using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 REPOLib.Modules;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
[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("slenered")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+a42c1a9bb690d58aa498cfeccd8d04781e31588e")]
[assembly: AssemblyProduct("OrbBoosts")]
[assembly: AssemblyTitle("OrbBoosts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace OrbBoosts
{
public class Boosts : MonoBehaviour
{
public enum BoostState
{
Unused,
Used,
Golden,
Weapon,
Stealth
}
private static readonly int BaseColorID = Shader.PropertyToID("_BaseColor");
private static readonly int FresnelColorID = Shader.PropertyToID("_FresnelColor");
private static readonly int EmissionColorID = Shader.PropertyToID("_EmissionColor");
private static readonly int SmoothnessID = Shader.PropertyToID("_Smoothness");
private static readonly int FresnelPowerID = Shader.PropertyToID("_FresnelPower");
private ItemToggle _itemToggle = null;
private ItemAttributes _itemAttributes = null;
private PhotonView _photonView = null;
private ValuableObject _valuableObject = null;
internal EnemyValuable EnemyValuable = null;
private float _usedTimer;
private Color _orbColor;
private Color _orbEmissionColor;
private Color _orbFresnelColor;
private Color _goldFresnelColor = new Color(0.6792453f, 0.542977f, 0f);
private readonly Color _goldColor = new Color(0.8880594f, 1f, 0f, 0.682353f);
private readonly Color _weaponColor = new Color(0f, 0f, 0f, 16f / 51f);
private readonly Color _weaponEmissionColor = new Color(0f, 0f, 0f);
private readonly Color _weaponFresnelColor = new Color(0f, 0f, 0f, 1f);
private readonly Color _stealthColor = new Color(1f, 0f, 0.6594234f, 6f / 85f);
private readonly Color _stealthFresnelColor = new Color(1f, 1f, 1f, 0.4627451f);
private readonly Color _boostColor = new Color(0f, 0.9372549f, 1f, 16f / 51f);
private int _size;
private string _spawnWeapon = "";
public BoostState state = BoostState.Unused;
internal string ItemName = "Orb";
internal string EnemyName = "None";
internal void Start()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
string text = ((Object)this).name.Replace("(Clone)", "");
if (1 == 0)
{
}
int size = ((text == "Enemy Valuable - Big") ? 3 : ((!(text == "Enemy Valuable - Medium")) ? 1 : 2));
if (1 == 0)
{
}
_size = size;
_itemToggle = ComponentHolderProtocol.AddComponent<ItemToggle>((Object)(object)this);
_itemToggle.onToggle = new UnityEvent();
_itemAttributes = ComponentHolderProtocol.AddComponent<ItemAttributes>((Object)(object)this);
_photonView = ((Component)this).GetComponent<PhotonView>();
_orbColor = EnemyValuable.outerMaterial.GetColor(BaseColorID);
_orbEmissionColor = EnemyValuable.outerMaterial.GetColor(EmissionColorID);
_orbFresnelColor = EnemyValuable.fresnelColorDefault;
_valuableObject = ((Component)this).GetComponent<ValuableObject>();
EnemyValuable.outerMaterial.SetColor(BaseColorID, _boostColor);
_itemToggle.disabled = true;
_itemAttributes.item = ScriptableObject.CreateInstance<Item>();
_itemAttributes.item.itemType = (itemType)1;
_itemAttributes.item.value = ScriptableObject.CreateInstance<Value>();
_itemAttributes.item.value.valueMax = 1f;
_itemAttributes.item.value.valueMin = 0f;
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
if (_itemAttributes.item.itemName == "N/A")
{
_photonView.RPC("RequestNameRPC", (RpcTarget)2, Array.Empty<object>());
}
}
else
{
SetName(ItemName + "'s");
}
}
internal void Update()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
if (EnemyValuable.indestructibleLerp < 1f)
{
return;
}
if (state != 0)
{
if (_usedTimer <= 0f)
{
((Behaviour)this).enabled = false;
}
Remove();
_usedTimer -= Time.deltaTime;
Color val = _orbFresnelColor;
Color val2;
switch (state)
{
case BoostState.Golden:
val = Color.Lerp(_goldFresnelColor, _orbFresnelColor, _usedTimer);
val2 = Color.Lerp(_goldColor, _boostColor, _usedTimer);
break;
case BoostState.Weapon:
{
val = Color.Lerp(_weaponFresnelColor, _orbFresnelColor, _usedTimer);
val2 = Color.Lerp(_weaponColor, _boostColor, _usedTimer);
Color val3 = Color.Lerp(_weaponEmissionColor, _orbEmissionColor, _usedTimer);
EnemyValuable.outerMaterial.SetColor(EmissionColorID, val3);
EnemyValuable.outerMaterial.SetFloat(SmoothnessID, Mathf.Lerp(0f, 0.8f, _usedTimer));
break;
}
case BoostState.Stealth:
val = Color.Lerp(_stealthFresnelColor, _orbFresnelColor, _usedTimer);
val2 = Color.Lerp(_stealthColor, _boostColor, _usedTimer);
break;
default:
val2 = Color.Lerp(_orbColor, _boostColor, EnemyValuable.indestructibleCurve.Evaluate(_usedTimer));
break;
}
EnemyValuable.outerMaterial.SetColor(FresnelColorID, val);
EnemyValuable.outerMaterial.SetColor(BaseColorID, val2);
return;
}
_itemToggle.disabled = false;
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
if (_itemAttributes.item.itemName == "N/A")
{
_photonView.RPC("RequestNameRPC", (RpcTarget)2, Array.Empty<object>());
}
}
else if (state == BoostState.Unused && _itemToggle.toggleState)
{
TriggerRandomEffect();
}
}
private void TriggerRandomEffect()
{
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
if (state != 0)
{
return;
}
state = BoostState.Used;
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(_itemToggle.playerTogglePhotonID);
float num = Random.value;
if (InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.numpad0Key, 0f))
{
num = 0.51f;
}
else if (InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.numpad1Key, 0f))
{
num = 0.26f;
}
else if (InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.numpad2Key, 0f))
{
num = 0.16f;
}
else if (InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.numpad3Key, 0f))
{
num = 0.06f;
}
else if (InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current.numpad4Key, 0f))
{
num = 0.05f;
}
MonoBehaviour.print((object)$"RNG: {num} : {val.playerName}");
float num2 = num;
float num3 = num2;
if (!(num3 > 0.5f))
{
if (!(num3 > 0.25f))
{
if (!(num3 > 0.15f))
{
if (!(num3 > 0.05f))
{
if (num3 <= 0.05f)
{
GoldBoost();
}
}
else
{
RandomWeapon(Random.value);
}
}
else
{
StealthBoost();
}
}
else
{
RandomUpgrade(_itemToggle.playerTogglePhotonID);
}
}
else
{
num = Random.value;
int healAmount = Mathf.CeilToInt(20f * num * (float)_size + (float)(10 * _size));
HealBoost(_itemToggle.playerTogglePhotonID, healAmount);
}
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("TriggerRandomEffectRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
TriggerRandomEffectRPC();
}
}
private void HealBoost(int playerID, int healAmount)
{
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerID);
val.playerHealth.HealOther(healAmount, false);
if (!GameManager.Multiplayer() || val.isLocal)
{
HealBoostRPC(playerID, healAmount);
return;
}
_photonView.RPC("HealBoostRPC", (RpcTarget)0, new object[2] { playerID, healAmount });
}
[PunRPC]
private void HealBoostRPC(int playerID, int healAmount)
{
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerID);
MonoBehaviour.print((object)$"Healing {healAmount} : {val.playerName}");
if (val.isLocal)
{
if ((float)healAmount >= 25f)
{
CameraGlitch.Instance.PlayLongHeal();
}
else
{
CameraGlitch.Instance.PlayShortHeal();
}
}
}
private void GoldBoost()
{
float num = Mathf.Min(10f * Mathf.Pow(Mathf.Lerp(0.1f, 1f, Random.value) / 65f, 0.55f), 1f);
MonoBehaviour.print((object)$"GoldRNG: {num}");
float num2 = Mathf.Lerp(1.3f, 3f, num);
float num3 = _valuableObject.dollarValueOriginal * num2;
if (1 == 0)
{
}
string text = ((num <= 0.3f) ? "Slightly " : ((num > 9f) ? "Extremely " : ((!(num >= 0.7f)) ? "" : "Very ")));
if (1 == 0)
{
}
string text2 = text;
SetName(EnemyName + "'s " + text2 + "Golden");
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("GoldBoostRPC", (RpcTarget)0, new object[2] { num, num3 });
}
else
{
GoldBoostRPC(num, num3);
}
}
[PunRPC]
private void GoldBoostRPC(float rng, float newValue)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
_goldFresnelColor = Color.Lerp(_orbFresnelColor, _goldFresnelColor, rng);
_valuableObject.dollarValueCurrent = newValue;
state = BoostState.Golden;
}
private void SetValue(float value)
{
_valuableObject.dollarValueCurrent = value;
}
private void StealthBoost()
{
SetState(BoostState.Stealth);
SetName(EnemyName + "'s Stealth");
}
private void RandomWeapon(float rng)
{
SetState(BoostState.Weapon);
List<(string, (float, float, float))> weapons = WeaponStore.Weapons;
weapons.Sort(delegate((string, (float, float, float)) tuple, (string, (float, float, float)) valueTuple)
{
float num2 = ParseWeight(tuple.Item2, _size);
float value = ParseWeight(valueTuple.Item2, _size);
return num2.CompareTo(value);
});
string spawnWeapon = "";
foreach (var item in weapons)
{
float num = ParseWeight(item.Item2, _size);
if (num != 0f)
{
if (num < 0f)
{
break;
}
if (num >= rng)
{
(spawnWeapon, _) = item;
break;
}
rng -= num;
}
}
_spawnWeapon = spawnWeapon;
SetName(EnemyName + "'s Weapon");
SetValue(_valuableObject.dollarValueOriginal / 2f);
}
private void RandomUpgrade(int playerID)
{
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerID);
List<(string, (float, float, float))> boosts = UpgradeStore.Boosts;
boosts.Sort(delegate((string, (float, float, float)) tuple, (string, (float, float, float)) valueTuple)
{
float num5 = ParseWeight(tuple.Item2, _size);
float value = ParseWeight(valueTuple.Item2, _size);
return num5.CompareTo(value);
});
string key = SemiFunc.PlayerGetSteamID(val);
float num = 0f;
if (StatsManager.instance.playerUpgradeMapPlayerCount.ContainsKey(key) && StatsManager.instance.playerUpgradeMapPlayerCount[key] > 0)
{
num += ParseWeight(UpgradeStore.BoostDictionary["playerUpgradeMapPlayerCount"], _size) / (float)(UpgradeStore.BoostDictionary.Count - 1);
}
int num2 = (GameManager.Multiplayer() ? OrbBoosts.MultiplayerTempUpgradesAmount.Value : OrbBoosts.SingleplayerTempUpgradesAmount.Value);
string text = "";
for (int i = 0; i < num2; i++)
{
float num3 = Random.value;
string text2 = "";
foreach (var item in boosts)
{
float num4 = ParseWeight(item.Item2, _size) + num;
if (num4 <= 0f)
{
break;
}
if (num4 >= num3)
{
(text2, _) = item;
MonoBehaviour.print((object)("Result: " + text2));
if (text2 == text)
{
MonoBehaviour.print((object)"Duplicate upgrade, rerolling");
text = "";
text2 = "";
i--;
}
break;
}
num3 -= num4;
}
if (!(text2 == ""))
{
text = text2;
if (!GameManager.Multiplayer())
{
RandomUpgradeRPC(playerID, text2);
continue;
}
_photonView.RPC("RandomUpgradeRPC", (RpcTarget)0, new object[2] { playerID, text2 });
}
}
}
[PunRPC]
private void RandomUpgradeRPC(int playerID, string upgradeName, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerID);
string text = SemiFunc.PlayerGetSteamID(val);
if (SemiFunc.MasterOnlyRPC(_info))
{
UpgradeStore.BoostActions[upgradeName].Invoke(text);
if (val.isLocal)
{
StatsUI.instance.Fetch();
StatsUI.instance.ShowStats();
CameraGlitch.Instance.PlayUpgrade();
}
else
{
GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f);
}
if (!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient)
{
val.playerHealth.MaterialEffectOverride((Effect)0);
}
}
}
[PunRPC]
private void TriggerRandomEffectRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
Remove();
_usedTimer = 2f;
}
private void Remove()
{
_itemToggle.disabled = true;
if (state == BoostState.Unused)
{
state = BoostState.Used;
}
}
private static float ParseWeight((float, float, float) weight, int size)
{
if (1 == 0)
{
}
float result;
switch (size)
{
case 1:
(result, _, _) = weight;
break;
case 2:
result = weight.Item2;
break;
case 3:
result = weight.Item3;
break;
default:
result = -1f;
break;
}
if (1 == 0)
{
}
return result;
}
private void SetName(string orbName)
{
if (!GameManager.Multiplayer())
{
SetNameRPC(orbName);
return;
}
_photonView.RPC("SetNameRPC", (RpcTarget)0, new object[1] { orbName });
}
[PunRPC]
private void SetNameRPC(string orbName)
{
ItemName = orbName;
_itemAttributes.promptName = "";
_itemAttributes.item.itemName = ItemName + " Soul";
_itemAttributes.itemName = _itemAttributes.item.itemName;
((Object)this).name = _itemAttributes.item.itemName;
}
[PunRPC]
private void SetClientNameRPC(string orbName)
{
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
SetNameRPC(orbName);
}
}
[PunRPC]
private void RequestNameRPC()
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
string text = ItemName + "'s";
_photonView.RPC("SetClientNameRPC", (RpcTarget)0, new object[1] { text });
}
}
public void SetState(BoostState newState)
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("SetStateRPC", (RpcTarget)0, new object[1] { newState });
}
else
{
SetStateRPC(newState);
}
}
[PunRPC]
public void SetStateRPC(BoostState newState)
{
state = newState;
}
public void Extracted(Vector3 position)
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
switch (state)
{
case BoostState.Golden:
{
GameObject val3 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject("Valuables/Surplus Valuable - Small", position, ((Component)this).transform.rotation, (byte)0, (object[])null) : Object.Instantiate<GameObject>(AssetManager.instance.surplusValuableSmall, position, ((Component)this).transform.rotation));
val3.GetComponent<ValuableObject>().dollarValueOverride = (int)_valuableObject.dollarValueCurrent / 2;
val3.AddComponent<Unextractable>();
break;
}
case BoostState.Weapon:
{
GameObject val2 = WeaponStore.SpawnItem(_spawnWeapon, position, ((Component)this).transform.rotation);
if (Object.op_Implicit((Object)(object)val2))
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("SetUnrechargeableRPC", (RpcTarget)0, new object[1] { val2.GetComponent<PhotonView>().ViewID });
}
else
{
SetUnrechargeable(val2);
}
}
break;
}
case BoostState.Stealth:
{
GameObject val = NetworkPrefabs.SpawnNetworkPrefab(NetworkPrefabs.GetNetworkPrefabRef("Items/Item Drone Temporary Stealth"), position, ((Component)this).transform.rotation, (byte)0, (object[])null);
ItemDroneTemporaryStealth component = val.GetComponent<ItemDroneTemporaryStealth>();
if (SemiFunc.IsMultiplayer())
{
((Component)component).GetComponent<PhotonView>().RPC("SetStealthDurationRPC", (RpcTarget)0, new object[1] { 40f * (float)_size });
}
else
{
component.StealthDuration = 40f * (float)_size;
}
break;
}
case BoostState.Unused:
case BoostState.Used:
break;
}
}
public void SetUnrechargeable(GameObject weapon)
{
weapon.AddComponent<Unrechargeable>();
ItemBattery component = weapon.GetComponent<ItemBattery>();
component.isUnchargable = true;
}
[PunRPC]
public void SetUnrechargeableRPC(int weaponID)
{
GameObject gameObject = ((Component)PhotonNetwork.GetPhotonView(weaponID)).gameObject;
gameObject.AddComponent<Unrechargeable>();
ItemBattery component = gameObject.GetComponent<ItemBattery>();
component.isUnchargable = true;
}
}
internal static class BuildInfo
{
public const string Version = "1.0.4";
}
public class ItemDroneTemporaryStealth : MonoBehaviour
{
private ItemToggle _itemToggle = null;
private ItemAttributes _itemAttributes = null;
private ItemDrone _itemDrone = null;
private PhysGrabObject _myPhysGrabObject = null;
private ItemEquippable _itemEquippable = null;
private ItemBattery _itemBattery = null;
private Unrechargeable _unrechargeable = null;
private float _timeSince = 0f;
internal float StealthDuration = 40f;
internal void Start()
{
_itemToggle = ((Component)this).GetComponent<ItemToggle>();
_itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
_itemDrone = ((Component)this).GetComponent<ItemDrone>();
_myPhysGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
_itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
_itemBattery = ((Component)this).GetComponent<ItemBattery>();
_unrechargeable = ((Component)this).GetComponent<Unrechargeable>();
_itemDrone.batteryDrainPreset.batteryDrainRate = _itemBattery.batteryLife / StealthDuration / 2f;
_itemBattery.batteryDrainRate = _itemDrone.batteryDrainPreset.batteryDrainRate;
}
internal void Update()
{
if (_itemEquippable.isEquipped)
{
return;
}
ItemDrone itemDrone = _itemDrone;
if (itemDrone != null && itemDrone.itemActivated && itemDrone.magnetActive && Object.op_Implicit((Object)(object)_itemDrone.playerAvatarTarget))
{
PlayerAvatar playerAvatarTarget = _itemDrone.playerAvatarTarget;
OrbBoosts.Instance.StealthTimer[playerAvatarTarget.steamID] = 0.1f;
if (_timeSince >= StealthDuration)
{
_unrechargeable.DestroyObject();
}
_timeSince += Time.deltaTime;
}
if ((GameManager.instance.gameMode != 1 || PhotonNetwork.IsMasterClient) && _itemDrone.itemActivated)
{
_myPhysGrabObject.OverrideZeroGravity(0.1f);
_myPhysGrabObject.OverrideDrag(1f, 0.1f);
_myPhysGrabObject.OverrideAngularDrag(10f, 0.1f);
}
}
[PunRPC]
public void SetStealthDurationRPC(float duration)
{
StealthDuration = duration;
}
}
[BepInPlugin("slenered.OrbBoosts", "OrbBoosts", "1.0.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class OrbBoosts : BaseUnityPlugin
{
internal static class Patches
{
[HarmonyPatch(typeof(EnemyValuable), "Start")]
[HarmonyPostfix]
internal static void EnemyValuableStart(EnemyValuable __instance)
{
Boosts orAddComponent = ComponentHolderProtocol.GetOrAddComponent<Boosts>((Object)(object)__instance);
orAddComponent.EnemyValuable = __instance;
}
[HarmonyPatch(typeof(GameDirector), "SetStart")]
[HarmonyPostfix]
internal static void GameDirectorSetStart(GameDirector __instance)
{
WeaponStore.Init();
foreach (KeyValuePair<string, Dictionary<string, int>> playerStat in UpgradeStore.PlayerStats)
{
foreach (KeyValuePair<string, int> item in playerStat.Value)
{
if (UpgradeStore.PlayerStats.ContainsKey(playerStat.Key))
{
UpgradeStore.ResetActions[playerStat.Key].Invoke(item.Key);
}
}
playerStat.Value.Clear();
}
foreach (PlayerAvatar player in __instance.PlayerList)
{
if (player.steamID != null)
{
Instance.StealthTimer[player.steamID] = 0.1f;
}
}
}
[HarmonyPatch(typeof(ValuableObject), "AddToDollarHaulList")]
[HarmonyPrefix]
internal static bool AddToDollarHaulList(ValuableObject __instance)
{
Component val = default(Component);
if (((Component)__instance).gameObject.TryGetComponent(typeof(Unextractable), ref val))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(ValuableObject), "AddToDollarHaulListRPC")]
[HarmonyPrefix]
internal static bool AddToDollarHaulListRPC(ValuableObject __instance)
{
Component val = default(Component);
if (((Component)__instance).gameObject.TryGetComponent(typeof(Unextractable), ref val))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(ExtractionPoint), "DestroyTheFirstPhysObjectsInHaulList")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> DestroyTheFirstPhysObjectsInHaulListTranspiler(IEnumerable<CodeInstruction> instructions)
{
return DestroyObjectsTranspiler(instructions);
}
[HarmonyPatch(typeof(ExtractionPoint), "DestroyAllPhysObjectsInHaulList")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> DestroyAllPhysObjectsInHaulListTranspiler(IEnumerable<CodeInstruction> instructions)
{
return DestroyObjectsTranspiler(instructions);
}
private static IEnumerable<CodeInstruction> DestroyObjectsTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(PhysGrabObject), "DestroyPhysGrabObject", (Type[])null, (Type[])null), (string)null)
}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "DestroyPhysGrabObject", (Type[])null, (Type[])null)).InstructionEnumeration();
}
[HarmonyPatch(typeof(StatsUI), "Fetch")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> StatsUIFetch(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"<b>", (string)null)
}).RemoveInstruction().SetOpcodeAndAdvance(OpCodes.Ldloc_S)
.RemoveInstructions(6)
.Insert((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "ReportStats", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
[HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")]
[HarmonyPostfix]
internal static void PlayerAvatarPlayerDeathRPC(PlayerAvatar __instance)
{
Instance.StealthTimer[__instance.steamID] = 0.1f;
}
[HarmonyPatch(typeof(EnemyParent), "Despawn")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> EnemyParentDespawnPatch(IEnumerable<CodeInstruction> instructions)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
MethodInfo methodInfo = typeof(Object).GetMethods(BindingFlags.Static | BindingFlags.Public).First((MethodInfo m) => m.Name == "Instantiate" && m.IsGenericMethodDefinition && m.GetParameters().Length == 3);
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo.MakeGenericMethod(typeof(GameObject)), (string)null)
}).RemoveInstruction().Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyParent), "enemyName")),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "Instantiate", (Type[])null, (Type[])null))
})
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(PhotonNetwork), "InstantiateRoomObject", (Type[])null, (Type[])null), (string)null)
})
.RemoveInstruction()
.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyParent), "enemyName")),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "InstantiateRoomObject", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
[HarmonyPatch(typeof(ChargingStation), "ChargeAreaCheck")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> ChargingStationChargeAreaCheck(IEnumerable<CodeInstruction> instructions)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
Label label = default(Label);
int a = 0;
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((Func<CodeInstruction, bool>)delegate(CodeInstruction i)
{
if (i.opcode == OpCodes.Bge && i.operand is Label label2 && a != 0)
{
label = label2;
return true;
}
if (i.opcode == OpCodes.Bge)
{
a++;
}
return false;
}, (string)null)
}).Advance(-3).RemoveInstructions(4)
.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "CanCharge", (Type[])null, (Type[])null)),
new CodeInstruction(OpCodes.Brfalse, (object)label)
})
.InstructionEnumeration();
}
[HarmonyPatch(typeof(PlayerVoiceChat), "Update")]
[HarmonyTranspiler]
internal static IEnumerable<CodeInstruction> PlayerVoiceChatUpdate(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null)
}).RemoveInstruction().Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Patches), "PlayerIsSilent", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
internal static IEnumerable<CodeInstruction> EnemyVisionVision(IEnumerable<CodeInstruction> instructions)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Expected O, but got Unknown
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Expected O, but got Unknown
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Expected O, but got Unknown
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
return new CodeMatcher((IEnumerable<CodeInstruction>)list, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldelem_U1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null)
}).SetAndAdvance(OpCodes.Ldloc_1, (object)null).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)21),
new CodeInstruction(OpCodes.Ldloc_S, (object)19),
new CodeInstruction(OpCodes.Ldloc_S, (object)4)
})
.Advance(3)
.RemoveInstruction()
.Advance(1)
.RemoveInstruction()
.Insert((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "VisionTrigger", (Type[])null, (Type[])null))
})
.Start()
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyVision), "VisionsToTrigger"), (string)null)
})
.Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
matcher.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)19),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "VisionsToTrigger", (Type[])null, (Type[])null))
});
}, (Action<string>)null)
.Start()
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyVision), "VisionsToTriggerCrouch"), (string)null)
})
.Advance(1)
.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)19),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "VisionsToTrigger", (Type[])null, (Type[])null))
})
.Start()
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyVision), "VisionsToTriggerCrawl"), (string)null)
})
.Advance(1)
.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldloc_S, (object)19),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OrbBoosts), "VisionsToTrigger", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
private static bool IsSilent(string steamID)
{
if (Instance.StealthTimer.TryGetValue(steamID, out var value))
{
return value <= 0f;
}
return true;
}
internal static bool PlayerIsSilent(PlayerVoiceChat instance)
{
if (Instance.StealthTimer.TryGetValue(instance.playerAvatar.steamID, out var value))
{
return value <= 0f;
}
return true;
}
[HarmonyPatch(typeof(PlayerAvatar), "Land")]
[HarmonyPrefix]
internal static bool PlayerAvatarLandPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "Jump")]
[HarmonyPrefix]
internal static bool PlayerAvatarJumpPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "Footstep")]
[HarmonyPrefix]
internal static bool PlayerAvatarFootstepPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "Slide")]
[HarmonyPrefix]
internal static bool PlayerAvatarSlidePatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "StandToCrouch")]
[HarmonyPrefix]
internal static bool PlayerAvatarStandToCrouchPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "CrouchToStand")]
[HarmonyPrefix]
internal static bool PlayerAvatarCrouchToStandPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "CrouchToCrawl")]
[HarmonyPrefix]
internal static bool PlayerAvatarStandToCrawlPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "CrawlToCrouch")]
[HarmonyPrefix]
internal static bool PlayerAvatarCrawlToCrouchPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "TumbleStart")]
[HarmonyPrefix]
internal static bool PlayerAvatarTumbleStartPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "TumbleStop")]
[HarmonyPrefix]
internal static bool PlayerAvatarTumbleStopPatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(PlayerAvatar), "TumbleBreakFree")]
[HarmonyPrefix]
internal static bool PlayerAvatarTumbleBreakFreePatch(PlayerAvatar __instance)
{
return IsSilent(__instance.steamID);
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerGrabStrengthUpgrade(ItemUpgradePlayerGrabStrength __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeStrength"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeStrength"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerHealth), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerHealthUpgrade(ItemUpgradePlayerHealth __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeHealth"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeHealth"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerSprintSpeedUpgrade(ItemUpgradePlayerSprintSpeed __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeSpeed"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeSpeed"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerTumbleLaunchUpgrade(ItemUpgradePlayerTumbleLaunch __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeLaunch"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeLaunch"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleWings), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerTumbleWingsUpgrade(ItemUpgradePlayerTumbleWings __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeTumbleWings"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeTumbleWings"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradeMapPlayerCountUpgrade(ItemUpgradeMapPlayerCount __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeMapPlayerCount"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeMapPlayerCount"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerCrouchRest), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerCrouchRestUpgrade(ItemUpgradeMapPlayerCount __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeCrouchRest"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeCrouchRest"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerEnergy), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerEnergyUpgrade(ItemUpgradePlayerEnergy __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeStamina"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeStamina"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerExtraJumpUpgrade(ItemUpgradePlayerExtraJump __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeExtraJump"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeExtraJump"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerGrabRangeUpgrade(ItemUpgradePlayerGrabRange __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeRange"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeRange"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleClimb), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradePlayerTumbleClimbUpgrade(ItemUpgradePlayerTumbleClimb __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeTumbleClimb"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeTumbleClimb"][key]++;
}
}
[HarmonyPatch(typeof(ItemUpgradeDeathHeadBattery), "Upgrade")]
[HarmonyPostfix]
internal static void ItemUpgradeDeathHeadBatteryUpgrade(ItemUpgradeDeathHeadBattery __instance)
{
string key = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(__instance.itemToggle.playerTogglePhotonID));
if (UpgradeStore.PlayerStats["playerUpgradeDeathHeadBattery"].ContainsKey(key))
{
UpgradeStore.PlayerStats["playerUpgradeDeathHeadBattery"][key]++;
}
}
}
public readonly Dictionary<string, float> StealthTimer = new Dictionary<string, float>();
public static ConfigEntry<int> SingleplayerTempUpgradesAmount;
public static ConfigEntry<int> MultiplayerTempUpgradesAmount;
internal static OrbBoosts Instance { get; private set; }
public static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
private Harmony? Harmony { get; set; }
private void Awake()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
SingleplayerTempUpgradesAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Boosts", "Singleplayer Temporary Upgrades", 2, new ConfigDescription("How many upgrades should you get each time you get a Upgrade Boost in singleplayer", (AcceptableValueBase)null, Array.Empty<object>()));
MultiplayerTempUpgradesAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Boosts", "Multiplayer Temporary Upgrades", 1, new ConfigDescription("How many upgrades should you get each time you get a Upgrade Boost in multiplayer", (AcceptableValueBase)null, Array.Empty<object>()));
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
private void Patch()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//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;
}
Type type = AccessTools.Inner(typeof(EnemyVision), "<Vision>d__34");
MethodInfo methodInfo = AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null);
Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyVisionVision", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null);
Harmony.PatchAll(typeof(Patches));
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
internal static bool CanCharge(ItemBattery item)
{
Unrechargeable component = ((Component)item).GetComponent<Unrechargeable>();
return (Object)(object)component == (Object)null && item.batteryLifeInt < item.batteryBars;
}
internal static GameObject Instantiate(GameObject original, Vector3 position, Quaternion rotation, string name)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(original, position, rotation);
Boosts orAddComponent = ComponentHolderProtocol.GetOrAddComponent<Boosts>((Object)(object)val);
orAddComponent.ItemName = name;
orAddComponent.EnemyName = name;
return val;
}
internal static GameObject InstantiateRoomObject(string prefabName, Vector3 position, Quaternion rotation, byte group = 0, object[] data = null, string name = "Orb")
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PhotonNetwork.InstantiateRoomObject(prefabName, position, rotation, group, data);
Boosts orAddComponent = ComponentHolderProtocol.GetOrAddComponent<Boosts>((Object)(object)val);
orAddComponent.ItemName = name;
orAddComponent.EnemyName = name;
return val;
}
internal static void DestroyPhysGrabObject(PhysGrabObject physGrabObject)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
try
{
Component val = default(Component);
if (!((Component)physGrabObject).gameObject.TryGetComponent(typeof(Unextractable), ref val))
{
Component val2 = default(Component);
if (((Component)physGrabObject).gameObject.TryGetComponent(typeof(Boosts), ref val2))
{
Boosts boosts = (Boosts)(object)val2;
boosts.Extracted(((Component)boosts).transform.position + Vector3.up);
}
physGrabObject.DestroyPhysGrabObject();
}
}
catch (Exception ex)
{
Debug.LogError((object)("DestroyPhysGrabObject: " + ex));
}
}
internal static bool VisionTrigger(EnemyVision instance, int playerID, PlayerAvatar player, bool sawPhysObj, bool flag4, bool playerNear)
{
float value;
return (sawPhysObj || flag4 || playerNear) && (!Instance.StealthTimer.TryGetValue(player.steamID, out value) || !(value > 0f) || instance.VisionTriggered[playerID] || sawPhysObj);
}
internal static string ReportStats(string text, KeyValuePair<string, int> stat)
{
string key = "playerUpgrade" + stat.Key.Replace(" ", "");
if (!UpgradeStore.PlayerStats.TryGetValue(key, out Dictionary<string, int> value))
{
return $"{text}<b>{stat.Value}\n</b>";
}
if (!value.TryGetValue(PlayerController.instance.playerSteamID, out var value2))
{
value2 = stat.Value;
}
string arg = ((stat.Value - value2 > 0) ? $" <color=#f36a62>+ {stat.Value - value2}</color>" : "");
return $"{text}<b>{value2}{arg}\n</b>";
}
internal static int VisionsToTrigger(int toTrigger, PlayerAvatar player)
{
float valueOrDefault = Instance.StealthTimer.GetValueOrDefault(player.steamID, 0f);
return (valueOrDefault > 0f) ? 30 : toTrigger;
}
private void Update()
{
foreach (string item in from invisKey in StealthTimer.Keys.ToList()
where StealthTimer[invisKey] > 0f
select invisKey)
{
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(item);
if (!Object.op_Implicit((Object)(object)val))
{
break;
}
StealthTimer[item] -= Time.deltaTime;
StealthTimer[item] = Mathf.Max(0f, StealthTimer[item]);
bool flag = StealthTimer[item] <= 0f;
if ((Object)(object)PlayerAvatar.instance != (Object)(object)val)
{
val.playerAvatarVisuals.meshParent.SetActive(flag);
}
((Component)val.playerAvatarVisuals.playerAvatarRightArm.grabberClawParent).gameObject.SetActive(flag);
ComponentHolderProtocol.GameObject((Object)(object)val.playerAvatarVisuals.playerAvatarRightArm.grabberOrb).SetActive(flag && val.physGrabber.grabbed);
((Component)val.flashlightController.mesh).gameObject.SetActive(flag);
}
}
}
public class Unextractable : MonoBehaviour
{
private PhysGrabObjectImpactDetector _impactDetector = null;
private PhysGrabObject _physGrabObject = null;
public bool becomesExtractable = true;
public float unextractableTimer = 3f;
private void Awake()
{
_impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
private void Update()
{
if (RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Remove(((Component)this).gameObject);
}
foreach (RoomVolume item in _physGrabObject.roomVolumeCheck.CurrentRooms.Where((RoomVolume currentRoom) => !currentRoom.Extraction))
{
if (becomesExtractable)
{
unextractableTimer -= Time.deltaTime;
if (unextractableTimer <= 0f)
{
_impactDetector.destroyDisable = false;
Object.Destroy((Object)(object)this);
}
}
}
if (becomesExtractable)
{
_impactDetector.destroyDisable = true;
}
}
}
public class Unrechargeable : MonoBehaviour
{
private PhysGrabObject _physGrabObject = null;
private ItemBattery _itemBattery = null;
private readonly Color _batteryColor = new Color(0.3333333f, 0f, 0f);
private float _despawnTimer = 10f;
private void Start()
{
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
_itemBattery = ((Component)_physGrabObject).GetComponent<ItemBattery>();
}
private void Update()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
if ((Object.op_Implicit((Object)(object)_itemBattery.itemAttributes.colorPreset) && _itemBattery.itemAttributes.colorPreset.colorMain != _batteryColor) || _itemBattery.batteryColorMedium != _batteryColor)
{
ColorPresets val = ScriptableObject.CreateInstance<ColorPresets>();
val.colorDark = _itemBattery.itemAttributes.colorPreset.colorDark;
val.colorLight = _itemBattery.itemAttributes.colorPreset.colorLight;
val.colorMain = _batteryColor;
_itemBattery.itemAttributes.colorPreset = val;
_itemBattery.batteryColorMedium = _batteryColor;
}
if (_itemBattery.batteryLifeInt <= 0)
{
_despawnTimer -= Time.deltaTime;
if (_despawnTimer <= 0f)
{
DestroyObject(Object.op_Implicit((Object)(object)((Component)this).gameObject));
}
}
}
public void DestroyObject(bool effects = true)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && !_physGrabObject.dead)
{
_physGrabObject.dead = true;
if (!SemiFunc.IsMultiplayer())
{
_physGrabObject.impactDetector.DestroyObjectRPC(effects, default(PhotonMessageInfo));
return;
}
_physGrabObject.impactDetector.photonView.RPC("DestroyObjectRPC", (RpcTarget)0, new object[1] { effects });
}
}
}
public static class UpgradeStore
{
internal static Dictionary<string, Dictionary<string, int>> PlayerStats;
internal static readonly Dictionary<string, (float, float, float)> BoostDictionary;
internal static readonly List<(string, (float, float, float))> Boosts;
private static readonly UnityEvent<string> UpgradePlayerHealthEvent;
private static readonly UnityEvent<string> UpgradePlayerEnergyEvent;
private static readonly UnityEvent<string> UpgradePlayerExtraJumpEvent;
private static readonly UnityEvent<string> UpgradeMapPlayerCountEvent;
private static readonly UnityEvent<string> UpgradePlayerTumbleLaunchEvent;
private static readonly UnityEvent<string> UpgradePlayerTumbleWingsEvent;
private static readonly UnityEvent<string> UpgradePlayerSprintSpeedEvent;
private static readonly UnityEvent<string> UpgradePlayerCrouchRestEvent;
private static readonly UnityEvent<string> UpgradePlayerGrabStrengthEvent;
private static readonly UnityEvent<string> UpgradePlayerGrabRangeEvent;
private static readonly UnityEvent<string> UpgradePlayerTumbleClimbEvent;
private static readonly UnityEvent<string> UpgradeDeathHeadBatteryEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerHealthEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerEnergyEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerExtraJumpEvent;
private static readonly UnityEvent<string> ResetUpgradeMapPlayerCountEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerTumbleLaunchEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerTumbleWingsEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerSprintSpeedEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerCrouchRestEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerGrabStrengthEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerGrabRangeEvent;
private static readonly UnityEvent<string> ResetUpgradePlayerTumbleClimbEvent;
private static readonly UnityEvent<string> ResetUpgradeDeathHeadBatteryEvent;
internal static readonly Dictionary<string, UnityEvent<string>> BoostActions;
internal static readonly Dictionary<string, UnityEvent<string>> ResetActions;
static UpgradeStore()
{
PlayerStats = new Dictionary<string, Dictionary<string, int>>
{
{
"playerUpgradeStrength",
new Dictionary<string, int>()
},
{
"playerUpgradeHealth",
new Dictionary<string, int>()
},
{
"playerUpgradeSpeed",
new Dictionary<string, int>()
},
{
"playerUpgradeStamina",
new Dictionary<string, int>()
},
{
"playerUpgradeExtraJump",
new Dictionary<string, int>()
},
{
"playerUpgradeRange",
new Dictionary<string, int>()
},
{
"playerUpgradeCrouchRest",
new Dictionary<string, int>()
},
{
"playerUpgradeTumbleWings",
new Dictionary<string, int>()
},
{
"playerUpgradeLaunch",
new Dictionary<string, int>()
},
{
"playerUpgradeMapPlayerCount",
new Dictionary<string, int>()
},
{
"playerUpgradeTumbleClimb",
new Dictionary<string, int>()
},
{
"playerUpgradeDeathHeadBattery",
new Dictionary<string, int>()
}
};
BoostDictionary = new Dictionary<string, (float, float, float)>
{
{
"playerUpgradeStrength",
(0.02f, 0.05f, 0.2f)
},
{
"playerUpgradeHealth",
(0.02f, 0.08f, 0.2f)
},
{
"playerUpgradeSpeed",
(0.05f, 0.08f, 0.1f)
},
{
"playerUpgradeStamina",
(0.05f, 0.1f, 0.1f)
},
{
"playerUpgradeExtraJump",
(0.08f, 0.14f, 0.1f)
},
{
"playerUpgradeRange",
(0.08f, 0.14f, 0.09f)
},
{
"playerUpgradeCrouchRest",
(0.1f, 0.1f, 0.08f)
},
{
"playerUpgradeTumbleWings",
(0.1f, 0.08f, 0.06f)
},
{
"playerUpgradeLaunch",
(0.1f, 0.08f, 0.02f)
},
{
"playerUpgradeTumbleClimb",
(0.1f, 0.05f, 0.02f)
},
{
"playerUpgradeDeathHeadBattery",
(0.15f, 0.05f, 0.02f)
},
{
"playerUpgradeMapPlayerCount",
(0.15f, 0.05f, 0.01f)
}
};
Boosts = new List<(string, (float, float, float))>(12)
{
("playerUpgradeStrength", BoostDictionary["playerUpgradeStrength"]),
("playerUpgradeHealth", BoostDictionary["playerUpgradeHealth"]),
("playerUpgradeSpeed", BoostDictionary["playerUpgradeSpeed"]),
("playerUpgradeStamina", BoostDictionary["playerUpgradeStamina"]),
("playerUpgradeExtraJump", BoostDictionary["playerUpgradeExtraJump"]),
("playerUpgradeRange", BoostDictionary["playerUpgradeRange"]),
("playerUpgradeCrouchRest", BoostDictionary["playerUpgradeCrouchRest"]),
("playerUpgradeTumbleWings", BoostDictionary["playerUpgradeTumbleWings"]),
("playerUpgradeLaunch", BoostDictionary["playerUpgradeLaunch"]),
("playerUpgradeMapPlayerCount", BoostDictionary["playerUpgradeMapPlayerCount"]),
("playerUpgradeTumbleClimb", BoostDictionary["playerUpgradeTumbleClimb"]),
("playerUpgradeDeathHeadBattery", BoostDictionary["playerUpgradeDeathHeadBattery"])
};
UpgradePlayerHealthEvent = new UnityEvent<string>();
UpgradePlayerEnergyEvent = new UnityEvent<string>();
UpgradePlayerExtraJumpEvent = new UnityEvent<string>();
UpgradeMapPlayerCountEvent = new UnityEvent<string>();
UpgradePlayerTumbleLaunchEvent = new UnityEvent<string>();
UpgradePlayerTumbleWingsEvent = new UnityEvent<string>();
UpgradePlayerSprintSpeedEvent = new UnityEvent<string>();
UpgradePlayerCrouchRestEvent = new UnityEvent<string>();
UpgradePlayerGrabStrengthEvent = new UnityEvent<string>();
UpgradePlayerGrabRangeEvent = new UnityEvent<string>();
UpgradePlayerTumbleClimbEvent = new UnityEvent<string>();
UpgradeDeathHeadBatteryEvent = new UnityEvent<string>();
ResetUpgradePlayerHealthEvent = new UnityEvent<string>();
ResetUpgradePlayerEnergyEvent = new UnityEvent<string>();
ResetUpgradePlayerExtraJumpEvent = new UnityEvent<string>();
ResetUpgradeMapPlayerCountEvent = new UnityEvent<string>();
ResetUpgradePlayerTumbleLaunchEvent = new UnityEvent<string>();
ResetUpgradePlayerTumbleWingsEvent = new UnityEvent<string>();
ResetUpgradePlayerSprintSpeedEvent = new UnityEvent<string>();
ResetUpgradePlayerCrouchRestEvent = new UnityEvent<string>();
ResetUpgradePlayerGrabStrengthEvent = new UnityEvent<string>();
ResetUpgradePlayerGrabRangeEvent = new UnityEvent<string>();
ResetUpgradePlayerTumbleClimbEvent = new UnityEvent<string>();
ResetUpgradeDeathHeadBatteryEvent = new UnityEvent<string>();
BoostActions = new Dictionary<string, UnityEvent<string>>
{
{ "playerUpgradeHealth", UpgradePlayerHealthEvent },
{ "playerUpgradeStamina", UpgradePlayerEnergyEvent },
{ "playerUpgradeExtraJump", UpgradePlayerExtraJumpEvent },
{ "playerUpgradeMapPlayerCount", UpgradeMapPlayerCountEvent },
{ "playerUpgradeLaunch", UpgradePlayerTumbleLaunchEvent },
{ "playerUpgradeTumbleWings", UpgradePlayerTumbleWingsEvent },
{ "playerUpgradeSpeed", UpgradePlayerSprintSpeedEvent },
{ "playerUpgradeCrouchRest", UpgradePlayerCrouchRestEvent },
{ "playerUpgradeStrength", UpgradePlayerGrabStrengthEvent },
{ "playerUpgradeRange", UpgradePlayerGrabRangeEvent },
{ "playerUpgradeTumbleClimb", UpgradePlayerTumbleClimbEvent },
{ "playerUpgradeDeathHeadBattery", UpgradeDeathHeadBatteryEvent }
};
ResetActions = new Dictionary<string, UnityEvent<string>>
{
{ "playerUpgradeHealth", ResetUpgradePlayerHealthEvent },
{ "playerUpgradeStamina", ResetUpgradePlayerEnergyEvent },
{ "playerUpgradeExtraJump", ResetUpgradePlayerExtraJumpEvent },
{ "playerUpgradeMapPlayerCount", ResetUpgradeMapPlayerCountEvent },
{ "playerUpgradeLaunch", ResetUpgradePlayerTumbleLaunchEvent },
{ "playerUpgradeTumbleWings", ResetUpgradePlayerTumbleWingsEvent },
{ "playerUpgradeSpeed", ResetUpgradePlayerSprintSpeedEvent },
{ "playerUpgradeCrouchRest", ResetUpgradePlayerCrouchRestEvent },
{ "playerUpgradeStrength", ResetUpgradePlayerGrabStrengthEvent },
{ "playerUpgradeRange", ResetUpgradePlayerGrabRangeEvent },
{ "playerUpgradeTumbleClimb", ResetUpgradePlayerTumbleClimbEvent },
{ "playerUpgradeDeathHeadBattery", ResetUpgradeDeathHeadBatteryEvent }
};
UpgradePlayerHealthEvent.AddListener((UnityAction<string>)UpgradePlayerHealth);
UpgradePlayerEnergyEvent.AddListener((UnityAction<string>)UpgradePlayerEnergy);
UpgradePlayerExtraJumpEvent.AddListener((UnityAction<string>)UpgradePlayerExtraJump);
UpgradeMapPlayerCountEvent.AddListener((UnityAction<string>)UpgradePlayerMapPlayerCount);
UpgradePlayerTumbleLaunchEvent.AddListener((UnityAction<string>)UpgradePlayerTumbleLaunch);
UpgradePlayerTumbleWingsEvent.AddListener((UnityAction<string>)UpgradePlayerTumbleWings);
UpgradePlayerSprintSpeedEvent.AddListener((UnityAction<string>)UpgradePlayerSprintSpeed);
UpgradePlayerCrouchRestEvent.AddListener((UnityAction<string>)UpgradePlayerCrouchRest);
UpgradePlayerGrabStrengthEvent.AddListener((UnityAction<string>)UpgradePlayerGrabStrength);
UpgradePlayerGrabRangeEvent.AddListener((UnityAction<string>)UpgradePlayerGrabRange);
UpgradePlayerTumbleClimbEvent.AddListener((UnityAction<string>)UpgradeUpgradePlayerTumbleClimb);
UpgradeDeathHeadBatteryEvent.AddListener((UnityAction<string>)UpgradeUpgradeDeathHeadBattery);
ResetUpgradePlayerHealthEvent.AddListener((UnityAction<string>)ResetUpgradePlayerHealth);
ResetUpgradePlayerEnergyEvent.AddListener((UnityAction<string>)ResetUpgradePlayerEnergy);
ResetUpgradePlayerExtraJumpEvent.AddListener((UnityAction<string>)ResetUpgradePlayerExtraJump);
ResetUpgradeMapPlayerCountEvent.AddListener((UnityAction<string>)ResetUpgradeMapPlayerCount);
ResetUpgradePlayerTumbleLaunchEvent.AddListener((UnityAction<string>)ResetUpgradePlayerTumbleLaunch);
ResetUpgradePlayerTumbleWingsEvent.AddListener((UnityAction<string>)ResetUpgradePlayerTumbleWings);
ResetUpgradePlayerSprintSpeedEvent.AddListener((UnityAction<string>)ResetUpgradePlayerSprintSpeed);
ResetUpgradePlayerCrouchRestEvent.AddListener((UnityAction<string>)ResetUpgradePlayerCrouchRest);
ResetUpgradePlayerGrabStrengthEvent.AddListener((UnityAction<string>)ResetUpgradePlayerGrabStrength);
ResetUpgradePlayerGrabRangeEvent.AddListener((UnityAction<string>)ResetUpgradePlayerGrabRange);
ResetUpgradePlayerTumbleClimbEvent.AddListener((UnityAction<string>)ResetUpgradePlayerTumbleClimb);
ResetUpgradeDeathHeadBatteryEvent.AddListener((UnityAction<string>)ResetUpgradeDeathHeadBattery);
}
private static void UpgradePlayerHealth(string steamID)
{
if (!PlayerStats["playerUpgradeHealth"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeHealth"].Add(steamID, StatsManager.instance.playerUpgradeHealth[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"Health");
PunManager.instance.UpgradePlayerHealth(steamID, 1);
}
private static void UpgradePlayerEnergy(string steamID)
{
if (!PlayerStats["playerUpgradeStamina"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeStamina"].Add(steamID, StatsManager.instance.playerUpgradeStamina[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"Energy");
PunManager.instance.UpgradePlayerEnergy(steamID, 1);
}
private static void UpgradePlayerExtraJump(string steamID)
{
if (!PlayerStats["playerUpgradeExtraJump"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeExtraJump"].Add(steamID, StatsManager.instance.playerUpgradeExtraJump[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"ExtraJump");
PunManager.instance.UpgradePlayerExtraJump(steamID, 1);
}
private static void UpgradePlayerMapPlayerCount(string steamID)
{
if (!PlayerStats["playerUpgradeMapPlayerCount"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeMapPlayerCount"].Add(steamID, StatsManager.instance.playerUpgradeMapPlayerCount[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"MapPlayerCount");
PunManager.instance.UpgradeMapPlayerCount(steamID, 1);
}
private static void UpgradePlayerTumbleLaunch(string steamID)
{
if (!PlayerStats["playerUpgradeLaunch"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeLaunch"].Add(steamID, StatsManager.instance.playerUpgradeLaunch[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"TumbleLaunch");
PunManager.instance.UpgradePlayerTumbleLaunch(steamID, 1);
}
private static void UpgradePlayerTumbleWings(string steamID)
{
if (!PlayerStats["playerUpgradeTumbleWings"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeTumbleWings"].Add(steamID, StatsManager.instance.playerUpgradeTumbleWings[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"TumbleWings");
PunManager.instance.UpgradePlayerTumbleWings(steamID, 1);
}
private static void UpgradePlayerSprintSpeed(string steamID)
{
if (!PlayerStats["playerUpgradeSpeed"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeSpeed"].Add(steamID, StatsManager.instance.playerUpgradeSpeed[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"SprintSpeed");
PunManager.instance.UpgradePlayerSprintSpeed(steamID, 1);
}
private static void UpgradePlayerCrouchRest(string steamID)
{
if (!PlayerStats["playerUpgradeCrouchRest"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeCrouchRest"].Add(steamID, StatsManager.instance.playerUpgradeCrouchRest[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"CrouchRest");
PunManager.instance.UpgradePlayerCrouchRest(steamID, 1);
}
private static void UpgradePlayerGrabStrength(string steamID)
{
if (!PlayerStats["playerUpgradeStrength"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeStrength"].Add(steamID, StatsManager.instance.playerUpgradeStrength[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"GrabStrength");
PunManager.instance.UpgradePlayerGrabStrength(steamID, 1);
}
private static void UpgradePlayerGrabRange(string steamID)
{
if (!PlayerStats["playerUpgradeRange"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeRange"].Add(steamID, StatsManager.instance.playerUpgradeRange[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"GrabRange");
PunManager.instance.UpgradePlayerGrabRange(steamID, 1);
}
private static void UpgradeUpgradePlayerTumbleClimb(string steamID)
{
if (!PlayerStats["playerUpgradeTumbleClimb"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeTumbleClimb"].Add(steamID, StatsManager.instance.playerUpgradeRange[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"TumbleClimb");
PunManager.instance.UpgradePlayerTumbleClimb(steamID, 1);
}
private static void UpgradeUpgradeDeathHeadBattery(string steamID)
{
if (!PlayerStats["playerUpgradeDeathHeadBattery"].ContainsKey(steamID))
{
PlayerStats["playerUpgradeDeathHeadBattery"].Add(steamID, StatsManager.instance.playerUpgradeRange[steamID]);
}
OrbBoosts.Logger.LogInfo((object)"DeathHeadBattery");
PunManager.instance.UpgradeDeathHeadBattery(steamID, 1);
}
private static void ResetUpgradePlayerHealth(string steamID)
{
StatsManager.instance.playerUpgradeHealth[steamID] = PlayerStats["playerUpgradeHealth"][steamID];
}
private static void ResetUpgradePlayerEnergy(string steamID)
{
StatsManager.instance.playerUpgradeStamina[steamID] = PlayerStats["playerUpgradeStamina"][steamID];
}
private static void ResetUpgradePlayerExtraJump(string steamID)
{
StatsManager.instance.playerUpgradeExtraJump[steamID] = PlayerStats["playerUpgradeExtraJump"][steamID];
}
private static void ResetUpgradeMapPlayerCount(string steamID)
{
StatsManager.instance.playerUpgradeMapPlayerCount[steamID] = PlayerStats["playerUpgradeMapPlayerCount"][steamID];
}
private static void ResetUpgradePlayerTumbleLaunch(string steamID)
{
StatsManager.instance.playerUpgradeLaunch[steamID] = PlayerStats["playerUpgradeLaunch"][steamID];
}
private static void ResetUpgradePlayerTumbleWings(string steamID)
{
StatsManager.instance.playerUpgradeTumbleWings[steamID] = PlayerStats["playerUpgradeTumbleWings"][steamID];
}
private static void ResetUpgradePlayerSprintSpeed(string steamID)
{
StatsManager.instance.playerUpgradeSpeed[steamID] = PlayerStats["playerUpgradeSpeed"][steamID];
}
private static void ResetUpgradePlayerCrouchRest(string steamID)
{
StatsManager.instance.playerUpgradeCrouchRest[steamID] = PlayerStats["playerUpgradeCrouchRest"][steamID];
}
private static void ResetUpgradePlayerGrabStrength(string steamID)
{
StatsManager.instance.playerUpgradeStrength[steamID] = PlayerStats["playerUpgradeStrength"][steamID];
}
private static void ResetUpgradePlayerGrabRange(string steamID)
{
StatsManager.instance.playerUpgradeRange[steamID] = PlayerStats["playerUpgradeRange"][steamID];
}
private static void ResetUpgradePlayerTumbleClimb(string steamID)
{
StatsManager.instance.playerUpgradeRange[steamID] = PlayerStats["playerUpgradeTumbleClimb"][steamID];
}
private static void ResetUpgradeDeathHeadBattery(string steamID)
{
StatsManager.instance.playerUpgradeRange[steamID] = PlayerStats["playerUpgradeDeathHeadBattery"][steamID];
}
}
public static class WeaponStore
{
private static readonly Dictionary<string, (float, float, float)> WeaponDictionary = new Dictionary<string, (float, float, float)>
{
{
"ItemGunTranq",
(2f / 9f, 0f, 0f)
},
{
"ItemGunStun",
(2f / 9f, 0f, 0f)
},
{
"ItemGunShockwave",
(2f / 9f, 0f, 0f)
},
{
"ItemMeleeFryingPan",
(1f / 9f, 0f, 0f)
},
{
"ItemMeleeBaseballBat",
(1f / 9f, 0f, 0f)
},
{
"ItemMeleeStunBaton",
(1f / 9f, 0f, 0f)
},
{
"ItemGunHandgun",
(0f, 0.5f, 0f)
},
{
"ItemMeleeSledgeHammer",
(0f, 0.25f, 0f)
},
{
"ItemMeleeSword",
(0f, 0.25f, 0f)
},
{
"ItemGunLaser",
(0f, 0f, 1f / 3f)
},
{
"ItemGunShotgun",
(0f, 0f, 1f / 3f)
},
{
"ItemCartCannon",
(0f, 0f, 1f / 6f)
},
{
"ItemCartLaser",
(0f, 0f, 1f / 6f)
}
};
internal static readonly List<(string, (float, float, float))> Weapons = new List<(string, (float, float, float))>(13)
{
("ItemGunTranq", WeaponDictionary["ItemGunTranq"]),
("ItemGunStun", WeaponDictionary["ItemGunStun"]),
("ItemGunShockwave", WeaponDictionary["ItemGunShockwave"]),
("ItemMeleeFryingPan", WeaponDictionary["ItemMeleeFryingPan"]),
("ItemMeleeBaseballBat", WeaponDictionary["ItemMeleeBaseballBat"]),
("ItemMeleeStunBaton", WeaponDictionary["ItemMeleeStunBaton"]),
("ItemGunHandgun", WeaponDictionary["ItemGunHandgun"]),
("ItemMeleeSledgeHammer", WeaponDictionary["ItemMeleeSledgeHammer"]),
("ItemMeleeSword", WeaponDictionary["ItemMeleeSword"]),
("ItemGunLaser", WeaponDictionary["ItemGunLaser"]),
("ItemGunShotgun", WeaponDictionary["ItemGunShotgun"]),
("ItemCartCannon", WeaponDictionary["ItemCartCannon"]),
("ItemCartLaser", WeaponDictionary["ItemCartLaser"])
};
private static HashSet<PrefabRef> _items = null;
private static bool _droneItemInit;
internal static void Init()
{
_items = (from x in StatsManager.instance.itemDictionary.Values
select x.prefab into x
orderby x.PrefabName
select x).ToHashSet();
if (!_droneItemInit)
{
_droneItemInit = true;
}
}
internal static GameObject? SpawnItem(string item, Vector3 position, Quaternion rotation)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
string item2 = item;
PrefabRef val = ((IEnumerable<PrefabRef>)_items).FirstOrDefault((Func<PrefabRef, bool>)((PrefabRef x) => x.PrefabName.Replace(" ", "") == item2));
if (val == null)
{
return null;
}
return NetworkPrefabs.SpawnNetworkPrefab(val, position, rotation, (byte)0, (object[])null);
}
}
}