using 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 DUSHIKAPSA;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Unity.Mathematics;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("m1r0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DUSHIKAPSA")]
[assembly: AssemblyTitle("DUSHIKAPSA")]
[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;
}
}
}
[HarmonyAfter(new string[] { "REPOAlchemy" })]
[HarmonyPriority(100)]
[HarmonyPatch(typeof(ExtractionPoint))]
public static class Patch_Extraction_KeepDushikapsa
{
[HarmonyPrefix]
[HarmonyPatch("DestroyTheFirstPhysObjectsInHaulList")]
private static bool Prefix_DestroyTheFirstPhysObjectsInHaulList(ExtractionPoint __instance)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
List<GameObject> dollarHaulList = RoundDirector.instance.dollarHaulList;
if (dollarHaulList == null || dollarHaulList.Count == 0)
{
return true;
}
GameObject val = dollarHaulList[0];
if (!Object.op_Implicit((Object)(object)val))
{
dollarHaulList.RemoveAt(0);
return false;
}
ExtractableItem component = val.GetComponent<ExtractableItem>();
if ((Object)(object)component == (Object)null)
{
return true;
}
dollarHaulList.RemoveAt(0);
if (SemiFunc.IsMasterClientOrSingleplayer() && Object.op_Implicit((Object)(object)__instance.safetySpawn))
{
val.transform.position = __instance.safetySpawn.position;
Rigidbody component2 = val.GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.velocity = Vector3.zero;
component2.angularVelocity = Vector3.zero;
}
RoundDirector instance = RoundDirector.instance;
instance.totalHaul += (int)component.value;
component.SetValue(0f);
val.GetComponent<DUSHIKAPSA_Controller>().SetBattery(0);
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch("DestroyAllPhysObjectsInHaulList")]
private static void Prefix_DestroyAllPhysObjectsInHaulList(ExtractionPoint __instance)
{
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
List<GameObject> list = RoundDirector.instance?.dollarHaulList;
if (list == null || list.Count == 0)
{
return;
}
List<GameObject> extractableItems = list.Where((GameObject x) => (Object)(object)x.GetComponent<ExtractableItem>() != (Object)null).ToList();
foreach (GameObject item in extractableItems)
{
ExtractableItem component = item.GetComponent<ExtractableItem>();
if ((Object)(object)component != (Object)null)
{
RoundDirector instance = RoundDirector.instance;
instance.totalHaul += (int)component.value;
component.SetValue(0f);
item.GetComponent<DUSHIKAPSA_Controller>().SetBattery(0);
}
}
list.RemoveAll((GameObject x) => extractableItems.Contains(x));
}
}
[HarmonyPatch(typeof(ItemBattery), "ChargeBattery")]
public static class Patch_ItemBattery_DisableCharging
{
private static bool Prefix(ItemBattery __instance)
{
if ((Object)(object)((Component)__instance).GetComponent<DUSHIKAPSA_Controller>() != (Object)null)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(BatteryVisualLogic), "BatteryVisuals")]
public static class Patch_BatteryVisualLogic_DisableVisualWarnings
{
private static bool Prefix(ItemBattery __instance)
{
if ((Object)(object)((Component)__instance).GetComponentInParent<DUSHIKAPSA_Controller>() != (Object)null)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChargingStation), "ChargeAreaCheck")]
internal static class ChargingStatioin_DisableCharging
{
[HarmonyPrefix]
private static bool Prefix(ChargingStation __instance, out List<DUSHIKAPSA_Controller> __state)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Collider[] source = Physics.OverlapBox(__instance.chargeArea.position, __instance.chargeArea.localScale / 2f, __instance.chargeArea.localRotation, LayerMask.op_Implicit(SemiFunc.LayerMaskGetPhysGrabObject()));
List<DUSHIKAPSA_Controller> list = (from x in source
select ((Component)x).GetComponentInParent<DUSHIKAPSA_Controller>() into x
where (Object)(object)x != (Object)null
select x).ToList();
foreach (DUSHIKAPSA_Controller item in list)
{
item.itemBattery.batteryBars = 0;
}
__state = list;
return true;
}
[HarmonyPostfix]
private static void Postfix(ChargingStation __instance, List<DUSHIKAPSA_Controller> __state)
{
foreach (DUSHIKAPSA_Controller item in __state)
{
item.itemBattery.batteryBars = item.capacity;
}
}
}
[HarmonyPatch(typeof(ItemDroneBattery), "Update")]
internal static class ChargingDrone_DisableCharging
{
private static readonly FieldRef<ItemDroneBattery, ItemDrone> _itemDrone = AccessTools.FieldRefAccess<ItemDroneBattery, ItemDrone>("itemDrone");
[HarmonyPrefix]
private static bool Prefix(ItemDroneBattery __instance)
{
ItemDrone val = _itemDrone.Invoke(__instance);
if (!val.magnetActive || !Object.op_Implicit((Object)(object)val.magnetTargetPhysGrabObject))
{
return true;
}
DUSHIKAPSA_Controller component = ((Component)val.magnetTargetPhysGrabObject).GetComponent<DUSHIKAPSA_Controller>();
if ((Object)(object)component != (Object)null)
{
val.MagnetActiveToggle(false);
}
return true;
}
}
[HarmonyPatch(typeof(PunManager), "SetItemNameLOGIC")]
internal static class Patch_PunManager_SetItemNameLOGIC
{
[HarmonyPostfix]
private static void Postfix(string name, int photonViewID, ItemAttributes _itemAttributes)
{
if (photonViewID == -1 && SemiFunc.IsMultiplayer())
{
return;
}
ItemAttributes val = _itemAttributes;
if (SemiFunc.IsMultiplayer())
{
val = ((Component)PhotonView.Find(photonViewID)).GetComponent<ItemAttributes>();
}
if ((Object)(object)_itemAttributes == (Object)null && !SemiFunc.IsMultiplayer())
{
return;
}
val.instanceName = name;
ExtractableItem component = ((Component)val).GetComponent<ExtractableItem>();
if (!Object.op_Implicit((Object)(object)component))
{
return;
}
StatsManager instance = StatsManager.instance;
if ((Object)(object)instance == (Object)null || !instance.dictionaryOfDictionaries.TryGetValue("m1r0.DUSHIKAPSA", out var value) || value == null)
{
return;
}
if (value.TryGetValue(name, out var value2))
{
if (!SemiFunc.RunIsLobby())
{
value[name] = (int)((float)value2 * component.valueKeptMultiplier);
}
component.value = value[name];
}
else if (!SemiFunc.RunIsShop())
{
int num2 = (value[name] = 0);
if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient())
{
PunManager.instance.UpdateStat("m1r0.DUSHIKAPSA", name, num2);
}
ItemBattery component2 = ((Component)val).GetComponent<ItemBattery>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.SetBatteryLife(0);
}
}
}
}
[HarmonyPatch(typeof(RoundDirector), "HaulCheck")]
public static class Patch_RoundDirector_HaulCheck_IncludeExtractableItem
{
private static bool Prefix(RoundDirector __instance)
{
__instance.currentHaul = 0;
List<GameObject> dollarHaulList = __instance.dollarHaulList;
if (dollarHaulList == null)
{
return false;
}
List<GameObject> list = new List<GameObject>();
foreach (GameObject item in dollarHaulList)
{
if (!Object.op_Implicit((Object)(object)item))
{
list.Add(item);
continue;
}
ValuableObject component = item.GetComponent<ValuableObject>();
if (Object.op_Implicit((Object)(object)component))
{
component.roomVolumeCheck.CheckSet();
if (!component.roomVolumeCheck.inExtractionPoint)
{
list.Add(item);
}
else
{
__instance.currentHaul += (int)component.dollarValueCurrent;
}
continue;
}
ExtractableItem component2 = item.GetComponent<ExtractableItem>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.roomVolumeCheck.CheckSet();
if (!component2.roomVolumeCheck.inExtractionPoint)
{
list.Add(item);
}
else
{
__instance.currentHaul += (int)component2.value;
}
}
else
{
list.Add(item);
}
}
foreach (GameObject item2 in list)
{
dollarHaulList.Remove(item2);
}
return false;
}
}
[HarmonyPatch(typeof(RoundDirector), "Update")]
public static class Patch_RoundDirector_Update_SafeHaul
{
private static bool Prefix(RoundDirector __instance)
{
__instance.currentHaul = 0;
__instance.currentHaulMax = 0;
List<GameObject> dollarHaulList = __instance.dollarHaulList;
if (dollarHaulList == null || dollarHaulList.Count == 0)
{
return false;
}
for (int num = dollarHaulList.Count - 1; num >= 0; num--)
{
GameObject val = dollarHaulList[num];
if (!Object.op_Implicit((Object)(object)val))
{
dollarHaulList.RemoveAt(num);
}
else
{
ValuableObject component = val.GetComponent<ValuableObject>();
if ((Object)(object)component != (Object)null)
{
__instance.currentHaul += (int)component.dollarValueCurrent;
__instance.currentHaulMax += (int)component.dollarValueOriginal;
}
else
{
ExtractableItem component2 = val.GetComponent<ExtractableItem>();
if ((Object)(object)component2 != (Object)null)
{
__instance.currentHaul += (int)component2.value;
__instance.currentHaulMax += (int)component2.value;
}
else
{
dollarHaulList.RemoveAt(num);
}
}
}
}
return false;
}
}
[HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")]
internal static class Patch_ShopManager_GetAllItemsFromStatsManager
{
[HarmonyPrefix]
private static void Prefix()
{
foreach (Item value in StatsManager.instance.itemDictionary.Values)
{
if (value.itemName == "DUSHIKAPSA - small")
{
value.maxPurchase = true;
value.maxPurchaseAmount = DUSHIKAPSA_Config.maxAmmountBought_Small.Value;
value.maxAmount = value.maxPurchaseAmount;
value.maxAmountInShop = math.min(DUSHIKAPSA_Config.maxInShop_Small.Value, value.maxPurchaseAmount);
}
else if (value.itemName == "DUSHIKAPSA - medium")
{
value.maxPurchase = true;
value.maxPurchaseAmount = DUSHIKAPSA_Config.maxAmmountBought_Medium.Value;
value.maxAmount = value.maxPurchaseAmount;
value.maxAmountInShop = math.min(DUSHIKAPSA_Config.maxInShop_Medium.Value, value.maxPurchaseAmount);
}
else if (value.itemName == "DUSHIKAPSA - large")
{
value.maxPurchase = true;
value.maxPurchaseAmount = DUSHIKAPSA_Config.maxAmmountBought_Large.Value;
value.maxAmount = value.maxPurchaseAmount;
value.maxAmountInShop = math.min(DUSHIKAPSA_Config.maxInShop_Large.Value, value.maxPurchaseAmount);
}
}
}
}
[HarmonyPatch(typeof(StatsManager), "Start")]
internal static class Patch_StatsManager_Start
{
[HarmonyPostfix]
private static void Postfix()
{
StatsManager instance = StatsManager.instance;
if (!((Object)(object)instance == (Object)null) && !instance.dictionaryOfDictionaries.ContainsKey("m1r0.DUSHIKAPSA"))
{
instance.dictionaryOfDictionaries.Add("m1r0.DUSHIKAPSA", new Dictionary<string, int>());
}
}
}
internal static class DushikapsaDict
{
internal const string DictName = "m1r0.DUSHIKAPSA";
}
namespace DUSHIKAPSA
{
[BepInPlugin("m1r0.DUSHIKAPSA", "DUSHIKAPSA", "1.0.0")]
public class DUSHIKAPSA : BaseUnityPlugin
{
internal static DUSHIKAPSA Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
DUSHIKAPSA_Config.Init(((BaseUnityPlugin)this).Config);
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
public static class DUSHIKAPSA_Config
{
public static ConfigEntry<int> maxAmmountBought_Small;
public static ConfigEntry<int> maxAmmountBought_Medium;
public static ConfigEntry<int> maxAmmountBought_Large;
public static ConfigEntry<int> maxInShop_Small;
public static ConfigEntry<int> maxInShop_Medium;
public static ConfigEntry<int> maxInShop_Large;
public static ConfigEntry<int> capacity_Small;
public static ConfigEntry<int> capacity_Medium;
public static ConfigEntry<int> capacity_Large;
public static ConfigEntry<float> ValueKeptMultiplier_Small;
public static ConfigEntry<float> ValueKeptMultiplier_Medium;
public static ConfigEntry<float> ValueKeptMultiplier_Large;
public static void Init(ConfigFile cfg)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Expected O, but got Unknown
maxAmmountBought_Small = cfg.Bind<int>("DUSHIKAPSA small", "maximum owned", 1, new ConfigDescription("sets how many of this item you can buy overall,\nif you have already bought this amount of this item, it will no longer spawn in shop.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
maxAmmountBought_Medium = cfg.Bind<int>("DUSHIKAPSA medium", "maximum owned", 1, new ConfigDescription("sets how many of this item you can buy overall,\nif you have already bought this amount of this item, it will no longer spawn in shop.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
maxAmmountBought_Large = cfg.Bind<int>("DUSHIKAPSA large", "maximum owned", 1, new ConfigDescription("sets how many of this item you can buy overall,\nif you have already bought this amount of this item, it will no longer spawn in shop.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
maxInShop_Small = cfg.Bind<int>("DUSHIKAPSA small", "max in shop", 1, new ConfigDescription("sets how many of this item can maximally spawm in one store.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
maxInShop_Medium = cfg.Bind<int>("DUSHIKAPSA medium", "max in shop", 1, new ConfigDescription("sets how many of this item can maximally spawm in one store.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
maxInShop_Large = cfg.Bind<int>("DUSHIKAPSA large", "max in shop", 1, new ConfigDescription("sets how many of this item can maximally spawm in one store.\nDefault: 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
capacity_Small = cfg.Bind<int>("DUSHIKAPSA small", "capacity", 3, new ConfigDescription("sets a capacity of how many orbs can this pouch absorb.\nDefault: 3", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
capacity_Medium = cfg.Bind<int>("DUSHIKAPSA medium", "capacity", 6, new ConfigDescription("sets a capacity of how many orbs can this pouch absorb.\nDefault: 6", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
capacity_Large = cfg.Bind<int>("DUSHIKAPSA large", "capacity", 9, new ConfigDescription("sets a capacity of how many orbs can this pouch absorb.\nDefault: 9", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
ValueKeptMultiplier_Small = cfg.Bind<float>("DUSHIKAPSA small", "value kept multiplier", 0.9f, new ConfigDescription("multiplier that multiplies your current value in a pouch when transfering to a new level.\nshould be set in range <0, 1>, but I'm not your mother, you may abuse this.\nDefault: 0.9", (AcceptableValueBase)null, Array.Empty<object>()));
ValueKeptMultiplier_Medium = cfg.Bind<float>("DUSHIKAPSA medium", "value kept multiplier", 0.7f, new ConfigDescription("multiplier that multiplies your current value in a pouch when transfering to a new level.\nshould be set in range <0, 1>, but I'm not your mother, you may abuse this.\nDefault: 0.7", (AcceptableValueBase)null, Array.Empty<object>()));
ValueKeptMultiplier_Large = cfg.Bind<float>("DUSHIKAPSA large", "value kept multiplier", 0.5f, new ConfigDescription("multiplier that multiplies your current value in a pouch when transfering to a new level.\nshould be set in range <0, 1>, but I'm not your mother, you may abuse this.\nDefault: 0.5", (AcceptableValueBase)null, Array.Empty<object>()));
}
}
internal class DUSHIKAPSA_Controller : MonoBehaviour
{
public enum Variant
{
SMALL,
MEDIUM,
LARGE
}
public Variant variant;
public int capacity;
public Color tint;
private PhotonView photonView;
internal ItemBattery itemBattery;
internal ExtractableItem extractableItem;
public GameObject smallPouch;
public GameObject mediumPouch;
public GameObject largePouch;
private static readonly int ColorId = Shader.PropertyToID("_Color");
private MaterialPropertyBlock _mpb;
private void Start()
{
photonView = ((Component)this).GetComponent<PhotonView>();
itemBattery = ((Component)this).GetComponent<ItemBattery>();
extractableItem = ((Component)this).GetComponent<ExtractableItem>();
itemBattery.isUnchargable = true;
itemBattery.chargeRate = 0f;
ApplyTint();
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (variant == Variant.SMALL)
{
SetCapacity(DUSHIKAPSA_Config.capacity_Small.Value);
extractableItem.SetMultiplier(DUSHIKAPSA_Config.ValueKeptMultiplier_Small.Value);
}
if (variant == Variant.MEDIUM)
{
SetCapacity(DUSHIKAPSA_Config.capacity_Medium.Value);
extractableItem.SetMultiplier(DUSHIKAPSA_Config.ValueKeptMultiplier_Medium.Value);
}
if (variant == Variant.LARGE)
{
SetCapacity(DUSHIKAPSA_Config.capacity_Large.Value);
extractableItem.SetMultiplier(DUSHIKAPSA_Config.ValueKeptMultiplier_Large.Value);
}
}
}
private void OnCollisionEnter(Collision collision)
{
if (!SemiFunc.IsMasterClientOrSingleplayer() || itemBattery.batteryLifeInt >= itemBattery.batteryBars)
{
return;
}
Transform root = collision.transform.root;
if (!((Object)(object)((Component)root).GetComponent<EnemyValuable>() != (Object)null))
{
return;
}
PhysGrabObject component = ((Component)root).GetComponent<PhysGrabObject>();
if (component.dead)
{
return;
}
ValuableObject component2 = ((Component)root).GetComponent<ValuableObject>();
float increment = (((Object)(object)component2 != (Object)null) ? component2.dollarValueCurrent : 1000f);
foreach (PhysGrabber item in new List<PhysGrabber>(component.playerGrabbing))
{
item.OverrideGrabRelease(photonView.ViewID, 0.5f);
}
((Component)root).GetComponent<PhysGrabObjectImpactDetector>().destroyDisable = false;
component.dead = true;
extractableItem.IncrementValue(increment);
SetBattery(itemBattery.batteryLifeInt + 1);
}
private void SetCapacity(int capacity)
{
//IL_0034: 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)
if (SemiFunc.IsMasterClient())
{
photonView.RPC("SetCapacityRPC", (RpcTarget)0, new object[1] { capacity });
}
else
{
SetCapacityRPC(capacity);
}
}
[PunRPC]
private void SetCapacityRPC(int capacity, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterAndOwnerOnlyRPC(_info, photonView))
{
this.capacity = capacity;
itemBattery.batteryBars = capacity;
}
}
public void SetBattery(int newCharge)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (SemiFunc.IsMasterClient())
{
photonView.RPC("SetBatteryRPC", (RpcTarget)0, new object[1] { newCharge });
}
else
{
SetBatteryRPC(newCharge);
}
}
}
[PunRPC]
private void SetBatteryRPC(int newCharge, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterAndOwnerOnlyRPC(_info, photonView))
{
newCharge = (int)Mathf.Round((float)newCharge * 100f / (float)capacity);
itemBattery.batteryLife = 1f;
itemBattery.SetBatteryLife(newCharge);
bool flag = newCharge < 33;
bool flag2 = newCharge > 66;
bool active = !flag && !flag2;
smallPouch.SetActive(flag);
mediumPouch.SetActive(active);
largePouch.SetActive(flag2);
}
}
public void ApplyTint()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
_mpb = new MaterialPropertyBlock();
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true);
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Material[] sharedMaterials = val.sharedMaterials;
if (sharedMaterials == null)
{
continue;
}
for (int j = 0; j < sharedMaterials.Length; j++)
{
Material val2 = sharedMaterials[j];
if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null) && ((Object)val2.shader).name.Contains("AddTint") && val2.HasProperty(ColorId))
{
val.GetPropertyBlock(_mpb, j);
_mpb.SetColor(ColorId, tint);
val.SetPropertyBlock(_mpb, j);
}
}
}
}
}
internal class ExtractableItem : MonoBehaviour
{
internal RoomVolumeCheck roomVolumeCheck;
internal PhotonView photonView;
internal PhysGrabObject physGrabObject;
private float inStartRoomCheckTimer;
private bool inStartRoom;
public float value;
public float valueKeptMultiplier;
private void Start()
{
photonView = ((Component)this).GetComponent<PhotonView>();
roomVolumeCheck = ((Component)this).GetComponent<RoomVolumeCheck>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
private void Update()
{
if (GameManager.instance.gameMode != 0 && !PhotonNetwork.IsMasterClient)
{
return;
}
if (inStartRoomCheckTimer > 0f)
{
inStartRoomCheckTimer -= Time.deltaTime;
return;
}
bool flag = false;
foreach (RoomVolume currentRoom in roomVolumeCheck.CurrentRooms)
{
if (currentRoom.Extraction)
{
if (!inStartRoom)
{
AddToDollarHaulList();
inStartRoom = true;
}
flag = true;
}
}
if (!flag && inStartRoom)
{
RemoveFromDollarHaulList();
inStartRoom = false;
}
inStartRoomCheckTimer = 0.5f;
}
private void LateUpdate()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (physGrabObject.grabbedLocal && !SemiFunc.RunIsShop())
{
WorldSpaceUIValue.instance.Show(physGrabObject, (int)value, false, Vector3.zero);
}
}
public void IncrementValue(float increment)
{
SetValue(value + increment);
}
public void SetValue(float newVal)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (SemiFunc.IsMasterClient())
{
photonView.RPC("SetValueRPC", (RpcTarget)0, new object[1] { newVal });
}
else
{
SetValueRPC(newVal);
}
}
}
[PunRPC]
private void SetValueRPC(float newVal, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterAndOwnerOnlyRPC(_info, photonView))
{
value = newVal;
SaveValueToStats();
}
}
public void SetMultiplier(float multiplier)
{
//IL_0034: 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)
if (SemiFunc.IsMasterClient())
{
photonView.RPC("SetMultiplierRPC", (RpcTarget)0, new object[1] { multiplier });
}
else
{
SetMultiplierRPC(multiplier);
}
}
[PunRPC]
private void SetMultiplierRPC(float multiplier, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterAndOwnerOnlyRPC(_info, photonView))
{
valueKeptMultiplier = multiplier;
}
}
private void SaveValueToStats()
{
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
ItemAttributes component = ((Component)this).GetComponent<ItemAttributes>();
if (!((Object)(object)component == (Object)null) && !string.IsNullOrEmpty(component.instanceName))
{
Dictionary<string, int> dictionary = StatsManager.instance.dictionaryOfDictionaries["m1r0.DUSHIKAPSA"];
dictionary[component.instanceName] = (int)value;
if (SemiFunc.IsMultiplayer())
{
PunManager.instance.UpdateStat("m1r0.DUSHIKAPSA", component.instanceName, (int)value);
}
}
}
private void AddToDollarHaulList()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.instance.gameMode == 1)
{
photonView.RPC("AddToDollarHaulListRPC", (RpcTarget)0, Array.Empty<object>());
}
else if (!RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
AddToDollarHaulListRPC();
}
}
[PunRPC]
public void AddToDollarHaulListRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info) && !RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Add(((Component)this).gameObject);
}
}
private void RemoveFromDollarHaulList()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (GameManager.instance.gameMode == 1)
{
photonView.RPC("RemoveFromDollarHaulListRPC", (RpcTarget)0, Array.Empty<object>());
}
else if (RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RemoveFromDollarHaulListRPC();
}
}
[PunRPC]
public void RemoveFromDollarHaulListRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info) && RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Remove(((Component)this).gameObject);
}
}
}
}