using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using DunGen.Graph;
using DunGen.Tags;
using DunGenPlus;
using DunGenPlus.Collections;
using DunGenPlus.Components.Scripting;
using DunGenPlus.Managers;
using DungeonBasement;
using DungeonFoyer;
using FacilityMeltdown.API;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalConfig.MonoBehaviours;
using LethalLevelLoader;
using LethalLib.Modules;
using OdinSerializer;
using ReservedItemSlotCore.Data;
using ScarletMansion.Configs;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch;
using ScarletMansion.GamePatch.Components;
using ScarletMansion.GamePatch.Components.TreasureRoom;
using ScarletMansion.GamePatch.Enemies;
using ScarletMansion.GamePatch.FixValues;
using ScarletMansion.GamePatch.Items;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.GamePatch.Props;
using ScarletMansion.Lights;
using ScarletMansion.ModPatch;
using ScarletMansion.NetcodePatcher;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletMansion")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansion")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d7e169df-3f43-44b0-a300-c23b9aa44d48")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
namespace ScarletMansion
{
public static class Assets
{
public class Enemy
{
public bool initialized;
public GameObject enemy;
public EnemyType enemyType;
public Func<int> rarityFunc;
public TerminalNode terminalNode;
public TerminalKeyword terminalKeyword;
public Enemy(GameObject enemy, TerminalNode node, TerminalKeyword keyword)
{
this.enemy = enemy;
enemyType = enemy.GetComponentInChildren<EnemyAI>().enemyType;
terminalNode = node;
terminalKeyword = keyword;
Enemies.RegisterEnemy(enemyType, 0, (LevelTypes)1, terminalNode, terminalKeyword);
}
public SpawnableEnemyWithRarity GetItemEntry(int rarity)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
return new SpawnableEnemyWithRarity(enemyType, rarity);
}
}
public class GlobalItem
{
public Item item;
private int _itemId;
public Func<ConfigItem> configItemEntryFunc;
public int itemId
{
get
{
if (_itemId == -1 && Object.op_Implicit((Object)(object)StartOfRound.Instance))
{
string text = (Object.op_Implicit((Object)(object)item) ? item.itemName : "NULL");
_itemId = Utility.GetGlobalItemId(item);
if (_itemId != -1)
{
Plugin.logger.LogWarning((object)$"Cached {_itemId} itemId for item {text}");
return _itemId;
}
Plugin.logger.LogWarning((object)("Tried to get itemId for item " + text + " but failed"));
}
return _itemId;
}
set
{
_itemId = value;
}
}
public GlobalItem(Item item, Func<ConfigItem> configItemEntryFunc)
{
this.item = item;
_itemId = -1;
this.configItemEntryFunc = configItemEntryFunc;
}
public ConfigItem GetConfigItemEntry()
{
return configItemEntryFunc();
}
}
public class ScrapItem : GlobalItem
{
public Func<ConfigScrapItem> configScrapItemEntryFunc;
public bool SpawnsOnMap => configScrapItemEntryFunc != null;
public ScrapItem(Item item, Func<ConfigScrapItem> configScrapItemEntryFunc)
: base(item, configScrapItemEntryFunc)
{
this.configScrapItemEntryFunc = configScrapItemEntryFunc;
}
public void UpdateItemValue()
{
if (SpawnsOnMap)
{
ConfigScrapItem configScrapItemEntry = GetConfigScrapItemEntry();
item.minValue = configScrapItemEntry.valueRange.min;
item.maxValue = configScrapItemEntry.valueRange.max;
}
}
public SpawnableItemWithRarity GetItemRarity()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
int num = GetConfigScrapItemEntry()?.spawnWeight ?? 0;
return new SpawnableItemWithRarity(item, num);
}
public ConfigScrapItem GetConfigScrapItemEntry()
{
return configScrapItemEntryFunc();
}
}
public class Flashlight : GlobalItem
{
public string assetName;
public string displayName;
public Item lethalVanillaItem;
public int lethalHelmetIndex = -1;
public int scarletHelmetIndex = -1;
public Flashlight(string baseName, int lethalHelmetIndex, Func<ConfigItem> configEntryFunc)
: base(null, configEntryFunc)
{
assetName = "Scarlet" + baseName;
displayName = "D. " + baseName;
this.lethalHelmetIndex = lethalHelmetIndex;
}
public bool ContainsItemCheckConfig(Item compareItem)
{
if (!GetConfigItemEntry().enabled)
{
return false;
}
return ContainsItem(compareItem);
}
public bool ContainsItem(Item compareItem)
{
return (Object)(object)compareItem == (Object)(object)item || (Object)(object)compareItem == (Object)(object)lethalVanillaItem;
}
}
public static ActionList onAssetsLoadEvent = new ActionList("onAssetsLoad");
public static ActionList<CoronerParameters> onPlayerDeath = new ActionList<CoronerParameters>("onPlayerDeath");
private const string mainAssetBundleName = "scarletmansion";
public static AssetBundle MainAssetBundle = null;
public static ExtendedMod extendedMod;
public static NetworkObjectListScriptableObject networkObjectList;
public static AudioClip entranceAudioClip;
public static Enemy knight;
public static Enemy maid;
public static List<GlobalItem> globalItems;
public static List<ScrapItem> scrapItems;
public static Dictionary<string, Func<ConfigScrapItem>> itemConfigTable = new Dictionary<string, Func<ConfigScrapItem>>
{
{
"Deco. crystal",
() => SyncedInstance<ConfigMain>.Instance.crystalValue
},
{
"Shattered deco. crystal",
() => SyncedInstance<ConfigMain>.Instance.crystalBrokenValue
},
{
"Doll Snow Globe",
() => SyncedInstance<ConfigMain>.Instance.snowGlobeValue
},
{
"Gohei",
() => SyncedInstance<ConfigMain>.Instance.goheiValue
}
};
public static GlobalItem key;
public static Flashlight flashlight;
public static Flashlight flashlightBB;
public static ItemGroup genericItemGroup;
public static ItemGroup tabletopItemGroup;
public static ItemGroup smallItemGroup;
public static bool dungeonMapHazardFound;
public static GameObject dungeonTurretMapHazard;
public static GameObject dungeonMinesMapHazard;
public static GameObject dungeonSpikeTrapMapHazard;
public static Sprite hoverIcon;
private static ManualLogSource logger => Plugin.logger;
public static GlobalItem GetGlobalItem(Item item)
{
return globalItems.FirstOrDefault((GlobalItem x) => (Object)(object)x.item == (Object)(object)item);
}
public static Flashlight GetFlashlight(Item item)
{
if (flashlight.ContainsItem(item))
{
return flashlight;
}
if (flashlightBB.ContainsItem(item))
{
return flashlightBB;
}
return null;
}
public static Flashlight GetFlashlightCheckConfig(Item item)
{
if (flashlight.ContainsItemCheckConfig(item))
{
return flashlight;
}
if (flashlightBB.ContainsItemCheckConfig(item))
{
return flashlightBB;
}
return null;
}
public static void LoadAssetBundle()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
if (manifestResourceNames.Length >= 1)
{
string text = manifestResourceNames[0];
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text);
Plugin.logger.LogDebug((object)("Loading resource " + text));
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
Plugin.ConfigFoyer.dungeon = Assets.Load<DungeonFlow>("sdmFoyer", onlyReportErrors: true);
Plugin.ConfigFoyer.dunGenExtender = Assets.Load<DunGenExtender>("foyerExtender", onlyReportErrors: true);
Plugin.ConfigBasement.dungeon = Assets.Load<DungeonFlow>("sdmBasement", onlyReportErrors: true);
Plugin.ConfigBasement.dunGenExtender = Assets.Load<DunGenExtender>("basementExtender", onlyReportErrors: true);
networkObjectList = Assets.Load<NetworkObjectListScriptableObject>("SDMList", onlyReportErrors: true);
entranceAudioClip = Assets.Load<AudioClip>("entrance_ogg", onlyReportErrors: true);
knight = new Enemy(Assets.Load<GameObject>("NET_KnightEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("KnightNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("KnightKeyword", onlyReportErrors: true));
maid = new Enemy(Assets.Load<GameObject>("NET_MaidEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("MaidNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("MaidKeyword", onlyReportErrors: true));
RegisterNetworkPrefab(networkObjectList.networkDungeon);
RegisterNetworkPrefab(networkObjectList.networkDoors);
RegisterNetworkPrefab(networkObjectList.networkItems);
RegisterNetworkPrefab(networkObjectList.networkFrames);
RegisterNetworkPrefab(networkObjectList.networkOther);
globalItems = new List<GlobalItem>();
scrapItems = new List<ScrapItem>();
foreach (Item scrapItem in networkObjectList.scrapItems)
{
Func<ConfigScrapItem> itemConfigFunction = GetItemConfigFunction(scrapItem);
ScrapItem item = new ScrapItem(scrapItem, itemConfigFunction);
scrapItems.Add(item);
globalItems.Add(item);
Items.RegisterScrap(scrapItem, 0, (LevelTypes)1);
NetworkPrefabs.RegisterNetworkPrefab(scrapItem.spawnPrefab);
Plugin.logger.LogDebug((object)("Scrap Item " + scrapItem.itemName + " registered"));
}
key = new GlobalItem(networkObjectList.items[0], () => SyncedInstance<ConfigMain>.Instance.scarletKeyValue);
globalItems.Add(key);
Items.RegisterItem(key.item);
flashlight = new Flashlight("Pro Flashlight", 0, () => SyncedInstance<ConfigMain>.Instance.decoProFlashlightValue);
flashlightBB = new Flashlight("Flashlight", 1, () => SyncedInstance<ConfigMain>.Instance.decoFlashlightValue);
globalItems.Add(flashlight);
globalItems.Add(flashlightBB);
foreach (EnemyType enemy in networkObjectList.enemies)
{
Enemies.RegisterEnemy(enemy, 0, (LevelTypes)1, (TerminalNode)null, (TerminalKeyword)null);
NetworkPrefabs.RegisterNetworkPrefab(enemy.enemyPrefab);
}
onAssetsLoadEvent.Call();
}
public static Func<ConfigScrapItem> GetItemConfigFunction(Item item)
{
string itemName = item.itemName;
if (itemConfigTable.TryGetValue(itemName, out var value))
{
return value;
}
return null;
}
private static void RegisterNetworkPrefab(List<GameObject> list)
{
foreach (GameObject item in list)
{
NetworkPrefabs.RegisterNetworkPrefab(item);
}
}
public static T Load<T>(string name, bool onlyReportErrors = true) where T : Object
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
logger.LogError((object)"Trying to load in asset but asset bundle is missing");
return default(T);
}
T val = MainAssetBundle.LoadAsset<T>(name);
bool flag = (Object)(object)val == (Object)null;
if (flag || onlyReportErrors)
{
logger.LogDebug((object)("Loading asset " + name));
}
if (flag)
{
logger.LogError((object)"...but it was not found");
}
return val;
}
}
public class FloorCleanup : MonoBehaviour
{
[Serializable]
public class State
{
public int value;
public Material material;
public float rotation;
}
[Header("References")]
public MeshRenderer targetRenderer;
public GameObject targerGameObject;
public int bitValueCheck;
[Header("Logic")]
public GameObject[] neighbors;
public int[] stateValues;
public Material[] stateMaterials;
public float[] stateRotations;
public State[] states;
private void Reset()
{
targetRenderer = ((Component)this).GetComponent<MeshRenderer>();
targerGameObject = ((Component)this).gameObject;
}
public bool UpdateRender()
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
int num2 = (1 << neighbors.Length) - 1;
for (int i = 0; i < neighbors.Length; i++)
{
GameObject val = neighbors[i];
if ((Object)(object)val != (Object)null && neighbors[i].activeSelf)
{
num += 1 << i;
}
}
if (num == num2)
{
return false;
}
for (int j = 0; j < stateValues.Length; j++)
{
if (stateValues[j] == num)
{
((Renderer)targetRenderer).material = stateMaterials[j];
((Component)targetRenderer).transform.localEulerAngles = new Vector3(0f, stateRotations[j], 0f);
return false;
}
}
if ((Object)(object)targerGameObject == (Object)null)
{
Plugin.logger.LogError((object)"FloorCleanup null. dev fix plz");
return false;
}
bool activeSelf = targerGameObject.activeSelf;
targerGameObject.SetActive(false);
return activeSelf;
}
private void OnDrawGizmosSelected()
{
//IL_0001: 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)
Gizmos.color = Color.green;
for (int i = 0; i < neighbors.Length; i++)
{
if ((bitValueCheck & (1 << i)) > 0)
{
Gizmos.DrawCube(neighbors[i].transform.position, Vector3.one);
}
}
}
}
public class FloorCleanUpParent : MonoBehaviour, IDungeonCompleteReceiver
{
public FloorCleanup[] children;
public string tileParentName;
private void Reset()
{
children = ((Component)this).GetComponentsInChildren<FloorCleanup>();
}
private void Awake()
{
tileParentName = ((Object)((Component)((Component)this).GetComponentInParent<Tile>()).gameObject).name ?? "";
}
public void OnDungeonComplete(Dungeon dungeon)
{
DoorwayManager.AddActionHook((DunGenScriptingHook)1, (Action)UpdateChildren);
}
public void UpdateChildren()
{
bool flag = true;
while (flag)
{
flag = false;
FloorCleanup[] array = children;
foreach (FloorCleanup floorCleanup in array)
{
if (!((Object)(object)floorCleanup == (Object)null))
{
bool flag2 = floorCleanup.UpdateRender();
flag = flag || flag2;
}
}
}
}
}
public class KnightSpawnPoint : MonoBehaviour
{
[CompilerGenerated]
private sealed class <GetNearbyPlayers>d__6 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public KnightSpawnPoint <>4__this;
private float <randomWait>5__1;
private StartOfRound <sround>5__2;
private PlayerControllerB[] <players>5__3;
private int <playerCount>5__4;
private int <i>5__5;
private PlayerControllerB <player>5__6;
private float <dist>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetNearbyPlayers>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<sround>5__2 = null;
<players>5__3 = null;
<player>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
<sround>5__2 = StartOfRound.Instance;
<players>5__3 = <sround>5__2.allPlayerScripts;
<playerCount>5__4 = <sround>5__2.connectedPlayersAmount + 1;
<i>5__5 = 0;
while (<i>5__5 < <playerCount>5__4)
{
<player>5__6 = <players>5__3[<i>5__5];
if (<player>5__6.isPlayerControlled || !<player>5__6.isPlayerDead)
{
<dist>5__7 = Vector3.SqrMagnitude(((Component)<>4__this).transform.position - ((Component)<player>5__6).transform.position);
if (<dist>5__7 <= 36f)
{
KnightSpawnManager.Instance.lastKnightSeenPlayer = <>4__this.index;
Plugin.logger.LogDebug((object)$"Knight {<>4__this.index} has noticed player {<player>5__6.playerUsername}");
}
<player>5__6 = null;
}
int num = <i>5__5 + 1;
<i>5__5 = num;
}
<sround>5__2 = null;
<players>5__3 = null;
break;
}
<randomWait>5__1 = Random.Range(4f, 8f);
<>2__current = (object)new WaitForSeconds(<randomWait>5__1);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public int index;
public GameObject renderGameObject;
public const float minTime = 4f;
public const float maxTime = 8f;
public const float minSqrDistance = 36f;
public void Start()
{
if (GameNetworkManager.Instance.isHostingGame)
{
((MonoBehaviour)this).StartCoroutine(GetNearbyPlayers());
}
}
[IteratorStateMachine(typeof(<GetNearbyPlayers>d__6))]
public IEnumerator GetNearbyPlayers()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetNearbyPlayers>d__6(0)
{
<>4__this = this
};
}
public void OnStop()
{
renderGameObject.SetActive(false);
((MonoBehaviour)this).StopAllCoroutines();
}
}
public class ScarletVent : EnemyVent
{
[Header("References")]
public ScarletVentVisuals visuals;
public EnemyType ignoreEnemyType;
private void Awake()
{
ignoreEnemyType = Assets.knight.enemyType;
}
public void ScarletUpdate()
{
if (base.occupied && (Object)(object)base.enemyType != (Object)(object)ignoreEnemyType)
{
float num = base.spawnTime - base.roundManager.timeScript.currentDayTime;
if (base.isPlayingAudio)
{
float num2 = Mathf.Abs(num / base.enemyType.timeToPlayAudio - 1f);
visuals.SetVolumeLazy(num2);
base.lowPassFilter.lowpassResonanceQ = Math.Abs(num2 * 2f - 2f);
}
else if (num < base.enemyType.timeToPlayAudio)
{
base.isPlayingAudio = true;
visuals.StartSpawnParticles();
}
}
else if (base.isPlayingAudio)
{
base.isPlayingAudio = false;
visuals.StopSpawnParticles();
visuals.StopLightningParticles();
}
}
public void OpenVent()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
ScarletNetworkManager.Instance.CreateSpawnAudioPrefabLocal(((Component)this).transform.position);
}
protected override void __initializeVariables()
{
((EnemyVent)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((EnemyVent)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "ScarletVent";
}
}
public class KnightGhostVariant : EnemyAI
{
public float maxChaseSpeed = 14.5f;
public float slowChaseSpeed = 6f;
private float currentAnimSpeed = 1f;
public Collider mainCollider;
public MeshRenderer[] knightMeshRenderers;
public AudioClip[] ramAudioClips;
public KnightSpawnPoint spawnPoint;
public bool activated;
private bool calledDisappear = false;
public override void Start()
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
maxChaseSpeed = SyncedInstance<ConfigMain>.Instance.revEnemyValue.speed;
if (StartOfRound.Instance.ClientPlayerList.TryGetValue(((NetworkBehaviour)this).NetworkObject.OwnerClientId, out var value))
{
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[value];
Plugin.logger.LogInfo((object)("Targeting " + base.targetPlayer.playerUsername + " for death"));
}
if (!((NetworkBehaviour)this).IsOwner)
{
MeshRenderer[] array = knightMeshRenderers;
foreach (MeshRenderer val in array)
{
((Renderer)val).enabled = false;
}
}
if (((NetworkBehaviour)this).IsServer)
{
int num = (Object.op_Implicit((Object)(object)KnightSpawnManager.Instance) ? KnightSpawnManager.Instance.GetSpawnPointIndex() : (-1));
if (num == -1)
{
EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents;
EnemyVent val2 = allEnemyVents[Random.Range(0, allEnemyVents.Length)];
SyncKnightAtPositionClientRpc(val2.floorNode.position, Quaternion.Euler(0f, val2.floorNode.eulerAngles.y, 0f));
}
else
{
SyncKnightReplacementClientRpc(num);
}
}
}
public override void DoAIInterval()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
base.movingTowardsTargetPlayer = true;
if ((Object)(object)base.targetPlayer == (Object)null || !((NetworkBehaviour)base.targetPlayer).IsOwner || base.isEnemyDead || base.timeSinceSpawn < 1f)
{
return;
}
if (!((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true))
{
CallDisappear();
return;
}
bool flag = base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f, -1);
int num = (flag ? 1 : 0);
if (flag)
{
base.targetPlayer.JumpToFearLevel(0.75f, true);
}
if (num != base.currentBehaviourStateIndex)
{
((EnemyAI)this).SwitchToBehaviourState(num);
}
}
public override void Update()
{
((EnemyAI)this).Update();
if (!base.isEnemyDead && !(base.timeSinceSpawn < 1f))
{
if (!activated)
{
activated = true;
base.creatureAnimator.SetBool("Activate", true);
}
float num = ((base.currentBehaviourStateIndex == 0) ? maxChaseSpeed : slowChaseSpeed);
if (((NetworkBehaviour)this).IsOwner)
{
base.agent.speed = Mathf.MoveTowards(base.agent.speed, num, (maxChaseSpeed - slowChaseSpeed) * 4f * Time.deltaTime);
}
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, num * 0.4597f, 4f * Time.deltaTime);
base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_005e: 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)
((EnemyAI)this).OnCollideWithPlayer(other);
if (base.timeSinceSpawn < 1f)
{
return;
}
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner && (Object)(object)val == (Object)(object)base.targetPlayer)
{
int markedDamageToPlayer = ScarletNetworkManagerUtility.GetMarkedDamageToPlayer(val);
val.DamagePlayer(markedDamageToPlayer, true, true, (CauseOfDeath)6, 1, false, default(Vector3));
val.JumpToFearLevel(1f, true);
ScarletNetworkManagerUtility.MarkPlayerForDeath(val);
if (val.isPlayerDead)
{
Assets.onPlayerDeath.Call(new CoronerParameters(val, CoronerDeathEnum.GhostKnight));
}
RoundManager.PlayRandomClip(base.creatureVoice, ramAudioClips, false, 1f, 1, 1000);
CallDisappear();
}
}
[ClientRpc]
public void SyncKnightReplacementClientRpc(int index)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2391938005u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2391938005u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Plugin.logger.LogDebug((object)$"Spawning ghost knight at {index}");
try
{
spawnPoint = KnightSpawnManager.Instance.GetSpawnPoint(index);
KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, spawnPoint);
}
catch (Exception ex)
{
Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {index}, but completely failed");
Plugin.logger.LogError((object)ex);
}
}
[ClientRpc]
public void SyncKnightAtPositionClientRpc(Vector3 position, Quaternion rotation)
{
//IL_011a: 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_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: 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_0104: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2455274832u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2455274832u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Plugin.logger.LogDebug((object)$"Spawning ghost knight at {position}");
try
{
KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, position, rotation);
}
catch (Exception ex)
{
Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {position}, but completely failed");
Plugin.logger.LogError((object)ex);
}
}
public void CallDisappear()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (!calledDisappear)
{
Plugin.logger.LogDebug((object)"Killing ghost knight");
calledDisappear = true;
mainCollider.enabled = false;
((Component)mainCollider).gameObject.SetActive(false);
ScarletNetworkManager.Instance.CreateSpawnAudioPrefab(((Component)this).transform.position, base.targetPlayer.actualClientId);
DisappearServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void DisappearServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(722636660u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 722636660u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
((EnemyAI)this).KillEnemy(true);
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(2391938005u, new RpcReceiveHandler(__rpc_handler_2391938005), "SyncKnightReplacementClientRpc");
((NetworkBehaviour)this).__registerRpc(2455274832u, new RpcReceiveHandler(__rpc_handler_2455274832), "SyncKnightAtPositionClientRpc");
((NetworkBehaviour)this).__registerRpc(722636660u, new RpcReceiveHandler(__rpc_handler_722636660), "DisappearServerRpc");
((EnemyAI)this).__initializeRpcs();
}
private static void __rpc_handler_2391938005(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightGhostVariant)(object)target).SyncKnightReplacementClientRpc(index);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2455274832(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0043: 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_0052: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
Quaternion rotation = default(Quaternion);
((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation);
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightGhostVariant)(object)target).SyncKnightAtPositionClientRpc(position, rotation);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_722636660(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightGhostVariant)(object)target).DisappearServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "KnightGhostVariant";
}
}
public class KnightVariant : EnemyAI
{
public AISearchRoutine searchForPlayers;
private bool stoppingMovement;
private bool hasStopped;
public AnimationStopPoints animStopPoints;
private float currentChaseSpeed = 10.875f;
private float currentAnimSpeed = 1f;
private PlayerControllerB previousTarget;
private bool wasOwnerLastFrame;
private float stopAndGoMinimumInterval;
private float timeSinceHittingPlayer;
public AudioClip[] springNoises;
public Collider mainCollider;
public override void Start()
{
((EnemyAI)this).Start();
if (((NetworkBehaviour)this).IsOwner && Object.op_Implicit((Object)(object)KnightSpawnManager.Instance))
{
int spawnPointIndex = KnightSpawnManager.Instance.GetSpawnPointIndex();
if (spawnPointIndex != -1)
{
SyncKnightReplacementClientRpc(spawnPointIndex);
}
}
}
public override void DoAIInterval()
{
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: 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_0178: 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_019f: 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_021a: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
StartOfRound instance = StartOfRound.Instance;
if (instance.allPlayersDead || base.isEnemyDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 1:
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true))
{
if ((Object)(object)previousTarget != (Object)(object)base.targetPlayer)
{
previousTarget = base.targetPlayer;
((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
}
base.movingTowardsTargetPlayer = true;
}
else
{
((EnemyAI)this).SwitchToBehaviourState(0);
((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId);
}
break;
case 0:
{
if (!((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId);
break;
}
for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++)
{
PlayerControllerB val = instance.allPlayerScripts[i];
if (((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
{
bool flag = !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)val.gameplayCamera).transform.position, instance.collidersAndRoomMaskAndDefault);
bool flag2 = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)val).transform.position) < 900f;
if (flag && flag2)
{
((EnemyAI)this).SwitchToBehaviourState(1);
return;
}
}
}
base.agent.speed = 6f;
if (!searchForPlayers.inProgress)
{
base.movingTowardsTargetPlayer = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
}
break;
}
}
}
public override void Update()
{
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: 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)
//IL_0136: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
return;
}
if (timeSinceHittingPlayer >= 0f)
{
timeSinceHittingPlayer -= Time.deltaTime;
}
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
StartOfRound instance = StartOfRound.Instance;
if (currentBehaviourStateIndex == 0 || currentBehaviourStateIndex != 1)
{
return;
}
if (((NetworkBehaviour)this).IsOwner)
{
if (stopAndGoMinimumInterval > 0f)
{
stopAndGoMinimumInterval -= Time.deltaTime;
}
if (!wasOwnerLastFrame)
{
wasOwnerLastFrame = true;
if (!stoppingMovement && timeSinceHittingPlayer < 0.12f)
{
base.agent.speed = currentChaseSpeed;
}
else
{
base.agent.speed = 0f;
}
}
bool flag = false;
for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++)
{
PlayerControllerB val = instance.allPlayerScripts[i];
if (((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
{
bool flag2 = val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f, -1);
bool flag3 = Vector3.SqrMagnitude(((Component)val.gameplayCamera).transform.position - base.eye.position) > 0.09f;
if (flag2 && flag3)
{
flag = true;
}
}
}
if (base.stunNormalizedTimer > 0f)
{
flag = true;
}
if (flag != stoppingMovement && stopAndGoMinimumInterval <= 0f)
{
stopAndGoMinimumInterval = 0.15f;
if (flag)
{
SetAnimationStopServerRpc();
}
else
{
SetAnimationGoServerRpc();
}
stoppingMovement = flag;
}
}
if (stoppingMovement)
{
if (!animStopPoints.canAnimationStop)
{
return;
}
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (!hasStopped)
{
hasStopped = true;
if (localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 70f, 25, -1f, -1))
{
float num = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)localPlayerController).transform.position);
if (num < 16f)
{
localPlayerController.JumpToFearLevel(0.9f, true);
}
else if (num < 81f)
{
localPlayerController.JumpToFearLevel(0.4f, true);
}
}
if (currentAnimSpeed > 2f)
{
RoundManager.PlayRandomClip(base.creatureVoice, springNoises, false, 1f, 0, 1000);
if (animStopPoints.animationPosition == 1)
{
base.creatureAnimator.SetTrigger("springBoing");
}
else
{
base.creatureAnimator.SetTrigger("springBoingPosition2");
}
}
}
bool flag4 = Vector3.SqrMagnitude(((Component)localPlayerController).transform.position - ((Component)this).transform.position) > 0.0625f;
if (mainCollider.isTrigger && flag4)
{
mainCollider.isTrigger = false;
}
base.creatureAnimator.SetFloat("walkSpeed", 0f);
currentAnimSpeed = 0f;
if (((NetworkBehaviour)this).IsOwner)
{
base.agent.speed = 0f;
}
}
else
{
if (hasStopped)
{
hasStopped = false;
mainCollider.isTrigger = true;
}
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, 5f, 3f * Time.deltaTime);
base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
if (((NetworkBehaviour)this).IsOwner)
{
base.agent.speed = Mathf.Lerp(base.agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
}
}
}
[ServerRpc]
public void SetAnimationStopServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//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_00c2: 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(3882357060u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3882357060u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SetAnimationStopClientRpc();
}
}
[ClientRpc]
public void SetAnimationStopClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1023489990u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1023489990u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
stoppingMovement = true;
}
}
}
[ServerRpc]
public void SetAnimationGoServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//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_00c2: 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(1320084365u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1320084365u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SetAnimationGoClientRpc();
}
}
[ClientRpc]
public void SetAnimationGoClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3930434877u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3930434877u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
stoppingMovement = false;
}
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_006a: 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)
((EnemyAI)this).OnCollideWithPlayer(other);
if (!stoppingMovement && base.currentBehaviourStateIndex == 1 && !(timeSinceHittingPlayer >= 0f))
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
timeSinceHittingPlayer = 0.2f;
val.DamagePlayer(90, true, true, (CauseOfDeath)6, 1, false, default(Vector3));
val.JumpToFearLevel(1f, true);
}
}
}
[ClientRpc]
public void SyncKnightReplacementClientRpc(int index)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3956096293u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3956096293u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncKnightReplacement(index);
}
}
}
public void SyncKnightReplacement(int index)
{
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3882357060u, new RpcReceiveHandler(__rpc_handler_3882357060), "SetAnimationStopServerRpc");
((NetworkBehaviour)this).__registerRpc(1023489990u, new RpcReceiveHandler(__rpc_handler_1023489990), "SetAnimationStopClientRpc");
((NetworkBehaviour)this).__registerRpc(1320084365u, new RpcReceiveHandler(__rpc_handler_1320084365), "SetAnimationGoServerRpc");
((NetworkBehaviour)this).__registerRpc(3930434877u, new RpcReceiveHandler(__rpc_handler_3930434877), "SetAnimationGoClientRpc");
((NetworkBehaviour)this).__registerRpc(3956096293u, new RpcReceiveHandler(__rpc_handler_3956096293), "SyncKnightReplacementClientRpc");
((EnemyAI)this).__initializeRpcs();
}
private static void __rpc_handler_3882357060(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_0076: 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_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
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightVariant)(object)target).SetAnimationStopServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1023489990(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightVariant)(object)target).SetAnimationStopClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1320084365(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_0076: 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_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
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightVariant)(object)target).SetAnimationGoServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3930434877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightVariant)(object)target).SetAnimationGoClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3956096293(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
target.__rpc_exec_stage = (__RpcExecStage)1;
((KnightVariant)(object)target).SyncKnightReplacementClientRpc(index);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "KnightVariant";
}
}
public class KnightSpawnManager : MonoBehaviour, IDungeonCompleteReceiver
{
public List<KnightSpawnPoint> spawnPoints;
public List<KnightSpawnPoint> unusedSpawnPoints;
public int lastKnightSeenPlayer = -1;
public bool disableNextKnightSpecialSpawn;
public static KnightSpawnManager Instance { get; private set; }
private void Awake()
{
Instance = this;
}
public static bool WillSpawnOnSpawnPoint()
{
if (Object.op_Implicit((Object)(object)Instance))
{
return !Instance.disableNextKnightSpecialSpawn && Instance.spawnPoints.Count > 0;
}
return false;
}
public void OnDungeonComplete(Dungeon dungeon)
{
KnightSpawnPoint[] componentsInChildren = ((Component)dungeon).GetComponentsInChildren<KnightSpawnPoint>();
spawnPoints = componentsInChildren.ToList();
for (int i = 0; i < spawnPoints.Count; i++)
{
spawnPoints[i].index = i;
}
unusedSpawnPoints = componentsInChildren.ToList();
Plugin.logger.LogDebug((object)$"Found {spawnPoints.Count} spawn points for the knight");
}
public int GetSpawnPointIndex()
{
if (disableNextKnightSpecialSpawn)
{
disableNextKnightSpecialSpawn = true;
return -1;
}
if (unusedSpawnPoints.Count == 0)
{
return -1;
}
if (lastKnightSeenPlayer >= 0)
{
KnightSpawnPoint knightSpawnPoint = spawnPoints[lastKnightSeenPlayer];
if (((Component)knightSpawnPoint).gameObject.activeInHierarchy)
{
Plugin.logger.LogDebug((object)$"Using the last knight {knightSpawnPoint.index} that saw a player");
unusedSpawnPoints.Remove(knightSpawnPoint);
lastKnightSeenPlayer = -1;
return knightSpawnPoint.index;
}
}
int index = Random.Range(0, unusedSpawnPoints.Count);
KnightSpawnPoint knightSpawnPoint2 = unusedSpawnPoints[index];
unusedSpawnPoints.RemoveAt(index);
return knightSpawnPoint2.index;
}
public KnightSpawnPoint GetSpawnPoint(int index)
{
return spawnPoints[index];
}
public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, KnightSpawnPoint spawnPoint)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
SpawnEnemyOnSpawnPoint(enemyAI, ((Component)spawnPoint).transform.position, ((Component)spawnPoint).transform.rotation);
spawnPoint.OnStop();
}
public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, Vector3 position, Quaternion rotation)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0069: Unknown result type (might be due to invalid IL or missing references)
((Component)enemyAI).transform.position = position;
((Component)enemyAI).transform.rotation = rotation;
enemyAI.serverPosition = position;
if ((Object)(object)enemyAI.agent == (Object)null)
{
enemyAI.agent = ((Component)enemyAI).GetComponentInChildren<NavMeshAgent>();
}
enemyAI.agent.Warp(position);
if (((NetworkBehaviour)enemyAI).IsOwner)
{
enemyAI.SyncPositionToClients();
}
ScarletNetworkManager.Instance?.CreateSpawnAudioPrefabLocal(position);
}
}
public struct ScarletNetworkParams : INetworkSerializeByMemcpy
{
public int scrapValue;
public int specialValue;
}
public class ItemReference
{
public Item item;
public int itemId;
public int value;
public ItemReference(Item item, int itemId, int value)
{
this.item = item;
this.itemId = itemId;
this.value = value;
}
public override string ToString()
{
string arg = (Object.op_Implicit((Object)(object)item) ? ((Object)item).name : "NULL");
return $"{arg}:{itemId} ({value})";
}
}
public class EnemyReference
{
public EnemyType enemy;
public int index;
public EnemyReference(EnemyType enemy, int index)
{
this.enemy = enemy;
this.index = index;
}
public override string ToString()
{
string arg = (Object.op_Implicit((Object)(object)enemy) ? ((Object)enemy).name : "NULL");
return $"{arg}:{index}";
}
}
public class EnemyReferenceSpawnLogic : EnemyReference
{
public enum SpawnLogic
{
None,
Special
}
public SpawnLogic logic;
public EnemyReferenceSpawnLogic(EnemyType enemy, int index, SpawnLogic logic)
: base(enemy, index)
{
this.logic = logic;
}
public void ApplySpawnLogic()
{
if (logic != 0)
{
string text = ((Object)enemy).name.ToLowerInvariant();
if (text == "knight")
{
KnightSpawnManager.Instance.disableNextKnightSpecialSpawn = true;
}
else if (text == "jester")
{
JesterAIPatch.active = true;
}
}
}
public override string ToString()
{
string text = base.ToString();
return text + " [" + logic.ToString() + "]";
}
}
public class ScarletNetworkManager : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <WaitForEndOfFrameToUpdateItemInitialProperities>d__19 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GrabbableObject comp;
public ScarletNetworkManager <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForEndOfFrameToUpdateItemInitialProperities>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.UpdateItemInitialProperites(comp);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitForItem>d__14 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public NetworkBehaviourReference itemRef;
public Action<GrabbableObject> action;
public ScarletNetworkManager <>4__this;
private float <t>5__1;
private GrabbableObject <comp>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForItem>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<comp>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<t>5__1 = Time.realtimeSinceStartup + 8f;
goto IL_007e;
case 1:
<>1__state = -1;
if (Time.realtimeSinceStartup > <t>5__1)
{
Plugin.logger.LogError((object)"Failed to find network object (ITEM)");
return false;
}
goto IL_007e;
case 2:
{
<>1__state = -1;
action(<comp>5__2);
return false;
}
IL_007e:
if (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref <comp>5__2, (NetworkManager)null))
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitForItemAndPlayer>d__15 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public NetworkBehaviourReference itemRef;
public NetworkBehaviourReference playerRef;
public Action<GrabbableObject, PlayerControllerB> action;
public ScarletNetworkManager <>4__this;
private float <t>5__1;
private GrabbableObject <comp>5__2;
private PlayerControllerB <player>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForItemAndPlayer>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<comp>5__2 = null;
<player>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<t>5__1 = Time.realtimeSinceStartup + 8f;
goto IL_0087;
case 1:
<>1__state = -1;
if (Time.realtimeSinceStartup > <t>5__1)
{
Plugin.logger.LogError((object)"Failed to find network object (ITEM)");
return false;
}
goto IL_0087;
case 2:
<>1__state = -1;
if (Time.realtimeSinceStartup > <t>5__1)
{
Plugin.logger.LogError((object)"Failed to find network object (PLAYER)");
return false;
}
goto IL_00df;
case 3:
{
<>1__state = -1;
action(<comp>5__2, <player>5__3);
return false;
}
IL_00df:
if (!((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref <player>5__3, (NetworkManager)null))
{
<>2__current = null;
<>1__state = 2;
return true;
}
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 3;
return true;
IL_0087:
if (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref <comp>5__2, (NetworkManager)null))
{
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_00df;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ScarletNetworkManager Instance { get; private set; }
private void Awake()
{
Instance = this;
}
[ServerRpc(RequireOwnership = false)]
public void DestroyPlayerItemInSlotServerRpc(NetworkBehaviourReference playerRef, int itemSlot, ServerRpcParams callParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_012f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3412664016u, callParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val, itemSlot);
((NetworkBehaviour)this).__endSendServerRpc(ref val, 3412664016u, callParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB val2 = default(PlayerControllerB);
if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val2, (NetworkManager)null))
{
Plugin.logger.LogDebug((object)$"P{((NetworkBehaviour)val2).OwnerClientId}, S{callParams.Receive.SenderClientId}");
DestroyPlayerItemInSlotClientRpc(playerRef, itemSlot);
}
else
{
Plugin.logger.LogError((object)"Error trying to get player script (SERVERRPC)");
}
}
}
[ClientRpc]
public void DestroyPlayerItemInSlotClientRpc(NetworkBehaviourReference playerRef, int itemSlot)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(345840887u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, itemSlot);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 345840887u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB val3 = default(PlayerControllerB);
if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null) && !((NetworkBehaviour)val3).IsOwner)
{
val3.DestroyPlayerItemInSlot_SDM(itemSlot);
}
else if ((Object)(object)val3 == (Object)null)
{
Plugin.logger.LogError((object)"Error trying to get player script (CLIENTRPC)");
}
}
}
[ServerRpc(RequireOwnership = false)]
public void CreateItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4119288164u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4119288164u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
CreateItem(itemId, fromScrapArray: false, position, null, callParams);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void CreateItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1939319057u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1939319057u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB player = default(PlayerControllerB);
((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null);
CreateItem(itemId, fromScrapArray: false, position, player, callParams);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void CreateScrapItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1250011204u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1250011204u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
CreateItem(itemId, fromScrapArray: true, position, null, callParams);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void CreateScrapItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3991430686u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemId);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3991430686u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB player = default(PlayerControllerB);
((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null);
CreateItem(itemId, fromScrapArray: true, position, player, callParams);
}
}
}
private void CreateItem(int itemId, bool fromScrapArray, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
GameObject prefab = ((!fromScrapArray) ? StartOfRound.Instance.allItemsList.itemsList[itemId].spawnPrefab : Utility.GetDungeonItems()[itemId].spawnableItem.spawnPrefab);
GrabbableObject val = CreateGrabbableObject(prefab, player, position);
((MonoBehaviour)this).StartCoroutine(WaitForEndOfFrameToUpdateItemInitialProperities(val));
UpdateItemFallingProperites(val, position);
UpdateItemElevator(val, player);
if (val is IScarletItem scarletItem)
{
scarletItem.UpdateSpecialProperties(callParams.specialValue);
}
int scrapValue = callParams.scrapValue;
if (scrapValue > 0)
{
UpdateItemValueProperties(val, scrapValue);
}
((NetworkBehaviour)val).NetworkObject.Spawn(false);
if ((Object)(object)player == (Object)null)
{
CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, callParams);
}
else
{
CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)player), callParams);
}
}
[ClientRpc]
public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_00a5: 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_00bf: 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_0117: 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_0133: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3004287685u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3004287685u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
Vector3 position2 = position;
ScarletNetworkParams callParams2 = callParams;
if (!((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(WaitForItem(itemRef, delegate(GrabbableObject c)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
CreateItem(c, position2, null, callParams2);
}));
}
}
[ClientRpc]
public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: 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_00a5: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: 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_0150: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2816052745u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2816052745u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
Vector3 position2 = position;
ScarletNetworkParams callParams2 = callParams;
if (!((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(WaitForItemAndPlayer(itemRef, playerRef, delegate(GrabbableObject c, PlayerControllerB p)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
CreateItem(c, position2, p, callParams2);
}));
}
}
[IteratorStateMachine(typeof(<WaitForItem>d__14))]
private IEnumerator WaitForItem(NetworkBehaviourReference itemRef, Action<GrabbableObject> action)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForItem>d__14(0)
{
<>4__this = this,
itemRef = itemRef,
action = action
};
}
[IteratorStateMachine(typeof(<WaitForItemAndPlayer>d__15))]
private IEnumerator WaitForItemAndPlayer(NetworkBehaviourReference itemRef, NetworkBehaviourReference playerRef, Action<GrabbableObject, PlayerControllerB> action)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForItemAndPlayer>d__15(0)
{
<>4__this = this,
itemRef = itemRef,
playerRef = playerRef,
action = action
};
}
private void CreateItem(GrabbableObject item, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams))
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
UpdateItemFallingProperites(item, position);
UpdateItemElevator(item, player);
if (item is IScarletItem scarletItem)
{
scarletItem.UpdateSpecialProperties(callParams.specialValue);
}
int scrapValue = callParams.scrapValue;
if (scrapValue > 0)
{
UpdateItemValueProperties(item, scrapValue);
}
}
private GrabbableObject CreateGrabbableObject(GameObject prefab, PlayerControllerB player, Vector3 position)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Transform itemSpawnTransform = GetItemSpawnTransform(player);
GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity, itemSpawnTransform);
return val.GetComponent<GrabbableObject>();
}
private Transform GetItemSpawnTransform(PlayerControllerB player)
{
if ((((Object)(object)player != (Object)null && player.isInElevator) || StartOfRound.Instance.inShipPhase) && (Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)
{
return RoundManager.Instance.spawnedScrapContainer;
}
return StartOfRound.Instance.elevatorTransform;
}
[IteratorStateMachine(typeof(<WaitForEndOfFrameToUpdateItemInitialProperities>d__19))]
private IEnumerator WaitForEndOfFrameToUpdateItemInitialProperities(GrabbableObject comp)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForEndOfFrameToUpdateItemInitialProperities>d__19(0)
{
<>4__this = this,
comp = comp
};
}
private void UpdateItemInitialProperites(GrabbableObject comp)
{
comp.reachedFloorTarget = false;
comp.hasHitGround = false;
comp.fallTime = 0f;
}
private void UpdateItemFallingProperites(GrabbableObject comp, Vector3 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
comp.startFallingPosition = position;
comp.targetFloorPosition = comp.GetItemFloorPosition(position);
}
private void UpdateItemValueProperties(GrabbableObject comp, int value)
{
comp.SetScrapValue(value);
RoundManager instance = RoundManager.Instance;
instance.totalScrapValueInLevel += (float)value;
}
private void UpdateItemElevator(GrabbableObject comp, PlayerControllerB player)
{
if ((Object)(object)player != (Object)null && player.isInHangarShipRoom)
{
player.SetItemInElevator(true, true, comp);
}
}
public void RequestEvilSkinApply(NetworkObjectReference reference, string enemyName)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if (SyncedInstance<ConfigMain>.Instance.paintingEnemyEvilSkinValue && ScarletBedroom.ENEMY_EVIL_LIST.Contains(enemyName))
{
RequestEvilSkinApplyClientRpc(reference);
}
}
[ClientRpc]
public void RequestEvilSkinApplyClientRpc(NetworkObjectReference reference)
{
//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)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(112037380u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 112037380u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val3 = default(NetworkObject);
if (!((NetworkObjectReference)(ref reference)).TryGet(ref val3, (NetworkManager)null))
{
return;
}
EnemyAI componentInParent = ((Component)val3).GetComponentInParent<EnemyAI>();
if ((Object)(object)componentInParent == (Object)null)
{
return;
}
string name = ((Object)componentInParent).name;
try
{
Plugin.logger.LogDebug((object)("Applying evil material to " + name));
ApplyMaterialToRenderers<SkinnedMeshRenderer>(((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>());
ApplyMaterialToRenderers<MeshRenderer>(((Component)componentInParent).GetComponentsInChildren<MeshRenderer>());
}
catch (Exception ex)
{
Plugin.logger.LogWarning((object)("Failed to apply evil material to " + name));
Plugin.logger.LogWarning((object)ex.ToString());
}
static void ApplyMaterialToRenderers<T>(T[] renderers) where T : Renderer
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
foreach (T val4 in renderers)
{
Material[] materials = ((Renderer)val4).materials;
for (int j = 0; j < materials.Length; j++)
{
Material val5 = new Material(Assets.networkObjectList.ghostMaterial);
val5.mainTexture = materials[j].mainTexture;
materials[j] = val5;
}
((Renderer)val4).materials = materials;
}
}
}
public void CreateSpawnAudioPrefab(Vector3 positon, ulong playerId)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
CreateSpawnAudioPrefabServerRpc(positon, playerId);
CreateSpawnAudioPrefabLocal(positon);
}
[ServerRpc(RequireOwnership = false)]
public void CreateSpawnAudioPrefabServerRpc(Vector3 position, ulong playerId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and