using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using WaterGunLib.Bundles;
using WaterGunLib.Modules;
using WaterGunLib.NetcodePatcher;
[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("WaterGunLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WaterGunLib")]
[assembly: AssemblyTitle("WaterGunLib")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace WaterGunLib
{
public class DetonatorItem : GrabbableObject
{
[CompilerGenerated]
private sealed class <SetDetonator>d__6 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public DetonatorItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetDetonator>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (StartOfRound.Instance.inShipPhase)
{
<>2__current = null;
<>1__state = 1;
return true;
}
if ((Object)(object)<>4__this.ObjectToDetonate == (Object)null)
{
<>4__this.ObjectToDetonate = GameObject.Find(<>4__this.pathToDestructionObject);
}
if ((Object)(object)<>4__this.ObjectToDetonate != (Object)null)
{
<>4__this.canBeDestroyed = 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();
}
}
public GameObject ObjectToDetonate;
public GameObject DestructionObject;
public string pathToDestructionObject = "Environment/Detonator/Rocks";
public float minDistance = 5f;
public string ExplosionText;
private bool canBeDestroyed = false;
[IteratorStateMachine(typeof(<SetDetonator>d__6))]
private IEnumerator SetDetonator()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetDetonator>d__6(0)
{
<>4__this = this
};
}
public override void Start()
{
((GrabbableObject)this).Start();
((MonoBehaviour)this).StartCoroutine(SetDetonator());
}
public override void Update()
{
((GrabbableObject)this).Update();
if ((Object)(object)base.playerHeldBy != (Object)null && StartOfRound.Instance.inShipPhase && canBeDestroyed)
{
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
}
else if ((Object)(object)base.playerHeldBy == (Object)null && StartOfRound.Instance.inShipPhase && canBeDestroyed)
{
DespawnObject();
}
}
private void DespawnObject()
{
if (NetworkManager.Singleton.IsServer)
{
((Component)this).GetComponent<NetworkObject>().Despawn(true);
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
float num = Vector3.Distance(((Component)this).transform.position, ObjectToDetonate.transform.position);
if (num <= minDistance)
{
HUDManager.Instance.DisplayTip(base.itemProperties.itemName, ExplosionText, false, false, "LC_Tip1");
DestroyObject();
}
else
{
HUDManager.Instance.DisplayTip(base.itemProperties.itemName, "Failed to detonate please get closer to the target", false, false, "LC_Tip1");
}
}
private void DestroyObject()
{
//IL_0012: 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)
GameObject val = Object.Instantiate<GameObject>(DestructionObject, ObjectToDetonate.transform.position, ObjectToDetonate.transform.rotation, RoundManager.Instance.mapPropsContainer.transform);
Object.Destroy((Object)(object)ObjectToDetonate);
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((GrabbableObject)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "DetonatorItem";
}
}
public class EnemySpawner : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <SpawnEnemyAfterDelay>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public EnemySpawner <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnEnemyAfterDelay>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.TimeBetweenSpawn);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (<>4__this.IsSpawningEnabled)
{
<>4__this.SpawnEnemy();
}
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();
}
}
[Space]
[Header("Refrences")]
public Transform SpawnTransform;
[Space]
[Header("Settings")]
public bool IsDynamic = false;
[Space]
[Header("Single Enemy Spawn Settings")]
private string EnemyName;
[Space]
[Header("Mutiple Enemy Spawn Settings")]
public string[] EnemyNames;
public float TimeBetweenSpawn = 5f;
public int SpawnCap = -1;
private int Spawns = 0;
private bool IsSpawningEnabled;
public void SpawnEnemy()
{
SpawnEnemyServerRpc();
}
[ServerRpc(RequireOwnership = false)]
private void SpawnEnemyServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1067344233u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1067344233u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
if (!IsDynamic)
{
EnemyType val3 = Resources.FindObjectsOfTypeAll<EnemyType>().First((EnemyType enemytype) => enemytype.enemyName == EnemyName);
GameObject val4 = Object.Instantiate<GameObject>(val3.enemyPrefab, SpawnTransform.position, SpawnTransform.rotation);
val4.GetComponent<NetworkObject>().Spawn(false);
if (SpawnCap != -1)
{
Spawns++;
}
}
else
{
if (Spawns > SpawnCap)
{
return;
}
EnemyType[] array = Resources.FindObjectsOfTypeAll<EnemyType>();
List<EnemyType> list = new List<EnemyType>();
EnemyType[] array2 = array;
foreach (EnemyType val5 in array2)
{
if (EnemyNames.Contains(val5.enemyName))
{
list.Add(val5);
}
}
int index = Random.Range(0, list.Count);
GameObject val6 = Object.Instantiate<GameObject>(list[index].enemyPrefab, SpawnTransform.position, SpawnTransform.rotation);
val6.GetComponent<NetworkObject>().Spawn(false);
if (SpawnCap != -1)
{
Spawns++;
}
((MonoBehaviour)this).StartCoroutine(SpawnEnemyAfterDelay());
}
}
public void ToggleSpawning()
{
if (!IsSpawningEnabled)
{
IsSpawningEnabled = true;
((MonoBehaviour)this).StartCoroutine(SpawnEnemyAfterDelay());
}
else
{
IsSpawningEnabled = false;
}
}
[IteratorStateMachine(typeof(<SpawnEnemyAfterDelay>d__11))]
private IEnumerator SpawnEnemyAfterDelay()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnEnemyAfterDelay>d__11(0)
{
<>4__this = this
};
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1067344233u, new RpcReceiveHandler(__rpc_handler_1067344233), "SpawnEnemyServerRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1067344233(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((EnemySpawner)(object)target).SpawnEnemyServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "EnemySpawner";
}
}
public class ItemSpawner : MonoBehaviour
{
[Header("Settings")]
public bool spawnOnStart = false;
public Transform spawnPos;
[Space(5f)]
[Header("Items")]
public string[] possibleItemNames;
private void Start()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (spawnOnStart)
{
SpawnRandomItem(spawnPos.position);
}
}
public GameObject SpawnRandomItem(Vector3 position)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkManager.Singleton.IsServer)
{
return null;
}
if (possibleItemNames.Count() == 0)
{
return null;
}
int num = Random.Range(0, possibleItemNames.Count());
Item itemFromName = ItemManagement.GetItemFromName(possibleItemNames[num]);
GameObject val = Object.Instantiate<GameObject>(ItemManagement.GetItemFromName(possibleItemNames[num]).spawnPrefab, position, Quaternion.identity, (Transform)null);
Debug.Log((object)$"Spawning item: {val}");
if (itemFromName.isScrap)
{
int num2 = Random.Range(itemFromName.minValue, itemFromName.maxValue);
val.GetComponent<GrabbableObject>().SetScrapValue(Mathf.RoundToInt((float)(num2 / 2)));
val.GetComponent<NetworkObject>().Spawn(false);
}
else
{
val.GetComponent<NetworkObject>().Spawn(false);
}
return val;
}
}
[BepInPlugin("WaterGun.WaterGunLib", "WaterGunLib", "1.3.2")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
internal class GameNetworkManager_Start
{
[HarmonyPrefix]
public static void Prefix(GameNetworkManager __instance)
{
foreach (GameObject item in prefabsToNetwork)
{
if (NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(item))
{
break;
}
NetworkManager.Singleton.AddNetworkPrefab(item);
}
}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
internal class StartOfRound_Awake
{
[HarmonyPostfix]
public static void Postfix()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Expected O, but got Unknown
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val in levels)
{
foreach (KeyValuePair<Enemies.RegisteredEnemy, List<string>> registeredEnemy in Enemies.registeredEnemies)
{
Enemies.RegisteredEnemy key = registeredEnemy.Key;
List<string> value = registeredEnemy.Value;
if (value.Contains("All"))
{
if (key.spawnType == Enemies.SpawnType.Indoor)
{
val.Enemies.Add(new SpawnableEnemyWithRarity
{
enemyType = key.enemyType,
rarity = key.rarity
});
}
else if (key.spawnType == Enemies.SpawnType.Outdoor)
{
val.OutsideEnemies.Add(new SpawnableEnemyWithRarity
{
enemyType = key.enemyType,
rarity = key.rarity
});
}
else if (key.spawnType == Enemies.SpawnType.DayTime)
{
val.DaytimeEnemies.Add(new SpawnableEnemyWithRarity
{
enemyType = key.enemyType,
rarity = key.rarity
});
}
}
}
foreach (KeyValuePair<SpawnableOutsideObjects.RegisteredOutsideObject, List<string>> registeredOutsideObject in SpawnableOutsideObjects.registeredOutsideObjects)
{
SpawnableOutsideObjects.RegisteredOutsideObject key2 = registeredOutsideObject.Key;
List<string> value2 = registeredOutsideObject.Value;
if (value2.Contains("All"))
{
List<SpawnableOutsideObjectWithRarity> list = val.spawnableOutsideObjects.ToList();
list.Add(new SpawnableOutsideObjectWithRarity
{
spawnableObject = key2.outsideObject,
randomAmount = key2.randomAmount
});
val.spawnableOutsideObjects = list.ToArray();
}
if (value2.Contains(val.PlanetName) && !value2.Contains("All"))
{
List<SpawnableOutsideObjectWithRarity> list2 = val.spawnableOutsideObjects.ToList();
list2.Add(new SpawnableOutsideObjectWithRarity
{
spawnableObject = key2.outsideObject,
randomAmount = key2.randomAmount
});
val.spawnableOutsideObjects = list2.ToArray();
}
}
}
}
}
[HarmonyPatch(typeof(Terminal), "Start")]
internal class Terminal_Start
{
[HarmonyPrefix]
public static void Prefix(Terminal __instance)
{
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: 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_0236: Expected O, but got Unknown
TerminalKeyword val = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
foreach (KeyValuePair<Enemies.RegisteredEnemy, List<string>> registeredEnemy in Enemies.registeredEnemies)
{
Enemies.RegisteredEnemy key = registeredEnemy.Key;
List<string> value = registeredEnemy.Value;
if ((Object)(object)key.infoNode == (Object)null)
{
key.infoNode = ScriptableObject.CreateInstance<TerminalNode>();
key.infoNode.displayText = "No information given about " + key.enemyType.enemyName + "\n\n";
key.infoNode.clearPreviousText = true;
key.infoNode.creatureName = key.enemyType.enemyName;
key.infoNode.maxCharactersToType = 35;
}
if (__instance.enemyFiles.Any((TerminalNode file) => file.creatureName == key.infoNode.creatureName))
{
Debug.LogError((object)("[WaterGunLib]: " + key.infoNode.creatureName + "Already exists in enemiesList"));
continue;
}
TerminalKeyword keyword2 = ScriptableObject.CreateInstance<TerminalKeyword>();
keyword2.word = key.infoNode.creatureName.ToLowerInvariant().Replace(" ", "-");
keyword2.defaultVerb = val;
List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
if (!list.Any((TerminalKeyword x) => x.word == keyword2.word))
{
list.Add(keyword2);
__instance.terminalNodes.allKeywords = list.ToArray();
}
List<CompatibleNoun> list2 = val.compatibleNouns.ToList();
if (!list2.Any((CompatibleNoun x) => x.noun.word == keyword2.word))
{
list2.Add(new CompatibleNoun
{
noun = keyword2,
result = key.infoNode
});
val.compatibleNouns = list2.ToArray();
}
key.infoNode.creatureFileID = __instance.enemyFiles.Count;
__instance.enemyFiles.Add(key.infoNode);
ScanNodeProperties[] componentsInChildren = key.enemyType.enemyPrefab.GetComponentsInChildren<ScanNodeProperties>();
ScanNodeProperties[] array = componentsInChildren;
foreach (ScanNodeProperties val2 in array)
{
val2.creatureScanID = key.infoNode.creatureFileID;
}
}
}
}
[HarmonyPatch(typeof(Terminal), "Awake")]
internal class Terminal_Awake
{
[HarmonyPrefix]
public static void Prefix(Terminal __instance)
{
//IL_0b4f: Unknown result type (might be due to invalid IL or missing references)
//IL_0b54: Unknown result type (might be due to invalid IL or missing references)
//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
//IL_0b92: Expected O, but got Unknown
//IL_0b94: Unknown result type (might be due to invalid IL or missing references)
//IL_0b99: Unknown result type (might be due to invalid IL or missing references)
//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Expected O, but got Unknown
//IL_0bce: Unknown result type (might be due to invalid IL or missing references)
//IL_0bd6: Expected O, but got Unknown
//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
//IL_06e6: Expected O, but got Unknown
//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0722: Unknown result type (might be due to invalid IL or missing references)
//IL_072a: Expected O, but got Unknown
//IL_0771: Unknown result type (might be due to invalid IL or missing references)
//IL_0776: Unknown result type (might be due to invalid IL or missing references)
//IL_0783: Unknown result type (might be due to invalid IL or missing references)
//IL_0790: Expected O, but got Unknown
//IL_0c5d: Unknown result type (might be due to invalid IL or missing references)
//IL_0c62: Unknown result type (might be due to invalid IL or missing references)
//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c7c: Expected O, but got Unknown
//IL_085d: Unknown result type (might be due to invalid IL or missing references)
//IL_0862: Unknown result type (might be due to invalid IL or missing references)
//IL_086f: Unknown result type (might be due to invalid IL or missing references)
//IL_087c: Expected O, but got Unknown
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Expected O, but got Unknown
//IL_0d3a: Unknown result type (might be due to invalid IL or missing references)
//IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
//IL_0d4c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d59: Expected O, but got Unknown
foreach (Unlockables.RegisteredUnlockable unlockable2 in Unlockables.registeredUnlockables)
{
if (StartOfRound.Instance.unlockablesList.unlockables.Any((UnlockableItem x) => x.unlockableName == unlockable2.unlockableItem.unlockableName))
{
Debug.LogError((object)("[WaterGunLib]: " + unlockable2.unlockableItem.unlockableName + "Already exists in unlockablesList"));
continue;
}
if ((Object)(object)unlockable2.unlockableItem.prefabObject != (Object)null)
{
PlaceableShipObject componentInChildren = unlockable2.unlockableItem.prefabObject.GetComponentInChildren<PlaceableShipObject>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.unlockableID = StartOfRound.Instance.unlockablesList.unlockables.Count;
}
}
StartOfRound.Instance.unlockablesList.unlockables.Add(unlockable2.unlockableItem);
}
TerminalKeyword val = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
TerminalKeyword val2 = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
foreach (KeyValuePair<Items.RegisteredItem, List<string>> item2 in Items.registeredItems)
{
if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item x) => x.itemName == item2.Key.item.itemName))
{
StartOfRound.Instance.allItemsList.itemsList.Add(item2.Key.item);
}
if (!item2.Key.isShopItem)
{
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val3 in levels)
{
if (!val3.spawnableScrap.Any((SpawnableItemWithRarity scrap) => (Object)(object)scrap.spawnableItem == (Object)(object)item2.Key.item))
{
if (item2.Value.Contains("All"))
{
val3.spawnableScrap.Add(new SpawnableItemWithRarity
{
rarity = item2.Key.rarity,
spawnableItem = item2.Key.item
});
}
if (item2.Value.Contains(val3.PlanetName) && !item2.Value.Contains("All"))
{
val3.spawnableScrap.Add(new SpawnableItemWithRarity
{
rarity = item2.Key.rarity,
spawnableItem = item2.Key.item
});
}
}
}
}
else
{
if (!item2.Key.isShopItem)
{
continue;
}
if (__instance.buyableItemsList.Any((Item itemScript) => (Object)(object)itemScript == (Object)(object)item2.Key.item))
{
List<Item> list = __instance.buyableItemsList.ToList();
list.Add(item2.Key.item);
__instance.buyableItemsList = list.ToArray();
}
TerminalKeyword keyword4 = ScriptableObject.CreateInstance<TerminalKeyword>();
((Object)keyword4).name = item2.Key.item.itemName.Replace(" ", "-");
keyword4.defaultVerb = val;
keyword4.word = item2.Key.item.itemName.ToLowerInvariant().Replace(" ", "-");
if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword x) => x.word == keyword4.word))
{
Debug.LogError((object)("[WaterGunLib]: Keyword: " + keyword4.word + " already exists"));
continue;
}
List<Item> list2 = __instance.buyableItemsList.ToList();
int num = list2.IndexOf(item2.Key.item);
int buyItemIndex = ((num == -1) ? (list2.Count - 1) : num);
TerminalNode val4 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val4).name = item2.Key.item.itemName.Replace(" ", "-") + "BuyNode2";
val4.displayText = "Ordered [variableAmount] " + item2.Key.item.itemName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
val4.clearPreviousText = true;
val4.maxCharactersToType = 15;
val4.buyItemIndex = buyItemIndex;
val4.creatureName = item2.Key.item.itemName;
val4.isConfirmationNode = false;
val4.itemCost = item2.Key.item.creditsWorth;
val4.playSyncedClip = 0;
TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>();
val5 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val5).name = item2.Key.item.itemName.Replace(" ", "-") + "BuyNode1";
val5.displayText = "You have requested to order " + item2.Key.item.itemName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
val5.clearPreviousText = true;
val5.maxCharactersToType = 35;
val5.buyItemIndex = buyItemIndex;
val5.creatureName = item2.Key.item.itemName;
val5.isConfirmationNode = true;
val5.overrideOptions = true;
val5.itemCost = item2.Key.item.creditsWorth;
val5.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
{
new CompatibleNoun
{
noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
result = val4
},
new CompatibleNoun
{
noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
result = result
}
};
List<TerminalKeyword> list3 = __instance.terminalNodes.allKeywords.ToList();
list3.Add(keyword4);
__instance.terminalNodes.allKeywords = list3.ToArray();
List<CompatibleNoun> list4 = val.compatibleNouns.ToList();
list4.Add(new CompatibleNoun
{
noun = keyword4,
result = val5
});
val.compatibleNouns = list4.ToArray();
TerminalNode val6 = item2.Key.infoNode;
if ((Object)(object)val6 == (Object)null)
{
val6 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val6).name = item2.Key.item.itemName.Replace(" ", "-") + "InfoNode";
val6.displayText = "No information given about " + item2.Key.item.itemName + "\n\n";
val6.clearPreviousText = true;
val6.maxCharactersToType = 25;
}
__instance.terminalNodes.allKeywords = list3.ToArray();
List<CompatibleNoun> list5 = val2.compatibleNouns.ToList();
list5.Add(new CompatibleNoun
{
noun = keyword4,
result = val6
});
val2.compatibleNouns = list5.ToArray();
}
}
foreach (Unlockables.RegisteredUnlockable item in Unlockables.registeredUnlockables)
{
TerminalKeyword keyword3 = ScriptableObject.CreateInstance<TerminalKeyword>();
((Object)keyword3).name = item.unlockableItem.unlockableName.Replace(" ", "-");
keyword3.defaultVerb = val;
keyword3.word = item.unlockableItem.unlockableName.ToLowerInvariant().Replace(" ", "-");
if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword x) => x.word == keyword3.word))
{
Debug.LogError((object)("[WaterGunLib]: Keyword: " + keyword3.word + " already exists"));
continue;
}
int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == item.unlockableItem.unlockableName);
TerminalNode val7 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val7).name = item.unlockableItem.unlockableName.Replace(" ", "-") + "BuyNode2";
val7.displayText = "Ordered [variableAmount] " + item.unlockableItem.unlockableName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
val7.clearPreviousText = true;
val7.maxCharactersToType = 15;
val7.buyItemIndex = -1;
val7.shipUnlockableID = shipUnlockableID;
val7.buyUnlockable = true;
val7.creatureName = item.unlockableItem.unlockableName;
val7.isConfirmationNode = false;
val7.itemCost = item.price;
val7.playSyncedClip = 0;
TerminalNode val8 = ScriptableObject.CreateInstance<TerminalNode>();
val8 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val8).name = item.unlockableItem.unlockableName.Replace(" ", "-") + "BuyNode1";
val8.displayText = "You have requested to order " + item.unlockableItem.unlockableName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
val8.clearPreviousText = true;
val8.maxCharactersToType = 35;
val8.buyItemIndex = -1;
val8.shipUnlockableID = shipUnlockableID;
val8.creatureName = item.unlockableItem.unlockableName;
val8.isConfirmationNode = true;
val8.overrideOptions = true;
val8.itemCost = item.price;
val8.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
{
new CompatibleNoun
{
noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
result = val7
},
new CompatibleNoun
{
noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
result = result
}
};
if (item.storeType == Unlockables.StoreType.Decor)
{
item.unlockableItem.shopSelectionNode = val8;
}
else
{
item.unlockableItem.shopSelectionNode = null;
}
List<TerminalKeyword> list6 = __instance.terminalNodes.allKeywords.ToList();
list6.Add(keyword3);
__instance.terminalNodes.allKeywords = list6.ToArray();
List<CompatibleNoun> list7 = val.compatibleNouns.ToList();
list7.Add(new CompatibleNoun
{
noun = keyword3,
result = val8
});
val.compatibleNouns = list7.ToArray();
TerminalNode val9 = item.itemInfo;
if ((Object)(object)val9 == (Object)null)
{
val9 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val9).name = item.unlockableItem.unlockableName.Replace(" ", "-") + "InfoNode";
val9.displayText = "No information given about " + item.unlockableItem.unlockableName + "\n\n";
val9.clearPreviousText = true;
val9.maxCharactersToType = 25;
}
__instance.terminalNodes.allKeywords = list6.ToArray();
List<CompatibleNoun> list8 = val2.compatibleNouns.ToList();
list8.Add(new CompatibleNoun
{
noun = keyword3,
result = val9
});
val2.compatibleNouns = list8.ToArray();
}
}
}
[HarmonyPatch(typeof(Terminal), "TextPostProcess")]
internal class Terminal_TextPostProcess
{
[HarmonyPrefix]
public static void Prefix(ref TerminalNode node, ref string modifiedDisplayText, Terminal __instance)
{
if (!modifiedDisplayText.Contains("[buyableItemsList]") || !modifiedDisplayText.Contains("[unlockablesSelectionList]"))
{
return;
}
int num = modifiedDisplayText.IndexOf(":");
foreach (Unlockables.RegisteredUnlockable registeredUnlockable in Unlockables.registeredUnlockables)
{
if (registeredUnlockable.storeType == Unlockables.StoreType.ShipUpgrade)
{
string unlockableName = registeredUnlockable.unlockableItem.unlockableName;
int price = registeredUnlockable.price;
string value = $"\n* {unlockableName} // Price: ${price}";
modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value);
}
}
}
}
private const string GUID = "WaterGun.WaterGunLib";
private const string VER = "1.3.2";
private const string NAME = "WaterGunLib";
public static List<GameObject> prefabsToNetwork = new List<GameObject>();
private void Awake()
{
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Expected O, but got Unknown
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
string pluginPath = Paths.PluginPath;
string[] files = Directory.GetFiles(pluginPath, "*.watergunlib", SearchOption.AllDirectories);
string[] array3 = files;
foreach (string text in array3)
{
Debug.Log((object)("[WaterGunLib]: Found bundle: " + text));
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)("[WaterGunLib]: Failed to load bundle: " + text));
continue;
}
WaterGunLibMod[] array4 = val.LoadAllAssets<WaterGunLibMod>();
WaterGunLibMod[] array5 = array4;
foreach (WaterGunLibMod waterGunLibMod in array5)
{
foreach (UnlockableItemRef unlockable in waterGunLibMod.Unlockables)
{
Unlockables.RegisterUnlockable(unlockable, waterGunLibMod.ModGUID);
}
foreach (SpawnableOutsideObjectRef outsideObject in waterGunLibMod.OutsideObjects)
{
SpawnableOutsideObjects.RegisterSpawnableOutsideObject(outsideObject, waterGunLibMod.ModGUID);
}
foreach (EnemyTypeRef enemy in waterGunLibMod.Enemies)
{
Enemies.RegisterEnemy(enemy, waterGunLibMod.ModGUID);
}
foreach (ItemRef item in waterGunLibMod.Items)
{
Items.RegisterItem(item, waterGunLibMod.ModGUID);
}
}
}
Harmony val2 = new Harmony("WaterGun.WaterGunLib");
val2.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded with all modules");
}
}
public class PowerGenerator : NetworkBehaviour
{
[Space]
[Header("Refrences")]
public List<Light> LightsToDisable;
public AudioClip FailSound;
public AudioClip ToggleSound;
public AudioSource GeneratorAudioSource;
[Space]
[Header("Settings")]
public bool IsAbleToFail = true;
[Range(0f, 100f)]
public float ChanceToFail = 50f;
public int FailDamage = 50;
[Space]
[Header("Events")]
public UnityEvent OnGeneratorFail;
public UnityEvent OnGeneratorSuccess;
public void ToggleAllLights(PlayerControllerB player)
{
ulong playerClientId = player.playerClientId;
ToggleLightsServerRpc(playerClientId);
}
[ServerRpc(RequireOwnership = false)]
public void ToggleLightsServerRpc(ulong clientid)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4017266650u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientid);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4017266650u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val3 in allPlayerScripts)
{
if (val3.playerClientId == clientid)
{
if (Random.value <= ChanceToFail / 100f)
{
ToggleLightsClientRpc(IsFailed: true, clientid);
}
else
{
ToggleLightsClientRpc(IsFailed: false, clientid);
}
}
}
}
[ClientRpc]
public void ToggleLightsClientRpc(bool IsFailed, ulong clientid)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1129565366u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref IsFailed, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, clientid);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1129565366u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
if (!IsFailed)
{
if ((Object)(object)GeneratorAudioSource != (Object)null)
{
GeneratorAudioSource.PlayOneShot(ToggleSound);
}
foreach (Light item in LightsToDisable)
{
if (!((Behaviour)item).enabled)
{
((Behaviour)item).enabled = true;
}
else
{
((Behaviour)item).enabled = false;
}
}
OnGeneratorSuccess.Invoke();
}
else
{
if (!IsFailed || !IsAbleToFail)
{
return;
}
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val3 in allPlayerScripts)
{
if (val3.playerClientId == clientid)
{
val3.DamagePlayer(FailDamage, true, true, (CauseOfDeath)11, 0, false, default(Vector3));
}
}
if ((Object)(object)GeneratorAudioSource != (Object)null)
{
GeneratorAudioSource.PlayOneShot(FailSound);
}
OnGeneratorFail.Invoke();
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(4017266650u, new RpcReceiveHandler(__rpc_handler_4017266650), "ToggleLightsServerRpc");
((NetworkBehaviour)this).__registerRpc(1129565366u, new RpcReceiveHandler(__rpc_handler_1129565366), "ToggleLightsClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_4017266650(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong clientid = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientid);
target.__rpc_exec_stage = (__RpcExecStage)1;
((PowerGenerator)(object)target).ToggleLightsServerRpc(clientid);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1129565366(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool isFailed = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isFailed, default(ForPrimitives));
ulong clientid = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientid);
target.__rpc_exec_stage = (__RpcExecStage)1;
((PowerGenerator)(object)target).ToggleLightsClientRpc(isFailed, clientid);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "PowerGenerator";
}
}
public class TeleportTarget : NetworkBehaviour
{
[Space]
[Header("Refrences")]
public Transform Target;
public AudioClip StartTeleport;
public AudioClip EndTeleport;
[Space]
[Header("AudioSource")]
public AudioSource EndAudioSource;
public AudioSource StartAudioSource;
public void TeleportPlayer()
{
//IL_0011: 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)
GameNetworkManager.Instance.localPlayerController.TeleportPlayer(Target.position, true, Target.eulerAngles.y, false, true);
GameNetworkManager.Instance.localPlayerController.isInElevator = false;
GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
TeleportPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
Debug.Log((object)"TeleportStarted");
}
[ServerRpc(RequireOwnership = false)]
private void TeleportPlayerServerRpc(int PlayerObj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1787506709u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, PlayerObj);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1787506709u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
TeleportPlayerClientRpc(PlayerObj);
}
}
}
[ClientRpc]
private void TeleportPlayerClientRpc(int PlayerObj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_00e6: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1996081384u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, PlayerObj);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1996081384u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
StartOfRound.Instance.allPlayerScripts[PlayerObj].TeleportPlayer(Target.position, true, Target.eulerAngles.y, false, true);
StartOfRound.Instance.allPlayerScripts[PlayerObj].isInElevator = false;
StartOfRound.Instance.allPlayerScripts[PlayerObj].isInHangarShipRoom = false;
if ((Object)(object)EndTeleport != (Object)null && (Object)(object)EndAudioSource != (Object)null)
{
EndAudioSource.PlayOneShot(EndTeleport);
}
if ((Object)(object)StartTeleport != (Object)null && (Object)(object)StartAudioSource != (Object)null)
{
StartAudioSource.PlayOneShot(StartTeleport);
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1787506709u, new RpcReceiveHandler(__rpc_handler_1787506709), "TeleportPlayerServerRpc");
((NetworkBehaviour)this).__registerRpc(1996081384u, new RpcReceiveHandler(__rpc_handler_1996081384), "TeleportPlayerClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1787506709(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerObj = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
target.__rpc_exec_stage = (__RpcExecStage)1;
((TeleportTarget)(object)target).TeleportPlayerServerRpc(playerObj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1996081384(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerObj = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
target.__rpc_exec_stage = (__RpcExecStage)1;
((TeleportTarget)(object)target).TeleportPlayerClientRpc(playerObj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "TeleportTarget";
}
}
public class ToxicGas : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DamagePlayerAfterDelay>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PlayerControllerB Player;
public ToxicGas <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DamagePlayerAfterDelay>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (<>4__this.IsAbleToDealDamage)
{
<>4__this.IsAbleToDealDamage = false;
Player.DamagePlayer(<>4__this.Damage, true, true, <>4__this.DeathType, <>4__this.DeathAnimation, false, default(Vector3));
Debug.Log((object)("Damaged Player: " + Player.playerUsername));
<>2__current = (object)new WaitForSeconds((float)<>4__this.Delay);
<>1__state = 1;
return true;
}
break;
case 1:
<>1__state = -1;
<>4__this.IsAbleToDealDamage = true;
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();
}
}
[Space]
[Header("Settings")]
public int Delay = 3;
public int Damage = 20;
public CauseOfDeath DeathType;
public int DeathAnimation = 0;
public bool DamageSFX = false;
private bool IsAbleToDealDamage = true;
private void OnTriggerStay(Collider other)
{
if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<PlayerControllerB>()))
{
((MonoBehaviour)this).StartCoroutine(DamagePlayerAfterDelay(((Component)other).GetComponent<PlayerControllerB>()));
}
}
[IteratorStateMachine(typeof(<DamagePlayerAfterDelay>d__7))]
private IEnumerator DamagePlayerAfterDelay(PlayerControllerB Player)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DamagePlayerAfterDelay>d__7(0)
{
<>4__this = this,
Player = Player
};
}
}
}
namespace WaterGunLib.Modules
{
[CreateAssetMenu(menuName = "WaterGunLib/Enemies/EnemyTypeRefrence")]
public class EnemyTypeRef : ScriptableObject
{
[Header("Settings")]
public bool networkPrefab;
public EnemyType enemyType;
public int rarity = 10;
public TerminalNode infoNode = null;
public Enemies.SpawnType spawnType = Enemies.SpawnType.Indoor;
public List<string> PlanetNames = new List<string> { "All" };
}
public class Enemies
{
public enum SpawnType
{
Outdoor,
Indoor,
DayTime
}
public class RegisteredEnemy
{
public EnemyType enemyType;
public string modGUID;
public SpawnType spawnType;
public int rarity;
public TerminalNode infoNode;
}
public static Dictionary<RegisteredEnemy, List<string>> registeredEnemies = new Dictionary<RegisteredEnemy, List<string>>();
public static void RegisterEnemy(EnemyTypeRef enemyTypeRef, string modGUID)
{
RegisteredEnemy registeredEnemy = new RegisteredEnemy
{
enemyType = enemyTypeRef.enemyType,
modGUID = modGUID,
spawnType = enemyTypeRef.spawnType,
rarity = enemyTypeRef.rarity,
infoNode = enemyTypeRef.infoNode
};
if (registeredEnemies.ContainsKey(registeredEnemy))
{
Debug.LogError((object)("[WaterGunLib]: " + registeredEnemy.enemyType.enemyName + " is already registered. modName: " + registeredEnemy.modGUID));
return;
}
if (enemyTypeRef.networkPrefab)
{
Plugin.prefabsToNetwork.Add(registeredEnemy.enemyType.enemyPrefab);
}
registeredEnemies.Add(registeredEnemy, enemyTypeRef.PlanetNames);
Debug.Log((object)("[WaterGunLib]: Registered " + registeredEnemy.enemyType.enemyName + ". modGUID: " + registeredEnemy.modGUID));
}
}
public class ItemManagement
{
public static Item GetItemFromName(string itemName)
{
foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
{
if (items.itemName == itemName)
{
return items;
}
}
return null;
}
}
[CreateAssetMenu(menuName = "WaterGunLib/Items/ItemRefrence")]
public class ItemRef : ScriptableObject
{
[Header("Settings")]
public bool networkPrefab;
public Item item;
[Space(5f)]
[Header("ShopItem")]
public TerminalNode infoNode = null;
public bool isShopItem = false;
[Space(5f)]
[Header("Scrap")]
public int rarity = 10;
public List<string> PlanetNames = new List<string> { "All" };
}
public class Items
{
public class RegisteredItem
{
public string modGUID;
public Item item;
public int rarity;
public TerminalNode infoNode;
public bool isShopItem;
}
public static Dictionary<RegisteredItem, List<string>> registeredItems = new Dictionary<RegisteredItem, List<string>>();
public static void RegisterItem(ItemRef itemRef, string modGUID)
{
RegisteredItem registeredItem = new RegisteredItem
{
item = itemRef.item,
modGUID = modGUID,
rarity = itemRef.rarity,
infoNode = itemRef.infoNode,
isShopItem = itemRef.isShopItem
};
if (registeredItems.ContainsKey(registeredItem))
{
Debug.LogError((object)("[WaterGunLib]: " + registeredItem.item.itemName + " is already registered. modName: " + registeredItem.modGUID));
return;
}
if (itemRef.networkPrefab)
{
Plugin.prefabsToNetwork.Add(registeredItem.item.spawnPrefab);
}
registeredItems.Add(registeredItem, itemRef.PlanetNames);
Debug.Log((object)("[WaterGunLib]: Registered " + registeredItem.item.itemName + ". modGUID: " + registeredItem.modGUID));
}
}
[CreateAssetMenu(menuName = "WaterGunLib/OutsideObjects/SpawnableOutsideObjectRefrence")]
public class SpawnableOutsideObjectRef : ScriptableObject
{
[Header("Settings")]
public bool networkPrefab;
public List<string> PlanetNames = new List<string> { "All" };
public AnimationCurve RandomAmount;
public SpawnableOutsideObject outsideObject;
}
public class SpawnableOutsideObjects
{
public class RegisteredOutsideObject
{
public string modGUID;
public SpawnableOutsideObject outsideObject;
public AnimationCurve randomAmount;
}
public static Dictionary<RegisteredOutsideObject, List<string>> registeredOutsideObjects = new Dictionary<RegisteredOutsideObject, List<string>>();
public static void RegisterSpawnableOutsideObject(SpawnableOutsideObjectRef outsideObject, string modGUID)
{
RegisteredOutsideObject registeredOutsideObject = new RegisteredOutsideObject
{
modGUID = modGUID,
outsideObject = outsideObject.outsideObject,
randomAmount = outsideObject.RandomAmount
};
if (registeredOutsideObjects.ContainsKey(registeredOutsideObject))
{
Debug.LogError((object)("[WaterGunLib]: " + ((Object)registeredOutsideObject.outsideObject.prefabToSpawn).name + " is already registered. modName: " + registeredOutsideObject.modGUID));
return;
}
if (outsideObject.networkPrefab)
{
Plugin.prefabsToNetwork.Add(registeredOutsideObject.outsideObject.prefabToSpawn);
}
registeredOutsideObjects.Add(registeredOutsideObject, outsideObject.PlanetNames);
Debug.Log((object)("[WaterGunLib]: Registered " + ((Object)registeredOutsideObject.outsideObject.prefabToSpawn).name + ". modGUID: " + registeredOutsideObject.modGUID));
}
}
[CreateAssetMenu(menuName = "WaterGunLib/Unlockables/UnlockableItemRefrence")]
public class UnlockableItemRef : ScriptableObject
{
[Header("Settings")]
public bool networkPrefab;
public UnlockableItem UnlockableItem;
public Unlockables.StoreType StoreType = Unlockables.StoreType.ShipUpgrade;
public int Price = 0;
public TerminalNode InfoNode = null;
}
public class Unlockables
{
public enum StoreType
{
ShipUpgrade,
Decor
}
public class RegisteredUnlockable
{
public StoreType storeType;
public UnlockableItem unlockableItem;
public string modGUID;
public int price;
public TerminalNode itemInfo;
}
public static List<RegisteredUnlockable> registeredUnlockables = new List<RegisteredUnlockable>();
public static void RegisterUnlockable(UnlockableItemRef unlockable, string modGUID)
{
RegisteredUnlockable registeredUnlockable = new RegisteredUnlockable
{
storeType = unlockable.StoreType,
unlockableItem = unlockable.UnlockableItem,
price = unlockable.Price,
itemInfo = unlockable.InfoNode,
modGUID = modGUID
};
if (registeredUnlockables.Contains(registeredUnlockable))
{
Debug.LogError((object)("[WaterGunLib]: " + unlockable.UnlockableItem.unlockableName + " is already registered. modName: " + registeredUnlockable.modGUID));
return;
}
if (unlockable.networkPrefab)
{
Plugin.prefabsToNetwork.Add(unlockable.UnlockableItem.prefabObject);
}
registeredUnlockables.Add(registeredUnlockable);
Debug.Log((object)("[WaterGunLib]: Registered " + unlockable.UnlockableItem.unlockableName + ". modGUID: " + registeredUnlockable.modGUID));
}
}
}
namespace WaterGunLib.Modules.Prefabs
{
public class NetworkPrefabs
{
public static void RegisterNetworkPrefab(GameObject prefab)
{
if (!Plugin.prefabsToNetwork.Contains(prefab))
{
Plugin.prefabsToNetwork.Add(prefab);
}
}
}
}
namespace WaterGunLib.Bundles
{
[CreateAssetMenu(menuName = "WaterGunLib/Mod")]
public class WaterGunLibMod : ScriptableObject
{
[Header("Settings")]
public string ModGUID;
[Space(5f)]
public List<UnlockableItemRef> Unlockables;
public List<SpawnableOutsideObjectRef> OutsideObjects;
public List<EnemyTypeRef> Enemies;
public List<ItemRef> Items;
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace WaterGunLib.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}