using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
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 UnityEngine;
using UnityEngine.SceneManagement;
using VanillaUpgrades.Classes;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VanillaUpgrades")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VanillaUpgrades")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5e12a72d-c200-488d-940a-653d1003d96e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VanillaUpgrades
{
[BepInPlugin("bulletbot.vanillaupgrades", "VanillaUpgrades", "1.0.3")]
internal class Plugin : BaseUnityPlugin
{
private const string modGUID = "bulletbot.vanillaupgrades";
private const string modName = "VanillaUpgrades";
private const string modVer = "1.0.3";
internal static Plugin instance;
internal ManualLogSource logger;
private readonly Harmony harmony = new Harmony("bulletbot.vanillaupgrades");
internal List<UpgradeItem> upgradeItems;
internal static float UpgradeValueIncrease(float upgradeValueIncrease, string itemAssetName)
{
if ((Object)(object)VanillaUpgradesManager.instance == (Object)null)
{
return upgradeValueIncrease;
}
UpgradeItem upgradeItem = instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == itemAssetName);
if (upgradeItem == null)
{
return upgradeValueIncrease;
}
float num = upgradeItem.GetConfig<float>("Price Increase Scaling");
if (num < 0f)
{
num = upgradeValueIncrease;
}
return num;
}
internal bool Upgrade(ItemToggle itemToggle)
{
if ((Object)(object)VanillaUpgradesManager.instance == (Object)null)
{
return true;
}
UpgradeItem upgradeItem = upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == ((Component)itemToggle).gameObject.GetComponent<ItemAttributes>().item.itemAssetName);
if (upgradeItem == null)
{
return true;
}
if (upgradeItem.GetConfig<bool>("Allow Team Upgrades"))
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
VanillaUpgradesManager.instance.Upgrade(upgradeItem.name, SemiFunc.PlayerGetSteamID(item));
}
}
else
{
VanillaUpgradesManager.instance.Upgrade(upgradeItem.name, SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID((int)AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID").GetValue(itemToggle))));
}
return false;
}
private void Awake()
{
instance = this;
logger = Logger.CreateLogSource("VanillaUpgrades");
upgradeItems = new List<UpgradeItem>();
Item[] array = Resources.LoadAll<Item>("items/");
foreach (Item item in array)
{
UpgradeItem upgradeItem = new UpgradeItem();
if (upgradeItem.Init(item))
{
upgradeItems.Add(upgradeItem);
}
}
SceneManager.activeSceneChanged += delegate
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
if (!((Object)(object)RunManager.instance == (Object)null) && !((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu) && !((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu))
{
GameObject val = new GameObject("Vanilla Upgrades Manager");
PhotonView val2 = val.AddComponent<PhotonView>();
val2.ViewID = 1864;
val.AddComponent<VanillaUpgradesManager>();
}
};
logger.LogMessage((object)"VanillaUpgrades has started.");
harmony.PatchAll();
}
}
}
namespace VanillaUpgrades.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("VanillaUpgrades.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}
namespace VanillaUpgrades.Patches
{
[HarmonyPatch(typeof(ItemAttributes))]
internal class ItemAttributesPatch
{
[HarmonyPatch("GetValue")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> GetValueTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(ShopManager), "instance"), (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "upgradeValueIncrease"), (string)null)
});
val.Advance(1);
val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ItemAttributes), "itemAssetName")),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "UpgradeValueIncrease", (Type[])null, (Type[])null))
});
return val.InstructionEnumeration();
}
}
[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount))]
internal class ItemUpgradeMapPlayerCountPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch))]
internal class ItemUpgradePlayerTumbleLaunchPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed))]
internal class ItemUpgradePlayerSprintSpeedPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange))]
internal class ItemUpgradePlayerGrabRangePatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump))]
internal class ItemUpgradePlayerExtraJumpPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerHealth))]
internal class ItemUpgradePlayerHealthPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerEnergy))]
internal class ItemUpgradePlayerEnergyPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength))]
internal class ItemUpgradePlayerGrabStrengthPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool Upgrade(ItemToggle ___itemToggle)
{
return Plugin.instance.Upgrade(___itemToggle);
}
}
[HarmonyPatch(typeof(ShopManager))]
internal class ShopManagerPatch
{
[HarmonyPatch("GetAllItemsFromStatsManager")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> GetAllItemsFromStatsManagerTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Expected O, but got Unknown
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Dictionary<string, Item>.ValueCollection.Enumerator), "get_Current", (Type[])null, (Type[])null), (string)null)
});
object operand = val.Operand;
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Dictionary<string, Item>.ValueCollection.Enumerator), "get_Current", (Type[])null, (Type[])null), (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
});
val.Advance(1);
val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldloc_1, (object)null),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ShopManagerPatch), "GetAllItemsFromStatsManager", (Type[])null, (Type[])null)),
new CodeInstruction(OpCodes.Brtrue, operand)
});
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "upgradeValueIncrease"), (string)null)
});
val.Advance(1);
val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldloc_1, (object)null),
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Item), "itemAssetName")),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "UpgradeValueIncrease", (Type[])null, (Type[])null))
});
return val.InstructionEnumeration();
}
private static bool GetAllItemsFromStatsManager(Item item)
{
if ((Object)(object)VanillaUpgradesManager.instance == (Object)null)
{
return false;
}
UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == item.itemAssetName);
return upgradeItem != null && !upgradeItem.GetConfig<bool>("Enabled");
}
}
[HarmonyPatch(typeof(StatsManager))]
internal class StatsManagerPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void StartPrefix(StatsManager __instance)
{
foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems)
{
__instance.dictionaryOfDictionaries.Add("appliedPlayerUpgrade" + upgradeItem.saveName, upgradeItem.appliedPlayerUpgrades);
}
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPostfix(StatsManager __instance)
{
foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems)
{
if (__instance.dictionaryOfDictionaries.TryGetValue("playerUpgrade" + upgradeItem.saveName, out var value))
{
upgradeItem.playerUpgrades = value;
}
}
}
}
}
namespace VanillaUpgrades.Classes
{
internal class UpgradeItem
{
internal string name;
internal Dictionary<string, int> playerUpgrades;
internal Dictionary<string, int> appliedPlayerUpgrades;
internal string saveName;
internal MethodInfo updateRightAway;
internal string sectionName;
private Dictionary<string, ConfigEntryBase> configEntries;
public bool AddConfig<T>(string key, T defaultValue, string description = "")
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
if (configEntries.ContainsKey(key))
{
Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' already exists. Duplicates are not allowed."));
return false;
}
ConfigEntryBase val = null;
val = (ConfigEntryBase)(object)((defaultValue is int) ? ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())) : ((!(defaultValue is float)) ? ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, description) : ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 100000f), Array.Empty<object>()))));
configEntries.Add(key, val);
return true;
}
public T GetConfig<T>(string key)
{
if (!configEntries.TryGetValue(key, out var value))
{
Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' does not exist. Returning default value."));
return default(T);
}
if (value is ConfigEntry<T> val)
{
return val.Value;
}
Plugin.instance.logger.LogWarning((object)("Type mismatch for config entry '" + key + "'. Expected: " + value.SettingType.FullName + ", but got: " + typeof(T).FullName + ". Returning default value."));
return default(T);
}
public int GetAmount(string steamId = null)
{
if (steamId != null)
{
return playerUpgrades.ContainsKey(steamId) ? playerUpgrades[steamId] : 0;
}
PlayerAvatar val = SemiFunc.PlayerAvatarLocal();
if ((Object)(object)val != (Object)null)
{
steamId = SemiFunc.PlayerGetSteamID(val);
}
return (steamId != null && playerUpgrades.ContainsKey(steamId)) ? playerUpgrades[steamId] : 0;
}
internal bool Init(Item item)
{
name = item.itemAssetName;
string text = "Item Upgrade ";
if (!name.StartsWith(text))
{
return false;
}
string text2 = name.Replace(text, "");
bool flag = true;
switch (text2)
{
case "Player Health":
saveName = text2.Replace("Player ", "");
break;
case "Player Energy":
saveName = "Stamina";
break;
case "Player Extra Jump":
saveName = new string((from x in text2.Replace("Player ", "")
where !char.IsWhiteSpace(x)
select x).ToArray());
break;
case "Player Tumble Launch":
saveName = "Launch";
break;
case "Map Player Count":
saveName = new string(text2.Where((char x) => !char.IsWhiteSpace(x)).ToArray());
flag = false;
break;
case "Player Sprint Speed":
saveName = "Speed";
break;
case "Player Grab Strength":
saveName = "Strength";
break;
case "Player Grab Range":
saveName = "Range";
break;
}
if (saveName == null)
{
return false;
}
if (flag)
{
text2 = text2.Replace("Player ", "");
}
updateRightAway = AccessTools.Method(typeof(PunManager), "Update" + new string(text2.Where((char x) => !char.IsWhiteSpace(x)).ToArray()) + "RightAway", (Type[])null, (Type[])null);
sectionName = text2;
AddConfig("Enabled", defaultValue: true, "Whether the upgrade item can be spawned to the shop.");
AddConfig("Max Amount", item.maxAmount, "The maximum number of times the upgrade item can appear in the truck.");
AddConfig("Max Amount In Shop", item.maxAmountInShop, "The maximum number of times the upgrade item can appear in the shop.");
AddConfig("Minimum Price", item.value.valueMin, "The minimum cost to purchase the upgrade item.\nThe default price multiplier is set to 4. (Note: Other mods may modify this multiplier, affecting this upgrade item's price.)");
AddConfig("Maximum Price", item.value.valueMax, "The maximum cost to purchase the upgrade item.\nThe default price multiplier is set to 4. (Note: Other mods may modify this multiplier, affecting this upgrade item's price.)");
AddConfig("Price Increase Scaling", -1f, "The scale of the price increase based on the total number of upgrade item purchased.\nDefault scaling is set to 0.5. (Note: This value may be modified by other mods that adjust the game's default scaling.)\nSet to -1 to use the default scaling.");
AddConfig("Max Purchase Amount", item.maxPurchase ? item.maxPurchaseAmount : 0, "The maximum number of times the upgrade item can be purchased before it is no longer available in the shop.\nSet to 0 to disable the limit.");
AddConfig("Allow Team Upgrades", defaultValue: false, "Whether the upgrade item applies to the entire team instead of just one player.");
AddConfig("Sync Host Upgrades", defaultValue: false, "Whether the host should sync the item upgrade for the entire team.");
AddConfig("Starting Amount", 0, "The number of times the upgrade item is applied at the start of the game.");
item.maxAmount = GetConfig<int>("Max Amount");
item.maxAmountInShop = GetConfig<int>("Max Amount In Shop");
item.maxPurchaseAmount = GetConfig<int>("Max Purchase Amount");
item.maxPurchase = item.maxPurchaseAmount > 0;
item.value = ScriptableObject.CreateInstance<Value>();
item.value.valueMin = GetConfig<float>("Minimum Price");
item.value.valueMax = GetConfig<float>("Maximum Price");
return true;
}
internal UpgradeItem()
{
playerUpgrades = new Dictionary<string, int>();
appliedPlayerUpgrades = new Dictionary<string, int>();
configEntries = new Dictionary<string, ConfigEntryBase>();
}
}
internal class VanillaUpgradesManager : MonoBehaviour
{
internal static VanillaUpgradesManager instance;
internal PhotonView photonView;
private bool checkPlayerUpgrades;
private void Awake()
{
instance = this;
photonView = ((Component)this).GetComponent<PhotonView>();
if (SemiFunc.IsMasterClientOrSingleplayer())
{
((MonoBehaviour)this).StartCoroutine("WaitUntilLevel");
}
}
private void FixedUpdate()
{
if (!checkPlayerUpgrades)
{
return;
}
foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems)
{
int config = upgradeItem.GetConfig<int>("Starting Amount");
if (config >= 0)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
string text = SemiFunc.PlayerGetSteamID(item);
if (!upgradeItem.appliedPlayerUpgrades.ContainsKey(text))
{
upgradeItem.appliedPlayerUpgrades[text] = 0;
}
if (upgradeItem.appliedPlayerUpgrades[text] != config)
{
Upgrade(upgradeItem.name, text, config - upgradeItem.appliedPlayerUpgrades[text]);
upgradeItem.appliedPlayerUpgrades[text] = config;
}
}
}
if (!upgradeItem.GetConfig<bool>("Sync Host Upgrades"))
{
continue;
}
int amount = upgradeItem.GetAmount();
foreach (PlayerAvatar item2 in from x in SemiFunc.PlayerGetAll()
where (Object)(object)x != (Object)(object)SemiFunc.PlayerAvatarLocal()
select x)
{
string steamId = SemiFunc.PlayerGetSteamID(item2);
int amount2 = upgradeItem.GetAmount(steamId);
int num = amount - amount2;
if (num != 0)
{
Upgrade(upgradeItem.name, steamId, num);
}
}
}
}
private IEnumerator WaitUntilLevel()
{
yield return (object)new WaitUntil((Func<bool>)(() => SemiFunc.LevelGenDone()));
checkPlayerUpgrades = true;
}
internal void Upgrade(string upgradeItemName, string steamId, int amount = 1)
{
UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == upgradeItemName);
if (upgradeItem != null)
{
upgradeItem.playerUpgrades[steamId] += amount;
if (SemiFunc.IsMasterClientOrSingleplayer())
{
upgradeItem.updateRightAway.Invoke(PunManager.instance, new object[1] { steamId });
}
if (SemiFunc.IsMasterClient())
{
photonView.RPC("UpgradeRPC", (RpcTarget)1, new object[3]
{
upgradeItemName,
steamId,
upgradeItem.playerUpgrades[steamId]
});
}
}
}
[PunRPC]
internal void UpgradeRPC(string upgradeItemName, string steamId, int amount)
{
UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == upgradeItemName);
if (upgradeItem != null)
{
upgradeItem.playerUpgrades[steamId] = amount;
upgradeItem.updateRightAway.Invoke(PunManager.instance, new object[1] { steamId });
}
}
}
}