Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of JengChatHQ v0.2.1
JengChatHQ.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using JengChatHQ.Dealer; using JengChatHQ.Fixes; using JengChatHQ.Interior; using JengChatHQ.JengGPT; using JengChatHQ.Knight; using JengChatHQ.LootBug; using JengChatHQ.NetcodePatcher; using JengChatHQ.Scrap; using LethalLevelLoader; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JengChatHQ")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyInformationalVersion("0.2.1+bb28e3d3291e5276fb35b716c3a7025b33801de3")] [assembly: AssemblyProduct("JengChatHQ")] [assembly: AssemblyTitle("JengChatHQ")] [assembly: AssemblyVersion("0.2.1.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JengChatHQ { [BepInPlugin("jeng.jengchathq", "JengChatHQ", "0.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal class Runner : MonoBehaviour { } public const string Guid = "jeng.jengchathq"; public const string Name = "JengChatHQ"; public const string Version = "0.2.1"; internal static ManualLogSource Log; internal static Runner Coroutines; internal static ConfigEntry<int> JengGPTRarity; internal static ConfigEntry<int> JengGPTMaxCount; internal static ConfigEntry<int> JengGPTHealth; internal static ConfigEntry<float> JengGPTChaseSpeed; internal static ConfigEntry<float> JengGPTRetreatMin; internal static ConfigEntry<float> JengGPTRetreatMax; internal static ConfigEntry<float> JengGPTRetreatSpeed; internal static ConfigEntry<float> JengGPTGiveUpSeconds; internal static ConfigEntry<float> JengGPTDriftAfter; internal static ConfigEntry<float> JengGPTHearingRange; internal static ConfigEntry<float> DealerTurnSeconds; internal static ConfigEntry<float> DealerLeaveDistance; internal static ConfigEntry<int> DealerMaxBet; internal static ConfigEntry<int> InteriorExperimentationWeight; internal static ConfigEntry<int> InteriorOtherMoonsWeight; internal static ConfigEntry<float> ThemeVolume; internal static ConfigEntry<float> ThemeHearDistance; internal static ConfigEntry<float> JengGPTHeight; internal static ConfigEntry<int> ScrapRarity; internal static ConfigEntry<bool> JengGPTAlwaysInHQ; internal static ConfigEntry<bool> LootBugPhotoOn; internal static ConfigEntry<int> KnightMovesPerHunt; internal static ConfigEntry<float> JengGPTArrivesAfter; internal static ConfigEntry<float> KnightSpawnChance; internal static ConfigEntry<float> KnightStepDistance; internal static ConfigEntry<float> KnightWakeDistance; internal static ConfigEntry<float> KnightLoseDistance; internal static ConfigEntry<float> KnightStunSeconds; internal static ConfigEntry<bool> ScrapOnlyInHQ; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; GameObject val = new GameObject("JengChatHQ Runner") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); Coroutines = val.AddComponent<Runner>(); JengGPTRarity = ((BaseUnityPlugin)this).Config.Bind<int>("JengGPT", "Rarity", 40, "Spawn weight inside every interior (vanilla enemies are roughly 1-100)."); JengGPTAlwaysInHQ = ((BaseUnityPlugin)this).Config.Bind<bool>("JengGPT", "AlwaysInJengChatHQ", true, "True: every JengChat HQ interior gets one JengGPT, whatever the game's own spawning picks. Elsewhere he depends on Rarity."); JengGPTArrivesAfter = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "ArrivesAfterSeconds", 60f, "With AlwaysInJengChatHQ: about how long after the ship lands he appears, far from the players (the real delay is 60-140% of this)."); JengGPTMaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("JengGPT", "MaxCount", 1, "Most JengGPTs at once."); JengGPTHealth = ((BaseUnityPlugin)this).Config.Bind<int>("JengGPT", "Health", 7, "Hits to kill (a shovel hit is 1). He never heals."); JengGPTChaseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "ChaseSpeed", 9.8f, "Chase speed. A player walks at about 4.6 and sprints at about 10.3, so this is just under a sprint."); JengGPTGiveUpSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "GiveUpSeconds", 20f, "He drops a chase after this long without seeing his target."); JengGPTDriftAfter = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "DriftAfterSeconds", 40f, "After roaming this long without seeing anyone, he moves his search to the nearest player inside."); JengGPTHearingRange = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "HearingRange", 18f, "How far away he hears an ordinary noise while roaming (meters). Louder noises carry farther. 0 makes him deaf."); JengGPTRetreatMin = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "RetreatMinSeconds", 10f, "After a roll he runs as far from the players as he can for at least this long."); JengGPTRetreatMax = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "RetreatMaxSeconds", 15f, "...and at most this long. Then he hunts again; there is no other grab cooldown."); JengGPTRetreatSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "RetreatSpeed", 9.8f, "How fast he runs off after a roll."); JengGPTHeight = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "Height", 2.7f, "How tall he stands in meters. A player is about 2.5."); ThemeVolume = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "ThemeVolume", 1f, "Volume of the JengChat theme, which plays while he chases or holds someone (0 turns it off)."); ThemeHearDistance = ((BaseUnityPlugin)this).Config.Bind<float>("JengGPT", "ThemeHearDistance", 50f, "How far away you can faintly hear the chase theme (meters)."); DealerMaxBet = ((BaseUnityPlugin)this).Config.Bind<int>("Dealer", "MaxBet", 400, "The most a piece of scrap can be worth to bet it."); DealerTurnSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Dealer", "TurnSeconds", 20f, "Seconds to choose hit or stand before he counts it as a stand."); DealerLeaveDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Dealer", "LeaveDistance", 9f, "Walk this far from the table mid-hand and you forfeit the scrap (meters)."); InteriorExperimentationWeight = ((BaseUnityPlugin)this).Config.Bind<int>("InteriorOdds", "Experimentation", -1, "How strongly Experimentation picks the JengChat HQ interior. -1 = as much as all the game's interiors there put together, which is a 50/50 chance. 0 = never. The game's main interior weighs 300."); InteriorOtherMoonsWeight = ((BaseUnityPlugin)this).Config.Bind<int>("InteriorOdds", "OtherMoons", 150, "The same for every other moon. 0 = never. 150 is roughly one landing in three on most moons. Every player needs the same values."); ScrapRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Rarity", 35, "Spawn weight of each JengChat HQ scrap item (golden balloon, party die, melon, chips, golden king, top hat, mug). The game's own scrap weighs roughly 5-100 each. 0 = never."); ScrapOnlyInHQ = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap", "OnlyInJengChatHQ", true, "True: these items are only found inside the JengChat HQ interior. False: in every interior."); KnightSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Knight", "SpawnChance", 1f, "Chance (0-1) that the chess hall, when the interior has one, holds the Knight."); KnightStepDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Knight", "MetersPerJump", 5f, "The Knight jumps once each time its target has travelled this far (meters). A jump covers about 4 m, so above 4 a player walking straight off gains on it, and lower is deadlier."); KnightMovesPerHunt = ((BaseUnityPlugin)this).Config.Bind<int>("Knight", "MovesPerHunt", 10, "It gives up a hunt after this many jumps without a capture, rests, and returns to its square when nobody is near."); KnightWakeDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Knight", "WakeDistance", 7f, "Moving within this distance of the statue, in its line of sight, wakes it (meters)."); KnightLoseDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Knight", "GiveUpDistance", 20f, "It gives up on a target farther away than this and becomes a statue again (meters)."); KnightStunSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Knight", "StunSeconds", 6f, "How long a hit stops it. It cannot be killed."); LootBugPhotoOn = ((BaseUnityPlugin)this).Config.Bind<bool>("LootBug", "PhotoFace", true, "True: the Hoarding bug is shown as the photo (built in, or lootbug.png next to the DLL) in place of its own model."); InitNetcodePatcher(); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); VoiceLines.LoadAll((MonoBehaviour)(object)Coroutines, directoryName); JengAssets.Load(directoryName); LootBugPhoto.Load(directoryName); JengGPTBuilder.BuildAndRegister(); DealerBuilder.BuildAndRegister(); JengScrap.BuildAndRegister(); KnightBuilder.BuildAndRegister(); RegisterInterior(); Harmony val2 = new Harmony("jeng.jengchathq"); val2.PatchAll(typeof(DealerSpotPatch)); val2.PatchAll(typeof(ScrapBorrowPatch)); val2.PatchAll(typeof(KnightSpotPatch)); val2.PatchAll(typeof(JengGPTHomePatch)); val2.PatchAll(typeof(LootBugPatch)); val2.PatchAll(typeof(ScrapSpawnPatch)); val2.PatchAll(typeof(DeathCauseFix)); Log.LogInfo((object)"JengChatHQ 0.2.1 loaded."); } private static void RegisterInterior() { if ((Object)(object)JengAssets.InteriorFlow == (Object)null) { Log.LogWarning((object)"The asset bundle has no interior: JengChat HQ is not registered."); return; } if (!Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader")) { Log.LogWarning((object)"LethalLevelLoader is not installed: the JengChat HQ interior is not registered."); return; } try { RegisterInteriorWithLoader(); } catch (Exception ex) { Log.LogError((object)("Couldn't register the JengChat HQ interior: " + ex)); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterInteriorWithLoader() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown JengInteriorLoader.Register((DungeonFlow)JengAssets.InteriorFlow); } private static void InitNetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace JengChatHQ.Scrap { public static class JengScrap { private class Def { public string id; public string name; public int min; public int max; public float pounds; public bool twoHanded; public bool metal; public bool small; } private static readonly Def[] Defs = new Def[7] { new Def { id = "GoldenBalloon", name = "Golden balloon", min = 45, max = 95, pounds = 0f, small = false }, new Def { id = "PartyDie", name = "Party die", min = 28, max = 60, pounds = 4f, small = true }, new Def { id = "Melon", name = "Festival melon", min = 50, max = 100, pounds = 24f, twoHanded = true }, new Def { id = "ChipStack", name = "Casino chips", min = 20, max = 52, pounds = 2f, small = true }, new Def { id = "GoldenKing", name = "Golden king", min = 80, max = 140, pounds = 16f, metal = true, small = true }, new Def { id = "TopHat", name = "JengGPT's spare hat", min = 30, max = 70, pounds = 1f, small = false }, new Def { id = "JengMug", name = "JengChat mug", min = 12, max = 36, pounds = 3f, small = true } }; private const float GameValueScale = 0.4f; public static readonly List<Item> All = new List<Item>(); private static readonly Dictionary<Item, Def> DefOf = new Dictionary<Item, Def>(); public static void BuildAndRegister() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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) Def[] defs = Defs; foreach (Def def in defs) { GameObject val = JengAssets.ItemModel(def.id); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)("Bundle has no model for scrap '" + def.id + "': skipped.")); continue; } GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("JengScrap" + def.id); GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "Model"; val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; int layer = LayerMask.NameToLayer("Props"); Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(true); for (int j = 0; j < componentsInChildren.Length; j++) { ((Component)componentsInChildren[j]).gameObject.layer = layer; } val2.tag = "PhysicsProp"; Bounds val4 = default(Bounds); bool flag = true; MeshFilter[] componentsInChildren2 = val3.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val5 in componentsInChildren2) { if ((Object)(object)val5.sharedMesh == (Object)null) { continue; } Matrix4x4 val6 = val2.transform.worldToLocalMatrix * ((Component)val5).transform.localToWorldMatrix; Bounds bounds = val5.sharedMesh.bounds; for (int k = 0; k < 8; k++) { Vector3 val7 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((k & 1) != 0) ? 1 : (-1)), (float)(((k & 2) != 0) ? 1 : (-1)), (float)(((k & 4) != 0) ? 1 : (-1)))); Vector3 val8 = ((Matrix4x4)(ref val6)).MultiplyPoint3x4(val7); if (flag) { ((Bounds)(ref val4))..ctor(val8, Vector3.zero); flag = false; } else { ((Bounds)(ref val4)).Encapsulate(val8); } } } BoxCollider obj = val2.AddComponent<BoxCollider>(); obj.center = ((Bounds)(ref val4)).center; obj.size = Vector3.Max(((Bounds)(ref val4)).size, Vector3.one * 0.08f); AudioSource obj2 = val2.AddComponent<AudioSource>(); obj2.playOnAwake = false; obj2.spatialBlend = 1f; obj2.rolloffMode = (AudioRolloffMode)1; obj2.minDistance = 2f; obj2.maxDistance = 16f; Item val9 = ScriptableObject.CreateInstance<Item>(); ((Object)val9).name = "JengScrap" + def.id; val9.itemName = def.name; val9.isScrap = true; val9.minValue = Mathf.RoundToInt((float)def.min / 0.4f); val9.maxValue = Mathf.RoundToInt((float)def.max / 0.4f); val9.weight = 1f + def.pounds / 105f; val9.twoHanded = def.twoHanded; val9.twoHandedAnimation = def.twoHanded; val9.isConductiveMetal = def.metal; val9.requiresBattery = false; val9.itemSpawnsOnGround = true; val9.restingRotation = Vector3.zero; val9.verticalOffset = 0f; val9.positionOffset = new Vector3(0f, 0.08f, def.twoHanded ? 0.3f : 0.12f); val9.rotationOffset = Vector3.zero; val9.grabAnim = (def.twoHanded ? "HoldLung" : ""); val9.useAnim = ""; val9.pocketAnim = ""; val9.throwAnim = ""; val9.toolTips = new string[0]; val9.meshVariants = (Mesh[])(object)new Mesh[0]; val9.materialVariants = (Material[])(object)new Material[0]; val9.clinkAudios = (AudioClip[])(object)new AudioClip[0]; val9.spawnPositionTypes = new List<ItemGroup>(); val9.spawnPrefab = val2; PhysicsProp obj3 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)obj3).itemProperties = val9; ((GrabbableObject)obj3).grabbable = true; ((GrabbableObject)obj3).grabbableToEnemies = true; ((GrabbableObject)obj3).mainObjectRenderer = val3.GetComponentInChildren<MeshRenderer>(true); GameObject val10 = new GameObject("ScanNode"); val10.transform.SetParent(val2.transform, false); val10.transform.localPosition = ((Bounds)(ref val4)).center; val10.layer = LayerMask.NameToLayer("ScanNode"); val10.AddComponent<BoxCollider>().size = Vector3.one * 0.3f; ScanNodeProperties obj4 = val10.AddComponent<ScanNodeProperties>(); obj4.headerText = def.name; obj4.subText = "Value: "; obj4.nodeType = 2; obj4.minRange = 1; obj4.maxRange = 13; obj4.requiresLineOfSight = true; Items.RegisterItem(val9); All.Add(val9); DefOf[val9] = def; } Plugin.Log.LogInfo((object)$"Registered {All.Count} JengChat HQ scrap items."); } internal static void BorrowFromGame(StartOfRound round) { if (All.Count == 0 || (Object)(object)round.allItemsList == (Object)null) { return; } List<Item> list = round.allItemsList.itemsList.Where((Item i) => (Object)(object)i != (Object)null && !All.Contains(i)).ToList(); Item val = ((IEnumerable<Item>)list).FirstOrDefault((Func<Item, bool>)((Item i) => i.isScrap && (Object)(object)i.itemIcon != (Object)null && (Object)(object)i.grabSFX != (Object)null && (Object)(object)i.dropSFX != (Object)null)); Dictionary<string, ItemGroup> groups = new Dictionary<string, ItemGroup>(); foreach (Item item in list) { if (item.spawnPositionTypes == null) { continue; } foreach (ItemGroup spawnPositionType in item.spawnPositionTypes) { if ((Object)(object)spawnPositionType != (Object)null && !groups.ContainsKey(((Object)spawnPositionType).name)) { groups[((Object)spawnPositionType).name] = spawnPositionType; } } } foreach (Item item2 in All) { if ((Object)(object)val != (Object)null) { if ((Object)(object)item2.itemIcon == (Object)null) { item2.itemIcon = val.itemIcon; } if ((Object)(object)item2.grabSFX == (Object)null) { item2.grabSFX = val.grabSFX; } if ((Object)(object)item2.dropSFX == (Object)null) { item2.dropSFX = val.dropSFX; } if ((Object)(object)item2.pocketSFX == (Object)null) { item2.pocketSFX = val.pocketSFX; } } string[] source = (DefOf[item2].small ? new string[3] { "GeneralItemClass", "SmallItems", "TabletopItems" } : new string[1] { "GeneralItemClass" }); item2.spawnPositionTypes = (from n in source.Where(groups.ContainsKey) select groups[n]).ToList(); } } internal static bool InJengChatHQ(RoundManager round) { DungeonFlow val = (((Object)(object)round.dungeonGenerator != (Object)null) ? round.dungeonGenerator.Generator : null)?.DungeonFlow; if ((Object)(object)val != (Object)null) { if ((object)val != JengAssets.InteriorFlow) { return ((Object)val).name == "JengChatHQFlow"; } return true; } return false; } } [HarmonyPatch(typeof(StartOfRound), "Awake")] internal static class ScrapBorrowPatch { private static void Postfix(StartOfRound __instance) { JengScrap.BorrowFromGame(__instance); } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] internal static class ScrapSpawnPatch { private static readonly List<SpawnableItemWithRarity> added = new List<SpawnableItemWithRarity>(); private static void Prefix(RoundManager __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown added.Clear(); int value = Plugin.ScrapRarity.Value; if (value <= 0 || (Object)(object)__instance.currentLevel == (Object)null || JengScrap.All.Count == 0) { return; } bool flag; try { flag = JengScrap.InJengChatHQ(__instance); } catch { flag = false; } if (!flag && Plugin.ScrapOnlyInHQ.Value) { return; } foreach (Item item2 in JengScrap.All) { SpawnableItemWithRarity item = new SpawnableItemWithRarity(item2, value); __instance.currentLevel.spawnableScrap.Add(item); added.Add(item); } Plugin.Log.LogInfo((object)$"Added {added.Count} JengChat HQ scrap items to this level's scrap (rarity {value} each)."); } private static void Finalizer(RoundManager __instance) { if ((Object)(object)__instance.currentLevel != (Object)null) { foreach (SpawnableItemWithRarity item in added) { __instance.currentLevel.spawnableScrap.Remove(item); } } added.Clear(); } } } namespace JengChatHQ.LootBug { public static class LootBugPhoto { private static Mesh oval; private static Material material; public static Texture2D Photo { get; private set; } public static void Load(string pluginDir) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown byte[] array = null; string path = Path.Combine(pluginDir, "lootbug.png"); if (File.Exists(path)) { array = File.ReadAllBytes(path); } else { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("lootbug.png"); if (stream != null) { array = new byte[stream.Length]; stream.Read(array, 0, array.Length); } } if (array == null) { Plugin.Log.LogWarning((object)"No loot bug photo: the Hoarding bug keeps its own look."); return; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, array)) { Plugin.Log.LogWarning((object)"Couldn't read the loot bug photo."); return; } ((Object)val).name = "LootBugPhoto"; ((Texture)val).wrapMode = (TextureWrapMode)1; Object.DontDestroyOnLoad((Object)(object)val); Photo = val; } internal static Material Material() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)material != (Object)null) { return material; } material = new Material(Shader.Find("HDRP/Lit") ?? Shader.Find("Standard")) { name = "LootBugPhoto" }; if (material.HasProperty("_BaseColorMap")) { material.SetTexture("_BaseColorMap", (Texture)(object)Photo); } material.mainTexture = (Texture)(object)Photo; if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", Color.white); } if (material.HasProperty("_Smoothness")) { material.SetFloat("_Smoothness", 0.1f); } Object.DontDestroyOnLoad((Object)(object)material); return material; } internal static Mesh Oval() { //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)oval != (Object)null) { return oval; } Vector3[] array = (Vector3[])(object)new Vector3[82]; Vector3[] array2 = (Vector3[])(object)new Vector3[array.Length]; Vector2[] array3 = (Vector2[])(object)new Vector2[array.Length]; int[] array4 = new int[240]; for (int i = 0; i < 2; i++) { int num = i * 41; float num2 = ((i == 0) ? (-1f) : 1f); array[num] = Vector3.zero; array2[num] = ((i == 0) ? Vector3.forward : Vector3.back); array3[num] = new Vector2(0.5f, 0.5f); for (int j = 0; j < 40; j++) { float num3 = (float)j * MathF.PI * 2f / 40f; array[num + 1 + j] = new Vector3(Mathf.Cos(num3) * 0.5f, Mathf.Sin(num3) * 0.5f, 0f); array2[num + 1 + j] = array2[num]; array3[num + 1 + j] = new Vector2(0.5f + num2 * Mathf.Cos(num3) * 0.5f, 0.5f + Mathf.Sin(num3) * 0.5f); int num4 = num + 1 + (j + 1) % 40; int num5 = (i * 40 + j) * 3; array4[num5] = num; array4[num5 + 1] = ((i == 0) ? (num + 1 + j) : num4); array4[num5 + 2] = ((i == 0) ? num4 : (num + 1 + j)); } } oval = new Mesh { name = "LootBugOval", vertices = array, normals = array2, uv = array3, triangles = array4 }; oval.RecalculateBounds(); Object.DontDestroyOnLoad((Object)(object)oval); return oval; } } [HarmonyPatch(typeof(HoarderBugAI), "Start")] internal static class LootBugPatch { private static void Postfix(HoarderBugAI __instance) { if (Plugin.LootBugPhotoOn.Value && !((Object)(object)LootBugPhoto.Photo == (Object)null) && (Object)(object)((Component)__instance).GetComponent<LootBugFace>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<LootBugFace>().bug = (EnemyAI)(object)__instance; } } } public class LootBugFace : MonoBehaviour { public EnemyAI bug; private Transform face; private Vector3 scale = Vector3.one; private void Start() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.NameToLayer("MapRadar"); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (((Component)val).gameObject.layer != num && (val is SkinnedMeshRenderer || val is MeshRenderer)) { val.forceRenderingOff = true; } } GameObject val2 = new GameObject("PhotoFace"); val2.layer = LayerMask.NameToLayer("Enemies"); face = val2.transform; face.SetParent(((Component)this).transform, false); Vector3 lossyScale = ((Component)this).transform.lossyScale; scale = new Vector3(Mathf.Max(Mathf.Abs(lossyScale.x), 0.001f), Mathf.Max(Mathf.Abs(lossyScale.y), 0.001f), Mathf.Max(Mathf.Abs(lossyScale.z), 0.001f)); face.localPosition = new Vector3(0f, 0.75f / scale.y, 0f); face.localScale = new Vector3(0.9f / scale.x, 1.15f / scale.y, 1f / scale.z); Plugin.Log.LogInfo((object)$"Loot bug photo on; the bug's own scale is {lossyScale}."); val2.AddComponent<MeshFilter>().sharedMesh = LootBugPhoto.Oval(); ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = LootBugPhoto.Material(); } private void LateUpdate() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)face == (Object)null) { return; } if ((Object)(object)bug != (Object)null && bug.isEnemyDead) { face.localPosition = new Vector3(0f, 0.06f / scale.y, 0f); face.localRotation = Quaternion.Euler(-90f, 0f, 0f); return; } Camera val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.activeCamera : null); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = Vector3.ProjectOnPlane(((Component)val).transform.position - face.position, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { face.rotation = Quaternion.LookRotation(val2); } } } } } namespace JengChatHQ.Knight { public class KnightAI : EnemyAI { public const int StateStatue = 0; public const int StateHunt = 1; private const float Square = 2f; private const float WindUpSeconds = 0.6f; private const float JumpSeconds = 0.36f; private const float JumpHeight = 1.5f; private const float CaptureRadius = 1.3f; private const float RestSeconds = 15f; public Transform model; public Renderer[] eyes = (Renderer[])(object)new Renderer[0]; public Transform mark; private readonly Vector3[] lastSeenAt = (Vector3[])(object)new Vector3[64]; private float sampleAt; private float travelled; private float stunnedUntil; private float deafUntil; private Vector3 targetLast; private Vector3 targetVelocity; private bool jumping; private int movesLeft; private float returnAt; private bool eyesOn = true; private PlayerControllerB touchMove; private NavMeshPath route; private static bool tipShown; private static readonly FieldInfo YawField = AccessTools.Field(typeof(EnemyAI), "targetYRotation"); private Bounds home; private bool hasHome; private Vector3 homeSpot; private float homeYaw; private bool Stunned { get { if (!(Time.time < stunnedUntil)) { return base.stunNormalizedTimer > 0f; } return true; } } public override void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = (HideFlags)0; } ((EnemyAI)this).Start(); route = new NavMeshPath(); deafUntil = Time.time + 3f; SetEyes(on: false); if ((Object)(object)mark != (Object)null) { ((Component)mark).gameObject.SetActive(false); } } public override void DoAIInterval() { if ((Object)(object)StartOfRound.Instance == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } } public override void Update() { //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); SetEyes(base.currentBehaviourStateIndex == 1 && !Stunned); if (!((NetworkBehaviour)this).IsServer || (Object)(object)StartOfRound.Instance == (Object)null || base.isEnemyDead) { return; } if (base.currentBehaviourStateIndex == 0) { if (Time.time < sampleAt) { return; } sampleAt = Time.time + 0.25f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; for (int i = 0; i < allPlayerScripts.Length && i < lastSeenAt.Length; i++) { PlayerControllerB val = allPlayerScripts[i]; if (!((Object)(object)val == (Object)null)) { float num = Vector3.Distance(((Component)val).transform.position, lastSeenAt[i]); lastSeenAt[i] = ((Component)val).transform.position; if (!(num < 0.2f) && !(num > 3f) && !(Time.time < deafUntil) && !Stunned && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true) && Notices(val)) { Hunt(val); return; } } } GoHomeUnseen(); return; } if ((Object)(object)touchMove != (Object)null && !Stunned) { PlayerControllerB val2 = touchMove; touchMove = null; if (((EnemyAI)this).PlayerIsTargetable(val2, false, false, true) && (Object)(object)val2 != (Object)(object)base.targetPlayer) { Hunt(val2); return; } } if ((Object)(object)base.targetPlayer == (Object)null || !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true) || Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) > Plugin.KnightLoseDistance.Value) { if (!jumping) { BecomeStatue(rest: false); } return; } Vector3 position = ((Component)base.targetPlayer).transform.position; float num2 = Vector3.Distance(position, targetLast); if (num2 < 3f && Time.deltaTime > 0f) { if (!Stunned) { travelled = Mathf.Min(travelled + num2, Plugin.KnightStepDistance.Value * 2f); } targetVelocity = Vector3.Lerp(targetVelocity, (position - targetLast) / Time.deltaTime, 0.25f); } targetLast = position; if (!jumping && !Stunned && !(travelled < Plugin.KnightStepDistance.Value)) { travelled -= Plugin.KnightStepDistance.Value; Jump(); } } private bool Notices(PlayerControllerB p) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (hasHome && InHome(((Component)this).transform.position) && InHome(((Component)p).transform.position)) { return true; } Vector3 val = ((Component)this).transform.position + Vector3.up * 2.2f; Vector3 position = ((Component)p.gameplayCamera).transform.position; if (Vector3.Distance(val, position) > Plugin.KnightWakeDistance.Value) { return false; } return !Physics.Linecast(val, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } public void SetHome(Bounds room) { //IL_0011: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((Bounds)(ref room)).Expand(new Vector3(-1.5f, 0f, -1.5f)); home = room; hasHome = true; homeSpot = ((Component)this).transform.position; homeYaw = ((Component)this).transform.eulerAngles.y; } private bool InHome(Vector3 at) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) if (Mathf.Abs(at.x - ((Bounds)(ref home)).center.x) <= ((Bounds)(ref home)).extents.x && Mathf.Abs(at.z - ((Bounds)(ref home)).center.z) <= ((Bounds)(ref home)).extents.z) { return Mathf.Abs(at.y - ((Component)this).transform.position.y) < 4f; } return false; } private void Hunt(PlayerControllerB p) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) base.targetPlayer = p; targetLast = ((Component)p).transform.position; targetVelocity = Vector3.zero; travelled = 0f; movesLeft = Mathf.Max(1, Plugin.KnightMovesPerHunt.Value); if (base.currentBehaviourStateIndex != 1) { ((EnemyAI)this).SwitchToBehaviourState(1); } CheckClientRpc((int)p.playerClientId); } private void BecomeStatue(bool rest) { base.targetPlayer = null; touchMove = null; deafUntil = Time.time + (rest ? 15f : 1.5f); returnAt = Time.time + 15f; ((EnemyAI)this).SwitchToBehaviourState(0); } private void GoHomeUnseen() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!hasHome || Time.time < returnAt || InHome(((Component)this).transform.position)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead && Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 22f) { return; } } WarpClientRpc(homeSpot, homeYaw); } [ClientRpc] private void WarpClientRpc(Vector3 to, float yaw) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2109414107u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref to); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2109414107u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((Component)this).transform.position = to; base.serverPosition = to; YawField.SetValue(this, yaw); ((Component)this).transform.eulerAngles = new Vector3(0f, yaw, 0f); } } } private void Jump() { //IL_0006: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(((Component)this).transform.position, ref val, 2f, -1)) { return; } Vector3 position = ((NavMeshHit)(ref val)).position; Vector3 val2 = ((Component)base.targetPlayer).transform.position + Vector3.ProjectOnPlane(targetVelocity, Vector3.up) * 0.96000004f; bool flag = false; Vector3 val3 = position; float num = float.MaxValue; float[] array = new float[3] { 2f, 1.5f, 1f }; Vector3 val4 = default(Vector3); NavMeshHit val5 = default(NavMeshHit); foreach (float num2 in array) { for (int j = 0; j < 8; j++) { float num3 = (((j & 1) == 0) ? 2f : 1f) * (((j & 2) == 0) ? 1f : (-1f)) * num2; float num4 = (((j & 1) == 0) ? 1f : 2f) * (((j & 4) == 0) ? 1f : (-1f)) * num2; ((Vector3)(ref val4))..ctor(num3, 0f, num4); if (!NavMesh.SamplePosition(position + val4, ref val5, 0.8f, -1)) { continue; } Vector3 position2 = ((NavMeshHit)(ref val5)).position; if (!(Mathf.Abs(position2.y - position.y) > 2.5f) && Route(position, position2, out var length) && !(length > ((Vector3)(ref val4)).magnitude * 2.5f + 1f)) { Vector3 val6 = Vector3.ProjectOnPlane(position2 - val2, Vector3.up); float magnitude = ((Vector3)(ref val6)).magnitude; float length2; float num5 = ((magnitude <= 1.17f) ? (magnitude - 1000f) : (Route(position2, val2, out length2) ? length2 : (500f + magnitude))); if (num5 < num) { num = num5; val3 = position2; flag = true; } } } if (flag) { break; } } if (flag) { jumping = true; movesLeft--; Vector3 val7 = Vector3.ProjectOnPlane(((Component)base.targetPlayer).transform.position - val3, Vector3.up); float y; if (!(((Vector3)(ref val7)).sqrMagnitude > 0.01f)) { y = ((Component)this).transform.eulerAngles.y; } else { Quaternion val8 = Quaternion.LookRotation(val7); y = ((Quaternion)(ref val8)).eulerAngles.y; } float yaw = y; JumpClientRpc(((Component)this).transform.position, val3, yaw); } } private bool Route(Vector3 from, Vector3 to, out float length) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) length = 0f; NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(to, ref val, 2f, -1)) { return false; } if (!NavMesh.CalculatePath(from, ((NavMeshHit)(ref val)).position, -1, route) || (int)route.status != 0) { return false; } Vector3[] corners = route.corners; for (int i = 1; i < corners.Length; i++) { length += Vector3.Distance(corners[i - 1], corners[i]); } return true; } [ClientRpc] private void JumpClientRpc(Vector3 from, Vector3 to, float yaw) { //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_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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3484954403u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref from); ((FastBufferWriter)(ref val)).WriteValueSafe(ref to); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3484954403u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(JumpArc(from, to, yaw)); } } } private IEnumerator JumpArc(Vector3 from, Vector3 to, float yaw) { //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) base.creatureVoice.PlayOneShot(KnightSounds.Tick); if ((Object)(object)mark != (Object)null) { ((Component)mark).gameObject.SetActive(true); } for (float t = 0f; t < 0.6f; t += Time.deltaTime) { if ((Object)(object)mark != (Object)null) { mark.SetPositionAndRotation(to + Vector3.up * 0.05f, Quaternion.Euler(90f, 0f, 0f)); } if ((Object)(object)model != (Object)null) { model.localScale = new Vector3(1f, Mathf.Lerp(1f, 0.82f, t / 0.6f), 1f); } yield return null; } if ((Object)(object)model != (Object)null) { model.localScale = Vector3.one; } ((Component)this).transform.position = to; base.serverPosition = to; YawField.SetValue(this, yaw); ((Component)this).transform.eulerAngles = new Vector3(0f, yaw, 0f); for (float t = 0f; t < 0.36f; t += Time.deltaTime) { float num = t / 0.36f; if ((Object)(object)model != (Object)null) { model.position = Vector3.Lerp(from, to, num) + Vector3.up * (4f * num * (1f - num) * 1.5f); } if ((Object)(object)mark != (Object)null) { mark.SetPositionAndRotation(to + Vector3.up * 0.05f, Quaternion.Euler(90f, 0f, 0f)); } yield return null; } if ((Object)(object)model != (Object)null) { model.localPosition = Vector3.zero; } if ((Object)(object)mark != (Object)null) { ((Component)mark).gameObject.SetActive(false); } base.creatureSFX.pitch = Random.Range(0.92f, 1.06f); base.creatureSFX.PlayOneShot(KnightSounds.Clack); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && Vector3.Distance(((Component)localPlayerController).transform.position, to) < 9f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if (!((NetworkBehaviour)this).IsServer) { yield break; } jumping = false; PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer == (Object)null || targetPlayer.isPlayerDead) { yield break; } Vector3 val = ((Component)targetPlayer).transform.position - to; if (Mathf.Abs(val.y) < 2.5f) { Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); if (((Vector3)(ref val2)).magnitude <= 1.3f) { CaptureClientRpc((int)targetPlayer.playerClientId); yield break; } } if (movesLeft <= 0 && base.currentBehaviourStateIndex == 1) { GiveUpClientRpc(); BecomeStatue(rest: true); } } [ClientRpc] private void CaptureClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2291302319u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2291302319u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureVoice.PlayOneShot(KnightSounds.Capture); PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; if (!((Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !val3.isPlayerDead) { val3.KillPlayer(Vector3.down * 4f, true, (CauseOfDeath)8, 0, default(Vector3), false); } } } [ClientRpc] private void GiveUpClientRpc() { //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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1105164246u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1105164246u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureVoice.PlayOneShot(KnightSounds.GiveUp); } } } [ClientRpc] private void CheckClientRpc(int playerId) { //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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1346515880u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1346515880u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureVoice.PlayOneShot(KnightSounds.Check); if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerId] != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { HUDManager.Instance.DisplayTip("Check.", tipShown ? "The Knight has chosen you." : "The Knight moves when you move.", true, false, "LC_Tip1"); tipShown = true; } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); base.creatureSFX.PlayOneShot(KnightSounds.Clonk); stunnedUntil = Time.time + Plugin.KnightStunSeconds.Value; if (!((NetworkBehaviour)this).IsServer || (Object)(object)playerWhoHit == (Object)null) { return; } if (base.currentBehaviourStateIndex == 0) { if (((EnemyAI)this).PlayerIsTargetable(playerWhoHit, false, false, true)) { Hunt(playerWhoHit); } } else { touchMove = playerWhoHit; } } public override void OnCollideWithPlayer(Collider other) { } private void SetEyes(bool on) { if (on == eyesOn) { return; } eyesOn = on; Renderer[] array = eyes; foreach (Renderer val in array) { if ((Object)(object)val != (Object)null) { val.enabled = on; } } } 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(2109414107u, new RpcReceiveHandler(__rpc_handler_2109414107), "WarpClientRpc"); ((NetworkBehaviour)this).__registerRpc(3484954403u, new RpcReceiveHandler(__rpc_handler_3484954403), "JumpClientRpc"); ((NetworkBehaviour)this).__registerRpc(2291302319u, new RpcReceiveHandler(__rpc_handler_2291302319), "CaptureClientRpc"); ((NetworkBehaviour)this).__registerRpc(1105164246u, new RpcReceiveHandler(__rpc_handler_1105164246), "GiveUpClientRpc"); ((NetworkBehaviour)this).__registerRpc(1346515880u, new RpcReceiveHandler(__rpc_handler_1346515880), "CheckClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_2109414107(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 to = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref to); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightAI)(object)target).WarpClientRpc(to, yaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3484954403(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); Vector3 to = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref to); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightAI)(object)target).JumpClientRpc(val, to, yaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2291302319(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 playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightAI)(object)target).CaptureClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1105164246(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; ((KnightAI)(object)target).GiveUpClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1346515880(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 playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightAI)(object)target).CheckClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "KnightAI"; } } public static class KnightSounds { private static AudioClip clack; private static AudioClip clonk; private static AudioClip check; private static AudioClip capture; private static AudioClip tick; private static AudioClip giveUp; public static AudioClip Tick { get { if (!((Object)(object)tick != (Object)null)) { return tick = DealerSounds.Noise("KnightTick", 0.12f, 520f, 30f, 0.6f); } return tick; } } public static AudioClip GiveUp { get { if (!((Object)(object)giveUp != (Object)null)) { return giveUp = DealerSounds.Chime("KnightGiveUp", new float[2] { 392f, 261.63f }, 0.2f); } return giveUp; } } public static AudioClip Clack { get { if (!((Object)(object)clack != (Object)null)) { return clack = DealerSounds.Noise("KnightClack", 0.3f, 150f, 16f, 0.95f); } return clack; } } public static AudioClip Clonk { get { if (!((Object)(object)clonk != (Object)null)) { return clonk = DealerSounds.Noise("KnightClonk", 0.22f, 320f, 22f, 0.8f); } return clonk; } } public static AudioClip Check { get { if (!((Object)(object)check != (Object)null)) { return check = DealerSounds.Chime("KnightCheck", new float[2] { 329.63f, 466.16f }, 0.16f); } return check; } } public static AudioClip Capture { get { if (!((Object)(object)capture != (Object)null)) { return capture = DealerSounds.Chime("KnightCapture", new float[3] { 466.16f, 329.63f, 164.81f }, 0.13f); } return capture; } } } public static class KnightBuilder { public static EnemyType EnemyType { get; private set; } public static void BuildAndRegister() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) GameObject val = JengAssets.Prefab("Assets/JengChatHQ/Interior/KnightModel.prefab"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"Bundle has no knight model: the Knight is skipped."); return; } GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("JengKnight"); val2.tag = "Enemy"; int layer = (val2.layer = LayerMask.NameToLayer("Enemies")); NavMeshAgent obj = val2.AddComponent<NavMeshAgent>(); obj.radius = 0.5f; obj.height = 2.6f; ((Behaviour)obj).enabled = false; GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform, false); ((Object)val3).name = "Model"; List<Renderer> list = new List<Renderer>(); Transform[] componentsInChildren = val3.GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren) { ((Component)val4).gameObject.layer = layer; if (((Object)val4).name == "Eye") { list.Add(((Component)val4).GetComponent<Renderer>()); } } GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)5); Object.DestroyImmediate((Object)(object)val5.GetComponent<Collider>()); ((Object)val5).name = "LandingMark"; val5.transform.SetParent(val2.transform, false); val5.transform.localPosition = new Vector3(0f, 0.05f, 0f); val5.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val5.transform.localScale = new Vector3(1.9f, 1.9f, 1f); Material val6 = new Material(Shader.Find("HDRP/Unlit") ?? Shader.Find("Unlit/Color")); val6.color = new Color(0.9f, 0.05f, 0.03f); if (val6.HasProperty("_UnlitColor")) { val6.SetColor("_UnlitColor", new Color(0.9f, 0.05f, 0.03f)); } val5.GetComponent<Renderer>().sharedMaterial = val6; GameObject val7 = new GameObject("Collision"); val7.transform.SetParent(val2.transform, false); val7.tag = "Enemy"; val7.layer = layer; BoxCollider obj2 = val7.AddComponent<BoxCollider>(); ((Collider)obj2).isTrigger = true; obj2.center = new Vector3(0f, 1.4f, 0f); obj2.size = new Vector3(1.1f, 2.8f, 1.1f); Rigidbody obj3 = val7.AddComponent<Rigidbody>(); obj3.isKinematic = true; obj3.useGravity = false; EnemyAICollisionDetect val8 = val7.AddComponent<EnemyAICollisionDetect>(); GameObject val9 = new GameObject("ScanNode"); val9.transform.SetParent(val2.transform, false); val9.transform.localPosition = new Vector3(0f, 2f, 0f); val9.layer = LayerMask.NameToLayer("ScanNode"); BoxCollider obj4 = val9.AddComponent<BoxCollider>(); ((Collider)obj4).isTrigger = true; obj4.size = Vector3.one * 0.6f; ScanNodeProperties obj5 = val9.AddComponent<ScanNodeProperties>(); obj5.headerText = "The Knight"; obj5.subText = "Moves when you move."; obj5.nodeType = 1; obj5.minRange = 1; obj5.maxRange = 10; obj5.requiresLineOfSight = true; KnightAI knightAI = val2.AddComponent<KnightAI>(); ((EnemyAI)knightAI).creatureVoice = Audio(val2, "CreatureVoice", 28f); ((EnemyAI)knightAI).creatureSFX = Audio(val2, "CreatureSFX", 40f); ((EnemyAI)knightAI).eye = val3.transform; knightAI.model = val3.transform; knightAI.eyes = list.ToArray(); knightAI.mark = val5.transform; ((EnemyAI)knightAI).AIIntervalTime = 0.2f; ((EnemyAI)knightAI).syncMovementSpeed = 0.05f; ((EnemyAI)knightAI).updatePositionThreshold = 0.4f; ((EnemyAI)knightAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[2] { new EnemyBehaviourState { name = "Statue" }, new EnemyBehaviourState { name = "Hunt" } }; val8.mainScript = (EnemyAI)(object)knightAI; EnemyType val10 = ScriptableObject.CreateInstance<EnemyType>(); ((Object)val10).name = "JengKnight"; val10.enemyName = "The Knight"; val10.enemyPrefab = val2; val10.probabilityCurve = AnimationCurve.Constant(0f, 1f, 1f); val10.numberSpawnedFalloff = AnimationCurve.Constant(0f, 10f, 1f); val10.MaxCount = 1; val10.PowerLevel = 1f; val10.canDie = false; val10.canBeStunned = true; val10.canBeDestroyed = false; val10.destroyOnDeath = false; val10.isOutsideEnemy = false; val10.isDaytimeEnemy = false; val10.doorSpeedMultiplier = 1f; val10.stunTimeMultiplier = 1f; ((EnemyAI)knightAI).enemyType = val10; EnemyType = val10; Plugin.Log.LogInfo((object)"Built the Knight."); } private static AudioSource Audio(GameObject on, string name, float reach) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(on.transform, false); val.transform.localPosition = new Vector3(0f, 1.5f, 0f); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 3f; obj.maxDistance = reach; return obj; } } [HarmonyPatch(typeof(RoundManager), "SpawnSyncedProps")] internal static class KnightSpotPatch { public const string MarkerName = "JengKnightSpot"; private static void Postfix(RoundManager __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00a2: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer || (Object)(object)KnightBuilder.EnemyType == (Object)null) { return; } Transform[] array = Object.FindObjectsOfType<Transform>(); NetworkObject val3 = default(NetworkObject); foreach (Transform val in array) { if (((Object)val).name != "JengKnightSpot") { continue; } if (Random.value > Plugin.KnightSpawnChance.Value) { Plugin.Log.LogInfo((object)"The chess hall's Knight stays away this time."); break; } NetworkObjectReference val2 = __instance.SpawnEnemyGameObject(val.position, val.eulerAngles.y, -1, KnightBuilder.EnemyType); Tile componentInParent = ((Component)val).GetComponentInParent<Tile>(); if ((Object)(object)componentInParent != (Object)null && ((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent<KnightAI>().SetHome(componentInParent.Bounds); } Plugin.Log.LogInfo((object)"The Knight is on the board in the chess hall."); break; } } } } namespace JengChatHQ.JengGPT { public class DiceHud : MonoBehaviour { private static DiceHud instance; private GameObject root; private RectTransform die; private Image dieFace; private readonly Image[] pips = (Image[])(object)new Image[7]; private TextMeshProUGUI unluckyText; private TextMeshProUGUI resultText; private float rollStart; private float rollEnd; private int result; private int unluckyMask; private int shownFace = 1; private float nextFaceAt; private bool rolling; private static readonly int[][] Faces = new int[7][] { null, new int[1] { 3 }, new int[2] { 0, 6 }, new int[3] { 0, 3, 6 }, new int[4] { 0, 1, 5, 6 }, new int[5] { 0, 1, 3, 5, 6 }, new int[6] { 0, 1, 2, 4, 5, 6 } }; private static readonly Vector2[] PipPositions = (Vector2[])(object)new Vector2[7] { new Vector2(-45f, 45f), new Vector2(45f, 45f), new Vector2(-45f, 0f), new Vector2(0f, 0f), new Vector2(45f, 0f), new Vector2(-45f, -45f), new Vector2(45f, -45f) }; public static bool HasInstance => (Object)(object)instance != (Object)null; public static DiceHud Instance { get { if (!((Object)(object)instance != (Object)null)) { return instance = Create(); } return instance; } } private static DiceHud Create() { //IL_0005: 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_0010: Expected O, but got Unknown GameObject val = new GameObject("JengGPT DiceHud"); Object.DontDestroyOnLoad((Object)val); DiceHud diceHud = val.AddComponent<DiceHud>(); diceHud.Build(); return diceHud; } private void Build() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) Canvas obj = ((Component)this).gameObject.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 500; CanvasScaler obj2 = ((Component)this).gameObject.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); root = new GameObject("Root", new Type[1] { typeof(RectTransform) }); root.transform.SetParent(((Component)this).transform, false); Stretch((RectTransform)root.transform); GameObject val = new GameObject("Die", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(root.transform, false); die = (RectTransform)val.transform; die.sizeDelta = new Vector2(150f, 150f); ((Graphic)val.AddComponent<Image>()).color = new Color(0.08f, 0.08f, 0.08f, 1f); dieFace = NewImage("Face", die, new Vector2(138f, 138f), Vector2.zero, new Color(0.95f, 0.93f, 0.88f)); for (int i = 0; i < pips.Length; i++) { pips[i] = NewImage("Pip" + i, die, new Vector2(26f, 26f), PipPositions[i], new Color(0.1f, 0.1f, 0.1f)); } RectTransform rectTransform = ((Graphic)NewImage("Unlucky", (RectTransform)root.transform, new Vector2(260f, 110f), Vector2.zero, new Color(0.55f, 0.05f, 0.05f, 0.9f))).rectTransform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 1f); rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; rectTransform.pivot = new Vector2(1f, 1f); rectTransform.anchoredPosition = new Vector2(-40f, -40f); unluckyText = NewText("UnluckyText", rectTransform, 40f); GameObject val3 = new GameObject("Result", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(root.transform, false); RectTransform val4 = (RectTransform)val3.transform; val4.sizeDelta = new Vector2(900f, 90f); val4.anchoredPosition = new Vector2(0f, -140f); resultText = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)resultText).alignment = (TextAlignmentOptions)514; ((TMP_Text)resultText).fontSize = 48f; root.SetActive(false); } private static void Stretch(RectTransform rt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_001e: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; Vector2 offsetMin = (rt.offsetMax = Vector2.zero); rt.offsetMin = offsetMin; } private static Image NewImage(string name, RectTransform parent, Vector2 size, Vector2 pos, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)parent, false); RectTransform val2 = (RectTransform)val.transform; val2.sizeDelta = size; val2.anchoredPosition = pos; Image obj = val.AddComponent<Image>(); ((Graphic)obj).color = color; return obj; } private static TextMeshProUGUI NewText(string name, RectTransform parent, float size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)parent, false); Stretch((RectTransform)val.transform); TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = size; ((Graphic)obj).color = Color.white; return obj; } private void UseGameFont() { TMP_FontAsset val = (((Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.chatText != (Object)null) ? ((TMP_Text)HUDManager.Instance.chatText).font : null); if (!((Object)(object)val == (Object)null)) { ((TMP_Text)unluckyText).font = val; ((TMP_Text)resultText).font = val; } } public void ShowRoll(int roll, int mask, float seconds) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) UseGameFont(); result = roll; unluckyMask = mask; rollStart = Time.time; rollEnd = Time.time + seconds; nextFaceAt = 0f; rolling = true; StringBuilder stringBuilder = new StringBuilder(); for (int i = 1; i <= 6; i++) { if ((mask & (1 << i)) != 0) { stringBuilder.Append((stringBuilder.Length == 0) ? "" : " ").Append(i); } } ((TMP_Text)unluckyText).text = "<size=60%>UNLUCKY</size>\n<b>" + stringBuilder?.ToString() + "</b>"; ((TMP_Text)resultText).text = ""; ((Transform)die).localScale = Vector3.one; ((Graphic)dieFace).color = new Color(0.95f, 0.93f, 0.88f); root.SetActive(true); } public void Hide() { rolling = false; if ((Object)(object)root != (Object)null) { root.SetActive(false); } } public void HideIfFor(PlayerControllerB player) { if ((Object)(object)player != (Object)null && (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Hide(); } } private void SetFace(int face) { for (int i = 0; i < pips.Length; i++) { ((Behaviour)pips[i]).enabled = false; } int[] array = Faces[face]; foreach (int num in array) { ((Behaviour)pips[num]).enabled = true; } } private void Update() { //IL_0151: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) if (!rolling) { return; } PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if ((Object)(object)val == (Object)null || val.isPlayerDead) { Hide(); } else if (Time.time < rollEnd) { float num = Mathf.InverseLerp(rollStart, rollEnd, Time.time); if (Time.time >= nextFaceAt) { int num2; do { num2 = Random.Range(1, 7); } while (num2 == shownFace); shownFace = num2; SetFace(shownFace); nextFaceAt = Time.time + Mathf.Lerp(0.05f, 0.4f, num * num); } float num3 = (1f - num) * 900f; ((Transform)die).localRotation = Quaternion.Euler(0f, 0f, ((Transform)die).localEulerAngles.z + num3 * Time.deltaTime); float num4 = Mathf.Abs(Mathf.Sin(num * MathF.PI * 4f)) * (1f - num) * 60f; die.anchoredPosition = new Vector2(0f, 40f + num4); } else { rolling = false; SetFace(result); ((Transform)die).localRotation = Quaternion.identity; die.anchoredPosition = new Vector2(0f, 40f); bool flag = (unluckyMask & (1 << result)) != 0; ((Graphic)dieFace).color = (flag ? new Color(1f, 0.55f, 0.55f) : new Color(0.6f, 1f, 0.7f)); ((Transform)die).localScale = Vector3.one * 1.15f; ((TMP_Text)resultText).text = (flag ? "<color=#FF5A5A>Too bad for you!</color>" : "<color=#7CF0B4>You're lucky...</color>"); } } } public static class JengAssets { public const string BundleFile = "jengchathq_assets.bundle"; private static AssetBundle loaded; private static readonly Dictionary<string, Material> Cards = new Dictionary<string, Material>(); public static GameObject DealerModel { get; private set; } public static GameObject CroupierModel { get; private set; } public static GameObject CardTable { get; private set; } public static ScriptableObject InteriorFlow { get; private set; } public static GameObject Prefab(string path) { if (!((Object)(object)loaded == (Object)null)) { return loaded.LoadAsset<GameObject>(path); } return null; } public static GameObject ItemModel(string id) { if (!((Object)(object)loaded == (Object)null)) { return loaded.LoadAsset<GameObject>("Assets/JengChatHQ/Items/" + id + ".prefab"); } return null; } public static Material CardMaterial(string name) { if ((Object)(object)loaded == (Object)null) { return null; } if (!Cards.TryGetValue(name, out var value)) { value = (Cards[name] = loaded.LoadAsset<Material>("Assets/JengChatHQ/Cards/Mat/" + name + ".mat")); } return value; } public static void Load(string pluginDir) { string text = Path.Combine(pluginDir, "jengchathq_assets.bundle"); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)"No jengchathq_assets.bundle next to the DLL: JengGPT uses the placeholder monitor."); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)("Couldn't load " + text + ".")); return; } loaded = val; DealerModel = val.LoadAsset<GameObject>("Assets/JengChatHQ/Prefabs/JengGPTModel.prefab"); CroupierModel = val.LoadAsset<GameObject>("Assets/JengChatHQ/Prefabs/CroupierModel.prefab"); CardTable = val.LoadAsset<GameObject>("Assets/JengChatHQ/Prefabs/CardTable.prefab"); InteriorFlow = val.LoadAsset<ScriptableObject>("Assets/JengChatHQ/Interior/JengChatHQFlow.asset"); Plugin.Log.LogInfo((object)(((Object)(object)DealerModel != (Object)null) ? "Loaded JengGPT's dealer model." : "Bundle has no JengGPTModel prefab.")); RepairShaders(val); } private static void RepairShaders(AssetBundle bundle) { int num = 0; int num2 = 0; int num3 = 0; HashSet<string> hashSet = new HashSet<string>(); HashSet<Material> hashSet2 = new HashSet<Material>(bundle.LoadAllAssets<Material>()); GameObject[] array = (GameObject[])(object)new GameObject[3] { DealerModel, CroupierModel, CardTable }; foreach (GameObject val in array) { if ((Object)(object)val == (Object)null) { continue; } Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Material[] sharedMaterials = componentsInChildren[j].sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { hashSet2.Add(val2); } else { num3++; } } } } foreach (Material item in hashSet2) { num++; if ((Object)(object)item.shader == (Object)null) { num3++; continue; } hashSet.Add(((Object)item.shader).name + (item.shader.isSupported ? "" : " (unsupported)")); if (!item.shader.isSupported) { Shader val3 = Shader.Find(((Object)item.shader).name); if ((Object)(object)val3 == (Object)null || !val3.isSupported) { num3++; } else if (!((Object)(object)val3 == (Object)(object)item.shader)) { int renderQueue = item.renderQueue; item.shader = val3; item.render