using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
[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("OtakuCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Basic ass version of weebshit")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OtakuCompany")]
[assembly: AssemblyTitle("OtakuCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace OtakuCompany
{
[BepInPlugin("OtakuCompany", "OtakuCompany", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static AssetBundle MainAssets;
private void Awake()
{
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);
}
}
}
MainAssets = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("OtakuCompany.dll", "otakucompany"));
Item val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/Figurine/Figurine.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 70, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Figurine is loaded!");
val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/BodyPillow/BodyPillow.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 70, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Body Pillow is loaded!");
val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/Katana/Katana.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 40, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Katana is loaded!");
val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/Onigiri/Onigiri.asset");
FoodItem foodItem = val.spawnPrefab.AddComponent<FoodItem>();
foodItem.foodAudio = ((Component)foodItem).gameObject.GetComponent<AudioSource>();
foodItem.eatFoodAudio = MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Items/Onigiri/Munch1.ogg");
foodItem.eatParticle = ((Component)foodItem).gameObject.GetComponent<ParticleSystem>();
((GrabbableObject)foodItem).grabbable = true;
((GrabbableObject)foodItem).itemProperties = val;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 80, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Onigiri is loaded!");
val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/Dango/Dango.asset");
foodItem = val.spawnPrefab.AddComponent<FoodItem>();
foodItem.foodAudio = ((Component)foodItem).gameObject.GetComponent<AudioSource>();
foodItem.eatFoodAudio = MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Items/Dango/Munch1.ogg");
foodItem.eatParticle = ((Component)foodItem).gameObject.GetComponent<ParticleSystem>();
((GrabbableObject)foodItem).grabbable = true;
((GrabbableObject)foodItem).itemProperties = val;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 80, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Dango is loaded!");
val = MainAssets.LoadAsset<Item>("Assets/Scripts/Items/Ramen/Ramen.asset");
foodItem = val.spawnPrefab.AddComponent<FoodItem>();
foodItem.foodAudio = ((Component)foodItem).gameObject.GetComponent<AudioSource>();
foodItem.eatFoodAudio = MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Items/Dango/Munch1.ogg");
foodItem.eatParticle = ((Component)foodItem).gameObject.GetComponent<ParticleSystem>();
((GrabbableObject)foodItem).grabbable = true;
((GrabbableObject)foodItem).itemProperties = val;
foodItem.heal = 50;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, 40, (LevelTypes)510);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Ramen is loaded!");
EnemyType val2 = MainAssets.LoadAsset<EnemyType>("Assets/Scripts/Enemies/TruckKun/TruckKun.asset");
TerminalNode val3 = MainAssets.LoadAsset<TerminalNode>("Assets/Scripts/Enemies/TruckKun/Node.asset");
TerminalKeyword val4 = MainAssets.LoadAsset<TerminalKeyword>("Assets/Scripts/Enemies/TruckKun/Keyword.asset");
val2.enemyPrefab.AddComponent<TruckKunAI>();
((EnemyAI)val2.enemyPrefab.GetComponent<TruckKunAI>()).enemyType = val2;
NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab);
Enemies.RegisterEnemy(val2, 100, (LevelTypes)510, (SpawnType)2, val3, val4);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Truck-kun is loaded!");
val2 = MainAssets.LoadAsset<EnemyType>("Assets/Scripts/Enemies/FatBastard/FatBastard.asset");
val2.enemyPrefab.AddComponent<FatBastardAI>();
((EnemyAI)val2.enemyPrefab.GetComponent<FatBastardAI>()).enemyType = val2;
NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab);
Enemies.RegisterEnemy(val2, 40, (LevelTypes)510, (SpawnType)0, (TerminalNode)null, (TerminalKeyword)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Oji-san is loaded!");
EnemyType val5 = MainAssets.LoadAsset<EnemyType>("Assets/Scripts/Enemies/FatBastard/FatBastardBondageTrap.asset");
val5.enemyPrefab.AddComponent<FatBastardBondageTrap>();
NetworkPrefabs.RegisterNetworkPrefab(val5.enemyPrefab);
val2.enemyPrefab.GetComponent<FatBastardAI>().bondageTrapPrefab = val5.enemyPrefab;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Oji-san's trap is loaded!");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OtakuCompany is loaded!");
((BaseUnityPlugin)this).Logger.LogWarning((object)$"\r\n⠄⠄⠄⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄\r\n⠄⠄⠄⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄\r\n⠄⠄⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄\r\n⠄⠄⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄\r\n⠄⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰\r\n⠄⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤\r\n⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗\r\n⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄\r\n⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠄\r\n⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃⠄\r\n⠄⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃⠄⠄\r\n⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁⠄⠄⠄\r\n⠄⠄⠄⠄⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁⠄⠄⠄⠄⠄\r\n⠄⠄⠄⠄⠄⠄⠄⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁⠄⠄⠄⠄⠄⢀⣠⣴\r\n⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿");
}
}
public class FoodItem : GrabbableObject
{
public ParticleSystem eatParticle;
public AudioSource foodAudio;
public AudioClip eatFoodAudio;
private PlayerControllerB previousPlayerHeldBy;
public int heal = 30;
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
previousPlayerHeldBy = base.playerHeldBy;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0049: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)base.playerHeldBy == (Object)null))
{
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.inSpecialInteractAnimation = true;
base.playerHeldBy.DamagePlayer(-heal, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
base.playerHeldBy.inSpecialInteractAnimation = false;
EatFoodServerRpc();
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
base.playerHeldBy.activatingItem = false;
}
[ServerRpc(RequireOwnership = false)]
private void EatFoodServerRpc()
{
EatFoodClientRpc();
}
[ClientRpc]
private void EatFoodClientRpc()
{
eatParticle.Play();
foodAudio.PlayOneShot(eatFoodAudio);
WalkieTalkie.TransmitOneShotAudio(foodAudio, eatFoodAudio, 1f);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
}
}
}
public class TruckKunAI : EnemyAI, IVisibleThreat
{
private RoundManager roundManager;
private Vector3 previousPosition;
private Vector3 agentLocalVelocity;
private float agentSpeedWithNegative;
private Vector3 targetDir;
private float turnAngleThreshhold = 90f;
public bool isTurnRound;
private Vector3 endDes;
private bool hasSetTurnRoundDes;
private Vector3 d1;
private float turnTimer = 0f;
public AudioClip screamSFX;
public AudioClip breathingSFX;
public AudioClip crashSFX;
public float[] playerStealthMeters = new float[4];
public Transform lookTarget;
public float detectionRadius = 12f;
private Collider[] allPlayerColliders = (Collider[])(object)new Collider[4];
private float closestPlayerDist;
private Collider tempTargetCollider;
public bool detectingPlayers;
public AISearchRoutine searchForPlayers;
public AISearchRoutine roamPlanet;
public bool investigating;
public bool hasBegunInvestigating;
public Vector3 investigatePosition;
private float stopAndLookInterval;
private float stopAndLookTimer;
public PlayerControllerB chasingPlayer;
public bool lostPlayerInChase;
public bool hasLostPlayerInChaseDebounce;
public Vector3 lastSeenPlayerPositionInChase;
private bool chasingPlayerInLOS;
private float noticePlayerTimer;
public float timeSinceHittingPlayer;
ThreatType IVisibleThreat.type => (ThreatType)4;
int IVisibleThreat.SendSpecialBehaviour(int id)
{
return 0;
}
int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition)
{
return 18;
}
int IVisibleThreat.GetInterestLevel()
{
return 0;
}
Transform IVisibleThreat.GetThreatLookTransform()
{
return base.eye;
}
Transform IVisibleThreat.GetThreatTransform()
{
return ((Component)this).transform;
}
Vector3 IVisibleThreat.GetThreatVelocity()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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)
if (((NetworkBehaviour)this).IsOwner)
{
return base.agent.velocity;
}
return Vector3.zero;
}
float IVisibleThreat.GetVisibility()
{
if (base.isEnemyDead)
{
return 0f;
}
if (((Vector3)(ref agentLocalVelocity)).sqrMagnitude > 0f)
{
return 1f;
}
return 0.75f;
}
public override void Start()
{
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
((EnemyAI)this).Start();
Debug.Log((object)"Truck-kun: Starting TruckKunAI");
((Component)((Component)this).transform.GetChild(0)).gameObject.layer = 22;
((Component)((Component)this).transform.GetChild(0)).gameObject.tag = "DoNotSet";
((Component)((Component)this).transform.GetChild(1)).gameObject.layer = 14;
((Component)((Component)this).transform.GetChild(1)).gameObject.tag = "DoNotSet";
base.useSecondaryAudiosOnAnimatedObjects = false;
base.eye = ((Component)this).transform.Find("eye");
((Component)this).gameObject.AddComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)this;
((Component)this).gameObject.AddComponent<OccludeAudio>();
base.agent.angularSpeed = 120f;
for (int i = 0; i < 2; i++)
{
EnemyBehaviourState val = new EnemyBehaviourState();
val.name = i.ToString();
val.playOneShotSFX = false;
val.playOneShotVoice = false;
base.enemyBehaviourStates = CollectionExtensions.AddToArray<EnemyBehaviourState>(base.enemyBehaviourStates, val);
}
AudioClip voiceClip = Plugin.MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Enemies/TruckKun/Truckhorn.mp3");
base.enemyBehaviourStates[1].VoiceClip = voiceClip;
base.enemyBehaviourStates[1].VoiceClip.LoadAudioData();
base.enemyBehaviourStates[1].playOneShotVoice = true;
base.creatureSFX = ((Component)((Component)this).transform.GetChild(7)).GetComponent<AudioSource>();
base.creatureVoice = ((Component)this).GetComponent<AudioSource>();
crashSFX = Plugin.MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Enemies/TruckKun/Crash.mp3");
base.AIIntervalTime = 0.1f;
if (Random.Range(0, 10) < 2)
{
base.creatureVoice.pitch = Random.Range(0.6f, 1.3f);
}
else
{
base.creatureVoice.pitch = Random.Range(0.9f, 1.1f);
}
base.currentBehaviourStateIndex = 0;
}
public override void DoAIInterval()
{
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: 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).DoAIInterval();
if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead)
{
return;
}
if (base.currentBehaviourStateIndex != 0)
{
if (base.currentBehaviourStateIndex != 1)
{
return;
}
investigating = false;
hasBegunInvestigating = false;
if (roamPlanet.inProgress)
{
((EnemyAI)this).StopSearch(roamPlanet, false);
}
if (lostPlayerInChase)
{
if (!searchForPlayers.inProgress)
{
searchForPlayers.searchWidth = 25f;
((EnemyAI)this).StartSearch(lastSeenPlayerPositionInChase, searchForPlayers);
Debug.Log((object)"Truck-kun lost player in chase; beginning search where the player was last seen");
}
}
else
{
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
Debug.Log((object)"Truck-kun found player during chase; stopping search coroutine and moving after target player");
}
((EnemyAI)this).SetMovingTowardsTargetPlayer(chasingPlayer);
}
return;
}
((EnemyAI)this).SetMovingTowardsTargetPlayer((PlayerControllerB)null);
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
if (investigating)
{
if (!hasBegunInvestigating)
{
hasBegunInvestigating = true;
((EnemyAI)this).StopSearch(roamPlanet, false);
((EnemyAI)this).SetDestinationToPosition(investigatePosition, false);
}
if (Vector3.Distance(((Component)this).transform.position, investigatePosition) < 5f)
{
investigating = false;
hasBegunInvestigating = false;
}
}
else if (!roamPlanet.inProgress)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, roamPlanet);
}
}
public override void FinishedCurrentSearchRoutine()
{
if (((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex == 1 && lostPlayerInChase && !chasingPlayerInLOS)
{
Debug.Log((object)"Truck-kun finished search; player not in line of sight, lost player, returning to roaming mode");
((EnemyAI)this).SwitchToBehaviourState(0);
}
}
public override void ReachedNodeInSearch()
{
((EnemyAI)this).ReachedNodeInSearch();
if (((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex == 0 && stopAndLookInterval > 12f)
{
stopAndLookInterval = 0f;
stopAndLookTimer = Random.Range(3f, 10f);
}
}
public override void Update()
{
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead || !base.ventAnimationFinished)
{
return;
}
timeSinceHittingPlayer += Time.deltaTime;
stopAndLookInterval += Time.deltaTime;
angleToTerrain();
switch (base.currentBehaviourStateIndex)
{
case 0:
lostPlayerInChase = false;
hasLostPlayerInChaseDebounce = false;
lookForPlayers();
CalculateAgentSpeed();
if (stopAndLookTimer > 0f)
{
stopAndLookTimer -= Time.deltaTime;
base.agent.speed = 0f;
}
break;
case 1:
lookForPlayers();
CalculateAgentSpeed();
if (lostPlayerInChase)
{
if (!hasLostPlayerInChaseDebounce)
{
hasLostPlayerInChaseDebounce = true;
HasLostPlayerInChaseClientRpc();
}
if (chasingPlayerInLOS)
{
noticePlayerTimer = 0f;
lostPlayerInChase = false;
break;
}
noticePlayerTimer += Time.deltaTime;
if (noticePlayerTimer > 9f)
{
noticePlayerTimer = 0f;
((EnemyAI)this).SwitchToBehaviourState(0);
}
break;
}
if (hasLostPlayerInChaseDebounce)
{
hasLostPlayerInChaseDebounce = false;
HasFoundPlayerInChaseClientRpc();
}
if (chasingPlayerInLOS)
{
noticePlayerTimer = 0f;
lastSeenPlayerPositionInChase = ((Component)chasingPlayer).transform.position;
break;
}
noticePlayerTimer += Time.deltaTime;
if (noticePlayerTimer > 3f)
{
lostPlayerInChase = true;
}
break;
case 2:
return;
}
smoothTurn();
}
private void lookForPlayers()
{
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
float num = 15f;
if (base.currentBehaviourStateIndex == 1)
{
num = 30f;
}
if (base.currentBehaviourStateIndex == 2)
{
num = 10f;
}
PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(num, 100, base.eye, -1f, StartOfRound.Instance.collidersRoomDefaultAndFoliage);
if (allPlayersInLineOfSight == null)
{
if (base.currentBehaviourStateIndex == 1)
{
chasingPlayerInLOS = false;
}
return;
}
PlayerControllerB val = allPlayersInLineOfSight[0];
if (base.currentBehaviourStateIndex == 1)
{
if (lostPlayerInChase)
{
chasingPlayerInLOS = (Object)(object)val != (Object)null;
return;
}
chasingPlayerInLOS = allPlayersInLineOfSight.Contains(chasingPlayer);
}
if (!investigating)
{
investigating = true;
hasBegunInvestigating = false;
investigatePosition = RoundManager.Instance.GetNavMeshPosition(((Component)val).transform.position, default(NavMeshHit), 5f, -1);
BeginChasingNewPlayerServerRpc((int)val.playerClientId);
}
}
private void CalculateAgentSpeed()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = previousPosition - ((Component)this).transform.position;
float num = ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 1.4f);
previousPosition = ((Component)this).transform.position;
if (base.currentBehaviourStateIndex == 0)
{
base.agent.speed = 4f;
base.agent.acceleration = 5f;
agentSpeedWithNegative = base.agent.speed;
}
else if (base.currentBehaviourStateIndex == 1)
{
agentSpeedWithNegative += Time.deltaTime * 20f;
base.agent.speed = Mathf.Clamp(agentSpeedWithNegative, -3f, 100f);
base.agent.acceleration = 20f;
}
}
private void angleToTerrain()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, float.PositiveInfinity))
{
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(Vector3.Cross(((Component)this).transform.TransformDirection(Vector3.right), ((RaycastHit)(ref val)).normal)), 30f * Time.deltaTime);
}
}
private void smoothTurn()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
//IL_0026: 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_0056: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_00ee: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: 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_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = base.destination - ((Component)this).transform.position;
targetDir = ((Vector3)(ref val)).normalized;
if (Vector3.Angle(targetDir, ((Component)this).transform.forward) > turnAngleThreshhold && !isTurnRound)
{
endDes = base.destination;
isTurnRound = true;
base.agent.autoBraking = false;
}
if (isTurnRound)
{
turnTimer += Time.deltaTime;
if (turnTimer >= 4f)
{
turnTimer = 0f;
base.agent.SetDestination(endDes);
hasSetTurnRoundDes = false;
isTurnRound = false;
}
if (!hasSetTurnRoundDes)
{
d1 = findTurnPoint(endDes);
hasSetTurnRoundDes = true;
base.agent.SetDestination(d1);
}
if (Vector3.Distance(((Component)this).transform.position, d1) <= base.agent.stoppingDistance + 1f && Vector3.Angle(endDes - ((Component)this).transform.position, ((Component)this).transform.forward) > turnAngleThreshhold)
{
d1 = findTurnPoint(endDes);
base.agent.SetDestination(d1);
}
if (Vector3.Angle(endDes - ((Component)this).transform.position, ((Component)this).transform.forward) < turnAngleThreshhold)
{
base.agent.SetDestination(endDes);
hasSetTurnRoundDes = false;
isTurnRound = false;
}
}
}
private Vector3 findTurnPoint(Vector3 des)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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_0049: 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_005f: 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_007d: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
float num = 5f;
float num2 = 120f;
Vector3 val = Vector3.Cross(((Component)this).transform.forward, targetDir);
Vector3 val2 = ((!(val.y < 0f)) ? (((Component)this).transform.position - ((Component)this).transform.right * num - ((Component)this).transform.right * (num * Mathf.Cos(num2 * (MathF.PI / 180f))) + ((Component)this).transform.forward * (num * Mathf.Sin(num2 * (MathF.PI / 180f)))) : (((Component)this).transform.position - ((Component)this).transform.right * num - ((Component)this).transform.right * (num * Mathf.Cos(180f - num2 * (MathF.PI / 180f))) + ((Component)this).transform.forward * (num * Mathf.Sin(180f - num2 * (MathF.PI / 180f)))));
NavMeshHit val3 = default(NavMeshHit);
if (NavMesh.SamplePosition(val2, ref val3, 2f, -1))
{
return ((NavMeshHit)(ref val3)).position;
}
return endDes;
}
[ServerRpc(RequireOwnership = false)]
private void BeginChasingNewPlayerServerRpc(int playerId)
{
BeginChasingNewPlayerClientRpc(playerId);
}
[ClientRpc]
private void BeginChasingNewPlayerClientRpc(int playerId)
{
chasingPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
lostPlayerInChase = false;
((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
}
[ClientRpc]
private void HasLostPlayerInChaseClientRpc()
{
lostPlayerInChase = true;
hasLostPlayerInChaseDebounce = false;
}
[ClientRpc]
private void HasFoundPlayerInChaseClientRpc()
{
lostPlayerInChase = false;
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_00c9: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).OnCollideWithPlayer(other);
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (base.isEnemyDead || !((Object)(object)component != (Object)null) || !((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) || !((Object)(object)component.inAnimationWithEnemy == (Object)null))
{
return;
}
Debug.Log((object)$"Truck-kun colliding with {component.playerUsername}");
if (component.isPlayerDead)
{
return;
}
if (component.isInHangarShipRoom)
{
Debug.Log((object)$"{component.playerUsername} is in ship, no damage");
}
else if (timeSinceHittingPlayer > 0.5f)
{
float num = 55f;
Vector3 val = base.agent.velocity;
float num2 = Mathf.Clamp(((Vector3)(ref val)).magnitude, 5f, 100f);
val = ((Component)component.gameplayCamera).transform.position - ((Component)this).transform.position;
Vector3 val2 = ((Vector3)(ref val)).normalized * num;
timeSinceHittingPlayer = 0f;
component.DamagePlayer((int)num2 * 2, true, true, (CauseOfDeath)1, 0, false, val2);
component.externalForces += val2;
MakeCrashNoiseServerRpc();
float num3 = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position);
if (num3 < 10f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
else if (num3 < 20f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
if (Random.Range(1, 100) > 90)
{
TeleportPlayerServerRpc((int)component.playerClientId);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void MakeCrashNoiseServerRpc()
{
Debug.Log((object)"Truck-kun: Sending serverrpc for crash");
MakeCrashNoiseClientRpc();
}
[ClientRpc]
public void MakeCrashNoiseClientRpc()
{
Debug.Log((object)"Truck-kun: recieving clientrpc for crash");
MakeCrashNoise();
}
private void MakeCrashNoise()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"Truck-kun: make crash noise");
base.creatureVoice.pitch = Random.Range(0.96f, 1.04f);
base.creatureVoice.PlayOneShot(crashSFX);
WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, crashSFX, 1f);
if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 30f)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.3f, true);
}
}
[ServerRpc(RequireOwnership = false)]
public void TeleportPlayerServerRpc(int playerId)
{
Debug.Log((object)"Truck-kun: Sending serverrpc for teleport");
TeleportPlayerClientRpc(playerId);
}
[ClientRpc]
public void TeleportPlayerClientRpc(int playerId)
{
Debug.Log((object)"Truck-kun: recieving clientrpc for teleport");
TeleportPlayer(playerId);
}
public void TeleportPlayer(int playerId)
{
//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_002e: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
StartOfRound.Instance.allPlayerScripts[playerId].TeleportPlayer(position, false, 0f, false, true);
}
}
public class FatBastardAI : EnemyAI, INoiseListener
{
private enum Kink
{
Voyeurism,
Exhibitionism,
Auralism
}
private Vector3 mainEntrancePosition;
private bool inKillAnimation;
private Transform homeNode;
private Kink currentKink;
private float arousalMeter;
private float arousalMaxThreshhold;
private float arousalCurrentThreshold;
private float[] arousalThresholds = new float[4] { 0f, 0.2f, 0.4f, 0.6f };
private float enrageTimer;
private float hearNoiseCooldown;
private float makeNoiseTimer;
private bool standingIdle;
private Transform turnCompass;
private PlayerControllerB lookAtPlayer;
private SkinnedMeshRenderer mesh;
private Vector3 previousPosition;
private float carryingPlayerDebounce;
private AudioSource carryingPlayerAudio;
private bool carryingPlayer;
private PlayerControllerB playerBeingCarried;
private Transform holdPlayerPoint;
private FatBastardBondageTrap chosenTrap;
private int maxToysToPlace;
public GameObject bondageTrapPrefab;
private int maxBondageTrapsToPlace;
private List<FatBastardBondageTrap> bondageTraps = new List<FatBastardBondageTrap>();
private float timeSincePlacingBondageTrap;
public override void Start()
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
Debug.Log((object)"Oji-san: Starting FatBastardAI");
((Component)((Component)this).transform.GetChild(0)).gameObject.layer = 22;
((Component)((Component)this).transform.GetChild(0)).gameObject.tag = "DoNotSet";
((Component)((Component)this).transform.GetChild(1)).gameObject.layer = 14;
((Component)((Component)this).transform.GetChild(1)).gameObject.tag = "DoNotSet";
((Component)((Component)this).transform.Find("Man")).tag = "Enemy";
base.useSecondaryAudiosOnAnimatedObjects = false;
base.eye = ((Component)this).transform.Find("eye");
holdPlayerPoint = ((Component)this).transform.Find("holdPlayerPoint");
turnCompass = ((Component)this).transform.Find("turnCompass");
((Component)((Component)this).transform.Find("Man")).gameObject.AddComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)this;
base.agent.angularSpeed = 180f;
for (int i = 0; i < 3; i++)
{
EnemyBehaviourState val = new EnemyBehaviourState();
val.name = i.ToString();
val.playOneShotSFX = false;
val.playOneShotVoice = false;
base.enemyBehaviourStates = CollectionExtensions.AddToArray<EnemyBehaviourState>(base.enemyBehaviourStates, val);
}
base.currentBehaviourStateIndex = 0;
base.creatureVoice = ((Component)this).GetComponent<AudioSource>();
mainEntrancePosition = RoundManager.FindMainEntrancePosition(false, false);
maxToysToPlace = Random.Range(2, 4);
maxBondageTrapsToPlace = Random.Range(1, 3);
homeNode = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)this).transform.position, false, 2);
currentKink = (Kink)Random.Range(0, Enum.GetNames(typeof(Kink)).Length - 1);
arousalMaxThreshhold = Random.Range(80f, 120f);
base.enemyHP = Random.Range(5, 7);
mesh = ((Component)((Component)this).transform.Find("Man").Find("default")).GetComponent<SkinnedMeshRenderer>();
}
public override void DoAIInterval()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
if (StartOfRound.Instance.livingPlayers == 0)
{
((EnemyAI)this).DoAIInterval();
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.targetNode = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)this).transform.position, false, 2);
((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false);
break;
case 1:
if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 140f))
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 5f && !standingIdle)
{
Vector3 randomNavMeshPositionInRadiusSpherical = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)base.targetPlayer).transform.position, 5f, default(NavMeshHit));
((EnemyAI)this).SetDestinationToPosition(randomNavMeshPositionInRadiusSpherical, false);
standingIdle = true;
}
else if (!standingIdle)
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
}
if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 10f && standingIdle)
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
standingIdle = false;
}
}
else if (carryingPlayer)
{
((EnemyAI)this).SetDestinationToPosition(((Component)chosenTrap).transform.position, true);
}
else
{
((EnemyAI)this).SetDestinationToPosition(homeNode.position, true);
}
break;
case 2:
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
break;
}
((EnemyAI)this).DoAIInterval();
}
public override void Update()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead || inKillAnimation || (Object)(object)GameNetworkManager.Instance == (Object)null)
{
return;
}
if (!carryingPlayer)
{
carryingPlayerDebounce += Time.deltaTime;
}
hearNoiseCooldown -= Time.deltaTime;
CalculateAlphaOpacity();
Vector3 val = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f);
float num = ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 4f);
base.creatureAnimator.SetFloat("speedMultiplier", num);
previousPosition = ((Component)this).transform.position;
switch (base.currentBehaviourStateIndex)
{
case 0:
if (timeSincePlacingBondageTrap > 4f)
{
timeSincePlacingBondageTrap = Random.Range(0f, 1f);
AttemptPlaceBondageTrap();
if (bondageTraps.Count >= maxBondageTrapsToPlace)
{
((EnemyAI)this).SwitchToBehaviourServerRpc(1);
}
}
else
{
timeSincePlacingBondageTrap += Time.deltaTime;
}
break;
case 1:
if (base.stunNormalizedTimer > 0f)
{
ReleasePlayer();
AddToArousalMeter(0.1f * Time.deltaTime);
base.agent.speed = 0f;
}
if (carryingPlayer)
{
LookAtPlayerOfInterest();
base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 7.25f, 4f, 10f);
}
else
{
LookAtPlayerOfInterest();
base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 4.25f, 0f, 4f);
}
if (carryingPlayer && (Object)(object)chosenTrap != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)chosenTrap).transform.position) < 3f)
{
PlayerControllerB player = playerBeingCarried;
ReleasePlayer();
chosenTrap.Lock(player);
}
CheckKink();
CheckNoise();
break;
case 2:
base.agent.speed = 10f;
enrageTimer -= Time.deltaTime;
if (((NetworkBehaviour)this).IsOwner && enrageTimer <= 0f && !carryingPlayer)
{
((EnemyAI)this).SwitchToBehaviourState(1);
}
break;
}
}
private void LateUpdate()
{
//IL_0023: 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)
if ((Object)(object)playerBeingCarried != (Object)null)
{
((Component)playerBeingCarried).transform.position = holdPlayerPoint.position;
((Component)playerBeingCarried).transform.rotation = holdPlayerPoint.rotation;
}
}
private void CalculateAlphaOpacity()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
Color color = ((Renderer)mesh).material.color;
float num = Math.Clamp(arousalMeter * 0.001f, 0f, 0.1f);
((Renderer)mesh).material.color = new Color(color.r, color.g, color.b, num);
if (base.currentBehaviourStateIndex == 2)
{
((Renderer)mesh).material.color = new Color(color.r, color.g, color.b, 1f);
}
}
public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesNoisePlayedInOneSpot = 0, int noiseID = 0)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
if (currentKink != Kink.Auralism || base.currentBehaviourStateIndex == 2)
{
return;
}
((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesNoisePlayedInOneSpot, noiseID);
if (base.stunNormalizedTimer > 0f || noiseID == 7 || noiseID == 6 || noiseID == 546 || inKillAnimation || hearNoiseCooldown >= 0f || timesNoisePlayedInOneSpot > 15)
{
return;
}
float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
if (!(num > 15f))
{
Debug.Log((object)$"Oji-san '{((Object)((Component)this).gameObject).name}': Heard noise! Distance: {num} meters");
Debug.Log((object)$"Oji-san '{((Object)((Component)this).gameObject).name}': Noise ID: {noiseID}");
if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
{
noiseLoudness /= 2f;
}
if (!(noiseLoudness < 0.25f))
{
AddToArousalMeter(10f);
hearNoiseCooldown = 1f;
}
}
}
private void LookAtPlayerOfInterest()
{
//IL_0056: 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_008c: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
if (base.currentBehaviourStateIndex == 2)
{
lookAtPlayer = base.targetPlayer;
}
else
{
lookAtPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
}
if ((Object)(object)lookAtPlayer != (Object)null)
{
turnCompass.LookAt(((Component)lookAtPlayer.gameplayCamera).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 30f * Time.deltaTime);
}
}
private void CheckKink()
{
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(360f, 15, 5, 1f);
if ((Object)(object)val != (Object)null)
{
AddToArousalMeter(1f * Time.deltaTime);
switch (currentKink)
{
case Kink.Voyeurism:
{
PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(90f, 15, base.eye, -1f, StartOfRound.Instance.collidersAndRoomMaskAndDefault);
if (allPlayersInLineOfSight != null)
{
AddToArousalMeter((float)allPlayersInLineOfSight.Length * Time.deltaTime);
}
break;
}
case Kink.Exhibitionism:
{
int num = StartOfRound.Instance.allPlayerScripts.Length;
for (int i = 0; i < num; i++)
{
if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 15, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, base.eye.position) > 0.3f)
{
AddToArousalMeter(3f * Time.deltaTime);
}
}
break;
}
case Kink.Auralism:
break;
}
}
else
{
AddToArousalMeter(-0.5f * Time.deltaTime);
}
}
private void AddToArousalMeter(float amount)
{
if (!(arousalMeter + amount < arousalCurrentThreshold) && !carryingPlayer)
{
CheckArousalThreshhold();
arousalMeter += amount;
if (arousalMeter >= arousalMaxThreshhold && ChooseUnoccupiedTrap())
{
Debug.Log((object)$"Oji-san '{((Object)((Component)this).gameObject).name}': Threshhold reached, enraging");
arousalMeter = 0f;
arousalCurrentThreshold = 0f;
arousalMaxThreshhold = Random.Range(80f, 120f);
enrageTimer = Random.Range(10f, 15f);
((EnemyAI)this).SwitchToBehaviourServerRpc(2);
}
}
}
private void CheckArousalThreshhold()
{
for (int i = 0; i < arousalThresholds.Length; i++)
{
float num = arousalMaxThreshhold * arousalThresholds[arousalThresholds.Length - 1 - i];
if (arousalMeter >= num)
{
arousalCurrentThreshold = num;
break;
}
}
}
[ServerRpc(RequireOwnership = false)]
private void GrabPlayerServerRpc(int playerId)
{
GrabPlayerClientRpc(playerId);
}
[ClientRpc]
private void GrabPlayerClientRpc(int playerId)
{
GrabPlayer(playerId);
}
private void GrabPlayer(int playerId)
{
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
carryingPlayer = true;
playerBeingCarried = StartOfRound.Instance.allPlayerScripts[playerId];
playerBeingCarried.DropAllHeldItems(true, false);
playerBeingCarried.inSpecialInteractAnimation = true;
playerBeingCarried.inAnimationWithEnemy = (EnemyAI)(object)this;
base.creatureAnimator.SetBool("carryingPlayer", true);
Debug.Log((object)$"Oji-san: grabbing player {playerBeingCarried.playerUsername}");
if ((Object)(object)playerBeingCarried.currentVoiceChatAudioSource == (Object)null)
{
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
}
if ((Object)(object)playerBeingCarried.currentVoiceChatAudioSource != (Object)null)
{
((Component)playerBeingCarried.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f;
OccludeAudio component = ((Component)playerBeingCarried.currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
component.overridingLowPass = true;
component.lowPassOverride = 700f;
playerBeingCarried.voiceMuffledByEnemy = true;
}
if (carryingPlayer)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
}
if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 15f)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.3f, true);
}
((EnemyAI)this).SwitchToBehaviourServerRpc(1);
}
[ServerRpc]
private void ReleasePlayerServerRpc()
{
ReleasePlayerClientRpc();
}
[ClientRpc]
private void ReleasePlayerClientRpc()
{
ReleasePlayer();
}
private void ReleasePlayer()
{
if (carryingPlayer)
{
if ((Object)(object)playerBeingCarried.currentVoiceChatAudioSource == (Object)null)
{
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
}
if ((Object)(object)playerBeingCarried.currentVoiceChatAudioSource != (Object)null)
{
((Component)playerBeingCarried.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f;
OccludeAudio component = ((Component)playerBeingCarried.currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
component.overridingLowPass = false;
component.lowPassOverride = 20000f;
playerBeingCarried.voiceMuffledByEnemy = false;
}
carryingPlayerDebounce = 0f;
playerBeingCarried.inSpecialInteractAnimation = false;
playerBeingCarried.inAnimationWithEnemy = null;
carryingPlayer = false;
playerBeingCarried = null;
base.creatureAnimator.SetBool("carryingPlayer", false);
}
}
private void OnEnable()
{
((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).AddListener((UnityAction<PlayerControllerB>)OnPlayerTeleport);
}
private void OnDisable()
{
((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).RemoveListener((UnityAction<PlayerControllerB>)OnPlayerTeleport);
}
private void OnPlayerTeleport(PlayerControllerB playerTeleported)
{
if (carryingPlayer && !((Object)(object)playerBeingCarried != (Object)(object)playerTeleported))
{
ReleasePlayer();
}
}
private void CheckNoise()
{
makeNoiseTimer -= Time.deltaTime;
if (makeNoiseTimer <= 0f)
{
makeNoiseTimer = Random.Range(5f, 10f);
if (Random.Range(0f, arousalMaxThreshhold) < arousalMeter)
{
MakeNoiseServerRpc();
}
}
}
[ServerRpc]
private void MakeNoiseServerRpc()
{
MakeNoiseClientRpc();
}
[ClientRpc]
private void MakeNoiseClientRpc()
{
MakeNoise();
}
private void MakeNoise()
{
Debug.Log((object)"Oji-san: Playing sound");
RoundManager.PlayRandomClip(base.creatureVoice, base.enemyType.audioClips, true, 1f, 0, 1000);
}
private bool AttemptPlaceBondageTrap()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < bondageTraps.Count; i++)
{
if (Vector3.Distance(((Component)bondageTraps[i]).transform.position, ((Component)this).transform.position) < 3f)
{
return false;
}
}
SpawnBondageTrapServerRpc(((Component)this).transform.position);
return false;
}
[ServerRpc]
private void SpawnBondageTrapServerRpc(Vector3 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
SpawnBondageTrapClientRpc(position);
}
[ClientRpc]
private void SpawnBondageTrapClientRpc(Vector3 position)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(bondageTrapPrefab, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
FatBastardBondageTrap componentInChildren = val.GetComponentInChildren<FatBastardBondageTrap>();
bondageTraps.Add(componentInChildren);
componentInChildren.trapID = bondageTraps.Count - 1;
componentInChildren.mainScript = this;
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(val.transform.position, val.transform.forward);
Vector3 position2 = val.transform.position;
bool flag = false;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val2, ref val3, 0.1f, StartOfRound.Instance.playersMask) && !flag)
{
((Ray)(ref val2)).origin = position2 + Vector3.forward;
if (!Physics.Raycast(val2, ref val3, 0.1f, StartOfRound.Instance.playersMask))
{
val.transform.position = position2 + Vector3.forward;
flag = true;
}
((Ray)(ref val2)).origin = position2 - Vector3.forward;
if (!Physics.Raycast(val2, ref val3, 0.1f, StartOfRound.Instance.playersMask) && !flag)
{
val.transform.position = position2 - Vector3.forward;
flag = true;
}
((Ray)(ref val2)).origin = position2 + Vector3.right;
if (!Physics.Raycast(val2, ref val3, 0.1f, StartOfRound.Instance.playersMask) && !flag)
{
val.transform.position = position2 + Vector3.right;
flag = true;
}
((Ray)(ref val2)).origin = position2 - Vector3.right;
if (!Physics.Raycast(val2, ref val3, 0.1f, StartOfRound.Instance.playersMask) && !flag)
{
val.transform.position = position2 - Vector3.right;
flag = true;
}
Debug.Log((object)((object)(RaycastHit)(ref val3)).ToString());
}
if (Physics.Raycast(val2, ref val3, 2f, StartOfRound.Instance.playersMask))
{
val.transform.Rotate(0f, 90f, 0f);
Debug.Log((object)((object)(RaycastHit)(ref val3)).ToString());
}
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
if (!base.isEnemyDead)
{
if (!base.inSpecialAnimation)
{
base.creatureAnimator.SetTrigger("Hurt");
}
base.enemyHP -= force;
if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
{
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
public override void KillEnemy(bool destroy = false)
{
((EnemyAI)this).KillEnemy(false);
}
public override void OnCollideWithPlayer(Collider other)
{
if (base.currentBehaviourStateIndex == 2)
{
((EnemyAI)this).OnCollideWithPlayer(other);
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, carryingPlayer || carryingPlayerDebounce < 20f, false);
if ((Object)(object)val != (Object)null && ChooseUnoccupiedTrap())
{
GrabPlayerServerRpc((int)val.playerClientId);
}
}
}
private bool ChooseUnoccupiedTrap()
{
for (int i = 0; i < bondageTraps.Count; i++)
{
if (!bondageTraps[i].occupied)
{
chosenTrap = bondageTraps[i];
return true;
}
}
chosenTrap = null;
return false;
}
}
public class FatBastardBondageTrap : MonoBehaviour
{
public FatBastardAI mainScript;
public int trapID;
public bool occupied;
public PlayerControllerB trappedPlayer;
private float trapDamageInterval = 3f;
private DoorLock trapLock;
private AudioClip zapSFX;
private void Start()
{
zapSFX = Plugin.MainAssets.LoadAsset<AudioClip>("Assets/Scripts/Enemies/FatBastard/Zap1.mp3");
trapLock = ((Component)((Component)this).gameObject.transform.Find("cage").Find("interact")).GetComponent<DoorLock>();
((Component)((Component)this).gameObject.transform.Find("cage").Find("interact")).tag = "InteractTrigger";
}
private void OnEnable()
{
((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).AddListener((UnityAction<PlayerControllerB>)OnPlayerTeleport);
}
private void OnDisable()
{
((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).RemoveListener((UnityAction<PlayerControllerB>)OnPlayerTeleport);
}
private void OnPlayerTeleport(PlayerControllerB playerTeleported)
{
if (occupied && !((Object)(object)playerTeleported != (Object)(object)trappedPlayer))
{
Unlock();
trapLock.UnlockDoorSyncWithServer();
}
}
public void Update()
{
//IL_0034: 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)
if (occupied)
{
if (trapDamageInterval <= 0f)
{
trappedPlayer.DamagePlayer(10, true, true, (CauseOfDeath)11, 0, false, default(Vector3));
trapDamageInterval = Random.Range(3f, 15f);
trapLock.doorLockSFX.pitch = Random.Range(0.96f, 1.04f);
trapLock.doorLockSFX.PlayOneShot(zapSFX);
}
else
{
trapDamageInterval -= Time.deltaTime;
}
}
if ((Object)(object)trappedPlayer != (Object)null && !trapLock.isLocked)
{
Unlock();
}
}
public void Lock(PlayerControllerB player)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
occupied = true;
trappedPlayer = player;
trappedPlayer.inSpecialInteractAnimation = true;
trappedPlayer.inAnimationWithEnemy = (EnemyAI)(object)mainScript;
((Component)trappedPlayer).transform.position = ((Component)this).transform.Find("holdPosition").position;
trapLock.LockDoor(30f);
}
public void Unlock()
{
trappedPlayer.inSpecialInteractAnimation = false;
trappedPlayer.inAnimationWithEnemy = null;
occupied = false;
trappedPlayer = null;
trapLock.UnlockDoorSyncWithServer();
}
}
public class FatBastardLock : NetworkBehaviour
{
private InteractTrigger lockTrigger;
public float maxTimeLeft = 60f;
public float lockPickTimeLeft = 60f;
public bool isLocked;
public bool isPickingLock;
[Space(5f)]
public Transform lockPickerPosition;
public Transform lockPickerPosition2;
public AudioClip pickingLockSFX;
public AudioClip unlockSFX;
public AudioSource doorLockSFX;
private bool displayedLockTip;
private bool localPlayerPickingLock;
private int playersPickingDoor;
private float playerPickingLockProgress;
public void Awake()
{
lockTrigger = ((Component)this).gameObject.AddComponent<InteractTrigger>();
lockPickerPosition = ((Component)this).transform;
lockPickerPosition2 = ((Component)this).transform;
}
public void Unlock()
{
doorLockSFX.Stop();
doorLockSFX.PlayOneShot(unlockSFX);
if (isLocked)
{
isLocked = false;
}
}
public void Lock()
{
isLocked = true;
}
[ServerRpc]
public void UnlockServerRpc()
{
UnlockClientRpc();
}
[ClientRpc]
public void UnlockClientRpc()
{
Unlock();
}
public void UnlockSyncWithServer()
{
if (isLocked)
{
Unlock();
UnlockServerRpc();
}
}
private void Update()
{
if (isLocked)
{
if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
{
return;
}
if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemId == 14)
{
if (StartOfRound.Instance.localPlayerUsingController)
{
lockTrigger.disabledHoverTip = "Use key: [R-trigger]";
}
else
{
lockTrigger.disabledHoverTip = "Use key: [ LMB ]";
}
}
else
{
lockTrigger.disabledHoverTip = "Locked";
}
if (playersPickingDoor > 0)
{
playerPickingLockProgress = Mathf.Clamp(playerPickingLockProgress + (float)playersPickingDoor * 0.85f * Time.deltaTime, 1f, 3.5f);
}
lockTrigger.timeToHoldSpeedMultiplier = Mathf.Clamp((float)playersPickingDoor * 0.85f, 1f, 3.5f);
}
if (isLocked && isPickingLock)
{
lockPickTimeLeft -= Time.deltaTime;
lockTrigger.disabledHoverTip = $"Picking lock: {(int)lockPickTimeLeft} sec.";
if (((NetworkBehaviour)this).IsServer && lockPickTimeLeft < 0f)
{
Unlock();
UnlockServerRpc();
}
}
}
public static implicit operator DoorLock(FatBastardLock v)
{
return v;
}
}
public class YandereAI : EnemyAI
{
private int timesOshiLeftDungeon;
private float timeOshiAwayFromDungeon;
private bool oshiReturned;
private bool oshiDead;
private PlayerControllerB oshi;
public override void Start()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
((EnemyAI)this).Start();
Debug.Log((object)"Oji-san: Starting YandereAI");
for (int i = 0; i < 3; i++)
{
EnemyBehaviourState val = new EnemyBehaviourState();
val.name = i.ToString();
val.playOneShotSFX = false;
val.playOneShotVoice = false;
base.enemyBehaviourStates = CollectionExtensions.AddToArray<EnemyBehaviourState>(base.enemyBehaviourStates, val);
}
base.currentBehaviourStateIndex = 0;
base.creatureVoice = ((Component)this).GetComponent<AudioSource>();
ChooseOshi();
}
public override void DoAIInterval()
{
((EnemyAI)this).DoAIInterval();
if (StartOfRound.Instance.livingPlayers != 0 && !base.isEnemyDead && base.currentBehaviourStateIndex == 0)
{
}
}
public override void Update()
{
((EnemyAI)this).Update();
if (!base.isEnemyDead)
{
}
}
private void ChooseOshi()
{
PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
oshi = allPlayerScripts[0];
}
private void CheckOshi()
{
if (!oshiDead && oshi.isPlayerDead)
{
oshiDead = true;
((EnemyAI)this).SwitchToBehaviourState(4);
}
if (!oshi.isInsideFactory && oshiReturned)
{
oshiReturned = false;
timesOshiLeftDungeon++;
}
else if (oshi.isInsideFactory && !oshiReturned)
{
oshiReturned = true;
}
if (!oshi.isInsideFactory)
{
timeOshiAwayFromDungeon += Time.deltaTime;
}
}
}
public class MagicGirlAI : NetworkBehaviour
{
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "OtakuCompany";
public const string PLUGIN_NAME = "OtakuCompany";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace OtakuCompany.Patches
{
[HarmonyPatch(typeof(KeyItem))]
internal class KeyItemPatch
{
[HarmonyPatch("ItemActivate")]
[HarmonyPostfix]
private static void ItemActivatePatch(ref KeyItem __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816))
{
FatBastardLock component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<FatBastardLock>();
if ((Object)(object)component != (Object)null && component.isLocked && !component.isPickingLock)
{
component.UnlockSyncWithServer();
((GrabbableObject)__instance).playerHeldBy.DespawnHeldObject();
}
}
}
}
[HarmonyPatch(typeof(LockPicker))]
internal class LockPickerPatch
{
[HarmonyPatch("ItemActivate")]
[HarmonyPostfix]
private static void ItemActivatePatch(ref LockPicker __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816))
{
FatBastardLock component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<FatBastardLock>();
if ((Object)(object)component != (Object)null && component.isLocked && !component.isPickingLock)
{
((GrabbableObject)__instance).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)component).NetworkObject, component.lockPickerPosition.localPosition, true);
Debug.Log((object)"discard held object called from lock picker");
__instance.PlaceLockPickerServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject), true);
__instance.PlaceOnDoor((DoorLock)component, true);
}
}
}
}
}