using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using GiantSpecimens.Colours;
using GiantSpecimens.Configs;
using GiantSpecimens.Dependency;
using GiantSpecimens.NetcodePatcher;
using GiantSpecimens.Patches;
using HarmonyLib;
using LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using On.GameNetcodeStuff;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GiantSpecimens")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Giant Enemies for Lethal Company.")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyInformationalVersion("1.8.0+b7d929d92d7aa726fe036a357df7beb6cf82d448")]
[assembly: AssemblyProduct("GiantSpecimens")]
[assembly: AssemblyTitle("GiantSpecimens")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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 GiantSpecimens
{
[BepInPlugin("GiantSpecimens", "GiantSpecimens", "1.8.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Harmony _harmony;
public static EnemyType PinkGiant;
public static EnemyType DriftGiant;
public static Item RedWoodPlushie;
public static Item Whistle;
internal static ManualLogSource Logger;
public static CauseOfDeath RupturedEardrums = EnumUtils.Create<CauseOfDeath>("RupturedEardrums");
public static CauseOfDeath InternalBleed = EnumUtils.Create<CauseOfDeath>("InternalBleed");
public static CauseOfDeath Thwomped = EnumUtils.Create<CauseOfDeath>("Thwomped");
public static ThreatType DriftwoodGiant = EnumUtils.Create<ThreatType>("DriftwoodGiant");
public static GiantSpecimensConfig ModConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
if (LobbyCompatibilityChecker.Enabled)
{
LobbyCompatibilityChecker.Init();
}
Assets.PopulateAssets();
ModConfig = new GiantSpecimensConfig(((BaseUnityPlugin)this).Config);
Whistle = Assets.MainAssetBundle.LoadAsset<Item>("WhistleObj");
Utilities.FixMixerGroups(Whistle.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(Whistle.spawnPrefab);
TerminalNode terminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("wlTerminalNode");
RegisterShopItemWithConfig(ModConfig.ConfigWhistleEnabled.Value, ModConfig.ConfigWhistleScrapEnabled.Value, Whistle, terminalNode, ModConfig.ConfigWhistleCost.Value, ModConfig.ConfigWhistleRarity.Value);
RedWoodPlushie = Assets.MainAssetBundle.LoadAsset<Item>("RedWoodPlushieObj");
Utilities.FixMixerGroups(RedWoodPlushie.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(RedWoodPlushie.spawnPrefab);
RegisterScrapWithConfig(ModConfig.ConfigRedwoodPlushieEnabled.Value, ModConfig.ConfigRedwoodPlushieRarity.Value, RedWoodPlushie);
PinkGiant = Assets.MainAssetBundle.LoadAsset<EnemyType>("PinkGiantObj");
TerminalNode terminalNode2 = Assets.MainAssetBundle.LoadAsset<TerminalNode>("PinkGiantTN");
TerminalKeyword terminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("PinkGiantTK");
NetworkPrefabs.RegisterNetworkPrefab(PinkGiant.enemyPrefab);
RegisterEnemyWithConfig(ModConfig.ConfigRedWoodEnabled.Value, ModConfig.ConfigRedWoodRarity.Value, PinkGiant, terminalNode2, terminalKeyword);
GiantPatches.Init();
Logger.LogInfo((object)"Plugin GiantSpecimens is loaded!");
InitializeNetworkBehaviours();
}
private void RegisterEnemyWithConfig(bool enabled, string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword)
{
if (enabled)
{
var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
}
else
{
Enemies.RegisterEnemy(enemy, 0, (LevelTypes)(-1), terminalNode, terminalKeyword);
}
}
private void RegisterScrapWithConfig(bool enabled, string configMoonRarity, Item scrap)
{
if (enabled)
{
var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
Items.RegisterScrap(scrap, dictionary, dictionary2);
}
else
{
Items.RegisterScrap(scrap, 0, (LevelTypes)(-1));
}
}
private void RegisterShopItemWithConfig(bool enabledShopItem, bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
{
if (enabledShopItem)
{
Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
}
if (enabledScrap)
{
RegisterScrapWithConfig(enabled: true, configMoonRarity, item);
}
}
private (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
foreach (string item in from s in configMoonRarity.Split(',')
select s.Trim())
{
string[] array = item.Split('@');
if (array.Length != 2)
{
continue;
}
string text = array[0];
if (int.TryParse(array[1], out var result))
{
if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
{
dictionary[result2] = result;
Logger.LogInfo((object)$"Registered spawn rate for level type {result2} to {result}");
}
else
{
dictionary2[text] = result;
Logger.LogInfo((object)$"Registered spawn rate for custom level type {text} to {result}");
}
}
}
return (dictionary, dictionary2);
}
private void InitializeNetworkBehaviours()
{
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);
}
}
}
}
}
public static class Assets
{
public static AssetBundle MainAssetBundle;
public static void PopulateAssets()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "giantspecimenassets"));
if ((Object)(object)MainAssetBundle == (Object)null)
{
Plugin.Logger.LogError((object)"Failed to load custom assets.");
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "GiantSpecimens";
public const string PLUGIN_NAME = "GiantSpecimens";
public const string PLUGIN_VERSION = "1.8.0";
}
}
namespace GiantSpecimens.Scrap
{
public class RedwoodPlushieScrap : GrabbableObject
{
[SerializeField]
public AudioSource plushiePlayer;
[SerializeField]
public AudioClip[] plushieSounds;
[SerializeField]
public float maxLoudness;
[SerializeField]
public float minLoudness;
[SerializeField]
public float minPitch;
[SerializeField]
public float maxPitch;
private Random noisemakerRandom;
public Animator triggerAnimator;
public AudioClip soundToPlay;
private void LogIfDebugBuild(string text)
{
}
public override void Start()
{
((GrabbableObject)this).Start();
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
int num = noisemakerRandom.Next(0, plushieSounds.Length);
float volume = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
plushiePlayer.pitch = pitch;
soundToPlay = plushieSounds[num];
PlayPlushiePlayer(volume);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
Animator obj = triggerAnimator;
if (obj != null)
{
obj.SetTrigger("playAnim");
}
}
}
public void PlayPlushiePlayer(float volume)
{
plushiePlayer.PlayOneShot(soundToPlay, volume);
if (((NetworkBehaviour)this).IsHost)
{
PlayPlushiePlayerClientRpc(volume);
}
else
{
PlayPlushiePlayerServerRpc(volume);
}
}
[ServerRpc]
public void PlayPlushiePlayerServerRpc(float volume)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3172147899u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3172147899u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsHost)
{
PlayPlushiePlayerClientRpc(volume);
}
}
[ClientRpc]
public void PlayPlushiePlayerClientRpc(float volume)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4222537525u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4222537525u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsHost)
{
plushiePlayer.PlayOneShot(soundToPlay, volume);
}
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_RedwoodPlushieScrap()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3172147899u, new RpcReceiveHandler(__rpc_handler_3172147899));
NetworkManager.__rpc_func_table.Add(4222537525u, new RpcReceiveHandler(__rpc_handler_4222537525));
}
private static void __rpc_handler_3172147899(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0082: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
float volume = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((RedwoodPlushieScrap)(object)target).PlayPlushiePlayerServerRpc(volume);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4222537525(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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
float volume = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((RedwoodPlushieScrap)(object)target).PlayPlushiePlayerClientRpc(volume);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "RedwoodPlushieScrap";
}
}
public class WhistleItem : GrabbableObject
{
[SerializeField]
public AudioSource whistlePlayer;
[SerializeField]
public AudioClip[] whistleSounds;
[SerializeField]
public float maxLoudness;
[SerializeField]
public float minLoudness;
[SerializeField]
public float minPitch;
[SerializeField]
public float maxPitch;
private Random noisemakerRandom;
public Animator triggerAnimator;
public int count;
private void LogIfDebugBuild(string text)
{
}
public override void Start()
{
((GrabbableObject)this).Start();
count = 0;
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
int num = noisemakerRandom.Next(0, whistleSounds.Length);
float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
whistlePlayer.pitch = pitch;
whistlePlayer.PlayOneShot(whistleSounds[num], num2);
if ((Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.SetTrigger("playAnim");
}
if ((Object)(object)base.playerHeldBy != (Object)null && FlagClosestRedWoodGiantInRange(75f))
{
LogIfDebugBuild("Run.");
}
}
private bool FlagClosestRedWoodGiantInRange(float range)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (spawnedEnemy.enemyType.enemyName == "RedWoodGiant")
{
float num = Vector3.Distance(((Component)base.playerHeldBy).transform.position, ((Component)spawnedEnemy).transform.position);
if (num < range && !base.playerHeldBy.isInsideFactory)
{
spawnedEnemy.SetDestinationToPosition(((Component)base.playerHeldBy).transform.position, false);
count++;
}
}
}
if (count > 0)
{
LogIfDebugBuild("You are being chased by " + count + " Redwood Giants :)");
count = 0;
return true;
}
return false;
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "WhistleItem";
}
}
}
namespace GiantSpecimens.Patches
{
public static class GiantPatches
{
[CompilerGenerated]
private static class <>O
{
public static hook_PlayerHitGroundEffects <0>__PlayerControllerB_PlayerHitGroundEffects;
}
public static bool thrownByGiant;
public static void Init()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__PlayerControllerB_PlayerHitGroundEffects;
if (obj == null)
{
hook_PlayerHitGroundEffects val = PlayerControllerB_PlayerHitGroundEffects;
<>O.<0>__PlayerControllerB_PlayerHitGroundEffects = val;
obj = (object)val;
}
PlayerControllerB.PlayerHitGroundEffects += (hook_PlayerHitGroundEffects)obj;
}
private static void PlayerControllerB_PlayerHitGroundEffects(orig_PlayerHitGroundEffects orig, PlayerControllerB self)
{
if (thrownByGiant)
{
self.fallValueUncapped = -41f;
thrownByGiant = false;
}
orig.Invoke(self);
}
}
}
namespace GiantSpecimens.Configs
{
public class GiantSpecimensConfig
{
public ConfigEntry<int> ConfigMultiplierForestkeeper { get; private set; }
public ConfigEntry<float> ConfigSpeedRedWood { get; private set; }
public ConfigEntry<float> ConfigShipDistanceRedWood { get; private set; }
public ConfigEntry<float> ConfigForestDistanceRedWood { get; private set; }
public ConfigEntry<string> ConfigColourHexcode { get; private set; }
public ConfigEntry<bool> ConfigRedWoodEnabled { get; private set; }
public ConfigEntry<string> ConfigRedWoodRarity { get; private set; }
public ConfigEntry<bool> ConfigRedwoodPlushieEnabled { get; private set; }
public ConfigEntry<string> ConfigRedwoodPlushieRarity { get; private set; }
public ConfigEntry<int> ConfigWhistleCost { get; private set; }
public ConfigEntry<bool> ConfigWhistleEnabled { get; private set; }
public ConfigEntry<string> ConfigWhistleRarity { get; private set; }
public ConfigEntry<bool> ConfigWhistleScrapEnabled { get; private set; }
public ConfigEntry<bool> ConfigDriftWoodEnabled { get; private set; }
public ConfigEntry<string> ConfigDriftWoodRarity { get; private set; }
public ConfigEntry<bool> ConfigDriftWoodPlushieEnabled { get; private set; }
public ConfigEntry<string> ConfigDriftWoodPlushieRarity { get; private set; }
public ConfigEntry<int> ConfigMultiplierDriftwood { get; private set; }
public GiantSpecimensConfig(ConfigFile configFile)
{
ConfigMultiplierForestkeeper = configFile.Bind<int>("Enemy Options", "ForestKeeper Multiplier", 2, "Multiplier in Forest Keeper spawnrate after the RedWood Giant spawns.");
ConfigMultiplierDriftwood = configFile.Bind<int>("Enemy Options", "Driftwood Multiplier", 2, "Multiplier in Driftwood spawnrate after the RedWood Giant spawns");
ConfigRedWoodEnabled = configFile.Bind<bool>("Enemy Options", "RedWood Giant | Enabled", true, "Enables/Disables the spawning of the RedWood Giant (sets rarity to 0 if false on all moons)");
ConfigRedWoodRarity = configFile.Bind<string>("Enemy Options", "RedWood Giant | Spawn Weight.", "Modded@100,ExperimentationLevel@50,AssuranceLevel@100,VowLevel@200,OffenseLevel@100,MarchLevel@200,RendLevel@200,DineLevel@100,TitanLevel@200,InfernisLevel@100,PorcerinLevel@200,EternLevel@150,Asteroid13Level@200,GratarLevel@100,PolarusLevel@150,AtlanticaLevel@25,CosmocosLevel@200,JunicLevel@150,GloomLevel@200,DesolationLevel@150,OldredLevel@100,Auralis@250", "Spawn Weight of the RedWood Giant in all moons, Feel free to add to it any moon, just follow the format (also needs LLL installed for LE moons to work with this config).");
ConfigSpeedRedWood = configFile.Bind<float>("Enemy Options", "RedWood Giant Speed", 2f, "Default walking speed of the RedWood Giant, (Chase speed is 4*Walking Speed) I recommend 1.5 to 3.");
ConfigShipDistanceRedWood = configFile.Bind<float>("Enemy Options", "RedWood Giant Targetting Range | Ship", 10f, "Distance of the Forest Keeper to the ship that stops the RedWoodGiant from chasing them, I recommend 0 to 15f (values are completely untested).");
ConfigForestDistanceRedWood = configFile.Bind<float>("Enemy Options", "RedWood Giant Targetting Range | Forest Keeper", 50f, "Distance from which the RedWood Giant is able to see the Forest Keeper, I recommend 30f or more.");
ConfigColourHexcode = configFile.Bind<string>("Enemy Options", "RedWood Giant | Footstep Colour", "#808080", "Decides what the default colour of the footsteps is using a hexcode, default is grey (Invalid hexcodes will default to Grey), keep blank to use custom set colours set by me for different moons, don't forget to include the hashtag in config.");
ConfigWhistleScrapEnabled = configFile.Bind<bool>("Scrap Options", "Whistle Scrap | Enabled", true, "Enables/Disables the spawning of the scrap (sets rarity to 0 if false on all moons)");
ConfigWhistleRarity = configFile.Bind<string>("Scrap Options", "Whistle Scrap | Rarity", "Modded@5,ExperimentationLevel@5,AssuranceLevel@5,VowLevel@5,OffenseLevel@5,MarchLevel@5,RendLevel@5,DineLevel@5,TitanLevel@5", "Rarity of Whistle scrap appearing on every moon");
ConfigRedwoodPlushieEnabled = configFile.Bind<bool>("Scrap Options", "RedWood Giant Scrap | Enabled", true, "Enables/Disables the spawning of the scrap (sets rarity to 0 if false on all moons)");
ConfigRedwoodPlushieRarity = configFile.Bind<string>("Scrap Options", "RedWood Giant Scrap | Rarity", "Modded@5,ExperimentationLevel@5,AssuranceLevel@5,VowLevel@5,OffenseLevel@5,MarchLevel@5,RendLevel@5,DineLevel@5,TitanLevel@5", "Rarity of redwood plushie appearing on every moon");
ConfigWhistleEnabled = configFile.Bind<bool>("Shop Options", "Whistle Item | Enabled", true, "Enables/Disables the whistle showing up in shop");
ConfigWhistleCost = configFile.Bind<int>("Shop Options", "Whistle Item | Cost", 100, "Cost of Whistle");
ConfigDriftWoodEnabled = configFile.Bind<bool>("Enemy Options", "Driftwood | Enabled", true, "Enables/Disables the spawning of the driftwood (sets rarity to 0 if false on all moons)");
ConfigDriftWoodPlushieEnabled = configFile.Bind<bool>("Scrap Options", "Driftwood Scrap | Enabled", true, "Enables/Disables the spawning of the scrap (sets rarity to 0 if false on all moons)");
ConfigDriftWoodRarity = configFile.Bind<string>("Enemy Options", "Driftwood | Rarity", "Modded@100,ExperimentationLevel@75,AssuranceLevel@50,VowLevel@150,OffenseLevel@50,MarchLevel@175,RendLevel@125,DineLevel@125,TitanLevel@150", "Rarity of driftwood appearing on every moon");
ConfigDriftWoodPlushieRarity = configFile.Bind<string>("Scrap Options", "Driftwood Scrap | Rarity", "Modded@5,ExperimentationLevel5,AssuranceLevel5,VowLevel@5,OffenseLevel5,MarchLevel@5,RendLevel@5,DineLevel@5,TitanLevel@5", "Rarity of driftwood plushie appearing on every moon.");
ClearUnusedEntries(configFile);
Plugin.Logger.LogInfo((object)"Setting up config for Giant Specimen plugin...");
}
private void ClearUnusedEntries(ConfigFile configFile)
{
PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null);
dictionary.Clear();
configFile.Save();
}
}
}
namespace GiantSpecimens.Enemy
{
internal class DriftwoodGiantAI : EnemyAI
{
private enum State
{
SpawnAnimation,
IdleAnimation,
SearchingForPrey,
RunningToPrey,
SlashingPrey,
EatingPrey,
PlayingWithPrey,
Scream
}
public Collider grabArea;
[NonSerialized]
public IEnumerable allAlivePlayers;
[NonSerialized]
public string levelName;
[NonSerialized]
public bool eatingEnemy;
[NonSerialized]
public EnemyAI targetEnemy;
[NonSerialized]
public bool targettingEnemy;
[NonSerialized]
public PlayerControllerB targetPlayer_;
[NonSerialized]
public bool targettingPlayer;
[NonSerialized]
public float seeableDistance = 50f;
public AnimationClip spawnAnimation;
public AnimationClip screamAnimation;
public AnimationClip throwAnimation;
[NonSerialized]
public bool spawned;
[NonSerialized]
public bool screaming;
public AudioSource MouthVoice;
public AudioClip[] stompSounds;
public AudioClip eatenSound;
public AudioClip screamSound;
public AudioClip spawnSound;
[NonSerialized]
public bool currentlyGrabbed;
[NonSerialized]
public int previousStateIndex;
[NonSerialized]
public int nextStateIndex;
[NonSerialized]
public string nextAnimationName = "";
[NonSerialized]
public bool testBuild = true;
[NonSerialized]
private Random throwRandom;
[NonSerialized]
public float delayedResponse;
[NonSerialized]
public bool tooFarAway;
[NonSerialized]
public int numberOfFeedings;
[NonSerialized]
public LineRenderer line;
private void LogIfDebugBuild(string text)
{
}
public override void Start()
{
((EnemyAI)this).Start();
throwRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
levelName = ((Object)RoundManager.Instance.currentLevel).name;
LogIfDebugBuild(levelName);
SpawnableEnemyWithRarity val = RoundManager.Instance.currentLevel.OutsideEnemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("DriftWoodGiant"));
if (val != null)
{
LogIfDebugBuild(val.rarity.ToString());
}
LogIfDebugBuild("DriftWood Giant Enemy Spawned");
_ = testBuild;
base.creatureVoice.PlayOneShot(spawnSound);
((MonoBehaviour)this).StartCoroutine(SpawnAnimationCooldown());
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
public override void Update()
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
{
DriftwoodGiantSeePlayerEffect();
}
if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
{
base.isEnemyDead = true;
((EnemyAI)this).KillEnemyOnOwnerClient(false);
DoAnimationClientRpc("startDeath");
base.creatureVoice.PlayOneShot(base.dieSFX);
}
if ((Object)(object)targetPlayer_ == (Object)(object)GameNetworkManager.Instance.localPlayerController && currentlyGrabbed)
{
((Component)GameNetworkManager.Instance.localPlayerController).transform.position = ((Component)grabArea).transform.position;
((Component)GameNetworkManager.Instance.localPlayerController).transform.LookAt(((Component)this).transform.position);
}
}
public override void DoAIInterval()
{
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (testBuild)
{
((MonoBehaviour)this).StartCoroutine(DrawPath(line, base.agent));
}
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 0f;
break;
case 1:
base.agent.speed = 0f;
break;
case 2:
base.agent.speed = 5f;
if (FindClosestTargetEnemyInRange(30f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
previousStateIndex = base.currentBehaviourStateIndex;
nextStateIndex = 3;
nextAnimationName = "startChase";
DoAnimationClientRpc("startScream");
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
targettingEnemy = true;
}
else if (FindClosestPlayerInRange(30f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
previousStateIndex = base.currentBehaviourStateIndex;
nextStateIndex = 3;
nextAnimationName = "startChase";
DoAnimationClientRpc("startScream");
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
targettingPlayer = true;
}
break;
case 3:
base.agent.speed = 20f;
if (targettingEnemy)
{
if ((Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) > seeableDistance && !DWHasLineOfSightToPosition(((Component)targetEnemy).transform.position)) || (Object)(object)targetEnemy == (Object)null)
{
LogIfDebugBuild("Stop chasing target enemy");
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
targettingEnemy = false;
targetEnemy = null;
previousStateIndex = base.currentBehaviourStateIndex;
nextStateIndex = 2;
nextAnimationName = "startWalk";
DoAnimationClientRpc("startScream");
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)targetEnemy).transform.position, true);
}
}
else if (targettingPlayer)
{
if ((Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer_).transform.position) > seeableDistance && !DWHasLineOfSightToPosition(((Component)targetPlayer_).transform.position)) || (Object)(object)targetPlayer_ == (Object)null)
{
LogIfDebugBuild("Stop chasing target player");
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
targettingPlayer = false;
targetPlayer_ = null;
previousStateIndex = base.currentBehaviourStateIndex;
nextStateIndex = 2;
nextAnimationName = "startWalk";
DoAnimationClientRpc("startScream");
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)targetPlayer_).transform.position, true);
}
}
else
{
LogIfDebugBuild("If you see this, something went wrong.");
LogIfDebugBuild("Resettings state to Scream Animation");
previousStateIndex = base.currentBehaviourStateIndex;
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
}
break;
case 4:
base.agent.speed = 0f;
if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) >= 2f && (Object)(object)targetEnemy != (Object)null)
{
tooFarAway = true;
delayedResponse += Time.deltaTime;
if (delayedResponse >= 3f)
{
delayedResponse = 0f;
previousStateIndex = base.currentBehaviourStateIndex;
DoAnimationClientRpc("startChase");
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
}
}
break;
case 5:
base.agent.speed = 0f;
break;
case 7:
base.agent.speed = 0f;
break;
case 6:
base.agent.speed = 0f;
break;
default:
LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
{
if (((Behaviour)agent).enabled)
{
yield return (object)new WaitForEndOfFrame();
line.SetPosition(0, ((Component)agent).transform.position);
line.positionCount = agent.path.corners.Length;
for (int i = 1; i < agent.path.corners.Length; i++)
{
line.SetPosition(i, agent.path.corners[i]);
}
}
}
public void ParticlesFromEatingPrey()
{
}
public void ShakePlayerCameraOnDistance()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
if (!(num < 19f))
{
if (num < 25f)
{
if (num >= 20f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
else if (num < 35f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
else
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
private bool FindClosestTargetEnemyInRange(float range)
{
//IL_006d: 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)
EnemyAI val = null;
float num = float.MaxValue;
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (spawnedEnemy.enemyType.enemyName == "MouthDog" || spawnedEnemy.enemyType.enemyName == "Baboon hawk" || spawnedEnemy.enemyType.enemyName == "Masked")
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position);
if (num2 < range && num2 < num)
{
num = num2;
val = spawnedEnemy;
}
}
}
if ((Object)(object)val != (Object)null)
{
targetEnemy = val;
targettingEnemy = true;
return true;
}
return false;
}
private bool FindClosestPlayerInRange(float range)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = null;
float num = float.MaxValue;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val2 in allPlayerScripts)
{
if (((NetworkBehaviour)val2).IsSpawned && val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom)
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
if (num2 < range && num2 < num)
{
num = num2;
val = val2;
}
}
}
if ((Object)(object)val != (Object)null)
{
targetPlayer_ = val;
targettingPlayer = true;
return true;
}
return false;
}
public void DriftwoodScream()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (((NetworkBehaviour)localPlayerController).IsSpawned && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead)
{
float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position);
if (num <= 20f && !localPlayerController.isInHangarShipRoom)
{
localPlayerController.DamagePlayer(5, true, true, Plugin.RupturedEardrums, 0, false, default(Vector3));
}
}
}
public void PlayRunFootsteps()
{
base.creatureVoice.PlayOneShot(stompSounds[Random.Range(0, stompSounds.Length)]);
}
public void PlayWalkFootsteps()
{
base.creatureVoice.PlayOneShot(stompSounds[Random.Range(0, stompSounds.Length)]);
}
public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy)
{
if ((Object)(object)collidedEnemy == (Object)(object)targetEnemy && (Object)(object)targetEnemy != (Object)null && base.currentBehaviourStateIndex == 3 && tooFarAway)
{
tooFarAway = false;
delayedResponse = 0f;
((EnemyAI)this).SwitchToBehaviourClientRpc(4);
DoAnimationClientRpc("startSlash");
}
}
public void SlashEnemy()
{
if (targettingEnemy)
{
if (!tooFarAway)
{
targetEnemy.HitEnemy(1, (PlayerControllerB)null, true);
if (targetEnemy.enemyHP <= 0)
{
nextStateIndex = 5;
nextAnimationName = "startEating";
targettingEnemy = false;
targetEnemy = null;
}
}
}
else
{
LogIfDebugBuild("This shouldn't be happening, please report this.");
}
}
public void ApproachCorpse()
{
((EnemyAI)this).SwitchToBehaviourClientRpc(nextStateIndex);
DoAnimationClientRpc(nextAnimationName);
}
public void DiggingIntoEnemyBody()
{
if (numberOfFeedings <= 4)
{
numberOfFeedings++;
return;
}
numberOfFeedings = 0;
previousStateIndex = base.currentBehaviourStateIndex;
DoAnimationClientRpc("startWalk");
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
}
public override void OnCollideWithPlayer(Collider other)
{
if ((Object)(object)((Component)other).GetComponent<PlayerControllerB>() == (Object)(object)targetPlayer_ && !currentlyGrabbed)
{
DoAnimationClientRpc("startThrow");
((EnemyAI)this).SwitchToBehaviourClientRpc(6);
}
}
public void GrabPlayer()
{
currentlyGrabbed = true;
}
public void ThrowingPlayer()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)targetPlayer_ == (Object)null)
{
LogIfDebugBuild("No player to throw, This is a bug, please report this");
return;
}
currentlyGrabbed = false;
Vector3 val = ((Component)this).transform.TransformDirection(Vector3.back);
Vector3 normalized = ((Vector3)(ref val)).normalized;
val = ((Component)this).transform.TransformDirection(Vector3.up);
Vector3 normalized2 = ((Vector3)(ref val)).normalized;
val = normalized + Quaternion.AngleAxis(45f, ((Component)this).transform.right) * normalized2;
Vector3 normalized3 = ((Vector3)(ref val)).normalized;
float num = 100f;
LogIfDebugBuild("Launching Player");
GiantPatches.thrownByGiant = true;
Rigidbody component = ((Component)targetPlayer_).GetComponent<Rigidbody>();
((Component)targetPlayer_).GetComponent<Rigidbody>().isKinematic = false;
component.velocity = Vector3.zero;
component.AddTorque(Vector3.Cross(normalized3, ((Component)this).transform.up) * num, (ForceMode)1);
component.AddForce(normalized3 * num, (ForceMode)1);
}
public void DriftwoodGiantSeePlayerEffect()
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
if (GameNetworkManager.Instance.localPlayerController.isPlayerDead || (GameNetworkManager.Instance.localPlayerController.isInsideFactory && (Object)(object)targetPlayer_ != (Object)null && !targettingPlayer))
{
return;
}
if (base.currentBehaviourStateIndex == 3 && (Object)(object)targetPlayer_ == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(1.4f, 1f);
}
else if (!GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, 45f, 70, -1f, (Transform)null))
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 15f)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.7f, true);
}
else
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.4f, true);
}
}
}
private IEnumerator ThrowPlayer()
{
yield return (object)new WaitForSeconds(throwAnimation.length);
ThrowingPlayer();
try
{
LogIfDebugBuild("Setting to null");
((Component)targetPlayer_).GetComponent<Rigidbody>().isKinematic = true;
}
catch
{
LogIfDebugBuild("Trying to change kinematics of an unknown player.");
}
targettingPlayer = false;
targetPlayer_ = null;
previousStateIndex = base.currentBehaviourStateIndex;
nextStateIndex = 2;
nextAnimationName = "startWalk";
DoAnimationClientRpc("startScream");
((EnemyAI)this).SwitchToBehaviourClientRpc(7);
((MonoBehaviour)this).StopCoroutine(ThrowPlayer());
}
private IEnumerator ScreamPause()
{
base.creatureVoice.PlayOneShot(screamSound);
yield return (object)new WaitForSeconds(screamAnimation.length);
DoAnimationClientRpc(nextAnimationName);
if (previousStateIndex == 6)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
((EnemyAI)this).SwitchToBehaviourClientRpc(nextStateIndex);
((MonoBehaviour)this).StopCoroutine(ScreamPause());
}
public bool DWHasLineOfSightToPosition(Vector3 pos, float width = 45f, int range = 60, float proximityAwareness = -1f)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0081: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.eye == (Object)null)
{
_ = ((Component)this).transform;
}
else
{
_ = base.eye;
}
if (Vector3.Distance(base.eye.position, pos) < (float)range && !Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
Vector3 val = pos - base.eye.position;
if (Vector3.Angle(base.eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness)
{
return true;
}
}
return false;
}
private IEnumerator SpawnAnimationCooldown()
{
yield return (object)new WaitForSeconds(spawnAnimation.length);
previousStateIndex = base.currentBehaviourStateIndex;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
DoAnimationClientRpc("startWalk");
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
((MonoBehaviour)this).StopCoroutine(SpawnAnimationCooldown());
}
[ClientRpc]
public void DoAnimationClientRpc(string animationName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(227334965u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 227334965u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_DriftwoodGiantAI()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(227334965u, new RpcReceiveHandler(__rpc_handler_227334965));
}
private static void __rpc_handler_227334965(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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string animationName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((DriftwoodGiantAI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "DriftwoodGiantAI";
}
}
internal class PinkGiantAI : EnemyAI
{
private enum State
{
SpawnAnimation,
IdleAnimation,
SearchingForForestKeeper,
RunningToForestKeeper,
EatingForestKeeper
}
[NonSerialized]
public static LevelColorMapper levelColorMapper = new LevelColorMapper();
public Collider AttackArea;
public ParticleSystem DustParticlesLeft;
public ParticleSystem DustParticlesRight;
public ParticleSystem ForestKeeperParticles;
public Collider CollisionFootR;
public Collider CollisionFootL;
public ChainIKConstraint LeftFoot;
public ChainIKConstraint RightFoot;
public AudioSource FootSource;
public AudioSource EnemyMouthSource;
[NonSerialized]
public bool sizeUp;
[NonSerialized]
public Vector3 newScale;
[NonSerialized]
public string levelName;
[NonSerialized]
public bool waitAfterChase;
[NonSerialized]
public bool eatingEnemy;
[NonSerialized]
public string footstepColour;
[NonSerialized]
public EnemyAI targetEnemy;
[NonSerialized]
public bool idleGiant = true;
[NonSerialized]
public float walkingSpeed;
[NonSerialized]
public float seeableDistance;
[NonSerialized]
public float distanceFromShip;
[NonSerialized]
public float distanceFromEnemy;
[NonSerialized]
public Transform shipBoundaries;
public AnimationClip idle;
public AnimationClip walking;
public AnimationClip eating;
public AnimationClip roaring;
public AudioClip[] stompSounds;
public AudioClip eatenSound;
public AudioClip spawnSound;
public AudioClip roarSound;
public GameObject rightBone;
public GameObject leftBone;
public GameObject eatingArea;
[NonSerialized]
public Vector3 midpoint;
[NonSerialized]
public bool testBuild;
[NonSerialized]
public LineRenderer line;
private void LogIfDebugBuild(string text)
{
}
public override void Start()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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)
((EnemyAI)this).Start();
levelName = ((Object)RoundManager.Instance.currentLevel).name;
LogIfDebugBuild(levelName);
shipBoundaries = ((Component)StartOfRound.Instance.shipBounds).transform;
Transform obj = shipBoundaries;
obj.localScale *= 1.5f;
Color val = Color.grey;
string value = Plugin.ModConfig.ConfigColourHexcode.Value;
if (string.IsNullOrEmpty(value))
{
footstepColour = null;
}
else if (Regex.IsMatch(value, "^#?[0-9a-fA-F]{6}$"))
{
footstepColour = value;
}
else
{
Plugin.Logger.LogWarning((object)("Invalid hexcode: " + value + ". Using default colour."));
footstepColour = null;
}
List<string> colorsForLevel = levelColorMapper.GetColorsForLevel(levelName);
if (footstepColour == null && colorsForLevel.Count > 0)
{
footstepColour = colorsForLevel[0];
}
if (footstepColour != null)
{
val = HexToColor(footstepColour);
}
MainModule main = DustParticlesLeft.main;
MainModule main2 = DustParticlesRight.main;
((MainModule)(ref main)).startColor = new MinMaxGradient(val);
((MainModule)(ref main2)).startColor = new MinMaxGradient(val);
LogIfDebugBuild(((object)(Color)(ref val)).ToString());
SpawnableEnemyWithRarity val2 = RoundManager.Instance.currentLevel.OutsideEnemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("ForestGiant"));
if (val2 != null && Plugin.ModConfig.ConfigMultiplierForestkeeper.Value >= 0)
{
val2.rarity *= Plugin.ModConfig.ConfigMultiplierForestkeeper.Value;
}
SpawnableEnemyWithRarity val3 = RoundManager.Instance.currentLevel.OutsideEnemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("DriftWoodGiant"));
if (val3 != null && Plugin.ModConfig.ConfigMultiplierDriftwood.Value >= 0)
{
val3.rarity *= Plugin.ModConfig.ConfigMultiplierDriftwood.Value;
}
SpawnableEnemyWithRarity val4 = RoundManager.Instance.currentLevel.OutsideEnemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("RedWoodGiant"));
if (val4 != null)
{
LogIfDebugBuild(val4.rarity.ToString());
}
walkingSpeed = Plugin.ModConfig.ConfigSpeedRedWood.Value;
distanceFromShip = Plugin.ModConfig.ConfigShipDistanceRedWood.Value;
seeableDistance = Plugin.ModConfig.ConfigForestDistanceRedWood.Value;
LogIfDebugBuild("Pink Giant Enemy Spawned");
_ = testBuild;
FootSource.PlayOneShot(spawnSound);
EnemyMouthSource.PlayOneShot(roarSound);
((MonoBehaviour)this).StartCoroutine(ScalingUp());
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
public override void Update()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: 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_00e2: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.currentBehaviourStateIndex == 4 && (Object)(object)targetEnemy != (Object)null)
{
midpoint = leftBone.transform.position;
((Component)targetEnemy).transform.position = midpoint + new Vector3(0f, -1f, 0f);
((Component)targetEnemy).transform.LookAt(eatingArea.transform.position);
((Component)targetEnemy).transform.position = midpoint + new Vector3(0f, -5.5f, 0f);
if (!sizeUp)
{
((Component)targetEnemy).transform.position = midpoint + new Vector3(0f, -1f, 0f);
((Component)targetEnemy).transform.LookAt(eatingArea.transform.position);
((Component)targetEnemy).transform.position = midpoint + new Vector3(0f, -6f, 0f);
newScale = ((Component)targetEnemy).transform.localScale;
newScale.x *= 1.4f;
newScale.y *= 1.3f;
newScale.z *= 1.4f;
((Component)targetEnemy).transform.localScale = newScale;
sizeUp = true;
}
Transform transform = ((Component)targetEnemy).transform;
transform.position += new Vector3(0f, 0.02f, 0f);
newScale = ((Component)targetEnemy).transform.localScale;
newScale.x *= 0.9995f;
newScale.y *= 0.9995f;
newScale.z *= 0.9995f;
((Component)targetEnemy).transform.localScale = newScale;
}
}
public void SearchOrChaseTarget()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
DoAnimationClientRpc("startWalk");
LogIfDebugBuild("Start Walking Around");
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
}
public override void DoAIInterval()
{
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (testBuild)
{
((MonoBehaviour)this).StartCoroutine(DrawPath(line, base.agent));
}
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 0f;
break;
case 1:
base.agent.speed = 0f;
break;
case 2:
{
base.agent.speed = walkingSpeed;
if (FindClosestForestKeeperInRange(seeableDistance))
{
DoAnimationClientRpc("startChase");
((MonoBehaviour)this).StartCoroutine(ChaseCoolDown());
LogIfDebugBuild("Start Target ForestKeeper");
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
}
var anon = (from x in StartOfRound.Instance.allPlayerScripts
where ((NetworkBehaviour)x).IsSpawned && x.isPlayerControlled && !x.isPlayerDead
select x into player
select new
{
Player = player,
Distance = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position)
} into x
orderby x.Distance
select x).FirstOrDefault(x => RWHasLineOfSightToPosition(((Component)x.Player).transform.position));
if (anon != null)
{
ChainIKConstraint closestCollisionFoot = GetClosestCollisionFoot(((Component)this).transform.position);
if ((Object)(object)closestCollisionFoot != (Object)null && (Object)(object)((ChainIKConstraintData)(ref ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)closestCollisionFoot).data)).target == (Object)null)
{
((ChainIKConstraintData)(ref ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)closestCollisionFoot).data)).target = ((Component)anon.Player).transform;
}
}
else
{
ChainIKConstraint closestCollisionFoot2 = GetClosestCollisionFoot(((Component)this).transform.position);
if ((Object)(object)closestCollisionFoot2 != (Object)null)
{
((ChainIKConstraintData)(ref ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)closestCollisionFoot2).data)).target = null;
}
}
break;
}
case 3:
base.agent.speed = walkingSpeed * 4f;
if ((Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) > seeableDistance && !RWHasLineOfSightToPosition(((Component)targetEnemy).transform.position)) || (Object)(object)targetEnemy == (Object)null || Vector3.Distance(((Component)targetEnemy).transform.position, shipBoundaries.position) <= distanceFromShip)
{
LogIfDebugBuild("Stop Target ForestKeeper");
DoAnimationClientRpc("startWalk");
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)targetEnemy).transform.position, true);
}
break;
case 4:
base.agent.speed = 0f;
break;
default:
LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
public ChainIKConstraint GetClosestCollisionFoot(Vector3 position)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_0039: 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)
if (Vector3.Distance(position, ((Component)this).transform.position) <= 30f)
{
if (Vector3.Distance(((Component)CollisionFootL).transform.position, position) < Vector3.Distance(((Component)CollisionFootR).transform.position, position))
{
return LeftFoot;
}
return RightFoot;
}
return null;
}
public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
{
if (((Behaviour)agent).enabled)
{
yield return (object)new WaitForEndOfFrame();
line.SetPosition(0, ((Component)agent).transform.position);
line.positionCount = agent.path.corners.Length;
for (int i = 1; i < agent.path.corners.Length; i++)
{
line.SetPosition(i, agent.path.corners[i]);
}
}
}
public void DealEnemyDamageFromShockwave(EnemyAI enemy, string foot)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (foot == "LeftFoot")
{
distanceFromEnemy = Vector3.Distance(((Component)CollisionFootL).transform.position, ((Component)enemy).transform.position);
}
else if (foot == "RightFoot")
{
distanceFromEnemy = Vector3.Distance(((Component)CollisionFootR).transform.position, ((Component)enemy).transform.position);
}
if (distanceFromEnemy <= 3f)
{
enemy.HitEnemy(2, (PlayerControllerB)null, false);
}
else if (distanceFromEnemy <= 10f)
{
enemy.HitEnemy(1, (PlayerControllerB)null, false);
}
LogIfDebugBuild($"Distance: {distanceFromEnemy} HP: {enemy.enemyHP}");
}
public void LeftFootStepInteractions()
{
//IL_0059: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
DustParticlesLeft.Play();
FootSource.PlayOneShot(stompSounds[Random.Range(0, stompSounds.Length)]);
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (((NetworkBehaviour)localPlayerController).IsSpawned && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead)
{
float num = Vector3.Distance(((Component)CollisionFootL).transform.position, ((Component)localPlayerController).transform.position);
if (num <= 10f && !localPlayerController.isInHangarShipRoom)
{
localPlayerController.DamagePlayer(15, true, true, Plugin.InternalBleed, 0, false, default(Vector3));
}
}
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (spawnedEnemy.enemyType.canDie && spawnedEnemy.enemyHP > 1 && !spawnedEnemy.isEnemyDead && spawnedEnemy.enemyType.enemyName != "ForestGiant")
{
DealEnemyDamageFromShockwave(spawnedEnemy, "LeftFoot");
}
}
}
public void RightFootStepInteractions()
{
//IL_0059: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
DustParticlesRight.Play();
FootSource.PlayOneShot(stompSounds[Random.Range(0, stompSounds.Length)]);
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (((NetworkBehaviour)localPlayerController).IsSpawned && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead)
{
float num = Vector3.Distance(((Component)CollisionFootR).transform.position, ((Component)localPlayerController).transform.position);
if (num <= 10f && !localPlayerController.isInHangarShipRoom)
{
localPlayerController.DamagePlayer(15, true, true, Plugin.InternalBleed, 0, false, default(Vector3));
}
}
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (spawnedEnemy.enemyType.canDie && spawnedEnemy.enemyHP > 1 && !spawnedEnemy.isEnemyDead && spawnedEnemy.enemyType.enemyName != "ForestGiant")
{
DealEnemyDamageFromShockwave(spawnedEnemy, "RightFoot");
}
}
}
private Color HexToColor(string hexCode)
{
//IL_000c: 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)
Color result = default(Color);
if (ColorUtility.TryParseHtmlString(hexCode, ref result))
{
return result;
}
return Color.white;
}
public void ParticlesFromEatingForestKeeper()
{
ForestKeeperParticles.Play();
}
public void ShakePlayerCamera()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
if (!(num < 10f))
{
if (!(num < 20f))
{
if (num < 50f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
else
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
else
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
private bool FindClosestForestKeeperInRange(float range)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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)
EnemyAI val = null;
float num = float.MaxValue;
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (spawnedEnemy.enemyType.enemyName == "ForestGiant")
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position);
if (num2 < range && num2 < num && Vector3.Distance(((Component)spawnedEnemy).transform.position, shipBoundaries.position) > distanceFromShip)
{
num = num2;
val = spawnedEnemy;
}
}
}
if ((Object)(object)val != (Object)null)
{
targetEnemy = val;
return true;
}
return false;
}
private IEnumerator ChaseCoolDown()
{
yield return (object)new WaitForSeconds(3.5f);
waitAfterChase = true;
((MonoBehaviour)this).StopCoroutine(ChaseCoolDown());
}
private IEnumerator ScalingUp()
{
newScale = ((Component)this).transform.localScale;
newScale.x *= 0.1f;
newScale.y *= 0.1f;
newScale.z *= 0.1f;
((Component)this).transform.localScale = newScale;
float elapsedTime = 0f;
float startScale = 0.01f;
float endScale = 1f;
while (elapsedTime < 10f)
{
yield return null;
elapsedTime += Time.deltaTime;
float num = Mathf.Clamp01(elapsedTime / 10f);
float num2 = Mathf.Lerp(startScale, endScale, num);
((Component)this).transform.localScale = new Vector3(num2, num2, num2);
}
((MonoBehaviour)this).StopCoroutine(ScalingUp());
}
private IEnumerator PauseDuringIdle()
{
yield return (object)new WaitForSeconds(idle.length);
((MonoBehaviour)this).StopCoroutine(PauseDuringIdle());
}
private IEnumerator EatForestKeeper()
{
targetEnemy.currentBehaviourStateIndex = 0;
targetEnemy.CancelSpecialAnimationWithPlayer();
((MonoBehaviour)targetEnemy).StopAllCoroutines();
targetEnemy.SetEnemyStunned(true, 10f, (PlayerControllerB)null);
targetEnemy.creatureVoice.Stop();
targetEnemy.creatureSFX.Stop();
EnemyMouthSource.PlayOneShot(eatenSound, 1f);
((EnemyAI)this).SwitchToBehaviourClientRpc(4);
DoAnimationClientRpc("eatForestKeeper");
yield return (object)new WaitForSeconds(eating.length);
((MonoBehaviour)this).StartCoroutine(PauseDuringIdle());
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
((MonoBehaviour)this).StopCoroutine(EatForestKeeper());
}
public void EatingTargetGiant()
{
targetEnemy.KillEnemyOnOwnerClient(true);
eatingEnemy = false;
sizeUp = false;
waitAfterChase = false;
}
public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy)
{
if ((Object)(object)collidedEnemy == (Object)(object)targetEnemy && !eatingEnemy && base.currentBehaviourStateIndex == 3 && waitAfterChase)
{
eatingEnemy = true;
((Collider)((Component)targetEnemy).GetComponent<BoxCollider>()).enabled = false;
((Collider)((Component)((Component)targetEnemy).transform.Find("FGiantModelContainer").Find("AnimContainer").Find("metarig")
.Find("spine")
.Find("spine.003")
.Find("shoulder.R")
.Find("upper_arm.R")
.Find("forearm.R")
.Find("hand.R")).GetComponent<BoxCollider>()).enabled = false;
((Collider)((Component)((Component)targetEnemy).transform.Find("FGiantModelContainer")).GetComponent<CapsuleCollider>()).enabled = false;
((Behaviour)targetEnemy.agent).enabled = false;
((MonoBehaviour)this).StartCoroutine(EatForestKeeper());
}
}
public bool RWHasLineOfSightToPosition(Vector3 pos, float width = 45f, int range = 60, float proximityAwareness = -1f)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0081: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.eye == (Object)null)
{
_ = ((Component)this).transform;
}
else
{
_ = base.eye;
}
if (Vector3.Distance(base.eye.position, pos) < (float)range && !Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
Vector3 val = pos - base.eye.position;
if (Vector3.Angle(base.eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness)
{
return true;
}
}
return false;
}
[ClientRpc]
public void DoAnimationClientRpc(string animationName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(875076641u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 875076641u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_PinkGiantAI()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(875076641u, new RpcReceiveHandler(__rpc_handler_875076641));
}
private static void __rpc_handler_875076641(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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string animationName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((PinkGiantAI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "PinkGiantAI";
}
}
}
namespace GiantSpecimens.Colours
{
public enum LevelTag
{
Desolate,
Wasteland,
Forest,
Snow,
Ice,
Tundra,
Mesa,
Jungle,
Desert,
Arctic,
Savannah,
Swamp,
Volcanic,
Urban,
Ruins,
Underwater,
Cave,
Mountain,
Plains,
Sky,
Space,
Lava,
Magical,
Cybernetic,
Industrial,
Coastal,
Rainforest,
Dark,
Arid
}
public class LevelColorMapper
{
private readonly Dictionary<string, List<LevelTag>> LevelNamesAndTheirTags = new Dictionary<string, List<LevelTag>>
{
{
"ExperimentationLevel",
new List<LevelTag>
{
LevelTag.Mesa,
LevelTag.Desolate
}
},
{
"AssuranceLevel",
new List<LevelTag> { LevelTag.Desert }
},
{
"VowLevel",
new List<LevelTag>
{
LevelTag.Forest,
LevelTag.Jungle
}
},
{
"OffenseLevel",
new List<LevelTag>
{
LevelTag.Volcanic,
LevelTag.Desolate
}
},
{
"MarchLevel",
new List<LevelTag>
{
LevelTag.Plains,
LevelTag.Savannah
}
},
{
"RendLevel",
new List<LevelTag>
{
LevelTag.Ruins,
LevelTag.Urban
}
},
{
"DineLevel",
new List<LevelTag>
{
LevelTag.Ice,
LevelTag.Mountain
}
},
{
"TitanLevel",
new List<LevelTag>
{
LevelTag.Snow,
LevelTag.Ruins
}
},
{
"InfernisLevel",
new List<LevelTag>
{
LevelTag.Lava,
LevelTag.Volcanic
}
},
{
"PorcerinLevel",
new List<LevelTag>
{
LevelTag.Swamp,
LevelTag.Rainforest
}
},
{
"EternLevel",
new List<LevelTag>
{
LevelTag.Arid,
LevelTag.Forest
}
},
{
"Asteroid13Level",
new List<LevelTag>
{
LevelTag.Dark,
LevelTag.Desolate
}
},
{
"GratarLevel",
new List<LevelTag>
{
LevelTag.Desert,
LevelTag.Arid
}
},
{
"PolarusLevel",
new List<LevelTag>
{
LevelTag.Snow,
LevelTag.Ice,
LevelTag.Arctic
}
},
{
"AtlanticaLevel",
new List<LevelTag>
{
LevelTag.Underwater,
LevelTag.Coastal
}
},
{
"CosmocosLevel",
new List<LevelTag>
{
LevelTag.Space,
LevelTag.Cybernetic
}
},
{
"JunicLevel",
new List<LevelTag>
{
LevelTag.Plains,
LevelTag.Savannah
}
},
{
"GloomLevel",
new List<LevelTag>
{
LevelTag.Swamp,
LevelTag.Dark
}
},
{
"DesolationLevel",
new List<LevelTag>
{
LevelTag.Desolate,
LevelTag.Wasteland
}
},
{
"OldredLevel",
new List<LevelTag>
{
LevelTag.Ruins,
LevelTag.Desolate
}
},
{
"46 Infernis",
new List<LevelTag>
{
LevelTag.Lava,
LevelTag.Volcanic
}
},
{
"76 Porcerin",
new List<LevelTag>
{
LevelTag.Swamp,
LevelTag.Rainforest
}
},
{
"154 Etern",
new List<LevelTag>
{
LevelTag.Arid,
LevelTag.Desert
}
},
{
"57 Asteroid13",
new List<LevelTag>
{
LevelTag.Dark,
LevelTag.Desolate
}
},
{
"147 Gratar",
new List<LevelTag>
{
LevelTag.Desert,
LevelTag.Arid
}
},
{
"94 Polarus",
new List<LevelTag>
{
LevelTag.Snow,
LevelTag.Ice,
LevelTag.Arctic
}
},
{
"44 Atlantica",
new List<LevelTag>
{
LevelTag.Underwater,
LevelTag.Coastal
}
},
{
"42 Cosmocos",
new List<LevelTag>
{
LevelTag.Space,
LevelTag.Cybernetic
}
},
{
"84 Junic",
new List<LevelTag>
{
LevelTag.Plains,
LevelTag.Savannah
}
},
{
"36 Gloom",
new List<LevelTag>
{
LevelTag.Swamp,
LevelTag.Dark
}
},
{
"48 Desolation",
new List<LevelTag>
{
LevelTag.Desolate,
LevelTag.Wasteland
}
},
{
"134 Oldred",
new List<LevelTag>
{
LevelTag.Ruins,
LevelTag.Desolate
}
},
{
"AuralisLevel",
new List<LevelTag>
{
LevelTag.Ice,
LevelTag.Cybernetic
}
}
};
private readonly Dictionary<LevelTag, string> TagToColor = new Dictionary<LevelTag, string>
{
{
LevelTag.Desolate,
"#FF0000"
},
{
LevelTag.Wasteland,
"#808080"
},
{
LevelTag.Forest,
"#228B22"
},
{
LevelTag.Snow,
"#FFFAFA"
},
{
LevelTag.Ice,
"#ADD8E6"
},
{
LevelTag.Tundra,
"#C0D6E4"
},
{
LevelTag.Mesa,
"#CC7722"
},
{
LevelTag.Jungle,
"#00A550"
},
{
LevelTag.Desert,
"#EDC9Af"
},
{
LevelTag.Arctic,
"#BED8D4"
},
{
LevelTag.Savannah,
"#E9DDC7"
},
{
LevelTag.Swamp,
"#697D89"
},
{
LevelTag.Volcanic,
"#FF4500"
},
{
LevelTag.Urban,
"#787878"
},
{
LevelTag.Ruins,
"#A9A9A9"
},
{
LevelTag.Underwater,
"#1E90FF"
},
{
LevelTag.Cave,
"#4B0082"
},
{
LevelTag.Mountain,
"#8B4513"
},
{
LevelTag.Plains,
"#7CFC00"
},
{
LevelTag.Sky,
"#87CEEB"
},
{
LevelTag.Space,
"#000080"
},
{
LevelTag.Lava,
"#CF1020"
},
{
LevelTag.Magical,
"#DA70D6"
},
{
LevelTag.Cybernetic,
"#00FFFF"
},
{
LevelTag.Industrial,
"#708090"
},
{
LevelTag.Coastal,
"#2E8B57"
},
{
LevelTag.Rainforest,
"#006400"
},
{
LevelTag.Arid,
"#EDEAC2"
},
{
LevelTag.Dark,
"#0A0F0D"
}
};
public List<string> GetColorsForLevel(string levelName)
{
if (!LevelNamesAndTheirTags.ContainsKey(levelName))
{
Plugin.Logger.LogInfo((object)("Level name not found." + levelName));
return new List<string>();
}
List<string> list = new List<string>();
foreach (LevelTag item in LevelNamesAndTheirTags[levelName])
{
if (TagToColor.TryGetValue(item, out var value))
{
list.Add(value);
}
}
return list;
}
}
}
namespace GiantSpecimens.Collisions
{
public class ColliderIdentifier : MonoBehaviour
{
[SerializeField]
public AudioSource CreatureSFX;
[SerializeField]
public AudioClip squishSound;
[SerializeField]
public ParticleSystem BloodSplatterLeft;
[SerializeField]
public ParticleSystem BloodSplatterRight;
private void LogIfDebugBuild(string text)
{
}
private void OnTriggerEnter(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && !component.isPlayerDead)
{
DetectCollider(((Component)this).gameObject, component);
}
}
}
private void OnCollisionEnter(Collision collision)
{
if (((Component)collision.collider).CompareTag("Player"))
{
PlayerControllerB component = ((Component)collision.collider).GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null)
{
DetectCollider(collision.gameObject, component);
}
}
}
private void DetectCollider(GameObject collidedObject, PlayerControllerB playerControllerB)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if (((Object)collidedObject).name == "AttackArea")
{
LogIfDebugBuild("Collided with AttackArea");
}
else if ((((Object)collidedObject).name == "CollisionFootL" || ((Object)collidedObject).name == "CollisionFootR") && !playerControllerB.isInHangarShipRoom)
{
playerControllerB.DamagePlayer(200, true, true, Plugin.Thwomped, 0, false, default(Vector3));
CreatureSFX.PlayOneShot(squishSound);
if (((Object)collidedObject).name == "CollisionFootL")
{
BloodSplatterLeft.Play();
}
else
{
BloodSplatterRight.Play();
}
}
else
{
LogIfDebugBuild("Collided with unknown object: " + ((Object)collidedObject).name);
}
}
}
}
namespace GiantSpecimens.Dependency
{
public static class LobbyCompatibilityChecker
{
public static bool Enabled => Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility");
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Init()
{
PluginHelper.RegisterPlugin("GiantSpecimens", Version.Parse("1.8.0"), (CompatibilityLevel)2, (VersionStrictness)3);
}
}
}
namespace GiantSpecimens.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}