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.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using GiantExtensionLaddersV2.Behaviours;
using GiantExtensionLaddersV2.ConfigStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UIElements.Collections;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("inoyu.GiantExtensionLadders")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("3.3.1.0")]
[assembly: AssemblyInformationalVersion("3.3.1+01d51b2e5ad5f3e164c2dfc5e3d4e00153bbf21a")]
[assembly: AssemblyProduct("GiantExtensionLaddersV2")]
[assembly: AssemblyTitle("inoyu.GiantExtensionLadders")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.3.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace GiantExtensionLaddersV2
{
[BepInPlugin("inoyu.GiantExtensionLadders", "GiantExtensionLaddersV2", "3.3.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency("com.sigurd.csync", "5.0.0")]
public class GiantExtensionLaddersV2 : BaseUnityPlugin
{
internal static MySyncedConfigs mySyncedConfigs;
private const string ladderAssetbundleName = "allLadderAssets";
private const string tinyLadderAssetbundleName = "TinyLadderAssets";
private const string bigLadderAssetbundleName = "BigLadderAssets";
private const string hugeLadderAssetbundleName = "HugeLadderAssets";
private const string ultimateLadderAssetbundleName = "UltimateLadderAssets";
private const string ladderCollectorAssetBundleName = "laddercollector";
private const string tinyLadderItemPropertiesLocation = "Assets/extLadderTest/tinyLadder/TinyLadder.asset";
private const string bigLadderItemPropertiesLocation = "Assets/extLadderTest/BigLadder/BigLadder.asset";
private const string hugeLadderItemPropertiesLocation = "Assets/extLadderTest/HugeLadder/HugeLadder.asset";
private const string ultimateLadderItemPropertiesLocation = "Assets/extLadderTest/Gigantic ladder/UltimateLadderItem.asset";
private const string ladderCollectorItemLocation = "Assets/LethalCompany/Mods/Items/LadderCollector/LadderCollectorItem.asset";
private const int MAX_PROPERTY_AMOUNT = 19;
internal static int propertyCounter = 0;
internal LadderObject tinyLadder = new LadderObject(10.3f, 75f, 0.15f, ladderIsClimbable: false, GiantLadderType.TINY);
internal LadderObject bigLadder = new LadderObject(17f, 60f, 0.15f, ladderIsClimbable: true, GiantLadderType.BIG);
internal LadderObject hugeLadder = new LadderObject(34.4f, 60f, 0.2f, ladderIsClimbable: true, GiantLadderType.HUGE);
internal LadderObject ultimateLadder = new LadderObject(68f, 60f, 0.25f, ladderIsClimbable: true, GiantLadderType.ULTIMATE);
internal static Item? tinyLadderItem;
internal static Item? bigLadderItem;
internal static Item? hugeLadderItem;
internal static Item? ultimateLadderItem;
internal static Item? ladderCollectorItem;
internal static TerminalNode? tinyLadderNode;
internal static TerminalNode? bigLadderNode;
internal static TerminalNode? hugeLadderNode;
internal static TerminalNode? ultimateLadderNode;
internal static TerminalNode? ladderCollectorNode;
internal static Dictionary<Item, string> originalItemNames = new Dictionary<Item, string>();
internal static bool isBuildSuccess = true;
internal static bool isPlayerOnTinyLadder = false;
internal static GiantExtensionLaddersV2 Instance { get; private set; } = null;
internal static ManualLogSource mls { get; private set; } = null;
internal static Harmony? Harmony { get; set; }
private void Awake()
{
//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: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("inoyu.GiantExtensionLadders");
}
mls = ((BaseUnityPlugin)this).Logger;
Instance = this;
mySyncedConfigs = new MySyncedConfigs(((BaseUnityPlugin)this).Config);
mls.LogInfo((object)"loading assetbundles");
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TinyLadderAssets");
string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BigLadderAssets");
string text3 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "HugeLadderAssets");
string text4 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "UltimateLadderAssets");
string text5 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "laddercollector");
AssetBundle val = AssetBundle.LoadFromFile(text);
AssetBundle val2 = AssetBundle.LoadFromFile(text2);
AssetBundle val3 = AssetBundle.LoadFromFile(text3);
AssetBundle val4 = AssetBundle.LoadFromFile(text4);
AssetBundle val5 = AssetBundle.LoadFromFile(text5);
if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val == (Object)null || (Object)(object)val4 == (Object)null)
{
mls.LogError((object)"failed to load assetbundles");
return;
}
tinyLadderItem = val.LoadAsset<Item>("Assets/extLadderTest/tinyLadder/TinyLadder.asset");
bigLadderItem = val2.LoadAsset<Item>("Assets/extLadderTest/BigLadder/BigLadder.asset");
hugeLadderItem = val3.LoadAsset<Item>("Assets/extLadderTest/HugeLadder/HugeLadder.asset");
ultimateLadderItem = val4.LoadAsset<Item>("Assets/extLadderTest/Gigantic ladder/UltimateLadderItem.asset");
ladderCollectorItem = val5.LoadAsset<Item>("Assets/LethalCompany/Mods/Items/LadderCollector/LadderCollectorItem.asset");
if ((Object)(object)bigLadderItem == (Object)null || (Object)(object)hugeLadderItem == (Object)null || (Object)(object)tinyLadderItem == (Object)null || (Object)(object)ultimateLadderItem == (Object)null || (Object)(object)ladderCollectorItem == (Object)null)
{
mls.LogError((object)"failed to load items from item assetbundles");
return;
}
mls.LogInfo((object)"building tiny ladder...");
tinyLadder.ladderPrefab = tinyLadderItem.spawnPrefab;
tinyLadder.meshRenderers = tinyLadder.ladderPrefab.GetComponentsInChildren<MeshRenderer>().ToList();
tinyLadder.animators = tinyLadder.ladderPrefab.GetComponentsInChildren<Animator>().ToList();
tinyLadder.transforms = tinyLadder.ladderPrefab.GetComponentsInChildren<Transform>().ToList();
tinyLadder.audioClips = val.LoadAllAssets<AudioClip>().ToList();
tinyLadder.audioSources = tinyLadder.ladderPrefab.GetComponentsInChildren<AudioSource>().ToList();
tinyLadder.interactTriggers = tinyLadder.ladderPrefab.GetComponentsInChildren<InteractTrigger>().ToList();
tinyLadder.boxColliders = tinyLadder.ladderPrefab.GetComponentsInChildren<BoxCollider>().ToList();
LadderItemScript ladderItemScript = tinyLadder.ladderPrefab.AddComponent<LadderItemScript>();
if ((Object)(object)tinyLadder.ladderPrefab.GetComponent<LadderItemScript>() == (Object)null)
{
mls.LogError((object)"tinyLadderItemPrefab failed");
return;
}
((GrabbableObject)ladderItemScript).grabbable = true;
((GrabbableObject)ladderItemScript).grabbableToEnemies = true;
((GrabbableObject)ladderItemScript).itemProperties = tinyLadderItem;
ladderItemScript.maxExtension = tinyLadder.LADDER_MAX_EXTENSION;
ladderItemScript.minInteractableRotation = tinyLadder.LADDER_MIN_ROTATION_FOR_INTERACTION;
ladderItemScript.ladderRotateSpeedMultiplier = tinyLadder.LADDER_ROTATE_SPEED;
ladderItemScript.isClimbable = true;
ladderItemScript.isClimbableInShip = true;
ladderItemScript.giantLadderType = tinyLadder.ladderType;
BuildLadderItemScript(tinyLadder.meshRenderers, tinyLadder.animators, tinyLadder.transforms, tinyLadder.audioClips, tinyLadder.audioSources, tinyLadder.interactTriggers, tinyLadder.boxColliders, ladderItemScript);
tinyLadderItem.canBeGrabbedBeforeGameStart = true;
mls.LogInfo((object)"building big ladder...");
bigLadder.ladderPrefab = bigLadderItem.spawnPrefab;
bigLadder.meshRenderers = bigLadder.ladderPrefab.GetComponentsInChildren<MeshRenderer>().ToList();
bigLadder.animators = bigLadder.ladderPrefab.GetComponentsInChildren<Animator>().ToList();
bigLadder.transforms = bigLadder.ladderPrefab.GetComponentsInChildren<Transform>().ToList();
bigLadder.audioClips = val2.LoadAllAssets<AudioClip>().ToList();
bigLadder.audioSources = bigLadder.ladderPrefab.GetComponentsInChildren<AudioSource>().ToList();
bigLadder.interactTriggers = bigLadder.ladderPrefab.GetComponentsInChildren<InteractTrigger>().ToList();
bigLadder.boxColliders = bigLadder.ladderPrefab.GetComponentsInChildren<BoxCollider>().ToList();
LadderItemScript ladderItemScript2 = bigLadder.ladderPrefab.AddComponent<LadderItemScript>();
if ((Object)(object)bigLadder.ladderPrefab.GetComponent<LadderItemScript>() == (Object)null)
{
mls.LogError((object)"bigLadderScript failed");
return;
}
((GrabbableObject)ladderItemScript2).grabbable = true;
((GrabbableObject)ladderItemScript2).grabbableToEnemies = true;
((GrabbableObject)ladderItemScript2).itemProperties = bigLadderItem;
ladderItemScript2.maxExtension = bigLadder.LADDER_MAX_EXTENSION;
ladderItemScript2.minInteractableRotation = bigLadder.LADDER_MIN_ROTATION_FOR_INTERACTION;
ladderItemScript2.ladderRotateSpeedMultiplier = bigLadder.LADDER_ROTATE_SPEED;
ladderItemScript2.isClimbable = bigLadder.LADDER_IS_CLIMBABLE;
ladderItemScript2.giantLadderType = bigLadder.ladderType;
BuildLadderItemScript(bigLadder.meshRenderers, bigLadder.animators, bigLadder.transforms, bigLadder.audioClips, bigLadder.audioSources, bigLadder.interactTriggers, bigLadder.boxColliders, ladderItemScript2);
mls.LogInfo((object)"building huge ladder...");
hugeLadder.ladderPrefab = hugeLadderItem.spawnPrefab;
hugeLadder.meshRenderers = hugeLadder.ladderPrefab.GetComponentsInChildren<MeshRenderer>().ToList();
hugeLadder.animators = hugeLadder.ladderPrefab.GetComponentsInChildren<Animator>().ToList();
hugeLadder.transforms = hugeLadder.ladderPrefab.GetComponentsInChildren<Transform>().ToList();
hugeLadder.audioClips = val3.LoadAllAssets<AudioClip>().ToList();
hugeLadder.audioSources = hugeLadder.ladderPrefab.GetComponentsInChildren<AudioSource>().ToList();
hugeLadder.interactTriggers = hugeLadder.ladderPrefab.GetComponentsInChildren<InteractTrigger>().ToList();
hugeLadder.boxColliders = hugeLadder.ladderPrefab.GetComponentsInChildren<BoxCollider>().ToList();
LadderItemScript ladderItemScript3 = hugeLadder.ladderPrefab.AddComponent<LadderItemScript>();
if ((Object)(object)hugeLadder.ladderPrefab.GetComponent<LadderItemScript>() == (Object)null)
{
mls.LogError((object)"hugeLadderScript failed");
return;
}
((GrabbableObject)ladderItemScript3).grabbable = true;
((GrabbableObject)ladderItemScript3).grabbableToEnemies = true;
((GrabbableObject)ladderItemScript3).itemProperties = hugeLadderItem;
ladderItemScript3.maxExtension = hugeLadder.LADDER_MAX_EXTENSION;
ladderItemScript3.minInteractableRotation = hugeLadder.LADDER_MIN_ROTATION_FOR_INTERACTION;
ladderItemScript3.ladderRotateSpeedMultiplier = hugeLadder.LADDER_ROTATE_SPEED;
ladderItemScript3.isClimbable = hugeLadder.LADDER_IS_CLIMBABLE;
ladderItemScript3.giantLadderType = hugeLadder.ladderType;
BuildLadderItemScript(hugeLadder.meshRenderers, hugeLadder.animators, hugeLadder.transforms, hugeLadder.audioClips, hugeLadder.audioSources, hugeLadder.interactTriggers, hugeLadder.boxColliders, ladderItemScript3);
mls.LogInfo((object)"building ultimate ladder...");
ultimateLadder.ladderPrefab = ultimateLadderItem.spawnPrefab;
ultimateLadder.meshRenderers = ultimateLadder.ladderPrefab.GetComponentsInChildren<MeshRenderer>().ToList();
ultimateLadder.animators = ultimateLadder.ladderPrefab.GetComponentsInChildren<Animator>().ToList();
ultimateLadder.transforms = ultimateLadder.ladderPrefab.GetComponentsInChildren<Transform>().ToList();
ultimateLadder.audioClips = val4.LoadAllAssets<AudioClip>().ToList();
ultimateLadder.audioSources = ultimateLadder.ladderPrefab.GetComponentsInChildren<AudioSource>().ToList();
ultimateLadder.interactTriggers = ultimateLadder.ladderPrefab.GetComponentsInChildren<InteractTrigger>().ToList();
ultimateLadder.boxColliders = ultimateLadder.ladderPrefab.GetComponentsInChildren<BoxCollider>().ToList();
LadderItemScript ladderItemScript4 = ultimateLadder.ladderPrefab.AddComponent<LadderItemScript>();
if ((Object)(object)ultimateLadder.ladderPrefab.GetComponent<LadderItemScript>() == (Object)null)
{
mls.LogError((object)"ultimateLadderScript failed");
return;
}
((GrabbableObject)ladderItemScript4).grabbable = true;
((GrabbableObject)ladderItemScript4).grabbableToEnemies = true;
((GrabbableObject)ladderItemScript4).itemProperties = ultimateLadderItem;
ladderItemScript4.maxExtension = ultimateLadder.LADDER_MAX_EXTENSION;
ladderItemScript4.minInteractableRotation = ultimateLadder.LADDER_MIN_ROTATION_FOR_INTERACTION;
ladderItemScript4.ladderRotateSpeedMultiplier = ultimateLadder.LADDER_ROTATE_SPEED;
ladderItemScript4.isClimbable = ultimateLadder.LADDER_IS_CLIMBABLE;
ladderItemScript4.giantLadderType = ultimateLadder.ladderType;
BuildLadderItemScript(ultimateLadder.meshRenderers, ultimateLadder.animators, ultimateLadder.transforms, ultimateLadder.audioClips, ultimateLadder.audioSources, ultimateLadder.interactTriggers, ultimateLadder.boxColliders, ladderItemScript4);
if (!isBuildSuccess)
{
mls.LogError((object)"Ran into a problem finding all ladder components on some ladders. If you see this, please add it as an issue on this mod's GitHub page.");
return;
}
LadderCollectorScript ladderCollectorScript = ladderCollectorItem.spawnPrefab.AddComponent<LadderCollectorScript>();
if ((Object)(object)ladderCollectorScript == (Object)null)
{
mls.LogError((object)"ladderCollectorScript failed");
return;
}
((GrabbableObject)ladderCollectorScript).grabbable = true;
((GrabbableObject)ladderCollectorScript).grabbableToEnemies = false;
((GrabbableObject)ladderCollectorScript).itemProperties = ladderCollectorItem;
ladderCollectorScript.lcAudioSource = ladderCollectorItem.spawnPrefab.GetComponent<AudioSource>();
ladderCollectorScript.teleportationLight = ladderCollectorItem.spawnPrefab.GetComponentInChildren<Light>();
List<Transform> list = ladderCollectorItem.spawnPrefab.GetComponentsInChildren<Transform>().ToList();
List<AudioClip> list2 = val5.LoadAllAssets<AudioClip>().ToList();
foreach (Transform item in list)
{
if (((Object)item).name.Equals("BaseNode"))
{
ladderCollectorScript.baseNode = item;
}
else if (((Object)item).name.Equals("LadderSpawnNode"))
{
ladderCollectorScript.ladderSpawnNode = item;
}
}
foreach (AudioClip item2 in list2)
{
if (((Object)item2).name.Equals("spawnSFX3"))
{
ladderCollectorScript.spawnAudio = item2;
}
}
if ((Object)(object)ladderCollectorScript.baseNode == (Object)null || (Object)(object)ladderCollectorScript.ladderSpawnNode == (Object)null || (Object)(object)ladderCollectorScript.spawnAudio == (Object)null || (Object)(object)ladderCollectorScript.lcAudioSource == (Object)null || (Object)(object)ladderCollectorScript.teleportationLight == (Object)null)
{
mls.LogError((object)"some components for ladderCollector couldn't be found!");
return;
}
NetworkPrefabs.RegisterNetworkPrefab(tinyLadderItem.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(bigLadderItem.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(hugeLadderItem.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(ultimateLadderItem.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(ladderCollectorItem.spawnPrefab);
Utilities.FixMixerGroups(tinyLadderItem.spawnPrefab);
Utilities.FixMixerGroups(bigLadderItem.spawnPrefab);
Utilities.FixMixerGroups(hugeLadderItem.spawnPrefab);
Utilities.FixMixerGroups(ultimateLadderItem.spawnPrefab);
Utilities.FixMixerGroups(ladderCollectorItem.spawnPrefab);
tinyLadderNode = ScriptableObject.CreateInstance<TerminalNode>();
tinyLadderNode.clearPreviousText = true;
tinyLadderNode.displayText = "Awwww... tiny ladder! Can be used if the person climbing is also tiny!\n\n";
Items.RegisterShopItem(tinyLadderItem, (TerminalNode)null, (TerminalNode)null, tinyLadderNode, SyncedEntry<int>.op_Implicit(mySyncedConfigs.tinyLadderPrice));
bigLadderNode = ScriptableObject.CreateInstance<TerminalNode>();
bigLadderNode.clearPreviousText = true;
bigLadderNode.displayText = "This ladder is 17m high, thats about 1,75x height of the standard ladder.\n\n";
Items.RegisterShopItem(bigLadderItem, (TerminalNode)null, (TerminalNode)null, bigLadderNode, SyncedEntry<int>.op_Implicit(mySyncedConfigs.bigLadderPrice));
hugeLadderNode = ScriptableObject.CreateInstance<TerminalNode>();
hugeLadderNode.clearPreviousText = true;
hugeLadderNode.displayText = "This ladder is 34m high, thats about 3,5x height of the standard ladder.\n\n";
Items.RegisterShopItem(hugeLadderItem, (TerminalNode)null, (TerminalNode)null, hugeLadderNode, SyncedEntry<int>.op_Implicit(mySyncedConfigs.hugeLadderPrice));
ultimateLadderNode = ScriptableObject.CreateInstance<TerminalNode>();
ultimateLadderNode.clearPreviousText = true;
ultimateLadderNode.displayText = "This ladder is 68m high, thats about 7x height of the standard ladder.\n\n";
Items.RegisterShopItem(ultimateLadderItem, (TerminalNode)null, (TerminalNode)null, ultimateLadderNode, SyncedEntry<int>.op_Implicit(mySyncedConfigs.ultimateLadderPrice));
ladderCollectorNode = ScriptableObject.CreateInstance<TerminalNode>();
ladderCollectorNode.clearPreviousText = true;
ladderCollectorNode.displayText = "This device somehow detects and attracts ladders within an huge range.\n\n";
Items.RegisterShopItem(ladderCollectorItem, (TerminalNode)null, (TerminalNode)null, ladderCollectorNode, 75);
originalItemNames.Add(tinyLadderItem, tinyLadderItem.itemName);
originalItemNames.Add(bigLadderItem, bigLadderItem.itemName);
originalItemNames.Add(hugeLadderItem, hugeLadderItem.itemName);
originalItemNames.Add(ultimateLadderItem, ultimateLadderItem.itemName);
originalItemNames.Add(ladderCollectorItem, ladderCollectorItem.itemName);
Harmony.PatchAll();
mls.LogInfo((object)"builds completed and items should be in shop.");
mls.LogInfo((object)"inoyu.GiantExtensionLadders v3.3.1 has fully loaded!");
}
private void BuildLadderItemScript(List<MeshRenderer> meshRenderers, List<Animator> animators, List<Transform> transforms, List<AudioClip> audioClips, List<AudioSource> audioSources, List<InteractTrigger> interactTriggers, List<BoxCollider> boxColliders, LadderItemScript ladderItemScript)
{
propertyCounter = 0;
foreach (MeshRenderer meshRenderer in meshRenderers)
{
if (((Object)meshRenderer).name.Equals("LadderBox"))
{
propertyCounter++;
((GrabbableObject)ladderItemScript).mainObjectRenderer = meshRenderer;
break;
}
}
foreach (Animator animator in animators)
{
if (((Object)animator).name.Equals("AnimContainer"))
{
propertyCounter++;
ladderItemScript.ladderAnimator = animator;
}
if (((Object)animator).name.Equals("MeshContainer"))
{
propertyCounter++;
ladderItemScript.ladderRotateAnimator = animator;
}
}
foreach (Transform transform in transforms)
{
if (((Object)transform).name.Equals("Base"))
{
propertyCounter++;
ladderItemScript.baseNode = transform;
}
if (((Object)transform).name.Equals("TopPosition"))
{
propertyCounter++;
ladderItemScript.topNode = transform;
}
if (((Object)transform).name.Equals("TopCollisionNode"))
{
propertyCounter++;
ladderItemScript.topCollisionNode = transform;
}
if (((Object)transform).name.Equals("MovableNode"))
{
propertyCounter++;
ladderItemScript.moveableNode = transform;
}
}
foreach (AudioClip audioClip in audioClips)
{
if (((Object)audioClip).name.Equals("ExtensionLadderHitWall"))
{
propertyCounter++;
ladderItemScript.hitRoof = audioClip;
}
if (((Object)audioClip).name.Equals("ExtensionLadderHitWall2"))
{
propertyCounter += 2;
ladderItemScript.fullExtend = audioClip;
ladderItemScript.hitWall = audioClip;
}
if (((Object)audioClip).name.Equals("ExtensionLadderExtend"))
{
propertyCounter++;
ladderItemScript.ladderExtendSFX = audioClip;
}
if (((Object)audioClip).name.Equals("ExtensionLadderShrink"))
{
propertyCounter++;
ladderItemScript.ladderShrinkSFX = audioClip;
}
if (((Object)audioClip).name.Equals("ExtensionLadderAlarm"))
{
propertyCounter++;
ladderItemScript.blinkWarningSFX = audioClip;
}
if (((Object)audioClip).name.Equals("ExtensionLadderLidOpen"))
{
propertyCounter++;
ladderItemScript.lidOpenSFX = audioClip;
}
}
foreach (AudioSource audioSource in audioSources)
{
if (((Object)audioSource).name.Equals("LadderAudio"))
{
propertyCounter++;
ladderItemScript.ladderAudio = audioSource;
break;
}
}
foreach (InteractTrigger interactTrigger in interactTriggers)
{
if (((Object)interactTrigger).name.Equals("ExtLadderTrigger"))
{
ladderItemScript.ladderScript = interactTrigger;
propertyCounter++;
break;
}
}
foreach (BoxCollider boxCollider in boxColliders)
{
if (((Object)boxCollider).name.Equals("ExtLadderTrigger"))
{
propertyCounter++;
ladderItemScript.interactCollider = (Collider)(object)boxCollider;
}
if (((Object)boxCollider).name.Equals("LadderBridgeCollider"))
{
propertyCounter++;
ladderItemScript.bridgeCollider = (Collider)(object)boxCollider;
}
if (((Object)boxCollider).name.Equals("KillTrigger"))
{
propertyCounter++;
ladderItemScript.killTrigger = (Collider)(object)boxCollider;
}
}
if (propertyCounter != 19)
{
mls.LogError((object)("Some Components of " + ((Object)ladderItemScript).name + " are missing!"));
isBuildSuccess = false;
}
}
}
internal enum GiantLadderType
{
TINY,
BIG,
HUGE,
ULTIMATE
}
internal class LadderObject
{
internal List<MeshRenderer> meshRenderers { get; set; }
internal List<Animator> animators { get; set; }
internal List<Transform> transforms { get; set; }
internal List<AudioClip> audioClips { get; set; }
internal List<AudioSource> audioSources { get; set; }
internal List<InteractTrigger> interactTriggers { get; set; }
internal List<BoxCollider> boxColliders { get; set; }
internal GameObject ladderPrefab { get; set; }
internal GiantLadderType ladderType { get; private set; }
internal float LADDER_MAX_EXTENSION { get; private set; }
internal float LADDER_MIN_ROTATION_FOR_INTERACTION { get; private set; }
internal int LADDER_LINECAST_CHECKS_MULTIPLIER { get; private set; }
internal int LADDER_LINECAST_MIN_CHECK_HEIGHT { get; private set; }
internal float LADDER_HEIGHT_MULTIPLIER { get; private set; }
internal float LADDER_ROTATE_SPEED { get; private set; }
internal bool LADDER_IS_CLIMBABLE { get; private set; }
public LadderObject(float ladderMaxExtension, float ladderMinRotationForInteraction, float ladderRotateSpeed, bool ladderIsClimbable, GiantLadderType type)
{
LADDER_MAX_EXTENSION = ladderMaxExtension;
LADDER_MIN_ROTATION_FOR_INTERACTION = ladderMinRotationForInteraction;
LADDER_ROTATE_SPEED = ladderRotateSpeed;
LADDER_IS_CLIMBABLE = ladderIsClimbable;
ladderType = type;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "inoyu.GiantExtensionLadders";
public const string PLUGIN_NAME = "GiantExtensionLaddersV2";
public const string PLUGIN_VERSION = "3.3.1";
}
}
namespace GiantExtensionLaddersV2.Patches
{
[HarmonyPatch(typeof(InteractTrigger))]
internal class LadderPlayerSnapPatch
{
private const float NEGATIVE_OFFSET_BASE_VALUE = 0.25f;
private const float TINY_LADDER_OFFSET_BASE_VALUE = -0.215f;
private const float OFFSET_BASE_VALUE = 0.035f;
private const float BIGGER_LADDER_SIZE_START = 20f;
private const int CLOSE_POS_ADDITIONAL_CHECKS = 10;
private const int LADDER_BOT_RESET_AMOUNT = 2;
private const int LADDER_TOP_RESET_AMOUNT = 5;
private const float GROUND_OFFSET = 0.5f;
private const float TINY_LADDER_GROUND_OFFSET = 0.05f;
[HarmonyPrefix]
[HarmonyPatch("ladderClimbAnimation")]
public static void PatchLadderPlayerSnap(InteractTrigger __instance, ref PlayerControllerB playerController)
{
//IL_0033: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
LadderItemScript componentInParent = ((Component)__instance).GetComponentInParent<LadderItemScript>();
if ((Object)(object)componentInParent != (Object)null)
{
if (componentInParent.giantLadderType == GiantLadderType.TINY)
{
__instance.bottomOfLadderPosition.position = new Vector3(__instance.bottomOfLadderPosition.position.x, playerController.thisPlayerBody.position.y - 0.2f, __instance.bottomOfLadderPosition.position.z);
GiantExtensionLaddersV2.isPlayerOnTinyLadder = true;
}
else
{
GiantExtensionLaddersV2.isPlayerOnTinyLadder = false;
}
Vector3 val = __instance.topOfLadderPosition.position - __instance.bottomOfLadderPosition.position;
Vector3 val2 = Vector3.Normalize(val);
float num = Vector3.Dot(Vector3.up, val2);
float vector3CloseToLadder = GetVector3CloseToLadder(__instance.bottomOfLadderPosition.position, __instance.topOfLadderPosition.position, val2, playerController.thisPlayerBody.position);
Vector3 val3 = __instance.bottomOfLadderPosition.position + vector3CloseToLadder * val2;
float num2 = Vector3.Distance(__instance.topOfLadderPosition.position, __instance.bottomOfLadderPosition.position);
Vector3 val4 = default(Vector3);
((Vector3)(ref val4))..ctor(0f, 0.035f, 0f);
val4 *= vector3CloseToLadder;
if (val3.y + val4.y >= __instance.topOfLadderPosition.position.y && vector3CloseToLadder > 5f)
{
val3 = __instance.bottomOfLadderPosition.position + (vector3CloseToLadder - 5f) * val2;
}
else if (vector3CloseToLadder < 2f && num2 >= 20f)
{
val4 += __instance.bottomOfLadderPosition.forward * 0.25f;
}
if (componentInParent.giantLadderType == GiantLadderType.TINY)
{
if (((GrabbableObject)componentInParent).isInShipRoom)
{
Vector3 val5 = __instance.bottomOfLadderPosition.forward * -0.215f * (1.3f - (num * 2f - 1f));
val4 += val5;
val4 += val2 * 0.05f;
}
else
{
Vector3 val6 = __instance.bottomOfLadderPosition.forward * -0.215f * 0.75f;
val4 += val6;
val4 += val2 * 0.05f;
}
}
else
{
val4 += val2 * 0.5f;
}
val3 += val4;
__instance.ladderPlayerPositionNode.position = val3;
playerController.thisPlayerBody.position = val3;
}
else
{
GiantExtensionLaddersV2.isPlayerOnTinyLadder = false;
}
}
private static float GetVector3CloseToLadder(Vector3 bottomPos, Vector3 topPos, Vector3 normalizedLDV, Vector3 playerVector)
{
//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)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
float num2 = float.MaxValue;
float num3 = Vector3.Distance(bottomPos, topPos) + 10f;
for (int i = 0; (float)i < num3; i++)
{
Vector3 val = bottomPos + (float)i * normalizedLDV;
float num4 = Vector3.Distance(playerVector, val);
if (num4 < num2)
{
num2 = num4;
num = i;
continue;
}
return num;
}
return num3 / 2f;
}
}
[HarmonyPatch]
public class LoadLadderConfigsPatch
{
private const bool debugLogsActive = false;
internal const string DISABLED_LADDER_PREFIX = "- - - ";
internal const string DISABLED_ITEM_NAME = "- - - (removed item: {0})";
internal const int DISABLED_ITEM_PRICE = 99999;
private static List<Item> removedItemsTerminalFix = new List<Item>();
private static List<Item> removedItemsSafeFix = new List<Item>();
private static float methodUptime = 10f;
private static float updateConfigStart = 3.5f;
private static bool isPatchActive = true;
private static bool isFirstPatch = true;
private static bool wasFirstPatchFail = false;
private static int amountOfRemovedItems = 0;
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPriority(0)]
public static void PatchLaddersConfigs()
{
if (isPatchActive && methodUptime > 0f)
{
methodUptime -= Time.deltaTime;
if (methodUptime < updateConfigStart)
{
SyncLadderPrices();
}
}
else if (isPatchActive && methodUptime <= 0f)
{
EvaluateConfigSync();
if (isFirstPatch && wasFirstPatchFail)
{
GiantExtensionLaddersV2.mls.LogWarning((object)"Initial config sync failed, trying again...");
isFirstPatch = false;
methodUptime = 10f;
removedItemsTerminalFix = new List<Item>();
}
else
{
isPatchActive = false;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
public static void PlayerLeave()
{
removedItemsTerminalFix = new List<Item>();
removedItemsSafeFix = new List<Item>();
methodUptime = 10f;
updateConfigStart = 4f;
isPatchActive = true;
isFirstPatch = true;
wasFirstPatchFail = false;
}
private static void EvaluateConfigSync()
{
bool flag = true;
foreach (ShopItem shopItem in Items.shopItems)
{
if (!shopItem.item.itemName.StartsWith("- - - ") && shopItem.item.itemName.Equals(GiantExtensionLaddersV2.tinyLadderItem.itemName) && shopItem.item.creditsWorth != GiantExtensionLaddersV2.mySyncedConfigs.tinyLadderPrice.Value)
{
flag = false;
}
else if (!shopItem.item.itemName.StartsWith("- - - ") && shopItem.item.itemName.Equals(GiantExtensionLaddersV2.bigLadderItem.itemName) && shopItem.item.creditsWorth != GiantExtensionLaddersV2.mySyncedConfigs.bigLadderPrice.Value)
{
flag = false;
}
else if (!shopItem.item.itemName.StartsWith("- - - ") && shopItem.item.itemName.Equals(GiantExtensionLaddersV2.hugeLadderItem.itemName) && shopItem.item.creditsWorth != GiantExtensionLaddersV2.mySyncedConfigs.hugeLadderPrice.Value)
{
flag = false;
}
else if (!shopItem.item.itemName.StartsWith("- - - ") && shopItem.item.itemName.Equals(GiantExtensionLaddersV2.ultimateLadderItem.itemName) && shopItem.item.creditsWorth != GiantExtensionLaddersV2.mySyncedConfigs.ultimateLadderPrice.Value)
{
flag = false;
}
}
if (flag)
{
GiantExtensionLaddersV2.mls.LogInfo((object)"Config sync success! All settings should now be synced with the host's settings.");
GiantExtensionLaddersV2.mls.LogInfo((object)"Updating sales...");
Object.FindObjectOfType<Terminal>().SetItemSales();
GiantExtensionLaddersV2.mls.LogInfo((object)"done!");
}
else if (isFirstPatch)
{
wasFirstPatchFail = true;
}
else
{
GiantExtensionLaddersV2.mls.LogError((object)"Config sync failed! \n Some of your settings are not synchronized with the host settings! This can lead to players having differently priced ladders.");
}
}
private static void SyncLadderPrices()
{
Terminal val = Object.FindObjectOfType<Terminal>();
if ((Object)(object)val == (Object)null)
{
GiantExtensionLaddersV2.mls.LogWarning((object)"Terminal was not found in scene!");
return;
}
amountOfRemovedItems = 0;
UpdatePriceOrRemove(GiantExtensionLaddersV2.tinyLadderItem, SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isTinyLadderEnabled), SyncedEntry<int>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.tinyLadderPrice));
UpdatePriceOrRemove(GiantExtensionLaddersV2.bigLadderItem, SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isBigLadderEnabled), SyncedEntry<int>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.bigLadderPrice));
UpdatePriceOrRemove(GiantExtensionLaddersV2.hugeLadderItem, SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isHugeLadderEnabled), SyncedEntry<int>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.hugeLadderPrice));
UpdatePriceOrRemove(GiantExtensionLaddersV2.ultimateLadderItem, SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isUltimateLadderEnabled), SyncedEntry<int>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.ultimateLadderPrice));
UpdatePriceOrRemove(GiantExtensionLaddersV2.ladderCollectorItem, SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isLadderCollectorEnabled), SyncedEntry<int>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.ladderCollectorPrice));
}
private static void UpdatePriceOrRemove(Item item, bool isItemEnabled, int updatedPrice)
{
if ((Object)(object)item != (Object)null)
{
if (isItemEnabled)
{
if (item.itemName.StartsWith("- - - "))
{
try
{
item.itemName = DictionaryExtensions.Get<Item, string>((IDictionary<Item, string>)GiantExtensionLaddersV2.originalItemNames, item, (string)null);
}
catch (Exception)
{
GiantExtensionLaddersV2.mls.LogError((object)"There was an error with resetting a removed item name. If you are not the host, please restart your game.");
}
}
Items.UpdateShopItemPrice(item, updatedPrice);
}
else
{
amountOfRemovedItems++;
RemoveItem(item, Items.terminal, amountOfRemovedItems);
}
}
else
{
GiantExtensionLaddersV2.mls.LogDebug((object)"item was null");
}
}
private static void RemoveItem(Item targetItem, Terminal terminal, int amountOfRemovedItems)
{
if (SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isSalesFixEasyActive) && !SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isDontFix))
{
Item val = FindBuyableItem(targetItem, terminal);
if ((Object)(object)val != (Object)null)
{
if (!removedItemsSafeFix.Contains(val))
{
removedItemsSafeFix.Add(val);
val.itemName = $"- - - (removed item: {removedItemsSafeFix.Count})";
val.creditsWorth = 99999;
val.highestSalePercentage = 0;
}
}
else
{
GiantExtensionLaddersV2.mls.LogWarning((object)"Item to be removed could not be found. Will remove the item the old way, this can lead to sales being displayed falsely!");
Items.RemoveShopItem(targetItem);
}
}
else if (SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isSalesFixTerminalActive) && !SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isSalesFixEasyActive) && !SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isDontFix))
{
int num = 0;
for (int i = 0; i < terminal.buyableItemsList.Length; i++)
{
if (terminal.buyableItemsList[i].itemName == targetItem.itemName)
{
num = i;
break;
}
}
Item val2 = terminal.buyableItemsList[num];
Item val3 = terminal.buyableItemsList[terminal.buyableItemsList.Length - amountOfRemovedItems];
UpdateBuyItemIndex(val2, terminal.buyableItemsList.Length - amountOfRemovedItems);
UpdateBuyItemIndex(val3, num);
terminal.buyableItemsList[num] = val3;
terminal.buyableItemsList[terminal.buyableItemsList.Length - amountOfRemovedItems] = val2;
if (!removedItemsTerminalFix.Contains(targetItem))
{
removedItemsTerminalFix.Add(targetItem);
Items.RemoveShopItem(targetItem);
}
}
else
{
Items.RemoveShopItem(targetItem);
}
}
private static Item? FindBuyableItem(Item item, Terminal terminal)
{
Item[] buyableItemsList = terminal.buyableItemsList;
foreach (Item val in buyableItemsList)
{
if (val.itemName.Equals(item.itemName))
{
return val;
}
}
return null;
}
private static void UpdateBuyItemIndex(Item item, int newIndex)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
Item item2 = item;
TerminalKeyword val = Items.terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
List<CompatibleNoun> source = val.compatibleNouns.ToList();
if (!Items.buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)item2))
{
bool flag = false;
return;
}
BuyableItemAssetInfo asset = Items.buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)item2);
if (!source.Any((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword))
{
bool flag2 = false;
return;
}
TerminalNode result2 = source.First((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword).result;
bool flag3 = false;
result2.buyItemIndex = newIndex;
if (result2.terminalOptions.Length == 0)
{
bool flag4 = false;
return;
}
CompatibleNoun[] terminalOptions = result2.terminalOptions;
CompatibleNoun[] array = terminalOptions;
foreach (CompatibleNoun val2 in array)
{
if ((Object)(object)val2.result != (Object)null && val2.result.buyItemIndex != -1)
{
val2.result.buyItemIndex = newIndex;
}
}
}
}
[HarmonyPatch(typeof(ExtensionLadderItem))]
internal class NormalLadderFallPatch
{
private static bool isLadderOnAnotherLadder;
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void LadderFallPatch(ExtensionLadderItem __instance)
{
//IL_003b: 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_0097: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) || ((GrabbableObject)__instance).isHeld || ((GrabbableObject)__instance).isHeldByEnemy || !((GrabbableObject)__instance).reachedFloorTarget || !__instance.ladderActivated || !Physics.Raycast(((Component)__instance).transform.position, Vector3.down, ref val, 80f, 268437760, (QueryTriggerInteraction)1))
{
return;
}
if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<LadderItemScript>() != (Object)null)
{
isLadderOnAnotherLadder = true;
return;
}
if (isLadderOnAnotherLadder)
{
((GrabbableObject)__instance).FallToGround(false, false, ((Component)__instance.baseNode).transform.position);
}
isLadderOnAnotherLadder = false;
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("ShipLeave")]
[HarmonyPrefix]
public static void CollectLadders(StartOfRound __instance)
{
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
if (!SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isAutoCollectLaddersEnabled))
{
return;
}
List<GrabbableObject> list = ((IEnumerable<GrabbableObject>)(object)Object.FindObjectsOfType<LadderItemScript>()).ToList();
list.AddRange(new <>z__ReadOnlyArray<GrabbableObject>(((IEnumerable<GrabbableObject>)(object)Object.FindObjectsOfType<ExtensionLadderItem>()).ToArray()));
for (int i = 0; i < list.Count; i++)
{
LadderItemScript ladderItemScript = list[i] as LadderItemScript;
GrabbableObject obj = list[i];
ExtensionLadderItem val = (ExtensionLadderItem)(object)((obj is ExtensionLadderItem) ? obj : null);
if (!((Object)(object)ladderItemScript == (Object)null) || !((Object)(object)val == (Object)null))
{
TeleportLadderItem(ladderItemScript, val, __instance.middleOfShipNode.position);
}
}
}
private static void TeleportLadderItem(LadderItemScript? ladder, ExtensionLadderItem? normalLadder, Vector3 position)
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject val = (GrabbableObject)(((object)ladder) ?? ((object)normalLadder));
if (!((Object)(object)val == (Object)null))
{
bool flag = ((GrabbableObject)(ladder?)).isPocketed ?? ((GrabbableObject)(normalLadder?)).isPocketed ?? false;
bool flag2 = ((GrabbableObject)(ladder?)).isHeld ?? ((GrabbableObject)(normalLadder?)).isHeld ?? false;
bool flag3 = ((GrabbableObject)(ladder?)).isHeldByEnemy ?? ((GrabbableObject)(normalLadder?)).isHeldByEnemy ?? false;
bool flag4 = ((GrabbableObject)(ladder?)).isBeingUsed ?? ((GrabbableObject)(normalLadder?)).isBeingUsed ?? false;
if (!flag && !flag2 && !flag3 && (!flag4 || SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isCollectExtendedLaddersEnabled)))
{
((Component)val).transform.position = position;
val.FallToGround(false, false, ((Component)val).transform.position);
StartOfRound.Instance.localPlayerController.SetItemInElevator(true, false, val);
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class TinyLadderClimbingSpeedPatch
{
private static float defaultClimbSpeed;
private static bool isDefaultClimbSpeedSet;
private const float CLIMB_SPEED_MULTIPLIER = 0.25f;
[HarmonyPatch("Update")]
[HarmonyPriority(200)]
[HarmonyPostfix]
private static void CrankThatClimbingSpeed(PlayerControllerB __instance)
{
if (!isDefaultClimbSpeedSet)
{
defaultClimbSpeed = __instance.climbSpeed;
isDefaultClimbSpeedSet = true;
}
if (GiantExtensionLaddersV2.isPlayerOnTinyLadder)
{
if (__instance.isPlayerControlled && __instance.isClimbingLadder)
{
__instance.climbSpeed = defaultClimbSpeed * 0.25f;
}
}
else
{
__instance.climbSpeed = defaultClimbSpeed;
}
}
}
[HarmonyPatch(typeof(InteractTrigger))]
internal class UseLadderInShipPatch
{
internal static bool changedPlayerLocation;
internal static PlayerControllerB playerWithChangedLocation;
private const float minPlayerSizeForTinyLadder = 0.25f;
[HarmonyPatch("Interact")]
[HarmonyPrefix]
public static void PlayerIsInShipPatch(InteractTrigger __instance, ref Transform playerTransform)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
LadderItemScript componentInParent = ((Component)__instance).GetComponentInParent<LadderItemScript>();
PlayerControllerB component = ((Component)playerTransform).GetComponent<PlayerControllerB>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)component != (Object)null && !component.isInHangarShipRoom)
{
if (componentInParent.giantLadderType == GiantLadderType.TINY && component.thisPlayerBody.localScale.y > 0.25f)
{
changedPlayerLocation = true;
component.isInHangarShipRoom = true;
playerWithChangedLocation = component;
}
}
else if ((Object)(object)componentInParent != (Object)null && (Object)(object)component != (Object)null && component.isInHangarShipRoom && componentInParent.giantLadderType == GiantLadderType.TINY && component.thisPlayerBody.localScale.y <= 0.25f)
{
changedPlayerLocation = true;
component.isInHangarShipRoom = false;
playerWithChangedLocation = component;
}
}
[HarmonyPatch("Update")]
[HarmonyPriority(700)]
[HarmonyPrefix]
public static void ResetPlayerIsInShipPatch()
{
if ((Object)(object)playerWithChangedLocation != (Object)null && changedPlayerLocation)
{
playerWithChangedLocation.isInHangarShipRoom = !playerWithChangedLocation.isInHangarShipRoom;
changedPlayerLocation = false;
playerWithChangedLocation = null;
}
}
}
}
namespace GiantExtensionLaddersV2.ConfigStuff
{
[DataContract]
internal class MySyncedConfigs : SyncedConfig2<MySyncedConfigs>
{
private const int MIN_LADDER_PRICE = 1;
private const int MAX_LADDER_PRICE = 9999;
private const float MIN_EXT_TIME = 3f;
private const float MAX_EXT_TIME = 999f;
private const float MIN_TP_FREQ = 1f;
private const float MAX_TP_FREQ = 60f;
private const int tinyLadderBasePrice = 15;
private const int bigLadderBasePrice = 75;
private const int hugeLadderBasePrice = 160;
private const int ultimateLadderBasePrice = 250;
private const int ladderCollectorBasePrice = 75;
private const float tinyLadderExtensionTimeBase = 10f;
private const float bigLadderExtensionTimeBase = 25f;
private const float hugeLadderExtensionTimeBase = 30f;
private const float ultimateLadderExtensionTimeBase = 60f;
private const float teleportFrequencyBase = 0.8f;
[SyncedEntryField]
internal SyncedEntry<bool> isTinyLadderEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isBigLadderEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isHugeLadderEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isUltimateLadderEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isLadderCollectorEnabled;
[SyncedEntryField]
internal SyncedEntry<float> tinyLadderExtTime;
[SyncedEntryField]
internal SyncedEntry<float> bigLadderExtTime;
[SyncedEntryField]
internal SyncedEntry<float> hugeLadderExtTime;
[SyncedEntryField]
internal SyncedEntry<float> ultimateLadderExtTime;
[SyncedEntryField]
internal SyncedEntry<int> tinyLadderPrice;
[SyncedEntryField]
internal SyncedEntry<int> bigLadderPrice;
[SyncedEntryField]
internal SyncedEntry<int> hugeLadderPrice;
[SyncedEntryField]
internal SyncedEntry<int> ultimateLadderPrice;
[SyncedEntryField]
internal SyncedEntry<int> ladderCollectorPrice;
[SyncedEntryField]
internal SyncedEntry<bool> isTinyLadderAlwaysActive;
[SyncedEntryField]
internal SyncedEntry<bool> isBigLadderAlwaysActive;
[SyncedEntryField]
internal SyncedEntry<bool> isHugeLadderAlwaysActive;
[SyncedEntryField]
internal SyncedEntry<bool> isUltimateLadderAlwaysActive;
[SyncedEntryField]
internal SyncedEntry<bool> isAutoCollectLaddersEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isTeleportFromShipRoomEnabled;
[SyncedEntryField]
internal SyncedEntry<bool> isCollectExtendedLaddersEnabled;
[SyncedEntryField]
internal SyncedEntry<float> teleportFrequency;
[SyncedEntryField]
internal SyncedEntry<bool> isSalesFixEasyActive;
[SyncedEntryField]
internal SyncedEntry<bool> isSalesFixTerminalActive;
[SyncedEntryField]
internal SyncedEntry<bool> isDontFix;
internal ConfigEntry<string> salesFixHeader;
private static ManualLogSource mlsConfig = Logger.CreateLogSource("inoyu.GiantExtensionLadders.Config");
internal MySyncedConfigs(ConfigFile cfg)
: base("GiantExtensionLaddersV2")
{
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Expected O, but got Unknown
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Expected O, but got Unknown
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Expected O, but got Unknown
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Expected O, but got Unknown
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Expected O, but got Unknown
isTinyLadderEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "DeactivateLadders", "isTinyLadderEnabled", true, "Tiny ladder doesn't appear in the shop if this is set to false.");
isBigLadderEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "DeactivateLadders", "isBigLadderEnabled", true, "Big ladder doesn't appear in the shop if this is set to false.");
isHugeLadderEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "DeactivateLadders", "isHugeLadderEnabled", true, "Huge ladder doesn't appear in the shop if this is set to false.");
isUltimateLadderEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "DeactivateLadders", "isUltimateLadderEnabled", true, "Ultimate ladder doesn't appear in the shop if this is set to false.");
isLadderCollectorEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "DeactivateLadders", "isLadderCollectorEnabled", true, "Ladder Collector doesn't appear in the shop if this is set to false.");
AcceptableValueRange<int> val = new AcceptableValueRange<int>(1, 9999);
tinyLadderPrice = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "LadderPrices", "tinyLadderPrice", 15, new ConfigDescription("Sets the price of the tiny ladder.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
bigLadderPrice = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "LadderPrices", "bigLadderPrice", 75, new ConfigDescription("Sets the price of the big ladder.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
hugeLadderPrice = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "LadderPrices", "hugeLadderPrice", 160, new ConfigDescription("Sets the price of the huge ladder.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
ultimateLadderPrice = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "LadderPrices", "ultimateLadderPrice", 250, new ConfigDescription("Sets the price of the ultimate ladder.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
ladderCollectorPrice = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "LadderPrices", "ladderCollectorItemPrice", 75, new ConfigDescription("Sets the price of ladder collector.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
isTinyLadderAlwaysActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderAlwaysActive", "isTinyLadderAlwaysActive", false, "Sets the tiny ladder to always being extended.");
isBigLadderAlwaysActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderAlwaysActive", "isBigLadderAlwaysActive", false, "Sets the big ladder to always being extended.");
isHugeLadderAlwaysActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderAlwaysActive", "isHugeLadderAlwaysActive", false, "Sets the huge ladder to always being extended.");
isUltimateLadderAlwaysActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderAlwaysActive", "isUltimateLadderAlwaysActive", false, "Sets the ultimate ladder to always being extended.");
AcceptableValueRange<float> val2 = new AcceptableValueRange<float>(3f, 999f);
tinyLadderExtTime = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "LadderExtensionTime", "tinyLadderExtensionTime", 10f, new ConfigDescription("Amount of seconds the tiny ladder stays extended.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
bigLadderExtTime = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "LadderExtensionTime", "bigLadderExtensionTime", 25f, new ConfigDescription("Amount of seconds the big ladder stays extended.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
hugeLadderExtTime = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "LadderExtensionTime", "hugeLadderExtensionTime", 30f, new ConfigDescription("Amount of seconds the huge ladder stays extended.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
ultimateLadderExtTime = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "LadderExtensionTime", "ultimateLadderExtensionTime", 60f, new ConfigDescription("Amount of seconds the ultimate ladder stays extended.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
salesFixHeader = cfg.Bind<string>("SalesBugfixMethod", "WhatIsThisConfigSection?", "(„• ᴗ •„) I am a happy placeholder!", "The sales bug is a relatively small bug that shifts sales by one slot occasionally. " + Environment.NewLine + "To fix this I have two solutions: the safe one, which will most likely always work and the experimental one, which looks way nicer in the terminal but could cause some issues.");
isSalesFixEasyActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "SalesBugfixMethod", "safeSalesFix", true, "This will fix sales in a very safe way, but disabled ladders will appear as an item named \"- - - (removed item: {0})\" in the store.");
isSalesFixTerminalActive = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "SalesBugfixMethod", "experimentalSalesFix", false, "This will fix sales and fully remove disabled ladders from the store without \"- - - (removed item: {0})\" being displayed." + Environment.NewLine + "WARNING: This might cause store related bugs or have influence on the compatibility with other mods!");
isDontFix = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "SalesBugfixMethod", "dontFixSales", false, "This will not fix the sales, resulting in sales sometimes being displayed on an item which is not on sale (or the opposite of that).");
isAutoCollectLaddersEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderCollector", "enableAutoCollectLadders", false, "This will try to teleport all remaining ladders on the map to the ship when pulling the lever to leave the planet.");
isTeleportFromShipRoomEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderCollector", "allowTeleportFromShipRoom", true, "This allows the ladder collector to teleport ladders that are in the ship room (or very close to it).");
teleportFrequency = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "LadderCollector", "ladderTeleportFrequency", 0.8f, new ConfigDescription("Time between ladder-teleports (in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
isCollectExtendedLaddersEnabled = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "LadderCollector", "collectExtendedLadders", true, "This allows the ladder collector to teleport ladders that are extended.");
ConfigManager.Register<MySyncedConfigs>((SyncedConfig2<MySyncedConfigs>)(object)this);
}
}
}
namespace GiantExtensionLaddersV2.Behaviours
{
internal class LadderCollectorScript : GrabbableObject
{
[CompilerGenerated]
private sealed class <SpawnLaddersAnim>d__12 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public List<GrabbableObject> ladders;
public LadderCollectorScript <>4__this;
private List<GrabbableObject> <laddersToTeleport>5__1;
private List<GrabbableObject>.Enumerator <>s__2;
private GrabbableObject <ladder>5__3;
private bool <areLadderTeleportConditionsMet>5__4;
private int <i>5__5;
private LadderItemScript <ladder>5__6;
private ExtensionLadderItem <normalLadder>5__7;
private float <baseNodeRotationAmount>5__8;
object? IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object? IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnLaddersAnim>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<laddersToTeleport>5__1 = null;
<>s__2 = default(List<GrabbableObject>.Enumerator);
<ladder>5__3 = null;
<ladder>5__6 = null;
<normalLadder>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<laddersToTeleport>5__1 = new List<GrabbableObject>();
<>s__2 = ladders.GetEnumerator();
try
{
while (<>s__2.MoveNext())
{
<ladder>5__3 = <>s__2.Current;
<areLadderTeleportConditionsMet>5__4 = <ladder>5__3.isInFactory == StartOfRound.Instance.localPlayerController.isInsideFactory && (!<ladder>5__3.isInShipRoom || SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isTeleportFromShipRoomEnabled));
if (<areLadderTeleportConditionsMet>5__4)
{
<laddersToTeleport>5__1.Add(<ladder>5__3);
}
<ladder>5__3 = null;
}
}
finally
{
((IDisposable)<>s__2).Dispose();
}
<>s__2 = default(List<GrabbableObject>.Enumerator);
<>4__this.teleportTimer = (float)<laddersToTeleport>5__1.Count * <>4__this.waitBetweenTeleport + 1f;
<>4__this.isTimerActive = true;
<i>5__5 = 0;
break;
case 1:
<>1__state = -1;
goto IL_025e;
case 2:
{
<>1__state = -1;
<ladder>5__6 = null;
<normalLadder>5__7 = null;
goto IL_025e;
}
IL_025e:
<i>5__5++;
break;
}
if (<i>5__5 < <laddersToTeleport>5__1.Count)
{
<ladder>5__6 = <laddersToTeleport>5__1[<i>5__5] as LadderItemScript;
ref ExtensionLadderItem reference = ref <normalLadder>5__7;
GrabbableObject obj = <laddersToTeleport>5__1[<i>5__5];
reference = (ExtensionLadderItem)(object)((obj is ExtensionLadderItem) ? obj : null);
<baseNodeRotationAmount>5__8 = 360f / (float)<laddersToTeleport>5__1.Count;
((Component)<>4__this.baseNode).transform.rotation = Quaternion.Euler(0f, (float)<i>5__5 * <baseNodeRotationAmount>5__8, 0f);
if ((Object)(object)<ladder>5__6 == (Object)null && (Object)(object)<normalLadder>5__7 == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = <>4__this.TeleportLadderItem(<ladder>5__6, <normalLadder>5__7, <>4__this.ladderSpawnNode.position, ((Component)<>4__this.baseNode).transform.rotation);
<>1__state = 2;
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 <TeleportLadderItem>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LadderItemScript ladder;
public ExtensionLadderItem normalLadder;
public Vector3 position;
public Quaternion rotation;
public LadderCollectorScript <>4__this;
private GrabbableObject <item>5__1;
private bool <isPocketed>5__2;
private bool <isHeld>5__3;
private bool <isHeldByEnemy>5__4;
private bool <isBeingUsed>5__5;
private bool <ladderAnimationBegun>5__6;
object? IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object? IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TeleportLadderItem>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<item>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<item>5__1 = (GrabbableObject)(((object)ladder) ?? ((object)normalLadder));
if ((Object)(object)<item>5__1 == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<isPocketed>5__2 = ((GrabbableObject)(ladder?)).isPocketed ?? ((GrabbableObject)(normalLadder?)).isPocketed ?? false;
<isHeld>5__3 = ((GrabbableObject)(ladder?)).isHeld ?? ((GrabbableObject)(normalLadder?)).isHeld ?? false;
<isHeldByEnemy>5__4 = ((GrabbableObject)(ladder?)).isHeldByEnemy ?? ((GrabbableObject)(normalLadder?)).isHeldByEnemy ?? false;
<isBeingUsed>5__5 = ((GrabbableObject)(ladder?)).isBeingUsed ?? ((GrabbableObject)(normalLadder?)).isBeingUsed ?? false;
<ladderAnimationBegun>5__6 = ladder?.ladderAnimationBegun ?? normalLadder?.ladderAnimationBegun ?? false;
if (!<isPocketed>5__2 && !<isHeld>5__3 && !<isHeldByEnemy>5__4 && !<isBeingUsed>5__5 && (!<ladderAnimationBegun>5__6 || SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isCollectExtendedLaddersEnabled)))
{
<>4__this.teleportationLight.intensity = 0f;
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.TeleportLightAnim());
<>4__this.lcAudioSource.pitch = Random.Range(0.94f, 1.06f);
<>4__this.lcAudioSource.PlayOneShot(<>4__this.spawnAudio);
((Component)<item>5__1).transform.position = position;
((Component)<item>5__1).transform.localEulerAngles = Vector3.zero;
((Component)<item>5__1).transform.eulerAngles = Vector3.zero;
((Component)<item>5__1).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
((Component)<item>5__1).transform.rotation = rotation;
<item>5__1.FallToGround(false, false, ((Component)<>4__this).transform.position);
StartOfRound.Instance.localPlayerController.SetItemInElevator(<>4__this.wasPlayerInShipRoom, false, <item>5__1);
<>2__current = (object)new WaitForSeconds(<>4__this.waitBetweenTeleport);
<>1__state = 2;
return true;
}
break;
case 1:
<>1__state = -1;
return false;
case 2:
<>1__state = -1;
break;
}
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 <TeleportLightAnim>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LadderCollectorScript <>4__this;
private float <numberOfSteps>5__1;
private float <maxIntensity>5__2;
private float <intensityPerStep>5__3;
private int <i>5__4;
private int <i>5__5;
object? IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object? IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TeleportLightAnim>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<numberOfSteps>5__1 = 100f * <>4__this.waitBetweenTeleport / 2f;
<maxIntensity>5__2 = 800f;
<intensityPerStep>5__3 = <maxIntensity>5__2 / <numberOfSteps>5__1;
<i>5__4 = 0;
goto IL_00c5;
case 1:
<>1__state = -1;
<i>5__4++;
goto IL_00c5;
case 2:
{
<>1__state = -1;
<i>5__5++;
break;
}
IL_00c5:
if ((float)<i>5__4 < <numberOfSteps>5__1)
{
Light? teleportationLight = <>4__this.teleportationLight;
teleportationLight.intensity += <intensityPerStep>5__3;
<>2__current = (object)new WaitForSeconds(0.01f);
<>1__state = 1;
return true;
}
<i>5__5 = 0;
break;
}
if ((float)<i>5__5 < <numberOfSteps>5__1)
{
Light? teleportationLight2 = <>4__this.teleportationLight;
teleportationLight2.intensity -= <intensityPerStep>5__3;
<>2__current = (object)new WaitForSeconds(0.01f);
<>1__state = 2;
return true;
}
<>4__this.teleportationLight.intensity = 0f;
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 Transform? baseNode;
public Transform? ladderSpawnNode;
public AudioSource? lcAudioSource;
public AudioClip? spawnAudio;
public Light? teleportationLight;
private bool wasPlayerInShipRoom = false;
private float teleportTimer = 0f;
private bool isTimerActive = false;
private float waitBetweenTeleport = 0.8f;
public override void Update()
{
((GrabbableObject)this).Update();
if (isTimerActive && teleportTimer > 0f)
{
teleportTimer -= Time.deltaTime;
}
else if (isTimerActive)
{
isTimerActive = false;
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0051: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
waitBetweenTeleport = GiantExtensionLaddersV2.mySyncedConfigs.teleportFrequency.Value;
if (!StartOfRound.Instance.inShipPhase && !isTimerActive)
{
if (((NetworkBehaviour)this).IsOwner)
{
base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
}
wasPlayerInShipRoom = false;
if (StartOfRound.Instance.localPlayerController.isInHangarShipRoom)
{
wasPlayerInShipRoom = true;
}
CollectLadders();
}
}
private void CollectLadders()
{
List<GrabbableObject> list = ((IEnumerable<GrabbableObject>)(object)Object.FindObjectsOfType<LadderItemScript>()).ToList();
list.AddRange(new <>z__ReadOnlyArray<GrabbableObject>(((IEnumerable<GrabbableObject>)(object)Object.FindObjectsOfType<ExtensionLadderItem>()).ToArray()));
((MonoBehaviour)this).StartCoroutine(SpawnLaddersAnim(list));
}
[IteratorStateMachine(typeof(<SpawnLaddersAnim>d__12))]
private IEnumerator SpawnLaddersAnim(List<GrabbableObject> ladders)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnLaddersAnim>d__12(0)
{
<>4__this = this,
ladders = ladders
};
}
[IteratorStateMachine(typeof(<TeleportLadderItem>d__13))]
private IEnumerator TeleportLadderItem(LadderItemScript? ladder, ExtensionLadderItem? normalLadder, Vector3 position, Quaternion rotation)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TeleportLadderItem>d__13(0)
{
<>4__this = this,
ladder = ladder,
normalLadder = normalLadder,
position = position,
rotation = rotation
};
}
[IteratorStateMachine(typeof(<TeleportLightAnim>d__14))]
private IEnumerator TeleportLightAnim()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TeleportLightAnim>d__14(0)
{
<>4__this = this
};
}
public override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
public override string __getTypeName()
{
return "LadderCollector";
}
}
internal class LadderItemScript : GrabbableObject
{
[CompilerGenerated]
private sealed class <LadderAnimation>d__53 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public bool isSkipExtension;
public float externalRotNormalTime;
public LadderItemScript <>4__this;
private float <ladderMaxExtension>5__1;
private float <ladderExtendAmountNormalized>5__2;
private float <ladderRotateAmountNormalized>5__3;
private float <currentNormalizedTime>5__4;
private float <extensionSpeedMultiplier2>5__5;
private float <newColliderScale>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LadderAnimation>d__53(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Expected O, but got Unknown
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0549: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0a52: Unknown result type (might be due to invalid IL or missing references)
//IL_0a71: Unknown result type (might be due to invalid IL or missing references)
//IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa6: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
//IL_0b19: Unknown result type (might be due to invalid IL or missing references)
//IL_0b23: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b6d: Unknown result type (might be due to invalid IL or missing references)
//IL_0b77: Unknown result type (might be due to invalid IL or missing references)
//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0919: Unknown result type (might be due to invalid IL or missing references)
//IL_0923: Unknown result type (might be due to invalid IL or missing references)
//IL_094e: Unknown result type (might be due to invalid IL or missing references)
//IL_096e: Unknown result type (might be due to invalid IL or missing references)
//IL_0978: Unknown result type (might be due to invalid IL or missing references)
//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
//IL_09cc: Unknown result type (might be due to invalid IL or missing references)
//IL_09f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0a16: Unknown result type (might be due to invalid IL or missing references)
//IL_0a20: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_057c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<ladderMaxExtension>5__1 = <>4__this.GetLadderExtensionDistance();
<ladderExtendAmountNormalized>5__2 = <ladderMaxExtension>5__1 / <>4__this.maxExtension;
<ladderRotateAmountNormalized>5__3 = 1f;
<currentNormalizedTime>5__4 = 0f;
<extensionSpeedMultiplier2>5__5 = 0.1f;
<>4__this.ladderAudio.volume = 1f;
<>4__this.ladderScript.interactable = false;
<>4__this.interactCollider.enabled = false;
<>4__this.bridgeCollider.enabled = false;
<>4__this.killTrigger.enabled = false;
if (!isSkipExtension)
{
<>4__this.ladderAnimator.SetBool("openLid", false);
<>4__this.ladderAnimator.SetBool("extend", false);
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_058d;
case 1:
<>1__state = -1;
<>4__this.ladderAnimator.SetBool("openLid", true);
((Component)<>4__this.ladderAudio).transform.position = ((Component)<>4__this).transform.position;
<>4__this.ladderAudio.PlayOneShot(<>4__this.lidOpenSFX, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)<>4__this.ladderAudio).transform.position, 18f, 0.8f, 0, ((GrabbableObject)<>4__this).isInShipRoom, 0);
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>4__this.ladderAnimator.SetBool("extend", true);
<>4__this.ladderAudio.clip = <>4__this.ladderExtendSFX;
<>4__this.ladderAudio.Play();
<ladderMaxExtension>5__1 += ((Component)<>4__this.baseNode).transform.position.y + 4f;
goto IL_02e1;
case 3:
<>1__state = -1;
goto IL_02e1;
case 4:
<>1__state = -1;
goto IL_058d;
case 5:
{
<>1__state = -1;
break;
}
IL_02e1:
if (<currentNormalizedTime>5__4 < 2f && <>4__this.topCollisionNode.position.y < <ladderMaxExtension>5__1)
{
<extensionSpeedMultiplier2>5__5 += Time.deltaTime * 2f;
<currentNormalizedTime>5__4 = Mathf.Min(<currentNormalizedTime>5__4 + Time.deltaTime * <extensionSpeedMultiplier2>5__5, 2f);
<>4__this.ladderAnimator.SetFloat("extensionAmount", <currentNormalizedTime>5__4);
<>2__current = null;
<>1__state = 3;
return true;
}
if (<>4__this.topCollisionNode.position.y >= <ladderMaxExtension>5__1)
{
<>4__this.hasHitRoof = true;
}
else
{
<>4__this.hasHitRoof = false;
}
<>4__this.extendAmount = <currentNormalizedTime>5__4;
<>4__this.interactCollider.enabled = true;
<>4__this.bridgeCollider.enabled = false;
<>4__this.killTrigger.enabled = false;
<>4__this.ladderAudio.Stop();
if (<ladderExtendAmountNormalized>5__2 == 1f)
{
((Component)<>4__this.ladderAudio).transform.position = ((Component)<>4__this.baseNode).transform.position + ((Component)<>4__this.baseNode).transform.up * <>4__this.maxExtension;
<>4__this.ladderAudio.PlayOneShot(<>4__this.fullExtend, 0.7f);
WalkieTalkie.TransmitOneShotAudio(<>4__this.ladderAudio, <>4__this.fullExtend, 0.7f);
RoundManager.Instance.PlayAudibleNoise(((Component)<>4__this.ladderAudio).transform.position, 8f, 0.5f, 0, ((GrabbableObject)<>4__this).isInShipRoom, 0);
}
else
{
((Component)<>4__this.ladderAudio).transform.position = ((Component)<>4__this.baseNode).transform.position + ((Component)<>4__this.baseNode).transform.up * (<ladderExtendAmountNormalized>5__2 * <>4__this.maxExtension);
<>4__this.ladderAudio.PlayOneShot(<>4__this.hitRoof);
WalkieTalkie.TransmitOneShotAudio(<>4__this.ladderAudio, <>4__this.hitRoof, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)<>4__this.ladderAudio).transform.position, 17f, 0.8f, 0, ((GrabbableObject)<>4__this).isInShipRoom, 0);
}
<>2__current = (object)new WaitForSeconds(0.4f);
<>1__state = 4;
return true;
IL_058d:
<>4__this.ladderAudio.clip = <>4__this.ladderFallSFX;
<>4__this.ladderAudio.Play();
<>4__this.ladderAudio.volume = 0f;
<extensionSpeedMultiplier2>5__5 = <>4__this.ladderRotateSpeedMultiplier;
<currentNormalizedTime>5__4 = 0f;
<ladderRotateAmountNormalized>5__3 = Mathf.Clamp(<>4__this.GetLadderRotationDegrees(90f) / -90f, 0f, 0.99f);
if (externalRotNormalTime > 0.01f)
{
<ladderRotateAmountNormalized>5__3 = 0.99f;
}
if (externalRotNormalTime > 0f)
{
<currentNormalizedTime>5__4 = externalRotNormalTime;
}
break;
}
if (<currentNormalizedTime>5__4 < <ladderRotateAmountNormalized>5__3)
{
<extensionSpeedMultiplier2>5__5 += Time.deltaTime * 2f;
<currentNormalizedTime>5__4 = Mathf.Min(<currentNormalizedTime>5__4 + Time.deltaTime * <extensionSpeedMultiplier2>5__5, <ladderRotateAmountNormalized>5__3);
if (<currentNormalizedTime>5__4 > 0.3f && <ladderExtendAmountNormalized>5__2 > 0.6f)
{
<>4__this.killTrigger.enabled = true;
}
<>4__this.ladderAudio.volume = Mathf.Min(<>4__this.ladderAudio.volume + Time.deltaTime * 1.75f, 1f);
<>4__this.ladderRotateAnimator.SetFloat("rotationAmount", <currentNormalizedTime>5__4);
<>2__current = null;
<>1__state = 5;
return true;
}
<>4__this.rotateAmount = <ladderRotateAmountNormalized>5__3;
<>4__this.ladderAudio.volume = 1f;
<>4__this.ladderAudio.Stop();
((Component)<>4__this.ladderAudio).transform.position = ((Component)<>4__this.moveableNode).transform.position;
<>4__this.ladderAudio.PlayOneShot(<>4__this.hitWall, Mathf.Min(<ladderRotateAmountNormalized>5__3 + 0.3f, 1f));
RoundManager.Instance.PlayAudibleNoise(((Component)<>4__this.ladderAudio).transform.position, 18f, 0.7f, 0, ((GrabbableObject)<>4__this).isInShipRoom, 0);
if (<>4__this.isClimbable && <ladderRotateAmountNormalized>5__3 * 90f < <>4__this.minInteractableRotation)
{
<>4__this.ladderScript.interactable = true;
<>4__this.interactCollider.enabled = true;
}
else
{
<>4__this.bridgeCollider.enabled = true;
}
<>4__this.killTrigger.enabled = false;
if (<>4__this.hasHitRoof)
{
<newColliderScale>5__6 = (100f - <>4__this.maxExtension) / 100f * 5.16f / 6f;
((Component)<>4__this.interactCollider).transform.localScale = new Vector3(((Component)<>4__this.interactCollider).transform.localScale.x, <newColliderScale>5__6, ((Component)<>4__this.interactCollider).transform.localScale.z);
((Component)<>4__this.bridgeCollider).transform.localScale = new Vector3(((Component)<>4__this.bridgeCollider).transform.localScale.x, <newColliderScale>5__6, ((Component)<>4__this.bridgeCollider).transform.localScale.z);
((Component)<>4__this.interactCollider).transform.localPosition = new Vector3(((Component)<>4__this.interactCollider).transform.localPosition.x, 1f, ((Component)<>4__this.interactCollider).transform.localPosition.z);
((Component)<>4__this.bridgeCollider).transform.localPosition = new Vector3(((Component)<>4__this.bridgeCollider).transform.localPosition.x, 1f, ((Component)<>4__this.bridgeCollider).transform.localPosition.z);
}
else
{
((Component)<>4__this.interactCollider).transform.localScale = new Vector3(((Component)<>4__this.interactCollider).transform.localScale.x, 5.15892f, ((Component)<>4__this.interactCollider).transform.localScale.z);
((Component)<>4__this.bridgeCollider).transform.localScale = new Vector3(((Component)<>4__this.bridgeCollider).transform.localScale.x, 5.15892f, ((Component)<>4__this.bridgeCollider).transform.localScale.z);
((Component)<>4__this.interactCollider).transform.localPosition = new Vector3(((Component)<>4__this.interactCollider).transform.localPosition.x, 3.8f, ((Component)<>4__this.interactCollider).transform.localPosition.z);
((Component)<>4__this.bridgeCollider).transform.localPosition = new Vector3(((Component)<>4__this.bridgeCollider).transform.localPosition.x, 3.29f, ((Component)<>4__this.bridgeCollider).transform.localPosition.z);
}
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();
}
}
private bool ladderActivated;
internal bool ladderAnimationBegun;
private Coroutine ladderAnimationCoroutine;
private RaycastHit hit;
private int layerMask = 268437761;
private float rotateAmount;
private float extendAmount;
private float ladderTimer;
private bool ladderBlinkWarning;
private bool ladderShrunkAutomatically;
private AudioClip ladderFallSFX;
public Animator ladderAnimator;
public Animator ladderRotateAnimator;
public Transform baseNode;
public Transform topNode;
public Transform moveableNode;
public AudioClip hitRoof;
public AudioClip fullExtend;
public AudioClip hitWall;
public AudioClip ladderExtendSFX;
public AudioClip ladderShrinkSFX;
public AudioClip blinkWarningSFX;
public AudioClip lidOpenSFX;
public AudioSource ladderAudio;
public InteractTrigger ladderScript;
public Collider interactCollider;
public Collider bridgeCollider;
public Collider killTrigger;
public GiantLadderType giantLadderType;
public float ladderAlarmTime;
public float ladderExtensionTime;
public float maxExtension;
public float minInteractableRotation;
public float ladderRotateSpeedMultiplier;
public bool isClimbable = true;
public bool isClimbableInShip = false;
public bool isAlwaysExtended = false;
public Transform topCollisionNode;
private const float RAYCAST_DISTANCE_CORRECTION = 4f;
private bool isOnAnotherLadder = false;
private bool hasFallenOnALadder = false;
private bool isLeaningAgainstALadder = false;
private bool hasHitRoof = false;
private Vector3 linecastStart = Vector3.zero;
private Vector3 linecastEnd = Vector3.zero;
private const int checkpointsPerTenMeters = 10;
private const int minAmountOfChecksPerCheckpoints = 50;
private const float amountOfChecksMulitplier = 1.2f;
private const float minDegrees = 9f;
private const int startingCheckPointNumber = 2;
public override void Update()
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_013d: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
calculateExtensionTimes();
if (!isClimbableInShip)
{
if (base.isInShipRoom)
{
isClimbable = false;
}
else
{
isClimbable = true;
}
}
if ((Object)(object)base.playerHeldBy == (Object)null && !base.isHeld && !base.isHeldByEnemy && base.reachedFloorTarget && ladderActivated)
{
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 80f, 268437760, (QueryTriggerInteraction)1))
{
if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<LadderItemScript>() != (Object)null)
{
isOnAnotherLadder = true;
}
else
{
if (isOnAnotherLadder)
{
((GrabbableObject)this).FallToGround(false, false, ((Component)this).transform.position);
}
isOnAnotherLadder = false;
}
}
if (!ladderAnimationBegun)
{
ladderTimer = 0f;
StartLadderAnimation(isSkipExtension: false, -1f);
}
else
{
if (!ladderAnimationBegun)
{
return;
}
RaycastHit val2 = default(RaycastHit);
if (hasFallenOnALadder && !Physics.Linecast(linecastStart, linecastEnd, ref val2, layerMask, (QueryTriggerInteraction)1))
{
StartLadderAnimation(isSkipExtension: true, rotateAmount);
hasFallenOnALadder = false;
}
if (!isAlwaysExtended)
{
ladderTimer += Time.deltaTime;
if (!ladderBlinkWarning && ladderTimer > ladderAlarmTime)
{
ladderBlinkWarning = true;
ladderAnimator.SetBool("blinkWarning", true);
ladderAudio.clip = blinkWarningSFX;
ladderAudio.Play();
}
else if (ladderTimer >= ladderExtensionTime)
{
ladderActivated = false;
ladderBlinkWarning = false;
ladderAudio.Stop();
ladderAnimator.SetBool("blinkWarning", false);
}
}
}
return;
}
if (ladderAnimationBegun)
{
ladderAnimationBegun = false;
ladderAudio.Stop();
killTrigger.enabled = false;
bridgeCollider.enabled = false;
interactCollider.enabled = false;
if (ladderAnimationCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(ladderAnimationCoroutine);
}
ladderAnimator.SetBool("blinkWarning", false);
((Component)ladderAudio).transform.position = ((Component)this).transform.position;
ladderAudio.PlayOneShot(ladderShrinkSFX);
ladderActivated = false;
}
if ((Object)(object)killTrigger != (Object)null)
{
killTrigger.enabled = false;
}
ladderScript.interactable = false;
if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith == (Object)(object)ladderScript)
{
ladderScript.CancelAnimationExternally();
}
if (rotateAmount > 0f)
{
rotateAmount = Mathf.Max(rotateAmount - Time.deltaTime * 2f, 0f);
ladderRotateAnimator.SetFloat("rotationAmount", rotateAmount);
}
else
{
ladderRotateAnimator.SetFloat("rotationAmount", 0f);
}
if (extendAmount > 0f)
{
extendAmount = Mathf.Max(extendAmount - Time.deltaTime * 2f, 0f);
ladderAnimator.SetFloat("extensionAmount", extendAmount);
}
else
{
ladderAnimator.SetBool("openLid", false);
ladderAnimator.SetBool("extend", false);
ladderAnimator.SetFloat("extensionAmount", 0f);
}
}
private void calculateExtensionTimes()
{
switch (giantLadderType)
{
case GiantLadderType.TINY:
isAlwaysExtended = SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isTinyLadderAlwaysActive);
ladderAlarmTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.tinyLadderExtTime) - 4f;
ladderExtensionTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.tinyLadderExtTime);
break;
case GiantLadderType.BIG:
isAlwaysExtended = SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isBigLadderAlwaysActive);
ladderAlarmTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.bigLadderExtTime) - 5f;
ladderExtensionTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.bigLadderExtTime);
break;
case GiantLadderType.HUGE:
isAlwaysExtended = SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isHugeLadderAlwaysActive);
ladderAlarmTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.hugeLadderExtTime) - 5f;
ladderExtensionTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.hugeLadderExtTime);
break;
case GiantLadderType.ULTIMATE:
isAlwaysExtended = SyncedEntry<bool>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.isUltimateLadderAlwaysActive);
ladderAlarmTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.ultimateLadderExtTime) - 5f;
ladderExtensionTime = SyncedEntry<float>.op_Implicit(GiantExtensionLaddersV2.mySyncedConfigs.ultimateLadderExtTime);
break;
default:
isAlwaysExtended = false;
ladderExtensionTime = 25f;
ladderAlarmTime = 20f;
break;
}
}
private void StartLadderAnimation(bool isSkipExtension, float externalRotNormalTime)
{
ladderAnimationBegun = true;
ladderScript.interactable = false;
if (ladderAnimationCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(ladderAnimationCoroutine);
}
ladderAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(LadderAnimation(isSkipExtension, externalRotNormalTime));
}
[IteratorStateMachine(typeof(<LadderAnimation>d__53))]
private IEnumerator LadderAnimation(bool isSkipExtension, float externalRotNormalTime)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LadderAnimation>d__53(0)
{
<>4__this = this,
isSkipExtension = isSkipExtension,
externalRotNormalTime = externalRotNormalTime
};
}
private float GetLadderExtensionDistance()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (Physics.Raycast(((Component)baseNode).transform.position, Vector3.up, ref hit, maxExtension, layerMask, (QueryTriggerInteraction)1) && (base.isInShipRoom || base.isInFactory))
{
return ((RaycastHit)(ref hit)).distance;
}
return maxExtension;
}
private float GetLadderRotationDegrees(float startAt)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_014a: Unknown