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 MultiplayerPriceScale v1.0.0
Repo_MutiplayerPriceScale.dll
Decompiled 4 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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: AssemblyTitle("Repo_MutiplayerPriceScale")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Repo_MutiplayerPriceScale")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b3c33cd8-1889-4330-aa55-6f304b93a68b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Repo_MutiplayerPriceScale; [BepInPlugin("Wan7.REPO.MutiplayerPriceScale", "Multiplayer Price Scale", "1.0.0")] [BepInProcess("REPO.exe")] public class Main : BaseUnityPlugin { internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("Wan7.REPO.MutiplayerPriceScale"); _harmony.PatchAll(); Log.LogInfo((object)"Wan7_Multiplayer Price Scale v1.0 已加载"); } } [HarmonyPatch(typeof(ItemAttributes))] [HarmonyPatch("GetValue")] public static class Patch_ItemAttributes_GetValue { private static readonly FieldRef<ItemAttributes, int> f_value = AccessTools.FieldRefAccess<ItemAttributes, int>("value"); private static readonly FieldInfo f_photonView = typeof(ItemAttributes).GetField("photonView", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo f_itemValueMin = typeof(ItemAttributes).GetField("itemValueMin", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo f_itemValueMax = typeof(ItemAttributes).GetField("itemValueMax", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo f_itemValueMultiplier = typeof(ShopManager).GetField("itemValueMultiplier", BindingFlags.Instance | BindingFlags.NonPublic); private const float UPGRADE_PER_PLAYER = 0.7f; private const float HEALTH_PER_PLAYER = 0.01f; private const float CRYSTAL_PER_PLAYER = 0.01f; private const float OTHER_PER_PLAYER = 0.6f; private static bool Prefix(ItemAttributes __instance) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Invalid comparison between Unknown and I4 //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Invalid comparison between Unknown and I4 //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) { return true; } try { float num = (float)f_itemValueMin.GetValue(__instance); float num2 = (float)f_itemValueMax.GetValue(__instance); float num3 = (float)f_itemValueMultiplier.GetValue(ShopManager.instance); float num4 = Random.Range(num, num2) * num3; if (num4 < 1000f) { num4 = 1000f; } itemType itemType = __instance.item.itemType; if ((int)itemType == 3) { num4 = ShopManager.instance.UpgradeValueGet(num4, __instance.item); } else if ((int)itemType == 8) { num4 = ShopManager.instance.HealthPackValueGet(num4) * 0.8f; } else if ((int)itemType == 5) { num4 = ShopManager.instance.CrystalValueGet(num4) * 0.8f; } int num5 = 1; try { num5 = SemiFunc.PlayerGetAll().Count; } catch { num5 = 1; } int num6 = Mathf.Max(num5 - 1, 0); float num7 = 0.6f; if ((int)itemType == 3) { num7 = 0.7f; } else if ((int)itemType == 8) { num7 = 0.01f; } else if ((int)itemType == 5) { num7 = 0.01f; } float num8 = 1f + num7 * (float)Mathf.Max(num6, 1); num4 *= num8; float value = Random.value; float num9 = Mathf.Pow(value, 3f); float num10 = num4 / 100f; float num11 = num4 * 2f; num4 = Mathf.Lerp(num11, num10, num9); if (Random.value < 0.01f) { f_value.Invoke(__instance) = 0; if (GameManager.Multiplayer()) { PhotonView val = (PhotonView)f_photonView.GetValue(__instance); if (val != null) { val.RPC("GetValueRPC", (RpcTarget)1, new object[1] { 0 }); } } return false; } if (num4 < 1000f) { num4 = 1000f; } num4 = Mathf.Ceil(num4 / 1000f); int num12 = (int)num4; f_value.Invoke(__instance) = num12; if (GameManager.Multiplayer()) { PhotonView val2 = (PhotonView)f_photonView.GetValue(__instance); if (val2 != null) { val2.RPC("GetValueRPC", (RpcTarget)1, new object[1] { num12 }); } } return false; } catch (Exception arg) { ManualLogSource log = Main.Log; if (log != null) { log.LogError((object)$"[PriceScale] 错误:{arg}"); } return true; } } }