using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using GameNetcodeStuff;
using HarmonyLib;
using IL.GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MysteryDice;
using MysteryDice.Effects;
using Newtonsoft.Json.Linq;
using OpenBodyCams;
using OpenBodyCams.API;
using PremiumScraps.CustomEffects;
using PremiumScraps.NetcodePatcher;
using PremiumScraps.Utils;
using SelfSortingStorage.Cupboard;
using ShipInventoryUpdated.Helpers.API;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;
using WeatherRegistry;
[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-CSharp")]
[assembly: IgnoresAccessChecksTo("WeatherRegistry")]
[assembly: AssemblyCompany("PremiumScraps")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b5ec14cfd7ae5789a6b73596435e2404b6450d6a")]
[assembly: AssemblyProduct("PremiumScraps")]
[assembly: AssemblyTitle("PremiumScraps")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
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;
}
}
}
namespace PremiumScraps
{
internal class Config
{
public bool StarlancerAIFix = false;
public bool WeatherRegistery = false;
public bool OpenBodyCams = false;
public readonly List<ulong> unluckyPlayersID = new List<ulong>();
public readonly List<(int, int)> scrapValues = new List<(int, int)>();
public readonly ConfigEntry<bool> diceEvents;
public readonly ConfigEntry<string> languageMode;
public readonly ConfigEntry<string> unluckyPlayersStr;
public readonly ConfigEntry<bool> gazpachoMemeSfx;
public readonly ConfigEntry<bool> squareSteelWeapon;
public readonly ConfigEntry<bool> controllerBodyCams;
public readonly ConfigEntry<float> ronkaVolumeMultiplier;
public readonly List<ConfigEntry<int>> entries = new List<ConfigEntry<int>>();
public readonly List<ConfigEntry<string>> values = new List<ConfigEntry<string>>();
public Config(ConfigFile cfg, List<Scrap> scraps)
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
cfg.SaveOnConfigSet = false;
diceEvents = cfg.Bind<bool>("General", "Dice events", true, "Adds some custom dice rolls to Emergency Dice items.\nRequires 'Emergency Dice Updated' 1.9.25+ to work, or else it will be automatically false.");
languageMode = cfg.Bind<string>("General", "Language mode", "default", new ConfigDescription("Change the language of this mod (translate text, tool tips and change some sounds). The 'default' value is automatically assigned to your system language.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "default", "english", "french" }), Array.Empty<object>()));
unluckyPlayersStr = cfg.Bind<string>("General", "Unlucky players", "76561198984467725,76561198198881967,76561198195911589", "Comma separated list of players Steam ID that you want them to be unlucky.\nBad things will happen to unlucky players, use this config to take a sweet revenge on your friends...");
gazpachoMemeSfx = cfg.Bind<bool>("Items", "Gazpacho meme sfx", true, "Turns El Gazpacho's grab and drop sfx to memes sounds.\nWill be automatically false if the chosen language is not french.");
squareSteelWeapon = cfg.Bind<bool>("Items", "Square Steel weapon", true, "Turns Galvanized Square Steel into a usable weapon.");
controllerBodyCams = cfg.Bind<bool>("Items", "Controller Body Cams", true, "Upgrade the Controller screen with a camera from OpenBodyCams mod.\nWill be automatically false if OpenBodyCams is not installed.");
ronkaVolumeMultiplier = cfg.Bind<float>("Items", "Ronka volume multiplier", 1f, new ConfigDescription("Change the volume of Ronka's 'scree' sound effects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
foreach (Scrap scrap in scraps)
{
entries.Add(cfg.Bind<int>("Spawn chance", scrap.asset.Split("/")[0], scrap.rarity, "Rarity of the item."));
values.Add(cfg.Bind<string>("Values", scrap.asset.Split("/")[0], "", "Min,max value of the item, follow the format 200,300 or empty for default.\nIn-game value will be randomized between these numbers and divided by 2.5."));
}
cfg.Save();
cfg.SaveOnConfigSet = true;
}
public void SetupCustomConfigs()
{
if (Chainloader.PluginInfos.ContainsKey("AudioKnight.StarlancerAIFix"))
{
StarlancerAIFix = true;
}
if (Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"))
{
WeatherRegistery = true;
}
if (Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams"))
{
OpenBodyCams = true;
}
foreach (string item in from s in unluckyPlayersStr.Value.Split(',')
select s.Trim())
{
if (ulong.TryParse(item, out var result))
{
unluckyPlayersID.Add(result);
}
}
foreach (ConfigEntry<string> value in values)
{
if (value.Value == "")
{
scrapValues.Add((-1, -1));
continue;
}
string[] array = (from s in value.Value.Split(',')
select s.Trim()).ToArray();
int result2;
int result3;
if (array.Count() != 2)
{
scrapValues.Add((-1, -1));
}
else if (!int.TryParse(array[0], out result2) || !int.TryParse(array[1], out result3))
{
scrapValues.Add((-1, -1));
}
else if (result2 > result3)
{
scrapValues.Add((-1, -1));
}
else
{
scrapValues.Add((result2, result3));
}
}
}
}
[BepInPlugin("zigzag.premiumscraps", "PremiumScraps", "2.5.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "zigzag.premiumscraps";
private const string NAME = "PremiumScraps";
private const string VERSION = "2.5.0";
public static Plugin instance;
public static List<AudioClip> audioClips = new List<AudioClip>();
public static List<GameObject> gameObjects = new List<GameObject>();
private readonly Harmony harmony = new Harmony("zigzag.premiumscraps");
internal static Config config { get; private set; } = null;
private void HarmonyPatchAll()
{
PremiumScrapsMonoModPatches.Load();
harmony.CreateClassProcessor(typeof(GetEnemies), true).Patch();
harmony.CreateClassProcessor(typeof(SteelBarPatch), true).Patch();
harmony.CreateClassProcessor(typeof(BombItemChargerPatch), true).Patch();
harmony.CreateClassProcessor(typeof(ControllerTerminalPatch), true).Patch();
harmony.CreateClassProcessor(typeof(ControllerHUDManagerPatch), true).Patch();
harmony.CreateClassProcessor(typeof(ControllerPlayerControllerBPatch), true).Patch();
harmony.CreateClassProcessor(typeof(ControllerVehicleControllerPatch), true).Patch();
if (Lang.ACTUAL_LANG == "fr")
{
harmony.CreateClassProcessor(typeof(FrenchModeItemTooltipsPatch), true).Patch();
}
if (Chainloader.PluginInfos.ContainsKey("mattymatty.MattyFixes"))
{
harmony.CreateClassProcessor(typeof(MattyFixesAirhornPositionPatch), true).Patch();
}
if (Chainloader.PluginInfos.ContainsKey("org.lethalcompanymodding.shipinventoryupdated"))
{
ShipInventoryConditions.Setup(Chainloader.PluginInfos.GetValueOrDefault("org.lethalcompanymodding.shipinventoryupdated").Metadata);
}
if (Chainloader.PluginInfos.ContainsKey("zigzag.SelfSortingStorage"))
{
SSSConditions.Setup(Chainloader.PluginInfos.GetValueOrDefault("zigzag.SelfSortingStorage").Metadata);
}
if (config.diceEvents.Value && Chainloader.PluginInfos.ContainsKey("Theronguard.EmergencyDice"))
{
DiceEvents.RegisterDiceEvents(((BaseUnityPlugin)this).Logger, Chainloader.PluginInfos.GetValueOrDefault("Theronguard.EmergencyDice").Metadata);
}
}
private void LoadItemBehaviour(Item item, int behaviourId)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Expected O, but got Unknown
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
GrabbableObject val;
switch (behaviourId)
{
default:
return;
case 1:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<FakeAirhorn>();
SetupScript.Copy((NoisemakerProp)val, item);
break;
case 2:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<TrollFace>();
break;
case 3:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<ScrollTP>();
break;
case 4:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<LegendaryStick>();
break;
case 5:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<StupidBook>();
break;
case 6:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<JobDark>();
break;
case 7:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<SpanishDrink>();
break;
case 8:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<TalkingBall>();
SetupScript.Copy((SoccerBallProp)val, item);
break;
case 9:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<HarryDoll>();
break;
case 10:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<Bomb>();
SetupScript.Copy((ThrowableItem)(object)val, item);
break;
case 11:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<LichKingHelm>();
break;
case 12:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<Controller>();
break;
case 13:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<SteelBar>();
SetupScript.Copy((Shovel)val, item);
break;
case 14:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<CDI_King>();
SetupScript.Copy((NoisemakerProp)val, item);
break;
case 15:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<GreatRonka>();
break;
case 16:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<EvilCard>();
break;
case 17:
val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<OldStatue>();
break;
}
val.grabbable = true;
val.isInFactory = true;
val.grabbableToEnemies = true;
val.itemProperties = item;
}
private void Awake()
{
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "premiumscraps");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/Data/";
string[] array = new string[2] { "Controller/ControlledAntena.prefab", "Controller/ControlledUI.prefab" };
string[] array2 = new string[49]
{
"AirHorn1.ogg", "friendship_ends_here.wav", "scroll_tp.wav", "ShovelReelUp.ogg", "ShovelSwing.ogg", "wooden-staff-hit.wav", "MineTrigger.ogg", "book_page.wav", "CVuse1.wav", "CVuse2.wav",
"CVuse3.wav", "CVuse4.wav", "TerminalAlarm.ogg", "Breathing.wav", "huh.wav", "book_use_redesign.wav", "uwu.wav", "uwu-rot.wav", "drink.wav", "spanishsound.wav",
"arthas.wav", "glass-grab.wav", "glass-drop.wav", "beam.wav", "ControlModeStart.wav", "ControlModeStop.wav", "FlashlightOutOfBatteries.ogg", "ControlledOn.wav", "ControlledOff.wav", "controller-alert.wav",
"LightningStrike2.ogg", "KingAAAAAAHHH.wav", "card-evil.wav", "card-evil2.wav", "card-boo.wav", "card-common-fr.wav", "card-evil-fr.wav", "card-evil2-fr.wav", "book_open_square_steel-fr.wav", "book_close_eco_friendly-fr.wav",
"book_use_redesign-fr.wav", "KingBoyFR.wav", "KingHmmFR.wav", "KingDinnerFR.wav", "KingHelpFR.wav", "KingPeaceFR.wav", "KingSaveFR.wav", "KingShipFR.wav", "Bronze Age Shitpost.wav"
};
string[] array3 = array;
foreach (string text3 in array3)
{
gameObjects.Add(val.LoadAsset<GameObject>(text2 + text3));
}
string[] array4 = array2;
foreach (string text4 in array4)
{
audioClips.Add(val.LoadAsset<AudioClip>(text2 + "_audio/" + text4));
}
List<Scrap> list = new List<Scrap>
{
new Scrap("Frieren/FrierenItem.asset", 10),
new Scrap("Chocobo/ChocoboItem.asset", 10),
new Scrap("AinzOoalGown/AinzOoalGownItem.asset", 5),
new Scrap("HelmDomination/HelmDominationItem.asset", 11, 11),
new Scrap("TheKing/TheKingItem.asset", 13, 14),
new Scrap("HarryMason/HarryMasonItem.asset", 10, 9),
new Scrap("Cristal/CristalItem.asset", 10),
new Scrap("PuppyShark/PuppySharkItem.asset", 10),
new Scrap("Rupee/RupeeItem.asset", 15),
new Scrap("EaNasir/EaNasirItem.asset", 9, 17),
new Scrap("HScard/HSCardItem.asset", 9, 16),
new Scrap("SODA/SODAItem.asset", 8),
new Scrap("Spoon/SpoonItem.asset", 13),
new Scrap("Crouton/CroutonItem.asset", 6),
new Scrap("AirHornCustom/AirHornCustomItem.asset", 11, 1),
new Scrap("Balan/BalanItem.asset", 10),
new Scrap("CustomFace/CustomFaceItem.asset", 8, 2),
new Scrap("Scroll/ScrollItem.asset", 7, 3),
new Scrap("Stick/StickItem.asset", 9, 4),
new Scrap("BookCustom/BookCustomItem.asset", 11, 5),
new Scrap("SquareSteel/SquareSteelItem.asset", 7, 13),
new Scrap("DarkJobApplication/JobApplicationItem.asset", 8, 6),
new Scrap("Moogle/MoogleItem.asset", 10),
new Scrap("Gazpacho/GazpachoItem.asset", 9, 7),
new Scrap("Abi/AbiItem.asset", 4, 8),
new Scrap("Bomb/BombItem.asset", 12, 10),
new Scrap("Controller/ControllerItem.asset", 8, 12),
new Scrap("Ronka/RonkaItem.asset", 10, 15)
};
int index = 0;
config = new Config(((BaseUnityPlugin)this).Config, list);
config.SetupCustomConfigs();
Lang.Load(((BaseUnityPlugin)this).Logger, Application.systemLanguage, config.languageMode.Value);
SetupScript.Network();
foreach (Scrap item in list)
{
Item val2 = val.LoadAsset<Item>(text2 + item.asset);
if (config.scrapValues[index].Item1 != -1)
{
val2.minValue = config.scrapValues[index].Item1;
val2.maxValue = config.scrapValues[index].Item2;
}
if (item.behaviourId != 0)
{
LoadItemBehaviour(val2, item.behaviourId);
}
SpecialEvent.LoadSpecialEvent(val2.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Items.RegisterScrap(val2, config.entries[index++].Value, (LevelTypes)(-1));
}
HarmonyPatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PremiumScraps is loaded !");
}
}
}
namespace PremiumScraps.Utils
{
public class Scrap
{
public string asset;
public int rarity;
public int behaviourId;
public Scrap(string asset, int rarity, int behaviourId = 0)
{
this.asset = asset;
this.rarity = rarity;
this.behaviourId = behaviourId;
}
}
public class SpecialEvent
{
public static int todayMonth = DateTime.Today.Month;
public static void LoadSpecialEvent(GameObject itemPrefab)
{
if (todayMonth == 12)
{
Transform val = ((((Object)itemPrefab).name == "TheKing") ? itemPrefab.transform.Find("CDi_LinkZeldaHarkinian/root_h/hip_jnt/spine_jnt_01/spine_jnt_02/spine_jnt_03/neck_jnt_02/Christmas") : ((!(((Object)itemPrefab).name == "PuppyShark")) ? itemPrefab.transform.Find("Christmas") : itemPrefab.transform.Find("PuppySharkLow/Christmas")));
if (val != null)
{
((Component)val).gameObject.SetActive(true);
}
}
}
}
public class NetworkReference
{
public NetworkObjectReference netObjectRef;
public int value;
public NetworkReference(NetworkObjectReference netObjectRef, int value)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
this.netObjectRef = netObjectRef;
this.value = value;
}
}
public class SetupScript
{
public static void Network()
{
IEnumerable<Type> enumerable;
try
{
enumerable = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
enumerable = ex.Types.Where((Type t) => t != null);
}
foreach (Type item in enumerable)
{
MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array = methods;
foreach (MethodInfo methodInfo in array)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
public static void Copy(ThrowableItem target, Item item)
{
ThrowableItem component = item.spawnPrefab.GetComponent<ThrowableItem>();
target.itemFallCurve = component.itemFallCurve;
target.itemVerticalFallCurve = component.itemVerticalFallCurve;
target.itemVerticalFallCurveNoBounce = component.itemVerticalFallCurveNoBounce;
GrabbableObjectPhysicsTrigger componentInChildren = item.spawnPrefab.GetComponentInChildren<GrabbableObjectPhysicsTrigger>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.itemScript = (GrabbableObject)(object)target;
}
Object.Destroy((Object)(object)component);
}
public static void Copy(NoisemakerProp target, Item item)
{
NoisemakerProp component = item.spawnPrefab.GetComponent<NoisemakerProp>();
((GrabbableObject)target).useCooldown = ((GrabbableObject)component).useCooldown;
target.noiseAudio = component.noiseAudio;
target.noiseAudioFar = component.noiseAudioFar;
target.noiseSFX = (AudioClip[])(object)new AudioClip[component.noiseSFX.Length];
for (int i = 0; i < component.noiseSFX.Length; i++)
{
target.noiseSFX[i] = component.noiseSFX[i];
}
target.noiseSFXFar = (AudioClip[])(object)new AudioClip[component.noiseSFXFar.Length];
for (int j = 0; j < component.noiseSFXFar.Length; j++)
{
target.noiseSFXFar[j] = component.noiseSFXFar[j];
}
target.noiseRange = component.noiseRange;
target.maxLoudness = component.maxLoudness;
target.minLoudness = component.minLoudness;
target.minPitch = component.minPitch;
target.maxPitch = component.maxPitch;
target.triggerAnimator = component.triggerAnimator;
Object.Destroy((Object)(object)component);
}
public static void Copy(Shovel target, Item item)
{
Shovel component = item.spawnPrefab.GetComponent<Shovel>();
target.shovelHitForce = component.shovelHitForce;
target.reelUp = component.reelUp;
target.swing = component.swing;
target.hitSFX = (AudioClip[])(object)new AudioClip[component.hitSFX.Length];
for (int i = 0; i < component.hitSFX.Length; i++)
{
target.hitSFX[i] = component.hitSFX[i];
}
target.shovelAudio = component.shovelAudio;
Object.Destroy((Object)(object)component);
}
public static void Copy(SoccerBallProp target, Item item)
{
SoccerBallProp component = item.spawnPrefab.GetComponent<SoccerBallProp>();
target.ballHitUpwardAmount = component.ballHitUpwardAmount;
target.grenadeFallCurve = component.grenadeFallCurve;
target.grenadeVerticalFallCurve = component.grenadeVerticalFallCurve;
target.soccerBallVerticalOffset = component.soccerBallVerticalOffset;
target.grenadeVerticalFallCurveNoBounce = component.grenadeVerticalFallCurveNoBounce;
target.hitBallSFX = (AudioClip[])(object)new AudioClip[component.hitBallSFX.Length];
for (int i = 0; i < component.hitBallSFX.Length; i++)
{
target.hitBallSFX[i] = component.hitBallSFX[i];
}
target.ballHitFloorSFX = (AudioClip[])(object)new AudioClip[component.ballHitFloorSFX.Length];
for (int j = 0; j < component.ballHitFloorSFX.Length; j++)
{
target.ballHitFloorSFX[j] = component.ballHitFloorSFX[j];
}
target.soccerBallAudio = component.soccerBallAudio;
target.ballCollider = component.ballCollider;
GrabbableObjectPhysicsTrigger componentInChildren = item.spawnPrefab.GetComponentInChildren<GrabbableObjectPhysicsTrigger>();
componentInChildren.itemScript = (GrabbableObject)(object)target;
Object.Destroy((Object)(object)component);
}
}
internal class DiceEvents
{
public static void RegisterDiceEvents(ManualLogSource logger, BepInPlugin diceMetadata)
{
if (diceMetadata.Name == "Emergency Dice Updated" && new Version("1.7.3").CompareTo(diceMetadata.Version) <= 0)
{
MysteryDice.RegisterNewEffect((IEffect)(object)new Premium(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Haunted(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Death(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Hazards(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Music(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Academy(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Bombs(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Crouton(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new Abi(), false, false);
MysteryDice.RegisterNewEffect((IEffect)(object)new HarryMason(), false, false);
if (Chainloader.PluginInfos.ContainsKey("Zeldahu.LethalAnomalies"))
{
MysteryDice.RegisterNewEffect((IEffect)(object)new SparkTowers(), false, false);
}
}
else
{
logger.LogWarning((object)"Compatibility with 'Emergency Dice Updated' was enabled but you are not using the targeted 1.7.4+ version. Custom events will not be loaded.");
}
}
}
public static class NetworkerExtensions
{
[CompilerGenerated]
private sealed class <DeathEffect>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
public PlayerControllerB player;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DeathEffect>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = JobDark.DeathHallucination(player, null, (MonoBehaviour?)(object)networker, Lang.Get("HEART_ATTACK"));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HarryMasonCurse>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
private Vector3 <position>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HarryMasonCurse>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<position>5__1 = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position;
networker.TeleportInsideServerRPC(Effects.GetLocalPlayerIndex(), <position>5__1);
networker.TurnOffAllLightsServerRPC();
Effects.Audio3D(1, <position>5__1, 1.5f);
networker.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 8, "Harry Mason", true, <position>5__1);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HauntedEffect>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
public PlayerControllerB player;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HauntedEffect>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = JobDark.HauntedHallucination(player);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HazardEffect>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
public PlayerControllerB player;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HazardEffect>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = JobDark.HazardHallucination(player, null);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SparkWarning>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
private int <i>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SparkWarning>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (GetEnemies.SparkTower != null && !StartOfRound.Instance.shipIsLeaving)
{
networker.MessageToEveryoneServerRPC(Lang.Get("DICE_INFO3"), "");
<i>5__1 = 0;
while (<i>5__1 < Random.Range(10, 14))
{
networker.SpawnEnemyAtPosServerRPC("SparkTower", RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position, false, default(Vector3));
<i>5__1++;
}
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <StartHallucination>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
public ulong playerId;
public int hallucinationID;
private bool <stopFlag>5__1;
private PlayerControllerB <player>5__2;
private int <>s__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StartHallucination>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<player>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<stopFlag>5__1 = false;
<player>5__2 = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
goto IL_0183;
case 1:
<>1__state = -1;
if (!((StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || (Object)(object)<player>5__2 == (Object)null || <player>5__2.isPlayerDead) | <stopFlag>5__1))
{
int num = hallucinationID;
<>s__3 = num;
switch (<>s__3)
{
case 0:
<>2__current = networker.HazardEffect(<player>5__2);
<>1__state = 2;
return true;
case 2:
<>2__current = networker.HauntedEffect(<player>5__2);
<>1__state = 3;
return true;
case 3:
<>2__current = networker.DeathEffect(<player>5__2);
<>1__state = 4;
return true;
}
goto IL_0183;
}
return false;
case 2:
<>1__state = -1;
goto IL_0183;
case 3:
<>1__state = -1;
goto IL_0183;
case 4:
{
<>1__state = -1;
<stopFlag>5__1 = true;
goto IL_0183;
}
IL_0183:
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <StartNoise>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
private Vector3 <position>5__1;
private int <i>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StartNoise>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<position>5__1 = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position;
networker.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 3, "crouton", true, <position>5__1);
<i>5__2 = 0;
break;
case 1:
<>1__state = -1;
networker.SpawnEnemyAtPosServerRPC("Hoarding bug", <position>5__1, false, default(Vector3));
<i>5__2++;
break;
}
if (<i>5__2 < 5)
{
<>2__current = (object)new WaitForSeconds(5f * (float)<i>5__2);
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <TheAcademyIsNowOpen>d__6 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Networker networker;
private int <nb>5__1;
private bool <surrounded>5__2;
private float <waitTimeMultiplicator>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TheAcademyIsNowOpen>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<nb>5__1 = 0;
<surrounded>5__2 = true;
<waitTimeMultiplicator>5__3 = 1f;
break;
case 1:
<>1__state = -1;
break;
}
if (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase)
{
if ((Plugin.config.StarlancerAIFix & <surrounded>5__2) && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && !GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
networker.MessageToEveryoneServerRPC(Lang.Get("DICE_INFO"), Lang.Get("DICE_INFO2"));
networker.SpawnSurroundedServerRPC("Flowerman", 5, 3, true, Vector3.one * Random.Range(1.5f, 2.3f));
<surrounded>5__2 = false;
}
else if (!Plugin.config.StarlancerAIFix || <nb>5__1 >= 5)
{
networker.SpawnEnemyAtPosServerRPC("Flowerman", RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position, false, default(Vector3));
<waitTimeMultiplicator>5__3 += 2f;
}
else if (<nb>5__1 <= 4)
{
networker.SpawnEnemyAtPosServerRPC("Flowerman", RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position, false, default(Vector3));
}
<nb>5__1++;
<>2__current = (object)new WaitForSeconds(<waitTimeMultiplicator>5__3 * (float)<nb>5__1);
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<StartHallucination>d__0))]
public static IEnumerator StartHallucination(this Networker networker, ulong playerId, int hallucinationID)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StartHallucination>d__0(0)
{
networker = networker,
playerId = playerId,
hallucinationID = hallucinationID
};
}
[IteratorStateMachine(typeof(<HazardEffect>d__1))]
public static IEnumerator HazardEffect(this Networker networker, PlayerControllerB player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HazardEffect>d__1(0)
{
networker = networker,
player = player
};
}
[IteratorStateMachine(typeof(<HauntedEffect>d__2))]
public static IEnumerator HauntedEffect(this Networker networker, PlayerControllerB player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HauntedEffect>d__2(0)
{
networker = networker,
player = player
};
}
[IteratorStateMachine(typeof(<DeathEffect>d__3))]
public static IEnumerator DeathEffect(this Networker networker, PlayerControllerB player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DeathEffect>d__3(0)
{
networker = networker,
player = player
};
}
[IteratorStateMachine(typeof(<HarryMasonCurse>d__4))]
public static IEnumerator HarryMasonCurse(this Networker networker)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HarryMasonCurse>d__4(0)
{
networker = networker
};
}
[IteratorStateMachine(typeof(<StartNoise>d__5))]
public static IEnumerator StartNoise(this Networker networker)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StartNoise>d__5(0)
{
networker = networker
};
}
[IteratorStateMachine(typeof(<TheAcademyIsNowOpen>d__6))]
public static IEnumerator TheAcademyIsNowOpen(this Networker networker)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TheAcademyIsNowOpen>d__6(0)
{
networker = networker
};
}
[IteratorStateMachine(typeof(<SparkWarning>d__7))]
public static IEnumerator SparkWarning(this Networker networker)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SparkWarning>d__7(0)
{
networker = networker
};
}
}
internal class Premium : IEffect
{
public string Name => "Premium Scraps";
public EffectType Outcome => (EffectType)3;
public bool ShowDefaultTooltip => true;
public string Tooltip => "Spawning some nice scraps !";
public void Use()
{
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, 3);
if (1 == 0)
{
}
string text = num switch
{
0 => "FunItemPack",
1 => "CuteItempack",
_ => "DangerousItempack",
};
if (1 == 0)
{
}
string text2 = text;
string[] array = new string[4];
switch (text2)
{
case "FunItemPack":
array = new string[4] { "The King", "Harry Mason", "Balan Statue", "SODA" };
break;
case "CuteItempack":
array = new string[4] { "Frieren", "Chocobo", "Puppy Shark", "Moogle" };
break;
case "DangerousItempack":
array = new string[4] { "Controller", "Friendship ender", "Scroll of Town Portal", "Job application" };
break;
}
for (int i = 0; i < array.Length; i++)
{
Networker.Instance.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 1, array[i], false, default(Vector3));
}
}
}
internal class Music : IEffect
{
public string Name => "Instrument of legends";
public EffectType Outcome => (EffectType)4;
public bool ShowDefaultTooltip => true;
public string Tooltip => "Play a tune !";
public void Use()
{
//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)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (Effects.GetScrap("OcarinaItem") != null)
{
Networker.Instance.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), Random.Range(2, 6), "Ocarina", false, default(Vector3));
}
else
{
Networker.Instance.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 6, "Clown horn", false, default(Vector3));
}
}
}
internal class Abi : IEffect
{
public string Name => "Abibaland";
public EffectType Outcome => (EffectType)4;
public bool ShowDefaultTooltip => true;
public string Tooltip => "Are you pondering the orb?";
public void Use()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < 12; i++)
{
Networker.Instance.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 1, "The talking orb", true, RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position);
}
}
}
internal class Bombs : IEffect
{
public string Name => "Bombs infestation";
public EffectType Outcome => (EffectType)1;
public bool ShowDefaultTooltip => false;
public string Tooltip => "Quite unstable";
public void Use()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < 30; i++)
{
Networker.Instance.SameScrapServerRPC(Effects.GetLocalPlayerIndex(), 1, "Bomb", true, RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position);
}
}
}
internal class HarryMason : IEffect
{
public string Name => "Where is everybody?";
public EffectType Outcome => (EffectType)2;
public bool ShowDefaultTooltip => true;
public string Tooltip => "Where is everybody?";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.HarryMasonCurse());
}
}
internal class Crouton : IEffect
{
public string Name => "Disturbing noise";
public EffectType Outcome => (EffectType)3;
public bool ShowDefaultTooltip => true;
public string Tooltip => "https://crouton.net";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartNoise());
}
}
internal class Hazards : IEffect
{
public string Name => "Hazard hallucination";
public EffectType Outcome => (EffectType)1;
public bool ShowDefaultTooltip => true;
public string Tooltip => "This is not real";
public void Use()
{
Effects.SpawnQuicksand(30);
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 0));
}
}
internal class Haunted : IEffect
{
public string Name => "Haunted hallucination";
public EffectType Outcome => (EffectType)1;
public bool ShowDefaultTooltip => true;
public string Tooltip => "You are now cursed";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 2));
}
}
internal class Death : IEffect
{
public string Name => "Death hallucination";
public EffectType Outcome => (EffectType)0;
public bool ShowDefaultTooltip => true;
public string Tooltip => "The air feels different...";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 3));
}
}
internal class Academy : IEffect
{
public string Name => "Flowerman Academy";
public EffectType Outcome => (EffectType)0;
public bool ShowDefaultTooltip => false;
public string Tooltip => "Y\u0339\u0350\u034do\u0363\u036c\u0334ur c\u0316\u0364\u036fl\u035c\u0333\u0324as\u0361\u0308\u0300s\u0358\u0360\u036cm\u036f\u0316ates are e\u036e\u0322\u0365x\u0315\u030c\u0317cit\u0312\u0317\u0318e\u0345\u0369d to meet\u0333\u036d\u0366 y\u032a\u0338\u0324ou\u0314\u035a\u0312";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.TheAcademyIsNowOpen());
}
}
internal class SparkTowers : IEffect
{
public string Name => "Towers";
public EffectType Outcome => (EffectType)0;
public bool ShowDefaultTooltip => false;
public string Tooltip => "Plasma-powered radio transmitter online!";
public void Use()
{
((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.SparkWarning());
}
}
internal class Effects
{
public enum DeathAnimation
{
Normal,
NoHead1,
Spring,
Haunted,
Mask1,
Mask2,
Fire,
CutInHalf,
NoHead2
}
[CompilerGenerated]
private sealed class <DamageHost>d__8 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PlayerControllerB player;
public int damageNb;
public CauseOfDeath cause;
public int animation;
public bool criticalBlood;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DamageHost>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Damage(player, damageNb, cause, animation, criticalBlood);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FadeOutAudio>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSource source;
public float time;
public bool specialStop;
private float <volume>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeOutAudio>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<volume>5__1 = source.volume;
break;
case 2:
<>1__state = -1;
break;
}
if (source.volume > 0f)
{
AudioSource obj = source;
obj.volume -= <volume>5__1 * Time.deltaTime / time;
if (!specialStop || !(source.volume <= 0.01f))
{
<>2__current = null;
<>1__state = 2;
return true;
}
}
source.Stop();
source.volume = <volume>5__1;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <Status>d__34 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string text;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Status>d__34(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
HUDManager.Instance.DisplayStatusEffect(text);
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SyncScrap>d__40 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public NetworkReference reference;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SyncScrap>d__40(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(3f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
RoundManager.Instance.SyncScrapValuesClientRpc((NetworkObjectReference[])(object)new NetworkObjectReference[1] { reference.netObjectRef }, new int[1] { reference.value });
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static int NbOfPlayers()
{
return StartOfRound.Instance.connectedPlayersAmount + 1;
}
public static bool IsUnlucky(ulong playerId)
{
if (Plugin.config.unluckyPlayersID.Count == 0)
{
return false;
}
return Plugin.config.unluckyPlayersID.Find((ulong id) => id == playerId) != 0;
}
public static int GetLocalPlayerIndex()
{
return Array.IndexOf(StartOfRound.Instance.allPlayerScripts, GameNetworkManager.Instance.localPlayerController);
}
public static void FillMessagesFromLang(List<string> messages, string[] ids)
{
foreach (string id in ids)
{
messages.Add(Lang.Get(id));
}
}
public static List<PlayerControllerB> GetPlayers(bool includeDead = false, bool excludeOutsideFactory = false)
{
List<PlayerControllerB> list = StartOfRound.Instance.allPlayerScripts.ToList();
List<PlayerControllerB> list2 = new List<PlayerControllerB>(list);
foreach (PlayerControllerB item in list)
{
if (!((NetworkBehaviour)item).IsSpawned || !item.isPlayerControlled || (!includeDead && item.isPlayerDead) || (excludeOutsideFactory && !item.isInsideFactory))
{
list2.Remove(item);
}
}
return list2;
}
public static List<EnemyAI> GetEnemies(bool includeDead = false, bool includeCanDie = false, bool excludeDaytime = false)
{
List<EnemyAI> list = Object.FindObjectsOfType<EnemyAI>().ToList();
List<EnemyAI> list2 = new List<EnemyAI>(list);
if (includeDead)
{
return list2;
}
foreach (EnemyAI item in list)
{
if (!((NetworkBehaviour)item).IsSpawned || item.isEnemyDead || (!includeCanDie && !item.enemyType.canDie) || (excludeDaytime && item.enemyType.isDaytimeEnemy))
{
list2.Remove(item);
}
}
return list2;
}
public static void Damage(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
damageNb = ((player.health > 100 && damageNb == 100) ? 900 : damageNb);
if (criticalBlood && player.health - damageNb <= 20)
{
player.bleedingHeavily = true;
}
player.DamagePlayer(damageNb, true, true, cause, animation, false, default(Vector3));
}
[IteratorStateMachine(typeof(<DamageHost>d__8))]
public static IEnumerator DamageHost(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DamageHost>d__8(0)
{
player = player,
damageNb = damageNb,
cause = cause,
animation = animation,
criticalBlood = criticalBlood
};
}
public static void Heal(ulong playerID, int health)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
val.health = ((val.health > 100) ? val.health : health);
val.criticallyInjured = false;
val.bleedingHeavily = false;
val.playerBodyAnimator.SetBool("Limp", false);
}
public static void TeleportationLocal(PlayerControllerB player, Vector3 position)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
player.averageVelocity = 0f;
player.velocityLastFrame = Vector3.zero;
player.TeleportPlayer(position, true, 0f, false, true);
player.beamOutParticle.Play();
if (GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
}
public static void SetPosFlags(ulong playerID, bool ship = false, bool exterior = false, bool interior = false)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
if (ship)
{
val.isInElevator = true;
val.isInHangarShipRoom = true;
val.isInsideFactory = false;
}
if (exterior)
{
val.isInElevator = false;
val.isInHangarShipRoom = false;
val.isInsideFactory = false;
}
if (interior)
{
val.isInElevator = false;
val.isInHangarShipRoom = false;
val.isInsideFactory = true;
}
GrabbableObject[] itemSlots = val.ItemSlots;
foreach (GrabbableObject val2 in itemSlots)
{
if ((Object)(object)val2 != (Object)null)
{
val2.isInFactory = val.isInsideFactory;
val2.isInElevator = val.isInElevator;
val2.isInShipRoom = val.isInHangarShipRoom;
}
}
if (GameNetworkManager.Instance.localPlayerController.playerClientId == val.playerClientId)
{
if (val.isInsideFactory)
{
TimeOfDay.Instance.DisableAllWeather(false);
}
else
{
ActivateWeatherEffect((LevelWeatherType)0);
}
}
}
public static void Explosion(Vector3 position, float range, int damage = 50, float physicsForce = 1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(position, true, range, range * 2.5f, damage, physicsForce, (GameObject)null, false);
}
public static void ExplosionLight(Vector3 position, float range, int damage = 10, float physicsForce = 1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(position, true, 0f, range, damage, physicsForce, (GameObject)null, false);
}
public static bool IsPlayerFacingObject<T>(PlayerControllerB player, out T obj, float distance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward), ref val, distance, 2816))
{
obj = ((Component)((RaycastHit)(ref val)).transform).GetComponent<T>();
if (obj != null)
{
return true;
}
}
obj = default(T);
return false;
}
public static bool IsPlayerNearObject<T>(PlayerControllerB player, out T obj, float distance) where T : Component
{
//IL_0013: 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)
T[] array = Object.FindObjectsByType<T>((FindObjectsSortMode)0);
for (int i = 0; i < array.Length; i++)
{
if (Vector3.Distance(((Component)player).transform.position, ((Component)array[i]).transform.position) <= distance)
{
obj = array[i];
return true;
}
}
obj = default(T);
return false;
}
public static Vector3 GetClosestAINodePosition(GameObject[] nodes, Vector3 position)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
return nodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray()[0].transform.position;
}
public static void Knockback(Vector3 position, float range, int damage = 0, float physicsForce = 30f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(position, false, 0f, range, damage, physicsForce, (GameObject)null, false);
}
public static void DropItem(Vector3 placingPosition = default(Vector3))
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, placingPosition, true);
}
public static void Audio(int audioID, float volume)
{
RoundManager.PlayRandomClip(HUDManager.Instance.UIAudio, (AudioClip[])(object)new AudioClip[1] { Plugin.audioClips[audioID] }, false, volume, 0, 1000);
}
public static void Audio(int audioID, Vector3 startPosition, float localVolume, float clientVolume, PlayerControllerB player)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
{
Audio(audioID, localVolume);
}
else if ((Object)(object)player != (Object)null)
{
player.itemAudio.PlayOneShot(Plugin.audioClips[audioID], clientVolume);
}
else
{
AudioSource.PlayClipAtPoint(Plugin.audioClips[audioID], startPosition + Vector3.up * 2f, clientVolume);
}
}
public static void Audio(int[] audioIDs, Vector3 position, float volume, bool adjust = true)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
//IL_0056: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
AudioClip[] array = audioIDs.Select((int id) => Plugin.audioClips[id]).ToArray();
Vector3 val = position;
if (adjust)
{
val += Vector3.up * 2f;
}
GameObject val2 = new GameObject("One shot audio");
val2.transform.position = val;
AudioSource val3 = (AudioSource)val2.AddComponent(typeof(AudioSource));
val3.spatialBlend = 1f;
val3.rolloffMode = (AudioRolloffMode)1;
val3.minDistance = 0f;
val3.maxDistance = 20f;
val3.volume = volume;
RoundManager.PlayRandomClip(val3, array, true, volume, 0, 1000);
Object.Destroy((Object)(object)val2, array[^1].length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
}
public static void Audio3D(int audioID, Vector3 position, float volume = 1f, float distance = 20f)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0012: 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_002f: Expected O, but got Unknown
GameObject val = new GameObject("One shot audio");
val.transform.position = position;
AudioSource val2 = (AudioSource)val.AddComponent(typeof(AudioSource));
val2.spatialBlend = 1f;
val2.rolloffMode = (AudioRolloffMode)1;
val2.minDistance = 0f;
val2.maxDistance = distance;
val2.PlayOneShot(Plugin.audioClips[audioID], volume);
Object.Destroy((Object)(object)val, Plugin.audioClips[audioID].length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
}
[IteratorStateMachine(typeof(<FadeOutAudio>d__23))]
public static IEnumerator FadeOutAudio(AudioSource source, float time, bool specialStop = false)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeOutAudio>d__23(0)
{
source = source,
time = time,
specialStop = specialStop
};
}
public static void ChangeWeather(LevelWeatherType weather)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_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)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
LevelWeatherType currentWeather = StartOfRound.Instance.currentLevel.currentWeather;
StartOfRound.Instance.currentLevel.currentWeather = weather;
if (Plugin.config.WeatherRegistery)
{
ChangeWeatherWR(weather);
return;
}
RoundManager.Instance.SetToCurrentLevelWeather();
TimeOfDay.Instance.SetWeatherBasedOnVariables(StartOfRound.Instance.currentLevel.randomWeathers.Where((RandomWeatherWithVariables w) => w.weatherType == weather).First());
if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
ActivateWeatherEffect(currentWeather);
}
}
public static void ActivateWeatherEffect(LevelWeatherType originalWeather = 0)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Invalid comparison between Unknown and I4
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Invalid comparison between Unknown and I4
for (int i = 0; i < TimeOfDay.Instance.effects.Length; i++)
{
WeatherEffect val = TimeOfDay.Instance.effects[i];
bool flag = (val.effectEnabled = (int)StartOfRound.Instance.currentLevel.currentWeather == i);
if ((Object)(object)val.effectPermanentObject != (Object)null)
{
val.effectPermanentObject.SetActive(flag);
}
if ((Object)(object)val.effectObject != (Object)null)
{
val.effectObject.SetActive(flag);
}
if ((Object)(object)TimeOfDay.Instance.sunAnimator != (Object)null)
{
if (flag && !string.IsNullOrEmpty(val.sunAnimatorBool))
{
TimeOfDay.Instance.sunAnimator.SetBool(val.sunAnimatorBool, true);
continue;
}
TimeOfDay.Instance.sunAnimator.Rebind();
TimeOfDay.Instance.sunAnimator.Update(0f);
}
}
if ((int)originalWeather == 4)
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
localPlayerController.isUnderwater = false;
localPlayerController.sourcesCausingSinking = Mathf.Clamp(localPlayerController.sourcesCausingSinking - 1, 0, 100);
localPlayerController.isMovementHindered = Mathf.Clamp(localPlayerController.isMovementHindered - 1, 0, 100);
localPlayerController.hinderedMultiplier = 1f;
}
}
public static void ChangeWeatherWR(LevelWeatherType weather)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost)
{
WeatherController.SetWeatherEffects(weather);
}
}
public static void AddCombinedWeather(LevelWeatherType weather)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.config.WeatherRegistery)
{
AddCombinedWeatherWR(weather);
}
}
public static void AddCombinedWeatherWR(LevelWeatherType weather)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
WeatherController.AddWeatherEffect(weather);
}
public static void CreateCameraOBC(PlayerControllerB? targetPlayer, MeshRenderer? renderer, GameObject gameObject, Controller controller)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
MeshRenderer renderer2 = renderer;
if ((Object)(object)targetPlayer == (Object)null || (Object)(object)renderer2 == (Object)null)
{
return;
}
BodyCamComponent bodyCam = gameObject.GetComponent<BodyCamComponent>();
if ((Object)(object)bodyCam == (Object)null)
{
bodyCam = BodyCam.CreateBodyCam(gameObject, (Renderer)null, 0, (ManualCameraRenderer)null);
bodyCam.Resolution = new Vector2Int(860, 520);
bodyCam.OnCameraCreated += delegate(Camera cam)
{
SetRenderDistanceOBC(cam);
};
bodyCam.OnRenderTextureCreated += delegate
{
SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
};
bodyCam.OnBlankedSet += delegate
{
SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
};
SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
SetRenderDistanceOBC(bodyCam.GetCamera());
}
bodyCam.SetTargetToPlayer(targetPlayer);
bodyCam.ForceEnableCamera = true;
controller.cameraReady = true;
}
public static void DestroyCameraOBC(MeshRenderer? renderer, GameObject gameObject)
{
BodyCamComponent component = gameObject.GetComponent<BodyCamComponent>();
if ((Object)(object)component != (Object)null)
{
component.SetTargetToNone();
component.ForceEnableCamera = false;
}
if (renderer != null)
{
((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)null);
}
}
private static void SetTextureOBC(bool isBlanked, MeshRenderer? renderer, Camera? cam)
{
if (isBlanked)
{
if (renderer != null)
{
((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)null);
}
}
else if (renderer != null)
{
((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)(object)((cam != null) ? cam.targetTexture : null));
}
}
private static void SetRenderDistanceOBC(Camera? cam)
{
if ((Object)(object)cam != (Object)null)
{
cam.nearClipPlane = 0.01f;
cam.farClipPlane = 100f;
}
}
public static void Message(string title, string bottom, bool warning = false)
{
HUDManager.Instance.DisplayTip(title, bottom, warning, false, "LC_Tip1");
}
[IteratorStateMachine(typeof(<Status>d__34))]
public static IEnumerator Status(string text)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Status>d__34(0)
{
text = text
};
}
public static NetworkObjectReference Spawn(SpawnableEnemyWithRarity enemy, Vector3 position, float yRot = 0f)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_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_0054: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, yRot, 0f)));
val.GetComponentInChildren<NetworkObject>().Spawn(true);
RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
return new NetworkObjectReference(val);
}
public static void SpawnMaskedOfPlayer(ulong playerId, Vector3 position)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
bool flag = ((Component)component).transform.position.y < -80f;
NetworkObjectReference val = RoundManager.Instance.SpawnEnemyGameObject(position, ((Component)component).transform.eulerAngles.y, -1, PremiumScraps.Utils.GetEnemies.Masked.enemyType);
NetworkObject val2 = default(NetworkObject);
if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null))
{
MaskedPlayerEnemy component2 = ((Component)val2).GetComponent<MaskedPlayerEnemy>();
component2.SetSuit(component.currentSuitID);
component2.mimickingPlayer = component;
((EnemyAI)component2).SetEnemyOutside(!flag);
component2.CreateMimicClientRpc(val, flag, (int)playerId);
}
}
public static void Spawn(SpawnableMapObject trap, Vector3 position, float yRot = 0f)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(trap.prefabToSpawn, position, Quaternion.Euler(new Vector3(0f, yRot, 0f)), RoundManager.Instance.mapPropsContainer.transform);
val.GetComponent<NetworkObject>().Spawn(true);
}
public static SpawnableItemWithRarity GetScrap(string scrapName)
{
string scrapName2 = scrapName;
return ((IEnumerable<SpawnableItemWithRarity>)RoundManager.Instance.currentLevel.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity i) => ((Object)i.spawnableItem).name.Equals(scrapName2)));
}
public static NetworkReference Spawn(SpawnableItemWithRarity scrap, Vector3 position)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
Transform val = RoundManager.Instance.spawnedScrapContainer ?? StartOfRound.Instance.elevatorTransform;
GameObject val2 = Object.Instantiate<GameObject>(scrap.spawnableItem.spawnPrefab, position + Vector3.up * 0.25f, Quaternion.identity, val);
GrabbableObject component = val2.GetComponent<GrabbableObject>();
((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
component.fallTime = 1f;
component.hasHitGround = true;
component.reachedFloorTarget = true;
component.scrapValue = (int)((float)Random.Range(scrap.spawnableItem.minValue, scrap.spawnableItem.maxValue) * RoundManager.Instance.scrapValueMultiplier);
((NetworkBehaviour)component).NetworkObject.Spawn(false);
return new NetworkReference(NetworkObjectReference.op_Implicit(val2.GetComponent<NetworkObject>()), component.scrapValue);
}
[IteratorStateMachine(typeof(<SyncScrap>d__40))]
public static IEnumerator SyncScrap(NetworkReference reference)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SyncScrap>d__40(0)
{
reference = reference
};
}
public static void SpawnQuicksand(int nb)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Random random = new Random(StartOfRound.Instance.randomMapSeed + 2);
GameObject[] array = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode")
orderby Vector3.Distance(x.transform.position, Vector3.zero)
select x).ToArray();
NavMeshHit val = default(NavMeshHit);
for (int i = 0; i < nb; i++)
{
Vector3 position = array[random.Next(0, array.Length)].transform.position;
Vector3 val2 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, val, random, -1, 1f) + Vector3.up;
GameObject val3 = Object.Instantiate<GameObject>(RoundManager.Instance.quicksandPrefab, val2, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
}
}
public static void SpawnLightningBolt(Vector3 strikePosition, bool damage = true, bool redirectInside = true)
{
//IL_0027: 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_0032: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: 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_0174: 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_00c6: 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)
Random random = new Random(StartOfRound.Instance.randomMapSeed);
random.Next(-32, 32);
random.Next(-32, 32);
Vector3 val = strikePosition + Vector3.up * 160f + new Vector3((float)random.Next(-32, 32), 0f, (float)random.Next(-32, 32));
RaycastHit val2 = default(RaycastHit);
if (redirectInside && Physics.Linecast(val, strikePosition + Vector3.up * 0.5f, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
RaycastHit val3 = default(RaycastHit);
if (!Physics.Raycast(val, strikePosition - val, ref val3, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
return;
}
strikePosition = ((RaycastHit)(ref val3)).point;
}
StormyWeather val4 = Object.FindObjectOfType<StormyWeather>(true);
LightningBoltPrefabScript val5 = Object.Instantiate<LightningBoltPrefabScript>(val4.targetedThunder);
((Behaviour)val5).enabled = true;
((LightningBoltScript)val5).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
((LightningBoltPrefabScriptBase)val5).AutomaticModeSeconds = 0.2f;
val5.Source.transform.position = val;
val5.Destination.transform.position = strikePosition;
((LightningBoltPrefabScriptBase)val5).CreateLightningBoltsNow();
AudioSource val6 = Object.Instantiate<AudioSource>(val4.targetedStrikeAudio);
((Component)val6).transform.position = strikePosition + Vector3.up * 0.5f;
((Behaviour)val6).enabled = true;
if (damage)
{
Landmine.SpawnExplosion(strikePosition + Vector3.up * 0.25f, false, 2.4f, 5f, 50, 0f, (GameObject)null, false);
}
val4.PlayThunderEffects(strikePosition, val6);
}
}
[HarmonyPatch(typeof(Terminal))]
internal class GetEnemies
{
public static SpawnableEnemyWithRarity Masked;
public static SpawnableEnemyWithRarity HoardingBug;
public static SpawnableEnemyWithRarity SnareFlea;
public static SpawnableEnemyWithRarity Jester;
public static SpawnableEnemyWithRarity Bracken;
public static SpawnableEnemyWithRarity Thumper;
public static SpawnableEnemyWithRarity CoilHead;
public static SpawnableEnemyWithRarity CircuitBees;
public static SpawnableEnemyWithRarity EarthLeviathan;
public static SpawnableEnemyWithRarity BunkerSpider;
public static SpawnableEnemyWithRarity ForestKeeper;
public static SpawnableEnemyWithRarity GhostGirl;
public static SpawnableEnemyWithRarity TulipSnake;
public static SpawnableEnemyWithRarity EyelessDog;
public static SpawnableEnemyWithRarity Maneater;
public static SpawnableEnemyWithRarity Nutcracker;
public static SpawnableEnemyWithRarity Barber;
public static SpawnableEnemyWithRarity Butler;
public static SpawnableEnemyWithRarity OldBird;
public static SpawnableEnemyWithRarity ShyGuy;
public static SpawnableEnemyWithRarity RedwoodTitan;
public static SpawnableEnemyWithRarity RedwoodGiant;
public static SpawnableEnemyWithRarity Locker;
public static SpawnableEnemyWithRarity Bruce;
public static SpawnableEnemyWithRarity SparkTower;
public static SpawnableEnemyWithRarity BaboonHawk;
public static SpawnableEnemyWithRarity Tourist;
public static SpawnableEnemyWithRarity Kiwi;
public static SpawnableEnemyWithRarity Gunfish;
public static SpawnableEnemyWithRarity Feiopar;
public static SpawnableEnemyWithRarity CadaverGrowths;
public static SpawnableMapObject Landmine;
public static SpawnableMapObject Turret;
public static SpawnableMapObject SpikeTrap;
public static SpawnableMapObject Seamine;
public static SpawnableMapObject BigBertha;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void GetEnemy(Terminal __instance)
{
SelectableLevel[] moonsCatalogueList = __instance.moonsCatalogueList;
foreach (SelectableLevel val in moonsCatalogueList)
{
foreach (SpawnableEnemyWithRarity enemy in val.Enemies)
{
if (enemy.enemyType.enemyName == "Masked" && Masked == null)
{
Masked = enemy;
}
else if (enemy.enemyType.enemyName == "Hoarding bug" && HoardingBug == null)
{
HoardingBug = enemy;
}
else if (enemy.enemyType.enemyName == "Centipede" && SnareFlea == null)
{
SnareFlea = enemy;
}
else if (enemy.enemyType.enemyName == "Jester" && Jester == null)
{
Jester = enemy;
}
else if (enemy.enemyType.enemyName == "Flowerman" && Bracken == null)
{
Bracken = enemy;
}
else if (enemy.enemyType.enemyName == "Crawler" && Thumper == null)
{
Thumper = enemy;
}
else if (enemy.enemyType.enemyName == "Spring" && CoilHead == null)
{
CoilHead = enemy;
}
else if (enemy.enemyType.enemyName == "Bunker Spider" && BunkerSpider == null)
{
BunkerSpider = enemy;
}
else if (enemy.enemyType.enemyName == "Girl" && GhostGirl == null)
{
GhostGirl = enemy;
}
else if (enemy.enemyType.enemyName == "Maneater" && Maneater == null)
{
Maneater = enemy;
}
else if (enemy.enemyType.enemyName == "Nutcracker" && Nutcracker == null)
{
Nutcracker = enemy;
}
else if (enemy.enemyType.enemyName == "Clay Surgeon" && Barber == null)
{
Barber = enemy;
}
else if (enemy.enemyType.enemyName == "Butler" && Butler == null)
{
Butler = enemy;
}
else if (enemy.enemyType.enemyName == "Shy guy" && ShyGuy == null)
{
ShyGuy = enemy;
}
else if (enemy.enemyType.enemyName == "Locker" && Locker == null)
{
Locker = enemy;
}
else if (enemy.enemyType.enemyName == "Stingray" && Gunfish == null)
{
Gunfish = enemy;
}
else if (enemy.enemyType.enemyName == "Cadaver Growths" && CadaverGrowths == null)
{
CadaverGrowths = enemy;
}
}
foreach (SpawnableEnemyWithRarity daytimeEnemy in val.DaytimeEnemies)
{
if (daytimeEnemy.enemyType.enemyName == "Red Locust Bees" && CircuitBees == null)
{
CircuitBees = daytimeEnemy;
}
else if (daytimeEnemy.enemyType.enemyName == "Tulip Snake" && TulipSnake == null)
{
TulipSnake = daytimeEnemy;
}
else if (daytimeEnemy.enemyType.enemyName == "GiantKiwi" && Kiwi == null)
{
Kiwi = daytimeEnemy;
}
}
foreach (SpawnableEnemyWithRarity outsideEnemy in val.OutsideEnemies)
{
if (outsideEnemy.enemyType.enemyName == "Earth Leviathan" && EarthLeviathan == null)
{
EarthLeviathan = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "ForestGiant" && ForestKeeper == null)
{
ForestKeeper = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "MouthDog" && EyelessDog == null)
{
EyelessDog = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "Baboon hawk" && BaboonHawk == null)
{
BaboonHawk = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "RadMech" && OldBird == null)
{
OldBird = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "Redwood Titan" && RedwoodTitan == null)
{
RedwoodTitan = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "RedWoodGiant" && RedwoodGiant == null)
{
RedwoodGiant = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "Bruce" && Bruce == null)
{
Bruce = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "SparkTower" && SparkTower == null)
{
SparkTower = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "Tourist" && Tourist == null)
{
Tourist = outsideEnemy;
}
else if (outsideEnemy.enemyType.enemyName == "Feiopar" && Feiopar == null)
{
Feiopar = outsideEnemy;
}
}
SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
foreach (SpawnableMapObject val2 in spawnableMapObjects)
{
if (((Object)val2.prefabToSpawn).name == "Landmine" && Landmine == null)
{
Landmine = val2;
}
else if (((Object)val2.prefabToSpawn).name == "TurretContainer" && Turret == null)
{
Turret = val2;
}
else if (((Object)val2.prefabToSpawn).name == "SpikeRoofTrapHazard" && SpikeTrap == null)
{
SpikeTrap = val2;
}
else if (((Object)val2.prefabToSpawn).name == "Seamine" && Seamine == null)
{
Seamine = val2;
}
else if (((Object)val2.prefabToSpawn).name == "Bertha" && BigBertha == null)
{
BigBertha = val2;
}
}
}
}
}
internal static class Lang
{
public static string ACTUAL_LANG = "en";
private static readonly Dictionary<string, string> langValues = new Dictionary<string, string>();
public static string Get(string id)
{
return langValues.GetValueOrDefault(id, id);
}
public static void Load(ManualLogSource logger, SystemLanguage systemLanguage, string languageMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
ChooseLanguage(systemLanguage, languageMode);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Lang/lang-" + ACTUAL_LANG + ".json");
if (!File.Exists(text))
{
logger.LogError((object)("Languade file (" + text + ") was not found. Please re-download the mod properly."));
return;
}
JObject val = JObject.Parse(File.ReadAllText(text));
langValues.Clear();
foreach (var (text3, val3) in val)
{
langValues[text3] = ((object)val3)?.ToString() ?? text3;
}
}
private static void ChooseLanguage(SystemLanguage systemLanguage, string languageMode)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
if (1 == 0)
{
}
string aCTUAL_LANG = languageMode switch
{
"default" => ((int)systemLanguage == 14) ? "fr" : "en",
"english" => "en",
"french" => "fr",
_ => ((int)systemLanguage == 14) ? "fr" : "en",
};
if (1 == 0)
{
}
ACTUAL_LANG = aCTUAL_LANG;
}
}
[HarmonyPatch(typeof(ItemCharger))]
internal class BombItemChargerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
public static void UpdatePatch(ref ItemCharger __instance)
{
if ((float)Traverse.Create((object)__instance).Field("updateInterval").GetValue() == 0f && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
{
__instance.triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery || (((Object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties).name == "BombItem" && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is Bomb bomb && !bomb.activated));
}
}
[HarmonyPrefix]
[HarmonyPatch("ChargeItem")]
public static bool ChargeItemPatch()
{
return Bomb.ChargeItemUnstable();
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class MattyFixesAirhornPositionPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
[HarmonyPriority(400)]
public static void AwakePatch()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
ScrapItem val = Items.scrapItems.Find((ScrapItem i) => i.modName == "PremiumScraps" && i.item.itemName == "Airhorn");
if (val != null && val != null)
{
val.item.restingRotation = new Vector3(0f, -180f, 270f);
val.item.floorYOffset = -180;
}
}
}
[HarmonyPatch(typeof(Shovel))]
internal class SteelBarPatch
{
[HarmonyPostfix]
[HarmonyPatch("HitShovel")]
public static void HitShovelPatch(Shovel __instance, bool cancel)
{
SteelBar.TwoHandedFix(__instance, cancel);
}
}
[HarmonyPatch(typeof(HUDManager))]
internal class FrenchModeItemTooltipsPatch
{
[HarmonyPrefix]
[HarmonyPatch("ChangeControlTip")]
public static void ChangeControlTipPatch(HUDManager __instance, string changeTo)
{
if (!StartOfRound.Instance.localPlayerUsingController)
{
changeTo = changeTo.Replace("[Z]", "[W]");
changeTo = changeTo.Replace("[Q]", "[A]");
changeTo = changeTo.Replace("[Q/E]", "[A/E]");
}
}
[HarmonyPrefix]
[HarmonyPatch("ChangeControlTipMultiple")]
public static void ChangeControlTipMultiplePatch(HUDManager __instance, string[] allLines, bool holdingItem)
{
if (allLines != null && !StartOfRound.Instance.localPlayerUsingController)
{
for (int i = 0; i < allLines.Length && i + (holdingItem ? 1 : 0) < __instance.controlTipLines.Length; i++)
{
allLines[i] = allLines[i].Replace("[Z]", "[W]");
allLines[i] = allLines[i].Replace("[Q]", "[A]");
allLines[i] = allLines[i].Replace("[Q/E]", "[A/E]");
}
}
}
}
[HarmonyPatch(typeof(Terminal))]
internal class ControllerTerminalPatch
{
[HarmonyPostfix]
[HarmonyPatch("QuitTerminal")]
public static void QuitTerminalPatch()
{
ControllerMovement.FlagsFix();
}
}
[HarmonyPatch(typeof(HUDManager))]
internal class ControllerHUDManagerPatch
{
[HarmonyPrefix]
[HarmonyPatch("EnableChat_performed")]
public static bool EnableChatControllerPatch(HUDManager __instance)
{
return ControllerMovement.ChatPatch(__instance);
}
[HarmonyPrefix]
[HarmonyPatch("SubmitChat_performed")]
public static bool SubmitChatControllerPatch(HUDManager __instance)
{
return ControllerMovement.ChatPatch(__instance);
}
[HarmonyPrefix]
[HarmonyPatch("OpenMenu_performed")]
public static bool OpenMenuControllerPatch(HUDManager __instance)
{
return ControllerMovement.ChatPatch(__instance);
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class ControllerPlayerControllerBPatch
{
[HarmonyPrefix]
[HarmonyPatch("Jump_performed")]
public static bool JumpControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Jump);
}
[HarmonyPrefix]
[HarmonyPatch("Crouch_performed")]
public static bool CrouchControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Crouch);
}
[HarmonyPrefix]
[HarmonyPatch("Interact_performed")]
public static bool InteractControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Interact);
}
[HarmonyPrefix]
[HarmonyPatch("ActivateItem_performed")]
public static bool ActivateItemControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.ActivateItem);
}
[HarmonyPrefix]
[HarmonyPatch("ActivateItem_canceled")]
public static bool CancelItemControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.CancelItem);
}
[HarmonyPrefix]
[HarmonyPatch("Discard_performed")]
public static bool DiscardControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.DropItem, canBeCanceled: true);
}
[HarmonyPrefix]
[HarmonyPatch("ScrollMouse_performed")]
public static bool ScrollControllerPatch(PlayerControllerB __instance, CallbackContext context)
{
return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.SwitchItem, ((CallbackContext)(ref context)).ReadValue<float>());
}
[HarmonyPrefix]
[HarmonyPatch("UseUtilitySlot_performed")]
public static bool UtilitySlotPatch(PlayerControllerB __instance, CallbackContext context)
{
return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.SwitchItemUtility, 50f);
}
[HarmonyPrefix]
[HarmonyPatch("Emote1_performed")]
public static bool Emote1ControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.Emote, 1f);
}
[HarmonyPrefix]
[HarmonyPatch("Emote2_performed")]
public static bool Emote2ControllerPatch(PlayerControllerB __instance)
{
return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.Emote, 2f);
}
[HarmonyPrefix]
[HarmonyPatch("CheckConditionsForEmote")]
public static bool EmoteConditionControllerPatch(PlayerControllerB __instance, ref bool __result)
{
bool flag = ControllerMovement.EmoteConditionPatch(__instance);
if (!flag)
{
__result = true;
}
return flag;
}
[HarmonyPrefix]
[HarmonyPatch("Update")]
public static void UpdateControllerPrePatch(PlayerControllerB __instance)
{
ControllerMovement.PlayerVectorPatch(__instance, ControllerMovement.ControllerActions.Move);
}
[HarmonyPostfix]
[HarmonyPatch("Update")]
public static void UpdateControllerPostPatch()
{
ControllerMovement.InvertFlagsFix();
}
[HarmonyPrefix]
[HarmonyPatch("PlayerLookInput")]
public static void PlayerLookInputControllerPrePatch(PlayerControllerB __instance)
{
ControllerMovement.PlayerVectorPatch(__instance, ControllerMovem