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 Mystery v91.9.9
menustuff/BepInEx/plugins/ZoLoKinoBabo112/Emblem.dll
Decompiled 2 years 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.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Emblem; using Emblem.Components; using Emblem.Managers; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Emblem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Emblem")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e4927ee1-3a47-4f93-8784-804356949316")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public class DynamicColorManager : MonoBehaviour { private static DynamicColorManager _instance; public static DynamicColorManager Instance { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("DynamicColorManager").AddComponent<DynamicColorManager>(); } return _instance; } } public SubMenuColor SubMenuColors { get; set; } private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } public void SetupDynamicColorChange(string parentPath) { AttachObserver(parentPath, SubMenuColors); } public void AttachObserver(string parentPath, SubMenuColor subMenuColors) { Transform val = PathFinder.Probe(parentPath); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Parent path not found: " + parentPath); } else { (((Component)val).gameObject.GetComponent<UIObserver>() ?? ((Component)val).gameObject.AddComponent<UIObserver>()).SetColors(subMenuColors); } } } public class UIObserver : MonoBehaviour { private Dictionary<GameObject, bool> _coloredObjects = new Dictionary<GameObject, bool>(); private SubMenuColor _subMenuColors; public void SetColors(SubMenuColor subMenuColors) { _subMenuColors = subMenuColors; } private void OnTransformChildrenChanged() { ProcessChildren(); } private void ProcessChildren() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0111: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in ((Component)this).transform) { Transform child = item; if ((Object)(object)child == (Object)null) { LogWarden.LogError("[UIObserver] Child transform is null in " + ((Object)((Component)this).transform).name); } else if (!(((Object)child).name == "ListHeader (1)") && (((Object)child).name.Contains("LobbyListItem(Clone)") || ((Object)child).name.Contains("LobbyListItemChallenge(Clone)") || ((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)"))) { bool flag = ((Object)child).name.Contains("LobbyListItemChallenge(Clone)") || ((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)"); Color color = (flag ? _subMenuColors.Background7 : _subMenuColors.Background5); ApplyColorToChild(child, color); if (((Object)child).name.Contains("LobbyListItem(Clone)") || ((Object)child).name.Contains("LobbyListItemChallenge(Clone)")) { ApplyChildColors(child, flag); HandleJoinButtonClones(child); } else if (((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)")) { ApplyChallengeColors(child); } DelayHelper.StartDelayedAction(0.01f, delegate { SetupButton(child); }); } } } private void ApplyChildColors(Transform child, bool isChallenge) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) ApplyColors(new List<(string, Color)> { ("Outline", _subMenuColors.BorderColor), ("ServerName", _subMenuColors.TextFontColor), ("NumPlayers", _subMenuColors.SubTextColor), (isChallenge ? "NumPlayers (1)" : null, _subMenuColors.SubTextColor) }, child); } private void ApplyChallengeColors(Transform child) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) ApplyColors(new List<(string, Color)> { ("Outline", _subMenuColors.BorderColor), ("ServerName", _subMenuColors.TextFontColor), ("Collected", _subMenuColors.SubTextColor), ("RankNum", _subMenuColors.TextFontColor) }, child); } private void ApplyColors(List<(string, Color)> colors, Transform parent) { //IL_0017: 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_0023: Unknown result type (might be due to invalid IL or missing references) foreach (var (text, color) in colors) { if (text != null) { CheckAndApplyColor(parent, text, color); } } } private void HandleJoinButtonClones(Transform parent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Transform val = parent.Find("NumPlayers"); if (!((Object)(object)val != (Object)null)) { return; } foreach (Transform item in val) { Transform val2 = item; if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Contains("JoinButton(Clone)") && (Object)(object)((Component)val2).GetComponent<Button>() != (Object)null) { SetupJoinButton(val2); } } } private void SetupJoinButton(Transform buttonTransform) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ((Component)buttonTransform).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.pivot = new Vector2(component.pivot.x, 1f); } Transform val = buttonTransform.Find("SelectionHighlight"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); } } private void SetupButton(Transform child) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)child == (Object)null) { return; } foreach (Transform item in child) { Transform val = item; if ((Object)(object)val == (Object)null || !((Object)val).name.Contains("JoinButton")) { continue; } Button component = ((Component)val).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { Image component2 = ((Component)val).GetComponent<Image>(); Transform obj = val.Find("Text (TMP)"); TMP_Text val2 = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component2 != (Object)null && (Object)(object)val2 != (Object)null) { HoverButtonDirect(val, _subMenuColors.ButtonRegText, _subMenuColors.ButtonHoverText, _subMenuColors.Darken, _subMenuColors.ButtonHoverBG); SetupEventTriggers(component, component2, val2, _subMenuColors.Darken, _subMenuColors.ButtonHoverBG, _subMenuColors.ButtonRegText, _subMenuColors.ButtonHoverText); ((Graphic)component2).color = _subMenuColors.Darken; } } } } private void HoverButtonDirect(Transform buttonTransform, Color regularFontColor, Color highlightFontColor, Color regularBGColor, Color highlightBGColor) { //IL_0095: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00ed: 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_0108: 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_0123: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01af: Expected O, but got Unknown Button component = ((Component)buttonTransform).GetComponent<Button>(); Animator component2 = ((Component)buttonTransform).GetComponent<Animator>(); Image backgroundImage = ((Component)buttonTransform).GetComponent<Image>(); Transform obj = buttonTransform.Find("Text (TMP)"); TMP_Text textComponent = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component != (Object)null && (Object)(object)textComponent != (Object)null && (Object)(object)backgroundImage != (Object)null) { if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } ((Selectable)component).transition = (Transition)0; textComponent.overrideColorTags = true; Color initialTextColor = ((Graphic)textComponent).color; Color initialBGColor = ((Graphic)backgroundImage).color; ((Graphic)textComponent).color = regularFontColor; ((Behaviour)backgroundImage).enabled = true; backgroundImage.pixelsPerUnitMultiplier = 4f; ((Graphic)backgroundImage).color = regularBGColor; RectTransform component3 = ((Component)component).GetComponent<RectTransform>(); component3.anchorMin = new Vector2(component3.anchorMin.x, 0.5f); component3.anchorMax = new Vector2(component3.anchorMax.x, 0.5f); component3.pivot = new Vector2(component3.pivot.x, 0.5f); component3.offsetMax = new Vector2(component3.offsetMax.x, 13f); component3.offsetMin = new Vector2(component3.offsetMin.x, -13f); Transform obj2 = buttonTransform.Find("SelectionHighlight"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = initialBGColor; ((Graphic)textComponent).color = initialTextColor; }); } else { LogWarden.LogError("[HoverButtonDirect] Required components not found on button at '" + ((Object)buttonTransform).name + "'."); } } private void SetupEventTriggers(Button button, Image backgroundImage, TMP_Text textComponent, Color regularBGColor, Color highlightBGColor, Color regularFontColor, Color highlightFontColor) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0061: Unknown result type (might be due to invalid IL or missing references) EventTrigger obj = ((Component)button).GetComponent<EventTrigger>() ?? ((Component)button).gameObject.AddComponent<EventTrigger>(); obj.triggers.Clear(); Color initialBGColor = ((Graphic)backgroundImage).color; Color initialTextColor = ((Graphic)textComponent).color; AddEventTrigger(obj, (EventTriggerType)0, delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; }); AddEventTrigger(obj, (EventTriggerType)1, delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = initialBGColor; ((Graphic)textComponent).color = initialTextColor; }); } private static void AddEventTrigger(EventTrigger trigger, EventTriggerType type, UnityAction<BaseEventData> action) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Entry val = new Entry { eventID = type }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action); trigger.triggers.Add(val); } private void CheckAndApplyColor(Transform parent, string childName, Color color) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find(childName); if ((Object)(object)val != (Object)null && (!_coloredObjects.TryGetValue(((Component)val).gameObject, out var value) || !value)) { ApplyColorToChild(val, color); } } private void ApplyColorToChild(Transform child, Color color) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)child == (Object)null)) { Graphic component = ((Component)child).GetComponent<Graphic>(); if ((Object)(object)component != (Object)null) { component.color = color; _coloredObjects[((Component)child).gameObject] = true; } else { LogWarden.LogError("[UIObserver] Graphic component not found on " + ((Object)child).name); } } } } public class HoverEffectHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public Image backgroundImage; public TMP_Text textComponent; public Color regularBGColor; public Color highlightBGColor; public Color regularFontColor; public Color highlightFontColor; public void OnPointerEnter(PointerEventData eventData) { //IL_0007: 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) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; } public void OnPointerExit(PointerEventData eventData) { //IL_0007: 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) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; } } public class SubMenuColor { public struct UIPath { public string Path; public Type ComponentType; public int Index; public UIPath(string path, Type componentType, int index = 0) { Path = path; ComponentType = componentType; Index = index; } } private static readonly UIPath HOST_BUTTON = new UIPath("Canvas/MenuContainer/MainButtons/HostButton/", typeof(Button)); private static readonly UIPath HOST_BG = new UIPath("MenuContainer/LobbyHostSettings/Image", typeof(Image)); private static readonly UIPath HOST_PANEL_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer", typeof(Image)); private static readonly UIPath HOST_BORDER = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Image", typeof(Image)); private static readonly UIPath HOST_LAN_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Header", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/EnterAName", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_INPUT_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField", typeof(Image)); private static readonly UIPath HOST_ONLINE_PUBLIC = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Public", typeof(Button)); private static readonly UIPath HOST_ONLINE_PUBLIC_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Public", typeof(Image)); private static readonly UIPath HOST_ONLINE_PRIVATE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Private", typeof(Button)); private static readonly UIPath HOST_ONLINE_PRIVATE_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Private", typeof(Image)); private static readonly UIPath HOST_LAN_REMOTE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/AllowRemote", typeof(Button)); private static readonly UIPath HOST_LAN_REMOTE_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/AllowRemote", typeof(Image)); private static readonly UIPath HOST_LAN_LOCAL = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Local", typeof(Button)); private static readonly UIPath HOST_LAN_LOCAL_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Local", typeof(Image)); private static readonly UIPath HOST_ONLINE_TAG_BORDER = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField", typeof(Image)); private static readonly UIPath HOST_ONLINE_TAG_PLACE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField/Text Area/Placeholder", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_TAG_TEXT = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField/Text Area/Text", typeof(TMP_Text)); private static readonly UIPath HOST_CONFIRM = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Confirm", typeof(Button)); private static readonly UIPath HOST_BACK = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Back", typeof(Button)); private static readonly UIPath HOST_DESC = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/PrivatePublicDescription", typeof(TMP_Text)); private static readonly UIPath CREWCOUNT_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/CrewCountField(Clone)/Text (TMP)", typeof(TMP_Text)); private static readonly UIPath CREWCOUNT_INPUT_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/CrewCountField(Clone)", typeof(Image)); private static readonly UIPath COSMO_BUTTON = new UIPath("TestOverlay(Clone)/Canvas/GlobalScale/ActivateButton", typeof(Image)); private static readonly UIPath FILE_PANEL_BG = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(Image)); private static readonly UIPath FILE_BORDER = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/Outline", typeof(Image)); private static readonly UIPath FILE_TITLE = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/EnterAName", typeof(TMP_Text)); private static readonly UIPath FILE_TIP = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/ChallengeMoonButton/TipText", typeof(TMP_Text)); private static readonly UIPath FILE_DARK = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/Darken", typeof(Image)); private static readonly UIPath FILES_BUTTON = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(TMP_Text)); private static readonly UIPath FILES_IMAGES = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(Image)); private static readonly UIPath LEAD_BORDER = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel", typeof(Image)); private static readonly UIPath LEAD_TITLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/ListHeader", typeof(TMP_Text)); private static readonly UIPath LEAD_REFRESH = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/RefreshButton", typeof(Button)); private static readonly UIPath LEAD_BACK = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/Back", typeof(Button)); private static readonly UIPath LEAD_REMOVE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/RemoveScore", typeof(Button)); private static readonly UIPath LEAD_PLAY = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Retry", typeof(Button)); private static readonly UIPath LEAD_SCROLL_BAR = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath LEAD_SCROLL_HANDLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Scrollbar Vertical", typeof(Scrollbar)); private static readonly UIPath LEAD_DROP = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown", typeof(TMP_Dropdown)); private static readonly UIPath LEAD_DROP_TEXT = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Label", typeof(TMP_Text)); private static readonly UIPath LEAD_DROP_ARROW = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Arrow", typeof(Image)); private static readonly UIPath LEAD_DROP_BG = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_BG = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Background", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_CHECK = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Checkmark", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_TEXT = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Label", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_TOGGLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item", typeof(Toggle)); private static readonly UIPath LOBBY_BG = new UIPath("MenuContainer/LobbyList/LobbyBackground", typeof(Image)); private static readonly UIPath LOBBY_TITLE = new UIPath("MenuContainer/LobbyList/ListPanel/ListHeader", typeof(TMP_Text)); private static readonly UIPath LOBBY_PANEL_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View", typeof(Image)); private static readonly UIPath LOBBY_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel", typeof(Image)); private static readonly UIPath LOBBY_REFRESH = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton", typeof(Button)); private static readonly UIPath LOBBYCOMPAT_REFRESH = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton/SelectionHighlight(Clone)", typeof(Image)); private static readonly UIPath LOBBYCOMPAT_REFRESH_HOVER = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton/SelectionHighlight", typeof(Image)); private static readonly UIPath LOBBY_BACK = new UIPath("MenuContainer/LobbyList/BackToMenu", typeof(Button)); private static readonly UIPath LOBBY_SCROLL_BAR = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath LOBBY_SCROLL_HANDLE = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Scrollbar Vertical", typeof(Scrollbar)); private static readonly UIPath LOBBY_LIST_STATUS = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Viewport/Content/ListHeader (1)", typeof(TMP_Text)); private static readonly UIPath LOBBY_TAG_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField", typeof(Image)); private static readonly UIPath LOBBY_TAG_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField/Text Area/Text", typeof(TMP_Text)); private static readonly UIPath LOBBY_TAG_PLACEHOLDER = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField/Text Area/Placeholder", typeof(TMP_Text)); private static readonly UIPath LOBBY_SORT_CHAL_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort", typeof(Image)); private static readonly UIPath LOBBY_SORT_CHAL_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Text (TMP)", typeof(TMP_Text)); private static readonly UIPath LOBBY_SORT_CHAL_BOX = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Arrow", typeof(Image)); private static readonly UIPath LOBBY_SORT_CHAL_BOX_CHECK = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Arrow (1)", typeof(Image)); private static readonly UIPath LOBBY_DROP = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown", typeof(TMP_Dropdown)); private static readonly UIPath LOBBY_DROP_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Label", typeof(TMP_Text)); private static readonly UIPath LOBBY_DROP_ARROW = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Arrow", typeof(Image)); private static readonly UIPath LOBBY_DROP_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Background", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_CHECK = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Checkmark", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Label", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_TOGGLE = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item", typeof(Toggle)); private static readonly UIPath LANWARN_BG = new UIPath("MenuContainer/LANWarning/Image", typeof(Image)); private static readonly UIPath LANWARN_PANEL_BG = new UIPath("MenuContainer/LANWarning/Panel", typeof(Image)); private static readonly UIPath LANWARN_BORDER = new UIPath("MenuContainer/LANWarning/Panel/Image", typeof(Image)); private static readonly UIPath LANWARN_TEXT = new UIPath("MenuContainer/LANWarning/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath LANWARN_CONFIRM = new UIPath("MenuContainer/LANWarning/Panel/Confirm", typeof(Button)); private static readonly UIPath NOTIFY_BG = new UIPath("MenuContainer/MenuNotification/Image", typeof(Image)); private static readonly UIPath NOTIFY_PANEL_BG = new UIPath("MenuContainer/MenuNotification/Panel", typeof(Image)); private static readonly UIPath NOTIFY_BORDER = new UIPath("MenuContainer/MenuNotification/Panel/Image", typeof(Image)); private static readonly UIPath NOTIFY_TEXT = new UIPath("MenuContainer/MenuNotification/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath NOTIFY_BACK = new UIPath("MenuContainer/MenuNotification/Panel/ResponseButton", typeof(Button)); private static readonly UIPath DELETE_BG = new UIPath("MenuContainer/DeleteFileConfirmation/Image", typeof(Image)); private static readonly UIPath DELETE_PANEL_BG = new UIPath("MenuContainer/DeleteFileConfirmation/Panel", typeof(Image)); private static readonly UIPath DELETE_BORDER = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Image", typeof(Image)); private static readonly UIPath DELETE_TEXT = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath DELETE_CONFIRM = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Delete", typeof(Button)); private static readonly UIPath DELETE_BACK = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Back", typeof(Button)); private static readonly UIPath CREDITS_BG = new UIPath("MenuContainer/CreditsPanel/Image", typeof(Image)); private static readonly UIPath CREDITS_PANEL_BG = new UIPath("MenuContainer/CreditsPanel/Panel", typeof(Image)); private static readonly UIPath CREDITS_BORDER = new UIPath("MenuContainer/CreditsPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath CREDITS_TITLE = new UIPath("MenuContainer/CreditsPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath CREDITS_TITLE_BG = new UIPath("MenuContainer/CreditsPanel/Panel/Image", typeof(Image)); private static readonly UIPath CREDITS_TEXT = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Viewport/Content/CreditsText", typeof(TMP_Text)); private static readonly UIPath CREDITS_TEXT_BG = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View", typeof(Image)); private static readonly UIPath CREDITS_BACK = new UIPath("MenuContainer/CreditsPanel/Panel/BackButton", typeof(Button)); private static readonly UIPath CREDITS_SCROLL_BAR = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath CREDITS_SCROLL_HANDLE = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private static readonly UIPath NEWS_BG = new UIPath("MenuContainer/NewsPanel/Image", typeof(Image)); private static readonly UIPath NEWS_PANEL_BG = new UIPath("MenuContainer/NewsPanel/Panel", typeof(Image)); private static readonly UIPath NEWS_BORDER = new UIPath("MenuContainer/NewsPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath NEWS_TITLE = new UIPath("MenuContainer/NewsPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath NEWS_TEXT = new UIPath("MenuContainer/NewsPanel/Panel/DemoText", typeof(TMP_Text)); private static readonly UIPath NEWS_CONFIRM = new UIPath("MenuContainer/NewsPanel/Panel/ResponseButton", typeof(Button)); private static readonly UIPath NEWS_BOX_1 = new UIPath("MenuContainer/NewsPanel/Panel/Image", typeof(Image)); private static readonly UIPath NEWS_BOX_2 = new UIPath("MenuContainer/NewsPanel/Panel/Image (1)", typeof(Image)); private static readonly UIPath NEWS_BOX_3 = new UIPath("MenuContainer/NewsPanel/Panel/Image (2)", typeof(Image)); private static readonly UIPath NEWS_BOX_4 = new UIPath("MenuContainer/NewsPanel/Panel/Image (3)", typeof(Image)); private static readonly UIPath NEWS_BOX_5 = new UIPath("MenuContainer/NewsPanel/Panel/Image (4)", typeof(Image)); private static readonly UIPath NEWS_BOX_6 = new UIPath("MenuContainer/NewsPanel/Panel/Image (5)", typeof(Image)); private static readonly UIPath SETTINGS_CONFIRM = new UIPath("MenuContainer/SettingsPanel/Confirm", typeof(Button)); private static readonly UIPath SETTINGS_BACK = new UIPath("MenuContainer/SettingsPanel/BackButton", typeof(Button)); private static readonly UIPath SETTINGS_DEFAULT = new UIPath("MenuContainer/SettingsPanel/SetToDefault", typeof(Button)); private static readonly UIPath SETTINGS_KEYBINDINGS = new UIPath("MenuContainer/SettingsPanel/KeybindingsButton", typeof(Button)); private static readonly UIPath SETTINGS_KEYS_TITLE = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Controls (1)", typeof(TMP_Text)); private static readonly UIPath KEYS_SCROLL_BAR = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath KEYS_SCROLL_HANDLE = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private static readonly UIPath SETTINGS_KEYS_REBIND_TEXT = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Viewport/Content/RemapKeysContainer/KeybindsSectionText(Clone)", typeof(TMP_Text)); private static readonly UIPath SETTINGS_KEYS_BACK = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Back", typeof(Button)); private static readonly UIPath SETTINGS_KEYS_DEFAULT = new UIPath("MenuContainer/SettingsPanel/SetDefault", typeof(Button)); private static readonly UIPath CUSTOM_BG = new UIPath("MenuContainer/CustomMenuPanel/Image", typeof(Image)); private static readonly UIPath CUSTOM_PANEL_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel", typeof(Image)); private static readonly UIPath CUSTOM_BORDER = new UIPath("MenuContainer/CustomMenuPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath CUSTOM_TITLE = new UIPath("MenuContainer/CustomMenuPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath CUSTOM_TITLE_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel/Image", typeof(Image)); private static readonly UIPath CUSTOM_TEXT = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Viewport/Content/CreditsText", typeof(TMP_Text)); private static readonly UIPath CUSTOM_TEXT_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View", typeof(Image)); private static readonly UIPath CUSTOM_BACK = new UIPath("MenuContainer/CustomMenuPanel/Panel/BackButton", typeof(Button)); private static readonly UIPath CUSTOM_SCROLL_BAR = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath CUSTOM_SCROLL_HANDLE = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private Configurator ConfigManager => Configurator.Instance; public Color ThemeColor { get; set; } public Color Background1 { get; set; } public Color Background2 { get; set; } public Color Background3 { get; set; } public Color Background4 { get; set; } public Color Background5 { get; set; } public Color Background6 { get; set; } public Color Background7 { get; set; } public Color Background8 { get; set; } public Color BorderColor { get; set; } public Color Highlight { get; set; } public Color TextFontColor { get; set; } public Color SubTextColor { get; set; } public Color DarkTextColor { get; set; } public Color ScrollBarColor { get; set; } public Color Darken { get; set; } public Color ButtonRegText { get; set; } public Color ButtonHoverText { get; set; } public Color ButtonHoverBG { get; set; } public void RecolorSubMenus() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (ConfigManager.enableSubMenuColor.Value) { ThemeColor = ColorParser.RGBA(ConfigManager.subMenuColor.Value); InitializeThemeColors(); ApplyColors(); SetupDynamicRecoloring(); } } private void InitializeThemeColors() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_003b: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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) Background1 = AdjustColor(ThemeColor, 0f, 0.7882f); Background2 = AdjustColor(ThemeColor, 1f, 0.4902f); Background3 = AdjustColor(ThemeColor, 0.3396f, 0.7f); Background4 = AdjustColor(ThemeColor, 1f, 0.0353f); Background5 = AdjustColor(ThemeColor, 0.35f, 0.9f); Background6 = AdjustColor(ThemeColor, 0.4f, 0.5f); Background7 = AdjustColor(ThemeColor, 0.5f, 0.8f); Background8 = AdjustColor(ThemeColor, 0f, 0.95f); BorderColor = AdjustColor(ThemeColor, 0.6698f, 1f); Highlight = AdjustColor(ThemeColor, 1f, 0.9451f); TextFontColor = AdjustColor(ThemeColor, 0.9529f, 1f); SubTextColor = AdjustColor(ThemeColor, 1f, 0.4471f); DarkTextColor = AdjustColor(ThemeColor, 0.2f, 0.9f); ScrollBarColor = AdjustColor(ThemeColor, 0.5f, 0.3f); Darken = AdjustColor(ThemeColor, 0f, 0.2f); if (ConfigManager.enableUseMenuColors.Value) { ButtonRegText = ColorParser.RGBA(ConfigManager.menuFontColor.Value); ButtonHoverText = ColorParser.RGBA(ConfigManager.menuRolloverFontColor.Value); ButtonHoverBG = ColorParser.RGBA(ConfigManager.menuRolloverBGColor.Value); } else { ButtonRegText = Highlight; ButtonHoverText = Color.black; ButtonHoverBG = Highlight; } } private Color AdjustColor(Color baseColor, float factor, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return new Color(Mathf.Clamp(baseColor.r * factor, 0f, 1f), Mathf.Clamp(baseColor.g * factor, 0f, 1f), Mathf.Clamp(baseColor.b * factor, 0f, 1f), alpha); } public void ApplyColors() { //IL_0006: 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) //IL_0026: 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_0046: 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_0066: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01b1: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: 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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_079d: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0845: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08cf: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0904: Unknown result type (might be due to invalid IL or missing references) //IL_0914: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0963: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) SetColor(HOST_BG, Background8); SetColor(HOST_PANEL_BG, Background3); SetColor(HOST_BORDER, BorderColor); SetColor(HOST_LAN_TITLE, TextFontColor); SetColor(HOST_ONLINE_TITLE, TextFontColor); SetColor(HOST_ONLINE_INPUT_BG, Background2); SetColor(HOST_ONLINE_TAG_BORDER, BorderColor); SetColor(HOST_ONLINE_PUBLIC_BG, Background4); SetColor(HOST_ONLINE_PRIVATE_BG, Background4); SetColor(HOST_LAN_LOCAL_BG, Background4); SetColor(HOST_LAN_REMOTE_BG, Background4); SetColor(HOST_ONLINE_TAG_PLACE, TextFontColor); SetColor(HOST_ONLINE_TAG_TEXT, TextFontColor); SetColor(HOST_DESC, Highlight); SetColor(HOST_ONLINE_TAG_TEXT, TextFontColor); HandleToggleButtons(HOST_ONLINE_PUBLIC, HOST_ONLINE_PRIVATE); HandleToggleButtons(HOST_LAN_REMOTE, HOST_LAN_LOCAL); HoverButton(HOST_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); HoverButton(HOST_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); if (PluginFinder.MoreCompany) { SetColor(CREWCOUNT_TITLE, Highlight); SetColor(CREWCOUNT_INPUT_BG, Background2); SetColor(COSMO_BUTTON, Highlight); } SetColor(FILE_PANEL_BG, Background3); SetColor(FILE_BORDER, BorderColor); SetColor(FILE_TITLE, TextFontColor); SetColor(FILE_TIP, Highlight); SetColor(FILE_DARK, Darken); if (!PluginFinder.BetterSaves) { RecolorChildObjects(FILES_IMAGES, "File", "DeleteButton", TextFontColor); SetupHostButton(); } SetColor(LEAD_BORDER, BorderColor); SetColor(LEAD_TITLE, TextFontColor); HoverButton(LEAD_REFRESH, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_BACK, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_REMOVE, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_PLAY, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); SetColor(LEAD_SCROLL_BAR, ScrollBarColor); UpdateScrollbarColors(LEAD_SCROLL_HANDLE); UpdateDropdownColors(LEAD_DROP); SetColor(LEAD_DROP_TEXT, TextFontColor); SetColor(LEAD_DROP_ARROW, Highlight); SetColor(LEAD_DROP_BG, Background5); SetColor(LEAD_DROP_ITEM_BG, Background2); SetColor(LEAD_DROP_ITEM_CHECK, Background7); SetColor(LEAD_DROP_ITEM_TEXT, SubTextColor); UpdateToggleColors(LEAD_DROP_ITEM_TOGGLE); SetColor(LOBBY_BG, Background1); SetColor(LOBBY_PANEL_BG, Background3); SetColor(LOBBY_BORDER, BorderColor); SetColor(LOBBY_TITLE, SubTextColor); if (PluginFinder.LobbyCompat) { DelayHelper.StartDelayedAction(0.3f, delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SetColor(LOBBYCOMPAT_REFRESH, ButtonRegText); }); SetColor(LOBBYCOMPAT_REFRESH_HOVER, ButtonHoverBG); } else { HoverButton(LOBBY_REFRESH, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); } HoverButton(LOBBY_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(LOBBY_SCROLL_BAR, ScrollBarColor); UpdateScrollbarColors(LOBBY_SCROLL_HANDLE); SetColor(LOBBY_LIST_STATUS, Highlight); SetColor(LOBBY_TAG_BORDER, BorderColor); SetColor(LOBBY_TAG_TEXT, TextFontColor); SetColor(LOBBY_TAG_PLACEHOLDER, TextFontColor); SetColor(LOBBY_SORT_CHAL_BORDER, BorderColor); SetColor(LOBBY_SORT_CHAL_TEXT, TextFontColor); SetColor(LOBBY_SORT_CHAL_BOX, BorderColor); SetColor(LOBBY_SORT_CHAL_BOX_CHECK, BorderColor); UpdateDropdownColors(LOBBY_DROP); SetColor(LOBBY_DROP_TEXT, TextFontColor); SetColor(LOBBY_DROP_ARROW, Highlight); SetColor(LOBBY_DROP_BG, Background5); SetColor(LOBBY_DROP_ITEM_BG, Background2); SetColor(LOBBY_DROP_ITEM_CHECK, Background7); SetColor(LOBBY_DROP_ITEM_TEXT, SubTextColor); UpdateToggleColors(LOBBY_DROP_ITEM_TOGGLE); SetColor(LANWARN_BG, Background1); SetColor(LANWARN_PANEL_BG, Background3); SetColor(LANWARN_BORDER, BorderColor); SetColor(LANWARN_TEXT, SubTextColor); HoverButton(LANWARN_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NOTIFY_BG, Background1); SetColor(NOTIFY_PANEL_BG, Background3); SetColor(NOTIFY_BORDER, BorderColor); SetColor(NOTIFY_TEXT, SubTextColor); HoverButton(NOTIFY_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(DELETE_BG, Background1); SetColor(DELETE_PANEL_BG, Background3); SetColor(DELETE_BORDER, BorderColor); SetColor(DELETE_TEXT, SubTextColor); HoverButton(DELETE_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); HoverButton(DELETE_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(CREDITS_BG, Background1); SetColor(CREDITS_PANEL_BG, Background3); SetColor(CREDITS_BORDER, BorderColor); SetColor(CREDITS_TITLE, TextFontColor); SetColor(CREDITS_TITLE_BG, Color.clear); SetColor(CREDITS_TEXT, TextFontColor); SetColor(CREDITS_TEXT_BG, Background3); SetColor(CREDITS_SCROLL_BAR, ScrollBarColor); SetColor(CREDITS_SCROLL_HANDLE, BorderColor); HoverButton(CREDITS_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NEWS_BG, Background1); SetColor(NEWS_PANEL_BG, Background5); SetColor(NEWS_BORDER, BorderColor); SetColor(NEWS_TITLE, Highlight); SetColor(NEWS_TEXT, SubTextColor); HoverButton(NEWS_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NEWS_BOX_1, Background6); SetColor(NEWS_BOX_2, Background6); SetColor(NEWS_BOX_3, Background6); SetColor(NEWS_BOX_4, Background6); SetColor(NEWS_BOX_5, Background6); SetColor(NEWS_BOX_6, Background6); HoverButton(SETTINGS_KEYBINDINGS, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_CONFIRM, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_BACK, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_DEFAULT, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); SetColor(SETTINGS_KEYS_TITLE, Highlight); SetColor(KEYS_SCROLL_BAR, ScrollBarColor); SetColor(KEYS_SCROLL_HANDLE, Highlight); SetColorOnButtonClick(SETTINGS_KEYS_REBIND_TEXT, SETTINGS_KEYBINDINGS, TextFontColor); HoverButton(SETTINGS_KEYS_BACK, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_KEYS_DEFAULT, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); if (ConfigManager.enableCustomMenuItem.Value) { SetColor(CUSTOM_BG, Background1); SetColor(CUSTOM_PANEL_BG, Background3); SetColor(CUSTOM_BORDER, BorderColor); SetColor(CUSTOM_TITLE, TextFontColor); SetColor(CUSTOM_TITLE_BG, Color.clear); SetColor(CUSTOM_TEXT, TextFontColor); SetColor(CUSTOM_TEXT_BG, Background3); SetColor(CUSTOM_SCROLL_BAR, ScrollBarColor); SetColor(CUSTOM_SCROLL_HANDLE, BorderColor); HoverButton(CUSTOM_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); } } public void SetupDynamicRecoloring() { if ((Object)(object)DynamicColorManager.Instance == (Object)null) { LogWarden.LogError("DynamicColorManager instance not found."); return; } DynamicColorManager.Instance.SubMenuColors = this; string parentPath = "MenuContainer/LobbyList/ListPanel/Scroll View/Viewport/Content"; DynamicColorManager.Instance.AttachObserver(parentPath, this); string parentPath2 = "MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Viewport/Content/"; DynamicColorManager.Instance.AttachObserver(parentPath2, this); } public void UpdateScrollbarColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Scrollbar path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is Scrollbar)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is Scrollbar) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background2; ((ColorBlock)(ref colors)).highlightedColor = BorderColor; ((ColorBlock)(ref colors)).pressedColor = BorderColor; ((Selectable)obj).colors = colors; } public void UpdateDropdownColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Dropdown path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is TMP_Dropdown)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is TMP_Dropdown) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background2; ((ColorBlock)(ref colors)).highlightedColor = Highlight; ((ColorBlock)(ref colors)).pressedColor = Highlight; ((Selectable)obj).colors = colors; } public void UpdateToggleColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Toggle path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is Toggle)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is Toggle) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background6; ((ColorBlock)(ref colors)).highlightedColor = Background7; ((ColorBlock)(ref colors)).pressedColor = Background7; ((ColorBlock)(ref colors)).selectedColor = Background7; ((ColorBlock)(ref colors)).disabledColor = Darken; ((Selectable)obj).colors = colors; } public static void SetColor(UIPath uiPath, Color color) { //IL_004a: 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) Transform[] array = PathFinder.ProbeAll(uiPath.Path); if (array != null && array.Length > uiPath.Index) { Transform val = array[uiPath.Index]; if ((Object)(object)val != (Object)null) { TMP_Text component = ((Component)val).GetComponent<TMP_Text>(); if ((Object)(object)component != (Object)null) { component.overrideColorTags = true; ((Graphic)component).color = color; return; } Graphic component2 = ((Component)val).GetComponent<Graphic>(); if ((Object)(object)component2 != (Object)null) { component2.color = color; } else { LogWarden.LogError($"[SetColor] {uiPath.ComponentType.Name} component not found on object at '{uiPath.Path}' with index {uiPath.Index}."); } } else { LogWarden.LogError($"[SetColor] Object at index {uiPath.Index} not found at '{uiPath.Path}'."); } } else { LogWarden.LogError($"[SetColor] Not enough objects found at '{uiPath.Path}'. Expected at least {uiPath.Index + 1}, found {array.Length}."); } } private void RecolorChildObjects(UIPath parentUIPath, string parentNamePrefix, string childName, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(parentUIPath.Path); if ((Object)(object)val != (Object)null) { foreach (Transform item in val) { Transform val2 = item; if (((Object)val2).name.StartsWith(parentNamePrefix)) { Transform val3 = val2.Find(childName); if (Object.op_Implicit((Object)(object)val3)) { Component component = ((Component)val3).GetComponent(parentUIPath.ComponentType); Graphic val4 = (Graphic)(object)((component is Graphic) ? component : null); if (Object.op_Implicit((Object)(object)val4)) { val4.color = color; } else { LogWarden.LogError("[SubMenuColor] " + parentUIPath.ComponentType.Name + " component not found on child '" + childName + "' in parent '" + ((Object)val2).name + "'."); } } else { LogWarden.LogError("[SubMenuColor] Child '" + childName + "' not found in parent '" + ((Object)val2).name + "'."); } } } return; } LogWarden.LogError("[SubMenuColor] Parent path '" + parentUIPath.Path + "' not found."); } public static void HoverButton(UIPath uiPath, Color regularFontColor, Color highlightFontColor, Color regularBGColor, Color highlightBGColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val != (Object)null) { Button component = ((Component)val).GetComponent<Button>(); Animator component2 = ((Component)val).GetComponent<Animator>(); Image backgroundImage = ((Component)val).GetComponent<Image>(); Transform obj = val.Find("Text (TMP)"); TMP_Text textComponent = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component != (Object)null && (Object)(object)textComponent != (Object)null && (Object)(object)backgroundImage != (Object)null) { if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } ((Selectable)component).transition = (Transition)0; textComponent.overrideColorTags = true; ((Graphic)textComponent).color = regularFontColor; ((Behaviour)backgroundImage).enabled = true; backgroundImage.pixelsPerUnitMultiplier = 4f; ((Graphic)backgroundImage).color = regularBGColor; RectTransform component3 = ((Component)backgroundImage).GetComponent<RectTransform>(); if (component3 != null) { component3.SetSizeWithCurrentAnchors((Axis)1, 22f); } ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; }); EventTrigger component4 = ((Component)component).GetComponent<EventTrigger>(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } EventTrigger trigger = ((Component)component).gameObject.AddComponent<EventTrigger>(); AddEventTrigger(trigger, (EventTriggerType)0, delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; }); AddEventTrigger(trigger, (EventTriggerType)1, delegate { //IL_0007: 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) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; }); Transform obj2 = val.Find("SelectionHighlight"); CanvasRenderer val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<CanvasRenderer>() : null); if ((Object)(object)val2 != (Object)null) { val2.cull = true; } } else { LogWarden.LogError("[HoverButton] Required components not found at '" + uiPath.Path + "'."); } } else { LogWarden.LogError("[HoverButton] Failed to find path '" + uiPath.Path + "'."); } } private static void AddEventTrigger(EventTrigger trigger, EventTriggerType type, UnityAction<BaseEventData> action) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Entry val = new Entry { eventID = type }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action); trigger.triggers.Add(val); } private void HandleToggleButtons(UIPath buttonPath1, UIPath buttonPath2) { ToggleButton(buttonPath1, highlighted: false); ToggleButton(buttonPath2, highlighted: true); AttachToggleHandler(buttonPath1, buttonPath2); AttachToggleHandler(buttonPath2, buttonPath1); } private void AttachToggleHandler(UIPath buttonPath, UIPath otherButtonPath) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown Transform obj = PathFinder.Probe(buttonPath.Path); Button val = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null); if ((Object)(object)val != (Object)null) { ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ToggleButton(buttonPath, highlighted: true); }); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ToggleButton(otherButtonPath, highlighted: false); }); } else { LogWarden.LogError("[SubMenuColor] Button component not found at '" + buttonPath.Path + "'."); } } private void ToggleButton(UIPath buttonPath, bool highlighted) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(buttonPath.Path); Image val2 = ((val != null) ? ((Component)val).GetComponent<Image>() : null); Animator val3 = ((val != null) ? ((Component)val).GetComponent<Animator>() : null); if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = false; } if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; val2.pixelsPerUnitMultiplier = 4f; ((Graphic)val2).color = (highlighted ? ButtonHoverBG : Color.clear); Transform val4 = val.Find("SelectionHighlight"); if ((Object)(object)val4 != (Object)null) { Image component = ((Component)val4).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } } TMP_Text componentInChildren = ((Component)val).GetComponentInChildren<TMP_Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.overrideColorTags = true; ((Graphic)componentInChildren).color = (highlighted ? ButtonHoverText : ButtonRegText); componentInChildren.extraPadding = true; componentInChildren.fontSizeMax = 13f; componentInChildren.fontStyle = (FontStyles)16; RectTransform rectTransform = componentInChildren.rectTransform; Vector3 localScale = ((Transform)rectTransform).localScale; ((Transform)rectTransform).localScale = new Vector3(localScale.x, 1.1f, localScale.z); } { foreach (Transform item in val) { TMP_Text[] componentsInChildren = ((Component)item).GetComponentsInChildren<TMP_Text>(); foreach (TMP_Text val5 in componentsInChildren) { if (((Object)((Component)val5).gameObject).name == "StatsText") { val5.overrideColorTags = true; ((Graphic)val5).color = (highlighted ? ButtonHoverText : ButtonRegText); } } } return; } } LogWarden.LogError("[SubMenuColor] Image component for highlight not found at '" + buttonPath.Path + "'."); } private void SetupHostButton() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown Transform val = PathFinder.Probe(HOST_BUTTON.Path); if ((Object)(object)val != (Object)null) { Button component = ((Component)val).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { ((UnityEvent)component.onClick).RemoveListener(new UnityAction(HandleSaveButtons)); ((UnityEvent)component.onClick).AddListener(new UnityAction(HandleSaveButtons)); LogWarden.LogInfo("Listener added to host button to handle save buttons."); } else { LogWarden.LogError("Host button component not found."); } } else { LogWarden.LogError("Host button path not found."); } } private void HandleSaveButtons() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(FILES_BUTTON.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[SubMenuColor] Parent path '" + FILES_BUTTON.Path + "' not found."); return; } List<Button> list = new List<Button>(); foreach (Transform item in val) { Button component = ((Component)item).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { list.Add(component); } } foreach (Button item2 in list) { if (EmblemPlugin.SaveFileStrings.TryGetValue(((Component)item2).gameObject, out var value)) { bool highlighted = GameNetworkManager.Instance.currentSaveFileName == value; UIPath buttonPath = new UIPath(((Object)item2).name, typeof(Button)); ToggleButton(buttonPath, highlighted); } } AttachToggleHandlerToAll(list.ToArray()); } private void AttachToggleHandlerToAll(Button[] allButtons) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown Button[] array = allButtons; foreach (Button button in array) { ((UnityEventBase)button.onClick).RemoveAllListeners(); ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { Button[] array2 = allButtons; foreach (Button val in array2) { bool highlighted = (Object)(object)val == (Object)(object)button; UIPath buttonPath = new UIPath(((Object)val).name, typeof(Button)); ToggleButton(buttonPath, highlighted); } }); } } private void SetColorOnButtonClick(UIPath targetUIPath, UIPath triggerUIPath, Color color) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.ProbeAll(triggerUIPath.Path)?.ElementAtOrDefault(triggerUIPath.Index); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.AddComponent<ColorSetter>().SetupColorChangeDeferred(targetUIPath, triggerUIPath.ComponentType, color); } else { LogWarden.LogError("[SetColorOnButtonClick] Trigger object not found."); } } public void RecolorCosmoButton() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (PluginFinder.MoreCompany) { InitializeThemeColors(); SetColor(COSMO_BUTTON, Highlight); } } } [BepInPlugin("Darkbrewery.Emblem", "Emblem", "1.5.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EmblemPlugin : BaseUnityPlugin { public static Dictionary<GameObject, string> SaveFileStrings = new Dictionary<GameObject, string>(); private UIComponent uiComponent; private HeaderReplacement headerReplacement; private Boardwalk boardwalk; private BackgroundManager backgroundManager; private LoadingText loadingText; private MenuMoodSetter menuMoodSetter; private Harmony harmony; private CustomMediaManager customMediaManager; private SceneManagerHelper sceneManagerHelper; private InterfaceDecorator interfaceDecorator; private VersionStyler versionStyler; private Slideshow slideshow; private SubMenuColor subMenuColor; private void Awake() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (PluginFinder.LobbyCompat) { LobbyCCheck.Init(); } LogWarden.Initialize(((BaseUnityPlugin)this).Logger); LogWarden.LogInfo(" --------------------------------------------------------------------- "); LogWarden.LogInfo(" %% EEEEE M M BBBBB L EEEEE M M %% "); LogWarden.LogInfo("# * == E MM MM B B L E MM MM == * #"); LogWarden.LogInfo(" * * EEEE M M M M BBBBB L EEEE M M M M * * "); LogWarden.LogInfo("# * == E M M M B B L E M M M == * #"); LogWarden.LogInfo(" %% EEEEE M M BBBBB LLLLL EEEEE M M %% "); LogWarden.LogInfo(" ------------------------- BY DARKBREWERY ---------------------------- "); LogWarden.LogInfo("Stirring from darkness..."); try { harmony = new Harmony("com.darkbrewery.emblem.harmony"); Configurator.InitializeInstance(((BaseUnityPlugin)this).Config); customMediaManager = new CustomMediaManager(); uiComponent = new UIComponent(); backgroundManager = new BackgroundManager(); headerReplacement = new HeaderReplacement(); boardwalk = new Boardwalk(); loadingText = new LoadingText(); menuMoodSetter = new MenuMoodSetter(); versionStyler = new VersionStyler(); slideshow = new Slideshow(((Component)this).transform); subMenuColor = new SubMenuColor(); interfaceDecorator = new InterfaceDecorator(uiComponent, backgroundManager, headerReplacement, boardwalk, loadingText, menuMoodSetter, versionStyler, slideshow, subMenuColor); sceneManagerHelper = new SceneManagerHelper(interfaceDecorator); harmony.PatchAll(); LogWarden.LogInfo("Successfully deployed, its intent shrouded"); } catch (Exception arg) { LogWarden.LogError($"Error initializing Emblem plugin: {arg}"); } } } public class ColorSetter : MonoBehaviour { private SubMenuColor.UIPath targetUIPath; private Color newColor; private Type triggerComponentType; private Button button; private void OnDestroy() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)button != (Object)null) { ((UnityEvent)button.onClick).RemoveListener(new UnityAction(OnButtonClick)); } } public void SetupColorChangeDeferred(SubMenuColor.UIPath targetPath, Type triggerCompType, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown targetUIPath = targetPath; newColor = color; triggerComponentType = triggerCompType; ref Button reference = ref button; Component component = ((Component)this).GetComponent(triggerComponentType); reference = (Button)(object)((component is Button) ? component : null); if ((Object)(object)button != (Object)null) { ((UnityEvent)button.onClick).RemoveListener(new UnityAction(OnButtonClick)); ((UnityEvent)button.onClick).AddListener(new UnityAction(OnButtonClick)); } else { LogWarden.LogError("[ColorSetter] Trigger component not found on this gameObject."); } } private void OnButtonClick() { ((MonoBehaviour)this).StartCoroutine(WaitForTargetAndApplyColor()); } private IEnumerator WaitForTargetAndApplyColor() { Transform targetTransform = null; while ((Object)(object)targetTransform == (Object)null) { targetTransform = PathFinder.ProbeAll(targetUIPath.Path)?.ElementAtOrDefault(targetUIPath.Index); if ((Object)(object)targetTransform == (Object)null) { yield return (object)new WaitForSeconds(0.5f); } } Component component = ((Component)targetTransform).GetComponent(targetUIPath.ComponentType); Graphic val = (Graphic)(object)((component is Graphic) ? component : null); if ((Object)(object)val != (Object)null) { val.color = newColor; } else { LogWarden.LogError("[ColorSetter] " + targetUIPath.ComponentType.Name + " component not found on target object."); } } } public class DelayHelper : MonoBehaviour { private static DelayHelper instance; private Dictionary<string, Coroutine> coroutineDictionary = new Dictionary<string, Coroutine>(); private Dictionary<TextMeshProUGUI, Coroutine> typingCoroutines = new Dictionary<TextMeshProUGUI, Coroutine>(); private static DelayHelper GetInstance() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("GlobalDelayHelper"); instance = val.AddComponent<DelayHelper>(); Object.DontDestroyOnLoad((Object)val); } return instance; } public static void StopAll() { foreach (Coroutine value in GetInstance().coroutineDictionary.Values) { ((MonoBehaviour)GetInstance()).StopCoroutine(value); } GetInstance().coroutineDictionary.Clear(); } public static void StartDelayedAction(float delayInSeconds, Action action) { GetInstance().DelayedAction(delayInSeconds, action); } private void DelayedAction(float delayInSeconds, Action action) { ((MonoBehaviour)this).StartCoroutine(DelayCoroutine(delayInSeconds, action)); } private IEnumerator DelayCoroutine(float delayInSeconds, Action action) { yield return (object)new WaitForSeconds(delayInSeconds); action?.Invoke(); } public static void StartRepeatingAction(string name, float intervalInSeconds, Action action) { StopRepeatingAction(name); Coroutine value = ((MonoBehaviour)GetInstance()).StartCoroutine(GetInstance().RepeatingActionCoroutine(intervalInSeconds, action)); GetInstance().coroutineDictionary[name] = value; } public static void StopRepeatingAction(string name) { if ((Object)(object)instance != (Object)null && instance.coroutineDictionary.TryGetValue(name, out var value)) { ((MonoBehaviour)instance).StopCoroutine(value); instance.coroutineDictionary.Remove(name); } } private IEnumerator RepeatingActionCoroutine(float intervalInSeconds, Action action) { while (true) { yield return (object)new WaitForSeconds(intervalInSeconds); action?.Invoke(); } } public static void StartFadeAction(Image image, float duration, Action onComplete = null) { GetInstance().FadeImageCoroutine(image, duration, onComplete); } private void FadeImageCoroutine(Image image, float duration, Action onComplete) { ((MonoBehaviour)this).StartCoroutine(FadeImage(image, duration, onComplete)); } private IEnumerator FadeImage(Image image, float duration, Action onComplete) { float currentTime = 0f; Color startColor = ((Graphic)image).color; Color endColor = new Color(startColor.r, startColor.g, startColor.b, 0f); while (currentTime < duration) { currentTime += Time.deltaTime; ((Graphic)image).color = Color.Lerp(startColor, endColor, currentTime / duration); yield return null; } ((Graphic)image).color = endColor; onComplete?.Invoke(); } public static void StartTypingText(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration = 0.3f, int flashCount = 2) { GetInstance().TypingTextCoroutine(textComponent, text, typingSpeed, flashDuration, flashCount); } private void TypingTextCoroutine(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration, int flashCount) { if (typingCoroutines.TryGetValue(textComponent, out var value)) { ((MonoBehaviour)this).StopCoroutine(value); typingCoroutines.Remove(textComponent); } Coroutine value2 = ((MonoBehaviour)this).StartCoroutine(TypeTextWithCursorFlash(textComponent, text, typingSpeed, flashDuration, flashCount)); typingCoroutines[textComponent] = value2; } private IEnumerator TypeTextWithCursorFlash(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration, int flashCount) { StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < flashCount; j++) { ((TMP_Text)textComponent).text = "_"; yield return (object)new WaitForSeconds(flashDuration); ((TMP_Text)textComponent).text = ""; yield return (object)new WaitForSeconds(flashDuration); } foreach (char value in text) { stringBuilder.Append(value); ((TMP_Text)textComponent).text = stringBuilder.ToString() + "_"; yield return (object)new WaitForSeconds(typingSpeed); ((TMP_Text)textComponent).text = stringBuilder.ToString(); } } } public class EmblemFolder { private readonly string basePluginsPath; private readonly Dictionary<string, string> fullPathCache = new Dictionary<string, string>(); private readonly Dictionary<string, IEnumerable<string>> validPathsCache = new Dictionary<string, IEnumerable<string>>(); private readonly Lazy<IEnumerable<string>> emblemDirectories; public EmblemFolder() { basePluginsPath = Path.Combine(Paths.BepInExRootPath, "plugins"); emblemDirectories = new Lazy<IEnumerable<string>>(() => FindEmblemDirectories()); } private IEnumerable<string> FindEmblemDirectories() { try { return (from dir in Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories) where Path.GetFileName(dir).Equals("Emblem", StringComparison.OrdinalIgnoreCase) select dir).ToList(); } catch (Exception ex) { LogWarden.LogError("[EmblemFolder] Error finding Emblem directories: " + ex.Message); return new List<string>(); } } public string FindFullPath(string inputPath) { if (fullPathCache.TryGetValue(inputPath, out var value)) { return value; } string path = ExtractRelativePathFromEmblem(inputPath); string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories); foreach (string text in directories) { if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase)) { string text2 = Path.Combine(text, path); if (File.Exists(text2) || Directory.Exists(text2)) { fullPathCache[inputPath] = text2; return text2; } } } LogWarden.LogError("[EmblemFolder] Could not find a valid path for: " + inputPath); return null; } public IEnumerable<string> FindAllValidPaths(string inputPathPattern) { if (validPathsCache.TryGetValue(inputPathPattern, out var value)) { return value; } string path = ExtractRelativePathFromEmblem(inputPathPattern); string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories); List<string> list = new List<string>(); string[] array = directories; foreach (string text in array) { if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase)) { string searchPattern = Path.Combine(text, path); list.AddRange(Directory.GetFiles(text, searchPattern, SearchOption.AllDirectories)); } } validPathsCache[inputPathPattern] = list; return list; } private string ExtractRelativePathFromEmblem(string path) { string[] array = path.Split(new char[2] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries); int num = Array.FindIndex(array, (string segment) => segment.Equals("Emblem", StringComparison.OrdinalIgnoreCase)); if (num != -1 && num < array.Length - 1) { return Path.Combine(array.Skip(num + 1).ToArray()); } return path; } } public class ImageFilters { private readonly Configurator configManager; public ImageFilters(Configurator configManager) { this.configManager = configManager; } public void Blend(string targetImagePath, Color vignetteColor) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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) Transform val = PathFinder.Probe(targetImagePath); if ((Object)(object)val == (Object)null) { LogWarden.LogError("ImageFilters.Blend: Image with path '" + targetImagePath + "' not found."); return; } GameObject gameObject = ((Component)val).gameObject; Transform val2 = gameObject.transform.Find("VignetteOverlay"); if (!configManager.enableRadiantTaper.Value) { if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); LogWarden.LogInfo("ImageFilters.Blend: Vignette effect removed from '" + targetImagePath + "'."); } return; } GameObject val3; if ((Object)(object)val2 != (Object)null) { val3 = ((Component)val2).gameObject; } else { val3 = new GameObject("VignetteOverlay"); RectTransform obj = val3.AddComponent<RectTransform>(); ((Transform)obj).SetParent(gameObject.transform, false); ((Transform)obj).SetAsLastSibling(); Rect rect = gameObject.GetComponent<RectTransform>().rect; float width = ((Rect)(ref rect)).width; rect = gameObject.GetComponent<RectTransform>().rect; obj.sizeDelta = new Vector2(width, ((Rect)(ref rect)).height); } Image obj2 = val3.GetComponent<Image>() ?? val3.AddComponent<Image>(); Texture2D val4 = CreateVignetteTexture(((Texture)gameObject.GetComponent<Image>().sprite.texture).width, ((Texture)gameObject.GetComponent<Image>().sprite.texture).height, vignetteColor); obj2.sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f)); ((Graphic)obj2).raycastTarget = false; } private Texture2D CreateVignetteTexture(int width, int height, Color vignetteColor) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); Color val2 = default(Color); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float distance2 = j; float distance3 = width - j; float distance4 = height - i; float distance5 = i; float num = Mathf.Max(CalculateExponentialBlend(distance2, width), CalculateExponentialBlend(distance3, width)); float num2 = Mathf.Max(CalculateExponentialBlend(distance4, height), CalculateExponentialBlend(distance5, height)); float num3 = Mathf.Max(num, num2); ((Color)(ref val2))..ctor(vignetteColor.r, vignetteColor.g, vignetteColor.b, num3); val.SetPixel(j, i, val2); } } val.Apply(); return val; static float CalculateExponentialBlend(floa
Monsters/BepInEx/plugins/ZoLoKinoBabo112/com.github.zehsteam.Hitmarker.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; using com.github.zehsteam.Hitmarker.MonoBehaviours; using com.github.zehsteam.Hitmarker.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.zehsteam.Hitmarker")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Shows a hitmarker when you successfully hit an enemy. With additional features. (Client-side)")] [assembly: AssemblyFileVersion("1.2.3.0")] [assembly: AssemblyInformationalVersion("1.2.3+9f550c00a965039c6c13c3bda8cf3750925b11f7")] [assembly: AssemblyProduct("Hitmarker")] [assembly: AssemblyTitle("com.github.zehsteam.Hitmarker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace com.github.zehsteam.Hitmarker { internal class ConfigManager { public ConfigEntry<bool> ExtendedLogging { get; private set; } public ConfigEntry<bool> ShowHitmarkerImage { get; private set; } public ConfigEntry<int> HitmarkerImageSize { get; private set; } public ConfigEntry<bool> PlayHitmarkerSound { get; private set; } public ConfigEntry<float> MessageDuration { get; private set; } public ConfigEntry<int> MessageFontSize { get; private set; } public ConfigEntry<bool> ShowDamageMessage { get; private set; } public ConfigEntry<bool> ShowKillMessage { get; private set; } public ConfigEntry<bool> OnlyShowLocalKillMessage { get; private set; } public ConfigManager() { BindConfigs(); ClearUnusedEntries(); } private void BindConfigs() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; ExtendedLogging = config.Bind<bool>("General Settings", "ExtendedLogging", false, "Enable extended logging."); ShowHitmarkerImage = config.Bind<bool>("Hitmarker Settings", "ShowHitmarkerImage", true, "Do you want to show the hitmarker image?"); HitmarkerImageSize = config.Bind<int>("Hitmarker Settings", "HitmarkerImageSize", 40, new ConfigDescription("The size of the hitmarker image in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); PlayHitmarkerSound = config.Bind<bool>("Hitmarker Settings", "PlayHitmarkerSound", true, "Do you want to play the hitmarker sound?"); MessageDuration = config.Bind<float>("Message Settings", "MessageDuration", 4f, "The message duration in seconds."); MessageFontSize = config.Bind<int>("Message Settings", "MessageFontSize", 35, new ConfigDescription("The message font size in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); ShowDamageMessage = config.Bind<bool>("Message Settings", "ShowDamageMessage", true, "Shows a message of how much damage you did to an enemy."); ShowKillMessage = config.Bind<bool>("Message Settings", "ShowKillMessage", true, "Shows a message when an enemy is killed."); OnlyShowLocalKillMessage = config.Bind<bool>("Message Settings", "OnlyShowLocalKillMessage", true, "Will only show your kill messages."); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal class Content { public static GameObject HitmarkerCanvasPrefab; public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, "hitmarker_assets"); AssetBundle val = AssetBundle.LoadFromFile(text); HitmarkerCanvasPrefab = val.LoadAsset<GameObject>("HitmarkerCanvas"); Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}"); } } } [BepInPlugin("com.github.zehsteam.Hitmarker", "Hitmarker", "1.2.3")] internal class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.github.zehsteam.Hitmarker"); internal static Plugin Instance; internal static ManualLogSource logger; internal static ConfigManager ConfigManager; internal static bool IsHostOrServer => NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("com.github.zehsteam.Hitmarker"); logger.LogInfo((object)"Hitmarker has awoken!"); harmony.PatchAll(typeof(HUDManagerPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); ConfigManager = new ConfigManager(); Content.Load(); } public void CreateHitmarkerCanvas() { if (!((Object)(object)HitmarkerCanvasBehaviour.Instance != (Object)null)) { Object.Instantiate<GameObject>(Content.HitmarkerCanvasPrefab); logger.LogInfo((object)"Instantiated Hitmarker canvas."); } } public void LogInfoExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogInfo(data); } } } internal class Utils { public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)playerScript; } public static PlayerControllerB GetPlayerScript(int playerWhoHit) { if (playerWhoHit < 0 || playerWhoHit > StartOfRound.Instance.allPlayerScripts.Length - 1) { return null; } return StartOfRound.Instance.allPlayerScripts[playerWhoHit]; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.Hitmarker"; public const string PLUGIN_NAME = "Hitmarker"; public const string PLUGIN_VERSION = "1.2.3"; } } namespace com.github.zehsteam.Hitmarker.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPatch("HitEnemyOnLocalClient")] [HarmonyPrefix] private static void HitEnemyOnLocalClientPatch(ref EnemyAI __instance, int force, PlayerControllerB playerWhoHit = null) { if (!((Object)(object)playerWhoHit == (Object)null) && Utils.IsLocalPlayer(playerWhoHit)) { HitEnemy(__instance, force, playerWhoHit); } } [HarmonyPatch("HitEnemyServerRpc")] [HarmonyPrefix] private static void HitEnemyServerRpcPatch(ref EnemyAI __instance, int force, int playerWhoHit) { if (playerWhoHit != -1) { PlayerControllerB playerScript = Utils.GetPlayerScript(playerWhoHit); if (!Utils.IsLocalPlayer(playerScript)) { HitEnemy(__instance, force, playerScript); } } } [HarmonyPatch("HitEnemyClientRpc")] [HarmonyPrefix] private static void HitEnemyClientRpcPatch(ref EnemyAI __instance, int force, int playerWhoHit) { if (playerWhoHit != -1 && !Plugin.IsHostOrServer) { PlayerControllerB playerScript = Utils.GetPlayerScript(playerWhoHit); if (!Utils.IsLocalPlayer(playerScript)) { HitEnemy(__instance, force, playerScript); } } } private static void HitEnemy(EnemyAI enemyAI, int force, PlayerControllerB playerWhoHit) { if (enemyAI.enemyType.canDie && !enemyAI.isEnemyDead && enemyAI.enemyHP > 0) { bool flag = Utils.IsLocalPlayer(playerWhoHit); string enemyName = enemyAI.enemyType.enemyName; bool flag2 = enemyAI.enemyHP - force <= 0; if (flag) { HitmarkerCanvasBehaviour.Instance.ShowHitmarker(flag2); HitmarkerCanvasBehaviour.Instance.ShowDamageMessage(enemyName, force); } if (flag2) { HitmarkerCanvasBehaviour.Instance.ShowKillMessage(enemyName, flag, playerWhoHit.playerUsername); } LogInfoExtended("HitEnemy();", enemyAI, force, playerWhoHit); } } private static void LogInfoExtended(string functionName, EnemyAI enemyAI, int force, PlayerControllerB playerWhoHit) { NetworkObject component = ((Component)enemyAI).gameObject.GetComponent<NetworkObject>(); string text = (Utils.IsLocalPlayer(playerWhoHit) ? " (LOCAL)" : ""); string text2 = $"{functionName} NetworkObjectId: {component.NetworkObjectId}\n\n"; text2 += $"Player \"{playerWhoHit.playerUsername}\"{text} hit \"{enemyAI.enemyType.enemyName}\" for {force} force.\n"; text2 += $"isEnemyDead: {enemyAI.isEnemyDead}, enemyHP: {enemyAI.enemyHP}, (new enemyHP should be {enemyAI.enemyHP - force})\n"; Plugin.Instance.LogInfoExtended("\n\n" + text2.Trim() + "\n"); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { Plugin.Instance.CreateHitmarkerCanvas(); } } } namespace com.github.zehsteam.Hitmarker.MonoBehaviours { public class HitmarkerCanvasBehaviour : MonoBehaviour { public static HitmarkerCanvasBehaviour Instance; public HitmarkerImageBehaviour HitmarkerImageBehaviour; public AudioClip HitSFX; public RectTransform MessageListTransform; public RectTransform MessageItemPrefab; private Queue<RectTransform> _messageItemPool = new Queue<RectTransform>(); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } private void Start() { InitializeMessageItemPool(); } private void InitializeMessageItemPool() { _messageItemPool = new Queue<RectTransform>(); for (int i = 0; i < 20; i++) { RectTransform val = Object.Instantiate<RectTransform>(MessageItemPrefab, (Transform)(object)MessageListTransform); ((Component)val).gameObject.SetActive(false); _messageItemPool.Enqueue(val); } } public void ShowHitmarker(bool killed = false) { ShowHitmarkerImage(killed); PlayHitSFX(); } private void ShowHitmarkerImage(bool killed = false) { if (Plugin.ConfigManager.ShowHitmarkerImage.Value) { HitmarkerImageBehaviour.ShowImage(killed); } } private void PlayHitSFX() { if (Plugin.ConfigManager.PlayHitmarkerSound.Value) { HUDManager.Instance.UIAudio.PlayOneShot(HitSFX); } } public void ShowDamageMessage(string enemyName, int damage = 1) { if (Plugin.ConfigManager.ShowDamageMessage.Value) { ShowMessage($"{enemyName} -{damage} HP"); } } public void ShowKillMessage(string enemyName, bool fromLocalPlayer = true, string fromPlayerName = "") { //IL_0063: 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) if (Plugin.ConfigManager.ShowKillMessage.Value && (fromLocalPlayer || !Plugin.ConfigManager.OnlyShowLocalKillMessage.Value)) { if (!fromLocalPlayer) { ShowMessage(fromPlayerName + " Killed " + enemyName, Color.red); } else { ShowMessage("Killed " + enemyName, Color.red); } } } private void ShowMessage(string text) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ShowMessage(text, Color.white); } private void ShowMessage(string text, Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SpawnMessageItemFromPool(text, color); } private RectTransform SpawnMessageItemFromPool(string text, Color color) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (_messageItemPool == null || _messageItemPool.Count == 0) { Plugin.logger.LogError((object)"Error: Failed to spawn message item from pool. Message item pool is either null or empty."); return null; } RectTransform val = _messageItemPool.Dequeue(); ((Component)val).gameObject.SetActive(true); ((Transform)val).SetAsLastSibling(); MessageItemBehaviour messageItemBehaviour = default(MessageItemBehaviour); if (((Component)val).TryGetComponent<MessageItemBehaviour>(ref messageItemBehaviour)) { messageItemBehaviour.SetText(text, color); } _messageItemPool.Enqueue(val); return val; } } public class HitmarkerImageBehaviour : MonoBehaviour { public Image Image; public Color32 DefaultColor; public Color32 KilledColor; private Coroutine _fadeOutCoroutine; private void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.ConfigManager.HitmarkerImageSize.Value; ((Graphic)Image).rectTransform.sizeDelta = new Vector2((float)value, (float)value); SetAlpha(0f); } public void ShowImage(bool killed = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)Image).color = Color32.op_Implicit(killed ? KilledColor : DefaultColor); if (_fadeOutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeOutCoroutine); } _fadeOutCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeOut(0.25f)); } private IEnumerator FadeOut(float duration) { SetAlpha(255f); for (float timer = 0f; timer < duration; timer += Time.deltaTime) { float percent = 1f / duration * timer; float alpha = 255f + -255f * percent; SetAlpha(alpha); yield return null; } SetAlpha(0f); } private void SetAlpha(float a) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) a = Mathf.Clamp(a, 0f, 255f); Color32 val = Color32.op_Implicit(((Graphic)Image).color); val.a = (byte)a; ((Graphic)Image).color = Color32.op_Implicit(val); } } public class MessageItemBehaviour : MonoBehaviour { public TextMeshProUGUI TextUGUI; private Coroutine _animationCoroutine; private void Start() { ((TMP_Text)TextUGUI).fontSize = Plugin.ConfigManager.MessageFontSize.Value; } private void OnEnable() { if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); } _animationCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayAnimation()); } private void OnDisable() { if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); } } private IEnumerator PlayAnimation() { yield return (object)new WaitForSeconds(Plugin.ConfigManager.MessageDuration.Value); float fadeOutDuration = 1f; SetAlpha(255f); for (float timer = 0f; timer < fadeOutDuration; timer += Time.deltaTime) { float percent = 1f / fadeOutDuration * timer; float alpha = 255f + -255f * percent; SetAlpha(alpha); yield return null; } SetAlpha(0f); yield return null; ((Component)this).gameObject.SetActive(false); } public void SetText(string text) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetText(text, Color.white); } public void SetText(string text, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)TextUGUI).text = text; ((Graphic)TextUGUI).color = color; } private void SetAlpha(float a) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) a = Mathf.Clamp(a, 0f, 255f); Color32 val = Color32.op_Implicit(((Graphic)TextUGUI).color); val.a = (byte)a; ((Graphic)TextUGUI).color = Color32.op_Implicit(val); } } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/CountryRoadCreature.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BigEyes.Utils; using CountryRoadCreature.Scripts; using GameNetcodeStuff; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CountryRoadCreature")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("CountryRoadCreature")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e5ba556cb7ea393620136a7365e89d1a9f25646b")] [assembly: AssemblyProduct("CountryRoadCreature")] [assembly: AssemblyTitle("CountryRoadCreature")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BigEyes.Utils { public class RegisterUtil { public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount) { enemy.MaxCount = spawnCount; enemy.PowerLevel = powerLevel; var (dictionary, dictionary2) = ConfigParsing(configMoonRarity); Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword); } public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap) { var (dictionary, dictionary2) = ConfigParsing(configMoonRarity); Items.RegisterScrap(scrap, dictionary, dictionary2); } public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity) { Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost); if (enabledScrap) { RegisterScrapWithConfig(configMoonRarity, item); } } public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (string item in from s in configMoonRarity.Split(',') select s.Trim()) { string[] array = item.Split(':'); if (array.Length != 2) { continue; } string text = array[0]; if (!int.TryParse(array[1], out var result)) { continue; } if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; continue; } string value = text + "Level"; if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2)) { dictionary[result2] = result; } else { dictionary2[text] = result; } } return (dictionary, dictionary2); } } } namespace CountryRoadCreature { [BepInPlugin("wexop.country_road_creature", "CountryRoadCreature", "1.0.7")] [BepInDependency("evaisa.lethallib", "0.15.1")] public class CountryRoadCreaturePlugin : BaseUnityPlugin { private const string GUID = "wexop.country_road_creature"; private const string NAME = "CountryRoadCreature"; private const string VERSION = "1.0.7"; public Dictionary<int, LightInformation> lightsInUse = new Dictionary<int, LightInformation>(); public static CountryRoadCreaturePlugin instance; public ConfigEntry<string> spawnMoonRarity; public ConfigEntry<string> headScrapMoonRarity; public ConfigEntry<string> handScrapMoonRarity; public ConfigEntry<int> maxCountryRoadCreatureSpawnNb; public ConfigEntry<float> countryRoadBaseSpeed; public ConfigEntry<float> countryRoadMaxSpeedMutliplier; public ConfigEntry<int> scrapHitPlayerChance; private void Awake() { instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"CountryRoadCreature starting...."); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "countryroadcreature"); AssetBundle bundle = AssetBundle.LoadFromFile(text); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CountryRoadCreature bundle found !"); LoadConfigs(); RegisterMonster(bundle); RegisterScrap(bundle); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CountryRoadCreature is ready!"); } private void LoadConfigs() { spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SpawnRarity", "Modded:40,ExperimentationLevel:20,AssuranceLevel:20,VowLevel:20,OffenseLevel:25,MarchLevel:25,RendLevel:30,DineLevel:30,TitanLevel:50,Adamance:50,Embrion:50,Artifice:55", "Chance for Country road creature to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game."); CreateStringConfig(spawnMoonRarity, requireRestart: true); maxCountryRoadCreatureSpawnNb = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxSpawnNumber", 1, "Max country road creatures spawn number. You need to restart the game."); CreateIntConfig(maxCountryRoadCreatureSpawnNb); handScrapMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "HandScrapSpawnRarity", "Modded:30,ExperimentationLevel:20,AssuranceLevel:20,VowLevel:25,OffenseLevel:25,MarchLevel:30,RendLevel:35,DineLevel:35,TitanLevel:35,Adamance:35,Embrion:35,Artifice:40", "Chance for creature hand scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game."); CreateStringConfig(handScrapMoonRarity, requireRestart: true); headScrapMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "HeadScrapSpawnRarity", "Modded:10,ExperimentationLevel:5,AssuranceLevel:5,VowLevel:10,OffenseLevel:10,MarchLevel:10,RendLevel:13,DineLevel:13,TitanLevel:15,Adamance:15,Embrion:20,Artifice:22", "Chance for creature head scrap to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game."); CreateStringConfig(headScrapMoonRarity, requireRestart: true); scrapHitPlayerChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HeadScrapHitPlayerChance", 10, "Chance for creature head scrap item to hit player after lights animation. You don't need to restart the game."); CreateIntConfig(scrapHitPlayerChance); countryRoadBaseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("MonsterBehavior", "CountryRoadBaseSpeed", 3.33f, "Country road Creature base speed. You don't need to restart the game."); CreateFloatConfig(countryRoadBaseSpeed); countryRoadMaxSpeedMutliplier = ((BaseUnityPlugin)this).Config.Bind<float>("MonsterBehavior", "CountryRoadMaxSpeedMultiplier", 2.4f, "Country road Creature max speed multiplier, based on his angry gauge. You don't need to restart the game."); CreateFloatConfig(countryRoadMaxSpeedMutliplier, 1f, 50f); } private void RegisterMonster(AssetBundle bundle) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/CountryRoadCreature/CountryRoadCreature.asset"); val.MaxCount = maxCountryRoadCreatureSpawnNb.Value; ((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND")); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.enemyPrefab} prefab"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Utilities.FixMixerGroups(val.enemyPrefab); TerminalNode val2 = new TerminalNode(); val2.creatureName = "CountryRoadCreature"; val2.displayText = "Run."; TerminalKeyword val3 = new TerminalKeyword(); val3.word = "CountryRoadCreature"; RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, val2, val3, val.PowerLevel, val.MaxCount); } private void RegisterScrap(AssetBundle bundle) { Item val = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/CountryRoadCreature/CountryRoadCreatureScrap.asset"); ((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND")); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.spawnPrefab} prefab"); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); RegisterUtil.RegisterScrapWithConfig(headScrapMoonRarity.Value, val); Item val2 = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/CountryRoadCreature/CountryRoadCreatureHandScrap.asset"); ((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val2).name + " FOUND")); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val2.spawnPrefab} prefab"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); RegisterUtil.RegisterScrapWithConfig(handScrapMoonRarity.Value, val2); } private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = min; ((BaseRangeOptions<float>)val).Max = max; ((BaseOptions)val).RequiresRestart = false; FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown IntSliderOptions val = new IntSliderOptions(); ((BaseRangeOptions<int>)val).Min = min; ((BaseRangeOptions<int>)val).Max = max; ((BaseOptions)val).RequiresRestart = false; IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions { RequiresRestart = requireRestart }); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); } } public static class PluginInfo { public const string PLUGIN_GUID = "CountryRoadCreature"; public const string PLUGIN_NAME = "CountryRoadCreature"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CountryRoadCreature.Scripts { public class CountryRoadCreatureEnemyAI : EnemyAI { public AudioClip seePlayerSound; public List<AudioClip> walkSounds; public AudioClip screamSound; public AudioClip runSound; public AudioSource walkSource; public GameObject creatureObject; public Transform grabPosition; private static readonly int walk = Animator.StringToHash("walk"); private static readonly int grab = Animator.StringToHash("grab"); private static readonly int walkSpeed = Animator.StringToHash("walkSpeed"); private static readonly int stun = Animator.StringToHash("stun"); public float aiInterval; public int lastBehaviorState; private float lookAtPlayerTimer; private float monsterRunTimer; private float walkSoundTimer; private float animationParanoidTimer; private float animationGrabTimer; private float lostPlayerTimer; private float stunedTimer; private bool isLookingAtPlayer = false; private bool isRunningToPlayer = false; private bool isWalking = false; private bool isStuned = false; private float monsterAngryValue = 0f; private float monsterSpeedMultiplier = 1f; private float monsterLookPlayerTime = 2.5f; private float monsterRunToPlayerTime = 5f; private float monsterGrabTime = 3f; private float lostPlayerTime = 2f; private float stunTime = 1.25f; private float speed = 3.33f; private float normalAcceleration = 255f; private float angularSpeed = 900f; private float visionWidth = 60f; private float maxSpeed = 2f; private float timeBetweenWalkSound = 0.75f; private PlayerControllerB playerToKIll = null; private List<LightInformation> lights = new List<LightInformation>(); private bool playerToKillIsLocal; private void AddAngryValue(float value) { monsterAngryValue = Mathf.Clamp(monsterAngryValue += value, 0f, 100f); monsterSpeedMultiplier = 1f + maxSpeed * (monsterAngryValue / 100f); } private void WalkingSound() { if (walkSoundTimer <= 0f) { walkSource.clip = walkSounds[Random.Range(0, walkSounds.Count)]; walkSource.Play(); walkSoundTimer = timeBetweenWalkSound / Mathf.Clamp(monsterSpeedMultiplier, 1f, 1.3f); } } private void ActiveLightList(bool active) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) foreach (LightInformation light in lights) { float num = Random.Range(0.1f, 0.5f); light.Light.color = (Color)(active ? light.color : new Color(num, 0f, 0f)); } } private IEnumerator ParanoidAnimation() { lights.Clear(); List<Light> closeLights = Object.FindObjectsByType<Light>((FindObjectsSortMode)0).ToList().FindAll((Light light) => Vector3.Distance(((Component)light).transform.position, ((Component)this).transform.position) < 20f && Object.op_Implicit((Object)(object)light)); foreach (Light closeObject in closeLights) { LightInformation lightInformation = new LightInformation { Light = closeObject, color = closeObject.color }; lights.Add(lightInformation); } yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1f)); creatureObject.SetActive(false); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1.2f)); creatureObject.SetActive(true); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1.5f)); creatureObject.SetActive(false); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2f)); creatureObject.SetActive(true); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.1f)); creatureObject.SetActive(false); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.2f)); creatureObject.SetActive(true); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.3f)); creatureObject.SetActive(false); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.4f)); creatureObject.SetActive(true); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.5f)); creatureObject.SetActive(false); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > monsterLookPlayerTime)); creatureObject.SetActive(true); yield return (object)new WaitForSeconds(1f); ActiveLightList(active: true); } public override void Start() { speed = CountryRoadCreaturePlugin.instance.countryRoadBaseSpeed.Value; maxSpeed = CountryRoadCreaturePlugin.instance.countryRoadMaxSpeedMutliplier.Value - 1f; ((EnemyAI)this).Start(); AllClientOnSwitchBehaviorState(); base.agent.angularSpeed = angularSpeed; } public override void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) ((EnemyAI)this).Update(); aiInterval -= Time.deltaTime; walkSoundTimer -= Time.deltaTime; animationGrabTimer -= Time.deltaTime; if (isStuned) { stunedTimer -= Time.deltaTime; } if (isLookingAtPlayer) { lookAtPlayerTimer -= Time.deltaTime; animationParanoidTimer += Time.deltaTime; } if (isRunningToPlayer) { monsterRunTimer -= Time.deltaTime; } if (isWalking) { lostPlayerTimer -= Time.deltaTime; WalkingSound(); } if (isStuned) { isStuned = stunedTimer > 0f; } if (lastBehaviorState != base.currentBehaviourStateIndex) { lastBehaviorState = base.currentBehaviourStateIndex; AllClientOnSwitchBehaviorState(); } if (isRunningToPlayer && GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 100f, 60, -1f)) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.8f, true); } if (base.currentBehaviourStateIndex == 3) { GrabAnimation(); } if (aiInterval <= 0f && ((NetworkBehaviour)this).IsOwner) { aiInterval = base.AIIntervalTime; ((EnemyAI)this).DoAIInterval(); } } public override void DoAIInterval() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); switch (base.currentBehaviourStateIndex) { case 0: if (lostPlayerTimer <= 0f) { ((EnemyAI)this).TargetClosestPlayer(1.5f, true, visionWidth); } if ((Object)(object)base.targetPlayer == (Object)null) { if (!base.currentSearch.inProgress) { AISearchRoutine val = new AISearchRoutine(); val.searchWidth = 200f; val.searchPrecision = 8f; ((EnemyAI)this).StartSearch(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position, val); } } else if (((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) { lookAtPlayerTimer = monsterLookPlayerTime; ((EnemyAI)this).SwitchToBehaviourState(1); } break; case 1: base.currentSearch.inProgress = false; if (lookAtPlayerTimer > 0f) { ((Component)this).transform.LookAt(((Component)base.targetPlayer).transform); } else if (((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) { monsterRunTimer = monsterRunToPlayerTime; ((EnemyAI)this).SwitchToBehaviourState(2); } else { ((EnemyAI)this).SwitchToBehaviourState(0); } break; case 2: if (monsterRunTimer <= 0f) { ((EnemyAI)this).TargetClosestPlayer(1.5f, true, visionWidth); if ((Object)(object)base.targetPlayer != (Object)null) { monsterRunTimer += 1f; break; } lostPlayerTimer = lostPlayerTime; ((EnemyAI)this).SwitchToBehaviourState(0); } else if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } break; case 3: if (!(animationGrabTimer <= 0f)) { base.targetPlayer = null; } break; case 4: Debug.Log((object)$"IS STUNED {isStuned}"); if (!isStuned) { monsterRunTimer = monsterRunToPlayerTime; ((EnemyAI)this).SwitchToBehaviourState(2); } break; } } private void LateUpdate() { //IL_0051: 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) if ((Object)(object)playerToKIll != (Object)null && animationGrabTimer > 0f && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null && !isStuned) { ((Component)base.inSpecialAnimationWithPlayer.gameplayCamera).transform.rotation = grabPosition.rotation; base.inSpecialAnimationWithPlayer.cameraContainerTransform.rotation = grabPosition.rotation; } } private void CancelPlayerEffects() { if ((Object)(object)playerToKIll != (Object)null) { playerToKIll.disableMoveInput = false; playerToKIll.disableLookInput = false; playerToKIll.inAnimationWithEnemy = null; playerToKIll.isInElevator = false; playerToKIll.disableInteract = false; playerToKIll.isInHangarShipRoom = false; } if (playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.disableMoveInput = false; localPlayerController.disableLookInput = false; localPlayerController.inAnimationWithEnemy = null; localPlayerController.isInElevator = false; localPlayerController.disableInteract = false; localPlayerController.isInHangarShipRoom = false; } base.inSpecialAnimationWithPlayer = null; base.inSpecialAnimation = false; } private void GrabAnimation() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) base.targetPlayer = null; if ((Object)(object)playerToKIll == (Object)null || !playerToKillIsLocal) { return; } if (animationGrabTimer > 0f) { base.inSpecialAnimation = true; playerToKIll.disableMoveInput = true; playerToKIll.disableLookInput = true; playerToKIll.disableInteract = true; base.inSpecialAnimationWithPlayer = playerToKIll; playerToKIll.inAnimationWithEnemy = (EnemyAI)(object)this; ((Component)playerToKIll).transform.position = grabPosition.position; ((Component)playerToKIll).transform.rotation = grabPosition.rotation; } else { ((EnemyAI)this).SwitchToBehaviourServerRpc(0); CancelPlayerEffects(); if (playerToKillIsLocal) { GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.zero, false, (CauseOfDeath)8, 0, default(Vector3)); playerToKillIsLocal = false; } playerToKIll = null; } } public void AllClientOnSwitchBehaviorState() { //IL_012e: 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_02ca: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = speed * monsterSpeedMultiplier; base.agent.acceleration = normalAcceleration; switch (base.currentBehaviourStateIndex) { case 0: lostPlayerTimer = lostPlayerTime; isLookingAtPlayer = false; isRunningToPlayer = false; isWalking = true; base.creatureAnimator.SetBool(walk, true); base.creatureAnimator.SetBool(grab, false); base.creatureAnimator.SetBool(stun, false); base.creatureAnimator.SetFloat(walkSpeed, 1f); break; case 1: monsterRunTimer = monsterRunToPlayerTime; base.agent.speed = 0f; base.creatureVoice.clip = seePlayerSound; base.creatureVoice.Play(); lookAtPlayerTimer = monsterLookPlayerTime; isLookingAtPlayer = true; isWalking = false; animationParanoidTimer = 0f; base.agent.velocity = Vector3.zero; AddAngryValue(15f); base.creatureAnimator.SetBool(walk, false); base.creatureAnimator.SetBool(grab, false); base.creatureAnimator.SetBool(stun, false); ((MonoBehaviour)this).StartCoroutine(ParanoidAnimation()); break; case 2: base.creatureVoice.clip = runSound; base.creatureVoice.Play(); monsterRunTimer = monsterRunToPlayerTime; isRunningToPlayer = true; base.creatureAnimator.SetBool(walk, true); base.creatureAnimator.SetBool(grab, false); base.creatureAnimator.SetBool(stun, false); base.creatureAnimator.SetFloat(walkSpeed, Mathf.Clamp(monsterSpeedMultiplier, 1f, 1.5f)); isWalking = true; break; case 3: AddAngryValue(100f); base.agent.speed = 0f; base.agent.velocity = Vector3.zero; animationGrabTimer = monsterGrabTime; base.creatureVoice.clip = screamSound; base.creatureVoice.Play(); base.creatureAnimator.SetBool(grab, true); base.creatureAnimator.SetBool(stun, false); break; case 4: AddAngryValue(100f); base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.creatureVoice.clip = screamSound; base.creatureVoice.Play(); base.creatureAnimator.SetBool(stun, true); isRunningToPlayer = false; monsterRunTimer = monsterRunToPlayerTime; break; } } public override void OnCollideWithPlayer(Collider other) { if (!((Object)(object)playerToKIll != (Object)null) && !isStuned && !(animationGrabTimer > 0f)) { animationGrabTimer = monsterGrabTime; PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, true); if ((Object)(object)val != (Object)null) { ((EnemyAI)this).SwitchToBehaviourServerRpc(3); playerToKillIsLocal = true; playerToKIll = val; playerToKIll.DropAllHeldItems(true, false); } ((EnemyAI)this).PlayAnimationOfCurrentState(); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (!isStuned) { animationGrabTimer = 0.75f; CancelPlayerEffects(); playerToKIll = null; playerToKillIsLocal = false; stunedTimer = stunTime; isStuned = true; base.targetPlayer = playerWhoHit; ((EnemyAI)this).SwitchToBehaviourServerRpc(4); } } } public class CountryRoadCreatureHeadItem : NoisemakerProp { public AudioSource hitPlayerAudioSource; public AudioSource laughtAudioSource; private List<LightInformation> lights = new List<LightInformation>(); private float animationParanoidTimer; private bool animationPlaying; private int hitPlayerChance = 10; public bool canHitPlayer; public override void Start() { ((NoisemakerProp)this).Start(); hitPlayerChance = CountryRoadCreaturePlugin.instance.scrapHitPlayerChance.Value; } private void ActiveLightList(bool active) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) foreach (LightInformation light in lights) { float num = Random.Range(0.1f, 0.5f); light.Light.color = (Color)(active ? light.color : new Color(num, 0f, 0f)); } } public override void Update() { ((GrabbableObject)this).Update(); if (animationPlaying) { animationParanoidTimer += Time.deltaTime; } } private IEnumerator ParanoidAnimation() { lights.Clear(); List<Light> closeLights = Object.FindObjectsByType<Light>((FindObjectsSortMode)0).ToList().FindAll((Light light) => Vector3.Distance(((Component)light).transform.position, ((Component)this).transform.position) < 15f && Object.op_Implicit((Object)(object)light)); foreach (Light closeObject in closeLights) { LightInformation lightInformation = new LightInformation { Light = closeObject, color = closeObject.color }; int instanceId = ((Object)closeObject).GetInstanceID(); if (CountryRoadCreaturePlugin.instance.lightsInUse.ContainsKey(instanceId)) { lights.Add(CountryRoadCreaturePlugin.instance.lightsInUse[instanceId]); continue; } CountryRoadCreaturePlugin.instance.lightsInUse.Add(instanceId, lightInformation); lights.Add(lightInformation); } ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1f)); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1.2f)); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 1.5f)); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2f)); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.1f)); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.2f)); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.3f)); ActiveLightList(active: true); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.4f)); ActiveLightList(active: false); yield return (object)new WaitUntil((Func<bool>)(() => animationParanoidTimer > 2.5f)); ActiveLightList(active: false); yield return (object)new WaitForSeconds(2f); bool canHitPlayerValue = (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && canHitPlayer; if (!(Random.Range(0, 100) < hitPlayerChance && canHitPlayerValue)) { ActiveLightList(active: true); animationPlaying = false; } else { GameNetworkManager.Instance.localPlayerController.DamagePlayer(15, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); laughtAudioSource.Play(); yield return (object)new WaitForSeconds(1f); animationPlaying = false; ActiveLightList(active: true); } lights.ForEach(delegate(LightInformation l) { CountryRoadCreaturePlugin.instance.lightsInUse.Remove(((Object)l.Light).GetInstanceID()); }); } public override void ItemActivate(bool used, bool buttonDown = true) { canHitPlayer = (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; if (!animationPlaying) { animationPlaying = true; animationParanoidTimer = 0f; ((MonoBehaviour)this).StartCoroutine(ParanoidAnimation()); } ((NoisemakerProp)this).ItemActivate(used, buttonDown); } } public class LightInformation { public Light Light; public Color color; } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/deadbegone.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CleanEnemies.ConfigInfo; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("deadbegone")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CleanEnemies")] [assembly: AssemblyTitle("deadbegone")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CleanEnemies { [BepInPlugin("deadbegone", "CleanEnemies", "1.0.0")] public class CleanEnemies : BaseUnityPlugin { public static bool InGameAndHost = false; public static Dictionary<NetworkObject, float> Despawnlist = new Dictionary<NetworkObject, float>(); public static CleanEnemies Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } public static ConfigFile BepInExConfig() { return ((BaseUnityPlugin)Instance).Config; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Config.Instance.Setup(); Patch(); Logger.LogInfo((object)"deadbegone v1.0.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("deadbegone"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "deadbegone"; public const string PLUGIN_NAME = "CleanEnemies"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CleanEnemies.Patches { [HarmonyPatch(typeof(EnemyAI))] public class EnemyDespawn { [HarmonyPatch("KillEnemy")] [HarmonyPostfix] private static void CheckToDespawn(EnemyAI __instance) { if (!CleanEnemies.InGameAndHost || !Config.Instance.Enabled.Value) { return; } bool flag = __instance.enemyType.enemyName == "Butler" || __instance.enemyType.enemyName == "Nutcracker"; if (__instance.thisNetworkObject.IsSpawned & (flag == Config.Instance.ForceRemoveAll.Value || !flag)) { if (Config.Instance.EnableLogging.Value && flag) { CleanEnemies.Logger.LogInfo((object)"Enemy is Special Case"); } float realtimeSinceStartup = Time.realtimeSinceStartup; CleanEnemies.Despawnlist.Add(__instance.thisNetworkObject, realtimeSinceStartup); if (Config.Instance.EnableLogging.Value) { CleanEnemies.Logger.LogInfo((object)"Added {__instance.thisNetworkObject.name} to despawn list"); } } } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerConnection { [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] public static void findplayer(PlayerControllerB __instance) { if (GameNetworkManager.Instance.isHostingGame) { CleanEnemies.InGameAndHost = true; if (Config.Instance.EnableLogging.Value) { CleanEnemies.Logger.LogInfo((object)"Host connected"); } } } } [HarmonyPatch(typeof(StartOfRound))] public class PlayerDisconnection { [HarmonyPatch("OnLocalDisconnect")] [HarmonyPostfix] public static void removeplayer() { CleanEnemies.InGameAndHost = false; CleanEnemies.Despawnlist.Clear(); if (Config.Instance.EnableLogging.Value) { CleanEnemies.Logger.LogInfo((object)"Despawnlist has been cleared and mod is waiting to be hosting a game"); } } } [HarmonyPatch(typeof(StartOfRound))] public class UpdateListLoop { public static int CurrentFrame; [HarmonyPatch("Update")] [HarmonyPostfix] public static void CheckIfDespawn() { CurrentFrame++; if (CurrentFrame > Config.Instance.UpdateAfterMultipleFrames.Value) { CurrentFrame = 1; } if (!CleanEnemies.InGameAndHost || !Config.Instance.Enabled.Value || CurrentFrame < Config.Instance.UpdateAfterMultipleFrames.Value) { return; } foreach (KeyValuePair<NetworkObject, float> item in CleanEnemies.Despawnlist) { if (!CleanEnemies.InGameAndHost || !Config.Instance.Enabled.Value) { break; } if (Time.realtimeSinceStartup - item.Value > Config.Instance.TimeToClear.Value) { item.Key.Despawn(true); if (Config.Instance.EnableLogging.Value) { CleanEnemies.Logger.LogInfo((object)"{p.Key.name} has been despawned after {(Time.realtimeSinceStartup - p.Value)} seconds"); } CleanEnemies.Despawnlist.Remove(item.Key); } } } } } namespace CleanEnemies.ConfigInfo { public sealed class Config { private static Config instance; public ConfigEntry<bool> Enabled { get; set; } public ConfigEntry<bool> EnableLogging { get; set; } public ConfigEntry<bool> ForceRemoveAll { get; set; } public ConfigEntry<float> TimeToClear { get; set; } public ConfigEntry<int> UpdateAfterMultipleFrames { get; set; } public static Config Instance { get { if (instance == null) { instance = new Config(); } return instance; } } public void Setup() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown Enabled = CleanEnemies.BepInExConfig().Bind<bool>("General", "Enabled", true, "Enables the mod"); EnableLogging = CleanEnemies.BepInExConfig().Bind<bool>("General", "Enable Logs", true, "Enables Logging"); ForceRemoveAll = CleanEnemies.BepInExConfig().Bind<bool>("General", "Remove Special Cases", false, "Makes nutcrackers and butlers affected by the mod, Will cause items / events after death to not spawn if time to remove is too short or be removed once enemy is destroyed"); TimeToClear = CleanEnemies.BepInExConfig().Bind<float>("General", "Time Until Removed", 3f, new ConfigDescription("Time it takes in seconds for an enemy to be removed after it has died", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>())); UpdateAfterMultipleFrames = CleanEnemies.BepInExConfig().Bind<int>("General", "Update After Multiple Frames", 1, new ConfigDescription("How many frames after each loop update should it check to despawn anything", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 120), Array.Empty<object>())); } } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/EverythingCanDie.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EverythingCanDie")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EverythingCanDie")] [assembly: AssemblyTitle("EverythingCanDie")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EverythingCanDie { public class Patches { public static List<string> UnkillableEnemies = new List<string>(); public static List<string> BonkableEnemies = new List<string>(); public static List<string> NotBonkableEnemies = new List<string>(); public static List<string> InvalidEnemies = new List<string>(); private static readonly int Damage = Animator.StringToHash("damage"); private static bool CheckingIfBonkable = false; public static void StartOfRoundPatch() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Expected O, but got Unknown Plugin.enemies = (from EnemyType e in Resources.FindObjectsOfTypeAll(typeof(EnemyType)) where (Object)(object)e != (Object)null select e).ToList(); Plugin.items = (from Item i in Resources.FindObjectsOfTypeAll(typeof(Item)) where (Object)(object)i != (Object)null select i).ToList(); Plugin.ENEMY_MASK = 524288; Plugin.PLAYER_HIT_MASK = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | (Plugin.ENEMY_MASK & 0x280008); if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "UnimmortalAllMobs"))) { ConfigEntry<bool> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "UnimmortalAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Return To Normal(Make Immortal mobs immortal again)."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "ExplosionEffectAllMobs"))) { ConfigEntry<bool> val2 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "ExplosionEffectAllMobs", true, "If this is set to true then explosion effect stays and removes the body otherwise when false all explosions on death will not appear and the body will appear."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "HealthAllMobs"))) { ConfigEntry<bool> val3 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "HealthAllMobs", true, "If this is set to false the enemies health will remain the same otherwise have fun configging."); } foreach (EnemyType enemy in Plugin.enemies) { string text = Plugin.RemoveInvalidCharacters(enemy.enemyName).ToUpper(); try { if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Unimmortal"))) { ConfigEntry<bool> val4 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Unimmortal", true, "If true this mob will explode and if immortal it will also be killable."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Explodeable"))) { ConfigEntry<bool> val5 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Explodeable", true, "The value of whether to spawn an explosion effect(Default on)"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Hittable"))) { ConfigEntry<bool> val6 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Hittable", true, "The value of whether this mob is hittable with things like shovels.(WARNING: If it is a modded item that happens to shoot then this might effect those items too)"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Shootable"))) { ConfigEntry<bool> val7 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Shootable", true, "The value of whether this mob is shootable with things like shotguns.(WARNING: Only works for items that use the ShotgunItem as its parent)"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Health"))) { EnemyAI component = enemy.enemyPrefab.GetComponent<EnemyAI>(); ConfigEntry<int> val8 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<int>("Mobs", text + ".Health", component.enemyHP, "The value of the mobs health.(Default Vanilla is 3 for most unkillable mobs)"); if (Plugin.CanMob("HealthAllMobs", ".Unimmortal", text)) { component.enemyHP = val8.Value; Plugin.Log.LogInfo((object)$"Set {((Object)enemy).name} HP to {component.enemyHP}"); } } } catch (Exception) { Plugin.Log.LogInfo((object)("It was not possible to generate the configs for the enemy: " + enemy.enemyName)); InvalidEnemies.Add(enemy.enemyName); } try { if (Plugin.CanMob("UnimmortalAllMobs", ".Unimmortal", text)) { UnkillableEnemies.Add(enemy.enemyName); enemy.canDie = true; } Plugin.Log.LogInfo((object)$"Vanilla canDie variable for {enemy.enemyName} = {enemy.canDie}"); } catch (Exception) { Plugin.Log.LogError((object)("It was not possible to determine whether the enemy " + enemy.enemyName + " was killable or not")); } } if ((Object)(object)Plugin.explosionPrefab == (Object)null && (Object)(object)StartOfRound.Instance.explosionPrefab != (Object)null) { Plugin.explosionPrefab = Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab); if ((Object)(object)Plugin.explosionPrefab.GetComponent<AudioSource>() != (Object)null) { Plugin.explosionPrefab.GetComponent<AudioSource>().volume = 0.35f; } Plugin.explosionPrefab.SetActive(false); Object.DontDestroyOnLoad((Object)(object)Plugin.explosionPrefab); } } public static void HitEnemyPatch(ref EnemyAI __instance, int force = 1, PlayerControllerB playerWhoHit = null) { if (!((Object)(object)__instance != (Object)null) || CheckingIfBonkable || (InvalidEnemies.Contains(__instance.enemyType.enemyName) && __instance.isEnemyDead)) { return; } EnemyType enemyType = __instance.enemyType; string text = Plugin.RemoveInvalidCharacters(enemyType.enemyName).ToUpper(); bool flag = true; if (!Plugin.CanMob("UnimmortalAllMobs", ".Unimmortal", text) || ((Object)(object)playerWhoHit == (Object)null && __instance.enemyType.enemyName == "RadMech")) { return; } if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit.ItemSlots[playerWhoHit.currentItemSlot] != (Object)null) { GrabbableObject val = playerWhoHit.ItemSlots[playerWhoHit.currentItemSlot]; if (val.itemProperties.isDefensiveWeapon && !Plugin.Can(text + ".Hittable")) { flag = false; Plugin.Log.LogInfo((object)("Hit Disabled for " + __instance.enemyType.enemyName + "!")); } else if (val is ShotgunItem && !Plugin.Can(text + ".Shootable")) { flag = false; Plugin.Log.LogInfo((object)("Shoot Disabled for " + __instance.enemyType.enemyName + "!")); } } if (!flag) { return; } if (!BonkableEnemies.Contains(__instance.enemyType.enemyName) && !NotBonkableEnemies.Contains(__instance.enemyType.enemyName)) { Plugin.Log.LogInfo((object)(__instance.enemyType.enemyName + " is not in the Bonkable or in the NotBonkable list")); CanEnemyGetBonked(__instance); } if (BonkableEnemies.Contains(__instance.enemyType.enemyName)) { Plugin.Log.LogInfo((object)(__instance.enemyType.enemyName + " is in the Bonkable list")); } else if (NotBonkableEnemies.Contains(__instance.enemyType.enemyName)) { Plugin.Log.LogInfo((object)(__instance.enemyType.enemyName + " is in the NotBonkable list")); if ((Object)(object)__instance.creatureAnimator != (Object)null) { __instance.creatureAnimator.SetTrigger(Damage); } if (__instance.enemyHP - force > 0) { EnemyAI obj = __instance; obj.enemyHP -= force; } else { __instance.enemyHP = 0; } if (__instance.enemyHP <= 0) { __instance.KillEnemyOnOwnerClient(false); } } } public static void CanEnemyGetBonked(EnemyAI __instance) { CheckingIfBonkable = true; int enemyHP = __instance.enemyHP; Plugin.Log.LogInfo((object)$"Enemy HP before bonk test: {enemyHP}"); __instance.HitEnemy(1, (PlayerControllerB)null, false, -3); int enemyHP2 = __instance.enemyHP; Plugin.Log.LogInfo((object)$"Enemy HP after bonk test: {enemyHP2}"); if (enemyHP != enemyHP2) { BonkableEnemies.Add(__instance.enemyType.enemyName); __instance.enemyHP = enemyHP; Plugin.Log.LogInfo((object)$"{__instance.enemyType.enemyName} is been added to the Bonkable list, HP = {__instance.enemyHP}"); } else { NotBonkableEnemies.Add(__instance.enemyType.enemyName); Plugin.Log.LogInfo((object)$"{__instance.enemyType.enemyName} is been added to the NotBonkable list, HP = {__instance.enemyHP}"); } CheckingIfBonkable = false; } public static void KillEnemyPatch(ref EnemyAI __instance) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)null) || InvalidEnemies.Contains(__instance.enemyType.enemyName)) { return; } EnemyType enemyType = __instance.enemyType; string mobName = Plugin.RemoveInvalidCharacters(enemyType.enemyName).ToUpper(); Plugin.Log.LogInfo((object)$"{((Object)__instance).name} HP is {__instance.enemyHP}, killing"); if (!Plugin.CanMob("ExplosionEffectAllMobs", ".Explodeable", mobName)) { return; } if (__instance.enemyType.enemyName == "Nutcracker" || __instance.enemyType.enemyName == "Butler") { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); if (((NetworkBehaviour)__instance).IsServer) { Object.Instantiate<GameObject>(Plugin.explosionPrefab, ((Component)__instance).transform.position, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); } return; } if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInChildren<PlayerControllerB>())) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); if (((NetworkBehaviour)__instance).IsServer) { Object.Instantiate<GameObject>(Plugin.explosionPrefab, ((Component)__instance).transform.position, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); } return; } HUDManager.Instance.ShakeCamera((ScreenShakeType)0); if (((NetworkBehaviour)__instance).IsServer) { Object.Instantiate<GameObject>(Plugin.explosionPrefab, ((Component)__instance).transform.position, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); } ((MonoBehaviour)__instance).StartCoroutine(MoveBody(__instance, 0.1f)); } private static IEnumerator MoveBody(EnemyAI __instance, float time) { yield return (object)new WaitForSeconds(time); Vector3 OriginalBodyPos = new Vector3(-10000f, -10000f, -10000f); ((Component)__instance).transform.position = OriginalBodyPos; __instance.SyncPositionToClients(); if (__instance.enemyType.enemyName == "Blob" && ((NetworkBehaviour)__instance).IsServer) { ((Component)__instance).GetComponent<NetworkObject>().Despawn(true); } } public static bool ReplaceShotgunCode(ref ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) ShootGun(__instance, shotgunPosition, shotgunForward); return false; } public static void ShootGun(ShotgunItem gun, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_006a: 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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: 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_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = ((GrabbableObject)gun).playerHeldBy; bool flag = ((GrabbableObject)gun).isHeld && (Object)(object)((GrabbableObject)gun).playerHeldBy != (Object)null; if (flag) { shotgunPosition += ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.25f; } bool flag2 = flag && (Object)(object)((GrabbableObject)gun).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; if (flag2) { ((GrabbableObject)gun).playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun"); } RoundManager.PlayRandomClip(((Component)gun).GetComponent<ShotgunItem>().gunShootAudio, ((Component)gun).GetComponent<ShotgunItem>().gunShootSFX, true, 1f, 1840, 1000); WalkieTalkie.TransmitOneShotAudio(((Component)gun).GetComponent<ShotgunItem>().gunShootAudio, ((Component)gun).GetComponent<ShotgunItem>().gunShootSFX[0], 1f); gun.gunShootParticle.Play(true); gun.isReloading = false; gun.shellsLoaded = Mathf.Clamp(gun.shellsLoaded - 1, 0, 2); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } Vector3[] array = (Vector3[])(object)new Vector3[Plugin.numTightPellets + Plugin.numLoosePellets]; State state = Random.state; for (int i = 0; i < Plugin.numTightPellets + Plugin.numLoosePellets; i++) { float num = ((i < Plugin.numTightPellets) ? Plugin.tightPelletAngle : Plugin.loosePelletAngle); Vector3 val = Random.onUnitSphere; float num2 = num * Mathf.Sqrt(Random.value); if (Vector3.Angle(shotgunForward, val) < num2) { val *= -1f; } Vector3 val2 = Vector3.RotateTowards(shotgunForward, val, num2 * MathF.PI / 180f, 0f); array[i] = val2; } Random.state = state; float num3 = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)gun.shotgunRayPoint).transform.position); float num4 = 0f; if (num3 < 5f) { num4 = 0.8f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 15f) { num4 = 0.5f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 23f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if (num4 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f && !flag) { ((MonoBehaviour)gun).StartCoroutine(DelayedEarsRinging(num4)); } Plugin.CountHandler countHandler = new Plugin.CountHandler(); Ray val4 = default(Ray); IHittable val6 = default(IHittable); EnemyAI val9 = default(EnemyAI); foreach (Vector3 val3 in array) { ((Ray)(ref val4))..ctor(shotgunPosition, val3); RaycastHit[] array2 = Physics.RaycastAll(val4, 30f, Plugin.PLAYER_HIT_MASK, (QueryTriggerInteraction)2); Array.Sort(array2, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); Vector3 val5 = shotgunPosition + val3 * 30f; Debug.Log((object)("SHOTGUN: RaycastAll hit " + array2.Length + " things (" + flag + "," + flag2 + ")")); for (int k = 0; k < array2.Length; k++) { GameObject gameObject = ((Component)((RaycastHit)(ref array2[k])).transform).gameObject; if (gameObject.TryGetComponent<IHittable>(ref val6)) { if (val6 == ((GrabbableObject)gun).playerHeldBy) { continue; } EnemyAI val7 = null; EnemyAICollisionDetect val8 = (EnemyAICollisionDetect)(object)((val6 is EnemyAICollisionDetect) ? val6 : null); if (val8 != null) { val7 = val8.mainScript; } if ((Object)(object)val7 != (Object)null && (val7.isEnemyDead || val7.enemyHP <= 0 || !val7.enemyType.canDie)) { continue; } if (val6 is PlayerControllerB) { countHandler.AddPlayerToCount((PlayerControllerB)(object)((val6 is PlayerControllerB) ? val6 : null)); } else if ((Object)(object)val7 != (Object)null) { countHandler.AddEnemyToCount(val7); } else { if (!flag) { continue; } countHandler.AddOtherToCount(val6); } val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Hit [" + ((object)val6)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } if (((Component)((RaycastHit)(ref array2[k])).collider).TryGetComponent<EnemyAI>(ref val9)) { if (!flag || val9.isEnemyDead || val9.enemyHP <= 0 || !val9.enemyType.canDie) { continue; } countHandler.AddEnemyToCount(val9); val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Backup hit [" + ((object)val9)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Wall [" + ((object)gameObject)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } Plugin.VisualiseShot(shotgunPosition, val5); } countHandler.player.ForEach(delegate(Plugin.Counter<PlayerControllerB> p) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) int num7 = p.count * 20; Debug.Log((object)("SHOTGUN: Hit " + ((object)p.item)?.ToString() + " with " + p.count + " pellets for " + num7 + " damage")); p.item.DamagePlayer(num7, true, true, (CauseOfDeath)7, 0, false, shotgunForward); }); countHandler.enemy.ForEach(delegate(Plugin.Counter<EnemyAI> e) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) int num6 = e.count / 2 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)e.item)?.ToString() + " with " + e.count + " pellets for " + num6 + " damage")); e.item.HitEnemyOnLocalClient(num6, shotgunForward, ((GrabbableObject)gun).playerHeldBy, true, -1); }); countHandler.other.ForEach(delegate(Plugin.Counter<IHittable> o) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) int num5 = o.count / 2 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)o.item)?.ToString() + " with " + o.count + " pellets for " + num5 + " damage")); o.item.Hit(num5, shotgunForward, ((GrabbableObject)gun).playerHeldBy, true, -1); }); ((Ray)(ref val4))..ctor(shotgunPosition, shotgunForward); RaycastHit val10 = default(RaycastHit); if (Physics.Raycast(val4, ref val10, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((Component)gun.gunBulletsRicochetAudio).transform.position = ((Ray)(ref val4)).GetPoint(((RaycastHit)(ref val10)).distance - 0.5f); gun.gunBulletsRicochetAudio.Play(); } } public static IEnumerator DelayedEarsRinging(float effectSeverity) { yield return (object)new WaitForSeconds(0.6f); SoundManager.Instance.earsRingingTimer = effectSeverity; } } [BepInPlugin("nwnt.EverythingCanDie", "EverythingCanDie", "1.2.22")] public class Plugin : BaseUnityPlugin { public class CountHandler { public List<Counter<PlayerControllerB>> player = new List<Counter<PlayerControllerB>>(); public List<Counter<EnemyAI>> enemy = new List<Counter<EnemyAI>>(); public List<Counter<IHittable>> other = new List<Counter<IHittable>>(); public void AddPlayerToCount(PlayerControllerB p) { if (player.Any((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p)) { player.First((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p).count++; } else { player.Add(new Counter<PlayerControllerB> { item = p, count = 1 }); } } public void AddEnemyToCount(EnemyAI ai) { if (enemy.Any((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai)) { enemy.First((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai).count++; } else { enemy.Add(new Counter<EnemyAI> { item = ai, count = 1 }); } } public void AddOtherToCount(IHittable hit) { if (other.Any((Counter<IHittable> i) => i.item == hit)) { other.First((Counter<IHittable> i) => i.item == hit).count++; } else { other.Add(new Counter<IHittable> { item = hit, count = 1 }); } } } public class Counter<T> { public T item; public int count; } public class FadeOutLine : MonoBehaviour { private const float lifetime = 0.4f; private const float width = 0.02f; private static readonly Color col = new Color(1f, 0f, 0f); private float alive = 0f; private LineRenderer line; public Vector3 start; public Vector3 end; private static readonly Material mat = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply")); public void Prep() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = Vector3.Distance(start, end); float num2 = (30f - num) / 30f; line = ((Component)this).gameObject.AddComponent<LineRenderer>(); line.startColor = col; line.endColor = col * num2 + Color.black * (1f - num2); line.startWidth = 0.02f; line.endWidth = num2 * 0.02f; line.SetPositions((Vector3[])(object)new Vector3[2] { start, end }); ((Renderer)line).material = mat; } private void Update() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) alive += Time.deltaTime; if (alive >= 0.4f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } line.startColor = new Color(col.r, col.g, col.b, (0.4f - alive) / 0.4f); line.endColor = new Color(line.endColor.r, line.endColor.g, line.endColor.b, (0.4f - alive) / 0.4f); } } public const string Guid = "nwnt.EverythingCanDie"; public const string Name = "EverythingCanDie"; public const string Version = "1.2.22"; public static Plugin Instance; public static Harmony Harmony; public static ManualLogSource Log; public static GameObject explosionPrefab; public static List<EnemyType> enemies; public static List<Item> items; public const float range = 30f; public static int ENEMY_MASK = 524288; public static int PLAYER_HIT_MASK; public static int numTightPellets = 2; public static float tightPelletAngle = 2.5f; public static int numLoosePellets = 3; public static float loosePelletAngle = 10f; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Harmony = new Harmony("nwnt.EverythingCanDie"); if ((Object)(object)Instance == (Object)null) { Instance = this; } Harmony.PatchAll(typeof(Plugin)); Log = ((BaseUnityPlugin)this).Logger; CreateHarmonyPatch(Harmony, typeof(StartOfRound), "Start", null, typeof(Patches), "StartOfRoundPatch", isPrefix: false); CreateHarmonyPatch(Harmony, typeof(EnemyAI), "HitEnemy", new Type[4] { typeof(int), typeof(PlayerControllerB), typeof(bool), typeof(int) }, typeof(Patches), "HitEnemyPatch", isPrefix: false); CreateHarmonyPatch(Harmony, typeof(EnemyAI), "KillEnemy", new Type[1] { typeof(bool) }, typeof(Patches), "KillEnemyPatch", isPrefix: false); CreateHarmonyPatch(Harmony, typeof(ShotgunItem), "ShootGun", new Type[2] { typeof(Vector3), typeof(Vector3) }, typeof(Patches), "ReplaceShotgunCode", isPrefix: true); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching should be complete now :]"); } public static Type FindType(string fullName) { try { if ((from a in AppDomain.CurrentDomain.GetAssemblies() where !a.IsDynamic select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName)) != null) { return (from a in AppDomain.CurrentDomain.GetAssemblies() where !a.IsDynamic select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName)); } } catch { return null; } return null; } public static void CreateHarmonyPatch(Harmony harmony, Type typeToPatch, string methodToPatch, Type[] parameters, Type patchType, string patchMethod, bool isPrefix) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown if (typeToPatch == null || patchType == null) { Log.LogInfo((object)"Type is either incorrect or does not exist!"); return; } MethodInfo methodInfo = AccessTools.Method(typeToPatch, methodToPatch, parameters, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(patchType, patchMethod, (Type[])null, (Type[])null); if (isPrefix) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("Prefix " + methodInfo.Name + " Patched!")); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("Postfix " + methodInfo.Name + " Patched!")); } } public static string RemoveInvalidCharacters(string source) { StringBuilder stringBuilder = new StringBuilder(); foreach (char c in source) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { stringBuilder.Append(c); } } return string.Join("", stringBuilder.ToString().Split((string[]?)null, StringSplitOptions.RemoveEmptyEntries)); } public static bool Can(string identifier) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (((BaseUnityPlugin)Instance).Config[new ConfigDefinition("Mobs", identifier)].BoxedValue.ToString().ToUpper().Equals("TRUE")) { return true; } return false; } public static bool CanMob(string parentIdentifier, string identifier, string mobName) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown string text = RemoveInvalidCharacters(mobName).ToUpper(); if (((BaseUnityPlugin)Instance).Config[new ConfigDefinition("Mobs", parentIdentifier)].BoxedValue.ToString().ToUpper().Equals("TRUE")) { foreach (ConfigDefinition key in ((BaseUnityPlugin)Instance).Config.Keys) { if (RemoveInvalidCharacters(key.Key.ToUpper()).Equals(RemoveInvalidCharacters(text + identifier.ToUpper()))) { return ((BaseUnityPlugin)Instance).Config[key].BoxedValue.ToString().ToUpper().Equals("TRUE"); } } Log.LogInfo((object)(identifier + ": No mob found!")); return false; } Log.LogInfo((object)(parentIdentifier + ": All mobs disabled!")); return false; } public static void VisualiseShot(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) GameObject val = new GameObject("Trail Visual"); FadeOutLine fadeOutLine = val.AddComponent<FadeOutLine>(); fadeOutLine.start = start; fadeOutLine.end = end; fadeOutLine.Prep(); } } public static class PluginInfo { public const string PLUGIN_GUID = "EverythingCanDie"; public const string PLUGIN_NAME = "EverythingCanDie"; public const string PLUGIN_VERSION = "1.0.0"; } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/HarbingerBehaviour.dll
Decompiled 2 years agousing 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.InteropServices; using System.Runtime.Versioning; using System.Xml.Serialization; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarbingerBehaviour.AICode; using HarbingerBehaviour.NetcodePatcher; using HarmonyLib; using LethalLib.Modules; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("22e8fa27-caf7-4b7e-8740-ef5c67f9766d")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace HarbingerBehaviour { [Serializable] public class Config : SyncedInstance<Config> { public readonly ConfigEntry<float> TeleportSpeed; public readonly ConfigEntry<float> TPSelfCooldown; public readonly ConfigEntry<float> TPOtherCooldown; public readonly ConfigEntry<int> MaxCount; public readonly ConfigEntry<string> HarbingerSpawnLocations; public readonly ConfigEntry<string> BlackList; public readonly ConfigEntry<string> WhiteList; public readonly ConfigEntry<bool> CanTPItems; public Config() { InitInstance(this); } public Config(ConfigFile cfg) { InitInstance(this); TeleportSpeed = cfg.Bind<float>("Teleport Enemies", "Teleportation speed multiplier", 1f, "How fast the telporation animation should play (default 1 -> 3.35 Sec)"); TPOtherCooldown = cfg.Bind<float>("Teleport Enemies", "Teleport Enemies Cooldown", 10f, "How frequantly should the harbinger teleport enemies to players (default 15 sec). Minimum of 10 seconds"); TPSelfCooldown = cfg.Bind<float>("Teleport Self", "Teleport Self Cooldown", 20f, "How frequantly should the harbinger teleport to players (default 20 sec). Minimum of 5 seconds"); MaxCount = cfg.Bind<int>("Spawning", "Maximum Harbingers", 2, "What is the maximum number of harbingers that should be able to spawn (defaut 2)"); HarbingerSpawnLocations = cfg.Bind<string>("Spawning", "Moon Spawn Weight", "Modded:35,ExperimentationLevel:10,AssuranceLevel:10,VowLevel:10,OffenseLevel:20,MarchLevel:20,RendLevel:40,DineLevel:40,TitanLevel:50,AdamanceLevel:20,EmbrionLevel:20,ArtificeLevel:50", "Rarety of Harbinger spawning on Each Moon (works will LLL as well)."); BlackList = cfg.Bind<string>("Teleport Enemies", "Teleportation BlackList", "none", "Add the names of the entities that should not be teleported (This must be the internal name of the entities). Make sure to separate each name with a comma and a space (PjonkGoose, Harbinger)"); WhiteList = cfg.Bind<string>("Teleport Enemies", "Teleportation WhiteList", "none", "An alternative to the blacklist. If this value is not default it will only teleport enemies that are part of the whitelist."); CanTPItems = cfg.Bind<bool>("Teleport Items", "Can Teleport Items", true, "This allows you to turn off the ability to teleport the apparatus."); } public static void RequestSync() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("ModName_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } HarbingerLoader.mls.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("ModName_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { HarbingerLoader.mls.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { HarbingerLoader.mls.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { HarbingerLoader.mls.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); HarbingerLoader.mls.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (SyncedInstance<Config>.IsHost) { SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("ModName_OnRequestConfigSync", new HandleNamedMessageDelegate(OnRequestSync)); SyncedInstance<Config>.Synced = true; } else { SyncedInstance<Config>.Synced = false; SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("ModName_OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveSync)); RequestSync(); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [BepInPlugin("InstanceWorld.Harbinger", "Harbinger Scripts", "1.0.0")] public class HarbingerLoader : BaseUnityPlugin { private Harmony harmony = new Harmony("InstanceWorld.Harbinger"); private const string GUID = "InstanceWorld.Harbinger"; private const string NAME = "Harbinger Scripts"; private const string VERSION = "1.0.0"; public static Config HarbConfig; private static HarbingerLoader Inst; internal static ManualLogSource mls; public static AssetBundle HarbBundle; public static int SpawnWeight = 25; private static EnemyType VoidHarbinger; public static string[] BlacklistNames; public static string[] WhitelistNames; private void Awake() { if ((Object)(object)Inst == (Object)null) { Inst = this; } mls = Logger.CreateLogSource("InstanceWorld.Harbinger"); mls.LogInfo((object)"Starting HarbingerPatcher..."); HarbBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "harbinger")); VoidHarbinger = HarbBundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/Harbinger/Harbinger_enemyType.asset"); if ((Object)(object)VoidHarbinger == (Object)null) { mls.LogError((object)"EnemyType Missing..."); } harmony.PatchAll(typeof(HarbingerAI)); harmony.PatchAll(typeof(TeleportRing)); harmony.PatchAll(typeof(Config)); HarbConfig = new Config(((BaseUnityPlugin)this).Config); SetharbValues(); mls.LogInfo((object)"Patching Networking..."); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls.LogInfo((object)"Completed Harbinger Patcher"); } private void SetharbValues() { TerminalNode val = HarbBundle.LoadAsset<TerminalNode>("Assets/LethalCompany/Mods/Harbinger/HarbingerFile.asset"); TerminalKeyword val2 = HarbBundle.LoadAsset<TerminalKeyword>("Assets/LethalCompany/Mods/Harbinger/Harbinger.asset"); VoidHarbinger.MaxCount = SyncedInstance<Config>.Instance.MaxCount.Value; if ((Object)(object)val2 == (Object)null) { mls.LogError((object)"TerminalNode Missing..."); } if ((Object)(object)val == (Object)null) { mls.LogError((object)"Keyword Missing..."); } NetworkPrefabs.RegisterNetworkPrefab(VoidHarbinger.enemyPrefab); (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) tuple = ConfigParsing(SyncedInstance<Config>.Instance.HarbingerSpawnLocations.Value); Dictionary<LevelTypes, int> item = tuple.spawnRateByLevelType; Dictionary<string, int> item2 = tuple.spawnRateByCustomLevelType; BlacklistNames = ParseBlacklist(SyncedInstance<Config>.Instance.BlackList.Value); WhitelistNames = ParseBlacklist(SyncedInstance<Config>.Instance.WhiteList.Value); if (!WhitelistNames.Contains("none")) { mls.LogWarning((object)"WhiteList active. Blacklist Disabled"); } Enemies.RegisterEnemy(VoidHarbinger, item, item2, val, val2); } private static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (string item in from s in configMoonRarity.Split(',') select s.Trim()) { string[] array = item.Split(':'); if (array.Length != 2) { continue; } string text = array[0]; if (int.TryParse(array[1], out var result)) { if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; mls.LogDebug((object)$"Registered spawn rate for level type {result2} to {result}"); } else { dictionary2[text] = result; mls.LogDebug((object)$"Registered spawn rate for custom level type {text} to {result}"); } } } return (dictionary, dictionary2); } private static string[] ParseBlacklist(string list) { string[] array = list.Split(","); for (int i = 0; i < array.Length; i++) { array[i] = array[i].ToLower().Trim(); } return array; } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { using MemoryStream memoryStream = new MemoryStream(); try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); xmlSerializer.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { HarbingerLoader.mls.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); using MemoryStream stream = new MemoryStream(data); try { return (T)xmlSerializer.Deserialize(stream); } catch (Exception arg) { HarbingerLoader.mls.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } } namespace HarbingerBehaviour.AICode { internal class EventIntermediate : MonoBehaviour { [SerializeField] private UnityEvent Listen; public void TriggerEvent() { Listen.Invoke(); } } internal class HarbingerAI : EnemyAI { public enum HarbingerStates { Moving, Standing, Teleporting, TeleportingSelf, TeleportItem } private Vector3 mainEntrancePosition; public float MaxDistanceToPlayerBeforeTeleport = 20f; public HarbingerStates state = HarbingerStates.Standing; public float movementspeed = 5f; private Random enemyRandom; public Vector2 MinMaxMovement = new Vector2(5f, 10f); public GameObject debugPoint; public GameObject NextPos; public float stationaryTime = 2f; public float ActionStart = 0f; public float MovementTimeout = 6f; [Header("Teleport Other")] public TeleportRing tpRing; public float TPOtherCooldown = 15f; private float TPOtherInitCooldown; private Random TeleportRandom; private bool TeleportValid = false; private bool aligned = false; private Quaternion lookRotation; [Header("TeleportSelf")] public Vector2 TeleportSelfArriveRadius = new Vector2(4f, 6f); public float SelfTeleportCooldown = 40f; public AudioSource PositionBeforeSelfTeleport; private float lastTeleportTime = 0f; private List<EnemyAI> Alreadyused = new List<EnemyAI>(); private float IntialCooldown; private bool TPSelfBehaviourOverridable = false; [Header("TeleportApparatus")] public GrabbableObject LungProp; public float ResetToStealCooldown = 5f; public float StealCooldown = 5f; public ItemCollider IC; private static List<GrabbableObject> grabbableObjectsInMap = new List<GrabbableObject>(); private float startTeleporItemTimer = 0f; public override void Start() { //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) ((EnemyAI)this).Start(); base.movingTowardsTargetPlayer = true; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); TeleportRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); mainEntrancePosition = RoundManager.FindMainEntrancePosition(false, false); ActionStart = Time.time; lastTeleportTime = Time.time; ((Component)PositionBeforeSelfTeleport).transform.SetParent(((Component)((Component)this).transform).transform.parent); ((Component)tpRing).transform.SetParent(((Component)((Component)this).transform).transform.parent); HarbingerLoader.mls.LogWarning((object)("Testing TP Speed: " + SyncedInstance<Config>.Instance.TPSelfCooldown.Value)); HostConfigApply(SyncedInstance<Config>.Instance.TeleportSpeed.Value, Math.Max(SyncedInstance<Config>.Instance.TPSelfCooldown.Value, 5f), Math.Max(SyncedInstance<Config>.Instance.TPOtherCooldown.Value, 5f)); RefreshGrabbableObjectsInMapList(); } public static void RefreshGrabbableObjectsInMapList() { grabbableObjectsInMap.Clear(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); HarbingerLoader.mls.LogInfo((object)$"objects in scene!! : {array.Length}"); for (int i = 0; i < array.Length; i++) { if (array[i].grabbableToEnemies && (Object)(object)((Component)array[i]).GetComponent<LungProp>() != (Object)null) { grabbableObjectsInMap.Add(((Component)array[i]).GetComponent<GrabbableObject>()); } } HarbingerLoader.mls.LogInfo((object)$"Picked : {grabbableObjectsInMap.Count}"); } public void HostConfigApply(float tpSpeedMult, float teleportSelfCooldown, float teleportOthersCooldown) { base.creatureAnimator.SetFloat("TeleportMultipier", tpSpeedMult); SelfTeleportCooldown = teleportSelfCooldown; IntialCooldown = SelfTeleportCooldown; TPOtherCooldown = teleportOthersCooldown; TPOtherInitCooldown = TPOtherCooldown; } public override void OnDestroy() { Object.Destroy((Object)(object)((Component)tpRing).gameObject); Object.Destroy((Object)(object)((Component)PositionBeforeSelfTeleport).gameObject); } public override void DoAIInterval() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0187: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) if (base.moveTowardsDestination) { base.agent.SetDestination(base.destination); } if (StartOfRound.Instance.livingPlayers == 0) { if (base.moveTowardsDestination) { base.agent.SetDestination(base.destination); } } else { if (!((NetworkBehaviour)RoundManager.Instance).IsHost) { return; } PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, true, true); testInPickupDistance(); if ((Object)(object)LungProp != (Object)null) { HarbingerLoader.mls.LogInfo((object)"Has Appi In Options"); } if (HarbingerLoader.HarbConfig.CanTPItems.Value && state != HarbingerStates.TeleportingSelf && state != HarbingerStates.Teleporting && StealCooldown == 0f && (Object)(object)LungProp != (Object)null && !((GrabbableObject)((Component)LungProp).GetComponent<LungProp>()).isHeld) { HarbingerLoader.mls.LogWarning((object)"Meet Requirnments"); if (state != HarbingerStates.TeleportItem) { NewStateClientRpc(HarbingerStates.TeleportItem); } if (startTeleporItemTimer != 0f) { base.agent.speed = 0f; } else { base.agent.speed = movementspeed + 2f; } if (Vector3.Distance(((Component)this).transform.position, ((Component)LungProp).transform.position) < 4f) { base.agent.speed = 0f; TeleportItem(); } } else if (state == HarbingerStates.TeleportItem) { NewStateClientRpc(HarbingerStates.Standing); } if (state != HarbingerStates.Teleporting && SelfTeleportCooldown == 0f) { if ((Object)(object)closestPlayer != (Object)null && closestPlayer.isInsideFactory && closestPlayer.isInsideFactory && Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position) > MaxDistanceToPlayerBeforeTeleport) { if (state != HarbingerStates.TeleportingSelf) { NewStateClientRpc(HarbingerStates.TeleportingSelf); } } else if ((Object)(object)closestPlayer == (Object)null || !closestPlayer.isInsideFactory) { if (state != HarbingerStates.TeleportingSelf && Random.Range(0, 2) == 1) { NewStateClientRpc(HarbingerStates.TeleportingSelf); } else { SelfTeleportCooldown += 5f; } } else if (TPSelfBehaviourOverridable && state == HarbingerStates.TeleportingSelf) { TPSelfBehaviourOverridable = false; ((MonoBehaviour)this).StopCoroutine(TeleportSelf()); NewStateClientRpc(HarbingerStates.Moving); } else { SelfTeleportCooldown += 5f; } } if (state == HarbingerStates.TeleportingSelf || state == HarbingerStates.TeleportItem || TPOtherCooldown != 0f) { return; } if ((Object)(object)closestPlayer != (Object)null && closestPlayer.isInsideFactory && Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position) < MaxDistanceToPlayerBeforeTeleport) { if (state != HarbingerStates.Teleporting) { NewStateClientRpc(HarbingerStates.Teleporting); } } else if (!TeleportValid && state == HarbingerStates.Teleporting) { ((MonoBehaviour)this).StopCoroutine(PrepTeleportOther()); NewStateClientRpc(HarbingerStates.Moving); } else { TPOtherCooldown += 5f; } } } public void testInPickupDistance() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; foreach (GrabbableObject item in grabbableObjectsInMap) { float num2 = Vector3.Distance(((Component)item).transform.position, ((Component)this).transform.position); if (num2 < 15f && num > num2) { num = num2; LungProp = item; } } if (num >= float.MaxValue) { LungProp = null; } } public override void Update() { //IL_011b: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (StealCooldown > 0f) { StealCooldown = Math.Max(0f, StealCooldown - Time.deltaTime); } if (SelfTeleportCooldown > 0f) { SelfTeleportCooldown = Math.Max(0f, SelfTeleportCooldown - Time.deltaTime); } if (TPOtherCooldown > 0f) { TPOtherCooldown = Math.Max(0f, TPOtherCooldown - Time.deltaTime); } if (startTeleporItemTimer > 0f) { startTeleporItemTimer = Math.Max(0f, startTeleporItemTimer - Time.deltaTime); } switch (state) { case HarbingerStates.Standing: if (ActionStart + stationaryTime < Time.time) { NewStateClientRpc(HarbingerStates.Moving); } break; case HarbingerStates.Moving: if (Vector3.Distance(((Component)this).transform.position, base.destination) < 0.5f || MovementTimeout + ActionStart < Time.time) { NewStateClientRpc(HarbingerStates.Standing); } break; case HarbingerStates.Teleporting: if (TeleportValid) { if (!aligned && Math.Abs(((Component)base.agent).transform.eulerAngles.y - ((Quaternion)(ref lookRotation)).eulerAngles.y) < 5f) { aligned = true; HarbingerLoader.mls.LogWarning((object)"In possition"); StartTeleportEffectsClientRpc(); ((EnemyAI)this).SwitchToBehaviourState(2); } else { ((Component)base.agent).transform.rotation = Quaternion.RotateTowards(((Component)base.agent).transform.rotation, lookRotation, Math.Abs(180f) * Time.deltaTime); } } break; case HarbingerStates.TeleportingSelf: break; } } public IEnumerator TimeTP() { yield return (object)new WaitForSeconds(6.25f); TeleportEvent(); } public void TeleportItem() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (LungProp is LungProp) { LungProp val = (LungProp)LungProp; if (val.isLungDocked) { EquipAppiClientRpc(((NetworkBehaviour)val).NetworkObjectId); } ((GrabbableObject)val).ChangeOwnershipOfProp(((NetworkBehaviour)this).NetworkManager.LocalClient.ClientId); TPItemClientRpc(((NetworkBehaviour)val).NetworkObjectId, TeleportRandom.Next(base.allAINodes.Length)); } NewStateClientRpc(HarbingerStates.Standing); } [ClientRpc] public void EquipAppiClientRpc(ulong Item) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(770069550u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, Item); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 770069550u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((GrabbableObject)((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[Item]).GetComponent<LungProp>()).EquipItem(); } } } [ClientRpc] public void TPItemClientRpc(ulong Item, int Location) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2152385852u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, Item); BytePacker.WriteValueBitPacked(val2, Location); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2152385852u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = NetworkManager.Singleton.SpawnManager.SpawnedObjects[Item]; LungProp component = ((Component)val3).GetComponent<LungProp>(); Vector3 position = base.allAINodes[Location].transform.position; ((Component)component).transform.position = position; ((Component)component).transform.SetParent(StartOfRound.Instance.propsContainer, true); ((GrabbableObject)component).EnablePhysics(true); ((GrabbableObject)component).fallTime = 0f; ((GrabbableObject)component).startFallingPosition = ((Component)component).transform.parent.InverseTransformPoint(position); ((GrabbableObject)component).targetFloorPosition = ((Component)component).transform.parent.InverseTransformPoint(((GrabbableObject)component).GetItemFloorPosition(default(Vector3))); ((GrabbableObject)component).floorYRot = -1; ((GrabbableObject)component).FallToGround(false); } } } [ClientRpc] public void NewStateClientRpc(HarbingerStates newstate) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3573526470u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<HarbingerStates>(ref newstate, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3573526470u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } HarbingerLoader.mls.LogInfo((object)("NewState " + newstate)); if (state == HarbingerStates.TeleportItem && newstate != state) { StealCooldown = ResetToStealCooldown; } if (state == HarbingerStates.Teleporting && newstate != state) { aligned = false; TeleportValid = false; Alreadyused.Clear(); } state = newstate; ActionStart = Time.time; switch (state) { case HarbingerStates.Standing: base.agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourState(0); break; case HarbingerStates.Moving: { NavMeshHit val7 = FindMoveLocation(((Component)this).transform.position, MinMaxMovement, 50, 1f, hasVertical: true, 2.5f); ((EnemyAI)this).SetDestinationToPosition(((NavMeshHit)(ref val7)).position, false); base.agent.speed = movementspeed; ((EnemyAI)this).SwitchToBehaviourState(1); break; } case HarbingerStates.Teleporting: base.agent.speed = 0f; if (((NetworkBehaviour)RoundManager.Instance).IsHost) { ((MonoBehaviour)this).StartCoroutine(PrepTeleportOther()); } break; case HarbingerStates.TeleportingSelf: base.agent.speed = 0f; ((MonoBehaviour)this).StartCoroutine(TeleportSelf()); break; case HarbingerStates.TeleportItem: { ((EnemyAI)this).SwitchToBehaviourState(4); startTeleporItemTimer = 0.5f; base.agent.speed = movementspeed + 2f; Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(((Component)LungProp).transform.position, Vector3.down); Vector3 val4 = ((Component)LungProp).transform.position; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val3, ref val5, 7f)) { val4 = ((RaycastHit)(ref val5)).point; } NavMeshHit val6 = default(NavMeshHit); if (NavMesh.SamplePosition(val4, ref val6, 10f, -1)) { HarbingerLoader.mls.LogInfo((object)"Found Destination"); ((EnemyAI)this).SetDestinationToPosition(((NavMeshHit)(ref val6)).position, false); } else { HarbingerLoader.mls.LogWarning((object)"Cant Find Location"); } break; } } } private IEnumerator TeleportSelf() { base.creatureAnimator.SetTrigger("CheckingTeleport"); TPSelfBehaviourOverridable = true; yield return (object)new WaitForSeconds(2f); List<Transform> validTeleportPlayers = new List<Transform>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB a in allPlayerScripts) { if (a.isInsideFactory && !a.isPlayerDead) { validTeleportPlayers.Add(((Component)a).transform); } } if (((NetworkBehaviour)RoundManager.Instance).IsHost) { Vector3 tpLocation = ((validTeleportPlayers.Count != 0) ? validTeleportPlayers[TeleportRandom.Next(validTeleportPlayers.Count)].position : ((base.allAINodes.Length == 0) ? ((Component)this).transform.position : base.allAINodes[Random.Range(0, base.allAINodes.Length)].transform.position)); NavMeshHit h = FindMoveLocation(tpLocation, TeleportSelfArriveRadius, 15, 1f, hasVertical: true, 2f); if (((NavMeshHit)(ref h)).hit) { LastLocationUpdateClientRpc(((Component)this).transform.position); ((EnemyAI)this).SwitchToBehaviourState(3); yield return (object)new WaitForSeconds(0.1f); base.agent.Warp(((NavMeshHit)(ref h)).position); lastTeleportTime = Time.time; SelfTeleportCooldown = IntialCooldown; if (TPOtherCooldown < 1f) { TPOtherCooldown = 1f; } } h = default(NavMeshHit); } TPSelfBehaviourOverridable = false; yield return (object)new WaitForSeconds(0.3f); NewStateClientRpc(HarbingerStates.Moving); } [ClientRpc] public void LastLocationUpdateClientRpc(Vector3 newLocation) { //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_0089: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1654902290u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newLocation); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1654902290u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((Component)PositionBeforeSelfTeleport).transform.position = newLocation; if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { PositionBeforeSelfTeleport.Play(); } } } private IEnumerator PrepTeleportOther() { base.creatureAnimator.SetTrigger("CheckingTeleport"); if (!((NetworkBehaviour)RoundManager.Instance).IsHost) { yield break; } yield return (object)new WaitForSeconds(0.5f); List<EnemyAI> validEnemies = new List<EnemyAI>(); foreach (EnemyAI Ai in RoundManager.Instance.SpawnedEnemies) { if (Ai.isOutside == base.isOutside && !Ai.isEnemyDead && Vector3.Distance(((Component)Ai).transform.position, ((Component)this).transform.position) > 20f && MonsterBlackList(Ai)) { validEnemies.Add(Ai); } } if (validEnemies.Count == 0) { HarbingerLoader.mls.LogInfo((object)"No valid Targets"); TPOtherCooldown += 5f; NewStateClientRpc(HarbingerStates.Standing); yield break; } EnemyAI a = validEnemies[TeleportRandom.Next(validEnemies.Count)]; Alreadyused.Add(a); NavMeshHit h = FindMoveLocation(((Component)this).transform.position, MinMaxMovement, 15, 1f); if (!((NavMeshHit)(ref h)).hit) { NewStateClientRpc(HarbingerStates.Standing); yield break; } SettUpTPClientRpc(((NetworkBehaviour)a).NetworkObjectId, ((NavMeshHit)(ref h)).position); Vector3 val = ((Component)tpRing).transform.position - ((Component)base.agent).transform.position; Vector3 RotateToTeleportionDirection = ((Vector3)(ref val)).normalized; RotateToTeleportionDirection.y = 0f; lookRotation = Quaternion.LookRotation(RotateToTeleportionDirection); TeleportValid = true; } [ClientRpc] public void SettUpTPClientRpc(ulong EnemyNetID, Vector3 loc) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(234086616u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, EnemyNetID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref loc); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 234086616u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = NetworkManager.Singleton.SpawnManager.SpawnedObjects[EnemyNetID]; tpRing.setup(((Component)val3).GetComponent<EnemyAI>(), loc); } } } public static NavMeshHit FindMoveLocation(Vector3 SourceLocation, Vector2 distanceRange, int maxTries = 15, float maxDistance = 2f, bool hasVertical = false, float VerticalAmount = 0f) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_008d: Unknown result type (might be due to invalid IL or missing references) NavMeshHit result = default(NavMeshHit); int num = 0; while (!((NavMeshHit)(ref result)).hit && num < maxTries) { Vector2 val = Random.insideUnitCircle; val = ((Vector2)(ref val)).normalized; Vector2 val2 = ((Vector2)(ref val)).normalized * distanceRange; float num2 = 0f; if (hasVertical) { num2 = Random.Range(0f - VerticalAmount, VerticalAmount); } Vector3 val3 = SourceLocation + new Vector3(val2.x, num2, val2.y); NavMesh.SamplePosition(val3, ref result, maxDistance, -1); num++; } return result; } public void TeleportEvent() { if (((NetworkBehaviour)RoundManager.Instance).IsHost) { lastTeleportTime = Time.time; TPOtherCooldown += TPOtherInitCooldown; TeleportClientRpc(); ((MonoBehaviour)this).StartCoroutine(EndTP()); } } [ClientRpc] public void TeleportClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3152957184u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3152957184u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { tpRing.CompleteTeleport(); tpRing.BurstEffects(); } } } private IEnumerator EndTP() { yield return (object)new WaitForSeconds(1.5f); NewStateClientRpc(HarbingerStates.Moving); } [ClientRpc] public void StartTeleportEffectsClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3751040310u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3751040310u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { tpRing.VisualEffectsActive(); } } } [ClientRpc] public void CancelTeleportClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1850307525u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1850307525u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { tpRing.Cancel(); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_006a: 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_021e: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f5: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if ((Object)(object)playerWhoHit == (Object)null || !((NetworkBehaviour)playerWhoHit).IsOwner) { return; } List<EnemyAI> list = new List<EnemyAI>(); foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (spawnedEnemy.isOutside == base.isOutside && !spawnedEnemy.isEnemyDead && Vector3.Distance(((Component)spawnedEnemy).transform.position, ((Component)this).transform.position) > 10f) { list.Add(spawnedEnemy); } } if (list.Count > 0) { Vector3 val = ((Component)list[Random.Range(0, list.Count - 1)]).transform.position; Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val, Vector3.down); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 5f)) { val = ((RaycastHit)(ref val3)).point; } NavMeshHit val4 = default(NavMeshHit); int num = 0; while (!((NavMeshHit)(ref val4)).hit && num < 10) { Vector2 val5 = Random.insideUnitCircle; val5 = ((Vector2)(ref val5)).normalized; Vector2 val6 = ((Vector2)(ref val5)).normalized * (float)Random.Range(3, 6); Vector3 val7 = val + new Vector3(val6.x, 0f, val6.y); NavMesh.SamplePosition(val7, ref val4, 0.5f, -1); ManualLogSource mls = HarbingerLoader.mls; Vector3 position = ((NavMeshHit)(ref val4)).position; mls.LogInfo((object)("Nav Pos: " + ((object)(Vector3)(ref position)).ToString())); num++; } if (num < 10) { playerWhoHit.TeleportPlayer(((NavMeshHit)(ref val4)).position, false, 0f, false, true); } else { playerWhoHit.TeleportPlayer(((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePosition, false, 0, false, 50, false).position, false, 0f, false, true); } } else { playerWhoHit.TeleportPlayer(((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePosition, false, 0, false, 50, false).position, false, 0f, false, true); } } public static bool MonsterBlackList(EnemyAI toTest) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!HarbingerLoader.WhitelistNames.Contains("none")) { return MonsterWhiteList(toTest); } if ((Object)(object)toTest == (Object)null) { return false; } if (toTest is DressGirlAI || toTest is CentipedeAI || toTest is SandSpiderAI) { return false; } if (toTest is CaveDwellerAI && (((CaveDwellerAI)toTest).holdingBaby || ((EnemyAI)(CaveDwellerAI)toTest).isOutside)) { return false; } if (HarbingerLoader.BlacklistNames.Contains(StandardiesMonsterNames(toTest.enemyType.enemyName))) { return false; } HarbingerLoader.mls.LogMessage((object)("Teleport BL Result is good: " + toTest.enemyType.enemyName)); return true; } private static bool MonsterWhiteList(EnemyAI toTest) { if (HarbingerLoader.WhitelistNames.Contains(StandardiesMonsterNames(toTest.enemyType.enemyName))) { HarbingerLoader.mls.LogMessage((object)("Teleport WL Result is good: " + toTest.enemyType.enemyName)); return true; } return false; } private static string StandardiesMonsterNames(string Monster) { return Monster.ToLower().Trim(); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HarbingerAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(770069550u, new RpcReceiveHandler(__rpc_handler_770069550)); NetworkManager.__rpc_func_table.Add(2152385852u, new RpcReceiveHandler(__rpc_handler_2152385852)); NetworkManager.__rpc_func_table.Add(3573526470u, new RpcReceiveHandler(__rpc_handler_3573526470)); NetworkManager.__rpc_func_table.Add(1654902290u, new RpcReceiveHandler(__rpc_handler_1654902290)); NetworkManager.__rpc_func_table.Add(234086616u, new RpcReceiveHandler(__rpc_handler_234086616)); NetworkManager.__rpc_func_table.Add(3152957184u, new RpcReceiveHandler(__rpc_handler_3152957184)); NetworkManager.__rpc_func_table.Add(3751040310u, new RpcReceiveHandler(__rpc_handler_3751040310)); NetworkManager.__rpc_func_table.Add(1850307525u, new RpcReceiveHandler(__rpc_handler_1850307525)); } private static void __rpc_handler_770069550(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong item = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref item); target.__rpc_exec_stage = (__RpcExecStage)2; ((HarbingerAI)(object)target).EquipAppiClientRpc(item); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2152385852(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong item = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref item); int location = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref location); target.__rpc_exec_stage = (__RpcExecStage)2; ((HarbingerAI)(object)target).TPItemClientRpc(item, location); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3573526470(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { HarbingerStates newstate = default(HarbingerStates); ((FastBufferReader)(ref reader)).ReadValueSafe<HarbingerStates>(ref newstate, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)2; ((HarbingerAI)(object)target).NewStateClientRpc(newstate); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1654902290(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 newLocation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newLocation); target.__rpc_exec_stage = (__RpcExecStage)2; ((HarbingerAI)(object)target).LastLocationUpdateClientRpc(newLocation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_234086616(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong enemyNetID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref enemyNetID); Vector3 loc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref loc); target.__rpc_exec_stage = (__RpcExecStage)2; ((HarbingerAI)(object)target).SettUpTPClientRpc(enemyNetID, loc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3152957184(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)2; ((HarbingerAI)(object)target).TeleportClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3751040310(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)2; ((HarbingerAI)(object)target).StartTeleportEffectsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1850307525(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)2; ((HarbingerAI)(object)target).CancelTeleportClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HarbingerAI"; } } internal class ItemCollider : MonoBehaviour { public HarbingerAI AI; public LayerMask LayerMask; private void OnTriggerEnter(Collider other) { if ((Object)(object)((Component)other).GetComponent<GrabbableObject>() != (Object)null && ((Component)other).GetComponent<GrabbableObject>() is LungProp) { HarbingerLoader.mls.LogInfo((object)"Triggered Appi"); } } public void TeleportCheck() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = ((Collider)((Component)this).GetComponent<BoxCollider>()).bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).size / 2f, Quaternion.identity, LayerMask.op_Implicit(LayerMask)); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)((Component)val).GetComponent<GrabbableObject>() != (Object)null && ((Component)val).GetComponent<GrabbableObject>() is LungProp) { HarbingerLoader.mls.LogInfo((object)"Triggered TP appi"); break; } } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("PhysicsProp") && ((Component)other).GetComponent<GrabbableObject>() is LungProp && (Object)(object)AI.LungProp == (Object)(object)((Component)other).GetComponent<GrabbableObject>()) { AI.LungProp = null; } } } internal class SlimePatchExample : NetworkBehaviour { public EnemyAI ai; [ClientRpc] public void TeleportCreatureClientRpc(Vector3 TPLocation) { //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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(56883393u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref TPLocation); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 56883393u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Vector3 val3 = ((BlobAI)ai).centerPoint.position - ((Component)(BlobAI)ai).transform.position; Vector3[] array = (Vector3[])(object)new Vector3[8]; if (ai is BlobAI) { for (int i = 0; i < ((BlobAI)ai).SlimeRaycastTargets.Length; i++) { array[i] = ((BlobAI)ai).SlimeBones[i].position - ((BlobAI)ai).centerPoint.position; } } if (((NetworkBehaviour)ai).IsOwner) { ai.agent.Warp(TPLocation); } if (ai is BlobAI) { ((BlobAI)ai).centerPoint.position = ((Component)(BlobAI)ai).transform.position + val3; for (int j = 0; j < ((BlobAI)ai).SlimeRaycastTargets.Length; j++) { array[j] = ((BlobAI)ai).centerPoint.position + array[j]; } Traverse.Create((object)(BlobAI)ai).Field("SlimeBonePositions").SetValue((object)array); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SlimePatchExample() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(56883393u, new RpcReceiveHandler(__rpc_handler_56883393)); } private static void __rpc_handler_56883393(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 tPLocation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref tPLocation); target.__rpc_exec_stage = (__RpcExecStage)2; ((SlimePatchExample)(object)target).TeleportCreatureClientRpc(tPLocation); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SlimePatchExample"; } } internal class TeleportRing : MonoBehaviour { public GameObject Container; public AudioSource FinishSound; public EnemyAI Teleport; public Vector3 EnemyLocation; public void setup(EnemyAI ToTeleport, Vector3 Location) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Teleport = ToTeleport; ((Component)this).transform.position = Location; } public void CompleteTeleport() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) EnemyLocation = ((Component)Teleport).transform.position; TeleportCreature(Teleport); LayerMask val = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Player" })); Collider[] array = Physics.OverlapCapsule(Container.transform.position, Container.transform.position, 3f, LayerMask.op_Implicit(val)); Collider[] array2 = array; foreach (Collider val2 in array2) { if (((Component)val2).CompareTag("Player") && ((NetworkBehaviour)((Component)val2).GetComponent<PlayerControllerB>()).IsOwner) { NavMeshHit val3 = HarbingerAI.FindMoveLocation(EnemyLocation, new Vector2(1f, 2f)); if (((NavMeshHit)(ref val3)).hit) { ((MonoBehaviour)this).StartCoroutine(TeleportPlayer(val2, ((NavMeshHit)(ref val3)).position)); } } } } private IEnumerator TeleportPlayer(Collider c, Vector3 pos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.1f); ((Component)c).GetComponent<PlayerControllerB>().TeleportPlayer(pos, true, 0f, false, true); } public void VisualEffectsActive() { Container.SetActive(true); } public void BurstEffects() { if (Object.op_Implicit((Object)(object)FinishSound)) { FinishSound.Play(); } ((MonoBehaviour)this).StartCoroutine(Deactivate()); } private IEnumerator Deactivate() { yield return (object)new WaitForSeconds(0.2f); Container.SetActive(false); } public void Cancel() { Container.SetActive(false); } public void CreatureConfigure() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Teleport is CentipedeAI) { ((EnemyAI)(CentipedeAI)Teleport).SwitchToBehaviourServerRpc(2); } else { Teleport.agent.Warp(((Component)this).transform.position); } } public void TeleportCreature(EnemyAI ai) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown Vector3 val = default(Vector3); Vector3[] array = (Vector3[])(object)new Vector3[8]; if (ai is BlobAI) { val = ((BlobAI)ai).centerPoint.position - ((Component)(BlobAI)ai).transform.position; for (int i = 0; i < ((BlobAI)ai).SlimeRaycastTargets.Length; i++) { array[i] = ((BlobAI)ai).SlimeBones[i].position - ((BlobAI)ai).centerPoint.position; } } if (((NetworkBehaviour)Teleport).IsOwner) { Teleport.agent.Warp(((Component)this).transform.position); } if (ai is BlobAI) { ((BlobAI)ai).centerPoint.position = ((Component)(BlobAI)ai).transform.position + val; for (int j = 0; j < ((BlobAI)ai).SlimeRaycastTargets.Length; j++) { array[j] = ((BlobAI)ai).centerPoint.position + array[j]; } Traverse.Create((object)(BlobAI)ai).Field("SlimeBonePositions").SetValue((object)array); } } } } namespace HarbingerBehaviour.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/Locker.dll
Decompiled 2 years agousing 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.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Locker.MonoBehaviours; using Locker.NetcodePatcher; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Locker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Locker")] [assembly: AssemblyCopyright("Copyright © zealsprince 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("335007C9-7068-4DF7-85B3-B406E9795203")] [assembly: AssemblyFileVersion("1.2.6")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.6.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Locker { internal class Assets { public enum LoadStatusCode : ushort { Success, Failed, Exists } public static AssetBundle Bundle; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static readonly Dictionary<string, string> Manifest = new Dictionary<string, string> { { "locker", "assets/exported/locker/enemies/locker.prefab" }, { "lockerenemy", "assets/exported/locker/enemies/lockerenemy.asset" } }; public static LoadStatusCode Load() { if ((Object)(object)Bundle != (Object)null) { return LoadStatusCode.Exists; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Locker"); Bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)Bundle == (Object)null) { Plugin.logger.LogInfo((object)("Failed to load asset bundle from path: " + text)); return LoadStatusCode.Failed; } Plugin.logger.LogInfo((object)("Loaded asset bundle from path: " + text)); string[] allAssetNames = Bundle.GetAllAssetNames(); foreach (string text2 in allAssetNames) { Plugin.logger.LogDebug((object)("Found asset: " + text2)); } foreach (KeyValuePair<string, string> item in Manifest) { Prefabs.Add(item.Key, Bundle.LoadAsset<GameObject>(item.Value)); } return LoadStatusCode.Success; } public static GameObject SpawnPrefab(string name, Vector3 position) { //IL_0038: 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) try { if (Prefabs.ContainsKey(name)) { Plugin.logger.LogDebug((object)("Loading prefab '" + name + "'")); return Object.Instantiate<GameObject>(Prefabs[name], position, Quaternion.identity); } Plugin.logger.LogWarning((object)("Prefab " + name + " not found!")); } catch (Exception ex) when (ex is ArgumentException || ex is NullReferenceException) { Plugin.logger.LogError((object)ex.Message); } return null; } public static GameObject Get(string name) { if (Prefabs.ContainsKey(name)) { return Prefabs[name]; } return null; } } public class Config { public static ConfigEntry<int> LockerSpawnWeight; public static ConfigEntry<float> LockerSpawnPower; public static ConfigEntry<int> LockerSpawnMax; public static ConfigEntry<string> LockerSpawnLevelsSet; public static ConfigEntry<string> LockerSpawnLevelsWithWeight; public static ConfigEntry<float> LockerVolumeAdjustment; public static ConfigEntry<float> LockerMechanicsReactivationChance; public static void Load() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown LockerMechanicsReactivationChance = Plugin.config.Bind<float>("Mechanics", "LockerMechanicsReactivationChance", 50f, new ConfigDescription("Chance for the Locker to reactivate after a chase and begin another lunge at the closest player (rolls a value 0-100 and if below the given value will reactivate)", (AcceptableValueBase)null, Array.Empty<object>())); LockerSpawnWeight = Plugin.config.Bind<int>("Spawn", "LockerSpawnWeight", 50, new ConfigDescription("What is the chance of the Locker spawning - higher values make it more common (this is like adding tickets to a lottery - it doesn't guarantee getting picked but it vastly increases the chances)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 99999), Array.Empty<object>())); LockerSpawnPower = Plugin.config.Bind<float>("Spawn", "LockerSpawnPower", 1f, new ConfigDescription("What's the spawn power of a Locker? How much does it subtract from the moon power pool on spawn?", (AcceptableValueBase)null, Array.Empty<object>())); LockerSpawnMax = Plugin.config.Bind<int>("Spawn", "LockerSpawnMax", 3, new ConfigDescription("What's the maximum amount of Lockers that can spawn on a given moon?", (AcceptableValueBase)null, Array.Empty<object>())); LockerSpawnLevelsSet = Plugin.config.Bind<string>("Spawn", "LockerSpawnLevelsSet", "all", new ConfigDescription("Which set of levels should by default let the Locker spawn on them? (Options are: all/none/modded/vanilla)", (AcceptableValueBase)null, Array.Empty<object>())); LockerSpawnLevelsWithWeight = Plugin.config.Bind<string>("Spawn", "LockerSpawnLevels", "experimentation:25, assurance:75, vow:0, march:0, offense:100", new ConfigDescription("Which specific moons/levels can the Locker spawn on and with what weight? (This takes priority over the level set config option - names are matched leniently and case insensitive)", (AcceptableValueBase)null, Array.Empty<object>())); LockerVolumeAdjustment = Plugin.config.Bind<float>("Volume", "LockerVolumeAdjustment", 1f, new ConfigDescription("Client side volume adjustment - values are a percentage i.e. 50% volume is 0.5", (AcceptableValueBase)null, Array.Empty<object>())); } } [BepInPlugin("com.zealsprince.locker", "Locker", "1.2.6")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "com.zealsprince.locker"; public const string ModName = "Locker"; public const string ModVersion = "1.2.6"; public static ManualLogSource logger; public static ConfigFile config; private readonly Harmony harmony = new Harmony("com.zealsprince.locker"); public void Awake() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) logger = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Config.Load(); if (Assets.Load() != 0) { return; } EnemyType val = Assets.Bundle.LoadAsset<EnemyType>("assets/exported/locker/enemies/lockerenemy.asset"); TerminalNode val2 = Assets.Bundle.LoadAsset<TerminalNode>("assets/exported/locker/enemies/lockerterminalnode.asset"); TerminalKeyword val3 = Assets.Bundle.LoadAsset<TerminalKeyword>("assets/exported/locker/enemies/lockerterminalkeyword.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); val.PowerLevel = Config.LockerSpawnPower.Value; val.MaxCount = Config.LockerSpawnMax.Value; string[] source = new string[4] { "all", "modded", "vanilla", "none" }; string text = source.FirstOrDefault((string s) => new string((from c in Config.LockerSpawnLevelsSet.Value.ToLower().ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()).Contains(s)); LevelTypes val4 = (LevelTypes)1; switch (text) { case "all": val4 = (LevelTypes)(-1); break; case "modded": val4 = (LevelTypes)1024; break; case "vanilla": val4 = (LevelTypes)1020; break; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); string text2 = new string((from c in Config.LockerSpawnLevelsWithWeight.Value.ToLower().ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); string[] array = text2.Split(new char[1] { ',' }); foreach (string text3 in array) { string[] array2 = text3.Split(new char[1] { ':' }); if (array2.Length == 1) { dictionary.Add(array2[0], Config.LockerSpawnWeight.Value); } else { if (array2.Length != 2) { continue; } int num = 0; try { num = int.Parse(array2[1]); } catch (Exception ex) { if (ex is ArgumentException || ex is FormatException || ex is OverflowException) { logger.LogError((object)$"Failed to parse level/moon weight value: {ex}"); } continue; } dictionary.Add(array2[0], num); } } Enemies.RegisterEnemy(val, Config.LockerSpawnWeight.Value, (LevelTypes)1, (SpawnType)0, val2, val3); Enemies.RemoveEnemyFromLevels(val, (LevelTypes)1, (string[])null); Enemies.RegisterEnemy(val, (SpawnType)0, new Dictionary<LevelTypes, int> { [val4] = Config.LockerSpawnWeight.Value }, dictionary, val2, val3); try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array3 = types; foreach (Type type in array3) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array4 = methods; foreach (MethodInfo methodInfo in array4) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception ex2) { logger.LogError((object)ex2); } harmony.PatchAll(); } } internal class Utilities { public static void ApplyLocalPlayerScreenshake(Vector3 position, float minDistance = 14f, float maxDistance = 25f, bool onlySmall = false) { //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) float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, position); if (num < minDistance && !onlySmall) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < maxDistance) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } public static void Explode(Vector3 position, float minRange = 5f, float maxRange = 6f, float damage = 25f, int enemyDamage = 6) { //IL_005a: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_028a: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, position, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); ApplyLocalPlayerScreenshake(position); Collider[] array = Physics.OverlapSphere(position, maxRange, 2621448, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { float num = Vector3.Distance(position, ((Component)array[i]).transform.position); if (num > 4f && Physics.Linecast(position, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (((Component)array[i]).gameObject.layer == 3) { PlayerControllerB component = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component).IsOwner) { float num2 = 1f - Mathf.Clamp01((num - minRange) / (maxRange - minRange)); component.DamagePlayer((int)(damage * num2), true, true, (CauseOfDeath)3, 0, false, default(Vector3)); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num < 6f) { componentInChildren.Detonate(); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num < 4.5f) { componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyDamage, default(Vector3), (PlayerControllerB)null, false, -1); } } } int num3 = ~LayerMask.GetMask(new string[1] { "Room" }); num3 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(position, 10f, num3); for (int j = 0; j < array.Length; j++) { Rigidbody component2 = ((Component)array[j]).GetComponent<Rigidbody>(); if (component2 != null) { component2.AddExplosionForce(70f, position, 10f); } } } } } namespace Locker.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatches { [HarmonyPostfix] [HarmonyPatch("PingScan_performed")] private static void NotifyScanLockers() { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)) { return; } foreach (LockerAI activeLocker in LockerAI.activeLockers) { activeLocker?.PlayerScan(GameNetworkManager.Instance.localPlayerController); } } } } namespace Locker.MonoBehaviours { public class LockerAI : EnemyAI { public enum State { Dormant, Activating, Chasing, Reactivating, Resetting, Consuming, Debug } public static readonly int CreatureID = 176; private static readonly Color eyeColorDormant = Color.black; private static readonly Color eyeColorScan = Color.cyan; private static readonly Color eyeColorDetect = new Color(1f, 0.4f, 0f); private static readonly Color eyeColorChase = Color.red; private AudioSource audioSource; private Animator animationController; private Material eyeMaterial; private Light internalLight; private List<Light> scrapeLights; private DoorLock[] doors = Array.Empty<DoorLock>(); private VisualEffect[] visualEffects; private static VFXExposedProperty chaseVFXBeginTrigger; private static VFXExposedProperty chaseVFXEndTrigger; private static readonly string chaseVFXBeginTriggerName = "BeginChase"; private static readonly string chaseVFXEndTriggerName = "EndChase"; private static VFXExposedProperty consumeVFXBeginTrigger; private static VFXExposedProperty consumeVFXEndTrigger; private static readonly string consumeVFXBeginTriggerName = "BeginConsume"; private static readonly string consumeVFXEndTriggerName = "EndConsume"; private int observedState; private Vector3 targetPosition; private Quaternion targetRotation; private float currentRotationSpeed = 0f; private readonly float maxRotationSpeed = 90f; private Color currentEyeColor = eyeColorDormant; private float currentEyeIntensity = 0f; private float activationTimer = 0f; private readonly float activationDuration = 1.5f; private readonly float activationSpinWindup = 0.45f; private float reactivationTimer = 0f; private readonly float reactivationDuration = 1f; private float consumeTimer = 0f; private readonly float consumeDuration = 2.2f; private readonly float consumeBloodWindup = 1f; private bool consumeBloodTriggered = false; private float resetTimer = 0f; private readonly float resetDuration = 1f; private PlayerControllerB playerScanning; private bool playerScanned = false; private float playerScannedTimer = 0f; private float playerScannedDuration = 0f; private float lastTargetTime; private readonly float touchOvershoot = 1.75f; private readonly float scanOvershoot = 1f; private readonly float reactivationOvershoot = 1.25f; private Vector3 lastChasePosition = Vector3.zero; private float chaseMovementAverage = 0f; private readonly float chaseMovementSpeed = 30f; private readonly float chaseMovementAverageInitial = 100f; private readonly float chaseMovementAverageMinimum = 0.01f; private readonly float lastTargetTimeframe = 0.2f; private readonly float explosionDamage = 100f; private readonly float explosionMinRange = 5f; private readonly float explosionMaxRange = 6f; private readonly int explosionEnemyDamage = 6; [Header("Locker")] public bool DebugToCamera = false; public AudioClip AudioClipPing; public AudioClip AudioClipActivate; public AudioClip AudioClipChase; public AudioClip AudioClipReactivate; public AudioClip AudioClipReset; public AudioClip AudioClipConsume; private LineRenderer debugLine; public static List<LockerAI> activeLockers = new List<LockerAI>(); public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); activeLockers.Remove(this); } public override void Start() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); activeLockers.Add(this); audioSource = ((Component)this).GetComponent<AudioSource>(); animationController = ((Component)this).GetComponent<Animator>(); SkinnedMeshRenderer componentInChildren = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>(); Material[] materials = ((Renderer)componentInChildren).materials; foreach (Material val in materials) { if (((Object)val).name.ToLower().Contains("eye")) { eyeMaterial = val; eyeMaterial.SetColor("_EmissiveColor", currentEyeColor); break; } } scrapeLights = new List<Light>(); Light[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val2 in array) { if (((Object)((Component)val2).gameObject).name == "InternalLight") { internalLight = val2; continue; } scrapeLights.Add(val2); ((Behaviour)val2).enabled = false; } internalLight.intensity = 0f; ((Behaviour)internalLight).enabled = true; targetPosition = Vector3.zero; visualEffects = ((Component)this).gameObject.GetComponentsInChildren<VisualEffect>(); chaseVFXBeginTrigger.name = chaseVFXBeginTriggerName; chaseVFXEndTrigger.name = chaseVFXEndTriggerName; consumeVFXBeginTrigger.name = consumeVFXBeginTriggerName; consumeVFXEndTrigger.name = consumeVFXEndTriggerName; doors = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[]; debugLine = ((Component)this).GetComponent<LineRenderer>(); SwitchState(State.Dormant); } public IEnumerator DrawPath() { if (((Behaviour)base.agent).enabled) { yield return (object)new WaitForEndOfFrame(); debugLine.positionCount = base.agent.path.corners.Length; debugLine.SetPosition(0, ((Component)base.agent).transform.position); for (int i = 1; i < base.agent.path.corners.Length; i++) { debugLine.SetPosition(i, base.agent.path.corners[i]); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { if (base.debugEnemyAI) { ((Renderer)debugLine).enabled = true; ((MonoBehaviour)this).StartCoroutine(DrawPath()); } else { ((Renderer)debugLine).enabled = false; } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerWhoHit != (Object)null) { TargetServerRpc(playerWhoHit.playerClientId, ((Component)playerWhoHit).transform.position); } } public override void Update() { //IL_0036: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_023c: 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_0246: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: 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_0435: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { return; } if (DebugToCamera) { DebugToCamera = false; TargetServerRpc(0uL, ((Component)Camera.main).transform.position); } switch (base.currentBehaviourStateIndex) { case 0: currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDormant, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 8f); break; case 1: if (activationTimer > activationSpinWindup) { currentRotationSpeed = Mathf.Lerp(currentRotationSpeed, maxRotationSpeed, Time.deltaTime / Mathf.Abs(maxRotationSpeed - currentRotationSpeed)); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * currentRotationSpeed * 4f); } currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDetect, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 100000f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 40000f, Time.deltaTime / 4f); break; case 2: currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 500000f, Time.deltaTime * 2f); if (((Component)this).transform.position != lastChasePosition) { Quaternion val2 = Quaternion.LookRotation(((Component)this).transform.position - lastChasePosition) * Quaternion.Euler(Vector3.up * 90f) * Quaternion.Euler(Vector3.back * 8f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 4f); } internalLight.intensity = Mathf.Lerp(internalLight.intensity, 20000f, Time.deltaTime); foreach (Light scrapeLight in scrapeLights) { scrapeLight.intensity = Mathf.Lerp(scrapeLight.intensity + (float)Random.Range(-3000, 3000), 4000f, Time.deltaTime * 2f); } break; case 3: currentRotationSpeed = Mathf.Lerp(currentRotationSpeed, maxRotationSpeed, Time.deltaTime / Mathf.Abs(maxRotationSpeed - currentRotationSpeed)); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * currentRotationSpeed * 6f); break; case 5: if (consumeTimer > consumeBloodWindup && !consumeBloodTriggered) { VisualEffect[] array = visualEffects; foreach (VisualEffect val in array) { val.SendEvent(consumeVFXBeginTrigger.name); } consumeBloodTriggered = true; } ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * 8f); currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 2f); foreach (Light scrapeLight2 in scrapeLights) { scrapeLight2.intensity = Mathf.Lerp(scrapeLight2.intensity, 0f, Time.deltaTime * 8f); } break; } eyeMaterial.SetColor("_EmissiveColor", currentEyeColor * currentEyeIntensity); } public void FixedUpdate() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) ObserveState(); PlayerControllerB val2 = null; try { val2 = ((EnemyAI)this).GetClosestPlayer(false, true, true); } catch (Exception ex) { if (!(ex is NullReferenceException)) { } } switch (base.currentBehaviourStateIndex) { case 0: if ((Object)(object)val2 != (Object)null && Mathf.Abs(((Component)val2).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && (double)Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 1.5) { Vector3 val3 = ((Component)this).transform.position - ((Component)val2).transform.position; TargetServerRpc(val2.playerClientId, ((Component)val2).transform.position - ((Vector3)(ref val3)).normalized * touchOvershoot); break; } if (IsLocalPlayerClosestWithLight()) { TargetServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((Component)StartOfRound.Instance.localPlayerController).transform.position); } if (playerScanned) { playerScannedTimer += Time.fixedDeltaTime; if (playerScannedTimer > playerScannedDuration) { currentEyeColor = eyeColorScan; audioSource.PlayOneShot(AudioClipPing, 1.5f * Config.LockerVolumeAdjustment.Value); playerScanning.JumpToFearLevel(0.2f, true); Vector3 val4 = ((Component)this).transform.position - ((Component)playerScanning).transform.position; TargetServerRpc(playerScanning.playerClientId, ((Component)playerScanning).transform.position - ((Vector3)(ref val4)).normalized * scanOvershoot); playerScanned = false; playerScannedTimer = 0f; playerScannedDuration = 0f; } } break; case 1: activationTimer += Time.fixedDeltaTime; if (activationTimer > activationDuration) { SwitchState(State.Chasing); } break; case 2: { if (IsLocalPlayerClosestWithLight()) { TargetServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((Component)StartOfRound.Instance.localPlayerController).transform.position); } if (playerScanned) { playerScannedTimer += Time.fixedDeltaTime; if (playerScannedTimer > playerScannedDuration) { audioSource.PlayOneShot(AudioClipPing, 1.5f * Config.LockerVolumeAdjustment.Value); playerScanning.JumpToFearLevel(0.5f, true); currentEyeColor = eyeColorScan; TargetServerRpc(playerScanning.playerClientId, ((Component)playerScanning).transform.position); playerScanned = false; playerScannedTimer = 0f; playerScannedDuration = 0f; } } if ((Object)(object)val2 != (Object)null && Mathf.Abs(((Component)val2).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 2f) { ConsumeServerRpc(val2.playerClientId); break; } DoorLock[] array = doors; foreach (DoorLock door in array) { if (!Object.op_Implicit((Object)(object)door)) { doors = doors.Where((DoorLock val) => (Object)(object)val != (Object)(object)door).ToArray(); break; } if (!Object.op_Implicit((Object)(object)((Component)door).GetComponent<Rigidbody>()) && Vector3.Distance(((Component)door).transform.position, ((Component)this).transform.position) < 3f) { Utilities.Explode(((Component)door).transform.position, 2f, 4f, 100f, 0); Object.Destroy((Object)(object)((Component)((Component)door).transform.parent).gameObject); doors = doors.Where((DoorLock val) => (Object)(object)val != (Object)(object)door).ToArray(); } } chaseMovementAverage = (chaseMovementAverage + Vector3.Distance(lastChasePosition, ((Component)this).transform.position)) / 2f; lastChasePosition = ((Component)this).transform.position; if (((NetworkBehaviour)this).IsServer && (Vector3.Distance(((Component)this).transform.position, targetPosition) <= 0.5f || chaseMovementAverage < chaseMovementAverageMinimum)) { if (chaseMovementAverage > chaseMovementAverageMinimum && Random.Range(0f, 100f) < Config.LockerMechanicsReactivationChance.Value) { ReactivateServerRpc(); } else { ResetServerRpc(); } } break; } case 3: reactivationTimer += Time.fixedDeltaTime; if (reactivationTimer > reactivationDuration) { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(true, false, false); if (Object.op_Implicit((Object)(object)closestPlayer)) { Vector3 val5 = ((Component)this).transform.position - ((Component)closestPlayer).transform.position; TargetServerRpc(closestPlayer.playerClientId, ((Component)closestPlayer).transform.position - ((Vector3)(ref val5)).normalized * reactivationOvershoot); } else { ResetServerRpc(); } } break; case 5: consumeTimer += Time.fixedDeltaTime; if (consumeTimer > consumeDuration) { SwitchState(State.Dormant); } break; case 4: resetTimer += Time.fixedDeltaTime; if (resetTimer > resetDuration) { SwitchState(State.Dormant); } break; } } public override void KillEnemy(bool destroy = false) { ((EnemyAI)this).KillEnemy(destroy); if (((NetworkBehaviour)this).IsServer) { ExplodeServerRpc(); } } public override void OnCollideWithEnemy(Collider other, EnemyAI enemy) { ((EnemyAI)this).OnCollideWithEnemy(other, enemy); int currentBehaviourStateIndex = base.currentBehaviourStateIndex; int num = currentBehaviourStateIndex; if (num == 2) { if (enemy.enemyType.canDie && !enemy.isEnemyDead) { enemy.KillEnemy(false); } if ((Object)(object)enemy.enemyType == (Object)(object)base.enemyType) { ((EnemyAI)this).KillEnemy(false); } } } public void OnTriggerEnter(Collider collider) { int currentBehaviourStateIndex = base.currentBehaviourStateIndex; int num = currentBehaviourStateIndex; if (num == 2) { PlayerControllerB component = ((Component)collider).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { ConsumeServerRpc(component.playerClientId); } } } public void SwitchState(State state) { ((EnemyAI)this).SwitchToBehaviourState((int)state); } public void ObserveState() { //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) if (base.currentBehaviourStateIndex == observedState) { return; } activationTimer = 0f; reactivationTimer = 0f; consumeTimer = 0f; resetTimer = 0f; switch (base.currentBehaviourStateIndex) { case 6: TargetServerRpc(0uL, new Vector3((float)Random.Range(-25, 25), ((Component)this).transform.position.y, (float)Random.Range(-25, 25))); break; case 0: { audioSource.loop = false; currentRotationSpeed = 0f; foreach (Light scrapeLight in scrapeLights) { scrapeLight.intensity = 0f; ((Behaviour)scrapeLight).enabled = false; } animationController.SetTrigger("Deactivate"); animationController.SetBool("Chasing", false); VisualEffect[] array2 = visualEffects; foreach (VisualEffect val2 in array2) { val2.SendEvent(consumeVFXEndTrigger.name); val2.SendEvent(chaseVFXEndTrigger.name); } consumeBloodTriggered = false; break; } case 1: audioSource.PlayOneShot(AudioClipActivate, Config.LockerVolumeAdjustment.Value); animationController.SetTrigger("Activate"); break; case 2: { if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh) { ((EnemyAI)this).SetDestinationToPosition(targetPosition, true); } base.agent.speed = chaseMovementSpeed; lastChasePosition = ((Component)this).transform.position; chaseMovementAverage = chaseMovementAverageInitial; audioSource.pitch = 1f; audioSource.clip = AudioClipChase; audioSource.loop = true; audioSource.volume = Config.LockerVolumeAdjustment.Value; audioSource.Play(); animationController.SetTrigger("OpenDoors"); foreach (Light scrapeLight2 in scrapeLights) { ((Behaviour)scrapeLight2).enabled = true; } animationController.SetTrigger("Chase"); animationController.SetBool("Chasing", true); VisualEffect[] array3 = visualEffects; foreach (VisualEffect val3 in array3) { val3.SendEvent(chaseVFXBeginTrigger.name); } break; } case 3: case 4: case 5: { base.agent.speed = 0f; currentRotationSpeed = 0f; audioSource.Stop(); audioSource.loop = false; ((Component)this).transform.rotation = ((Component)this).transform.rotation * Quaternion.Euler(Vector3.forward * 10f); animationController.SetBool("Chasing", false); animationController.SetTrigger("CloseDoors"); VisualEffect[] array = visualEffects; foreach (VisualEffect val in array) { val.SendEvent(chaseVFXEndTrigger.name); } if ((Object)(object)StartOfRound.Instance != (Object)null) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num < 7f) { Utilities.ApplyLocalPlayerScreenshake(((Component)this).transform.position, 4f, 7f); if (num < 4f) { if (base.currentBehaviourStateIndex == 5) { localPlayerController.JumpToFearLevel(1f, true); } else { localPlayerController.JumpToFearLevel(0.7f, true); } } } } if (base.currentBehaviourStateIndex == 5) { audioSource.PlayOneShot(AudioClipConsume, Config.LockerVolumeAdjustment.Value); } else if (base.currentBehaviourStateIndex == 3) { audioSource.PlayOneShot(AudioClipReactivate, Config.LockerVolumeAdjustment.Value); } else { audioSource.PlayOneShot(AudioClipReset, Config.LockerVolumeAdjustment.Value); } break; } } observedState = base.currentBehaviourStateIndex; } private bool IsLocalPlayerClosestWithLight() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0072: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; float num = float.PositiveInfinity; PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 15, (Transform)null, -1f, -1); if (allPlayersInLineOfSight == null || allPlayersInLineOfSight.Length == 0) { return false; } PlayerControllerB[] array = allPlayersInLineOfSight; foreach (PlayerControllerB val2 in array) { bool flag = false; Vector3 val3 = ((Component)this).transform.position - ((Component)val2).transform.position; float num2 = Vector3.Angle(((Component)val2).transform.forward, val3); if ((Object)(object)val2.pocketedFlashlight != (Object)null && val2.pocketedFlashlight.isBeingUsed && Mathf.Abs(num2) < 30f) { flag = true; } GrabbableObject currentlyHeldObjectServer = val2.currentlyHeldObjectServer; if (!flag && val2.isHoldingObject && (Object)(object)currentlyHeldObjectServer != (Object)null) { bool flag2 = ((object)currentlyHeldObjectServer).GetType() == typeof(FlashlightItem); Light[] componentsInChildren = ((Component)currentlyHeldObjectServer).gameObject.GetComponentsInChildren<Light>(); Light[] array2 = componentsInChildren; foreach (Light val4 in array2) { if (!((Behaviour)val4).enabled || !(val4.intensity > 0f) || !(val4.range > 0f)) { continue; } if (flag2) { if (Mathf.Abs(num2) < 30f) { flag = true; } } else { flag = true; } } } if (flag) { float num3 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position); if (num3 < num) { num = num3; val = val2; } } } if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)StartOfRound.Instance.localPlayerController) { return true; } return false; } public PlayerControllerB GetClosestVisiblePlayer() { //IL_004a: 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) PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 30, (Transform)null, -1f, -1); float num = float.PositiveInfinity; PlayerControllerB result = null; if (allPlayersInLineOfSight != null) { if (allPlayersInLineOfSight.Length != 0) { PlayerControllerB[] array = allPlayersInLineOfSight; foreach (PlayerControllerB val in array) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } return null; } [ServerRpc(RequireOwnership = false)] public void TargetServerRpc(ulong clientId, Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1408573431u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1408573431u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TargetClientRpc(clientId, position); } } } [ClientRpc] public void TargetClientRpc(ulong clientId, Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1018811517u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1018811517u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !(Time.time - lastTargetTimeframe > lastTargetTime) || (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 6 && (base.currentBehaviourStateIndex != 2 || clientId != base.targetPlayer.playerClientId) && base.currentBehaviourStateIndex != 3)) { return; } position.y = ((Component)this).transform.position.y; targetPosition = position; targetRotation = Quaternion.LookRotation(targetPosition - ((Component)this).transform.position); targetRotation *= Quaternion.Euler(Vector3.up * 90f); lastTargetTime = Time.time; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[clientId]; if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 6) { SwitchState(State.Activating); } else if ((base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3) && base.currentBehaviourStateIndex == 3) { if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh) { ((EnemyAI)this).SetDestinationToPosition(targetPosition, true); } SwitchState(State.Chasing); } } [ServerRpc(RequireOwnership = false)] public void ReactivateServerRpc() { //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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1126862929u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1126862929u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { targetPosition = ((Component)this).transform.position; if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh) { ((EnemyAI)this).SetDestinationToPosition(targetPosition, true); } ReactivateClientRpc(); } } [ClientRpc] public void ReactivateClientRpc() { //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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011b: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1648224205u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1648224205u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB closestVisiblePlayer = GetClosestVisiblePlayer(); if ((Object)(object)closestVisiblePlayer != (Object)null) { currentRotationSpeed = 0f; targetRotation = Quaternion.LookRotation(((Component)closestVisiblePlayer).transform.position - ((Component)this).transform.position); targetRotation *= Quaternion.Euler(Vector3.up * 90f); } SwitchState(State.Reactivating); } } [ServerRpc(RequireOwnership = false)] public void ConsumeServerRpc(ulong clientid) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2082259863u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientid); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2082259863u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { targetPosition = ((Component)this).transform.position; if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh) { ((EnemyAI)this).SetDestinationToPosition(targetPosition, false); } ConsumeClientRpc(clientid); } } [ClientRpc] public void ConsumeClientRpc(ulong id) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2705739593u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2705739593u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(KillPlayer(id)); SwitchState(State.Consuming); } } } [ServerRpc(RequireOwnership = false)] public void ResetServerRpc() { //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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3735075229u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3735075229u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (((NetworkBehaviour)this).IsServer && base.agent.isOnNavMesh) { targetPosition = ((Component)this).transform.position; ((EnemyAI)this).SetDestinationToPosition(targetPosition, false); } ResetClientRpc(); } } [ClientRpc] public void ResetClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3355973848u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3355973848u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SwitchState(State.Resetting); } } } [ServerRpc(RequireOwnership = true)] public void ExplodeServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2667453085u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2667453085u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ExplodeClientRpc(); } } [ClientRpc] public void ExplodeClientRpc() { //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_00c2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(707895878u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 707895878u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Utilities.Explode(((Component)this).transform.position, explosionMinRange, explosionMaxRange, explosionDamage, explosionEnemyDamage); Object.Destroy((Object)(object)((Component)this).gameObject); } } } public IEnumerator KillPlayer(ulong id) { PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[id]; if ((Object)(object)player != (Object)null) { player.bleedingHeavily = true; yield return (object)new WaitForSeconds(0.1f); player.KillPlayer(Vector3.zero, true, (CauseOfDeath)8, 1, default(Vector3)); float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 3f)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = ((Component)base.eye).transform; player.deadBody.attachedLimb = player.deadBody.bodyParts[5]; player.deadBody.matchPositionExactly = true; } yield return (object)new WaitUntil((Func<bool>)(() => (double)(Time.timeSinceLevelLoad - startTime) > (double)consumeDuration * 0.75)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = null; player.deadBody.attachedLimb = null; player.deadBody.matchPositionExactly = false; ((Component)player.deadBody).gameObject.SetActive(false); player.deadBody = null; } } } public void PlayerScan(PlayerControllerB player) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0060: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e3: 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_00f2: Unknown result type (might be due to invalid IL or missing references) if (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 6 && base.currentBehaviourStateIndex != 2) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position); if ((!(num < 2f) || !(Mathf.Abs(((Component)player).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f)) && num < 90f && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 2f + Vector3.right * 0.2f, ((Component)player).transform.position + Vector3.up * 2f + Vector3.right * 0.2f, StartOfRound.Instance.collidersAndRoomMask)) { playerScanning = player; if (!playerScanned) { playerScanned = true; playerScannedTimer = 0f; playerScannedDuration = num / 30f; } else if (playerScannedDuration - playerScannedTimer < num / 30f) { playerScannedDuration = num / 30f; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LockerAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1408573431u, new RpcReceiveHandler(__rpc_handler_1408573431)); NetworkManager.__rpc_func_table.Add(1018811517u, new RpcReceiveHandler(__rpc_handler_1018811517)); NetworkManager.__rpc_func_table.Add(1126862929u, new RpcReceiveHandler(__rpc_handler_1126862929)); NetworkManager.__rpc_func_table.Add(1648224205u, new RpcReceiveHandler(__rpc_handler_1648224205)); NetworkManager.__rpc_func_table.Add(2082259863u, new RpcReceiveHandler(__rpc_handler_2082259863)); NetworkManager.__rpc_func_table.Add(2705739593u, new RpcReceiveHandler(__rpc_handler_2705739593)); NetworkManager.__rpc_func_table.Add(3735075229u, new RpcReceiveHandler(__rpc_handler_3735075229)); NetworkManager.__rpc_func_table.Add(3355973848u, new RpcReceiveHandler(__rpc_handler_3355973848)); NetworkManager.__rpc_func_table.Add(2667453085u, new RpcReceiveHandler(__rpc_handler_2667453085)); NetworkManager.__rpc_func_table.Add(707895878u, new RpcReceiveHandler(__rpc_handler_707895878)); } private static void __rpc_handler_1408573431(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((LockerAI)(object)target).TargetServerRpc(clientId, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1018811517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((LockerAI)(object)target).TargetClientRpc(clientId, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1126862929(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; ((LockerAI)(object)target).ReactivateServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1648224205(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)2; ((LockerAI)(object)target).ReactivateClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2082259863(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientid = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientid); target.__rpc_exec_stage = (__RpcExecStage)1; ((LockerAI)(object)target).ConsumeServerRpc(clientid); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2705739593(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((LockerAI)(object)target).ConsumeClientRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3735075229(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; ((LockerAI)(object)target).ResetServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3355973848(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)2; ((LockerAI)(object)target).ResetClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2667453085(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((LockerAI)(object)target).ExplodeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_707895878(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)2; ((LockerAI)(object)target).ExplodeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LockerAI"; } } } namespace Locker.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/ProjectSCP.SCP1507.dll
Decompiled 2 years agousing 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.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalBestiary.Modules; using Microsoft.CodeAnalysis; using ProjectSCP.SCP1507.NetcodePatcher; using SCP1507.Configurations; using SCP1507.DataClass; using SCP1507.FlamingoManager; using SCP1507.Patches; using SCP1507.SCP1507; using SCP1507.SCP1507Alpha; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [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("ProjectSCP.SCP1507")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+a17b707596129066829c1424595a974c49330530")] [assembly: AssemblyProduct("SCP1507")] [assembly: AssemblyTitle("ProjectSCP.SCP1507")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkBehaviourReference>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkBehaviourReference>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SCP1507 { [BepInPlugin("ProjectSCP.SCP1507", "SCP1507", "1.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? ModAssets; private readonly Harmony harmony = new Harmony("ProjectSCP.SCP1507"); public static Config FlamingoConfig { get; internal set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; FlamingoConfig = new Config(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); Logger.LogInfo((object)"Plugin ProjectSCP.SCP1507 loading asset bundles"); string path = "scp1507modassets"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path)); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } Logger.LogInfo((object)"Extracting Enemies"); EnemyType val = ModAssets.LoadAsset<EnemyType>("scp1507"); TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SCP1507TN"); TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SCP1507TK"); EnemyType val4 = ModAssets.LoadAsset<EnemyType>("SCP1507Alpha"); TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("SCP1507ATN"); TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("SCP1507ATK"); Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)16, 20 }, { (LevelTypes)64, 20 }, { (LevelTypes)(-1), FlamingoConfig.RARITY_ALPHA.Value }, { (LevelTypes)1024, 40 } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Logger.LogInfo((object)"Registered Prfabs"); Enemies.RegisterEnemy(val, 0, (LevelTypes)(-1), val2, val3); Enemies.RegisterEnemy(val4, dictionary, dictionary2, val5, val6); Logger.LogInfo((object)"Registered enemies"); harmony.PatchAll(typeof(ConfigurationsPatch)); harmony.PatchAll(typeof(NoiseItemPatch)); harmony.PatchAll(typeof(PhysicsProp)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); Logger.LogInfo((object)"Executed patches"); Logger.LogInfo((object)"Plugin ProjectSCP.SCP1507 is loaded!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "ProjectSCP.SCP1507"; public const string PLUGIN_NAME = "SCP1507"; public const string PLUGIN_VERSION = "1.1.2"; } } namespace SCP1507.SCP1507 { public class AnimationRelaySCP1507Alpha : MonoBehaviour { public Scp1507Alpha mainScript; public void AttackDoorAnimationHandle() { MonsterLogger("Started attack sequence against door! FROM ALPHA. This is not supposed to happen and may cause issue!", reportable: true); } public void AttackPlayerAnimationHandle() { mainScript.SwingAttackHitClientRpc(); } public void FootStepAnimationHandle() { mainScript.walkingSource.Play(); } private void MonsterLogger(string message, bool reportable = false) { if (!reportable) { Debug.Log((object)("[ProjectSCP.SCP1507][SCP1507Alpha.Animations][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } else { Debug.LogError((object)("[ProjectSCP.SCP1507][SCP1507Alpha.Animations][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } } } public class AnimationRelaySCP1507 : MonoBehaviour { public Scp1507 mainScript; public void AttackDoorAnimationHandle() { ((EnemyAI)mainScript).creatureSFX.PlayOneShot(mainScript.destroyDoor); mainScript.SwingAttackHitDoor(); } public void AttackPlayerAnimationHandle() { mainScript.SwingAttackHitClientRpc(); } public void FootStepAnimationHandle() { mainScript.walkingSource.Play(); } } public class Scp1507 : EnemyAI { [NonSerialized] [Header("Alpha")] public Scp1507Alpha alpha; [NonSerialized] public int alphaId; private bool isAlphaAlive; [Header("Attack")] public float attackCooldown; private float attackCooldownBeheader; public int damage; public Transform AttackArea; private Coroutine KillCoroutine; [Header("Audio")] public AudioClip destroyDoor; public AudioClip[] honks; public AudioClip[] attacks; public AudioClip attackDoor; public AudioSource walkingSource; private global::SCP1507.FlamingoManager.FlamingoManager flamingoManager; [Header("LookAt")] public Transform lookAt; public Transform defaultLookAt; private Coroutine startCo; [NonSerialized] private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public PlayerControllerB Scp1507TargetPlayer { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value); } set { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)value == (Object)null) { _playerNetVar.Value = default(NetworkBehaviourReference); } else { _playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value); } } } private void DoAttackSound() { base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]); } public void DoQuackSound() { try { base.creatureVoice.PlayOneShot(honks[RandomNumberGenerator.GetInt32(honks.Length)]); } catch (ArgumentNullException) { } } private void OnTriggerEnter(Collider other) { MonsterLogger("We collided with something!"); if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<DoorLock>())) { PlayAnimationClientRpc("AttackDoor", value: true); } } private void OnTriggerExit(Collider other) { if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<DoorLock>())) { PlayAnimationClientRpc("AttackDoor", value: false); } } private void CheckIfCanBreakDoor(DoorLock Door) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_008e: 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) if (alpha.HitDoor(Door)) { return; } try { GameObject gameObject = ((Component)((Component)((Component)((Component)Door).transform.parent).transform.parent).transform.parent).gameObject; if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()) && Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f) { NetworkObjectReference netObjRef = NetworkObjectReference.op_Implicit(gameObject); Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position; BashDoorClientRpc(netObjRef, ((Vector3)(ref val)).normalized * 20f); } } catch (NullReferenceException) { try { Door.OpenDoorAsEnemyClientRpc(); } catch (Exception ex) { Debug.Log((object)("The doors are not formatted the right way and as such Flamingo's may seems really stupid hitting doors " + ex)); } } } [ClientRpc] public void BashDoorClientRpc(NetworkObjectReference netObjRef, Vector3 Position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4184319842u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref Position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4184319842u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)val3).gameObject; Rigidbody val4 = gameObject.AddComponent<Rigidbody>(); AudioSource val5 = gameObject.AddComponent<AudioSource>(); val5.spatialBlend = 1f; val5.maxDistance = 60f; val5.rolloffMode = (AudioRolloffMode)1; val5.volume = 1f; ((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.12f)); val4.AddForce(Position, (ForceMode)1); val5.PlayOneShot(destroyDoor); } } } private IEnumerator TurnOffC(Rigidbody rigidbody, float time) { rigidbody.detectCollisions = false; yield return (object)new WaitForSeconds(time); rigidbody.detectCollisions = true; Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 5f); } public void SwingAttackHitDoor() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) int num = 512; if (((NetworkBehaviour)this).IsHost) { Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val in array2) { DoorLock component = ((Component)val).gameObject.GetComponent<DoorLock>(); if ((Object)(object)component != (Object)null) { CheckIfCanBreakDoor(component); } } } } attackCooldown = attackCooldownBeheader; } private void Awake() { attackCooldownBeheader = attackCooldown; attackCooldown = 0f; startCo = ((MonoBehaviour)this).StartCoroutine(StartCoroutineFLAMINGO()); damage = Plugin.FlamingoConfig.DAMAGE_NORMAL.Value; if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { flamingoManager = global::SCP1507.FlamingoManager.FlamingoManager.Instance; flamingoManager.RegisterScp1507Instance(this); } Random random = new Random(); bool value = random.Next(2) == 0; PlayAnimationClientRpc("DanceDirection", value); } private IEnumerator StartCoroutineFLAMINGO() { yield return (object)new WaitForSeconds(3f); TriggerRampage(2000); } [ClientRpc] public void StartCallAlphaClientRpc(int x) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3896637521u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, x); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3896637521u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((MonoBehaviour)this).StopCoroutine(startCo); Scp1507Alpha[] array = Object.FindObjectsOfType<Scp1507Alpha>(); foreach (Scp1507Alpha scp1507Alpha in array) { if (scp1507Alpha.alphaId == x) { alpha = scp1507Alpha; alphaId = x; isAlphaAlive = true; break; } } } private void LateUpdate() { //IL_0096: 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_004d: 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) if (isAlphaAlive) { if (alpha.LocalAnger >= 7) { if ((Object)(object)Scp1507TargetPlayer != (Object)null) { lookAt.position = Scp1507TargetPlayer.playerEye.position; } else { lookAt.position = defaultLookAt.position; } } else { lookAt.position = defaultLookAt.position; } } else if ((Object)(object)((EnemyAI)this).GetClosestPlayer(false, false, false) != (Object)null) { lookAt.position = ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position; } attackCooldown += Time.deltaTime; } public override void DoAIInterval() { //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); switch (base.currentBehaviourStateIndex) { case 0: base.agent.isStopped = true; base.agent.speed = 5f; base.agent.ResetPath(); break; case 1: base.agent.isStopped = false; Scp1507TargetPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); base.agent.speed = 5f; if (base.creatureAnimator.GetBool("Dancing")) { PlayAnimationClientRpc("Dancing", value: false); } if (!((Object)(object)Scp1507TargetPlayer != (Object)null)) { break; } if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) > 10f) { base.agent.SetDestination(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)alpha).transform.position, 10f, default(NavMeshHit))); base.agent.speed = 10f; } else if ((Object)(object)Scp1507TargetPlayer != (Object)null) { base.agent.SetDestination(((Component)Scp1507TargetPlayer).transform.position); if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) < 1.2f && attackCooldown >= 1f) { PlayAnimationClientRpc("Attack"); } } break; case 2: base.agent.speed = 5f; Scp1507TargetPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if ((Object)(object)Scp1507TargetPlayer != (Object)null) { base.agent.SetDestination(((Component)Scp1507TargetPlayer).transform.position); if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) < 1.2f && attackCooldown >= 1f) { PlayAnimationClientRpc("Attack"); } } else { base.agent.ResetPath(); } break; default: MonsterLogger("WRONG BEHAVIOUR STATE INDEX!", reportable: true); break; case 3: break; } } public void StopMoving(int flamingoId) { if (flamingoId == alphaId) { PlayAnimationClientRpc("Walking", value: false); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } public void TriggerAlphaCharge(int flamingoId) { if (flamingoId == alphaId) { PlayAnimationClientRpc("Walking", value: true); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } public void TriggerRampage(int flamingoId) { if (flamingoId == alphaId || flamingoId == 2000) { PlayAnimationClientRpc("Walking", value: true); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } } private bool CheckIfPlayerDances() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; int num = 0; if (num < allPlayerScripts.Length) { PlayerControllerB val = allPlayerScripts[num]; if (!(Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 10f) && val.performingEmote) { return true; } } return false; } [ClientRpc] public void PlayAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(783826533u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 783826533u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void PlayAnimationClientRpc(string animationName, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3605508353u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3605508353u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetBool(animationName, value); } } public void StartDance() { PlayAnimationClientRpc("Dancing", value: true); } public void StopDance() { PlayAnimationClientRpc("Dancing", value: false); } private void MonsterLogger(string message, bool reportable = false) { if (!reportable) { Plugin.Logger.LogInfo((object)("[ProjectSCP.SCP1507][SCP1507Instance][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } else { Plugin.Logger.LogError((object)("[ProjectSCP.SCP1507][SCP1507Instance][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if ((Object)(object)playerWhoHit != (Object)null && isAlphaAlive) { alpha.LocalAnger += 5; try { alpha.GiveServerAngerServerRpc(playerWhoHit.actualClientId, alpha.LocalAnger); } catch (InvalidOperationException) { MonsterLogger("Small error on calling!"); throw; } } if (base.isEnemyDead) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { global::SCP1507.FlamingoManager.FlamingoManager.Instance.UnregisterScp1507Instance(this); } } } [ClientRpc] public void SwingAttackHitClientRpc() { //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_00c3: 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_00d3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2851027910u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2851027910u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } int num = 8; Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val3 in array2) { PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false); if ((Object)(object)val4 != (Object)null) { base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]); MonsterLogger(val4.health.ToString()); KillCoroutine = ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(val4)); } } } attackCooldown = attackCooldownBeheader; } private IEnumerator DamagePlayerCoroutine(PlayerControllerB playerControllerB) { yield return (object)new WaitForSeconds(0.3f); ((MonoBehaviour)this).StopCoroutine(KillCoroutine); playerControllerB.DamagePlayer(damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } protected override void __initializeVariables() { if (_playerNetVar == null) { throw new Exception("Scp1507._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Scp1507() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(4184319842u, new RpcReceiveHandler(__rpc_handler_4184319842)); NetworkManager.__rpc_func_table.Add(3896637521u, new RpcReceiveHandler(__rpc_handler_3896637521)); NetworkManager.__rpc_func_table.Add(783826533u, new RpcReceiveHandler(__rpc_handler_783826533)); NetworkManager.__rpc_func_table.Add(3605508353u, new RpcReceiveHandler(__rpc_handler_3605508353)); NetworkManager.__rpc_func_table.Add(2851027910u, new RpcReceiveHandler(__rpc_handler_2851027910)); } private static void __rpc_handler_4184319842(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_0060: 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) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable)); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507)(object)target).BashDoorClientRpc(netObjRef, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3896637521(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 x = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref x); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507)(object)target).StartCallAlphaClientRpc(x); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_783826533(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507)(object)target).PlayAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3605508353(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507)(object)target).PlayAnimationClientRpc(animationName, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2851027910(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)2; ((Scp1507)(object)target).SwingAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Scp1507"; } } public class HatHandler : MonoBehaviour { public List<GameObject> allHats; private void Awake() { if (Plugin.FlamingoConfig.CUSTOM_HAT.Value) { int @int = RandomNumberGenerator.GetInt32(allHats.Count); allHats[@int].SetActive(true); allHats.RemoveAt(@int); } foreach (GameObject allHat in allHats) { Object.Destroy((Object)(object)allHat); } } } public enum State { Unmoving, AlphaCharge, Rampage, None } } namespace SCP1507.Patches { [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("GrabServerRpc")] [HarmonyPostfix] private static void PostFix(GrabbableObject __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"WE DID GRAB ITEM!"); if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { global::SCP1507.FlamingoManager.FlamingoManager.Instance.PickupItemTrigger(__instance.playerHeldBy, ((Component)__instance).transform.position); } } } [HarmonyPatch(typeof(NoisemakerProp))] internal class NoiseItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] private static bool PreFix(NoisemakerProp __instance, bool used, bool buttonDown = true) { if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { Debug.Log((object)"Activated!"); if (((Object)__instance).name == "Airhorn(Clone)") { Debug.Log((object)"It's an Airhorn!"); global::SCP1507.FlamingoManager.FlamingoManager.Instance.AirHornCheck(((GrabbableObject)__instance).playerHeldBy); } if (((Object)__instance).name == "Clownhorn(Clone)") { Debug.Log((object)"It's a clown Horn"); global::SCP1507.FlamingoManager.FlamingoManager.Instance.ClownHornCheck(((GrabbableObject)__instance).playerHeldBy); } } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("StartPerformingEmoteServerRpc")] [HarmonyPostfix] private static void PostFixStart(PlayerControllerB __instance) { if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { global::SCP1507.FlamingoManager.FlamingoManager.Instance.StartEmoting(__instance); } } [HarmonyPatch("StopPerformingEmoteServerRpc")] [HarmonyPostfix] private static void PostFixStop(PlayerControllerB __instance) { if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { global::SCP1507.FlamingoManager.FlamingoManager.Instance.StopEmoting(__instance); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("UnloadSceneObjectsEarly")] [HarmonyPostfix] private static void PostFixStart(RoundManager __instance) { if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null) { global::SCP1507.FlamingoManager.FlamingoManager.Instance.DestroyManagerClientRpc(); } } } } namespace SCP1507.FlamingoManager { public class FlamingoManager : MonoBehaviour { private static FlamingoManager _instance; private List<Scp1507> allFlamingo; private List<EmoteTime> playersDoingEmotes; private int honksDone; public static FlamingoManager Instance => _instance; private void Awake() { allFlamingo = new List<Scp1507>(); playersDoingEmotes = new List<EmoteTime>(); if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; ((MonoBehaviour)this).InvokeRepeating("CheckIfSeen", 2f, 7f); ((MonoBehaviour)this).InvokeRepeating("Emotehandles", 5f, 1f); ((MonoBehaviour)this).InvokeRepeating("HonkManager", 5f, 6f); } public void RegisterScp1507Instance(Scp1507 instance) { allFlamingo.Add(instance); } public void UnregisterScp1507Instance(Scp1507 instance) { foreach (Scp1507 item in allFlamingo) { if ((Object)(object)item == (Object)(object)instance) { allFlamingo.Remove(instance); break; } } } public void AirHornCheck(PlayerControllerB playerHeldBy) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) foreach (Scp1507 item in allFlamingo) { float num = Vector3.Distance(((Component)playerHeldBy).transform.position, ((Component)item).transform.position); if (num <= 5f) { item.alpha.LocalAnger++; item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger); break; } } } public void ClownHornCheck(PlayerControllerB playerHeldBy) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) foreach (Scp1507 item in allFlamingo) { float num = Vector3.Distance(((Component)playerHeldBy).transform.position, ((Component)item).transform.position); if (num <= 5f) { item.alpha.LocalAnger--; item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger); break; } } } public void PickupItemTrigger(PlayerControllerB playerHeldBy, Vector3 positionOfPickup) { //IL_0016: 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) foreach (Scp1507 item in allFlamingo) { float num = Vector3.Distance(positionOfPickup, ((Component)item).transform.position); if (num <= 5f) { item.alpha.LocalAnger += 2; item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger); break; } } } public void CheckIfSeen() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] array = RoundManager.Instance.playersManager.allPlayerScripts.Where((PlayerControllerB player) => !player.isPlayerDead && player.isPlayerControlled && player.isInsideFactory).ToArray(); if (array.Length == 0) { return; } PlayerControllerB val = array[RandomNumberGenerator.GetInt32(array.Length)]; foreach (Scp1507 item in allFlamingo) { if ((Object)(object)item == (Object)null || !val.HasLineOfSightToPosition(((Component)item).transform.position, 45f, 60, -1f) || !((Object)(object)item.alpha != (Object)null)) { continue; } item.alpha.LocalAnger += 2; GrabbableObject[] itemSlots = val.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { if ((Object)(object)val2 == (Object)null) { continue; } MonsterLogger("1 DONE"); if (val2.isHeld) { MonsterLogger("2 DONE"); if ((Object)(object)((Component)val2).gameObject.GetComponent<Shovel>() != (Object)null) { MonsterLogger("Holding shovel!"); item.alpha.LocalAnger += 3; break; } if ((Object)(object)((Component)val2).gameObject.GetComponent<KnifeItem>() != (Object)null) { item.alpha.LocalAnger += 3; break; } if ((Object)(object)((Component)val2).gameObject.GetComponent<ShotgunItem>() != (Object)null) { item.alpha.LocalAnger += 7; break; } } } item.alpha.GiveServerAngerServerRpc(val.actualClientId, item.alpha.LocalAnger); break; } } public void Emotehandles() { foreach (EmoteTime playersDoingEmote in playersDoingEmotes) { playersDoingEmote.TimeEmoting++; if (allFlamingo != null) { switch (playersDoingEmote.TimeEmoting) { case 10: allFlamingo[0].alpha.LocalAnger--; allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger); break; case 20: allFlamingo[0].alpha.LocalAnger -= 2; allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger); break; case 30: allFlamingo[0].alpha.LocalAnger -= 3; allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger); break; case 40: allFlamingo[0].alpha.LocalAnger -= 4; allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger); break; } } } } public void StartEmoting(PlayerControllerB actualPlayer) { //IL_002b: 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) PlayerControllerB actualPlayer2 = actualPlayer; bool flag = false; try { foreach (Scp1507 item in allFlamingo) { try { if (Vector3.Distance(((Component)item).transform.position, ((Component)actualPlayer2).transform.position) < 6f) { item.StartDance(); flag = true; } } catch (NullReferenceException) { UnregisterScp1507Instance(item); } } } catch (InvalidOperationException) { } if (flag && playersDoingEmotes.FirstOrDefault((EmoteTime e) => e.ClientId == actualPlayer2.actualClientId) == null) { playersDoingEmotes.Add(new EmoteTime(actualPlayer2.actualClientId)); } } public void HonkManager() { if (allFlamingo.Count != 0) { int num = allFlamingo.Count / 3; num++; ((MonoBehaviour)this).StartCoroutine(HonkForTimes(num)); } } private IEnumerator HonkForTimes(int numberOfHonks) { for (honksDone = 0; honksDone < numberOfHonks; honksDone++) { allFlamingo[RandomNumberGenerator.GetInt32(allFlamingo.Count)].DoQuackSound(); yield return (object)new WaitForSeconds(RandomFloatBetween(0.1f, 1f)); } } public void StopEmoting(PlayerControllerB actualPlayer) { //IL_0034: 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) PlayerControllerB actualPlayer2 = actualPlayer; bool flag = false; foreach (Scp1507 item in allFlamingo) { if (!((Object)(object)item == (Object)null) && Vector3.Distance(((Component)item).transform.position, ((Component)actualPlayer2).transform.position) < 6f) { item.StopDance(); flag = true; } } if (flag) { playersDoingEmotes.Remove(playersDoingEmotes.FirstOrDefault((EmoteTime e) => e.ClientId == actualPlayer2.actualClientId)); } } public static float RandomFloatBetween(float min, float max) { Random random = new Random(); double num = max - min; double num2 = random.NextDouble(); double num3 = num2 * num + (double)min; return (float)num3; } [ClientRpc] public void DestroyManagerClientRpc() { Object.Destroy((Object)(object)((Component)this).gameObject); } private void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).CancelInvoke("CheckIfSeen"); ((MonoBehaviour)this).CancelInvoke("Emotehandles"); ((MonoBehaviour)this).CancelInvoke("HonkManager"); } private void MonsterLogger(string message, bool reportable = false) { if (!reportable) { Plugin.Logger.Log((LogLevel)16, (object)("[ProjectSCP.SCP1507][SCP1507Manager][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } else { Plugin.Logger.Log((LogLevel)2, (object)("[ProjectSCP.SCP1507][SCP1507Manager][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } } } } namespace SCP1507.DataClass { public class PlayerRecord { private PlayerControllerB playerControllerB; private ulong clientId; private int angerMeter; private bool angered; public PlayerControllerB PlayerControllerB => playerControllerB; public ulong ClientId => clientId; public bool Angered { get { if (!playerControllerB.isPlayerDead && playerControllerB.isInsideFactory) { return angered; } return false; } } public int AngerMeter { get { return angerMeter; } set { if (value <= 0) { angerMeter = 0; return; } if (value >= Plugin.FlamingoConfig.ANGER_FOR_ANGRY_FLAMINGO.Value) { angered = true; } angerMeter = value; } } public PlayerRecord(ulong clientId, int angerMeter) { this.clientId = clientId; this.angerMeter = angerMeter; if (this.angerMeter >= Plugin.FlamingoConfig.ANGER_FOR_ANGRY_FLAMINGO.Value) { angered = true; } PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == clientId) { playerControllerB = val; } } } } } namespace SCP1507.SCP1507Alpha { public class EmoteTime { private ulong clientId; private int timeEmoting; public int TimeEmoting { get { return timeEmoting; } set { timeEmoting = value; } } public ulong ClientId => clientId; public EmoteTime(ulong clientId) { this.clientId = clientId; timeEmoting = 0; } } public class Scp1507Alpha : EnemyAI { private List<DoorHold> currentBreakingDoors; [Header("Make anger")] public int alphaId; private int localAnger; public List<PlayerRecord> listOfAnger; [Header("NetStats")] private ulong localPlayerId; private PlayerControllerB localPlayer; [Header("Audio")] public AudioClip[] honks; public AudioClip[] attacks; public AudioSource walkingSource; [Header("FlamingoBasics")] private bool isSeen; [Header("Attack")] public int damage; public Transform AttackArea; public float attackCooldown; private float attackCooldownBeheader; [Header("Look")] public Transform lookAt; public Transform defaultLookAt; private Coroutine beingLookedAtCoroutine; private Coroutine KillCoroutine; private int numberOfFlamingos; [NonSerialized] private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public int LocalAnger { get { return localAnger; } set { localAnger = value; } } public PlayerControllerB Scp1507AlphaTargetPlayer { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value); } set { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)value == (Object)null) { _playerNetVar.Value = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)null); } else { _playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value); } } } private void DoAttackSound() { base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]); } private void DoQuackSound() { base.creatureVoice.PlayOneShot(honks[RandomNumberGenerator.GetInt32(honks.Length)]); } private IEnumerator QuackAlpha() { while (!base.isEnemyDead) { yield return (object)new WaitForSeconds(global::SCP1507.FlamingoManager.FlamingoManager.RandomFloatBetween(5f, 10f)); DoQuackSound(); } } public bool HitDoor(DoorLock door) { foreach (DoorHold currentBreakingDoor in currentBreakingDoors) { if ((Object)(object)door == (Object)(object)currentBreakingDoor.Door) { currentBreakingDoor.NumberOfHits++; if (currentBreakingDoor.CanBreak) { return true; } return false; } } currentBreakingDoors.Add(new DoorHold(door)); return false; } public void DeleteDoor(DoorLock door) { foreach (DoorHold currentBreakingDoor in currentBreakingDoors) { if ((Object)(object)door == (Object)(object)currentBreakingDoor.Door) { currentBreakingDoors.Remove(currentBreakingDoor); } } } public void SpawnNewFlamingo() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); list.AddRange(RoundManager.Instance.currentLevel.Enemies); SpawnableEnemyWithRarity val = list.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("scp1507")); GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 10f, default(NavMeshHit)), (float)Random.RandomRangeInt(0, 360), RoundManager.Instance.currentLevel.Enemies.IndexOf(val), val.enemyType)); val2.GetComponent<Scp1507>().StartCallAlphaClientRpc(alphaId); numberOfFlamingos++; if (RandomNumberGenerator.GetInt32(100) <= Plugin.FlamingoConfig.CHANCE_SPAWN_NEW_ALPHA.Value && Plugin.FlamingoConfig.CAN_SPAWN_ALPHA.Value) { SpawnNewAlphaFlamingo(); } } public void SpawnNewAlphaFlamingo() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); list.AddRange(RoundManager.Instance.currentLevel.Enemies); SpawnableEnemyWithRarity val = list.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("scp1507Alpha")); GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 10f, default(NavMeshHit)), (float)Random.RandomRangeInt(0, 360), RoundManager.Instance.currentLevel.Enemies.IndexOf(val), val.enemyType)); val2.GetComponent<Scp1507>().StartCallAlphaClientRpc(alphaId); } public void ActivateRampage() { ((MonoBehaviour)this).StartCoroutine(OrderRampage()); } private IEnumerator OrderRampage() { Scp1507[] array = Object.FindObjectsOfType<Scp1507>(); foreach (Scp1507 flamingo in array) { yield return (object)new WaitForSeconds(0.1f); flamingo.TriggerRampage(alphaId); } } public void StartCrusade() { MonsterLogger("Calling Crusade! "); Scp1507[] array = Object.FindObjectsOfType<Scp1507>(); foreach (Scp1507 scp in array) { ((MonoBehaviour)this).StartCoroutine(OrderCrusade()); } } private IEnumerator OrderCrusade() { Scp1507[] array = Object.FindObjectsOfType<Scp1507>(); foreach (Scp1507 flamingo in array) { yield return (object)new WaitForSeconds(0.1f); flamingo.TriggerAlphaCharge(alphaId); } } public void StopMoving() { Scp1507[] array = Object.FindObjectsOfType<Scp1507>(); foreach (Scp1507 scp in array) { ((MonoBehaviour)this).StartCoroutine(OrderStop()); } } private IEnumerator OrderStop() { Scp1507[] array = Object.FindObjectsOfType<Scp1507>(); foreach (Scp1507 flamingo in array) { yield return (object)new WaitForSeconds(0.1f); flamingo.StopMoving(alphaId); } } [ServerRpc(RequireOwnership = false)] public void GiveServerAngerServerRpc(ulong clientId, int anger) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1748763037u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); BytePacker.WriteValueBitPacked(val2, anger); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1748763037u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } try { PlayerRecord playerByClientId = GetPlayerByClientId(clientId); playerByClientId.AngerMeter = anger; MonsterLogger("Player is " + playerByClientId.AngerMeter); } catch (KeyNotFoundException value) { Console.WriteLine(value); listOfAnger.Add(new PlayerRecord(clientId, anger)); } } [ClientRpc] public void StartLookAtCoroutineClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(100667040u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 100667040u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && beingLookedAtCoroutine == null) { beingLookedAtCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckIfLookedCoroutine()); } } } [ClientRpc] public void PlayAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(81093682u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 81093682u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void PlayAnimationClientRpc(string animationName, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3413923772u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3413923772u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetBool(animationName, value); } } private void Awake() { numberOfFlamingos = 0; damage = Plugin.FlamingoConfig.DAMAGE_NORMAL.Value; alphaId = RandomNumberGenerator.GetInt32(1000); localAnger = 0; listOfAnger = new List<PlayerRecord>(); } public override void Start() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown ((EnemyAI)this).Start(); localPlayer = RoundManager.Instance.playersManager.localPlayerController; localPlayerId = localPlayer.playerClientId; StartAlphaSearch(); attackCooldownBeheader = attackCooldown; attackCooldown = 0f; PlayAnimationClientRpc("IsAlpha", value: true); if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance == (Object)null) { GameObject val = new GameObject("Scp1507Manager"); val.AddComponent<global::SCP1507.FlamingoManager.FlamingoManager>(); } } private void LateUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!base.isEnemyDead) { if ((Object)(object)Scp1507AlphaTargetPlayer != (Object)null) { lookAt.position = Scp1507AlphaTargetPlayer.playerEye.position; } else { lookAt.position = defaultLookAt.position; } } attackCooldown += Time.deltaTime; } public override void DoAIInterval() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); switch (base.currentBehaviourStateIndex) { case 0: base.agent.isStopped = true; PlayAnimationClientRpc("Walking", value: false); if (!CheckIfAPlayerHasVisionToCurrentPosition()) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } if (FindAlphaTarget()) { StartCrusade(); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } break; case 1: base.agent.isStopped = false; PlayAnimationClientRpc("Walking", value: true); if (CheckIfAPlayerHasVisionToCurrentPosition()) { ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } if (FindAlphaTarget()) { StartCrusade(); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } if (RandomNumberGenerator.GetInt32(100) <= Plugin.FlamingoConfig.CHANCE_SPAWN_NEW_FLAMINGO.Value && numberOfFlamingos <= Plugin.FlamingoConfig.MAXIMUM_NUMBER_OF_FLAMINGO.Value) { SpawnNewFlamingo(); } break; case 2: base.agent.isStopped = false; ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); PlayAnimationClientRpc("Walking", value: true); base.agent.SetDestination(((Component)Scp1507AlphaTargetPlayer).transform.position); if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507AlphaTargetPlayer).transform.position) < 1.2f && attackCooldown >= attackCooldownBeheader) { PlayAnimationClientRpc("Attack"); } if (!Scp1507AlphaTargetPlayer.isInsideFactory || Scp1507AlphaTargetPlayer.isPlayerDead) { base.agent.ResetPath(); StartAlphaSearch(); StopMoving(); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } break; default: MonsterLogger("WRONG BEHAVIOUR STATE INDEX!", reportable: true); break; } } private bool CheckIfPlayerDances() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; int num = 0; if (num < allPlayerScripts.Length) { PlayerControllerB val = allPlayerScripts[num]; if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 6f && val.performingEmote) { return true; } } return false; } private void StartAlphaSearch() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (base.searchCoroutine == null) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } } private bool FindAlphaTarget() { if (listOfAnger == null) { MonsterLogger("List of Anger is null", reportable: true); return false; } int num = 0; PlayerRecord playerRecord = null; foreach (PlayerRecord item in listOfAnger) { if (item == null) { MonsterLogger("Encounteed a null value Entry", reportable: true); } else if (item.Angered && num < item.AngerMeter) { num = item.AngerMeter; playerRecord = item; } } if (playerRecord == null) { return false; } Scp1507AlphaTargetPlayer = playerRecord.PlayerControllerB; return true; } private bool CheckIfAPlayerHasVisionToCurrentPosition() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { isSeen = true; return true; } } return false; } private bool CheckIfLocalPlayerHasVisionToCurrentPosition_ONEPLAYER() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (localPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { isSeen = true; return true; } return false; } private IEnumerator CheckIfLookedCoroutine() { int numberOfSecondsSeen = 0; while (true) { if (CheckIfLocalPlayerHasVisionToCurrentPosition_ONEPLAYER()) { numberOfSecondsSeen++; switch (numberOfSecondsSeen) { case 10: AddToAnger(1); break; case 20: AddToAnger(2); break; case 30: AddToAnger(3); break; case 40: AddToAnger(4); break; } yield return (object)new WaitForSeconds(1f); } else { numberOfSecondsSeen = 0; } } } public void AddToAnger(int x) { localAnger += x; GiveServerAngerServerRpc(localPlayerId, localAnger); } public void SetToAnger(int x) { localAnger = x; GiveServerAngerServerRpc(localPlayerId, localAnger); } public void RemoveToAnger(int x) { localAnger -= x; GiveServerAngerServerRpc(localPlayerId, localAnger); } private PlayerRecord? GetPlayerByClientId(ulong clientId) { for (int i = 0; i < listOfAnger.Count; i++) { if (listOfAnger[i].ClientId == clientId) { return listOfAnger[i]; } } throw new KeyNotFoundException("Player with the given ClientId was not found. CREATING NEW PROFILE"); } private void MonsterLogger(string message, bool reportable = false) { if (!reportable) { Plugin.Logger.Log((LogLevel)16, (object)("[ProjectSCP.SCP1507][SCP1507Alpha][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } else { Plugin.Logger.Log((LogLevel)2, (object)("[ProjectSCP.SCP1507][SCP1507Alpha][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message)); } } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if ((Object)(object)playerWhoHit != (Object)null) { GiveServerAngerServerRpc(playerWhoHit.actualClientId, 20); } if (base.isEnemyDead) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { if (base.searchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); } ((EnemyAI)this).KillEnemyOnOwnerClient(false); ActivateRampage(); } } [ClientRpc] public void SwingAttackHitClientRpc() { //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_00c3: 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_00d3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4249217996u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4249217996u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } int num = 8; Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val3 in array2) { PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false); if ((Object)(object)val4 != (Object)null) { DoAttackSound(); KillCoroutine = ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(val4)); } } } attackCooldown = 0f; } private IEnumerator DamagePlayerCoroutine(PlayerControllerB playerControllerB) { yield return (object)new WaitForSeconds(0.1f); playerControllerB.DamagePlayer(damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); ((MonoBehaviour)this).StopCoroutine(KillCoroutine); } protected override void __initializeVariables() { if (_playerNetVar == null) { throw new Exception("Scp1507Alpha._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Scp1507Alpha() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1748763037u, new RpcReceiveHandler(__rpc_handler_1748763037)); NetworkManager.__rpc_func_table.Add(100667040u, new RpcReceiveHandler(__rpc_handler_100667040)); NetworkManager.__rpc_func_table.Add(81093682u, new RpcReceiveHandler(__rpc_handler_81093682)); NetworkManager.__rpc_func_table.Add(3413923772u, new RpcReceiveHandler(__rpc_handler_3413923772)); NetworkManager.__rpc_func_table.Add(4249217996u, new RpcReceiveHandler(__rpc_handler_4249217996)); } private static void __rpc_handler_1748763037(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); int anger = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref anger); target.__rpc_exec_stage = (__RpcExecStage)1; ((Scp1507Alpha)(object)target).GiveServerAngerServerRpc(clientId, anger); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_100667040(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)2; ((Scp1507Alpha)(object)target).StartLookAtCoroutineClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_81093682(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507Alpha)(object)target).PlayAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3413923772(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp1507Alpha)(object)target).PlayAnimationClientRpc(animationName, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4249217996(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)2; ((Scp1507Alpha)(object)target).SwingAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Scp1507Alpha"; } } public class DoorHold { private DoorLock door; private int numberOfHits; private bool canBreak; public DoorLock Door => door; public bool CanBreak => canBreak; public int NumberOfHits { get { return numberOfHits; } set { numberOfHits = value; if (numberOfHits >= 10) { canBreak = true; } } } public DoorHold(DoorLock door) { this.door = door; numberOfHits = 1; } } public enum StateA { Seen, Walking, Targeting } } namespace SCP1507.Configurations { [Serializable] public class Config : SyncedInstance<Config> { public ConfigEntry<int> MAXIMUM_NUMBER_OF_FLAMINGO { get; private set; } public ConfigEntry<bool> CAN_SPAWN_ALPHA { get; private set; } public ConfigEntry<int> CHANCE_SPAWN_NEW_FLAMINGO { get; private set; } public ConfigEntry<int> RARITY_ALPHA { get; private set; } public ConfigEntry<int> CHANCE_SPAWN_NEW_ALPHA { get; private set; } public ConfigEntry<int> DAMAGE_ALPHA { get; private set; } public ConfigEntry<int> DAMAGE_NORMAL { get; private set; } public ConfigEntry<int> ANGER_FOR_ANGRY_FLAMINGO { get; private set; } public ConfigEntry<bool> CUSTOM_HAT { get; private set; } public Config(ConfigFile cfg) { InitInstance(this); MAXIMUM_NUMBER_OF_FLAMINGO = cfg.Bind<int>("Flamingo Spawn", "Maximum number of flamingo!", 30, "This value defines the number of flamingo there can be on the map. It does not take alpha's into account"); CAN_SPAWN_ALPHA = cfg.Bind<bool>("Flamingo Spawn", "Can alpha spawn alpha?", false, "Enabling this option will make alpha able to spawn other alpha's. This can go out of hand quickly"); CHANCE_SPAWN_NEW_FLAMINGO = cfg.Bind<int>("Flamingo Spawn", "Spawn speed flamingo", 4, "Every 0.2 seconds, the alpha will generate a number between 0 and 100. If the number generated is lower than the value specified, he will spawn a new flamingo. The higher this value the more likely a flamingo will spawn. Do not"); RARITY_ALPHA = cfg.Bind<int>("Flamingo Spawn", "Rarity alpha flamingo", 40, "This is the rarity for an alpha flamingo to spawn direcly registered into the game"); CHANCE_SPAWN_NEW_ALPHA = cfg.Bind<int>("Flamingo Spawn", "Chances to spawn a new alpha by alpha", 10, "Whenever a flamingo is summoned this is the chance for it to summon an additional alpha flamingo. See Spawn speed flamingo for how this value works."); DAMAGE_ALPHA = cfg.Bind<int>("Stats", "Chances to spawn alpha", 20, "What are the chance for an alpha to spawn when spawning a new flamingo"); DAMAGE_NORMAL = cfg.Bind<int>("Stats", "Chances to spawn alpha", 5, "This is the amount of raw damage dealt by flamingo"); ANGER_FOR_ANGRY_FLAMINGO = cfg.Bind<int>("Anger", "Anger before flamingos are angry", 10, "This is the amount of anger before the flamingo's are angry"); CUSTOM_HAT = cfg.Bind<bool>("Cosmetics", "Can flamingos have custom hat?", true, "True = yes, false = no"); } public static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("Xilef992SCP1507_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0047: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("Xilef992SCP1507_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } } public static class ConfigurationsPatch { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_005d: 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_0068: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (((NetworkBehaviour)RoundManager.Instance).IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = Config.OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("SCP1507_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = Config.OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("SCP1507_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); Config.RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Debug.Log((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Debug.Log((object)$"Error deserializing instance: {arg}"); return default(T); } } } } namespace ProjectSCP.SCP1507.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/ProjectSCP.SCP966.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalBestiary.Modules; using Microsoft.CodeAnalysis; using ProjectSCP.SCP966.NetcodePatcher; using SCP1507.Configurations; using SCP966; using SCP966.Ai; using SCP966.SCP966Manager; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [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("ProjectSCP.SCP966")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.5.0")] [assembly: AssemblyInformationalVersion("1.1.5+b10a46636fee521e5f4cc924426ebc00abb0be54")] [assembly: AssemblyProduct("SCP966")] [assembly: AssemblyTitle("ProjectSCP.SCP966")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkBehaviourReference>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkBehaviourReference>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(HUDManager))] internal class ScanPatch { [HarmonyPatch("PingScan_performed")] [HarmonyPostfix] private static void PostFix(CallbackContext context) { if ((Object)(object)Scp966Manager.Instance != (Object)null) { Scp966Manager.Instance.StartScanOnAllInstances(); } } } namespace SCP1507.Configurations { [Serializable] public class Config : SyncedInstance<Config> { public ConfigEntry<float> TIME_YOU_SEE_MONSTER { get; private set; } public ConfigEntry<int> RARITY { get; private set; } public Config(ConfigFile cfg) { InitInstance(this); TIME_YOU_SEE_MONSTER = cfg.Bind<float>("Visibility", "Time you see the monster", 0.2f, "The amount of time you will see SCP 966 upon scan. It should not be higher than 1.2"); RARITY = cfg.Bind<int>("Spawning", "Rarity", 30, "The rarity of SCp 966 on all the moons"); } public static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("Xilef992SCP966_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0047: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("Xilef992SCP966_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } } public static class ConfigurationsPatch { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_005d: 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_0068: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (((NetworkBehaviour)RoundManager.Instance).IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = Config.OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("SCP966_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = Config.OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("SCP966_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); Config.RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Debug.Log((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Debug.Log((object)$"Error deserializing instance: {arg}"); return default(T); } } } } namespace SCP966 { [BepInPlugin("ProjectSCP.SCP966", "SCP966", "1.1.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? ModAssets; private readonly Harmony harmony = new Harmony("ProjectSCP.SCP966"); public static Config Config { get; internal set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); string path = "scp966modassets"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path)); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } EnemyType val = ModAssets.LoadAsset<EnemyType>("SCP966Enemy"); TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SCP966TN"); TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SCP966TK"); Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)4, 40 }, { (LevelTypes)(-1), Config.RARITY.Value }, { (LevelTypes)1024, 20 } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, dictionary, dictionary2, val2, val3); harmony.PatchAll(typeof(ConfigurationsPatch)); harmony.PatchAll(typeof(ScanPatch)); Logger.LogInfo((object)"Plugin ProjectSCP.SCP966 is loaded!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "ProjectSCP.SCP966"; public const string PLUGIN_NAME = "SCP966"; public const string PLUGIN_VERSION = "1.1.5"; } } namespace SCP966.SCP966Manager { public class Scp966Manager : MonoBehaviour { private static Scp966Manager _instance; private List<Scp966> _allScp966Instances = new List<Scp966>(); public static Scp966Manager Instance => _instance; private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { _instance = this; } } public void RegisterScp966Instance(Scp966 instance) { _allScp966Instances.Add(instance); } public void UnregisterScp966Instance(Scp966 instance) { _allScp966Instances.Remove(instance); } public void StartScanOnAllInstances() { foreach (Scp966 allScp966Instance in _allScp966Instances) { allScp966Instance.StartScanCoroutine(); } } } } namespace SCP966.Ai { public class AnimatorCallIn : MonoBehaviour { public Scp966 scpScript; public void Attack() { scpScript.SwingAttackHitClientRpc(); } } public class Scp966 : EnemyAI { public SkinnedMeshRenderer mesh; public Transform lookAt; public Transform defaultLookAt; public Transform AttackArea; [Header("Damage Attacks")] public int firstAttack; public int secondAttack; public int thirdAttack; private int currentDamage; public float attackCooldown; private float attackCooldownBeheader; private float? previousNightVisionValue; [Header("Audio")] public AudioClip[] echoes; public AudioClip[] idles; private Coroutine passiveSound; private float waitTimer; private bool justStopedMoving = true; private bool weightModifiedLocal; private bool gettingScanned; private bool canScan = true; private Coroutine killCoroutine; [NonSerialized] private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool noRegen; private float previousStamina; [NonSerialized] public bool isVisibleForLocalPlayer; private PlayerControllerB localPlayer; private GameObject foundNightVision; private Transform batteryTransform; private Transform barTransform; public PlayerControllerB Scp966TargetPlayer { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value); } set { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)value == (Object)null) { _playerNetVar.Value = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)null); } else { _playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value); } } } public override void Start() { //IL_0022: 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_006b: Expected O, but got Unknown ((EnemyAI)this).Start(); localPlayer = RoundManager.Instance.playersManager.localPlayerController; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); attackCooldownBeheader = attackCooldown; if (((NetworkBehaviour)this).IsHost) { passiveSound = ((MonoBehaviour)this).StartCoroutine(IdlePlay()); } if ((Object)(object)Scp966Manager.Instance == (Object)null) { GameObject val = new GameObject("Scp966Manager"); val.AddComponent<Scp966Manager>(); } Scp966Manager.Instance.RegisterScp966Instance(this); } private void LateUpdate() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) CheckIfLocalPlayerHasNightVision(); if ((Object)(object)Scp966TargetPlayer != (Object)null) { lookAt.position = Scp966TargetPlayer.playerEye.position; } else { lookAt.position = defaultLookAt.position; } attackCooldown -= Time.deltaTime; if (noRegen) { if (localPlayer.sprintMeter > previousStamina) { localPlayer.sprintMeter = previousStamina; } else { previousStamina = localPlayer.sprintMeter; } } else { previousStamina = localPlayer.sprintMeter; } } public override void DoAIInterval() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); switch (base.currentBehaviourStateIndex) { case 0: { DoAnimationClientRpc("Walking", value: true); base.agent.autoBraking = true; base.agent.speed = 5f; base.agent.stoppingDistance = 1f; PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(45f, 60, 3); if ((Object)(object)val != (Object)null) { ((EnemyAI)this).StopSearch(base.currentSearch, true); Scp966TargetPlayer = val; ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; } case 1: base.agent.stoppingDistance = 8f; base.agent.speed = 5f; base.agent.autoBraking = true; if (!Scp966TargetPlayer.isInsideFactory || Scp966TargetPlayer.isPlayerDead || Vector3.Distance(((Component)this).transform.position, ((Component)Scp966TargetPlayer).transform.position) > 25f) { base.agent.ResetPath(); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 0f); Scp966TargetPlayer = null; break; } ((EnemyAI)this).SetDestinationToPosition(((Component)Scp966TargetPlayer).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp966TargetPlayer).transform.position) < base.agent.stoppingDistance) { DoAnimationClientRpc("Walking", value: false); if (justStopedMoving) { switch (RandomNumberGenerator.GetInt32(3)) { case 0: MonsterLogger("WE ARE doing nothing"); break; case 1: MonsterLogger("WE ARE SCREAMING"); DoAnimationClientRpc("Scream"); PlayScreamClientRpc(RandomNumberGenerator.GetInt32(echoes.Length)); break; case 2: MonsterLogger("Staring"); DoAnimationClientRpc("Stare"); break; } } justStopedMoving = false; } else { justStopedMoving = true; DoAnimationClientRpc("Walking", value: true); } if (!Scp966TargetPlayer.isPlayerDead) { SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 1f); CheckIfTargetHasLowStamClientRpc(Scp966TargetPlayer.playerClientId); } break; case 2: base.agent.stoppingDistance = 0f; base.agent.speed = 5f; base.agent.acceleration = 12f; base.agent.autoBraking = false; DoAnimationClientRpc("Walking", value: true); if (!Scp966TargetPlayer.isInsideFactory || Scp966TargetPlayer.isPlayerDead || Vector3.Distance(((Component)this).transform.position, ((Component)Scp966TargetPlayer).transform.position) > 25f) { base.agent.ResetPath(); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 0f); break; } ((EnemyAI)this).SetDestinationToPosition(((Component)Scp966TargetPlayer).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp966TargetPlayer).transform.position) < 1.2f && attackCooldown <= 0.27f) { DoAnimationClientRpc("Attack"); switch (base.creatureAnimator.GetInteger("AttackNumber")) { case 0: SetCurrentDamageClientRpc(firstAttack, 1); break; case 1: SetCurrentDamageClientRpc(secondAttack, 2); break; case 2: SetCurrentDamageClientRpc(thirdAttack, 0); break; default: MonsterLogger("We are outside of possible attack array!", pleaseReport: true); break; } } if (!Scp966TargetPlayer.isPlayerDead) { SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 1f); CheckIfTargetHasLowStamClientRpc(Scp966TargetPlayer.playerClientId); } break; default: MonsterLogger("Behaviour State was changed to an non real one", pleaseReport: true); break; } } private void EnableMesh() { isVisibleForLocalPlayer = true; if ((Object)(object)mesh == (Object)null) { mesh = ((Component)this).GetComponent<SkinnedMeshRenderer>(); } ((Renderer)mesh).enabled = true; } private void DisableMesh() { isVisibleForLocalPlayer = false; if ((Object)(object)mesh == (Object)null) { mesh = ((Component)this).GetComponent<SkinnedMeshRenderer>(); } ((Renderer)mesh).enabled = false; } private void CheckIfLocalPlayerHasNightVision() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (gettingScanned) { return; } if ((Object)(object)foundNightVision == (Object)null) { foundNightVision = GameObject.Find("nightVision(Clone)"); if ((Object)(object)foundNightVision != (Object)null) { batteryTransform = foundNightVision.transform.Find("Battery"); if ((Object)(object)batteryTransform != (Object)null) { barTransform = batteryTransform.Find("Bar"); } } } if ((Object)(object)foundNightVision != (Object)null && (Object)(object)batteryTransform != (Object)null && (Object)(object)barTransform != (Object)null) { GameObject gameObject = ((Component)batteryTransform).gameObject; if (gameObject.activeSelf) { float x = barTransform.localScale.x; if (previousNightVisionValue.HasValue) { if (x < previousNightVisionValue.Value) { EnableMesh(); } else { DisableMesh(); } previousNightVisionValue = x; } else { MonsterLogger("There was no value for previousNightVisionValue"); previousNightVisionValue = x; } } else { DisableMesh(); } } else { DisableMesh(); } } public void StartScanCoroutine() { if (canScan) { canScan = false; gettingScanned = true; ((MonoBehaviour)this).StartCoroutine(ScanCoroutine()); } } private IEnumerator ScanCoroutine() { EnableMesh(); yield return (object)new WaitForSeconds(0f + Plugin.Config.TIME_YOU_SEE_MONSTER.Value); DisableMesh(); gettingScanned = false; yield return (object)new WaitForSeconds(1.2f - Plugin.Config.TIME_YOU_SEE_MONSTER.Value); canScan = true; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); SendIfTargetHasLowStamServerRpc(); if (base.isEnemyDead) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { if (base.searchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); } ((EnemyAI)this).KillEnemyOnOwnerClient(false); ((MonoBehaviour)this).StopCoroutine(passiveSound); SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 0f); } } private IEnumerator IdlePlay() { while (!base.isEnemyDead) { yield return (object)new WaitForSeconds(waitTimer); PlayOnShotIdleClientRpc(RandomNumberGenerator.GetInt32(idles.Length)); waitTimer = 5 + RandomNumberGenerator.GetInt32(20); } } [ClientRpc] public void PlayOnShotIdleClientRpc(int x) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(594416341u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, x); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 594416341u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureVoice.PlayOneShot(idles[x]); } } } [ClientRpc] public void SwingAttackHitClientRpc() { //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_00c3: 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_00d3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3731458306u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3731458306u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } int num = 8; Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num); if (array.Length != 0) { Collider[] array2 = array; foreach (Collider val3 in array2) { PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false); if ((Object)(object)val4 != (Object)null) { base.creatureSFX.Play(); MonsterLogger(val4.health.ToString()); killCoroutine = ((MonoBehaviour)this).StartCoroutine(killPlayer(val4)); } } } attackCooldown = attackCooldownBeheader; } private IEnumerator killPlayer(PlayerControllerB playerControllerB) { yield return (object)new WaitForSeconds(0.3f); ((MonoBehaviour)this).StopCoroutine(killCoroutine); playerControllerB.DamagePlayer(currentDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (playerControllerB.health <= currentDamage) { SetWeightPlayerClientRpc(Scp966TargetPlayer.playerClientId, 0f); } } [ClientRpc] public void PlayScreamClientRpc(int x) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1177901251u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, x); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1177901251u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureVoice.PlayOneShot(echoes[x]); } } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2020107260u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2020107260u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void DoAnimationClientRpc(string animationName, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1148248770u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1148248770u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.creatureAnimator.SetBool(animationName, value); } } [ClientRpc] public void SetCurrentDamageClientRpc(int x, int animation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(388176069u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, x); BytePacker.WriteValueBitPacked(val2, animation); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 388176069u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { currentDamage = x; base.creatureAnimator.SetInteger("AttackNumber", animation); } } } [ClientRpc] public void SetWeightPlayerClientRpc(ulong clientId, float weight) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3591909219u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref weight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3591909219u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && RoundManager.Instance.playersManager.localPlayerController.playerClientId == clientId) { if (weight == 0f) { noRegen = false; } else if (weight == 1f) { noRegen = true; } } } [ClientRpc] public void CheckIfTargetHasLowStamClientRpc(ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2762657010u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2762657010u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)RoundManager.Instance.playersManager.localPlayerController == (Object)(object)Scp966TargetPlayer && Scp966TargetPlayer.sprintMeter <= 0.3f) { SendIfTargetHasLowStamServerRpc(); } } } [ServerRpc(RequireOwnership = false)] public void SendIfTargetHasLowStamServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2218761627u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2218761627u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } } } private void MonsterLogger(string x, bool pleaseReport = false) { Plugin.Logger.LogInfo((object)("[SCP966SleepKiller][SCP966 - AI CLASS][" + (pleaseReport ? "This Error should be reported with the context of the error" : "NO NEED REPORT") + "] :: " + x)); } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); Scp966Manager.Instance.UnregisterScp966Instance(this); } protected override void __initializeVariables() { if (_playerNetVar == null) { throw new Exception("Scp966._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Scp966() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(594416341u, new RpcReceiveHandler(__rpc_handler_594416341)); NetworkManager.__rpc_func_table.Add(3731458306u, new RpcReceiveHandler(__rpc_handler_3731458306)); NetworkManager.__rpc_func_table.Add(1177901251u, new RpcReceiveHandler(__rpc_handler_1177901251)); NetworkManager.__rpc_func_table.Add(2020107260u, new RpcReceiveHandler(__rpc_handler_2020107260)); NetworkManager.__rpc_func_table.Add(1148248770u, new RpcReceiveHandler(__rpc_handler_1148248770)); NetworkManager.__rpc_func_table.Add(388176069u, new RpcReceiveHandler(__rpc_handler_388176069)); NetworkManager.__rpc_func_table.Add(3591909219u, new RpcReceiveHandler(__rpc_handler_3591909219)); NetworkManager.__rpc_func_table.Add(2762657010u, new RpcReceiveHandler(__rpc_handler_2762657010)); NetworkManager.__rpc_func_table.Add(2218761627u, new RpcReceiveHandler(__rpc_handler_2218761627)); } private static void __rpc_handler_594416341(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 x = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref x); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).PlayOnShotIdleClientRpc(x); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3731458306(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)2; ((Scp966)(object)target).SwingAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1177901251(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 x = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref x); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).PlayScreamClientRpc(x); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2020107260(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1148248770(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).DoAnimationClientRpc(animationName, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_388176069(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int x = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref x); int animation = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref animation); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).SetCurrentDamageClientRpc(x, animation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3591909219(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); float weight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref weight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).SetWeightPlayerClientRpc(clientId, weight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2762657010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((Scp966)(object)target).CheckIfTargetHasLowStamClientRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2218761627(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; ((Scp966)(object)target).SendIfTargetHasLowStamServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Scp966"; } } public enum State { Searching, Tiering, Chasing } } namespace ProjectSCP.SCP966.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/Roller.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Roller; using RollerEnemy; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("Roller")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Roller")] [assembly: AssemblyTitle("Roller")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RollerEnemy { internal class RollerAI : EnemyAI { public enum RollerState { CLOSED, SEARCHING, ARMING, ROLLING } private const float speed = 10f; private const float pupilSpeed = 0.08f; private Animator animator; private Material material; private bool agressive = false; private bool hitWall = false; private float startSeeingPlayer = 0f; private RollerState rollerState = RollerState.CLOSED; private float timeSinceHittingPlayer = 0f; private float stateTimeLeft = 0f; private Vector3 direction = Vector3.zero; private Transform targetedPlayer = null; public Transform secondEye = null; private bool usingFirstEye = false; private AudioSource Scream; private AudioSource Arm; private AudioSource Roll; private AudioSource WallHit; private AudioSource Open; private AudioSource Close; private GameObject radarCircle; public override void Start() { base.AIIntervalTime = 0.2f; base.updatePositionThreshold = 0.4f; base.moveTowardsDestination = false; base.syncMovementSpeed = 0.22f; base.exitVentAnimationTime = 1.45f; base.enemyHP = 1; ((EnemyAI)this).Start(); animator = ((Component)this).GetComponent<Animator>(); material = ((Renderer)((Component)((Component)this).transform.Find("EyeModel")).GetComponent<SkinnedMeshRenderer>()).materials[0]; material.SetFloat("_EyeOpeness", 1f); Scream = ((Component)((Component)this).transform.Find("AudioSources").Find("Scream")).GetComponent<AudioSource>(); Arm = ((Component)((Component)this).transform.Find("AudioSources").Find("Arm")).GetComponent<AudioSource>(); Roll = ((Component)((Component)this).transform.Find("AudioSources").Find("Roll")).GetComponent<AudioSource>(); WallHit = ((Component)((Component)this).transform.Find("AudioSources").Find("WallHit")).GetComponent<AudioSource>(); Open = ((Component)((Component)this).transform.Find("AudioSources").Find("Open")).GetComponent<AudioSource>(); Close = ((Component)((Component)this).transform.Find("AudioSources").Find("Close")).GetComponent<AudioSource>(); radarCircle = ((Component)((Component)this).transform.Find("Circle")).gameObject; } public override void Update() { ((EnemyAI)this).Update(); if (!base.isEnemyDead) { if (radarCircle.layer != 14) { radarCircle.layer = 14; } timeSinceHittingPlayer -= Time.deltaTime; stateTimeLeft -= Time.deltaTime; CheckState(); } } private void LateUpdate() { if ((Object)(object)targetedPlayer != (Object)null) { FocusEyeOnPlayer(targetedPlayer); } } private void CheckState() { //IL_0196: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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) switch (rollerState) { case RollerState.CLOSED: if (stateTimeLeft <= 0f) { SetStateServerRPC(RollerState.SEARCHING); } break; case RollerState.SEARCHING: if (stateTimeLeft <= 0f) { SetStateServerRPC(RollerState.CLOSED); Close.Play(); agressive = false; } else if ((Object)(object)targetedPlayer == (Object)null) { material.SetFloat("_EyeOpeness", Mathf.Lerp(material.GetFloat("_EyeOpeness"), 1f, 0.08f)); PlayerControllerB val = PlayerVisible(); if ((Object)(object)val != (Object)null) { targetedPlayer = ((Component)val).transform; startSeeingPlayer = Time.time; if (val.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId) { val.JumpToFearLevel(1f, true); } Scream.Play(); } } else if (Time.time > startSeeingPlayer + 0.5f) { SetStateClientRPC(RollerState.ARMING); } break; case RollerState.ARMING: if (stateTimeLeft <= 0f) { SetStateClientRPC(RollerState.ROLLING); agressive = true; break; } direction = ((Component)targetedPlayer).transform.position - ((Component)this).transform.position; direction.y = 0f; ((Vector3)(ref direction)).Normalize(); agressive = true; ((Component)this).transform.LookAt(new Vector3(((Component)targetedPlayer).transform.position.x, ((Component)this).transform.position.y, ((Component)targetedPlayer).transform.position.z)); break; case RollerState.ROLLING: if (stateTimeLeft <= 0f && hitWall) { WallHit.Play(); Roll.Stop(); SetStateClientRPC(RollerState.CLOSED); } base.agent.Move(direction * 10f * Time.deltaTime); break; } } [ServerRpc] private void SetStateServerRPC(RollerState state) { SetStateClientRPC(state); } [ClientRpc] private void SetStateClientRPC(RollerState state) { rollerState = state; switch (state) { case RollerState.CLOSED: stateTimeLeft = 3f; targetedPlayer = null; hitWall = false; animator.SetBool("Closed", true); animator.SetBool("Rolling", false); animator.SetBool("Searching", false); break; case RollerState.SEARCHING: stateTimeLeft = 4f; animator.SetBool("Closed", false); animator.SetBool("Rolling", false); animator.SetBool("Searching", true); Open.Play(); break; case RollerState.ARMING: animator.SetBool("Closed", false); animator.SetBool("Rolling", true); animator.SetBool("Searching", false); stateTimeLeft = 0.25f; Arm.Play(); break; case RollerState.ROLLING: stateTimeLeft = 1f; animator.SetBool("Closed", false); animator.SetBool("Rolling", true); animator.SetBool("Searching", false); Roll.Play(0.25); break; } } private PlayerControllerB PlayerVisible() { PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(30f, 70, base.eye, 3f, -1); if (allPlayersInLineOfSight != null && allPlayersInLineOfSight.Length != 0) { usingFirstEye = true; return allPlayersInLineOfSight[0]; } allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(30f, 70, secondEye, 3f, -1); if (allPlayersInLineOfSight != null && allPlayersInLineOfSight.Length != 0) { usingFirstEye = false; return allPlayersInLineOfSight[0]; } return null; } private void FocusEyeOnPlayer(Transform player) { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) base.eye.LookAt(player.position + new Vector3(0f, 1f, 0f)); if (!usingFirstEye) { } material.SetFloat("_EyeOpeness", Mathf.Lerp(material.GetFloat("_EyeOpeness"), -0.6f, 0.08f)); } public override void OnCollideWithPlayer(Collider other) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (!agressive || timeSinceHittingPlayer >= 0f) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { timeSinceHittingPlayer = 0.5f; val.DamagePlayer(90, true, true, (CauseOfDeath)6, 2, false, default(Vector3)); if (val.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId) { val.JumpToFearLevel(1f, true); } } } public void WallSignal() { if (rollerState == RollerState.ROLLING && stateTimeLeft <= 0f) { hitWall = true; } } } [BepInPlugin("RollerEnemy", "RollerEnemy", "1.0.0")] public class RollerEnemyPlugin : BaseUnityPlugin { public static EnemyType EnemyType; internal static ManualLogSource Log; private const string EnemyTypePath = "Assets/Roller/RollerType.asset"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy START!"); LoadAssets(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy LOADED!"); } private void LoadAssets() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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) Assets.PopulateAssets(); LoadNetWeaver(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy ASSETS POPULATED!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); if (Assets.MainAssetBundle.Contains("Assets/Roller/RollerType.asset")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy VALID PATH!"); EnemyType = Assets.MainAssetBundle.LoadAsset<EnemyType>("Assets/Roller/RollerType.asset"); if ((Object)(object)EnemyType == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy ENEMYTYPE IS NULL!"); return; } if ((Object)(object)EnemyType.enemyPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy ROLLER ENEMY PREFAB MISSING!"); return; } AddScripts(EnemyType); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering Roller as Enemy"); LevelTypes val = (LevelTypes)(-1); SpawnType val2 = (SpawnType)0; TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>(); val3.displayText = "Roller \n\nDanger level: 65%\n\nSpiky roller which rolls whenever it sees danger.They are shy, but very dangerous creatures. They close themselves in their shells, but check regurarly for any dangers. Beware of their scream, as it might mean a certain death!\n\n"; val3.clearPreviousText = true; val3.maxCharactersToType = 2000; val3.creatureName = "Roller"; val3.creatureFileID = 28888; TerminalKeyword val4 = TerminalUtils.CreateTerminalKeyword("roller", false, (CompatibleNoun[])null, val3, (TerminalKeyword)null, false); NetworkPrefabs.RegisterNetworkPrefab(EnemyType.enemyPrefab); Enemies.RegisterEnemy(EnemyType, 25, val, val2, val3, val4); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy ROLLER ENEMY TYPE LOADED CORRECTLY!"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollerEnemy INVALID PATH!"); } } private void AddScripts(EnemyType rollerType) { GameObject enemyPrefab = rollerType.enemyPrefab; enemyPrefab.AddComponent<RollerAI>(); ((EnemyAI)enemyPrefab.GetComponent<RollerAI>()).enemyType = rollerType; ((EnemyAI)enemyPrefab.GetComponent<RollerAI>()).eye = enemyPrefab.transform.Find("Roller Armature").Find("Eye"); enemyPrefab.GetComponent<RollerAI>().secondEye = enemyPrefab.transform.Find("Roller Armature").Find("Eye").Find("EyeOther"); ((Component)enemyPrefab.transform.Find("WallSensor")).gameObject.AddComponent<WallSensor>(); ((Component)enemyPrefab.transform.Find("WallSensor")).gameObject.GetComponent<WallSensor>().roller = enemyPrefab.GetComponent<RollerAI>(); enemyPrefab.GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)enemyPrefab.GetComponent<RollerAI>(); } private void LoadNetWeaver() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { try { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } catch { } } } } public static class Assets { public static string mainAssetBundleName = "rollerbundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().GetName().Name; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName); MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } namespace Roller { [HarmonyPatch] internal class EnemyPatches { [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void RegisterEnemy(StartOfRound __instance) { SelectableLevel[] levels = __instance.levels; HandleSpawnInAny(levels); } private static void HandleSpawnInAny(SelectableLevel[] levels) { } } internal class WallSensor : MonoBehaviour { public RollerAI roller; private void OnTriggerStay(Collider other) { if (((Component)other).gameObject.layer == LayerMask.NameToLayer("Room") || ((Component)other).gameObject.layer == LayerMask.NameToLayer("Colliders")) { roller.WallSignal(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
Monsters/BepInEx/plugins/ZoLoKinoBabo112/TheFiend.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TheFiend; using TheFiend.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TheFiend")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Your mod description.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TheFiend")] [assembly: AssemblyTitle("TheFiend")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class TheFiendAI : EnemyAI { public NetworkVariable<int> StateOfMind; public NetworkVariable<int> Funky = new NetworkVariable<int>(1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Animator animator; public GameObject Main; public GameObject Neck; public GameObject Spine; public GameObject LeftHand; public GameObject RightHand; public MeshRenderer MapDot; public SkinnedMeshRenderer skinnedMesh; private float OldYScale; public Random enemyRandom; public AudioClip[] audioClips; public AudioClip StepClip; private AudioSource AS; private AudioSource AS2; private Vector3 FavSpot; private bool ResetNode; private bool EatingPlayer; public NetworkVariable<bool> Seeking; public NetworkVariable<bool> Invis; public NetworkVariable<bool> RageMode; public NetworkVariable<bool> GlobalCD; public NetworkVariable<bool> StandingMode; public NetworkVariable<bool> IsDying = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> LungApparatusWillRage = new NetworkVariable<bool>(global::TheFiend.TheFiend.WillRageAfterApparatus.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public Quaternion OldR; public bool Step; private Vector3 LastPos; private Vector3 Node; private int LightTriggerTimes; private NavMeshPath path; private GameObject Head; private GameObject breakerBox; private RoundManager roundManager; public TimeOfDay timeOfDay; private GameObject LungApparatus; private Vector3 LungApparatusPosition; public GameObject TargetLook; public void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) path = new NavMeshPath(); FavSpot = ((Component)this).transform.position; Head = ((Component)Neck.transform.Find("mixamorig:Head")).gameObject; OldR = Neck.transform.localRotation; animator = ((Component)this).GetComponent<Animator>(); animator.Play("Idle"); AS = ((Component)this).GetComponent<AudioSource>(); AS2 = Spine.GetComponent<AudioSource>(); try { breakerBox = ((Component)Object.FindObjectOfType<BreakerBox>()).gameObject; } catch { breakerBox = null; } roundManager = Object.FindObjectOfType<RoundManager>(); timeOfDay = Object.FindObjectOfType<TimeOfDay>(); ((Renderer)MapDot).material.color = Color.red; AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0]; AS.outputAudioMixerGroup = outputAudioMixerGroup; } public override void Start() { //IL_0014: 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_009c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); OldYScale = Main.transform.position.y; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); AS.clip = audioClips[0]; AS.loop = true; AS.Play(); LungApparatus = GameObject.Find("LungApparatus(Clone)"); if (Object.op_Implicit((Object)(object)LungApparatus)) { LungApparatusPosition = LungApparatus.transform.position; } } public void FixedUpdate() { if (Step && !Invis.Value) { AS2.pitch = Random.Range(0.6f, 1f); AS2.PlayOneShot(StepClip); } } public void LateUpdate() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetLook != (Object)null) { Neck.transform.LookAt(TargetLook.transform, Vector3.up); } else { Neck.transform.localRotation = OldR; } } public override void DoAIInterval() { //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_09a7: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_0a28: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if ((Object)(object)base.stunnedByPlayer != (Object)null) { AS.clip = audioClips[2]; AS.loop = false; AS.Play(); IsDying.Value = true; Object.Destroy((Object)(object)((Component)this).gameObject, 4f); base.stunnedByPlayer = null; ((Renderer)skinnedMesh).enabled = false; } if (!IsDying.Value) { if (timeOfDay.hour >= 15) { Funky.Value = 2; } if (Seeking.Value) { AS.volume = 0f; } else if (StateOfMind.Value != 3) { AS.volume = global::TheFiend.TheFiend.Volume.Value; } if (Invis.Value) { ((Renderer)skinnedMesh).enabled = false; } else { ((Renderer)skinnedMesh).enabled = true; } if (Random.Range(1, 10000) == 1) { TeleportServerRpc(); } if (Random.Range(1, 10000 / Funky.Value) == 1 && StateOfMind.Value == 3) { HideOnCellingServerRpc(); } if (Random.Range(1, 10000 / Funky.Value) == 1 && !Seeking.Value) { ToggleSeekingServerRpc(); } if (!GlobalCD.Value) { if (StateOfMind.Value < 3) { StateOfMind.Value = 0; } if (Object.op_Implicit((Object)(object)breakerBox) && !Seeking.Value) { GameObject gameObject = ((Component)breakerBox.transform.Find("Mesh")).gameObject; if (Vector3.Distance(Main.transform.position, gameObject.transform.position) <= 5f) { RaycastHit val = default(RaycastHit); if (Physics.Raycast(Neck.transform.position, gameObject.transform.position - Neck.transform.position, ref val, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enmies" })) && Vector3.Distance(((RaycastHit)(ref val)).point, gameObject.transform.position) < 2f) { StateOfMind.Value = 4; TargetLook = gameObject; if (Vector3.Distance(Main.transform.position, gameObject.transform.position) <= 2f) { BreakerBoxBreakServerRpc(); } } else { StateOfMind.Value = 0; } } } if (((EnemyAI)this).TargetClosestPlayer(100f, false, 70f)) { TargetLook = ((Component)base.targetPlayer).gameObject; if (Object.op_Implicit((Object)(object)base.targetPlayer.currentlyHeldObject) && ((Object)((Component)base.targetPlayer.currentlyHeldObject).gameObject).name.Contains("FlashlightItem")) { GameObject gameObject2 = ((Component)((Component)base.targetPlayer.currentlyHeldObject).gameObject.transform.Find("Light")).gameObject; Light component = gameObject2.GetComponent<Light>(); if (((Behaviour)component).enabled && Vector3.Distance(Head.transform.position, gameObject2.transform.position) <= 2.5f) { FearedServerRpc(TempRage: false, uselight: true); LightTriggerTimes++; } } } if (StateOfMind.Value == 3 && !GlobalCD.Value && !Seeking.Value && ((EnemyAI)this).TargetClosestPlayer(100f, false, 70f)) { TargetLook = ((Component)base.targetPlayer).gameObject; if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).gameObject.transform.position) <= 4f) { HideOnCellingServerRpc(); } } if (!EatingPlayer && StateOfMind.Value <= 2 && !GlobalCD.Value && !StandingMode.Value) { if (((EnemyAI)this).TargetClosestPlayer(100f, false, 70f)) { TargetLook = ((Component)base.targetPlayer).gameObject; ResetNode = true; if (base.agent.remainingDistance > 10f && !RageMode.Value) { OldYScale = Main.transform.position.y; if (!Seeking.Value) { StateOfMind.Value = 1; base.agent.speed = 3 + (Funky.Value - 1); animator.Play("Walk"); if (CheckDoor()) { if (Random.Range(1, 100) == 1 && StateOfMind.Value != 3) { HideOnCellingServerRpc(); } } else if (Random.Range(1, 1000) == 1 && StateOfMind.Value != 3) { HideOnCellingServerRpc(); } } else { base.agent.speed = 1f; animator.Play("Seeking"); BreakDoorServerRpc(); } if (Random.Range(1, global::TheFiend.TheFiend.FlickerRngChance.Value) == 1) { roundManager.FlickerLights(true, true); } } else if (!Seeking.Value) { StateOfMind.Value = 2; if ((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(45f, 60, -1) != (Object)null) { base.targetPlayer.JumpToFearLevel(0.9f, true); } if (!RageMode.Value) { base.agent.speed = 9 * Funky.Value; } else { base.agent.speed = 20 * Funky.Value; } animator.Play("Run"); BreakDoorServerRpc(); } ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); if (Seeking.Value) { PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[]; foreach (PlayerControllerB val2 in array) { if (val2.HasLineOfSightToPosition(Neck.transform.position, 45f, 60, -1f)) { ToggleSeekingServerRpc(); FearedServerRpc(TempRage: true); break; } } } } else { base.agent.speed = 3f; if (ResetNode) { WonderVectorServerRpc(60f); ResetNode = false; } if (Node != Vector3.zero) { ((EnemyAI)this).SetDestinationToPosition(Node, false); } else { ResetNode = true; } if (base.agent.remainingDistance == 0f) { ResetNode = true; } if (Random.Range(1, 100) == 1) { ResetNode = true; } TargetLook = null; } if (!GlobalCD.Value) { if (base.agent.remainingDistance == 0f && StateOfMind.Value == 0 && !RageMode.Value) { animator.Play("Idle"); } else if (!Seeking.Value && StateOfMind.Value == 1) { animator.Play("Walk"); } } } if (StateOfMind.Value == 4 && Object.op_Implicit((Object)(object)TargetLook)) { animator.Play("Walk"); ((EnemyAI)this).SetDestinationToPosition(TargetLook.transform.position, false); } if ((Object)(object)LungApparatus != (Object)null && LungApparatusWillRage.Value && !Invis.Value && LungApparatus.transform.position != LungApparatusPosition) { ((Component)LungApparatus.transform.Find("Point Light")).gameObject.GetComponent<Light>().color = Color.red; ((GrabbableObject)LungApparatus.GetComponent<LungProp>()).scrapValue = 300; LungApparatus = null; ((MonoBehaviour)this).StartCoroutine(Rage()); } } } ((EnemyAI)this).SyncPositionToClients(); } [ServerRpc] public void ToggleSeekingServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2185458962u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2185458962u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Seeking.Value = !Seeking.Value; } } private void OnTriggerStay(Collider collision) { //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_0097: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)collision).gameObject.GetComponent<PlayerControllerB>()) && StateOfMind.Value != 3 && !GlobalCD.Value && !Invis.Value && !IsDying.Value && !EatingPlayer && Vector3.Distance(((Component)this).transform.position, ((Component)collision).gameObject.transform.position) < 4f) { GrabServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)((Component)collision).gameObject.GetComponent<PlayerControllerB>())); } } [ServerRpc(RequireOwnership = false)] public void SceamServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2166844155u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2166844155u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AS.Stop(); AS.clip = audioClips[Random.Range(1, 2)]; AS.loop = false; AS.Play(); SceamClientRpc(); } } } [ClientRpc] public void SceamClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3334696286u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3334696286u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AS.Stop(); AS.clip = audioClips[Random.Range(1, 2)]; AS.loop = false; AS.Play(); } } } [ServerRpc(RequireOwnership = false)] public void IdleSoundServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(579005519u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 579005519u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AS.Stop(); AS.clip = audioClips[0]; AS.loop = true; AS.Play(); IdleSoundClientRpc(); } } } [ClientRpc] public void IdleSoundClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(469331619u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 469331619u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AS.Stop(); AS.clip = audioClips[0]; AS.loop = true; AS.Play(); } } } [ServerRpc(RequireOwnership = false)] public void GrabServerRpc(NetworkBehaviourReference PlayerControllerBRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2819942690u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref PlayerControllerBRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2819942690u, val, (RpcDelivery)0); } PlayerControllerB val3 = default(PlayerControllerB); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviourReference)(ref PlayerControllerBRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null)) { GrabClientRpc(NetworkObjectReference.op_Implicit(((Component)val3).gameObject)); } } } [ClientRpc] public void GrabClientRpc(NetworkObjectReference networkObject) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2797167683u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2797167683u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref networkObject)).TryGet(ref val3, (NetworkManager)null)) { ((MonoBehaviour)this).StartCoroutine(Grabbing(((Component)val3).gameObject)); } } } public IEnumerator Grabbing(GameObject Player) { if (EatingPlayer || !Object.op_Implicit((Object)(object)Player)) { yield break; } PlayerControllerB PCB = Player.GetComponent<PlayerControllerB>(); if (PCB.health <= 50) { EatingPlayer = true; TargetLook = null; base.agent.speed = 0f; ((EnemyAI)this).SetDestinationToPosition(((Component)base.agent).transform.position, false); float oldspeed = PCB.movementSpeed; PCB.movementSpeed = 0f; animator.Play("Grab"); ((Component)this).transform.LookAt(Player.transform.position, Vector3.up); ((MonoBehaviour)this).StartCoroutine(RotatePlayerToMe(PCB)); SceamServerRpc(); yield return (object)new WaitForSeconds(1.7f); PCB.KillPlayer(Main.transform.forward * 30f, true, (CauseOfDeath)6, 1, default(Vector3)); if (((NetworkBehaviour)PCB).IsOwner) { PCB.movementSpeed = oldspeed; } yield return (object)new WaitForSeconds(1f); IdleSoundServerRpc(); animator.Play("Idle"); yield return (object)new WaitForSeconds(3f); yield return (object)new WaitForSeconds(2f); RageMode.Value = false; if (Random.Range(1, 30) == 1) { HideOnCellingServerRpc(); } EatingPlayer = false; } else { PCB.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); PCB.externalForceAutoFade += Main.transform.forward * 30f; animator.Play("Craw"); GlobalCD.Value = true; PCB.movementAudio.PlayOneShot(audioClips[6], 1f); StartCooldown(1f); } } private IEnumerator RotatePlayerToMe(PlayerControllerB PCB) { if (Object.op_Implicit((Object)(object)PCB)) { Vector3 Position = ((Component)this).transform.position - ((Component)PCB).gameObject.transform.position; while (PCB.health != 0) { PlayerSmoothLookAt(Position, PCB); yield return null; } } } private void PlayerSmoothLookAt(Vector3 newDirection, PlayerControllerB PCB) { //IL_0017: 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_002d: Unknown result type (might be due to invalid IL or missing references) ((Component)PCB).gameObject.transform.rotation = Quaternion.Lerp(((Component)PCB).gameObject.transform.rotation, Quaternion.LookRotation(newDirection), Time.deltaTime * 5f); } [ServerRpc(RequireOwnership = false)] public void HideOnCellingServerRpc() { //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_0107: 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_011d: 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_0142: 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_019e: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(862535042u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 862535042u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } if (StateOfMind.Value != 3) { if (StateOfMind.Value <= 3) { StateOfMind.Value = 3; LastPos = Main.transform.position; OldYScale = Main.transform.position.y; RaycastHit val3 = default(RaycastHit); Physics.Raycast(Main.transform.position, ((Component)this).transform.TransformDirection(Vector3.up), ref val3, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enmies" })); animator.Play("Hide"); AS.Stop(); base.agent.speed = 0f; SetYLevelClientRpc(((RaycastHit)(ref val3)).point.y); ((Renderer)MapDot).enabled = false; } } else if (!StandingMode.Value) { ((MonoBehaviour)this).StartCoroutine(Stand()); } } [ClientRpc] public void SetYLevelClientRpc(float y) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3597756483u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref y, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3597756483u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Main.transform.position = new Vector3(Main.transform.position.x, y, Main.transform.position.z); } } } public IEnumerator Stand() { StandingMode.Value = true; ((Renderer)MapDot).enabled = true; Rigidbody rig = Main.AddComponent<Rigidbody>(); rig.detectCollisions = false; while (Vector3.Distance(Main.transform.position, LastPos) > 1.5f) { yield return null; } Object.Destroy((Object)(object)rig); animator.Play("UnHide"); yield return (object)new WaitForSeconds(0.2f); SetYLevelClientRpc(OldYScale); animator.Play("Idle"); SceamServerRpc(); yield return (object)new WaitForSeconds(2f); IdleSoundServerRpc(); BreakDoorServerRpc(); StateOfMind.Value = 1; StandingMode.Value = false; } [ServerRpc] public void BreakDoorServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2228961150u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2228961150u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } try { DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[]; foreach (DoorLock val3 in array) { GameObject gameObject = ((Component)((Component)((Component)((Component)val3).transform.parent).transform.parent).transform.parent).gameObject; if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()) && Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f) { NetworkObjectReference netObjRef = NetworkObjectReference.op_Implicit(gameObject); Vector3 val4 = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position; BashDoorClientRpc(netObjRef, ((Vector3)(ref val4)).normalized * 20f); } } } catch { } } [ClientRpc] public void BashDoorClientRpc(NetworkObjectReference netObjRef, Vector3 Position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2581177773u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref Position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2581177773u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)val3).gameObject; Rigidbody val4 = gameObject.AddComponent<Rigidbody>(); AudioSource val5 = gameObject.AddComponent<AudioSource>(); val5.spatialBlend = 1f; val5.maxDistance = 60f; val5.rolloffMode = (AudioRolloffMode)1; val5.volume = 3f; ((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.12f)); val4.AddForce(Position, (ForceMode)1); val5.PlayOneShot(audioClips[3]); } } } public bool CheckDoor() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[]; foreach (DoorLock val in array) { GameObject gameObject = ((Component)((Component)((Component)val).transform.parent).transform.parent).gameObject; if (Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f) { return true; } } return false; } private IEnumerator TurnOffC(Rigidbody rigidbody, float time) { rigidbody.detectCollisions = false; yield return (object)new WaitForSeconds(time); rigidbody.detectCollisions = true; Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 5f); } [ServerRpc(RequireOwnership = false)] public void FearedServerRpc(bool TempRage, bool uselight = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3886079065u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref TempRage, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref uselight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3886079065u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !EatingPlayer && !StandingMode.Value) { GlobalCD.Value = true; FearedClientRpc(); ((MonoBehaviour)this).StartCoroutine(CD(5f)); float tempRage = 3f; if (uselight) { tempRage = LightTriggerTimes * 2; } if (TempRage) { ((MonoBehaviour)this).StartCoroutine(SetTempRage(tempRage)); } } } public IEnumerator Rage() { GlobalCD.Value = true; yield return (object)new WaitForSeconds(0.2f); animator.Play("Rage"); PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[]; foreach (PlayerControllerB player in array) { player.JumpToFearLevel(0.9f, true); } AS.maxDistance = 500f; AS.Stop(); AS.clip = audioClips[5]; AS.loop = false; AS.Play(); yield return (object)new WaitForSeconds(9f); ToggleRageServerRpc(TheRageValue: true); AS.maxDistance = 30f; GlobalCD.Value = false; yield return (object)new WaitForSeconds(20f); ToggleRageServerRpc(TheRageValue: false); } [ServerRpc(RequireOwnership = false)] public void ToggleRageServerRpc(bool TheRageValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1019923705u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref TheRageValue, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1019923705u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RageMode.Value = TheRageValue; } } } [ServerRpc(RequireOwnership = false)] public void TeleportServerRpc() { //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_015a: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1623300671u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1623300671u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || Invis.Value) { return; } Invis.Value = true; List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[]; foreach (PlayerControllerB val3 in array) { if (val3.isInsideFactory) { list.Add(val3); } } if (list.Count > 0) { ((Component)this).transform.position = ((Component)list[Random.Range(1, list.Count)]).gameObject.transform.position; } GlobalCD.Value = true; ((MonoBehaviour)this).StartCoroutine(CD(25f, UnInvis: true)); } [ClientRpc] public void FearedClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3221369379u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3221369379u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { animator.Play("CoverFace"); base.agent.speed = 0f; AS.Stop(); AS.clip = audioClips[4]; AS.loop = false; AS.Play(); } } } public void StartCooldown(float time, bool UnInvis = false) { ((MonoBehaviour)this).StartCoroutine(CD(time, UnInvis)); } private IEnumerator CD(float time, bool UnInvis = false) { base.agent.speed = 0f; yield return (object)new WaitForSeconds(time); GlobalCD.Value = false; if (UnInvis) { Invis.Value = false; } } private IEnumerator StateMindCD(float time, int typenow) { yield return (object)new WaitForSeconds(time); StateOfMind.Value = typenow; } private IEnumerator SetTempRage(float time) { ToggleRageServerRpc(TheRageValue: true); yield return (object)new WaitForSeconds(time); ToggleRageServerRpc(TheRageValue: false); } [ServerRpc(RequireOwnership = false)] public void WonderVectorServerRpc(float Range) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2540260648u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref Range, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2540260648u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Vector3 val3 = ((Component)this).transform.position + new Vector3(Random.Range(0f - Range, Range), 0f, Random.Range(0f - Range, Range)); if (base.agent.CalculatePath(val3, path)) { Node = val3; } else { Node = Vector3.zero; } } } [ServerRpc] public void BreakerBoxBreakServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0121: 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.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(180009697u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 180009697u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !Object.op_Implicit((Object)(object)breakerBox.GetComponent<Rigidbody>())) { BreakerBoxBreakClientRpc(NetworkObjectReference.op_Implicit(breakerBox)); } } [ClientRpc] public void BreakerBoxBreakClientRpc(NetworkObjectReference networkObjectReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4033774285u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4033774285u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)val3).gameObject; ((Component)((Component)gameObject.transform.Find("Mesh")).transform.Find("PowerBoxDoor")).gameObject.AddComponent<Rigidbody>(); Rigidbody val4 = gameObject.AddComponent<Rigidbody>(); ((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.1f)); Vector3 val5 = Neck.transform.position - ((Component)this).transform.position; val4.AddForce(((Vector3)(ref val5)).normalized * 15f, (ForceMode)1); gameObject.GetComponent<AudioSource>().PlayOneShot(audioClips[3]); Object.Destroy((Object)(object)gameObject, 5f); gameObject = null; roundManager.PowerSwitchOffClientRpc(); ((MonoBehaviour)this).StartCoroutine(StateMindCD(1f, 0)); animator.Play("Grab"); } } } protected override void __initializeVariables() { if (StateOfMind == null) { throw new Exception("TheFiendAI.StateOfMind cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)StateOfMind).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StateOfMind, "StateOfMind"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)StateOfMind); if (Funky == null) { throw new Exception("TheFiendAI.Funky cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)Funky).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Funky, "Funky"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Funky); if (Seeking == null) { throw new Exception("TheFiendAI.Seeking cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)Seeking).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Seeking, "Seeking"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Seeking); if (Invis == null) { throw new Exception("TheFiendAI.Invis cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)Invis).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Invis, "Invis"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Invis); if (RageMode == null) { throw new Exception("TheFiendAI.RageMode cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)RageMode).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RageMode, "RageMode"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)RageMode); if (GlobalCD == null) { throw new Exception("TheFiendAI.GlobalCD cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)GlobalCD).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)GlobalCD, "GlobalCD"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)GlobalCD); if (StandingMode == null) { throw new Exception("TheFiendAI.StandingMode cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)StandingMode).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StandingMode, "StandingMode"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)StandingMode); if (IsDying == null) { throw new Exception("TheFiendAI.IsDying cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)IsDying).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsDying, "IsDying"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)IsDying); if (LungApparatusWillRage == null) { throw new Exception("TheFiendAI.LungApparatusWillRage cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)LungApparatusWillRage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)LungApparatusWillRage, "LungApparatusWillRage"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)LungApparatusWillRage); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_TheFiendAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2185458962u, new RpcReceiveHandler(__rpc_handler_2185458962)); NetworkManager.__rpc_func_table.Add(2166844155u, new RpcReceiveHandler(__rpc_handler_2166844155)); NetworkManager.__rpc_func_table.Add(3334696286u, new RpcReceiveHandler(__rpc_handler_3334696286)); NetworkManager.__rpc_func_table.Add(579005519u, new RpcReceiveHandler(__rpc_handler_579005519)); NetworkManager.__rpc_func_table.Add(469331619u, new RpcReceiveHandler(__rpc_handler_469331619)); NetworkManager.__rpc_func_table.Add(2819942690u, new RpcReceiveHandler(__rpc_handler_2819942690)); NetworkManager.__rpc_func_table.Add(2797167683u, new RpcReceiveHandler(__rpc_handler_2797167683)); NetworkManager.__rpc_func_table.Add(862535042u, new RpcReceiveHandler(__rpc_handler_862535042)); NetworkManager.__rpc_func_table.Add(3597756483u, new RpcReceiveHandler(__rpc_handler_3597756483)); NetworkManager.__rpc_func_table.Add(2228961150u, new RpcReceiveHandler(__rpc_handler_2228961150)); NetworkManager.__rpc_func_table.Add(2581177773u, new RpcReceiveHandler(__rpc_handler_2581177773)); NetworkManager.__rpc_func_table.Add(3886079065u, new RpcReceiveHandler(__rpc_handler_3886079065)); NetworkManager.__rpc_func_table.Add(1019923705u, new RpcReceiveHandler(__rpc_handler_1019923705)); NetworkManager.__rpc_func_table.Add(1623300671u, new RpcReceiveHandler(__rpc_handler_1623300671)); NetworkManager.__rpc_func_table.Add(3221369379u, new RpcReceiveHandler(__rpc_handler_3221369379)); NetworkManager.__rpc_func_table.Add(2540260648u, new RpcReceiveHandler(__rpc_handler_2540260648)); NetworkManager.__rpc_func_table.Add(180009697u, new RpcReceiveHandler(__rpc_handler_180009697)); NetworkManager.__rpc_func_table.Add(4033774285u, new RpcReceiveHandler(__rpc_handler_4033774285)); } private static void __rpc_handler_2185458962(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).ToggleSeekingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2166844155(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; ((TheFiendAI)(object)target).SceamServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3334696286(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)2; ((TheFiendAI)(object)target).SceamClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_579005519(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; ((TheFiendAI)(object)target).IdleSoundServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_469331619(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)2; ((TheFiendAI)(object)target).IdleSoundClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2819942690(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerControllerBRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerControllerBRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).GrabServerRpc(playerControllerBRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2797167683(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((TheFiendAI)(object)target).GrabClientRpc(networkObject); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_862535042(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; ((TheFiendAI)(object)target).HideOnCellingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3597756483(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float yLevelClientRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yLevelClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((TheFiendAI)(object)target).SetYLevelClientRpc(yLevelClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2228961150(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).BreakDoorServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2581177773(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_0060: 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) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable)); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((TheFiendAI)(object)target).BashDoorClientRpc(netObjRef, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3886079065(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool tempRage = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref tempRage, default(ForPrimitives)); bool uselight = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref uselight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).FearedServerRpc(tempRage, uselight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1019923705(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool theRageValue = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref theRageValue, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).ToggleRageServerRpc(theRageValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1623300671(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; ((TheFiendAI)(object)target).TeleportServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3221369379(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)2; ((TheFiendAI)(object)target).FearedClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2540260648(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float range = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref range, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).WonderVectorServerRpc(range); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_180009697(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((TheFiendAI)(object)target).BreakerBoxBreakServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4033774285(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((TheFiendAI)(object)target).BreakerBoxBreakClientRpc(networkObjectReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TheFiendAI"; } } namespace TheFiend { [BepInPlugin("com.TheFiend", "The Fiend", "0.0.0")] public class TheFiend : BaseUnityPlugin { public static TheFiend instance; public static string RoleCompanyFolder = "Assets/TheFiend/"; public static AssetBundle bundle; public static ConfigEntry<int> SpawnChance; public static ConfigEntry<LevelTypes> Moon; public static ConfigEntry<int> FlickerRngChance; public static ConfigEntry<bool> WillRageAfterApparatus; public static ConfigEntry<float> Volume; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "Fiend.cfg"), true); SpawnChance = val.Bind<int>("Fiend", "Spawn Weight", 30, new ConfigDescription("The Chance to spawn the fiend inside of the building", (AcceptableValueBase)null, Array.Empty<object>())); Moon = val.Bind<LevelTypes>("Fiend", "Moon", (LevelTypes)(-1), new ConfigDescription("What is the only moon it can spawn on. Only one VALUE at a time.", (AcceptableValueBase)null, Array.Empty<object>())); FlickerRngChance = val.Bind<int>("Fiend", "Flicker Chance", 1000, new ConfigDescription("This is a Random chance out of 1/1000 happening to a random player", (AcceptableValueBase)null, Array.Empty<object>())); WillRageAfterApparatus = val.Bind<bool>("Fiend", "Rage After Apparatus", true, new ConfigDescription("Trigger his rage mode if you remove the Apparatus.", (AcceptableValueBase)null, Array.Empty<object>())); Volume = val.Bind<float>("Fiend", "Volume", 1f, new ConfigDescription("Sounds as scream and idle sound, not step sounds", (AcceptableValueBase)null, Array.Empty<object>())); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } instance = this; bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "thefiend")); EnemyType val2 = bundle.LoadAsset<EnemyType>(RoleCompanyFolder + "TheFiend.asset"); Enemies.RegisterEnemy(val2, SpawnChance.Value, Moon.Value, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "TheFiendNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "TheFiendKey.asset")); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); Utilities.FixMixerGroups(val2.enemyPrefab); } public void AddScrap(string Name, int Rare, LevelTypes level) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) Item val = bundle.LoadAsset<Item>(RoleCompanyFolder + Name + ".asset"); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, Rare, level); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TheFiend"; public const string PLUGIN_NAME = "TheFiend"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace TheFiend.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/ZoLoKinoBabo112/AccurateStaminaDisplay.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; 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("AccurateStaminaDisplay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes the stamina meter display on the HUD, so it more accurately represents your current stamina percentage.")] [assembly: AssemblyFileVersion("2.1.3.0")] [assembly: AssemblyInformationalVersion("2.1.3")] [assembly: AssemblyProduct("AccurateStaminaDisplay")] [assembly: AssemblyTitle("AccurateStaminaDisplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AccurateStaminaDisplay { internal static class NewStaminaMeter { private const float STAMINA_EMPTY = 0.1f; private const float STAMINA_EXHAUSTED = 0.3f; private const float METER_EMPTY = 0.29767f; private const float METER_FULL = 0.911f; private static readonly Color NORM_COLOR = new Color(1f, 0.4626f, 0f); private static readonly Color EX_COLOR = new Color(0.9f, 0.1f, 0f); private static PlayerControllerB player; private static float minStamina; private static bool exhausted; private static Image meterOverlay; private static readonly float OVERLAY_MAX = Mathf.Lerp(0.29767f, 0.911f, Mathf.InverseLerp(0.1f, 1f, 0.3f)); private static Gradient tzpGrad; private static readonly Color LIME = new Color(0.4f, 1f, 0f); private const float TZP_LIGHT_MIN = 0.1f; private const float TZP_LIGHT_MAX = 0.2f; private const float TZP_HEAVY_MIN = 0.65f; private const float TZP_HEAVY_MAX = 0.77f; private static CanvasRenderer meterAlpha; private static CanvasRenderer overlayAlpha; private static bool wasClimbing; internal static void UpdateMeter(int playerMovementHinderedPrev) { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { Init(); return; } minStamina = ((Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.Empty) ? 0.3f : 0.1f); float num = Mathf.InverseLerp(minStamina, 1f, player.sprintMeter); player.sprintMeterUI.fillAmount = Mathf.Lerp(0.29767f, 0.911f, num); if (player.isClimbingLadder) { wasClimbing = true; } else if (player.thisController.isGrounded) { wasClimbing = false; } bool flag = playerMovementHinderedPrev > 0 && !wasClimbing && !player.jetpackControls; bool flag2 = Plugin.configInhalantInfo.Value && player.drunkness > 0f && tzpGrad != null; bool flag3 = Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.ChangeColor || (Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.AlwaysShow && (flag || flag2)); if (exhausted) { if (!flag3 || player.isSprinting || (player.sprintMeter >= 0.3f && !flag)) { exhausted = false; } } else if (flag3 && (player.isExhausted || flag)) { exhausted = true; ((Graphic)player.sprintMeterUI).color = EX_COLOR; } else if (flag2) { ((Graphic)player.sprintMeterUI).color = tzpGrad.Evaluate(player.drunkness); } else { ((Graphic)player.sprintMeterUI).color = NORM_COLOR; } if (!((Object)(object)meterOverlay != (Object)null)) { return; } if (Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.AlwaysShow && !exhausted && !player.criticallyInjured && !flag2) { meterOverlay.fillAmount = Mathf.Min(player.sprintMeterUI.fillAmount, OVERLAY_MAX); if ((Object)(object)overlayAlpha != (Object)null) { overlayAlpha.SetAlpha(meterAlpha.GetAlpha()); } ((Behaviour)meterOverlay).enabled = ((Behaviour)player.sprintMeterUI).enabled; ((Component)meterOverlay).gameObject.SetActive(true); } else { ((Component)meterOverlay).gameObject.SetActive(false); } } private static void Init() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) player = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)player != (Object)null) { if ((Object)(object)meterOverlay == (Object)null) { meterOverlay = ((Component)Object.Instantiate<Transform>(((Component)player.sprintMeterUI).transform, ((Component)player.sprintMeterUI).transform.parent)).GetComponent<Image>(); ((Graphic)meterOverlay).color = EX_COLOR; } if (Chainloader.PluginInfos.ContainsKey("ShyHUD") && (Object)(object)meterOverlay != (Object)null) { meterAlpha = ((Component)player.sprintMeterUI).GetComponent<CanvasRenderer>(); overlayAlpha = ((Component)meterOverlay).GetComponent<CanvasRenderer>(); } } if (tzpGrad == null) { tzpGrad = new Gradient(); tzpGrad.SetKeys((GradientColorKey[])(object)new GradientColorKey[6] { new GradientColorKey(NORM_COLOR, 0f), new GradientColorKey(Color.yellow, 0.1f), new GradientColorKey(Color.yellow, 0.2f), new GradientColorKey(LIME, 0.65f), new GradientColorKey(LIME, 0.77f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }); } } } internal enum ExhaustionIndicator { Empty, ChangeColor, AlwaysShow, DontShow } [BepInPlugin("butterystancakes.lethalcompany.accuratestaminadisplay", "Accurate Stamina Display", "2.1.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string PLUGIN_GUID = "butterystancakes.lethalcompany.accuratestaminadisplay"; private const string PLUGIN_NAME = "Accurate Stamina Display"; private const string PLUGIN_VERSION = "2.1.3"; internal static ConfigEntry<bool> configInhalantInfo; internal static ConfigEntry<ExhaustionIndicator> configExhaustionIndicator; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) LoadConfig(); new Harmony("butterystancakes.lethalcompany.accuratestaminadisplay").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Accurate Stamina Display v2.1.3 loaded"); } private void LoadConfig() { configInhalantInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "InhalantInfo", false, "Adjusts the color of the stamina meter to reflect the amount of TZP inhaled. (Light = yellow, heavy = green, \"overdose\" = white)"); configExhaustionIndicator = ((BaseUnityPlugin)this).Config.Bind<ExhaustionIndicator>("Misc", "ExhaustionIndicator", ExhaustionIndicator.AlwaysShow, "How the stamina meter displays exhaustion. You become exhausted when stamina hits 0% or if you release the sprint key while stamina is 20% or lower.\n\"Empty\" will make the stamina bar display as empty for the last 20% of stamina, just like the original game. \"ChangeColor\" will turn the bar red when you are currently exhausted. \"AlwaysShow\" will always display the last 20% of the bar as red. \"DontShow\" will not display any special indicator for exhaustion."); if (configExhaustionIndicator.Value != ExhaustionIndicator.AlwaysShow) { return; } bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "AlwaysShowRedPortion", true, "Legacy setting, use \"ExhaustionIndicator\" instead").Value; bool value2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "ExhaustedRed", true, "Legacy setting, use \"ExhaustionIndicator\" instead").Value; if (((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous", "EmptyEarly", false, "Legacy setting, use \"ExhaustionIndicator\" instead").Value) { configExhaustionIndicator.Value = ExhaustionIndicator.Empty; } else if (value2) { if (value) { configExhaustionIndicator.Value = ExhaustionIndicator.AlwaysShow; } else { configExhaustionIndicator.Value = ExhaustionIndicator.ChangeColor; } } else { configExhaustionIndicator.Value = ExhaustionIndicator.DontShow; } ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Extra", "AlwaysShowRedPortion"].Definition); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Extra", "ExhaustedRed"].Definition); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Miscellaneous", "EmptyEarly"].Definition); ((BaseUnityPlugin)this).Config.Save(); } } public static class PluginInfo { public const string PLUGIN_GUID = "AccurateStaminaDisplay"; public const string PLUGIN_NAME = "AccurateStaminaDisplay"; public const string PLUGIN_VERSION = "2.1.3"; } } namespace AccurateStaminaDisplay.Patches { [HarmonyPatch] internal class AccurateStaminaDisplayPatches { [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] public static void PlayerPostLateUpdate(int ___movementHinderedPrev) { NewStaminaMeter.UpdateMeter(___movementHinderedPrev); } } }
BepInEx/plugins/ZoLoKinoBabo112/AmmoTin.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalCompanyAmmoTin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalCompanyAmmoTin")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("85d63194-36a9-4b57-9db1-9b88fba8b04e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LethalCompanyAmmoTin; [BepInPlugin("htd.lethalcompany.ammotin", "Ammo Tin", "1.0.0.0")] public class ModAmmoTinMain : BaseUnityPlugin { [HarmonyPatch(typeof(ShotgunItem), "ReloadedGun")] private static class ShotgunItemReloadedGunPatches { private static void Postfix(ShotgunItem __instance, ref bool __result) { if (__result) { return; } for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy.ItemSlots[i] != (Object)null && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].itemProperties.itemName == "Ammo Tin" && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery.charge >= shotgunDrainCost) { Battery insertedBattery = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery; insertedBattery.charge -= shotgunDrainCost; __result = true; __instance.ammoSlotToUse = 100; break; } } } } [HarmonyPatch(typeof(PlayerControllerB), "DestroyItemInSlot")] private static class PlayerControllerBDestroyItemInSlotPatches { private static bool Prefix(PlayerControllerB __instance, ref int itemSlot) { if (itemSlot == 100) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.ShutdownInProgress) { return true; } return false; } return true; } } public const string Version = "1.0.0.0"; public const string ModName = "Ammo Tin"; public const string GUID = "htd.lethalcompany.ammotin"; private Harmony _Harmony = new Harmony("htd.lethalcompany.ammotin"); public static ManualLogSource Log; public static AssetBundle AmmoTinAssets; public static int maxShotgunReloads = 8; public static float shotgunDrainCost = 1f / (float)maxShotgunReloads; private void Awake() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); AmmoTinAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "ammotin")); if ((Object)(object)AmmoTinAssets == (Object)null) { Log.LogError((object)"Failed to load custom assets."); return; } Item val = AmmoTinAssets.LoadAsset<Item>("Assets/Prefab/AmmoTin.asset"); Item val2 = AmmoTinAssets.LoadAsset<Item>("Assets/Prefab/AmmoTinScrap.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("2-Scrap", "Allow Ammo Tin to be Scrap", false, "Setting this to true will add it to scrap lists for all moons.").Value; int value2 = ((BaseUnityPlugin)this).Config.Bind<int>("2-Scrap", "Ammo Tin Default Rarity", 5, "What Weighted Value does this have.").Value; int value3 = ((BaseUnityPlugin)this).Config.Bind<int>("2-Scrap", "Ammo Tin Min", 65, "Min Scrap value.").Value; int value4 = ((BaseUnityPlugin)this).Config.Bind<int>("2-Scrap", "Ammo Tin Max", 215, "Max Scrap value.").Value; int value5 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Experimentation Rarity", -1, "What Weighted Value does this have for Moon Experimentation If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value6 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Assurance Rarity", -1, "What Weighted Value does this have for Moon Assurance If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value7 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Vow Rarity", -1, "What Weighted Value does this have for Moon Vow If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value8 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Offense Rarity", -1, "What Weighted Value does this have for Moon Offense If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value9 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin March Rarity", -1, "What Weighted Value does this have for Moon March If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value10 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Adamance Rarity", -1, "What Weighted Value does this have for Moon Adamance If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value11 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Rend Rarity", -1, "What Weighted Value does this have for Moon Rend If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value12 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Dine Rarity", -1, "What Weighted Value does this have for Moon Dine If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value13 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Titan Rarity", -1, "What Weighted Value does this have for Moon Titan If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value14 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Embrion Rarity", -1, "What Weighted Value does this have for Moon Embrion If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value15 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Artifice Rarity", -1, "What Weighted Value does this have for Moon Artifice If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; int value16 = ((BaseUnityPlugin)this).Config.Bind<int>("3-Moon Rarity", "Ammo Tin Modded Moons Rarity", -1, "What Weighted Value does this have for Modded Moons If set to -1 defualt is used, if set to 0 it won't spawn here.").Value; if (value) { val2.minValue = value3; val2.maxValue = value4; if (value5 != 0) { Items.RegisterScrap(val2, (value5 < 0) ? value2 : value5, (LevelTypes)4); } if (value6 != 0) { Items.RegisterScrap(val2, (value6 < 0) ? value2 : value6, (LevelTypes)8); } if (value7 != 0) { Items.RegisterScrap(val2, (value7 < 0) ? value2 : value7, (LevelTypes)16); } if (value8 != 0) { Items.RegisterScrap(val2, (value8 < 0) ? value2 : value8, (LevelTypes)32); } if (value9 != 0) { Items.RegisterScrap(val2, (value9 < 0) ? value2 : value9, (LevelTypes)64); } if (value10 != 0) { Items.RegisterScrap(val2, (value10 < 0) ? value2 : value10, (LevelTypes)2048); } if (value11 != 0) { Items.RegisterScrap(val2, (value11 < 0) ? value2 : value11, (LevelTypes)128); } if (value12 != 0) { Items.RegisterScrap(val2, (value12 < 0) ? value2 : value12, (LevelTypes)256); } if (value13 != 0) { Items.RegisterScrap(val2, (value13 < 0) ? value2 : value13, (LevelTypes)512); } if (value14 != 0) { Items.RegisterScrap(val2, (value14 < 0) ? value2 : value14, (LevelTypes)8192); } if (value15 != 0) { Items.RegisterScrap(val2, (value15 < 0) ? value2 : value15, (LevelTypes)4096); } if (value16 != 0) { Items.RegisterScrap(val2, (value16 < 0) ? value2 : value16, (LevelTypes)1024); } } bool value17 = ((BaseUnityPlugin)this).Config.Bind<bool>("1-Shop", "Ammo Tin In Shop", true, "Is it possible to buy the Ammo Tin from the shop.").Value; int value18 = ((BaseUnityPlugin)this).Config.Bind<int>("1-Shop", "Ammo Tin Price", 600, "Price of the Ammo Tin in the shop.").Value; int num = value18; if (value17) { TerminalNode val3 = AmmoTinAssets.LoadAsset<TerminalNode>("Assets/Terminal/WI.asset"); Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val3, num); } maxShotgunReloads = ((BaseUnityPlugin)this).Config.Bind<int>("0-Reloads", "Total Shotgun Reloads from Full Ammo Tin", 8, "If an Ammo Tin is full, this is the possible amount of reloads you can get.").Value; shotgunDrainCost = 1f / (float)maxShotgunReloads; _Harmony.PatchAll(); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; } }
BepInEx/plugins/ZoLoKinoBabo112/AmmoTinPVCom.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using PiggyVarietyMod.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalCompanyAmmoTinPiggyVarietyCompat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalCompanyAmmoTinPiggyVarietyCompat")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dfc547b3-8844-42f7-aeba-ed1788a8bbc7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LethalCompanyAmmoTinPiggyVarietyCompat; [HarmonyPatch(typeof(M4Item))] public class M4ItemPatches { [HarmonyPatch("ReloadedGun")] [HarmonyPostfix] public static void Postfix(M4Item __instance, ref bool __result) { if (__result) { return; } for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy.ItemSlots[i] != (Object)null && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].itemProperties.itemName == "Ammo Tin" && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery.charge >= ModAmmoTinPVComMain.m4DrainCost) { Battery insertedBattery = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery; insertedBattery.charge -= ModAmmoTinPVComMain.m4DrainCost; __result = true; __instance.ammoSlotToUse = 100; break; } } } } [BepInPlugin("htd.lethalcompany.ammotinPVCom", "Ammo Tin Piggys Variety Compatability", "1.0.1")] public class ModAmmoTinPVComMain : BaseUnityPlugin { public const string Version = "1.0.1"; public const string ModName = "Ammo Tin Piggys Variety Compatability"; public const string GUID = "htd.lethalcompany.ammotinPVCom"; private Harmony _Harmony = new Harmony("htd.lethalcompany.ammotinPVCom"); public static ManualLogSource Log; public static int maxM4Reloads = 2; public static float m4DrainCost = 1f / (float)maxM4Reloads; public static int maxRevolverReloads = 12; public static float revolverDrainCost = 1f / (float)maxRevolverReloads; private void Awake() { maxM4Reloads = ((BaseUnityPlugin)this).Config.Bind<int>("Reloads", "Total M4(Rifle) Reloads from Full Ammo Tin", 2, "If an Ammo Tin is full, this is the possible amount of reloads you can get.").Value; m4DrainCost = 1f / (float)maxM4Reloads; maxRevolverReloads = ((BaseUnityPlugin)this).Config.Bind<int>("Reloads", "Total Revolver Reloads from Full Ammo Tin", 12, "If an Ammo Tin is full, this is the possible amount of reloads you can get.").Value; revolverDrainCost = 1f / (float)maxRevolverReloads; _Harmony.PatchAll(); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; } } [HarmonyPatch(typeof(RevolverItem))] public class RevolverItemPatches { [HarmonyPatch("ReloadedGun")] [HarmonyPostfix] public static void Postfix(RevolverItem __instance, ref bool __result) { if (__result) { return; } for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy.ItemSlots[i] != (Object)null && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].itemProperties.itemName == "Ammo Tin" && ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery.charge >= ModAmmoTinPVComMain.revolverDrainCost) { Battery insertedBattery = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i].insertedBattery; insertedBattery.charge -= ModAmmoTinPVComMain.revolverDrainCost; __result = true; __instance.ammoSlotToUse = 100; break; } } } }
BepInEx/plugins/ZoLoKinoBabo112/BagConfig.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BagConfig.Dependency; using BagConfig.Patches; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using HarmonyLib.Public.Patching; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.RuntimeDetour; using MonoMod.Utils; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("BagConfig")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.0.5")] [assembly: AssemblyInformationalVersion("0.0.5-beta+e7d81f5a424d08fe51b7d90704f57c344c149b36")] [assembly: AssemblyProduct("BagConfig")] [assembly: AssemblyTitle("BagConfig - My Assembly Title")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BagConfig { [BepInPlugin("mattymatty.BagConfig", "BagConfig", "0.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class BagConfig : BaseUnityPlugin { internal static readonly ISet<Hook> Hooks = new HashSet<Hook>(); internal static readonly Harmony Harmony = new Harmony("mattymatty.BagConfig"); public const string GUID = "mattymatty.BagConfig"; public const string NAME = "BagConfig"; public const string VERSION = "0.0.5"; internal static ManualLogSource Log; public static BagConfig INSTANCE { get; private set; } private void Awake() { INSTANCE = this; Log = ((BaseUnityPlugin)this).Logger; try { if (LobbyCompatibilityChecker.Enabled) { LobbyCompatibilityChecker.Init(); } Log.LogInfo((object)"Initializing Configs"); PluginConfig.Init(); Log.LogInfo((object)"Patching Methods"); PatchLateJoin.Init(); Harmony.PatchAll(); BeltBagPatch.Patch(); Log.LogInfo((object)"BagConfig v0.0.5 Loaded!"); } catch (Exception ex) { Log.LogError((object)("Exception while initializing: \n" + ex)); } } } internal static class PluginConfig { public static class Misc { public static ConfigEntry<bool> Tooltip { get; internal set; } public static ConfigEntry<bool> DropAll { get; internal set; } public static ConfigEntry<bool> HideBag { get; internal set; } public static ConfigEntry<float> GrabRange { get; internal set; } } public static class Host { public static ConfigEntry<bool> Capacity { get; internal set; } public static ConfigEntry<bool> Category { get; internal set; } public static ConfigEntry<bool> Range { get; internal set; } } public static class Limits { public static StringDictionary ItemCategoryAssociations = new StringDictionary(); public static readonly Dictionary<string, ICategoryConfig> CategoryConfigs = new Dictionary<string, ICategoryConfig>(); public static ConfigEntry<int> Capacity { get; internal set; } public static ConfigEntry<string> ItemCategories { get; internal set; } } public interface ICategoryConfig { string CategoryName { get; } bool Allow { get; } int Limit { get; } } public class StaticCategoryConfig : ICategoryConfig { public string CategoryName { get; } public bool Allow { get; } public int Limit { get; } public StaticCategoryConfig(string categoryName, bool allow, int limit) { CategoryName = categoryName; Allow = allow; Limit = limit; } } public class BepInExCategoryConfig : ICategoryConfig { private readonly ConfigEntry<bool> _allowConfig; private readonly ConfigEntry<int> _limitConfig; public string CategoryName { get; } public bool Allow => _allowConfig.Value; public int Limit => _limitConfig.Value; public BepInExCategoryConfig(string categoryName, bool allow = false, int max = -1) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown CategoryName = categoryName; _allowConfig = ((BaseUnityPlugin)BagConfig.INSTANCE).Config.Bind<bool>("Limit." + CategoryName, "Allow", allow, new ConfigDescription("Allow grabbing this category!", (AcceptableValueBase)null, Array.Empty<object>())); _limitConfig = ((BaseUnityPlugin)BagConfig.INSTANCE).Config.Bind<int>("Limit." + CategoryName, "Max Amount", max, new ConfigDescription("How many items of this category can be stored at the same time?", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, Limits.Capacity?.Value ?? int.MaxValue), Array.Empty<object>())); if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(_allowConfig); LethalConfigProxy.AddConfig(_limitConfig); } } } private const string ToolsCategory = "Tools"; private const string DenyCategory = "Deny"; private const string OneHandedCategory = "One Handed Scrap"; private const string TwoHandedCategory = "Two Handed Scrap"; internal static void Init() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)BagConfig.INSTANCE).Config; Misc.Tooltip = config.Bind<bool>("Miscellaneous", "Tooltip", true, "Show a tooltip if the target item cannot be stored"); Misc.DropAll = config.Bind<bool>("Miscellaneous", "Add Empty Bag Action", true, "Add action to Drop the entire bag inventory"); Misc.HideBag = config.Bind<bool>("Miscellaneous", "Hide Bag When Pocketed", false, "Hide the bag when in pocket ( also disables opening it by looking down )"); Misc.GrabRange = config.Bind<float>("Miscellaneous", "Grab Range", 4f, new ConfigDescription("Max range for grabbing items with the bag", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>())); Host.Capacity = config.Bind<bool>("Host Settings", "Enforce Capacity", true, "Server-side check to limit the bag Capacity"); Host.Category = config.Bind<bool>("Host Settings", "Enforce Restrictions", true, "Server-side check to limit the items allowed inside the Bag"); Host.Range = config.Bind<bool>("Host Settings", "Enforce Range", true, "Server-side check to limit the grab range"); Limits.Capacity = config.Bind<int>("Limits", "Capacity", 15, new ConfigDescription("How many items can the bag store", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>())); Limits.ItemCategories = config.Bind<string>("Limits", "Item Categories", "Body: Deny", new ConfigDescription("Dictionary describing the association between a Item and a Category name", (AcceptableValueBase)null, Array.Empty<object>())); Limits.CategoryConfigs["Tools"] = new BepInExCategoryConfig("Tools", allow: true); Limits.CategoryConfigs["One Handed Scrap"] = new BepInExCategoryConfig("One Handed Scrap"); Limits.CategoryConfigs["Two Handed Scrap"] = new BepInExCategoryConfig("Two Handed Scrap"); Limits.CategoryConfigs["Deny"] = new StaticCategoryConfig("Deny", allow: false, 0); ProcessCategories(Limits.ItemCategories); Limits.ItemCategories.SettingChanged += delegate { ProcessCategories(Limits.ItemCategories); }; if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(Misc.Tooltip); LethalConfigProxy.AddConfig(Misc.DropAll, requiresRestart: true); LethalConfigProxy.AddConfig(Misc.HideBag); LethalConfigProxy.AddConfig(Misc.GrabRange); LethalConfigProxy.AddConfig(Limits.Capacity); LethalConfigProxy.AddConfig(Limits.ItemCategories); LethalConfigProxy.AddConfig(Host.Capacity); LethalConfigProxy.AddConfig(Host.Category); LethalConfigProxy.AddConfig(Host.Range); } CleanAndSave(); static void ProcessCategories(ConfigEntry<string> entry) { Limits.ItemCategoryAssociations = ProcessDictionary(entry); foreach (string value3 in Limits.ItemCategoryAssociations.Values) { if (!Limits.CategoryConfigs.ContainsKey(value3)) { Limits.CategoryConfigs[value3] = new BepInExCategoryConfig(value3, allow: true); } } } static StringDictionary ProcessDictionary(ConfigEntry<string> entry) { string value = entry.Value; StringDictionary stringDictionary = new StringDictionary(); string[] array = value.Split(","); foreach (string text in array) { string text2 = text.Trim(); string[] array2 = text2.Split(":"); if (array2.Length != 2) { BagConfig.Log.LogError((object)("Item Association: malformed Entry! " + text2)); } else { string text3 = array2[0].Trim(); string value2 = array2[1].Trim(); if (stringDictionary.ContainsKey(text3)) { BagConfig.Log.LogWarning((object)("Item Association: " + text3 + " was already defined - overwriting!")); } stringDictionary[text3] = value2; } } return stringDictionary; } } internal static void CleanAndSave() { ConfigFile config = ((BaseUnityPlugin)BagConfig.INSTANCE).Config; PropertyInfo propertyInfo = AccessTools.Property(((object)config).GetType(), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config, null); dictionary.Clear(); config.Save(); } public static ICategoryConfig GetBagCategory(this GrabbableObject grabbable) { if (Limits.ItemCategoryAssociations.ContainsKey(grabbable.itemProperties.itemName)) { return Limits.CategoryConfigs[Limits.ItemCategoryAssociations[grabbable.itemProperties.itemName]]; } bool isScrap = grabbable.itemProperties.isScrap; bool twoHanded = grabbable.itemProperties.twoHanded; if (!isScrap) { return Limits.CategoryConfigs["Tools"]; } if (!twoHanded) { return Limits.CategoryConfigs["One Handed Scrap"]; } return Limits.CategoryConfigs["Two Handed Scrap"]; } } public static class Utils { private static readonly MethodInfo BeginSendClientRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendClientRpc", (Type[])null, (Type[])null); private static readonly MethodInfo BeginSendServerRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendServerRpc", (Type[])null, (Type[])null); internal static bool TryGetRpcID(MethodInfo methodInfo, out uint rpcID) { //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Collection<Instruction> instructions = PatchManager.GetMethodPatcher((MethodBase)methodInfo).CopyOriginal().Definition.Body.Instructions; rpcID = 0u; for (int i = 0; i < instructions.Count; i++) { if (instructions[i].OpCode == OpCodes.Ldc_I4 && instructions[i - 1].OpCode == OpCodes.Ldarg_0) { rpcID = (uint)(int)instructions[i].Operand; } if (!(instructions[i].OpCode != OpCodes.Call)) { object operand = instructions[i].Operand; MethodReference val = (MethodReference)((operand is MethodReference) ? operand : null); if (val != null && (Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendClientRpc) || Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendServerRpc))) { BagConfig.Log.LogDebug((object)$"Rpc Id found for {methodInfo.Name}: {rpcID}U"); return true; } } } BagConfig.Log.LogFatal((object)("Cannot find Rpc ID for " + methodInfo.Name)); return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "mattymatty.BagConfig"; public const string PLUGIN_NAME = "BagConfig"; public const string PLUGIN_VERSION = "0.0.5"; } } namespace BagConfig.Patches { [HarmonyPatch] internal static class BeltBagPatch { private class CategoryCount { public int Count; } private static readonly Action<GrabbableObject, bool> BaseInteractMethod; private static readonly ConditionalWeakTable<BeltBagItem, ConditionalWeakTable<PluginConfig.ICategoryConfig, CategoryCount>> CategoryMemory; internal static void Patch() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(BeltBagItem), "ItemInteractLeftRight", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(BeltBagPatch), "OverrideGrab", (Type[])null, (Type[])null); BagConfig.Hooks.Add(new Hook((MethodBase)methodInfo, methodInfo2, new HookConfig { Priority = -999 })); } static BeltBagPatch() { CategoryMemory = new ConditionalWeakTable<BeltBagItem, ConditionalWeakTable<PluginConfig.ICategoryConfig, CategoryCount>>(); MethodInfo meth = AccessTools.Method(typeof(GrabbableObject), "ItemInteractLeftRight", (Type[])null, (Type[])null); DynamicMethod dynamicMethod = new DynamicMethod("Base.ItemInteractLeftRight", null, new Type[2] { typeof(GrabbableObject), typeof(bool) }, typeof(BeltBagItem)); ILGenerator iLGenerator = dynamicMethod.GetILGenerator(); iLGenerator.Emit(OpCodes.Ldarg_0); iLGenerator.Emit(OpCodes.Ldarg_1); iLGenerator.Emit(OpCodes.Call, meth); iLGenerator.Emit(OpCodes.Ret); BaseInteractMethod = (Action<GrabbableObject, bool>)dynamicMethod.CreateDelegate(typeof(Action<GrabbableObject, bool>)); } private static IEnumerator EmptyBagCoroutine(BeltBagItem @this) { while (@this.objectsInBag.Count > 0) { @this.RemoveObjectFromBag(0); yield return (object)new WaitForEndOfFrame(); } } private static void OverrideGrab(Action<BeltBagItem, bool> orig, BeltBagItem @this, bool right) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) BaseInteractMethod((GrabbableObject)(object)@this, right); if (right) { if (PluginConfig.Misc.DropAll.Value) { ((MonoBehaviour)@this).StartCoroutine(EmptyBagCoroutine(@this)); } } else { if ((Object)(object)((GrabbableObject)@this).playerHeldBy == (Object)null || @this.tryingAddToBag) { return; } if (@this.objectsInBag.Count >= PluginConfig.Limits.Capacity.Value) { if (PluginConfig.Misc.Tooltip.Value) { HUDManager.Instance.DisplayTip("Belt bag Info", "This bag is Full!", false, false, "LC_Tip1"); } } else { RaycastHit val = default(RaycastHit); if (!Physics.Raycast(((Component)((GrabbableObject)@this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)@this).playerHeldBy.gameplayCamera).transform.forward, ref val, PluginConfig.Misc.GrabRange.Value, GameNetworkManager.Instance.localPlayerController.interactableObjectsMask)) { return; } ManualLogSource log = BagConfig.Log; Transform parent = ((Component)((RaycastHit)(ref val)).collider).transform.parent; log.LogDebug((object)("Grab Hit: " + ((parent != null) ? ((Object)parent).name : null) + "." + ((Object)((Component)((RaycastHit)(ref val)).collider).gameObject).name)); if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref val)).collider).tag != "PhysicsProp") { return; } GrabbableObject component = ((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<GrabbableObject>(); if (!@this.CanBePutInBag(component)) { return; } if (@this.CheckBagFilters(component, out var limited, out var disallowed)) { @this.TryAddObjectToBag(component); } else if (PluginConfig.Misc.Tooltip.Value) { if (!disallowed && limited) { PluginConfig.ICategoryConfig bagCategory = component.GetBagCategory(); HUDManager.Instance.DisplayTip("Belt bag Info", "Cannot store any more " + bagCategory.CategoryName + " inside of the bag!", false, false, "LC_Tip1"); } else { HUDManager.Instance.DisplayTip("Belt bag Info", "Cannot store " + component.itemProperties.itemName + " inside of the bag!", false, false, "LC_Tip1"); } } } } } private static bool CanBePutInBag(this BeltBagItem @this, GrabbableObject grabbable) { if (Object.op_Implicit((Object)(object)grabbable) && (Object)(object)grabbable != (Object)(object)@this && !grabbable.isHeld && !grabbable.isHeldByEnemy) { return grabbable.itemProperties.itemId != 123984; } return false; } private static bool CheckBagFilters(this BeltBagItem @this, GrabbableObject grabbable, out bool limited, out bool disallowed) { limited = false; PluginConfig.ICategoryConfig bagCategory = grabbable.GetBagCategory(); disallowed = !bagCategory.Allow; int limit = bagCategory.Limit; if (limit < 0) { return !disallowed; } if (limit == 0) { limited = true; return false; } ConditionalWeakTable<PluginConfig.ICategoryConfig, CategoryCount> orCreateValue = CategoryMemory.GetOrCreateValue(@this); if (orCreateValue.TryGetValue(bagCategory, out var value) && value.Count >= limit) { limited = true; return false; } return !disallowed; } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void AddBagTooltip(StartOfRound __instance) { if (!PluginConfig.Misc.DropAll.Value) { return; } BeltBagItem val = default(BeltBagItem); foreach (Item items in __instance.allItemsList.itemsList) { if (Object.op_Implicit((Object)(object)items.spawnPrefab) && items.spawnPrefab.TryGetComponent<BeltBagItem>(ref val)) { Array.Resize(ref items.toolTips, items.toolTips.Length + 1); items.toolTips[^1] = "Empty Bag: [E]"; break; } } } [HarmonyPostfix] [HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")] private static void TriggerHeldActions(BeltBagItem __instance, GrabbableObject gObject) { LungProp val = (LungProp)(object)((gObject is LungProp) ? gObject : null); if (val != null) { if (val.isLungDocked) { val.isLungDocked = false; if (val.disconnectAnimation != null) { ((MonoBehaviour)val).StopCoroutine(val.disconnectAnimation); } val.disconnectAnimation = ((MonoBehaviour)val).StartCoroutine(val.DisconnectFromMachinery()); } if (val.isLungDockedInElevator) { val.isLungDockedInElevator = false; ((Component)val).gameObject.GetComponent<AudioSource>().PlayOneShot(val.disconnectSFX); } } if (!((GrabbableObject)__instance).hasBeenHeld) { ((GrabbableObject)__instance).hasBeenHeld = true; if (!((GrabbableObject)__instance).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { RoundManager instance = RoundManager.Instance; instance.valueOfFoundScrapItems += ((GrabbableObject)__instance).scrapValue; } } } [HarmonyPostfix] [HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")] private static void TrackAdd(BeltBagItem __instance, GrabbableObject gObject) { PluginConfig.ICategoryConfig bagCategory = gObject.GetBagCategory(); ConditionalWeakTable<PluginConfig.ICategoryConfig, CategoryCount> orCreateValue = CategoryMemory.GetOrCreateValue(__instance); orCreateValue.GetOrCreateValue(bagCategory).Count++; } [HarmonyPostfix] [HarmonyPatch(typeof(BeltBagItem), "RemoveFromBagLocalClientNonElevatorParent")] [HarmonyPatch(typeof(BeltBagItem), "RemoveFromBagLocalClient")] private static void TrackRemove(BeltBagItem __instance, NetworkObjectReference objectRef) { ConditionalWeakTable<PluginConfig.ICategoryConfig, CategoryCount> orCreateValue = CategoryMemory.GetOrCreateValue(__instance); NetworkObject val = default(NetworkObject); GrabbableObject grabbable = default(GrabbableObject); if (((NetworkObjectReference)(ref objectRef)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent<GrabbableObject>(ref grabbable)) { PluginConfig.ICategoryConfig bagCategory = grabbable.GetBagCategory(); orCreateValue.GetOrCreateValue(bagCategory).Count--; } if (__instance.objectsInBag.Count == 0) { orCreateValue.Clear(); } } [HarmonyPrefix] [HarmonyPatch(typeof(BeltBagItem), "TryAddObjectToBagServerRpc")] private static bool EnforceLimits(BeltBagItem __instance, NetworkObjectReference netObjectRef, int playerWhoAdded) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return true; } if ((int)((NetworkBehaviour)__instance).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return true; } NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val, (NetworkManager)null)) { return true; } GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>(); if (!__instance.CanBePutInBag(component)) { __instance.CancelAddObjectToBagClientRpc(playerWhoAdded); return false; } if (PluginConfig.Host.Capacity.Value && __instance.objectsInBag.Count >= PluginConfig.Limits.Capacity.Value) { __instance.CancelAddObjectToBagClientRpc(playerWhoAdded); return false; } if (PluginConfig.Host.Category.Value && !__instance.CheckBagFilters(component, out var _, out var _)) { __instance.CancelAddObjectToBagClientRpc(playerWhoAdded); return false; } if (PluginConfig.Host.Range.Value) { Vector3 position = ((Component)component).transform.position; PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (Vector3.Distance(position, (playerHeldBy != null) ? ((Component)playerHeldBy.gameplayCamera).transform.position : Vector3.positiveInfinity) > PluginConfig.Misc.GrabRange.Value) { __instance.CancelAddObjectToBagClientRpc(playerWhoAdded); return false; } } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(BeltBagItem), "CancelAddObjectToBagClientRpc")] private static void OnServerRefusal(int playerWhoAdded) { if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerWhoAdded] != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { HUDManager.Instance.DisplayTip("Belt bag Info", "Host refused your grab request!", true, false, "LC_Tip1"); } } [HarmonyTranspiler] [HarmonyPatch(typeof(BeltBagItem), "RemoveObjectFromBag")] private static IEnumerable<CodeInstruction> FixDrop(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(GrabbableObject), "GetItemFloorPosition", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(BeltBagPatch), "FixVerticalOffset", (Type[])null, (Type[])null); CodeMatcher val = new CodeMatcher((IEnumerable<CodeInstruction>)list, ilGenerator); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo, (string)null) }); if (val.IsInvalid) { BagConfig.Log.LogError((object)"Patch RemoveObjectFromBag, Fail - 1 "); return list; } val.Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_1, (object)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)methodInfo2) }); return val.Instructions(); } private static Vector3 FixVerticalOffset(Vector3 position, BeltBagItem beltBagItem, int index) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0025: Unknown result type (might be due to invalid IL or missing references) if (beltBagItem.objectsInBag.Count <= index) { return position; } GrabbableObject val = beltBagItem.objectsInBag[index]; if (!Object.op_Implicit((Object)(object)val)) { return position; } position += Vector3.down * ((GrabbableObject)beltBagItem).itemProperties.verticalOffset; position += Vector3.up * val.itemProperties.verticalOffset; return position; } [HarmonyPostfix] [HarmonyPatch(typeof(BeltBagItem), "PocketItem")] private static void HideWhenInPocket(BeltBagItem __instance) { if (((NetworkBehaviour)__instance).IsOwner && PluginConfig.Misc.HideBag.Value) { ((Component)__instance.useBagTrigger).GetComponent<Collider>().enabled = false; ((GrabbableObject)__instance).EnableItemMeshes(false); } } } internal static class PatchLateJoin { private static uint _tryAddObjectToBagClientRpc; internal static void Init() { MethodInfo methodInfo = AccessTools.Method(typeof(BeltBagItem), "TryAddObjectToBagClientRpc", (Type[])null, (Type[])null); if (!Utils.TryGetRpcID(methodInfo, out _tryAddObjectToBagClientRpc)) { throw new MissingMemberException("BeltBagItem", "TryAddObjectToBagClientRpc"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "SyncAlreadyHeldObjectsClientRpc")] private static void SyncItemsInBags(StartOfRound __instance, NetworkObjectReference[] gObjects, int joiningClientId) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } NetworkObject val2 = default(NetworkObject); BeltBagItem val3 = default(BeltBagItem); for (int i = 0; i < gObjects.Length; i++) { NetworkObjectReference val = gObjects[i]; if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) || !((Component)val2).TryGetComponent<BeltBagItem>(ref val3)) { continue; } foreach (GrabbableObject item in val3.objectsInBag) { NetworkObjectReference val4 = NetworkObjectReference.op_Implicit(((NetworkBehaviour)item).NetworkObject); ClientRpcParams val5 = default(ClientRpcParams); val5.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlyArray<ulong>(new ulong[1] { (ulong)joiningClientId }) }; ClientRpcParams val6 = val5; FastBufferWriter val7 = ((NetworkBehaviour)val3).__beginSendClientRpc(_tryAddObjectToBagClientRpc, val6, (RpcDelivery)0); ((FastBufferWriter)(ref val7)).WriteValueSafe<NetworkObjectReference>(ref val4, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val7, ((GrabbableObject)val3).playerHeldBy.actualClientId); ((NetworkBehaviour)val3).__endSendClientRpc(ref val7, _tryAddObjectToBagClientRpc, val6, (RpcDelivery)0); } } } } } namespace BagConfig.Dependency { public static class LethalConfigProxy { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<string> entry, bool requiresRestart = false) { //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_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(entry, new TextInputFieldOptions { RequiresRestart = requiresRestart })); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<bool> entry, bool requiresRestart = false) { //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_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(entry, new BoolCheckBoxOptions { RequiresRestart = requiresRestart })); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<float> entry, bool requiresRestart = false) { //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_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(entry, new FloatInputFieldOptions { RequiresRestart = requiresRestart })); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<int> entry, bool requiresRestart = false) { //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_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(entry, new IntInputFieldOptions { RequiresRestart = requiresRestart })); } } public static class LobbyCompatibilityChecker { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { PluginHelper.RegisterPlugin("mattymatty.BagConfig", Version.Parse("0.0.5"), (CompatibilityLevel)0, (VersionStrictness)2); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }
BepInEx/plugins/ZoLoKinoBabo112/BetterSpectate.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterSpectate.Compatibility; using BetterSpectate.Patches; using GameNetcodeStuff; using HarmonyLib; using SpectateEnemy; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterSpectate")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterSpectate")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("89d76a0b-65c7-4246-8645-3d523e10258e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterSpectate { public class BetterSpectateAPI { public bool isModLoaded => (Object)(object)BetterSpectateBase.instance != (Object)null; public bool isFirstPersonSpectateEnabled => PlayerControllerB_Patch.GetFirstPersonEnabled(); public bool isZoomEnabled => PlayerControllerB_Patch.GetZoomEnabled(); public bool isFirstPersonSpectating => PlayerControllerB_Patch.IsPlayerInFirstPerson(); public float zoomDistance => PlayerControllerB_Patch.GetZoomDistance(); public float zoomSpeed => PlayerControllerB_Patch.GetZoomSpeed(); public float maxZoom => SpectateUtils.GetMaxZoom(); public float minZoom => SpectateUtils.GetMinZoom(); } public class ConfigSetup { private const string CONFIG_FILE_NAME = "Fusition.BetterSpectate"; private static ConfigFile config; private ConfigEntry<bool> isZoomEnabled; private ConfigEntry<float> maxZoomDistance; private ConfigEntry<float> minZoomDistance; private ConfigEntry<float> defaultZoomDistance; private ConfigEntry<float> zoomSpeed; private ConfigEntry<bool> isFirstPersonEnabled; private ConfigEntry<bool> isFirstPersonDefault; private ConfigEntry<string> firstPersonKeybind; public static void Initialize() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "Fusition.BetterSpectate.cfg"); config = new ConfigFile(text, true); ConfigEntry<bool> val = config.Bind<bool>("Zoom Settings", "Third Person Zoom Enabled", true, "Allows spectators to zoom in and out."); ConfigEntry<float> val2 = config.Bind<float>("Zoom Settings", "Max Zoom Distance", 15f, "Furthest distance a spectator can zoom out."); ConfigEntry<float> val3 = config.Bind<float>("Zoom Settings", "Min Zoom Distance", 1f, "Closest distance a spectator can zoom in."); ConfigEntry<float> val4 = config.Bind<float>("Zoom Settings", "Default Zoom Distance", 1.4f, "Distance a spectator is set upon death."); ConfigEntry<float> val5 = config.Bind<float>("Zoom Settings", "Zoom Speed", 0.4f, "Speed that scrolling will zoom in or out."); ConfigEntry<bool> val6 = config.Bind<bool>("General Settings", "First Person Spectate Enabled", true, "Allows spectators to enter a first person view."); ConfigEntry<bool> val7 = config.Bind<bool>("General Settings", "Default to First Person", true, "Defaults players to a first person view on death."); ConfigEntry<string> val8 = config.Bind<string>("General Settings", "First Person Keybind", "P", "Sets the keybind to switch between perspectives."); PlayerControllerB_Patch.SetFirstPersonEnabled(val6.Value); PlayerControllerB_Patch.SetFirstPersonToggle(val7.Value); PlayerControllerB_Patch.InitializeFirstPersonSpectateInputAction("<Keyboard>/" + val8.Value); PlayerControllerB_Patch.SetZoomEnabled(val.Value); PlayerControllerB_Patch.SetZoomDistance(val4.Value); PlayerControllerB_Patch.SetDefaultZoomDistance(val4.Value); PlayerControllerB_Patch.SetZoomSpeed(val5.Value); SpectateUtils.SetMaxZoom(val2.Value); SpectateUtils.SetMinZoom(val3.Value); } } [BepInPlugin("Fusition.BetterSpectate", "BetterSpectate", "1.0.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BetterSpectateBase : BaseUnityPlugin { public const string MOD_GUID = "Fusition.BetterSpectate"; private const string MOD_NAME = "BetterSpectate"; private const string MOD_VERS = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Fusition.BetterSpectate"); public static BetterSpectateBase instance; internal static ManualLogSource fusLogSource; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; fusLogSource = Logger.CreateLogSource("Fusition.BetterSpectate"); fusLogSource.LogInfo((object)SpectateEnemyCompat.enabled); ConfigSetup.Initialize(); harmony.PatchAll(typeof(PlayerControllerB_Patch)); harmony.PatchAll(typeof(StartOfRound_Patch)); } } } namespace BetterSpectate.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerB_Patch { private static bool isZoomEnabled; private static float zoomDistance = 1.4f; private static float zoomSpeed = 0.4f; private static float defaultZoomDistance; private static bool isFirstPersonEnabled; private static InputAction firstPersonSpectateAction; private static bool firstPersonSpectateToggle = false; private static bool isInFirstPerson = false; private static bool inputDisabledForCompat = false; [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] public static void LateUpdate_Patch(PlayerControllerB __instance) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)__instance.spectatedPlayerScript != (Object)null) { if (__instance.spectatedPlayerScript.isHoldingObject) { __instance.spectatedPlayerScript.currentlyHeldObjectServer.parentObject = (firstPersonSpectateToggle ? ((Component)__instance.spectatedPlayerScript.localItemHolder).transform : ((Component)__instance.spectatedPlayerScript.serverItemHolder).transform); } if (UnityInput.Current.mouseScrollDelta.y != 0f && isZoomEnabled) { ((Renderer)__instance.thisPlayerModel).enabled = false; SetZoomDistance((zoomDistance + UnityInput.Current.mouseScrollDelta.y / -120f * zoomSpeed).ZoomClamp()); } if (SpectateEnemyCompat.enabled) { SpectateEnemyCompat.CheckIfSpectatingEnemies(); } if (!inputDisabledForCompat && firstPersonSpectateAction.WasPressedThisFrame()) { SwitchPerspective(__instance); } } } [HarmonyPatch(typeof(PlayerControllerB), "RaycastSpectateCameraAroundPivot")] [HarmonyPrefix] public static bool RaycastSpectateCameraAroundPivot_Patch(PlayerControllerB __instance, RaycastHit ___hit, int ___walkableSurfacesNoPlayersMask) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.spectatedPlayerScript != (Object)null) { Transform transform = ((Component)__instance.spectatedPlayerScript.visorCamera).transform; if (isFirstPersonEnabled && firstPersonSpectateToggle) { ((Component)__instance.playersManager.spectateCamera).transform.position = transform.position; ((Component)__instance.playersManager.spectateCamera).transform.rotation = transform.rotation; isInFirstPerson = true; } else if (isZoomEnabled) { RaycastCameraToZoomDistance(__instance, ___hit, ___walkableSurfacesNoPlayersMask); } return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")] [HarmonyPrefix] public static bool SpectateNextPlayer_Patch(PlayerControllerB __instance, RaycastHit ___hit, int ___walkableSurfacesNoPlayersMask) { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) int num = 0; if ((Object)(object)__instance.spectatedPlayerScript != (Object)null) { num = (int)__instance.spectatedPlayerScript.playerClientId; if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { SetModelVisibilityForThirdPerson(__instance.spectatedPlayerScript); } } for (int i = 0; i < __instance.playersManager.allPlayerScripts.Length; i++) { num = (num + 1) % __instance.playersManager.allPlayerScripts.Length; if (__instance.playersManager.allPlayerScripts[num].isPlayerDead || !__instance.playersManager.allPlayerScripts[num].isPlayerControlled || !((Object)(object)__instance.playersManager.allPlayerScripts[num] != (Object)(object)__instance)) { continue; } __instance.spectatedPlayerScript = __instance.playersManager.allPlayerScripts[num]; if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { if (!firstPersonSpectateToggle) { BetterSpectateBase.fusLogSource.LogInfo((object)"Model visibility adjusted for dead player in third person"); SetModelVisibilityForThirdPerson(__instance.spectatedPlayerScript); } else { BetterSpectateBase.fusLogSource.LogInfo((object)"Model visibility adjusted for dead player in first person"); SetModelVisibilityForFirstPerson(__instance.spectatedPlayerScript); } } __instance.SetSpectatedPlayerEffects(false); return false; } if ((Object)(object)__instance.deadBody != (Object)null && ((Component)__instance.deadBody).gameObject.activeSelf) { __instance.spectateCameraPivot.position = __instance.deadBody.bodyParts[0].position; RaycastSpectateCameraAroundPivot_Patch(__instance, ___hit, ___walkableSurfacesNoPlayersMask); } StartOfRound.Instance.SetPlayerSafeInShip(); return false; } public static void InitializeFirstPersonSpectateInputAction(string binding) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown firstPersonSpectateAction = new InputAction("FirstPersonSpectatePressed", (InputActionType)0, binding, (string)null, (string)null, (string)null); firstPersonSpectateAction.Enable(); } public static bool IsPlayerInFirstPerson() { return isInFirstPerson; } public static bool GetZoomEnabled() { return isZoomEnabled; } public static void SetZoomEnabled(bool enabled) { isZoomEnabled = true; } public static bool GetFirstPersonEnabled() { return isFirstPersonEnabled; } public static void SetFirstPersonEnabled(bool enabled) { isFirstPersonEnabled = true; } public static void SwitchPerspective(PlayerControllerB controller) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) firstPersonSpectateToggle = !firstPersonSpectateToggle; if (!firstPersonSpectateToggle) { BetterSpectateBase.fusLogSource.LogInfo((object)"Player Toggled to Third Person"); SetModelVisibilityForThirdPerson(controller.spectatedPlayerScript); ((Component)controller.spectateCameraPivot).transform.rotation = ((Component)controller.spectatedPlayerScript.visorCamera).transform.rotation; zoomDistance = defaultZoomDistance; } else { BetterSpectateBase.fusLogSource.LogInfo((object)"Player Toggled to First Person"); SetModelVisibilityForFirstPerson(controller.spectatedPlayerScript); } } public static void SetFirstPersonToggle(bool value) { firstPersonSpectateToggle = value; } public static void SetModelVisibilityForFirstPerson(PlayerControllerB controller) { ((Renderer)controller.thisPlayerModelArms).enabled = true; ((Renderer)controller.thisPlayerModel).enabled = false; ((Renderer)controller.thisPlayerModelLOD1).enabled = false; ((Renderer)controller.thisPlayerModelLOD2).enabled = false; } public static void SetModelVisibilityForThirdPerson(PlayerControllerB controller) { ((Renderer)controller.thisPlayerModelArms).enabled = false; ((Renderer)controller.thisPlayerModel).enabled = true; ((Renderer)controller.thisPlayerModelLOD1).enabled = true; ((Renderer)controller.thisPlayerModelLOD2).enabled = true; } public static float GetZoomDistance() { return zoomDistance; } public static void SetZoomDistance(float value) { zoomDistance = value; } public static void SetDefaultZoomDistance(float value) { defaultZoomDistance = value; } public static float GetZoomSpeed() { return zoomSpeed; } public static void SetZoomSpeed(float value) { zoomSpeed = value; } public static void SetInputDisabled(bool value) { inputDisabledForCompat = value; } private static void RaycastCameraToZoomDistance(PlayerControllerB controller, RaycastHit hit, int walkableSurfacesNoPlayersMask) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) Ray val = default(Ray); ((Ray)(ref val))..ctor(controller.spectateCameraPivot.position, -controller.spectateCameraPivot.forward); if (Physics.Raycast(val, ref hit, zoomDistance, walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1)) { ((Component)controller.playersManager.spectateCamera).transform.position = ((Ray)(ref val)).GetPoint(((RaycastHit)(ref hit)).distance - 0.25f); } else { ((Component)controller.playersManager.spectateCamera).transform.position = ((Ray)(ref val)).GetPoint(zoomDistance - 0.1f); } ((Component)controller.playersManager.spectateCamera).transform.LookAt(controller.spectateCameraPivot); } } internal static class SpectateUtils { private static float maxZoomDistance; private static float minZoomDistance; public static float ZoomClamp(this float value) { if (maxZoomDistance > minZoomDistance) { if (value > maxZoomDistance) { return maxZoomDistance; } if (value < minZoomDistance) { return minZoomDistance; } return value; } return PlayerControllerB_Patch.GetZoomDistance(); } public static float GetMaxZoom() { return maxZoomDistance; } public static void SetMaxZoom(float value) { maxZoomDistance = value; } public static float GetMinZoom() { return minZoomDistance; } public static void SetMinZoom(float value) { minZoomDistance = value; } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRound_Patch { [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] public static void ReviveDeadPlayers_Patch(PlayerControllerB[] ___allPlayerScripts) { for (int i = 0; i < ___allPlayerScripts.Length; i++) { if ((Object)(object)___allPlayerScripts[i] != (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((Renderer)___allPlayerScripts[i].thisPlayerModelArms).enabled = false; ((Renderer)___allPlayerScripts[i].thisPlayerModel).enabled = true; ((Renderer)___allPlayerScripts[i].thisPlayerModelLOD1).enabled = true; ((Renderer)___allPlayerScripts[i].thisPlayerModelLOD2).enabled = true; if (___allPlayerScripts[i].isHoldingObject) { ___allPlayerScripts[i].currentlyHeldObjectServer.parentObject = ((Component)___allPlayerScripts[i].serverItemHolder).transform; } } } } } } namespace BetterSpectate.Compatibility { public static class SpectateEnemyCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("SpectateEnemy"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void CheckIfSpectatingEnemies() { if (SpectateEnemiesAPI.IsLoaded && SpectateEnemiesAPI.IsSpectatingEnemies) { PlayerControllerB_Patch.SetFirstPersonToggle(value: false); PlayerControllerB_Patch.SetInputDisabled(value: true); } } } }
BepInEx/plugins/ZoLoKinoBabo112/BMX.LobbyCompatibility.dll
Decompiled 2 years 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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LobbyCompatibility.Attributes; using LobbyCompatibility.Behaviours; using LobbyCompatibility.Configuration; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using LobbyCompatibility.Models; using LobbyCompatibility.Pooling; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Pool; 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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("MaxWasUnavailable;legoandmars;xilophor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Towards a future with fewer lobby incompatibility errors.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+df734d7e6811df56b55ed362a5f2a9b75c0e2e90")] [assembly: AssemblyProduct("LobbyCompatibility")] [assembly: AssemblyTitle("BMX.LobbyCompatibility")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/MaxWasUnavailable/LobbyCompatibility")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LobbyCompatibility { [LobbyCompatibility(CompatibilityLevel.ClientOnly, VersionStrictness.Minor)] [BepInPlugin("BMX.LobbyCompatibility", "LobbyCompatibility", "1.2.0")] public class LobbyCompatibilityPlugin : BaseUnityPlugin { private bool _isPatched; private Harmony? Harmony { get; set; } internal static ManualLogSource? Logger { get; private set; } public static LobbyCompatibilityPlugin? Instance { get; private set; } public static Config? Config { get; private set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); PatchAll(); Logger.LogInfo((object)"Plugin BMX.LobbyCompatibility is loaded!"); } public void PatchAll() { //IL_0040: 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_0047: Expected O, but got Unknown //IL_004c: Expected O, but got Unknown if (_isPatched) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"Already patched!"); } return; } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogDebug((object)"Patching..."); } if (Harmony == null) { Harmony val = new Harmony("BMX.LobbyCompatibility"); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); _isPatched = true; ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogDebug((object)"Patched!"); } } public void UnpatchAll() { if (!_isPatched) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"Already unpatched!"); } return; } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogDebug((object)"Unpatching..."); } Harmony.UnpatchSelf(); _isPatched = false; ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogDebug((object)"Unpatched!"); } } } public static class PluginInfo { public const string PLUGIN_GUID = "BMX.LobbyCompatibility"; public const string PLUGIN_NAME = "LobbyCompatibility"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace LobbyCompatibility.Pooling { internal class PluginCategorySlotPool : MonoBehaviour { private PluginCategorySlot? _template; private Transform? _container; private IObjectPool<PluginCategorySlot>? _pool; public void InitializeUsingTemplate(PluginCategorySlot template, Transform container) { _container = container; _template = template; _pool = (IObjectPool<PluginCategorySlot>?)(object)new ObjectPool<PluginCategorySlot>((Func<PluginCategorySlot>)CreatePooledItem, (Action<PluginCategorySlot>)OnTakeFromPool, (Action<PluginCategorySlot>)OnReturnedToPool, (Action<PluginCategorySlot>)OnDestroyPoolObject, false, 10, 10000); } public PluginCategorySlot? Spawn(PluginDiffResult pluginDiffResult) { PluginCategorySlot pluginCategorySlot = SpawnInternal(); pluginCategorySlot?.SetPluginDiffResult(pluginDiffResult); return pluginCategorySlot; } public void Release(PluginCategorySlot pluginCategorySlot) { if (!((Object)(object)pluginCategorySlot == (Object)null) && _pool != null) { _pool.Release(pluginCategorySlot); } } private PluginCategorySlot? SpawnInternal() { if ((Object)(object)_template == (Object)null || (Object)(object)_container == (Object)null || _pool == null) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogInfo((object)"PluginCategorySlotPool tried to spawn an item, but was not initialized properly."); } return null; } return _pool.Get(); } private PluginCategorySlot CreatePooledItem() { if ((Object)(object)_template == (Object)null || (Object)(object)_container == (Object)null) { throw new NullReferenceException("Template is missing! Did it get destroyed?"); } PluginCategorySlot pluginCategorySlot = Object.Instantiate<PluginCategorySlot>(_template, _container); ((Component)pluginCategorySlot).gameObject.SetActive(true); return pluginCategorySlot; } private void OnTakeFromPool(PluginCategorySlot pluginCategorySlot) { ((Component)pluginCategorySlot).gameObject.SetActive(true); ((Component)pluginCategorySlot).transform.SetAsLastSibling(); } private void OnReturnedToPool(PluginCategorySlot pluginCategorySlot) { ((Component)pluginCategorySlot).gameObject.SetActive(false); } private void OnDestroyPoolObject(PluginCategorySlot pluginCategorySlot) { Object.Destroy((Object)(object)((Component)pluginCategorySlot).gameObject); } } internal class PluginDiffSlotPool : MonoBehaviour { private PluginDiffSlot? _template; private Transform? _container; private IObjectPool<PluginDiffSlot>? _pool; public void InitializeUsingTemplate(PluginDiffSlot template, Transform container) { _container = container; _template = template; _pool = (IObjectPool<PluginDiffSlot>?)(object)new ObjectPool<PluginDiffSlot>((Func<PluginDiffSlot>)CreatePooledItem, (Action<PluginDiffSlot>)OnTakeFromPool, (Action<PluginDiffSlot>)OnReturnedToPool, (Action<PluginDiffSlot>)OnDestroyPoolObject, false, 20, 10000); } public PluginDiffSlot? Spawn(PluginDiff pluginDiff, bool lobbyCompatibilityPresent) { PluginDiffSlot pluginDiffSlot = SpawnInternal(); pluginDiffSlot?.SetPluginDiff(pluginDiff, lobbyCompatibilityPresent); return pluginDiffSlot; } public PluginDiffSlot? Spawn(string pluginNameText, string clientVersionText, string serverVersionText, Color color) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) PluginDiffSlot pluginDiffSlot = SpawnInternal(); pluginDiffSlot?.SetText(pluginNameText, clientVersionText, serverVersionText, color); return pluginDiffSlot; } public void Release(PluginDiffSlot pluginDiffSlot) { if (!((Object)(object)pluginDiffSlot == (Object)null) && _pool != null) { _pool.Release(pluginDiffSlot); } } private PluginDiffSlot? SpawnInternal() { if ((Object)(object)_template == (Object)null || (Object)(object)_container == (Object)null || _pool == null) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogInfo((object)"PluginDiffSlotPool tried to spawn an item, but was not initialized properly."); } return null; } return _pool.Get(); } private PluginDiffSlot CreatePooledItem() { if ((Object)(object)_template == (Object)null || (Object)(object)_container == (Object)null) { throw new NullReferenceException("Template is missing! Did it get destroyed?"); } PluginDiffSlot pluginDiffSlot = Object.Instantiate<PluginDiffSlot>(_template, _container); ((Component)pluginDiffSlot).gameObject.SetActive(true); return pluginDiffSlot; } private void OnTakeFromPool(PluginDiffSlot pluginDiffSlot) { ((Component)pluginDiffSlot).gameObject.SetActive(true); ((Component)pluginDiffSlot).transform.SetAsLastSibling(); } private void OnReturnedToPool(PluginDiffSlot pluginDiffSlot) { ((Component)pluginDiffSlot).gameObject.SetActive(false); } private void OnDestroyPoolObject(PluginDiffSlot pluginDiffSlot) { Object.Destroy((Object)(object)((Component)pluginDiffSlot).gameObject); } } } namespace LobbyCompatibility.Patches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPriority(0)] [HarmonyWrapSafe] internal class ES3SettingsConstructorPrefix { [HarmonyPrefix] private static void FileSettings(ref string path) { path = ((path == "LCChallengeFile") ? "LCModdedChallengeFile" : path); } } [HarmonyPatch(typeof(ISteamUserStats), "FindOrCreateLeaderboard")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal class FindOrCreateLeaderboardPrefix { [HarmonyPrefix] private static void Prefix(ref string pchLeaderboardName) { pchLeaderboardName = (pchLeaderboardName.StartsWith("challenge") ? ("modded_" + pchLeaderboardName) : pchLeaderboardName); } } [HarmonyPatch] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class GetLeaderboardForChallengeTranspiler { [HarmonyTargetMethod] private static MethodBase? TargetMethod() { return AccessTools.Method(typeof(MenuManager), "GetLeaderboardForChallenge", (Type[])null, (Type[])null).GetCustomAttribute<AsyncStateMachineAttribute>().StateMachineType.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.NonPublic); } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.OperandIs(instruction, (object)" Results"))).ThrowIfInvalid("Could not find leaderboard results text").SetOperandAndAdvance((object)" Results (Modded)") .InstructionEnumeration(); } } [HarmonyPatch] [HarmonyPriority(800)] [HarmonyWrapSafe] internal class LoadLobbyListAndFilterTranspiler { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(SteamLobbyManager), "currentLobbyList"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(LobbySlot), "thisLobby"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(SteamLobbyManager), "levelListContainer"); MethodInfo methodInfo = AccessTools.Method(typeof(LoadLobbyListAndFilterTranspiler), "InitializeLobbySlot", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Lobby), "GetData", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(LoadLobbyListAndFilterTranspiler), "ReplaceLobbyName", (Type[])null, (Type[])null); return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"name", (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo2, (string)null) }).ThrowIfNotMatch("Unable to find Lobby.GetData(name) line.", Array.Empty<CodeMatch>()).Advance(2) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)methodInfo3) }) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction inst) => inst.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction inst) => inst.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((OpCode?)OpCodes.Ldelem, (object)typeof(Lobby), (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)fieldInfo2, (string)null) }) .ThrowIfNotMatch("Unable to find LobbySlot.thisLobby line.", Array.Empty<CodeMatch>()) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Dup, (object)null) }) .Advance(6) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo3), new CodeInstruction(OpCodes.Call, (object)methodInfo) }) .InstructionEnumeration(); } private static void InitializeLobbySlot(LobbySlot lobbySlot, Transform levelListContainer) { ModdedLobbySlot moddedLobbySlot = ((Component)lobbySlot).gameObject.AddComponent<ModdedLobbySlot>(); moddedLobbySlot.Setup(lobbySlot); moddedLobbySlot.SetParentContainer(levelListContainer.parent); } private static string ReplaceLobbyName(string lobbyName) { if (lobbyName.Length == 0) { return lobbyName; } return lobbyName.Replace("[MOD]", ""); } } [HarmonyPatch] [HarmonyPriority(800)] [HarmonyWrapSafe] internal class LoadServerListTranspiler { [HarmonyTargetMethod] private static MethodBase? TargetMethod() { return HarmonyHelper.GetAsyncInfo(typeof(SteamLobbyManager), "LoadServerList"); } [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) { //IL_004d: 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_0083: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00eb: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown MethodInfo searchCoroutineMethod = AccessTools.Method(typeof(MonoBehaviour), "StartCoroutine", new Type[1] { typeof(IEnumerator) }, (Type[])null); MethodInfo methodInfo = AccessTools.Method(typeof(LoadServerListTranspiler), "LoadListPostfix", (Type[])null, (Type[])null); Label label = default(Label); CodeMatcher obj = new CodeMatcher(instructions, ilGenerator).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction inst) => CodeInstructionExtensions.Calls(inst, searchCoroutineMethod))).ThrowIfInvalid("Unable to find StartCoroutine.").Advance(1) .SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)) .CreateLabel(ref label) .Advance(-7) .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Br, (object)label)) .SearchForward((Func<CodeInstruction, bool>)((CodeInstruction inst) => inst.opcode == OpCodes.Leave)) .ThrowIfInvalid("Unable to find leave instruction."); CodeInstruction[] array = new CodeInstruction[2]; CodeInstruction val = new CodeInstruction(OpCodes.Ldloc_1, (object)null); CodeInstruction val2 = val; array[0] = val; array[1] = new CodeInstruction(OpCodes.Call, (object)methodInfo); CodeMatcher val3 = obj.InsertAndAdvance((CodeInstruction[])(object)array); CodeInstructionExtensions.MoveLabelsTo(val3.Instruction, val2); return val3.InstructionEnumeration(); } internal static async void LoadListPostfix(SteamLobbyManager steamLobbyManager) { LobbyQuery lobbyList = SteamMatchmaking.LobbyList; lobbyList.stringFilters = LobbyHelper.LatestLobbyRequestStringFilters; lobbyList.distance = LobbyHelper.LatestLobbyRequestDistanceFilter; bool flag = !lobbyList.stringFilters.ContainsKey("tag") || lobbyList.stringFilters["tag"] != "none"; ModdedLobbyFilter currentFilter = (((Object)(object)ModdedLobbyFilterDropdown.Instance != (Object)null) ? ModdedLobbyFilterDropdown.Instance.LobbyFilter : ModdedLobbyFilter.All); if (flag) { currentFilter = ModdedLobbyFilter.All; } Lobby[] filteredLobbies = null; if (currentFilter != ModdedLobbyFilter.VanillaAndUnknownOnly && !flag) { if (PluginHelper.Checksum != "" && (currentFilter == ModdedLobbyFilter.CompatibleFirst || currentFilter == ModdedLobbyFilter.CompatibleOnly)) { if (lobbyList.stringFilters.ContainsKey("checksum")) { lobbyList.stringFilters.Remove("checksum"); } else { ((LobbyQuery)(ref lobbyList)).WithKeyValue("checksum", PluginHelper.Checksum); } } if (lobbyList.stringFilters.ContainsKey("tag")) { lobbyList.stringFilters["tag"] = "modded"; } filteredLobbies = await ((LobbyQuery)(ref lobbyList)).RequestAsync(); } Lobby[] source = LobbyHelper.FilterLobbies((Lobby[])(((object)steamLobbyManager.currentLobbyList) ?? ((object)new Lobby[0])), filteredLobbies, currentFilter); steamLobbyManager.currentLobbyList = source.ToArray(); if (!source.Any()) { ((TMP_Text)steamLobbyManager.serverListBlankText).text = LobbyHelper.GetEmptyLobbyListString(currentFilter); } else { steamLobbyManager.loadLobbyListCoroutine = ((MonoBehaviour)steamLobbyManager).StartCoroutine(steamLobbyManager.loadLobbyListAndFilter(steamLobbyManager.currentLobbyList)); } } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class LobbyDataIsJoinablePostfix { [HarmonyPostfix] private static bool Postfix(bool isJoinable, ref Lobby lobby) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!isJoinable) { return false; } if (((Lobby)(ref lobby)).GetData("modded") != "true" && !PluginHelper.CanJoinVanillaLobbies()) { Object.FindObjectOfType<MenuManager>().SetLoadingScreen(false, (RoomEnter)3, "You are using mods which aren't strictly client-side, but the lobby is not modded."); return PluginHelper.CanJoinVanillaLobbies() && isJoinable; } string text = GeneralExtensions.Join<char>((IEnumerable<char>)LobbyHelper.GetLobbyPlugins(lobby), (Func<char, string>)null, string.Empty); LobbyHelper.GetLobbyDiff(lobby, text); if (string.IsNullOrEmpty(text)) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogWarning((object)"Lobby is modded but does not have any plugin information."); } return isJoinable; } bool flag = PluginHelper.MatchesTargetRequirements(PluginHelper.ParseLobbyPluginsMetadata(text)); if (!flag) { ManualLogSource? logger2 = LobbyCompatibilityPlugin.Logger; if (logger2 != null) { logger2.LogWarning((object)"You are missing required plugins to join this lobby."); } Object.FindObjectOfType<MenuManager>().SetLoadingScreen(false, (RoomEnter)5, "You are missing required mods to join this lobby."); } return flag; } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class LobbyDataIsJoinableTranspiler { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0002: 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_0064: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.OperandIs(instruction, (object)"joinable"))).ThrowIfInvalid("Could not find joinable").RemoveInstructions(4) .Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LobbyDataIsJoinableTranspiler), "IsJoinable", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } private static bool IsJoinable(ref Lobby lobby) { if (!(((Lobby)(ref lobby)).GetData("_joinable") == "true")) { return ((Lobby)(ref lobby)).GetData("joinable") == "true"; } return true; } } [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class MenuManagerPostfix { [HarmonyPostfix] private static void Postfix(MenuManager __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown if (__instance.isInitScene) { return; } Transform val = __instance.serverListUIContainer.transform.Find("ListPanel"); Transform val2 = (((Object)(object)val != (Object)null) ? val.Find("Scroll View") : null); TextMeshProUGUI privatePublicDescription = __instance.privatePublicDescription; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)privatePublicDescription == (Object)null)) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogInfo((object)"Initializing menu UI."); } ((TMP_Text)__instance.leaderboardHeaderText).rectTransform.offsetMax = new Vector2(2000f, ((TMP_Text)__instance.leaderboardHeaderText).rectTransform.offsetMax.y); Transform parent = __instance.menuNotification.transform.parent; GameObject val3 = Object.Instantiate<GameObject>(__instance.menuNotification, parent); val3.AddComponent<ModListTooltipPanel>(); val3.SetActive(true); GameObject panel = Object.Instantiate<GameObject>(__instance.menuNotification, parent); GameObject val4 = new GameObject("ModListPanel Handler"); val4.transform.SetParent(parent); ModListPanel modListPanel = val4.AddComponent<ModListPanel>(); modListPanel.SetupPanel(panel, val2, privatePublicDescription); Transform obj = val.Find("RefreshButton"); Button val5 = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null); if ((Object)(object)val5 != (Object)null) { UIHelper.ReskinRefreshButton(val5); } UIHelper.AddCustomFilterToLobbyList(val); } } } [HarmonyPatch(typeof(LobbyQuery), "RequestAsync")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class RequestAsyncPrefix { [HarmonyPrefix] private static void Prefix(LobbyQuery __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) LobbyHelper.LatestLobbyRequestStringFilters = __instance.stringFilters ?? new Dictionary<string, string>(); LobbyHelper.LatestLobbyRequestDistanceFilter = __instance.distance; } } [HarmonyPatch(typeof(MenuManager), "SetLoadingScreen")] [HarmonyPriority(800)] [HarmonyWrapSafe] internal static class SetLoadingScreenPrefix { [HarmonyPrefix] private static bool Prefix(bool isLoading, RoomEnter result, MenuManager __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if (isLoading) { return true; } if ((int)result != 5) { return true; } __instance.MenuAudio.volume = 0.5f; __instance.menuButtons.SetActive(true); __instance.loadingScreen.SetActive(false); __instance.serverListUIContainer.SetActive(false); if ((Object)(object)ModListPanel.Instance != (Object)null) { ModListPanel.Instance.DisplayNotification(LobbyHelper.LatestLobbyDiff, "Error while joining..."); } ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogDebug((object)"Error while joining! Logging Diff..."); } ManualLogSource? logger2 = LobbyCompatibilityPlugin.Logger; if (logger2 != null) { logger2.LogDebug((object)GeneralExtensions.Join<PluginDiff>((IEnumerable<PluginDiff>)LobbyHelper.LatestLobbyDiff.PluginDiffs, (Func<PluginDiff, string>)((PluginDiff diff) => diff.GetDisplayText()), ", ")); } return false; } } [HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated")] [HarmonyPriority(0)] [HarmonyWrapSafe] internal static class SteamMatchmakingOnLobbyCreatedPostfix { [HarmonyPostfix] private static void Postfix(Result result, ref Lobby lobby) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if ((int)result != 1) { return; } List<PluginInfoRecord> source = PluginHelper.GetAllPluginInfo().ToList(); ((Lobby)(ref lobby)).SetData("modded", "true"); string[] array = PluginHelper.GetLobbyPluginsMetadata().ToArray(); for (int i = 0; i < array.Length; i++) { ((Lobby)(ref lobby)).SetData(string.Format("{0}{1}", "plugins", i), array[i] + ((i < array.Length - 1) ? "@" : string.Empty)); } ((Lobby)(ref lobby)).SetData("_joinable", ((Lobby)(ref lobby)).GetData("joinable")); ((Lobby)(ref lobby)).SetData("checksum", PluginHelper.Checksum); if (source.Any(delegate(PluginInfoRecord plugin) { CompatibilityLevel? compatibilityLevel = plugin.CompatibilityLevel; if (compatibilityLevel.HasValue) { CompatibilityLevel valueOrDefault = compatibilityLevel.GetValueOrDefault(); if ((uint)(valueOrDefault - 1) <= 2u) { return true; } } return false; }) && !LobbyHelper.LobbyNameContainsModIdentifier(lobby)) { ((Lobby)(ref lobby)).SetData("name", "[MOD]" + ((Lobby)(ref lobby)).GetData("name")); } if (source.Any((PluginInfoRecord plugin) => plugin.CompatibilityLevel.GetValueOrDefault() == CompatibilityLevel.Everyone)) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogWarning((object)"You are hosting a lobby with required plugins. Disabling vanilla clients from joining."); } ((Lobby)(ref lobby)).SetData("joinable", "false"); if (((Lobby)(ref lobby)).GetData("tag") == "none") { ((Lobby)(ref lobby)).SetData("tag", "modded"); } } } } } namespace LobbyCompatibility.Models { public record LobbyDiff(List<PluginDiff> PluginDiffs, bool LobbyCompatibilityPresent = true) { private LobbyDiffResult? _cachedResult; public string GetDisplayText(bool shortened = false) { LobbyDiffResult moddedLobbyType = GetModdedLobbyType(); string text = ((moddedLobbyType != LobbyDiffResult.PresumedCompatible) ? moddedLobbyType.ToString() : (shortened ? "Compatible?" : "Presumed Compatible")); return "Mod Status: " + text; } internal LobbyDiffResult GetModdedLobbyType() { if (_cachedResult.HasValue) { return _cachedResult.Value; } LobbyDiffResult? lobbyDiffResult; if (!LobbyCompatibilityPresent) { lobbyDiffResult = (_cachedResult = LobbyDiffResult.Unknown); return lobbyDiffResult.Value; } bool flag = PluginDiffs.Any((PluginDiff pluginDiff) => pluginDiff.PluginDiffResult == PluginDiffResult.Unknown); if (PluginDiffs.Any((PluginDiff pluginDiff) => pluginDiff.PluginDiffResult != 0 && pluginDiff.PluginDiffResult != PluginDiffResult.Unknown)) { lobbyDiffResult = (_cachedResult = LobbyDiffResult.Incompatible); return lobbyDiffResult.Value; } if (flag) { lobbyDiffResult = (_cachedResult = LobbyDiffResult.PresumedCompatible); return lobbyDiffResult.Value; } lobbyDiffResult = (_cachedResult = LobbyDiffResult.Compatible); return lobbyDiffResult.Value; } [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("PluginDiffs = "); builder.Append(PluginDiffs); builder.Append(", LobbyCompatibilityPresent = "); builder.Append(LobbyCompatibilityPresent.ToString()); return true; } } public record PluginDiff(PluginDiffResult PluginDiffResult, string GUID, Version? ClientVersion, Version? ServerVersion) { public string GetDisplayText() { string text = GUID ?? ""; if (ClientVersion != null) { text += $"-v{ClientVersion}"; } if (PluginDiffResult == PluginDiffResult.ModVersionMismatch && ServerVersion != null) { text += $" — v{ServerVersion} was required"; } return text; } public Color GetTextColor() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0066: Unknown result type (might be due to invalid IL or missing references) switch (PluginDiffResult) { case PluginDiffResult.Compatible: return LobbyCompatibilityPlugin.Config?.CompatibleColor.Value ?? Config.DefaultCompatibleColor; case PluginDiffResult.ServerMissingMod: case PluginDiffResult.ClientMissingMod: case PluginDiffResult.ModVersionMismatch: return LobbyCompatibilityPlugin.Config?.IncompatibleColor.Value ?? Config.DefaultIncompatibleColor; default: return LobbyCompatibilityPlugin.Config?.UnknownColor.Value ?? Config.DefaultUnknownColor; } } } [Serializable] public record PluginInfoRecord([property: JsonProperty("i")] string GUID, [property: JsonProperty("v"), JsonConverter(typeof(VersionConverter))] Version Version, [property: JsonProperty("c")] CompatibilityLevel? CompatibilityLevel, [property: JsonProperty("s")] VersionStrictness? VersionStrictness); } namespace LobbyCompatibility.Features { internal static class HarmonyHelper { public static MethodInfo? GetAsyncInfo(Type type, string method) { return AccessTools.Method(type, method, (Type[])null, (Type[])null).GetCustomAttribute<AsyncStateMachineAttribute>().StateMachineType.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.NonPublic); } } public static class LobbyHelper { public static readonly Regex ModdedLobbyIdentifierRegex = new Regex("(\\bmod(s|ded)?\\b)", RegexOptions.IgnoreCase); public static Dictionary<string, string> LatestLobbyRequestStringFilters = new Dictionary<string, string>(); public static LobbyDistanceFilter? LatestLobbyRequestDistanceFilter; private static List<PluginInfoRecord>? _clientPlugins; public static LobbyDiff LatestLobbyDiff { get; private set; } = new LobbyDiff(new List<PluginDiff>()); private static Dictionary<ulong, LobbyDiff> LobbyDiffCache { get; } = new Dictionary<ulong, LobbyDiff>(); public static LobbyDiff GetLobbyDiff(Lobby lobby) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return GetLobbyDiff(lobby, null); } internal static LobbyDiff GetLobbyDiff(Lobby lobby, string? lobbyPluginString) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) if (LobbyDiffCache.TryGetValue(SteamId.op_Implicit(((Lobby)(ref lobby)).Id), out LobbyDiff value)) { LatestLobbyDiff = value; return value; } List<PluginInfoRecord> list = PluginHelper.ParseLobbyPluginsMetadata(lobbyPluginString ?? GetLobbyPlugins(lobby)).ToList(); if (_clientPlugins == null) { _clientPlugins = PluginHelper.GetAllPluginInfo().ToList(); } List<PluginDiff> list2 = new List<PluginDiff>(); foreach (PluginInfoRecord lobbyPlugin in list) { PluginInfoRecord pluginInfoRecord = _clientPlugins.FirstOrDefault((PluginInfoRecord plugin) => plugin.GUID == lobbyPlugin.GUID); if (!lobbyPlugin.CompatibilityLevel.HasValue || !lobbyPlugin.VersionStrictness.HasValue) { Version version = pluginInfoRecord?.Version; list2.Add(new PluginDiff((!(version == lobbyPlugin.Version)) ? PluginDiffResult.Unknown : PluginDiffResult.Compatible, lobbyPlugin.GUID, version, lobbyPlugin.Version)); } else if (pluginInfoRecord == null) { if (lobbyPlugin.CompatibilityLevel.GetValueOrDefault() == CompatibilityLevel.Everyone) { list2.Add(new PluginDiff(PluginDiffResult.ClientMissingMod, lobbyPlugin.GUID, null, lobbyPlugin.Version)); } else { list2.Add(new PluginDiff(PluginDiffResult.Compatible, lobbyPlugin.GUID, null, lobbyPlugin.Version)); } } else if (pluginInfoRecord.CompatibilityLevel != lobbyPlugin.CompatibilityLevel) { list2.Add(new PluginDiff(PluginDiffResult.ModVersionMismatch, lobbyPlugin.GUID, pluginInfoRecord.Version, lobbyPlugin.Version)); } else if (pluginInfoRecord.CompatibilityLevel != CompatibilityLevel.ClientOnly && !PluginHelper.MatchesVersion(pluginInfoRecord, lobbyPlugin)) { list2.Add(new PluginDiff(PluginDiffResult.ModVersionMismatch, lobbyPlugin.GUID, pluginInfoRecord.Version, lobbyPlugin.Version)); } else { list2.Add(new PluginDiff(PluginDiffResult.Compatible, lobbyPlugin.GUID, pluginInfoRecord.Version, lobbyPlugin.Version)); } } foreach (PluginInfoRecord clientPlugin in _clientPlugins) { PluginInfoRecord pluginInfoRecord2 = list.FirstOrDefault((PluginInfoRecord plugin) => plugin.GUID == clientPlugin.GUID); if (!clientPlugin.CompatibilityLevel.HasValue || !clientPlugin.VersionStrictness.HasValue) { Version version2 = pluginInfoRecord2?.Version; if (version2 != clientPlugin.Version) { list2.Add(new PluginDiff(PluginDiffResult.Unknown, clientPlugin.GUID, clientPlugin.Version, version2)); } continue; } if (pluginInfoRecord2 != null) { continue; } CompatibilityLevel? compatibilityLevel = clientPlugin.CompatibilityLevel; bool flag; if (compatibilityLevel.HasValue) { CompatibilityLevel valueOrDefault = compatibilityLevel.GetValueOrDefault(); if ((uint)(valueOrDefault - 2) <= 1u) { flag = true; goto IL_038a; } } flag = false; goto IL_038a; IL_038a: if (flag) { list2.Add(new PluginDiff(PluginDiffResult.ServerMissingMod, clientPlugin.GUID, clientPlugin.Version, null)); } else { list2.Add(new PluginDiff(PluginDiffResult.Compatible, clientPlugin.GUID, clientPlugin.Version, null)); } } bool lobbyCompatibilityPresent = list.Any(); LatestLobbyDiff = new LobbyDiff(list2, lobbyCompatibilityPresent); LobbyDiffCache.Add(SteamId.op_Implicit(((Lobby)(ref lobby)).Id), LatestLobbyDiff); return LatestLobbyDiff; } internal static string GetLobbyPlugins(Lobby lobby) { List<string> list = new List<string>(); int num = 0; do { list.Insert(num, ((Lobby)(ref lobby)).GetData(string.Format("{0}{1}", "plugins", num))); } while (list[num++].Contains("@")); return GeneralExtensions.Join<string>((IEnumerable<string>)list, (Func<string, string>)null, string.Empty).Replace("@", string.Empty); } public static string GetCompatibilityHeader(PluginDiffResult pluginDiffResult) { return pluginDiffResult switch { PluginDiffResult.Compatible => "Compatible", PluginDiffResult.ClientMissingMod => "Missing lobby-required mods", PluginDiffResult.ServerMissingMod => "Incompatible with lobby", PluginDiffResult.ModVersionMismatch => "Incompatible mod versions", _ => "Unknown", }; } public static Lobby[] FilterLobbies(Lobby[] normalLobbies, Lobby[]? filteredLobbies, ModdedLobbyFilter currentFilter) { Lobby[] filteredLobbies2 = filteredLobbies; List<Lobby> list = new List<Lobby>(); if (filteredLobbies2 != null) { normalLobbies = normalLobbies.Where((Lobby lobby) => !filteredLobbies2.Any((Lobby check) => ((object)(Lobby)(ref lobby)).Equals((object?)check))).ToArray(); } if (currentFilter == ModdedLobbyFilter.VanillaAndUnknownOnly) { list.AddRange(FilterLobbiesByDiffResult(normalLobbies, LobbyDiffResult.Unknown)); } else { bool flag = filteredLobbies2 != null; bool flag2 = flag; if (flag2) { bool flag3 = (uint)currentFilter <= 1u; flag2 = flag3; } if (flag2) { var (collection, lobbies) = SplitLobbiesByDiffResult(filteredLobbies2, LobbyDiffResult.Compatible); var (collection2, enumerable) = SplitLobbiesByDiffResult(normalLobbies, LobbyDiffResult.Compatible); list.AddRange(collection); list.AddRange(collection2); if (currentFilter == ModdedLobbyFilter.CompatibleFirst) { var (collection3, collection4) = SplitLobbiesByDiffResult(lobbies, LobbyDiffResult.PresumedCompatible); var (collection5, collection6) = SplitLobbiesByDiffResult(normalLobbies, LobbyDiffResult.PresumedCompatible); list.AddRange(collection3); list.AddRange(collection5); list.AddRange(collection4); list.AddRange(collection6); } } else if (filteredLobbies2 != null || currentFilter != 0) { list = ((filteredLobbies2 != null || currentFilter != ModdedLobbyFilter.CompatibleOnly) ? normalLobbies.ToList() : new List<Lobby>()); } else { var (collection7, enumerable2) = SplitLobbiesByDiffResult(normalLobbies, LobbyDiffResult.Compatible); var (collection8, collection9) = SplitLobbiesByDiffResult(normalLobbies, LobbyDiffResult.PresumedCompatible); list.AddRange(collection7); list.AddRange(collection8); list.AddRange(collection9); } } return list.ToArray(); } private static (IEnumerable<Lobby> matchedLobbies, IEnumerable<Lobby> unmatchedLobbies) SplitLobbiesByDiffResult(IEnumerable<Lobby> lobbies, LobbyDiffResult filteredLobbyDiffResult) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002f: Unknown result type (might be due to invalid IL or missing references) List<Lobby> list = new List<Lobby>(); List<Lobby> list2 = new List<Lobby>(); foreach (Lobby lobby in lobbies) { LobbyDiffResult moddedLobbyType = GetLobbyDiff(lobby).GetModdedLobbyType(); if (moddedLobbyType == filteredLobbyDiffResult) { list.Add(lobby); } else { list2.Add(lobby); } } return (list, list2); } private static IEnumerable<Lobby> FilterLobbiesByDiffResult(IEnumerable<Lobby> lobbies, LobbyDiffResult filteredLobbyDiffResult) { return SplitLobbiesByDiffResult(lobbies, filteredLobbyDiffResult).matchedLobbies; } public static string GetEmptyLobbyListString(ModdedLobbyFilter moddedLobbyFilter) { return moddedLobbyFilter switch { ModdedLobbyFilter.CompatibleOnly => "No available compatible\nservers to join.", ModdedLobbyFilter.VanillaAndUnknownOnly => "No available vanilla or unknown\nservers to join.", _ => "No available servers to join.", }; } public static bool LobbyNameContainsModIdentifier(Lobby lobby) { return ModdedLobbyIdentifierRegex.IsMatch(((Lobby)(ref lobby)).GetData("name")); } } public static class PluginHelper { private static readonly List<PluginInfoRecord> RegisteredPluginInfoRecords = new List<PluginInfoRecord>(); private static string? _cachedChecksum; internal static string Checksum { get { return _cachedChecksum ?? GetRequiredPluginsChecksum(); } set { _cachedChecksum = value; } } public static void RegisterPlugin(string guid, Version version, CompatibilityLevel compatibilityLevel, VersionStrictness versionStrictness) { RegisteredPluginInfoRecords.Add(new PluginInfoRecord(guid, version, compatibilityLevel, versionStrictness)); _cachedChecksum = null; } private static bool HasCompatibilityAttribute(BaseUnityPlugin plugin) { return ((object)plugin)?.GetType().GetCustomAttributes(typeof(LobbyCompatibilityAttribute), inherit: false).Any() ?? false; } private static IEnumerable<PluginInfo> GetCompatibilityPlugins() { return from plugin in Chainloader.PluginInfos where HasCompatibilityAttribute(plugin.Value.Instance) select plugin.Value; } private static LobbyCompatibilityAttribute? GetCompatibilityAttribute(BaseUnityPlugin plugin) { return (LobbyCompatibilityAttribute)((object)plugin).GetType().GetCustomAttributes(typeof(LobbyCompatibilityAttribute), inherit: false).FirstOrDefault(); } internal static IEnumerable<PluginInfoRecord> GetAllPluginInfo() { List<PluginInfoRecord> list = new List<PluginInfoRecord>(); List<PluginInfo> list2 = GetCompatibilityPlugins().ToList(); List<PluginInfo> list3 = (from plugin in Chainloader.PluginInfos.Values where plugin.Instance != null && !HasCompatibilityAttribute(plugin.Instance) select (plugin)).ToList(); list2.RemoveAll((PluginInfo plugin) => RegisteredPluginInfoRecords.Any((PluginInfoRecord record) => record.GUID == plugin.Metadata.GUID)); list3.RemoveAll((PluginInfo plugin) => RegisteredPluginInfoRecords.Any((PluginInfoRecord record) => record.GUID == plugin.Metadata.GUID)); list.AddRange(list2.Select((PluginInfo plugin) => new PluginInfoRecord(plugin.Metadata.GUID, plugin.Metadata.Version, GetCompatibilityAttribute(plugin.Instance)?.CompatibilityLevel, GetCompatibilityAttribute(plugin.Instance)?.VersionStrictness))); list.AddRange(list3.Select((PluginInfo plugin) => new PluginInfoRecord(plugin.Metadata.GUID, plugin.Metadata.Version, null, null))); return list.Concat(RegisteredPluginInfoRecords); } internal static IEnumerable<string> GetLobbyPluginsMetadata() { string json = JsonConvert.SerializeObject((object)GetAllPluginInfo().ToList(), (JsonConverter[])(object)new JsonConverter[1] { (JsonConverter)new VersionConverter() }); int maxChunkLength = 8191; for (int i = 0; i < json.Length; i += maxChunkLength) { if (maxChunkLength + i > json.Length) { maxChunkLength = json.Length - i; } yield return json.Substring(i, maxChunkLength); } } internal static IEnumerable<PluginInfoRecord> ParseLobbyPluginsMetadata(string json) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown try { return JsonConvert.DeserializeObject<List<PluginInfoRecord>>(json, (JsonConverter[])(object)new JsonConverter[1] { (JsonConverter)new VersionConverter() }) ?? new List<PluginInfoRecord>(); } catch (Exception ex) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogError((object)"Failed to parse lobby plugins metadata."); } ManualLogSource? logger2 = LobbyCompatibilityPlugin.Logger; if (logger2 != null) { logger2.LogDebug((object)ex); } throw; } } internal static bool MatchesVersion(PluginInfoRecord source, PluginInfoRecord target) { if (source.VersionStrictness == VersionStrictness.None) { return true; } if (source.VersionStrictness.GetValueOrDefault() == VersionStrictness.Major) { if (target.Version.Major != source.Version.Major) { return false; } } else if (source.VersionStrictness.GetValueOrDefault() == VersionStrictness.Minor) { if (target.Version.Major != source.Version.Major || target.Version.Minor != source.Version.Minor) { return false; } } else if (source.VersionStrictness.GetValueOrDefault() == VersionStrictness.Patch && target.Version != source.Version) { return false; } return true; } internal static bool MatchesTargetRequirements(IEnumerable<PluginInfoRecord> targetPluginInfo) { List<PluginInfoRecord> list = GetAllPluginInfo().ToList(); List<PluginInfoRecord> list2 = targetPluginInfo.ToList(); bool flag; foreach (PluginInfoRecord clientPlugin2 in list) { CompatibilityLevel? compatibilityLevel = clientPlugin2.CompatibilityLevel; if (compatibilityLevel.HasValue) { CompatibilityLevel valueOrDefault = compatibilityLevel.GetValueOrDefault(); if ((uint)(valueOrDefault - 2) <= 1u) { flag = true; goto IL_005c; } } flag = false; goto IL_005c; IL_005c: if (!flag || list2.Any((PluginInfoRecord serverPlugin) => serverPlugin.GUID == clientPlugin2.GUID && MatchesVersion(clientPlugin2, serverPlugin))) { continue; } flag = false; goto IL_010a; } foreach (PluginInfoRecord serverPlugin2 in list2) { CompatibilityLevel? compatibilityLevel = serverPlugin2.CompatibilityLevel; if (!compatibilityLevel.HasValue || compatibilityLevel.GetValueOrDefault() != CompatibilityLevel.Everyone || list.Any((PluginInfoRecord clientPlugin) => clientPlugin.GUID == serverPlugin2.GUID && MatchesVersion(serverPlugin2, clientPlugin))) { continue; } flag = false; goto IL_010a; } return true; IL_010a: return flag; } internal static bool CanJoinVanillaLobbies() { return true; } public static IEnumerable<PluginDiff> FilterPluginDiffs(IEnumerable<PluginDiff> pluginDiffs, ModListFilter modListFilter) { return modListFilter switch { ModListFilter.Compatible => pluginDiffs.Where((PluginDiff x) => x.PluginDiffResult == PluginDiffResult.Compatible), ModListFilter.Incompatible => pluginDiffs.Where((PluginDiff x) => x.PluginDiffResult == PluginDiffResult.ServerMissingMod || x.PluginDiffResult == PluginDiffResult.ClientMissingMod || x.PluginDiffResult == PluginDiffResult.ModVersionMismatch), ModListFilter.Unknown => pluginDiffs.Where((PluginDiff x) => x.PluginDiffResult == PluginDiffResult.Unknown), _ => pluginDiffs, }; } private static string GetRequiredPluginsChecksum() { List<PluginInfoRecord> list = GetAllPluginInfo().Where(delegate(PluginInfoRecord plugin) { CompatibilityLevel? compatibilityLevel = plugin.CompatibilityLevel; return compatibilityLevel.HasValue && compatibilityLevel.GetValueOrDefault() == CompatibilityLevel.Everyone; }).OrderBy<PluginInfoRecord, string>((PluginInfoRecord plugin) => plugin.GUID, StringComparer.Ordinal).ToList(); if (!list.Any()) { return _cachedChecksum = ""; } string text = ""; foreach (PluginInfoRecord item in list) { text += item.GUID; switch (item.VersionStrictness) { case VersionStrictness.Major: text += new Version(item.Version.Major, 0).ToString(); break; case VersionStrictness.Minor: text += new Version(item.Version.Major, item.Version.Minor).ToString(); break; case VersionStrictness.Patch: text += item.Version.ToString(); break; } } byte[] array = SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(text)); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("X2")); } _cachedChecksum = stringBuilder.ToString(); ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogDebug((object)_cachedChecksum); } return _cachedChecksum; } } internal static class TextureHelper { internal static Dictionary<string, Sprite?> SpriteCache = new Dictionary<string, Sprite>(); public static Sprite? FindSpriteInAssembly(string path, Assembly? assembly = null) { if (SpriteCache.ContainsKey(path)) { return SpriteCache[path]; } if (assembly == null) { assembly = Assembly.GetExecutingAssembly(); } if (assembly == null) { return null; } Sprite val = null; try { if (assembly.GetManifestResourceNames().Contains(path)) { val = LoadSpriteRaw(GetResource(assembly, path)); } } catch (Exception ex) { ManualLogSource? logger = LobbyCompatibilityPlugin.Logger; if (logger != null) { logger.LogError((object)("Unable to find texture in assembly! Exception: " + ex)); } } SpriteCache.Add(path, val); return val; } public static byte[] GetResource(Assembly assembly, string resource) { using Stream stream = assembly.GetManifestResourceStream(resource) ?? throw new FileNotFoundException(resource); using MemoryStream memoryStream = new MemoryStream(new byte[stream.Length], writable: true); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } public static Sprite? LoadSpriteRaw(byte[] image, float pixelsPerUnit = 100f) { Texture2D val = LoadTextureRaw(image); if (!((Object)(object)val == (Object)null)) { return LoadSpriteFromTexture(val, pixelsPerUnit); } return null; } public static Texture2D? LoadTextureRaw(byte[] file) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown if (file.Length != 0) { Texture2D val = new Texture2D(0, 0, (TextureFormat)4, false, false); if (ImageConversion.LoadImage(val, file)) { return val; } } return null; } public static Sprite? LoadSpriteFromTexture(Texture2D spriteTexture, float pixelsPerUnit = 100f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)spriteTexture == (Object)null) { return null; } Sprite val = Sprite.Create(spriteTexture, new Rect(0f, 0f, (float)((Texture)spriteTexture).width, (float)((Texture)spriteTexture).height), new Vector2(0f, 0f), pixelsPerUnit); ((Object)val).name = ((Object)spriteTexture).name; return val; } } internal static class UIHelper { public static bool TryMultiplySizeDelta(Transform? transform, Vector2 multiplier) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)transform == (Object)null) { return false; } RectTransform component = ((Component)transform).GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { return false; } MultiplySizeDelta(component, multiplier); return true; } private static void MultiplySizeDelta(RectTransform rectTransform, Vector2 multiplier) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector2 sizeDelta = rectTransform.sizeDelta; rectTransform.sizeDelta = new Vector2(sizeDelta.x * multiplier.x, sizeDelta.y * multiplier.y); } public static void AddToAnchoredPosition(Transform? transform, Vector2 addition) { //IL_0027: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) if (!((Object)(object)transform == (Object)null)) { RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val == null) { val = ((Component)transform).GetComponent<RectTransform>(); } if (!((Object)(object)val == (Object)null)) { val.anchoredPosition = new Vector2(val.anchoredPosition.x + addition.x, val.anchoredPosition.y + addition.y); } } } public static TextMeshProUGUI SetupTextAsTemplate(TextMeshProUGUI template, Transform parent, Color color, Vector2 size, float maxFontSize, float minFontSize, HorizontalAlignmentOptions alignment = 2, Vector2? defaultPosition = null) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Object.Instantiate<TextMeshProUGUI>(template, parent); ((TMP_Text)val).rectTransform.anchoredPosition = (Vector2)(((??)defaultPosition) ?? new Vector2(0f, 0f)); ((TMP_Text)val).rectTransform.sizeDelta = size; ((TMP_Text)val).horizontalAlignment = alignment; ((TMP_Text)val).enableAutoSizing = true; ((TMP_Text)val).fontSizeMax = maxFontSize; ((TMP_Text)val).fontSizeMin = minFontSize; ((TMP_Text)val).enableWordWrapping = false; ((Graphic)val).color = color; ((Component)val).gameObject.SetActive(false); return val; } public static RectTransform ApplyParentSize(GameObject uiElement, Transform parent) { //IL_0029: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) RectTransform val = uiElement.GetComponent<RectTransform>(); if ((Object)(object)val == (Object)null) { val = uiElement.AddComponent<RectTransform>(); } ((Transform)val).SetParent(parent); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 0.5f); RectTransform obj = val; Vector2 offsetMin = (val.offsetMax = Vector2.zero); obj.offsetMin = offsetMin; ((Transform)val).localRotation = Quaternion.identity; ((Transform)val).localScale = Vector3.one; ((Transform)val).localPosition = Vector3.zero; return val; } public static TextMeshProUGUI CreateTextFromTemplate(TextMeshProUGUI template, string content, float yPosition, Color? overrideColor = null) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Object.Instantiate<TextMeshProUGUI>(template, ((TMP_Text)template).transform.parent); if (overrideColor.HasValue) { ((Graphic)val).color = overrideColor.Value; } ((TMP_Text)val).rectTransform.anchoredPosition = new Vector2(((TMP_Text)val).rectTransform.anchoredPosition.x, yPosition); ((TMP_Text)val).text = content; ((Component)val).gameObject.SetActive(true); return val; } public static (List<PluginDiffSlot?> pluginDiffSlots, List<PluginCategorySlot?> pluginCategorySlots) GenerateDiffSlotsFromLobbyDiff(LobbyDiff lobbyDiff, PluginDiffSlotPool pluginDiffSlotPool, PluginCategorySlotPool pluginCategorySlotPool, ModListFilter? modListFilter = null, int? maxLines = null) { //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) List<PluginDiffSlot> list = new List<PluginDiffSlot>(); List<PluginCategorySlot> list2 = new List<PluginCategorySlot>(); IEnumerable<PluginDiff> enumerable; if (!modListFilter.HasValue) { IEnumerable<PluginDiff> pluginDiffs = lobbyDiff.PluginDiffs; enumerable = pluginDiffs; } else { enumerable = PluginHelper.FilterPluginDiffs(lobbyDiff.PluginDiffs, modListFilter.Value); } IEnumerable<PluginDiff> source = enumerable; int num = 0; int num2 = 0; foreach (PluginDiffResult compatibilityResult in Enum.GetValues(typeof(PluginDiffResult)).Cast<PluginDiffResult>()) { List<PluginDiff> list3 = source.Where((PluginDiff pluginDiff) => pluginDiff.PluginDiffResult == compatibilityResult).ToList(); if (list3.Count == 0) { continue; } if (maxLines.HasValue && num >= maxLines - 1) { break; } PluginCategorySlot item = pluginCategorySlotPool.Spawn(compatibilityResult); list2.Add(item); num++; foreach (PluginDiff item2 in list3) { PluginDiffSlot pluginDiffSlot = pluginDiffSlotPool.Spawn(item2, lobbyDiff.LobbyCompatibilityPresent); if (!((Object)(object)pluginDiffSlot == (Object)null)) { list.Add(pluginDiffSlot); num++; num2++; if (maxLines.HasValue && num >= maxLines) { break; } } } } int num3 = lobbyDiff.PluginDiffs.Count - num2; if (maxLines.HasValue && num >= maxLines && num3 > 0) { string pluginNameText = string.Format("{0} more mod{1}...", num3, (num3 == 1) ? "" : "s"); PluginDiffSlot pluginDiffSlot2 = pluginDiffSlotPool.Spawn(pluginNameText, "", "", LobbyCompatibilityPlugin.Config?.UnknownColor.Value ?? Color.gray); if ((Object)(object)pluginDiffSlot2 != (Object)null) { list.Add(pluginDiffSlot2); } } return (list, list2); } public static void ClearSpawnedDiffSlots(PluginDiffSlotPool pluginDiffSlotPool, PluginCategorySlotPool pluginCategorySlotPool, ref List<PluginDiffSlot?> existingPluginDiffSlots, ref List<PluginCategorySlot?> existingPluginCategorySlots) { foreach (PluginDiffSlot existingPluginDiffSlot in existingPluginDiffSlots) { if (!((Object)(object)existingPluginDiffSlot == (Object)null)) { pluginDiffSlotPool.Release(existingPluginDiffSlot); } } foreach (PluginCategorySlot existingPluginCategorySlot in existingPluginCategorySlots) { if (!((Object)(object)existingPluginCategorySlot == (Object)null)) { pluginCategorySlotPool.Release(existingPluginCategorySlot); } } existingPluginDiffSlots.Clear(); existingPluginCategorySlots.Clear(); } public static void AddVerticalLayoutGroup(GameObject gameObject, bool addContentSizeFitter = true) { VerticalLayoutGroup val = gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false; if (addContentSizeFitter) { ContentSizeFitter val2 = ((Component)val).gameObject.AddComponent<ContentSizeFitter>(); val2.verticalFit = (FitMode)2; } } public static void ReskinRefreshButton(Button refreshButton) { //IL_0083: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) object obj; if (refreshButton == null) { obj = null; } else { Transform obj2 = ((Component)refreshButton).transform.Find("Text (TMP)"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null); } TextMeshProUGUI val = (TextMeshProUGUI)obj; object obj3; if (refreshButton == null) { obj3 = null; } else { Transform obj4 = ((Component)refreshButton).transform.Find("SelectionHighlight"); obj3 = ((obj4 != null) ? ((Component)obj4).GetComponent<RectTransform>() : null); } RectTransform val2 = (RectTransform)obj3; Image val3 = ((val2 != null) ? ((Component)val2).GetComponent<Image>() : null); if (!((Object)(object)refreshButton == (Object)null) && !((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null)) { val2.anchoredPosition = new Vector2(140f, 17.5f); val2.sizeDelta = new Vector2(34f, 43.5f); RectTransform val4 = Object.Instantiate<RectTransform>(val2, ((TMP_Text)val).transform.parent, false); Image component = ((Component)val4).GetComponent<Image>(); ((Transform)val4).SetSiblingIndex(0); Color color = ((Graphic)component).color; ((Graphic)component).color = new Color(color.r, color.g, color.b, 1f); component.sprite = TextureHelper.FindSpriteInAssembly("LobbyCompatibility.Resources.Refresh.png"); val3.sprite = TextureHelper.FindSpriteInAssembly("LobbyCompatibility.Resources.InvertedRefresh.png"); ((Behaviour)val).enabled = false; } } public static void AddCustomFilterToLobbyList(Transform listPanel, float adjustment = -40f) { //IL_007a: 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_0097: 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_00ae: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown Transform val = listPanel.Find("Dropdown"); Transform val2 = listPanel.Find("ToggleChallengeSort"); Transform obj = listPanel.Find("ServerTagInputField"); RectTransform val3 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); object obj2; if (val3 == null) { obj2 = null; } else { Transform obj3 = ((Transform)val3).Find("Text Area/Placeholder"); obj2 = ((obj3 != null) ? ((Component)obj3).GetComponent<TextMeshProUGUI>() : null); } TextMeshProUGUI val4 = (TextMeshProUGUI)obj2; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null) && !((Object)(object)val4 == (Object)null)) { AddToAnchoredPosition(val, new Vector2(adjustment, 0f)); AddToAnchoredPosition(val2, new Vector2(adjustment, 0f)); val3.offsetMax = new Vector2(val3.offsetMax.x + adjustment, val3.offsetMax.y); ((TMP_Text)val4).text = "Server tag..."; Transform val5 = Object.Instantiate<Transform>(val, val.parent, false); TMP_Dropdown component = ((Component)val5).GetComponent<TMP_Dropdown>(); RectTransform component2 = ((Component)val5).GetComponent<RectTransform>(); component2.anchoredPosition = new Vector2(adjustment, component2.anchoredPosition.y); component.captionText.fontSize = 10f; component.itemText.fontSize = 10f; component.ClearOptions(); component.AddOptions(new List<OptionData> { new OptionData("Mods: Compatible first"), new OptionData("Mods: Compatible only"), new OptionData("Mods: Vanilla and Unknown only"), new OptionData("Mods: All") }); ModdedLobbyFilterDropdown moddedLobbyFilterDropdown = ((Component)component).gameObject.AddComponent<ModdedLobbyFilterDropdown>(); moddedLobbyFilterDropdown.SetDropdown(component); ((UnityEventBase)component.onValueChanged).m_PersistentCalls.Clear(); ((UnityEvent<int>)(object)component.onValueChanged).AddListener((UnityAction<int>)moddedLobbyFilterDropdown.ChangeFilterType); } } } } namespace LobbyCompatibility.Enums { public enum CompatibilityLevel { ClientOnly, ServerOnly, Everyone, ClientOptional } public enum LobbyDiffResult { Compatible, Incompatible, PresumedCompatible, Unknown } public static class LobbyMetadata { public const string Name = "name"; public const string Tag = "tag"; public const string Version = "vers"; public const string Joinable = "joinable"; public const string Modded = "modded"; public const string JoinableModded = "_joinable"; public const string Plugins = "plugins"; public const string RequiredChecksum = "checksum"; public const string ModdedLobbyPrefix = "[MOD]"; } public enum ModdedLobbyFilter { CompatibleFirst, CompatibleOnly, VanillaAndUnknownOnly, All } public enum ModListFilter { All, Compatible, Incompatible, Unknown } public enum PluginDiffResult { Compatible, ServerMissingMod, ClientMissingMod, ModVersionMismatch, Unknown } public enum VersionStrictness { None, Major, Minor, Patch } } namespace LobbyCompatibility.Configuration { public class Config { public static readonly Color DefaultCompatibleColor = Color.green; public static readonly Color DefaultIncompatibleColor = Color.red; public static readonly Color DefaultUnknownColor = Color.gray; public ConfigEntry<ModdedLobbyFilter> DefaultModdedLobbyFilter; public ConfigEntry<ModListFilter> DefaultModListTab; public ConfigEntry<Color> CompatibleColor; public ConfigEntry<Color> IncompatibleColor; public ConfigEntry<Color> UnknownColor; public Config(ConfigFile configFile) { //IL_004a: 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_008a: Unknown result type (might be due to invalid IL or missing references) DefaultModdedLobbyFilter = configFile.Bind<ModdedLobbyFilter>("General", "Default Lobby Filter Type", ModdedLobbyFilter.CompatibleFirst, "The default filter to apply when searching for a public lobby"); DefaultModListTab = configFile.Bind<ModListFilter>("General", "Default ModList Tab", ModListFilter.All, "The default tab to use when viewing a lobby's mod list"); CompatibleColor = configFile.Bind<Color>("Visual", "Compatible Plugin Color", DefaultCompatibleColor, "The color used to respresent compatible plugins"); IncompatibleColor = configFile.Bind<Color>("Visual", "Incompatible Plugin Color", DefaultIncompatibleColor, "The color used to respresent incompatible plugins"); UnknownColor = configFile.Bind<Color>("Visual", "Unknown Plugin Color", DefaultUnknownColor, "The color used to respresent unknown plugins"); } } } namespace LobbyCompatibility.Behaviours { public class ButtonEventHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler { private Color? _highlightedColor; private Sprite? _highlightedSprite; private Image? _image; private Color? _normalColor; private Sprite? _normalSprite; public event Action<bool>? OnHoverStateChanged; public event Action? OnClick; public void OnPointerClick(PointerEventData eventData) { this.OnClick?.Invoke(); } public void OnPointerEnter(PointerEventData eventData) { this.OnHoverStateChanged?.Invoke(obj: true); SetHighlighted(highlighted: true); } public void OnPointerExit(PointerEventData eventData) { this.OnHoverStateChanged?.Invoke(obj: false); SetHighlighted(highlighted: false); } public void SetButtonImageData(Image image, Sprite normalSprite, Sprite highlightedSprite, Color normalColor, Color highlightedColor) { //IL_0016: 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) _image = image; _normalSprite = normalSprite; _highlightedSprite = highlightedSprite; SetColor(normalColor, highlightedColor); SetHighlighted(highlighted: false); } public void SetColor(Color normalColor, Color highlightedColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) _normalColor = normalColor; _highlightedColor = highlightedColor; SetHighlighted(highlighted: false); } private void SetHighlighted(bool highlighted) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_image == (Object)null)) { _image.sprite = (highlighted ? _highlightedSprite : _normalSprite); Color? val = (highlighted ? _highlightedColor : _normalColor); if (val.HasValue) { ((Graphic)_image).color = val.Value; } } } } internal class ModdedLobbyFilterDropdown : MonoBehaviour { private TMP_Dropdown? _dropdown; private SteamLobbyManager? _steamLobbyManager; public ModdedLobbyFilter LobbyFilter { get; private set; } public static ModdedLobbyFilterDropdown? Instance { get; private set; } public void Awake() { UpdateLobbyFilter(LobbyCompatibilityPlugin.Config?.DefaultModdedLobbyFilter.Value ?? ModdedLobbyFilter.CompatibleFirst); if ((Object)(object)_dropdown != (Object)null) { _dropdown.SetValueWithoutNotify((int)LobbyFilter); } Instance = this; _steamLobbyManager = Object.FindObjectOfType<SteamLobbyManager>(); } public void SetDropdown(TMP_Dropdown dropdown) { _dropdown = dropdown; } public void ChangeFilterType(int index) { UpdateLobbyFilter((ModdedLobbyFilter)index); if ((Object)(object)_steamLobbyManager != (Object)null) { _steamLobbyManager.RefreshServerListButton(); } } private void UpdateLobbyFilter(ModdedLobbyFilter lobbyFilter) { LobbyFilter = lobbyFilter; } } public class ModdedLobbySlot : MonoBehaviour { private List<ButtonEventHandler> _buttonEventHandlers = new List<ButtonEventHandler>(); private RectTransform? _buttonTransform; private Button? _joinButton; private LobbyDiff? _lobbyDiff; private LobbySlot? _lobbySlot; private Transform? _parentContainer; internal void Setup(LobbySlot lobbySlot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) _lobbySlot = lobbySlot; _lobbyDiff = LobbyHelper.GetLobbyDiff(_lobbySlot.thisLobby); TextMeshProUGUI playerCount = _lobbySlot.playerCount; if ((Object)(object)playerCount == (Object)null) { return; } _joinButton = ((Component)this).GetComponentInChildren<Button>(); if (!((Object)(object)_joinButton == (Object)null)) { Sprite lobbySprite = GetLobbySprite(_lobbyDiff.GetModdedLobbyType()); Sprite lobbySprite2 = GetLobbySprite(_lobbyDiff.GetModdedLobbyType(), inverted: true); if ((Object)(object)lobbySprite != (Object)null && (Object)(object)lobbySprite2 != (Object)null && (Object)(object)_lobbySlot.LobbyName != (Object)null) { Vector3 localPosition = ((TMP_Text)playerCount).transform.localPosition; ((TMP_Text)playerCount).transform.localPosition = new Vector3(32f, localPosition.y, localPosition.z); CreateModListButton(_joinButton, lobbySprite, lobbySprite2, ((Graphic)_lobbySlot.LobbyName).color, ((TMP_Text)playerCount).transform); } } } private void Start() { Button? joinButton = _joinButton; TextMeshProUGUI buttonText = ((joinButton != null) ? ((Component)joinButton).GetComponentInChildren<TextMeshProUGUI>() : null); LobbyDiffResult? lobbyDiffResult = _lobbyDiff?.GetModdedLobbyType(); if (lobbyDiffResult.HasValue && !((Object)(object)_joinButton == (Object)null) && !((Object)(object)buttonText == (Object)null) && (lobbyDiffResult.GetValueOrDefault() == LobbyDiffResult.Incompatible || lobbyDiffResult.GetValueOrDefault() == LobbyDiffResult.Unknown)) { _buttonEventHandlers.ForEach(delegate(ButtonEventHandler handler) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) handler.SetColor(((Graphic)buttonText).color, ((Graphic)buttonText).color); }); if (lobbyDiffResult.GetValueOrDefault() == LobbyDiffResult.Incompatible) { ((Selectable)_joinButton).interactable = false; SetupModListButtonEvents(_joinButton); } } } private void OnDestroy() { if (_buttonEventHandlers.Count == 0) { return; } foreach (ButtonEventHandler buttonEventHandler in _buttonEventHandlers) { if (!((Object)(object)buttonEventHandler == (Object)null)) { buttonEventHandler.OnHoverStateChanged -= OnModListHoverStateChanged; buttonEventHandler.OnClick -= OnModListClick; } } _buttonEventHandlers.Clear(); } public void SetParentContainer(Transform parentTransform) { _parentContainer = parentTransform; } private Button? CreateModListButton(Button original, Sprite sprite, Sprite invertedSprite, Color color, Transform parent) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (_lobbyDiff == null) { return null; } Button val = Object.Instantiate<Button>(original, parent); _buttonTransform = ((Component)val).GetComponent<RectTransform>(); Transform obj = ((Component)val).transform.Find("SelectionHighlight"); RectTransform val2 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); Image val3 = ((val2 != null) ? ((Component)val2).GetComponent<Image>() : null); if ((Object)(object)_buttonTransform == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { return null; } TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = false; } ((UnityEventBase)val.onClick).m_PersistentCalls.Clear(); ((Selectable)val).transition = (Transition)0; ((Behaviour)((Selectable)val).animator).enabled = false; SetupButtonPositioning(_buttonTransform); SetupButtonImage(val2, val3); ButtonEventHandler buttonEventHandler = SetupModListButtonEvents(val); buttonEventHandler.SetButtonImageData(val3, sprite, invertedSprite, color, color); return val; } private void OnModListClick() { if (!(_lobbyDiff == null) && !((Object)(object)ModListPanel.Instance == (Object)null)) { ModListPanel.Instance.DisplayNotification(_lobbyDiff); } } private void OnModListHoverStateChanged(bool hovered) { if (!(_lobbyDiff == null) && !((Object)(object)_buttonTransform == (Object)null) && !((Object)(object)_parentContainer == (Object)null) && !((Object)(object)ModListTooltipPanel.Instance == (Object)null)) { if (hovered) { ModListTooltipPanel.Instance.DisplayNotification(_lobbyDiff, _buttonTransform, _parentContainer); } else { ModListTooltipPanel.Instance.HideNotification(); } } } private ButtonEventHandler SetupModListButtonEvents(Button button) { ButtonEventHandler buttonEventHandler = ((Component)button).gameObject.AddComponent<ButtonEventHandler>(); buttonEventHandler.OnHoverStateChanged += OnModListHoverStateChanged; buttonEventHandler.OnClick += OnModListClick; _buttonEventHandlers.Add(buttonEventHandler); return buttonEventHandler; } private void SetupButtonPositioning(RectTransform buttonTransform) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) buttonTransform.sizeDelta = new Vector2(30f, 30f); buttonTransform.offsetMin = new Vector2(-37f, -37f); buttonTransform.offsetMax = new Vector2(-9.3f, -7f); buttonTransform.anchoredPosition = new Vector2(-85f, -7f); ((Transform)buttonTransform).localPosition = new Vector3(-5.5f, 1.25f, 0f); ((Transform)buttonTransform).localScale = new Vector3(0.6f, 0.6f, 0.6f); } private void SetupButtonImage(RectTransform buttonImageTransform, Image buttonImage) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0055: Unknown result type (might be due to invalid IL or missing references) buttonImageTransform.sizeDelta = new Vector2(31.5f, 30f); buttonImageTransform.offsetMin = new Vector2(0f, 0f); buttonImageTransform.offsetMax = new Vector2(31.5f, 30f); buttonImageTransform.anchoredPosition = new Vector2(14f, 15f); ((Transform)buttonImageTransform).localScale = Vector3.one; ((Behaviour)buttonImage).enabled = true; } private Sprite? GetLobbySprite(LobbyDiffResult lobbyDiffResult, bool inverted = false) { string text = "LobbyCompatibility.Resources."; if (inverted) { text += "Inverted"; } switch (lobbyDiffResult) { case LobbyDiffResult.Compatible: case LobbyDiffResult.PresumedCompatible: text += "ModSettings"; break; case LobbyDiffResult.Incompatible: text += "ModSettingsExclamationPoint"; break; default: text += "ModSettingsQuestionMark"; break; } return TextureHelper.FindSpriteInAssembly(text + ".png"); } } public class ModListPanel : MonoBehaviour { public static ModListPanel? Instance; private static readonly Vector2 NotificationWidth = new Vector2(1.6f, 1.75f); private static readonly float TabPadding = 3f; private List<PluginDiffSlot?> _spawnedPluginDiffSlots = new List<PluginDiffSlot>(); private List<PluginCategorySlot?> _spawnedPluginCategorySlots = new List<PluginCategorySlot>(); private RectTransform? _panelTransform; private ScrollRect? _scrollRect; private TextMeshProUGUI? _titleText; private TextMeshProUGUI? _descriptionText; private List<ModListTab> _tabs = new List<ModListTab>(); private ModListFilter _currentTab; private LobbyDiff? _lobbyDiff; private PluginDiffSlotPool? _pluginDiffSlotPool; private PluginCategorySlotPool? _pluginCategorySlotPool; private void Awake() { Instance = this; } public void SetupPanel(GameObject panel, Transform scrollViewTemplate, TextMeshProUGUI privatePublicDescription) { //IL_00f7: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown Transform obj = panel.transform.Find("Panel"); Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); _panelTransform = ((val != null) ? ((Graphic)val).rectTransform : null); RectTransform? panelTransform = _panelTransform; object obj2; if (panelTransform == null) { obj2 = null; } else { Transform obj3 = ((Transform)panelTransform).Find("Image"); obj2 = ((obj3 != null) ? ((Component)obj3).GetComponent<Image>() : null); } Image val2 = (Image)obj2; if ((Object)(object)val == (Object)null || (Object)(object)_panelTransform == (Object)null || (Object)(object)val2 == (Object)null) { return; } Transform obj4 = ((Transform)_panelTransform).Find("ResponseButton"); Button val3 = ((obj4 != null) ? ((Component)obj4).GetComponent<Button>() : null); RectTransform val4 = ((val3 != null) ? ((Component)val3).GetComponent<RectTransform>() : null); if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null) { return; } Transform obj5 = ((Transform)_panelTransform).Find("NotificationText"); _titleText = ((obj5 != null) ? ((Component)obj5).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)_titleText == (Object)null) { return; } ((TMP_Text)_titleText).rectTransform.anchoredPosition = new Vector2(-2f, 155f); _descriptionText = Object.Instantiate<TextMeshProUGUI>(privatePublicDescription, ((TMP_Text)_titleText).transform.parent); ((TMP_Text)_descriptionText).rectTransform.anchoredPosition = new Vector2(-3f, -60f); ((TMP_Text)_descriptionText).rectTransform.sizeDelta = new Vector2(400f, ((TMP_Text)_descriptionText).rectTransform.sizeDelta.y); ((TMP_Text)_descriptionText).text = ""; _scrollRect = SetupScrollRect(_panelTransform, scrollViewTemplate, ((Graphic)_titleText).color); if (!((Object)(object)_scrollRect == (Object)null)) { SetupModListSlots(_panelTransform, _scrollRect, ((Graphic)_titleText).color); ((Graphic)val).color = new Color(((Graphic)val).color.r, ((Graphic)val).color.g, ((Graphic)val).color.b, 1f); UIHelper.TryMultiplySizeDelta((Transform?)(object)_panelTransform, NotificationWidth); UIHelper.TryMultiplySizeDelta(((Component)val2).transform, NotificationWidth); UIHelper.TryMultiplySizeDelta(((Transform)_panelTransform).Find("NotificationText"), NotificationWidth); val4.anchoredPosition = new Vector2(val4.anchoredPosition.x, -110.5f); ((UnityEventBase)val3.onClick).m_PersistentCalls.Clear(); ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { SetPanelActive(active: false); }); _tabs = SetupTabs(val2, val, val3); SetPanelActive(active: false); } } public List<ModListTab> SetupTabs(Image panelOutlineImage, Image panelImage, Button button) { //IL_0059: 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_008e: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01df: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_panelTransform == (Object)null) { return new List<ModListTab>(); } List<ModListTab> list = new List<ModListTab>(); List<ModListFilter> list2 = Enum.GetValues(typeof(ModListFilter)).Cast<ModListFilter>().ToList(); Color unselectedColor = default(Color); for (int i = 0; i < list2.Count; i++) { Image val = Object.Instantiate<Image>(panelOutlineImage, ((Component)panelOutlineImage).transform.parent); ((Graphic)val).rectTransform.sizeDelta = new Vector2(_panelTransform.sizeDelta.x / (float)list2.Count - TabPadding, 35f - TabPadding); float num = (float)i * (_panelTransform.sizeDelta.x + TabPadding) / (float)list2.Count; ((Graphic)val).rectTransform.anchoredPosition = new Vector2((0f - _panelTransform.sizeDelta.x + ((Graphic)val).rectTransform.sizeDelta.x + (float)i) / 2f + num, (_panelTransform.sizeDelta.y + ((Graphic)val).rectTransform.sizeDelta.y - TabPadding) / 2f); val.sprite = null; ((Graphic)val).color = ((Graphic)panelImage).color; Image val2 = Object.Instantiate<Image>(val, ((Component)val).transform, true); val2.sprite = panelOutlineImage.sprite; ((Graphic)val2).color = ((Graphic)panelOutlineImage).color; ((Graphic)val2).rectTransform.sizeDelta = ((Graphic)val2).rectTransform.sizeDelta + new Vector2(TabPadding, TabPadding); ((Graphic)val2).rectTransform.anchoredPosition = ((Graphic)val2).rectTransform.anchoredPosition + new Vector2((0f - TabPadding) / 2f, 0f); Button val3 = Object.Instantiate<Button>(button, ((Component)val).transform); RectTransform component = ((Component)val3).GetComponent<RectTransform>(); component.anchoredPosition = new Vector2((0f - TabPadding) / 2f - 0.4f, 0f); component.sizeDelta = ((Graphic)val2).rectTransform.sizeDelta + new Vector2(TabPadding, 0f); TextMeshProUGUI componentInChildren = ((Component)val3).GetComponentInChildren<TextMeshProUGUI>(); ((Component)val3).transform.SetAsFirstSibling(); ((Color)(ref unselectedColor))..ctor(((Graphic)val).color.r / 1.25f, ((Graphic)val).color.g / 1.25f, ((Graphic)val).color.b / 1.25f, 1f); ((Component)val).transform.SetParent(((Transform)_panelTransform).parent); ((Component)val).transform.SetSiblingIndex(1); ModListTab modListTab = ((Component)val).gameObject.AddComponent<ModListTab>(); modListTab.Setup(val, val2, val3, componentInChildren, list2[i], ((Graphic)val).color, unselectedColor); modListTab.SetupEvents(SetTab); modListTab.SetSelectionStatus(list2[i] == LobbyCompatibilityPlugin.Config?.DefaultModListTab.Value); list.Add(modListTab); } return list; } private ScrollRect? SetupScrollRect(RectTransform panelTransform, Transform scrollViewTemplate, Color defaultTextColor) { //IL_004b: 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_008f: 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) Transform val = Object.Instantiate<Transform>(scrollViewTemplate, (Transform)(object)panelTransform); RectTransform component = ((Component)val).GetComponent<RectTransform>(); ScrollRect component2 = ((Component)val).GetComponent<ScrollRect>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { return null; } SteamLobbyManager componentInChildren = ((Component)val).GetComponentInChildren<SteamLobbyManager>(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)componentInChildren); } component.anchoredPosition = new Vector2(15f, -30f); component.sizeDelta = new Vector2(-30f, -100f); component2.verticalNormalizedPosition = 1f; component2.verticalScrollbarVisibility = (ScrollbarVisibility)1; UIHelper.AddVerticalLayoutGroup(((Component)component2.content).gameObject); SetupLineSeperator(component2, defaultTextColor, 34.5f); SetupLineSeperator(component2, defaultTextColor, 106.5f); return component2; } private Image SetupLineSeperator(ScrollRect scrollRect, Color color, float xPosition) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("LineSeperator"); Image val2 = val.AddComponent<Image>(); val.transform.SetParent(((Transform)scrollRect.content).parent, false); ((Graphic)val2).rectTransform.anchoredPosition = Vector2.op_Implicit(new Vector3(xPosition, 0f)); ((Graphic)val2).rectTransform.sizeDelta = Vector2.op_Implicit(new Vector3(1f, 200f)); ((Graphic)val2).color = color; return val2; } private void SetupModListSlots(RectTransform panelTransform, ScrollRect scrollRect, Color defaultTextColor) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0038: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL
BepInEx/plugins/ZoLoKinoBabo112/ButteryFixes.dll
Decompiled 2 years 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.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ButteryFixes.Utility; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [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("ButteryFixes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Bundle of miscellaneous vanilla-compatible fixes")] [assembly: AssemblyFileVersion("1.10.2.0")] [assembly: AssemblyInformationalVersion("1.10.2+cc8aac71f0b3011ec3f0f3990f6f67c90041efa3")] [assembly: AssemblyProduct("ButteryFixes")] [assembly: AssemblyTitle("ButteryFixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.10.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ButteryFixes { internal class Compatibility { internal const string FAST_CLIMBING_GUID = "inoyu.FastClimbing"; internal const string BETTER_LADDERS_GUID = "e3s1.BetterLadders"; internal const string GENERAL_IMPROVEMENTS_GUID = "ShaosilGaming.GeneralImprovements"; internal const string MODEL_REPLACEMENT_API_GUID = "meow.ModelReplacementAPI"; internal const string STARLANCER_AI_FIX_GUID = "AudioKnight.StarlancerAIFix"; internal const string BETTER_SPRAY_PAINT_GUID = "taffyko.BetterSprayPaint"; internal const string LETHAL_QUANTITIES_GUID = "LethalQuantities"; internal static bool INSTALLED_GENERAL_IMPROVEMENTS; internal static bool INSTALLED_LETHAL_QUANTITIES; internal static bool DISABLE_LADDER_PATCH; internal static bool DISABLE_PLAYERMODEL_PATCHES; internal static bool DISABLE_ENEMY_MESH_PATCH; internal static bool DISABLE_SPRAY_PAINT_PATCHES; internal static void Init() { if (Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements")) { INSTALLED_GENERAL_IMPROVEMENTS = true; Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - GeneralImprovements detected"); } if (Chainloader.PluginInfos.ContainsKey("inoyu.FastClimbing") || Chainloader.PluginInfos.ContainsKey("e3s1.BetterLadders")) { Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Ladder patch will be disabled"); DISABLE_LADDER_PATCH = true; } if (Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI")) { DISABLE_PLAYERMODEL_PATCHES = true; Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Playermodel patches will be disabled"); } if (Chainloader.PluginInfos.ContainsKey("AudioKnight.StarlancerAIFix")) { DISABLE_ENEMY_MESH_PATCH = true; Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - EnableEnemyMesh patch will be disabled"); } if (Chainloader.PluginInfos.ContainsKey("taffyko.BetterSprayPaint")) { DISABLE_SPRAY_PAINT_PATCHES = true; Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Spray paint patches will be disabled"); } if (Chainloader.PluginInfos.ContainsKey("LethalQuantities")) { INSTALLED_LETHAL_QUANTITIES = true; Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lethal Quantities detected"); } } } internal enum MusicDopplerLevel { Vanilla = -1, None, Reduced } internal enum GameResolution { DontChange = -1, Low, High } internal class Configuration { private static ConfigFile configFile; internal static ConfigEntry<MusicDopplerLevel> musicDopplerLevel; internal static ConfigEntry<GameResolution> gameResolution; internal static ConfigEntry<bool> makeConductive; internal static ConfigEntry<bool> maskHornetsPower; internal static ConfigEntry<bool> fixJumpCheese; internal static ConfigEntry<bool> keysAreScrap; internal static ConfigEntry<bool> showApparatusValue; internal static ConfigEntry<bool> randomizeDefaultSeed; internal static ConfigEntry<bool> scanOnShip; internal static ConfigEntry<bool> fixFireExits; internal static ConfigEntry<bool> unlimitedOldBirds; internal static ConfigEntry<bool> restoreShipIcon; internal static ConfigEntry<bool> limitSpawnChance; internal static void Init(ConfigFile cfg) { configFile = cfg; GameplayConfig(); VisualConfig(); AudioConfig(); ExtraConfig(); MigrateLegacyConfigs(); } private static void GameplayConfig() { randomizeDefaultSeed = configFile.Bind<bool>("Gameplay", "RandomizeDefaultSeed", true, "(Host only) Randomizes the seed when starting a new save file, rather than always using the default of 0. (This changes starting weather and shop sales.)"); fixFireExits = configFile.Bind<bool>("Gameplay", "FixFireExits", true, "Fix fire exit rotation so you are always facing away from the door when you leave. This applies to interiors, as well as the exteriors of the original game's moons."); makeConductive = configFile.Bind<bool>("Gameplay", "MakeConductive", true, "(Host only) Makes some metallic items that are non-conductive in vanilla actually conductive. This fix applies sensibly to the existing items, but you can disable it if you are used to vanilla's properties."); keysAreScrap = configFile.Bind<bool>("Gameplay", "KeysAreScrap", false, "(Host only) Enabling this will allow you to sell keys for $3 as listed, but will also cause them to be lost if all players die. If this is disabled, they will no longer show \"Value: $3\" on the scanner, instead."); limitSpawnChance = configFile.Bind<bool>("Gameplay", "LimitSpawnChance", true, "(Host only) Prevents enemy spawn weight from exceeding 100 (likely the intended maximum) if its spawn curves would normally allow it to do so.\nThis will prevent some enemy types from spawning out of control on certain maps."); unlimitedOldBirds = configFile.Bind<bool>("Gameplay", "UnlimitedOldBirds", false, "(Host only) Allows Old Birds to continue spawning even once all the ones presently on the map have \"woken up\", like in vanilla. This will cause them to appear out of nowhere, since they don't have a proper spawning animation\nThis will also allow outdoor spawns to \"overflow\" when you unplug the apparatus, since that doesn't add Old Birds to the power count in vanilla."); maskHornetsPower = configFile.Bind<bool>("Gameplay", "MaskHornetsPower", false, "(Host only) Mask hornets internally have the same power level as butlers, but because they spawn in a non-standard way, they don't contribute to the indoor power. Enabling this will prevent additional monsters spawning to replace dead butlers."); fixJumpCheese = configFile.Bind<bool>("Gameplay", "FixJumpCheese", true, "(Host only) Enabling this makes enemies hear players jumping and landing on the floor. This fixes the exploit where you can silently move past dogs with sprinting speed by spamming the jump button."); } private static void VisualConfig() { gameResolution = configFile.Bind<GameResolution>("Visual", "GameResolution", GameResolution.DontChange, "The internal resolution rendered by the game. There are unused resolution presets in the game data that you can enable using this option.\n\"DontChange\" makes no changes - vanilla is 860x520, but this setting is also compatible with other resolution mods.\n\"Low\" is 620x350. \"High\" is 970x580."); restoreShipIcon = configFile.Bind<bool>("Visual", "RestoreShipIcon", true, "Show the ship icon on the radar (next to the compass) when it is following an outside player. This doesn't display properly in vanilla (bug?)"); showApparatusValue = configFile.Bind<bool>("Visual", "ShowApparatusValue", false, "Actually show the apparatus' value on the scanner instead of \"???\" (in vanilla, it is always $80)"); } private static void AudioConfig() { musicDopplerLevel = configFile.Bind<MusicDopplerLevel>("Audio", "MusicDopplerLevel", MusicDopplerLevel.Reduced, "Controls how much Unity's simulated \"Doppler effect\" applies to music sources like the dropship, boombox, etc. (This is what causes pitch distortion when moving towards/away from the source of the music)\n\"Vanilla\" makes no changes. \"Reduced\" will make the effect more subtle. \"None\" will disable it completely (so music always plays at the correct pitch)"); } private static void ExtraConfig() { scanOnShip = configFile.Bind<bool>("Extra", "ScanOnShip", false, "Allows the \"scan\" command on the terminal to count the number and value of the items on your ship, when in orbit or parked at Gordion."); } private static void MigrateLegacyConfigs() { configFile.Bind<bool>("Gameplay", "KillOldBirds", true, "Legacy setting, doesn't work"); configFile.Remove(configFile["Gameplay", "KillOldBirds"].Definition); configFile.Bind<bool>("Visual", "FancyEntranceDoors", false, "Legacy setting, use \"Chameleon\" instead"); configFile.Remove(configFile["Visual", "FancyEntranceDoors"].Definition); } } [BepInPlugin("butterystancakes.lethalcompany.butteryfixes", "Buttery Fixes", "1.10.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string PLUGIN_GUID = "butterystancakes.lethalcompany.butteryfixes"; private const string PLUGIN_NAME = "Buttery Fixes"; private const string PLUGIN_VERSION = "1.10.2"; internal static ManualLogSource Logger; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Compatibility.Init(); Configuration.Init(((BaseUnityPlugin)this).Config); new Harmony("butterystancakes.lethalcompany.butteryfixes").PatchAll(); SceneManager.sceneLoaded += SceneOverrides.OnSceneLoaded; Logger.LogInfo((object)"Buttery Fixes v1.10.2 loaded"); } } public static class PluginInfo { public const string PLUGIN_GUID = "ButteryFixes"; public const string PLUGIN_NAME = "ButteryFixes"; public const string PLUGIN_VERSION = "1.10.2"; } } namespace ButteryFixes.Utility { internal static class GlobalReferences { internal const int NUM_LEVELS = 13; internal static Dictionary<string, EnemyType> allEnemiesList = new Dictionary<string, EnemyType>(); internal static float dopplerLevelMult = 1f; internal static Mesh tragedyMask; internal static Mesh tragedyMaskLOD; internal static Mesh tragedyMaskEyesFilled; internal static Material tragedyMaskMat; internal static AudioClip[] tragedyMaskRandomClips; internal static Mesh playerBody; internal static Material scavengerSuitBurnt; internal static bool crashedJetpackAsLocalPlayer; internal static GameObject smokeParticle; internal static Transform shipNode; internal static Vector3 shipNodeOffset; internal static readonly Vector3 shipDefaultPos = new Vector3(1.2714634f, 0.27843857f, -7.5f); internal static bool patchScanNodes; internal static int scrapNotCollected = -1; internal static int scrapEaten; internal static Animator shipAnimator; internal static AudioClip[] woodenDoorOpen; internal static AudioClip[] woodenDoorClose; } public static class NonPatchFunctions { internal static bool[] playerWasLastSprinting = new bool[50]; internal static IEnumerator ShellsAppearAfterDelay(ShotgunItem shotgun) { bool wasHeldByEnemy = ((GrabbableObject)shotgun).isHeldByEnemy; float timeSinceStart = Time.realtimeSinceStartup; yield return (object)new WaitForSeconds(((GrabbableObject)shotgun).isHeldByEnemy ? 0.85f : 1.9f); if (((GrabbableObject)shotgun).isHeldByEnemy) { ((Renderer)shotgun.shotgunShellLeft).forceRenderingOff = false; ((Renderer)shotgun.shotgunShellLeft).enabled = true; ((Renderer)shotgun.shotgunShellRight).forceRenderingOff = false; ((Renderer)shotgun.shotgunShellRight).enabled = true; } else if (((Renderer)shotgun.shotgunShellLeft).enabled) { ((Renderer)shotgun.shotgunShellRight).enabled = true; } else { ((Renderer)shotgun.shotgunShellLeft).enabled = true; } yield return (object)new WaitForSeconds(((GrabbableObject)shotgun).isHeldByEnemy ? 0.66f : 0.75f); if (!wasHeldByEnemy) { yield return (object)new WaitUntil((Func<bool>)(() => !shotgun.isReloading || Time.realtimeSinceStartup - timeSinceStart > 3f)); } ((Renderer)shotgun.shotgunShellLeft).forceRenderingOff = true; ((Renderer)shotgun.shotgunShellRight).forceRenderingOff = true; Plugin.Logger.LogDebug((object)$"Finished animating shotgun shells (held by enemy: {((GrabbableObject)shotgun).isHeldByEnemy})"); } public static void ShotgunPreProcess(Vector3 shotgunPosition, ref int num, ref RaycastHit[] results) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) int num2 = 0; HashSet<EnemyAI> hashSet = new HashSet<EnemyAI>(); List<RaycastHit> list = new List<RaycastHit>(); List<RaycastHit> list2 = new List<RaycastHit>(); list2.AddRange(from hit in results.Take(num) orderby Vector3.Distance(shotgunPosition, ((RaycastHit)(ref hit)).point) select hit); RaycastHit[] array = list2.ToArray(); EnemyAICollisionDetect val = default(EnemyAICollisionDetect); for (int i = 0; i < num; i++) { if (!((Component)((RaycastHit)(ref array[i])).transform).TryGetComponent<EnemyAICollisionDetect>(ref val) || val.onlyCollideWhenGrounded) { continue; } EnemyAI mainScript = val.mainScript; if (!hashSet.Add(mainScript)) { continue; } EnemyType enemyType = mainScript.enemyType; if (!enemyType.canDie || ((Object)enemyType).name == "DocileLocustBees") { list.Add(array[i]); } else if (!mainScript.isEnemyDead) { results[num2] = array[i]; num2++; if (num2 == 10) { num = 10; return; } } } if (list.Count > 0) { foreach (RaycastHit item in list.OrderByDescending((RaycastHit invincible) => ((Component)((RaycastHit)(ref invincible)).transform).GetComponent<EnemyAICollisionDetect>().mainScript is BlobAI)) { results[num2] = item; num2++; if (num2 == 10) { num = 10; return; } } } num = num2; } internal static void FakeFootstepAlert(PlayerControllerB player) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) bool flag = player.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed; if (((NetworkBehaviour)player).IsOwner ? player.isSprinting : playerWasLastSprinting[player.actualClientId]) { RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 22f, 0.6f, 0, flag, 3322); } else { RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 17f, 0.4f, 0, flag, 3322); } } internal static void ConvertMaskToTragedy(Transform mask) { Transform val = mask.Find("Mesh"); if ((Object)(object)val != (Object)null && (Object)(object)GlobalReferences.tragedyMask != (Object)null && (Object)(object)GlobalReferences.tragedyMaskMat != (Object)null) { ((Component)val).GetComponent<MeshFilter>().mesh = GlobalReferences.tragedyMask; ((Renderer)((Component)val).GetComponent<MeshRenderer>()).sharedMaterial = GlobalReferences.tragedyMaskMat; Transform obj = val.Find("EyesFilled"); MeshFilter val2 = ((obj != null) ? ((Component)obj).GetComponent<MeshFilter>() : null); if ((Object)(object)val2 != (Object)null && (Object)(object)GlobalReferences.tragedyMaskEyesFilled != (Object)null) { val2.mesh = GlobalReferences.tragedyMaskEyesFilled; Transform obj2 = mask.Find("ComedyMaskLOD1"); MeshFilter val3 = ((obj2 != null) ? ((Component)obj2).GetComponent<MeshFilter>() : null); if ((Object)(object)val3 != (Object)null && (Object)(object)GlobalReferences.tragedyMaskLOD != (Object)null) { val3.mesh = GlobalReferences.tragedyMaskLOD; ((Renderer)((Component)val3).GetComponent<MeshRenderer>()).sharedMaterial = GlobalReferences.tragedyMaskMat; Plugin.Logger.LogDebug((object)"All mask meshes replaced successfully"); } else { Plugin.Logger.LogWarning((object)"Failed to replace mask eyes"); } } else { Plugin.Logger.LogWarning((object)"Failed to replace mask LOD"); } } else { Plugin.Logger.LogWarning((object)"Failed to replace mask mesh"); } } internal static void ForceRefreshAllHelmetLights(PlayerControllerB player, bool forceOff = false) { for (int i = 0; i < player.allHelmetLights.Length; i++) { bool flag = false; if (!forceOff) { for (int j = 0; j < player.ItemSlots.Length; j++) { if ((Object)(object)player.ItemSlots[j] != (Object)null) { GrabbableObject obj = player.ItemSlots[j]; FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if ((Object)(object)val != (Object)null && val.flashlightTypeID == i && ((GrabbableObject)val).isPocketed && ((GrabbableObject)val).isBeingUsed && ((GrabbableObject)val).insertedBattery.charge > 0f) { flag = true; break; } } } } if (((Behaviour)player.allHelmetLights[i]).enabled != flag) { ((Behaviour)player.allHelmetLights[i]).enabled = flag; Plugin.Logger.LogDebug((object)$"Fixed erroneous active state of {player.playerUsername}'s helmet light \"{((Object)player.allHelmetLights[i]).name}\" (now {flag})"); } } } public static void SpawnProbabilitiesPostProcess(ref List<int> spawnProbabilities, List<SpawnableEnemyWithRarity> enemies) { for (int i = 0; i < spawnProbabilities.Count; i++) { EnemyType enemyType = enemies[i].enemyType; if (enemyType.requireNestObjectsToSpawn && spawnProbabilities[i] > 0 && !Object.FindObjectsOfType<EnemyAINestSpawnObject>().Any((EnemyAINestSpawnObject nest) => (Object)(object)nest.enemyType == (Object)(object)enemyType)) { Plugin.Logger.LogDebug((object)("Enemy \"" + enemyType.enemyName + "\" spawning is disabled; no nests present on map")); spawnProbabilities[i] = 0; } else if (Configuration.limitSpawnChance.Value && spawnProbabilities[i] > 100 && StartOfRound.Instance.currentLevelID < 13) { Plugin.Logger.LogDebug((object)$"Enemy \"{enemyType.enemyName}\" is exceeding maximum spawn weight ({spawnProbabilities[i]} > 100)"); spawnProbabilities[i] = 100; } } } public static void OldBirdSpawnsFromApparatus() { if (!Configuration.unlimitedOldBirds.Value && GlobalReferences.allEnemiesList.TryGetValue("RadMech", out var value)) { EnemyType obj = value; obj.numberSpawned++; RoundManager instance = RoundManager.Instance; instance.currentOutsideEnemyPower += value.PowerLevel; Plugin.Logger.LogDebug((object)"Old Bird spawned from apparatus"); } } internal static void SmokingHotCorpse(Transform body) { //IL_0027: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer skinnedMeshRenderer = default(SkinnedMeshRenderer); if ((Object)(object)GlobalReferences.smokeParticle == (Object)null || !((Component)body).TryGetComponent<SkinnedMeshRenderer>(ref skinnedMeshRenderer)) { return; } foreach (Transform item in body) { if (((Object)item).name.StartsWith(((Object)GlobalReferences.smokeParticle).name)) { return; } } GameObject obj = Object.Instantiate<GameObject>(GlobalReferences.smokeParticle, ((Component)body).transform); obj.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); obj.transform.localScale = Vector3.one; ShapeModule shape = obj.GetComponent<ParticleSystem>().shape; ((ShapeModule)(ref shape)).skinnedMeshRenderer = skinnedMeshRenderer; Plugin.Logger.LogDebug((object)"Smoke from freshly burnt corpse"); } public static void BabyEatsScrap(GrabbableObject grabObj) { if (grabObj.itemProperties.isScrap) { GlobalReferences.scrapEaten += grabObj.scrapValue; } } } internal static class ReflectionCache { internal static readonly FieldInfo IS_IN_HANGAR_SHIP_ROOM = AccessTools.Field(typeof(PlayerControllerB), "isInHangarShipRoom"); internal static readonly FieldInfo ENEMY_COLLIDERS = AccessTools.Field(typeof(ShotgunItem), "enemyColliders"); internal static readonly FieldInfo SPAWN_PROBABILITIES = AccessTools.Field(typeof(RoundManager), "SpawnProbabilities"); internal static readonly FieldInfo CURRENT_LEVEL = AccessTools.Field(typeof(RoundManager), "currentLevel"); internal static readonly MethodInfo SPAWN_PROBABILITIES_POST_PROCESS = AccessTools.Method(typeof(NonPatchFunctions), "SpawnProbabilitiesPostProcess", (Type[])null, (Type[])null); } internal static class SceneOverrides { internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0add: Unknown result type (might be due to invalid IL or missing references) //IL_0ae2: Unknown result type (might be due to invalid IL or missing references) //IL_0ae7: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) if ((int)mode != 1) { return; } bool flag = Configuration.fixFireExits.Value; GameObject obj = GameObject.Find("/Environment/Map/DiageticAmbiance/BigMachine"); Transform val = ((obj != null) ? obj.transform : null); List<string> list = new List<string>(); string text = string.Empty; switch (((Scene)(ref scene)).name) { case "Level1Experimentation": { Plugin.Logger.LogDebug((object)"Detected landing on Experimentation"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(-112.04f, val.localPosition.y, val.localPosition.z); Plugin.Logger.LogDebug((object)"Experimentation - Fixed factory ambience"); } GameObject obj3 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (7)"); Transform val3 = ((obj3 != null) ? obj3.transform : null); if ((Object)(object)val3 != (Object)null) { val3.localPosition = new Vector3(-147.8f, val3.localPosition.y, -81.2f); val3.localScale = new Vector3(129.6264f, val3.localScale.y, 184.7249f); GameObject obj4 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (9)"); Transform val4 = ((obj4 != null) ? obj4.transform : null); if ((Object)(object)val4 != (Object)null) { val4.localPosition = new Vector3(-145.4f, val4.localPosition.y, -42.1f); val4.localScale = new Vector3(171.2598f, val4.localScale.y, 326.2066f); GameObject obj5 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (8)"); Transform val5 = ((obj5 != null) ? obj5.transform : null); if ((Object)(object)val5 != (Object)null) { val5.localPosition = new Vector3(-117.39f, val5.localPosition.y, -87.23f); val5.localScale = new Vector3(10.4316f, val5.localScale.y, 15.95104f); Plugin.Logger.LogDebug((object)"Experimentation - Adjusted water tower fog triggers"); } } } GameObject obj6 = GameObject.Find("/Environment/SteelDoor"); Transform val6 = ((obj6 != null) ? obj6.transform : null); if ((Object)(object)val6 != (Object)null) { val6.localPosition = new Vector3(-194.668f, 19.788f, val6.localPosition.z); Plugin.Logger.LogDebug((object)"Experimentation - Fixed old back entrance"); } GameObject obj7 = GameObject.Find("/Environment/Map/Cube (1)"); Renderer val7 = ((obj7 != null) ? obj7.GetComponent<Renderer>() : null); if ((Object)(object)val7 != (Object)null) { val7.enabled = false; Plugin.Logger.LogDebug((object)"Experimentation - Hide untextured geometry"); } list.AddRange(new <>z__ReadOnlyArray<string>(new string[40] { "BendingPipe", "Bolt", "CatwalkChunk", "CatwalkChunk.004", "CatwalkChunk.005", "CatwalkRailPost", "CatwalkStairTile", "ChainlinkFenceBend", "ChainlinkFenceCut", "CordConnector", "Cube.001", "Cube.004", "Cube.006", "Cube.007/HangarRoomBeams.001", "Cube.007/SiloWithLadder.001", "Girder1", "GridPlate", "LadderFrame", "LongCord1", "LongCord2", "LongCord3", "LongCord4", "MeterBoxDevice", "MiscShelf1", "MiscShelf2", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001", "RaisedCementPlatform", "Scaffolding", "SiloTall", "SpawnRoom", "StandardDoorSize", "StandardDoorSize.001", "StandardDoorSize.002", "TelephonePoleCordsC", "TrainCarRailLowDetail", "ValveWithHandle.001" })); break; } case "Level2Assurance": Plugin.Logger.LogDebug((object)"Detected landing on Assurance"); list.AddRange(new <>z__ReadOnlyArray<string>(new string[6] { "ChainlinkFenceCut", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001" })); break; case "Level3Vow": Plugin.Logger.LogDebug((object)"Detected landing on Vow"); flag = false; break; case "Level4March": Plugin.Logger.LogDebug((object)"Detected landing on March"); break; case "Level5Rend": Plugin.Logger.LogDebug((object)"Detected landing on Rend"); text = "/Environment/Map/SnowCabin/FancyDoorMapModel/SteelDoor (1)/DoorMesh/Cube"; break; case "Level6Dine": { Plugin.Logger.LogDebug((object)"Detected landing on Dine"); GameObject obj2 = GameObject.Find("/Environment/Map/KillTrigger (4)"); Transform val2 = ((obj2 != null) ? obj2.transform : null); if ((Object)(object)val2 != (Object)null) { val2.localPosition = new Vector3(148.11f, val2.localPosition.y, 83.61f); val2.localScale = new Vector3(35.3778f, val2.localScale.y, val2.localScale.z); Plugin.Logger.LogDebug((object)"Dine - Fixed death pit"); } break; } case "Level7Offense": Plugin.Logger.LogDebug((object)"Detected landing on Offense"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(27.601871f, 24.056633f, -67.70342f); Plugin.Logger.LogDebug((object)"Offense - Fixed factory ambience"); } list.AddRange(new <>z__ReadOnlyArray<string>(new string[11] { "ChainlinkFenceCut", "CreeperVine", "MiscShelf1", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001", "LargePipeCorner (1)", "LargePipeCorner (2)", "Girder1 (4)" })); break; case "Level8Titan": Plugin.Logger.LogDebug((object)"Detected landing on Titan"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(-36.07f, 55.12f, 26.15f); Plugin.Logger.LogDebug((object)"Titan - Fixed factory ambience"); } break; case "Level9Artifice": Plugin.Logger.LogDebug((object)"Detected landing on Artifice"); break; case "Level10Adamance": Plugin.Logger.LogDebug((object)"Detected landing on Adamance"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(-108.44491f, -3.2953954f, 8.043371f); Plugin.Logger.LogDebug((object)"Adamance - Fixed factory ambience"); } flag = false; text = "/Environment/SnowCabin/FancyDoorMapModel/SteelDoor (1)/DoorMesh/Cube"; break; case "Level11Embrion": Plugin.Logger.LogDebug((object)"Detected landing on Embrion"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(202.6046f, 14.0158f, 3.280455f); Plugin.Logger.LogDebug((object)"Embrion - Fixed factory ambience"); } break; case "CompanyBuilding": Plugin.Logger.LogDebug((object)"Detected landing on Gordion"); break; default: Plugin.Logger.LogInfo((object)"Landed on unknown moon"); flag = false; break; } if (flag) { EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); foreach (EntranceTeleport val8 in array) { if (val8.isEntranceToBuilding && val8.entranceId > 0) { val8.entrancePoint.localRotation = Quaternion.Euler(0f, 180f, 0f); Plugin.Logger.LogDebug((object)$"Fixed rotation of external fire exit #{val8.entranceId}"); } } } if (list.Count > 0) { GameObject obj8 = GameObject.Find("Environment/Map/ModelsIntroScene"); Transform val9 = ((obj8 != null) ? obj8.transform : null); foreach (Transform item in val9) { Transform val10 = item; if (list.Remove(((Object)val10).name)) { ((Component)val10).gameObject.SetActive(false); } } Plugin.Logger.LogDebug((object)"Hide out-of-bounds objects (Experimentation and leftovers)"); if (list.Count > 0) { int num = 0; foreach (string item2 in list) { Transform val11 = val9.Find(item2); if ((Object)(object)val11 != (Object)null) { ((Component)val11).gameObject.SetActive(!((Component)val11).gameObject.activeSelf); num++; } } if (list.Count != num) { Plugin.Logger.LogWarning((object)$"Failed to hide {list.Count} objects:"); foreach (string item3 in list) { Plugin.Logger.LogWarning((object)("- \"" + item3 + "\"")); } } } } if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS) { ScanNodeProperties? obj9 = ((IEnumerable<ScanNodeProperties>)Object.FindObjectsOfType<ScanNodeProperties>()).FirstOrDefault((Func<ScanNodeProperties, bool>)((ScanNodeProperties scanNodeProperties) => scanNodeProperties.headerText == "Ship")); GlobalReferences.shipNode = ((obj9 != null) ? ((Component)obj9).transform : null); if ((Object)(object)GlobalReferences.shipNode != (Object)null) { GlobalReferences.shipNodeOffset = GlobalReferences.shipNode.position - GlobalReferences.shipDefaultPos; } } if (!string.IsNullOrEmpty(text) && GlobalReferences.woodenDoorOpen != null && GlobalReferences.woodenDoorOpen.Length != 0 && GlobalReferences.woodenDoorClose != null && GlobalReferences.woodenDoorClose.Length != 0) { GameObject obj10 = GameObject.Find(text); AnimatedObjectTrigger val12 = ((obj10 != null) ? obj10.GetComponent<AnimatedObjectTrigger>() : null); if ((Object)(object)val12 != (Object)null) { val12.boolFalseAudios = GlobalReferences.woodenDoorClose; val12.boolTrueAudios = GlobalReferences.woodenDoorOpen; Plugin.Logger.LogDebug((object)"Overwritten cabin door SFX with wooden variants"); } } } } internal static class ScriptableObjectOverrides { internal static void OverrideEnemyTypes() { foreach (KeyValuePair<string, EnemyType> allEnemies in GlobalReferences.allEnemiesList) { switch (allEnemies.Key) { case "RadMech": if (!Configuration.unlimitedOldBirds.Value) { if (Compatibility.INSTALLED_LETHAL_QUANTITIES) { Plugin.Logger.LogWarning((object)"Config setting \"UnlimitedOldBirds\" is disabled, but you have Lethal Quantities installed. This usually prevents Old Birds from being able to spawn due to a conflict. The config setting will be ignored for this session, but consider enabling it to hide this warning in the future."); allEnemies.Value.requireNestObjectsToSpawn = false; } else { allEnemies.Value.requireNestObjectsToSpawn = true; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Require \"nest\" to spawn")); } } else { allEnemies.Value.requireNestObjectsToSpawn = false; } break; case "MaskedPlayerEnemy": allEnemies.Value.isOutsideEnemy = false; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Subtract from indoor power, not outdoor power")); break; case "Blob": allEnemies.Value.canDie = false; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't \"die\" when crushed by spike trap")); break; case "ForestGiant": { ScanNodeProperties componentInChildren = allEnemies.Value.enemyPrefab.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headerText = "Forest Keeper"; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Rename scan node")); } break; } case "ClaySurgeon": { allEnemies.Value.enemyPrefab.GetComponent<NavMeshAgent>().speed = 0f; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't slide around on fresh spawn")); Renderer[] componentsInChildren = allEnemies.Value.enemyPrefab.GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (((Component)val).gameObject.layer == 19) { val.shadowCastingMode = (ShadowCastingMode)0; } } break; } case "CaveDweller": ((GrabbableObject)allEnemies.Value.enemyPrefab.GetComponent<CaveDwellerPhysicsProp>()).itemProperties.isConductiveMetal = false; Plugin.Logger.LogDebug((object)("Conductive: " + allEnemies.Value.enemyName + " (False)")); break; case "SandWorm": allEnemies.Value.canBeDestroyed = false; Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't get eaten by other worms")); break; } allEnemies.Value.numberSpawned = 0; } } internal static void OverrideSelectableLevels() { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; if (!(name == "OffenseLevel")) { if (name == "RendLevel") { SpawnableMapObject val2 = ((IEnumerable<SpawnableMapObject>)val.spawnableMapObjects).FirstOrDefault((Func<SpawnableMapObject, bool>)delegate(SpawnableMapObject spawnableMapObject) { GameObject prefabToSpawn = spawnableMapObject.prefabToSpawn; return ((prefabToSpawn != null) ? ((Object)prefabToSpawn).name : null) == "SpikeRoofTrapHazard"; }); if (val2 != null) { val2.requireDistanceBetweenSpawns = true; Plugin.Logger.LogDebug((object)"Rend now properly spaces spike traps"); } } } else { val.videoReel = null; } } } internal static void OverrideItems() { Dictionary<string, bool> dictionary = new Dictionary<string, bool> { { "FancyCup", true }, { "LockPicker", true }, { "MoldPan", true }, { "Phone", true }, { "Shotgun", true }, { "SoccerBall", false }, { "SprayPaint", true }, { "ToiletPaperRolls", false } }; Dictionary<string, bool> dictionary2 = new Dictionary<string, bool> { { "Airhorn", false }, { "CashRegister", false }, { "ChemicalJug", true }, { "ClownHorn", false }, { "ComedyMask", false }, { "TragedyMask", false } }; Dictionary<string, bool> dictionary3 = new Dictionary<string, bool> { { "ExtensionLadder", false }, { "MagnifyingGlass", true }, { "PillBottle", true }, { "RadarBooster", false }, { "SprayPaint", true }, { "WeedKillerBottle", true } }; AudioClip val = null; AudioClip val2 = null; AudioClip val3 = null; List<Item> list = new List<Item>(); List<Item> list2 = new List<Item>(); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if ((Object)(object)items == (Object)null) { Plugin.Logger.LogWarning((object)"Encountered a missing item in StartOfRound.allItemsList; this is probably an issue with another mod"); continue; } bool flag = false; GameObject spawnPrefab = items.spawnPrefab; ScanNodeProperties val4 = ((spawnPrefab != null) ? spawnPrefab.GetComponentInChildren<ScanNodeProperties>() : null); switch (((Object)items).name) { case "Boombox": items.spawnPrefab.GetComponent<BoomboxItem>().boomboxAudio.dopplerLevel = 0.3f * GlobalReferences.dopplerLevelMult; Plugin.Logger.LogDebug((object)"Doppler level: Boombox"); break; case "BottleBin": val2 = items.grabSFX; break; case "ToyCube": case "Brush": case "PillBottle": case "Toothpaste": case "Remote": case "SteeringWheel": list2.Add(items); break; case "Candy": items.grabSFX = null; Plugin.Logger.LogDebug((object)("Audio: " + items.itemName)); break; case "ClownHorn": ((GrabbableObject)items.spawnPrefab.GetComponent<NoisemakerProp>()).useCooldown = 0.4f; Plugin.Logger.LogDebug((object)"Cooldown: Clown horn"); break; case "EasterEgg": case "MapDevice": case "ZapGun": case "Cog1": flag = true; break; case "GarbageLid": case "MetalSheet": case "FancyCup": list.Add(items); break; case "FancyLamp": items.verticalOffset = 0f; break; case "FishTestProp": flag = true; break; case "Flashlight": case "ProFlashlight": { FlashlightItem component = items.spawnPrefab.GetComponent<FlashlightItem>(); Material[] sharedMaterials = ((Renderer)component.flashlightMesh).sharedMaterials; sharedMaterials[1] = component.bulbDark; ((Renderer)component.flashlightMesh).sharedMaterials = sharedMaterials; Plugin.Logger.LogDebug((object)("Bulb off: " + items.itemName)); break; } case "Hairdryer": ((GrabbableObject)items.spawnPrefab.GetComponent<NoisemakerProp>()).useCooldown = 2f; Plugin.Logger.LogDebug((object)"Cooldown: Hairdryer"); break; case "Key": if (Configuration.keysAreScrap.Value) { items.isScrap = true; Plugin.Logger.LogDebug((object)"Scrap: Key"); break; } ((GrabbableObject)items.spawnPrefab.GetComponent<KeyItem>()).scrapValue = 0; if ((Object)(object)val4 != (Object)null) { val4.subText = string.Empty; val4.scrapValue = 0; Plugin.Logger.LogDebug((object)"Scan node: Key"); } break; case "Knife": { KnifeItem component2 = items.spawnPrefab.GetComponent<KnifeItem>(); if ((Object)(object)val4 != (Object)null) { val4.scrapValue = ((GrabbableObject)component2).scrapValue; val4.subText = $"Value: ${val4.scrapValue}"; Plugin.Logger.LogDebug((object)"Scan node: Kitchen knife"); } if (items.minValue == 70 && items.maxValue == 210) { items.maxValue = 105; } break; } case "RedLocustHive": flag = true; ((GrabbableObject)items.spawnPrefab.GetComponent<PhysicsProp>()).isInFactory = false; Plugin.Logger.LogDebug((object)"Factory: Hive"); if (items.minValue == 90 && items.maxValue == 140) { items.minValue = 100; items.maxValue = 375; } break; case "Shotgun": if (items.minValue == 30 && items.maxValue == 100) { items.minValue = 63; items.maxValue = 225; } break; case "SprayPaint": val3 = items.dropSFX; break; case "TeaKettle": val = items.grabSFX; break; case "TragedyMask": { GlobalReferences.tragedyMaskRandomClips = items.spawnPrefab.GetComponent<RandomPeriodicAudioPlayer>()?.randomClips; Transform obj = items.spawnPrefab.transform.Find("MaskMesh"); MeshFilter val5 = ((obj != null) ? ((Component)obj).GetComponent<MeshFilter>() : null); if (!((Object)(object)val5 != (Object)null)) { break; } Transform obj2 = ((Component)val5).transform.Find("EyesFilled"); MeshFilter val6 = ((obj2 != null) ? ((Component)obj2).GetComponent<MeshFilter>() : null); if ((Object)(object)val6 != (Object)null && (Object)(object)GlobalReferences.tragedyMaskEyesFilled != (Object)null) { val6.mesh = GlobalReferences.tragedyMaskEyesFilled; Transform obj3 = ((Component)val5).transform.Find("ComedyMaskLOD"); MeshFilter val7 = ((obj3 != null) ? ((Component)obj3).GetComponent<MeshFilter>() : null); if ((Object)(object)val7 != (Object)null && (Object)(object)GlobalReferences.tragedyMaskLOD != (Object)null) { val7.mesh = GlobalReferences.tragedyMaskLOD; Plugin.Logger.LogDebug((object)"Meshes: Tragedy"); } } break; } case "WeedKillerBottle": items.spawnPrefab.GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)0; Plugin.Logger.LogDebug((object)"Audio rolloff: Weed killer"); break; } if (flag) { items.spawnPrefab.GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)1; Plugin.Logger.LogDebug((object)("Audio rolloff: " + items.itemName)); } if ((Object)(object)items.spawnPrefab != (Object)null) { bool flag2 = false; Renderer[] componentsInChildren = items.spawnPrefab.GetComponentsInChildren<Renderer>(); foreach (Renderer val8 in componentsInChildren) { if (val8.enabled && ((Component)val8).gameObject.layer == 13) { val8.enabled = false; flag2 = true; } } if (flag2) { Plugin.Logger.LogDebug((object)("Invisible trigger: " + items.itemName)); } if ((Object)(object)items.spawnPrefab.GetComponent<Rigidbody>() != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)((Component)val4).GetComponent<Rigidbody>() == (Object)null) { ((Component)val4).gameObject.AddComponent<Rigidbody>().isKinematic = true; Plugin.Logger.LogDebug((object)("Scan node rigidbody: " + items.itemName)); } } if (dictionary3.ContainsKey(((Object)items).name)) { items.canBeInspected = dictionary3[((Object)items).name]; Plugin.Logger.LogDebug((object)$"Inspectable: {items.itemName} ({items.canBeInspected})"); } if (items.canBeInspected) { if (items.toolTips == null) { Plugin.Logger.LogWarning((object)("Item \"" + ((Object)items).name + "\" is missing toolTips")); } else if (items.toolTips.Length < 3) { bool flag3 = false; string[] toolTips = items.toolTips; for (int i = 0; i < toolTips.Length; i++) { if (toolTips[i].StartsWith("Inspect")) { flag3 = true; break; } } if (!flag3) { items.toolTips = CollectionExtensions.AddToArray<string>(items.toolTips, "Inspect: [Z]"); Plugin.Logger.LogDebug((object)("Inspect tooltip: " + items.itemName)); } } } if (dictionary.ContainsKey(((Object)items).name)) { items.isConductiveMetal = dictionary[((Object)items).name] && Configuration.makeConductive.Value; Plugin.Logger.LogDebug((object)$"Conductive: {items.itemName} ({items.isConductiveMetal})"); } if (dictionary2.ContainsKey(((Object)items).name)) { items.canBeGrabbedBeforeGameStart = dictionary2[((Object)items).name]; Plugin.Logger.LogDebug((object)$"Hold before ship has landed: {items.itemName} ({items.canBeGrabbedBeforeGameStart})"); } } if ((Object)(object)val != (Object)null) { foreach (Item item in list) { item.grabSFX = val; Plugin.Logger.LogDebug((object)("Audio: " + item.itemName)); } } if (!((Object)(object)val2 != (Object)null)) { return; } foreach (Item item2 in list2) { item2.grabSFX = val2; Plugin.Logger.LogDebug((object)("Audio: " + item2.itemName)); if (((Object)item2).name == "PillBottle" && (Object)(object)val3 != (Object)null) { item2.dropSFX = val3; } } } internal static void OverrideUnlockables() { foreach (UnlockableItem unlockable in StartOfRound.Instance.unlockablesList.unlockables) { switch (unlockable.unlockableName) { case "Record player": unlockable.prefabObject.GetComponentInChildren<AnimatedObjectTrigger>().thisAudioSource.dopplerLevel = GlobalReferences.dopplerLevelMult; Plugin.Logger.LogDebug((object)"Doppler level: Record player"); break; case "Disco Ball": unlockable.prefabObject.GetComponentInChildren<CozyLights>().turnOnAudio.dopplerLevel = 0.92f * GlobalReferences.dopplerLevelMult; Plugin.Logger.LogDebug((object)"Doppler level: Disco ball"); break; case "JackOLantern": unlockable.prefabObject.GetComponentInChildren<InteractTrigger>().cooldownTime = 0.5f; Plugin.Logger.LogDebug((object)"Cooldown: Jack o' Lantern"); break; case "Plushie pajama man": unlockable.prefabObject.GetComponentInChildren<InteractTrigger>().cooldownTime = 0.54f; Plugin.Logger.LogDebug((object)"Cooldown: Plushie pajama man"); break; case "Inverse Teleporter": if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS) { InteractTrigger buttonTrigger = unlockable.prefabObject.GetComponentInChildren<ShipTeleporter>().buttonTrigger; buttonTrigger.hoverTip = buttonTrigger.hoverTip.Replace("Beam up", "Beam out"); Plugin.Logger.LogDebug((object)"Text: Inverse teleporter"); } break; } } } } internal static class TileOverrides { internal static void OverrideTiles(IndoorMapType[] indoorMapTypes) { //IL_01e1: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_0225: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject allTile in GetAllTiles(indoorMapTypes)) { switch (((Object)allTile).name) { case "DoubleDoorRoom": case "MediumRoomHallway1B": { Transform val2 = allTile.transform.Find("AnomalySpawns"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Removed obsolete triggers (fix spray paint)")); } break; } case "ManorStartRoom": { if (GlobalReferences.woodenDoorOpen != null && GlobalReferences.woodenDoorOpen.Length >= 1 && GlobalReferences.woodenDoorClose != null && GlobalReferences.woodenDoorClose.Length >= 1) { break; } Transform obj2 = allTile.transform.Find("Doorways"); object obj3; if (obj2 == null) { obj3 = null; } else { Doorway componentInChildren = ((Component)obj2).GetComponentInChildren<Doorway>(); if (componentInChildren == null) { obj3 = null; } else { List<GameObjectWeight> connectorPrefabWeights = componentInChildren.ConnectorPrefabWeights; if (connectorPrefabWeights == null) { obj3 = null; } else { GameObjectWeight? obj4 = ((IEnumerable<GameObjectWeight>)connectorPrefabWeights).FirstOrDefault((Func<GameObjectWeight, bool>)((GameObjectWeight prefab) => ((Object)prefab.GameObject).name == "FancyDoorMapSpawn")); if (obj4 == null) { obj3 = null; } else { SpawnSyncedObject component = obj4.GameObject.GetComponent<SpawnSyncedObject>(); if (component == null) { obj3 = null; } else { GameObject spawnPrefab = component.spawnPrefab; obj3 = ((spawnPrefab != null) ? spawnPrefab.GetComponentInChildren<AnimatedObjectTrigger>() : null); } } } } } AnimatedObjectTrigger val3 = (AnimatedObjectTrigger)obj3; if ((Object)(object)val3 != (Object)null) { GlobalReferences.woodenDoorClose = val3.boolFalseAudios; GlobalReferences.woodenDoorOpen = val3.boolTrueAudios; Plugin.Logger.LogDebug((object)"Cached wooden door SFX"); } else { Plugin.Logger.LogWarning((object)"Could not find fancy door prefab"); } break; } case "KitchenTile": { string[] array = new string[2] { "TablesMisc/ArrangementA/coffeeTable", "TablesMisc/ArrangementB/coffeeTable (1)" }; foreach (string text in array) { Transform obj = allTile.transform.Find(text); BoxCollider val = ((obj != null) ? ((Component)obj).GetComponent<BoxCollider>() : null); if ((Object)(object)val != (Object)null) { val.center = new Vector3(val.center.x, val.center.y, 3.48f); val.size = new Vector3(val.size.x, val.size.y, 4f); Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Adjusted collider on prop \"" + ((Object)val).name + "\"")); } } break; } } if (!((Object)allTile).name.StartsWith("Cave") && !((Object)allTile).name.Contains("Tunnel")) { continue; } ParticleSystemRenderer[] componentsInChildren = allTile.GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val4 in componentsInChildren) { if ((Object)(object)((Renderer)val4).sharedMaterial != (Object)null && ((Object)((Renderer)val4).sharedMaterial).name.StartsWith("RainParticle") && !((Object)val4).name.StartsWith("RainHit")) { val4.renderMode = (ParticleSystemRenderMode)3; Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Fix drip billboarding")); } } } } private static List<GameObject> GetAllTiles(IndoorMapType[] indoorMapTypes) { List<TileSet> list = new List<TileSet>(); HashSet<GameObject> hashSet = new HashSet<GameObject>(); foreach (IndoorMapType val in indoorMapTypes) { foreach (GraphNode node in val.dungeonFlow.Nodes) { list.AddRange(node.TileSets); } foreach (GraphLine line in val.dungeonFlow.Lines) { foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { list.AddRange(dungeonArchetype.TileSets); } } foreach (TileSet item in list) { foreach (GameObjectChance weight in item.TileWeights.Weights) { if (hashSet.Add(weight.Value)) { Plugin.Logger.LogDebug((object)("Cached reference to tile \"" + ((Object)weight.Value).name + "\"")); } } } } HashSet<GameObject> hashSet2 = hashSet; List<GameObject> list2 = new List<GameObject>(hashSet2.Count); list2.AddRange(hashSet2); return list2; } } } namespace ButteryFixes.Patches.Player { [HarmonyPatch] internal class BodyPatches { private static bool dontCheckBadges = true; [HarmonyPatch(typeof(DeadBodyInfo), "Start")] [HarmonyPostfix] private static void DeadBodyInfoPostStart(DeadBodyInfo __instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Invalid comparison between Unknown and I4 //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.grabBodyObject != (Object)null && __instance.playerScript.isInHangarShipRoom) { __instance.playerScript.SetItemInElevator(true, true, __instance.grabBodyObject); } if (Compatibility.DISABLE_PLAYERMODEL_PATCHES) { return; } if ((int)__instance.causeOfDeath == 14) { __instance.MakeCorpseBloody(); } SkinnedMeshRenderer componentInChildren = ((Component)__instance).GetComponentInChildren<SkinnedMeshRenderer>(); if (!((Object)(object)componentInChildren != (Object)null) || !((Object)(object)StartOfRound.Instance != (Object)null)) { return; } UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[__instance.playerScript.currentSuitID]; if (val == null) { return; } try { Material val2 = ((Renderer)componentInChildren).sharedMaterials[0]; bool flag = (int)__instance.causeOfDeath == 3; if (!flag && GlobalReferences.crashedJetpackAsLocalPlayer && (Object)(object)__instance.playerScript == (Object)(object)GameNetworkManager.Instance.localPlayerController) { flag = true; GlobalReferences.crashedJetpackAsLocalPlayer = false; __instance.setMaterialToPlayerSuit = false; Plugin.Logger.LogInfo((object)"Local player spawned a body after a jetpack crashed, caught in time to burn it"); } if (flag) { if ((Object)(object)val2 != (Object)(object)GlobalReferences.scavengerSuitBurnt) { val2 = (((Renderer)componentInChildren).sharedMaterial = GlobalReferences.scavengerSuitBurnt); NonPatchFunctions.SmokingHotCorpse(((Component)__instance).transform); } else { dontCheckBadges = true; __instance.ChangeMesh(GlobalReferences.playerBody, (Material)null); dontCheckBadges = false; } } bool flag2 = false; Renderer val3 = default(Renderer); if ((Object)(object)__instance.detachedHeadObject != (Object)null && ((Component)__instance.detachedHeadObject).TryGetComponent<Renderer>(ref val3)) { if (((Object)__instance.detachedHeadObject).name != "DecapitatedLegs") { val3.sharedMaterial = val2; } else { flag2 = true; Material[] sharedMaterials = val3.sharedMaterials; sharedMaterials[0] = val2; val3.materials = sharedMaterials; } Plugin.Logger.LogDebug((object)"Fixed helmet material on player corpse"); } if ((Object)(object)val.headCostumeObject == (Object)null && (Object)(object)val.lowerTorsoCostumeObject == (Object)null) { return; } Transform val4 = ((Component)__instance).transform.Find("spine.001"); if ((Object)(object)val.lowerTorsoCostumeObject != (Object)null) { Transform val5 = (flag2 ? __instance.detachedHeadObject : val4); if ((Object)(object)val5 != (Object)null) { GameObject val6 = Object.Instantiate<GameObject>(val.lowerTorsoCostumeObject, val5.position, val5.rotation, val5); if (!__instance.setMaterialToPlayerSuit || flag) { Renderer[] componentsInChildren = val6.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].sharedMaterial = val2; } } if (flag2) { val6.transform.SetPositionAndRotation(new Vector3(-0.040002573f, -0.06549633f, -0.03463273f), Quaternion.Euler(19.440311f, 0.011659833f, 0.052958783f)); } Plugin.Logger.LogDebug((object)"Torso attachment complete for player corpse"); } } Transform val7 = ((val4 != null) ? val4.Find("spine.002/spine.003") : null); if ((Object)(object)val.headCostumeObject != (Object)null) { Transform val8 = __instance.detachedHeadObject; if (((Object)(object)val8 == (Object)null || flag2) && (Object)(object)val7 != (Object)null) { val8 = val7.Find("spine.004"); } if ((Object)(object)val8 != (Object)null) { GameObject val9 = Object.Instantiate<GameObject>(val.headCostumeObject, val8.position, val8.rotation, val8); if ((Object)(object)val8 == (Object)(object)__instance.detachedHeadObject) { val9.transform.SetPositionAndRotation(new Vector3(0.06989373f, 0.0544735f, -0.6852454f), Quaternion.Euler(96.69699f, 0f, 0f)); val9.transform.localScale = new Vector3(val9.transform.localScale.x / val8.localScale.x, val9.transform.localScale.y / val8.localScale.y, val9.transform.localScale.z / val8.localScale.z); } if (!__instance.setMaterialToPlayerSuit || flag) { Renderer[] componentsInChildren = val9.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].sharedMaterial = val2; } } Plugin.Logger.LogDebug((object)"Head attachment complete for player corpse"); } } if ((Object)(object)val7 != (Object)null && __instance.setMaterialToPlayerSuit && !flag) { Transform val10 = Object.Instantiate<Transform>(((Component)__instance.playerScript.playerBadgeMesh).transform, val7); Transform val11 = Object.Instantiate<Transform>(((Component)__instance.playerScript.playerBetaBadgeMesh).transform, val7); if ((Object)(object)__instance.playerScript == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((Component)val10).GetComponent<Renderer>().forceRenderingOff = false; ((Component)val11).GetComponent<Renderer>().forceRenderingOff = false; } Plugin.Logger.LogDebug((object)"Badges added to player corpse"); } } catch (Exception ex) { Plugin.Logger.LogError((object)"Encountered a non-fatal error while adjusting player corpse appearance"); Plugin.Logger.LogError((object)ex); } } [HarmonyPatch(typeof(DeadBodyInfo), "ChangeMesh")] [HarmonyPostfix] private static void DeadBodyInfoPostChangeMesh(DeadBodyInfo __instance) { if (Compatibility.DISABLE_PLAYERMODEL_PATCHES || dontCheckBadges) { return; } Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (((Component)val).gameObject.layer == 0 && (((Object)val).name.StartsWith("BetaBadge") || ((Object)val).name.StartsWith("LevelSticker"))) { val.forceRenderingOff = true; Plugin.Logger.LogDebug((object)("Player corpse transformed; hide badge \"" + ((Object)val).name + "\"")); } } } [HarmonyPatch(typeof(RagdollGrabbableObject), "Start")] [HarmonyPostfix] private static void RagdollGrabbableObjectPostStart(RagdollGrabbableObject __instance) { if ((Object)(object)StartOfRound.Instance != (Object)null && !StartOfRound.Instance.isChallengeFile && ((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel") { ((GrabbableObject)__instance).scrapValue = 0; } } [HarmonyPatch(typeof(DeadBodyInfo), "SetRagdollPositionSafely")] [HarmonyPostfix] private static void PostSetRagdollPositionSafely(DeadBodyInfo __instance, Vector3 newPosition) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS && (Object)(object)__instance.grabBodyObject != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(newPosition)) { GameNetworkManager.Instance.localPlayerController.SetItemInElevator(true, true, __instance.grabBodyObject); } } } } [HarmonyPatch] internal class PlayerPatches { private static List<PlayerControllerB> bunnyhoppingPlayers = new List<PlayerControllerB>(50); [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void PlayerControllerBPostUpdate(PlayerControllerB __instance, bool ___isWalking) { if (__instance.isClimbingLadder && !Compatibility.DISABLE_LADDER_PATCH) { __instance.isSprinting = false; if (___isWalking) { __instance.playerBodyAnimator.SetFloat("animationSpeed", 1f); } } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] private static void PostConnectClientToPlayerObject(PlayerControllerB __instance) { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) if (Configuration.gameResolution.Value != GameResolution.DontChange) { RenderTexture targetTexture = __instance.gameplayCamera.targetTexture; if (Configuration.gameResolution.Value == GameResolution.High) { ((Texture)targetTexture).width = 970; ((Texture)targetTexture).height = 580; Plugin.Logger.LogInfo((object)"High resolution applied"); } else { ((Texture)targetTexture).width = 620; ((Texture)targetTexture).height = 350; Plugin.Logger.LogInfo((object)"Low resolution applied"); } GlobalReferences.patchScanNodes = true; } else { if (GlobalReferences.patchScanNodes) { Plugin.Logger.LogInfo((object)"Resolution changes reverted"); } GlobalReferences.patchScanNodes = false; } if (!Compatibility.DISABLE_PLAYERMODEL_PATCHES) { Transform obj = __instance.localVisor.Find("ScavengerHelmet"); Renderer val = ((obj != null) ? ((Component)obj).GetComponent<Renderer>() : null); if ((Object)(object)val != (Object)null) { val.shadowCastingMode = (ShadowCastingMode)0; Plugin.Logger.LogDebug((object)"\"Fake helmet\" no longer casts a shadow"); } } try { ((Component)__instance.playerBadgeMesh).GetComponent<Renderer>().forceRenderingOff = true; ((Renderer)__instance.playerBetaBadgeMesh).forceRenderingOff = true; Plugin.Logger.LogDebug((object)"Hide badges on local player"); } catch (Exception ex) { Plugin.Logger.LogWarning((object)"Ran into error fetching local player's badges"); Plugin.Logger.LogWarning((object)ex); } if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS && ((TMP_Text)__instance.playersManager.mapScreenPlayerName).text == "MONITORING: Player") { ((TMP_Text)__instance.playersManager.mapScreenPlayerName).SetText("MONITORING: " + __instance.playersManager.mapScreen.radarTargets[__instance.playersManager.mapScreen.targetTransformIndex].name, true); Plugin.Logger.LogDebug((object)"Fix \"MONITORING: Player\""); } GlobalReferences.crashedJetpackAsLocalPlayer = false; Light[] allHelmetLights = __instance.allHelmetLights; foreach (Light val2 in allHelmetLights) { if ((int)val2.shadows == 0) { val2.shadows = (LightShadows)1; ((Component)val2).GetComponent<HDAdditionalLightData>().shadowNearPlane = 0.66f; } } if (Configuration.restoreShipIcon.Value) { Transform val3 = __instance.playersManager.mapScreen.shipArrowUI.transform.Find("ShipIcon"); if ((Object)(object)val3 != (Object)null) { val3.localPosition = new Vector3(val3.localPosition.x, val3.localPosition.y, 0f); Plugin.Logger.LogDebug((object)"Fix ship icon on radar"); } } } [HarmonyPatch(typeof(PlayerControllerB), "PlayJumpAudio")] [HarmonyPostfix] private static void PostPlayJumpAudio(PlayerControllerB __instance, bool ___isWalking) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!Configuration.fixJumpCheese.Value || !((NetworkBehaviour)__instance).IsServer || StartOfRound.Instance.inShipPhase) { if (bunnyhoppingPlayers.Count > 0) { Plugin.Logger.LogWarning((object)"Bunnyhopping player list has some residual entries"); bunnyhoppingPlayers.Clear(); } } else { if (__instance.isInsideFactory || __instance.isInElevator || __instance.isInHangarShipRoom) { return; } EnemyType val = GlobalReferences.allEnemiesList["MouthDog"]; if ((Object)(object)val == (Object)null || val.numberSpawned < 1) { return; } bool flag = false; if (((NetworkBehaviour)__instance).IsOwner) { flag = ___isWalking; } else if (__instance.timeSincePlayerMoving < 0.25f) { Vector3 val2 = __instance.serverPlayerPosition - __instance.oldPlayerPosition; val2.y = 0f; flag = ((Vector3)(ref val2)).magnitude > float.Epsilon; } if (flag) { Plugin.Logger.LogDebug((object)("Player \"" + __instance.playerUsername + "\" is bunnyhopping with dogs outside; creating noise")); NonPatchFunctions.FakeFootstepAlert(__instance); if (!bunnyhoppingPlayers.Contains(__instance)) { bunnyhoppingPlayers.Add(__instance); } } } } [HarmonyPatch(typeof(PlayerControllerB), "LandFromJumpClientRpc")] [HarmonyPostfix] private static void PostLandFromJumpClientRpc(PlayerControllerB __instance) { if (!bunnyhoppingPlayers.Contains(__instance)) { return; } Plugin.Logger.LogDebug((object)("Player \"" + __instance.playerUsername + "\" landed from bunnyhop")); if (Configuration.fixJumpCheese.Value && ((NetworkBehaviour)__instance).IsServer) { EnemyType val = GlobalReferences.allEnemiesList["MouthDog"]; if ((Object)(object)val != (Object)null && val.numberSpawned >= 1) { NonPatchFunctions.FakeFootstepAlert(__instance); } } bunnyhoppingPlayers.Remove(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepSound")] [HarmonyPostfix] private static void PostPlayFootstepSound(PlayerControllerB __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsServer && !((NetworkBehaviour)__instance).IsOwner) { bool[] playerWasLastSprinting = NonPatchFunctions.playerWasLastSprinting; nint num = checked((nint)__instance.actualClientId); AnimatorStateInfo currentAnimatorStateInfo = __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(0); playerWasLastSprinting[num] = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("Sprinting"); } } [HarmonyPatch(typeof(PlayerControllerB), "QEItemInteract_performed")] [HarmonyPatch(typeof(PlayerControllerB), "ItemSecondaryUse_performed")] [HarmonyPatch(typeof(PlayerControllerB), "ItemTertiaryUse_performed")] [HarmonyPrefix] private static void PreItem_performed(PlayerControllerB __instance) { if (__instance.equippedUsableItemQE && (Object)(object)__instance.currentlyHeldObjectServer != (Object)null && (__instance.currentlyHeldObjectServer is FlashlightItem || __instance.currentlyHeldObjectServer is JetpackItem || __instance.currentlyHeldObjectServer is BoomboxItem || ((Object)__instance.currentlyHeldObjectServer.itemProperties).name == "Hairdryer")) { __instance.equippedUsableItemQE = false; Plugin.Logger.LogWarning((object)"Tried to use Q/E controls on an item with no secondary/tertiary use. This shouldn't happen"); } } [HarmonyPatch(typeof(PlayerControllerB), "PlaceGrabbableObject")] [HarmonyPostfix] private static void PostPlaceGrabbableObject(GrabbableObject placeObject) { if (StartOfRound.Instance.isObjectAttachedToMagnet && (Object)(object)StartOfRound.Instance.attachedVehicle != (Object)null && (Object)(object)((Component)placeObject).transform.parent == (Object)(object)((Component)StartOfRound.Instance.attachedVehicle).transform) { GameNetworkManager.Instance.localPlayerController.SetItemInElevator(true, true, placeObject); Plugin.Logger.LogDebug((object)$"Item \"{placeObject.itemProperties.itemName}\" #{((Object)placeObject).GetInstanceID()} was placed inside a magnetized Cruiser and auto-collected"); } } } [HarmonyPatch] internal class SuitPatches { private static bool localCostumeChanged; [HarmonyPatch(typeof(UnlockableSuit), "ChangePlayerCostumeElement")] [HarmonyPrefix] private static void PreChangePlayerCostumeElement(ref Transform costumeContainer, GameObject newCostume) { if (Compatibility.DISABLE_PLAYERMODEL_PATCHES || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } if ((Object)(object)costumeContainer == (Object)(object)GameNetworkManager.Instance.localPlayerController.headCostumeContainerLocal) { costumeContainer = GameNetworkManager.Instance.localPlayerController.headCostumeContainer; if ((Object)(object)newCostume != (Object)null) { localCostumeChanged = true; } } else if ((Object)(object)costumeContainer == (Object)(object)GameNetworkManager.Instance.localPlayerController.lowerTorsoCostumeContainer && (Object)(object)newCostume != (Object)null) { localCostumeChanged = true; } } [HarmonyPatch(typeof(UnlockableSuit), "ChangePlayerCostumeElement")] [HarmonyPostfix] private static void PostChangePlayerCostumeElement(ref Transform costumeContainer) { if (localCostumeChanged) { localCostumeChanged = false; Renderer[] componentsInChildren = ((Component)costumeContainer).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].shadowCastingMode = (ShadowCastingMode)3; } Plugin.Logger.LogDebug((object)("Local costume part only draws shadow - " + ((Object)costumeContainer).name)); } } [HarmonyPatch(typeof(UnlockableSuit), "SwitchSuitForPlayer")] [HarmonyPostfix] private static void PostSwitchSuitForPlayer(PlayerControllerB player, int suitID) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { UnlockableSuit.ChangePlayerCostumeElement(player.lowerTorsoCostumeContainer, StartOfRound.Instance.unlockablesList.unlockables[suitID].lowerTorsoCostumeObject); } } } } namespace ButteryFixes.Patches.Objects { [HarmonyPatch] internal class ApparatusPatches { [HarmonyPatch(typeof(LungProp), "Start")] [HarmonyPostfix] [HarmonyPriority(0)] private static void LungPropPostStart(LungProp __instance) { ScanNodeProperties componentInChildren = ((Component)__instance).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { if (componentInChildren.headerText == "Apparatice") { componentInChildren.headerText = "Apparatus"; } if (Configuration.showApparatusValue.Value) { componentInChildren.scrapValue = ((GrabbableObject)__instance).scrapValue; componentInChildren.subText = $"Value: ${componentInChildren.scrapValue}"; } Plugin.Logger.LogDebug((object)"Scan node: Apparatus"); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TransDisconnectFromMachinery(IEnumerable<CodeInstruction> instructions) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "SpawnEnemyGameObject", (Type[])null, (Type[])null); for (int i = 2; i < list.Count; i++) { if (list[i].opcode == OpCodes.Callvirt && (MethodInfo)list[i].operand == methodInfo) { list.Insert(i + 2, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(NonPatchFunctions), "OldBirdSpawnsFromApparatus", (Type[])null, (Type[])null))); Plugin.Logger.LogDebug((object)"Transpiler (Radiation warning): Add Old Bird values after spawning"); return list; } } Plugin.Logger.LogError((object)"Radiation warning transpiler failed"); return instructions; } } [HarmonyPatch] internal class BreakerBoxPatches { [HarmonyPatch(typeof(BreakerBox), "SetSwitchesOff")] [HarmonyPostfix] private static void PostSetSwitchesOff(BreakerBox __instance) { __instance.breakerBoxHum.Stop(); } [HarmonyPatch(typeof(BreakerBox), "SwitchBreaker")] [HarmonyPostfix] private static void PostSwitchBreaker(BreakerBox __instance) { if (__instance.breakerBoxHum.isPlaying && RoundManager.Instance.powerOffPermanently) { __instance.breakerBoxHum.Stop(); } } } [HarmonyPatch] internal class CruiserPatches { private static float radioPingTimestamp; [HarmonyPatch(typeof(VehicleController), "DestroyCar")] [HarmonyPostfix] private static void PostDestroyCar(VehicleController __instance) { __instance.hoodAudio.mute = true; ((Component)__instance.healthMeter).GetComponentInChildren<Renderer>().forceRenderingOff = true; ((Component)__instance.turboMeter).GetComponentInChildren<Renderer>().forceRenderingOff = true; } [HarmonyPatch(typeof(VehicleController), "SetCarEffects")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TransSetCarEffects(IEnumerable<CodeInstruction> instructions) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "PlayAudibleNoise", (Type[])null, (Type[])null); for (int i = 0; i < list.Count; i++) { if (!(list[i].opcode == OpCodes.Callvirt) || !((MethodInfo)list[i].operand == methodInfo)) { continue; } for (int j = i + 1; j < list.Count; j++) { if (list[j].opcode == OpCodes.Br) { list.Insert(i + 1, new CodeInstruction(OpCodes.Br, list[j].operand)); Plugin.Logger.LogDebug((object)"Transpiler (Cruiser noise alert): Fix 2 audible noises at once"); return list; } } } Plugin.Logger.LogError((object)"Cruiser noise alert transpiler failed"); return instructions; } [HarmonyPatch(typeof(VehicleController), "SetRadioValues")] [HarmonyPostfix] private static void PostSetRadioValues(VehicleController __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsServer && __instance.radioAudio.isPlaying && Time.realtimeSinceStartup > radioPingTimestamp) { radioPingTimestamp = Time.realtimeSinceStartup + 2f; RoundManager.Instance.PlayAudibleNoise(((Component)__instance.radioAudio).transform.position, 16f, Mathf.Min((__instance.radioAudio.volume + __instance.radioInterference.volume) * 0.5f, 0.9f), 0, false, 2692); } } [HarmonyPatch(typeof(VehicleController), "CollectItemsInTruck")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TransCollectItemsInTruck(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(Physics), "OverlapSphere", new Type[4] { typeof(Vector3), typeof(float), typeof(int), typeof(QueryTriggerInteraction) }, (Type[])null); for (int i = 1; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && (MethodInfo)list[i].operand == methodInfo && list[i - 1].opcode == OpCodes.Ldc_I4_1) { list[i - 1].opcode = OpCodes.Ldc_I4_2; Plugin.Logger.LogDebug((object)"Transpiler (Cruiser collect): Auto-collect trigger colliders, for Teeth"); return list; } } Plugin.Logger.LogError((object)"Cruiser collect transpiler failed"); return instructions; } } [HarmonyPatch] internal class DramaticMaskPatches { [HarmonyPatch(typeof(HauntedMaskItem), "MaskClampToHeadAnimationEvent")] [HarmonyPostfix] private static void PostMaskClampToHeadAnimationEvent(HauntedMaskItem __instance) { if (__instance.maskTypeId == 5) { Plugin.Logger.LogDebug((object)"Player is being converted by a Tragedy mask; about to replace mask prefab appearance"); NonPatchFunctions.ConvertMaskToTragedy(((Component)__instance.currentHeadMask).transform); } } } [HarmonyPatch] internal class ElevatorPatches { [HarmonyPatch(typeof(MineshaftElevatorController), "OnEnable")] [HarmonyPostfix] private static void MineshaftElevatorControllerPostOnEnable(MineshaftElevatorController __instance) { __instance.elevatorJingleMusic.dopplerLevel = 0.58f * GlobalReferences.dopplerLevelMult; Plugin.Logger.LogDebug((object)"Doppler level: Mineshaft elevator"); } } [HarmonyPatch] internal class ExtensionLadderPatches { [HarmonyPatch(typeof(ExtensionLadderItem), "StartLadderAnimation")] [HarmonyPostfix] private static void PostStartLadderAnimation(ref bool ___ladderBlinkWarning) { if (___ladderBlinkWarning) { ___ladderBlinkWarning = false; Plugin.Logger.LogDebug((object)"Fixed broken extension ladder warning"); } } [HarmonyPatch(typeof(ExtensionLadderItem), "Update")] [HarmonyPostfix] private static void ExtensionLadderItemPostUpdate(ExtensionLadderItem __instance) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.suckingPlayersOutOfShip && !((GrabbableObject)__instance).itemUsedUp) { ((GrabbableObject)__instance).itemUsedUp = true; for (int i = 0; i < ((GrabbableObject)__instance).propColliders.Length; i++) { ((GrabbableObject)__instance).propColliders[i].excludeLayers = LayerMask.op_Implicit(-1); } Plugin.Logger.LogDebug((object)"Suck players through ladder"); } } } [HarmonyPatch] internal class FlashlightPatches { [HarmonyPatch(typeof(FlashlightItem), "PocketItem")] [HarmonyPatch(typeof(FlashlightItem), "DiscardItem")] [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] [HarmonyPostfix] private static void FlashlightItemPost(PlayerControllerB ___previousPlayerHeldBy) { if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS && !((Object)(object)___previousPlayerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { NonPatchFunctions.ForceRefreshAllHelmetLights(___previousPlayerHeldBy); } } } [HarmonyPatch] internal class ItemPatches { [HarmonyPatch(typeof(GrabbableObject), "ChargeBatteries")] [HarmonyPostfix] private static void PostChargeBatteries(GrabbableObject __instance) { BoomboxItem val = (BoomboxItem)(object)((__instance is BoomboxItem) ? __instance : null); if ((Object)(object)val != (Object)null && val.isPlayingMusic && val.boomboxAudio.pitch < 1f && ((GrabbableObject)val).insertedBattery.charge > 0f) { val.boomboxAudio.pitch = 1f; Plugin.Logger.LogDebug((object)"Boombox was recharged, correcting pitch"); } } [HarmonyPatch(typeof(GrabbableObjectPhysicsTrigger), "OnTriggerEnter")] [HarmonyPrefix] private static bool GrabbableObjectPhysicsTriggerPreOnTriggerEnter(GrabbableObjectPhysicsTrigger __instance, Collider other) { if (((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect val = default(EnemyAICollisionDetect); if (!((Component)other).TryGetComponent<EnemyAICollisionDetect>(ref val) || (Object)(object)val.mainScript == (Object)null) { return false; } if (val.mainScript.isEnemyDead) { return false; } if (__instance.itemScript.isInShipRoom && (StartOfRound.Instance.shipIsLeaving || !val.mainScript.isInsidePlayerShip || val.mainScript is ForestGiantAI || val.mainScript is RadMechAI)) { return false; } } return true; } [HarmonyPatch(typeof(GrabbableObject), "PocketItem")] [HarmonyPostfix] private static void GrabbableObjectPostPocketItem(GrabbableObject __instance) { if ((Object)(object)__instance.playerHeldBy != (Object)null) { __instance.playerHeldBy.playerBodyAnimator.SetTrigger(__instance.itemProperties.twoHandedAnimation ? "SwitchHoldAnimationTwoHanded" : "SwitchHoldAnimation"); } } } [HarmonyPatch] internal class JetpackPatches { [HarmonyPatch(typeof(JetpackItem), "ExplodeJetpackClientRpc")] [HarmonyPostfix] public static void PostExplodeJetpackClientRpc(JetpackItem __instance, PlayerControllerB ___previousPlayerHeldBy) { if (Compatibility.DISABLE_PLAYERMODEL_PATCHES) { return; } DeadBodyInfo val = ___previousPlayerHeldBy.deadBody; if ((Object)(object)val == (Object)null) { DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>(); foreach (DeadBodyInfo val2 in array) { if ((Object)(object)val2.playerScript == (Object)(object)___previousPlayerHeldBy) { val = val2; } } } if ((Object)(object)val != (Object)null) { val.setMaterialToPlayerSuit = false; Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(); foreach (Renderer val3 in componentsInChildren) { if (((Component)val3).gameObject.layer == 0 && (((Object)val3).name.StartsWith("BetaBadge") || ((Object)val3).name.StartsWith("LevelSticker"))) { val3.forceRenderingOff = true; } else if (((Component)val3).gameObject.layer == 20 && (val3 is SkinnedMeshRenderer || val3 is MeshRenderer)) { val3.sharedMaterial = GlobalReferences.scavengerSuitBurnt; } } NonPatchFunctions.SmokingHotCorpse(((Component)val).transform); Plugin.Logger.LogDebug((object)"Jetpack exploded and burned player corpse"); } else { Plugin.Logger.LogWarning((object)"Jetpack exploded but the player that crashed it didn't spawn a body"); if ((Object)(object)___previousPlayerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { GlobalReferences.crashedJetpackAsLocalPlayer = true; Plugin.Logger.LogInfo((object)"Local player crashed, try to run other patch when corpse is spawned"); } } } } [HarmonyPatch] internal class LandminePatches { [HarmonyPatch(typeof(Landmine), "Detonate")] [HarmonyPostfix] private static void LandminePostDetonate(Landmine __instance) { Transform parent = ((Component)__instance).transform.parent; object obj; if (parent == null) { obj = null; } else { Transform obj2 = parent.Find("ScanSphere"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<Renderer>() : null); } Renderer val = (Renderer)obj; if ((Object)(object)val != (Object)null) { val.forceRenderingOff = true; Plugin.Logger.LogDebug((object)"Landmine: Hide radar dot after detonation"); } if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS) { Transform parent2 = ((Component)__instance).transform.parent; ScanNodeProperties val2 = ((parent2 != null) ? ((Component)parent2).GetComponentInChildren<ScanNodeProperties>() : null); if ((Object)(object)val2 != (Object)null) { ((Component)val2).GetComponent<Collider>().enabled = false; Plugin.Logger.LogDebug((object)"Landmine: Hide scan node after detonation"); } TerminalAccessibleObject val3 = default(TerminalAccessibleObject); if (((Component)__instance).TryGetComponent<TerminalAccessibleObject>(ref val3)) { Object.Destroy((Object)(object)val3); Plugin.Logger.LogDebug((object)"Landmine: Hide terminal code after detonation"); } } } [HarmonyPatch(typeof(Landmine), "SetOffMineAnimation")] [HarmonyPrefix] private static bool PreSetOffMineAnimation(Landmine __instance) { if (__instance.hasExploded) { return ((Component)__instance).GetComponent<Renderer>().enabled; } return true; } } [HarmonyPatch] internal class ShipLightPatches { [HarmonyPatch(typeof(CozyLights), "Update")] [HarmonyPrefix] private static bool CozyLightsPreUpdate(CozyLights __instance, ref bool ___cozyLightsOn) { if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.firingPlayersCutsceneRunning && (Object)(object)GlobalReferences.shipAnimator != (Object)null && GlobalReferences.shipAnimator.GetBool("AlarmRinging")) { if (___cozyLightsOn) { __instance.cozyLightsAnimator.SetBool("on", false); ___cozyLightsOn = false; } if ((Object)(object)__instance.turnOnAudio != (Object)null) { __instance.SetAudio(); } return false; } return true; } } [HarmonyPatch] internal class ShotgunPatches { [HarmonyPatch(typeof(ShotgunItem), "ReloadGunEffectsClientRpc")] [HarmonyPostfix] private static void PostReloadGunEffectsClientRpc(ShotgunItem __instance, bool start) { if (start && !((NetworkBehaviour)__instance).IsOwner) { ((Renderer)__instance.shotgunShellLeft).enabled = __instance.shellsLoaded > 0; ((Renderer)__instance.shotgunShellRight).enabled = false; ((MonoBehaviour)__instance).StartCoroutine(NonPatchFunctions.ShellsAppearAfterDelay(__instance)); Plugin.Logger.LogDebug((object)"Shotgun was reloaded by another client; animating shells"); } } [HarmonyPatch(typeof(ShotgunItem), "Update")] [HarmonyPostfix] private static void ShotgunItemPostUpdate(ShotgunItem __instance) { if (__instance.isReloading) { ((Renderer)__instance.shotgunShellLeft).forceRenderingOff = false; ((Renderer)__instance.shotgunShellRight).forceRenderingOff = false; } } [HarmonyPatch(typeof(ShotgunItem), "Start")] [HarmonyPatch(typeof(ShotgunItem), "DiscardItem")] [HarmonyPostfix] private static void DontRenderShotgunShells(ShotgunItem __instance) { ((Renderer)__instance.shotgunShellLeft).forceRenderingOff = true; ((Renderer)__instance.shotgunShellRight).forceRenderingOff = true; } [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ShotgunItemTransShootGun(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); bool flag = false; for (int i = 2; i < list.Count; i++) { if (!flag && list[i].opcode == OpCodes.Bge_Un && list[i - 2].opcode == OpCodes.Ldloc_2) { for (int j = i + 1; j < list.Count - 1; j++) { int num = -1; if (list[j + 1].opcode == OpCodes.Ldloc_2) { if (num >= 0 && list[j].opcode == OpCodes.Br) { list.Insert(num, new CodeInstruction(OpCodes.Br, list[j].operand)); Plugin.Logger.LogDebug((object)"Transpiler (Shotgun blast): Fix ear-ringing severity in extremely close range"); flag = true; break; } if (num < 0 && list[j].opcode == OpCodes.Stloc_S) { num = j + 1; } } } } else if (list[i].opcode == OpCodes.Newarr && (Type)list[i].operand == typeof(RaycastHit) && list[i - 1].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i - 1].operand == 10) { list[i - 1].operand = 50; Plugin.Logger.LogDebug((object)"Transpiler (Shotgun blast): Resize target colliders array"); } else if (list[i].opcode == OpCodes.Call && list[i].operand.ToString().Contains("SphereCastNonAlloc")) { list.InsertRange(i + 2, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldloca_S, list[i + 1].operand), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldflda, (object)ReflectionCache.ENEMY_COLLIDERS), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(NonPatchFunctions), "ShotgunPreProcess", (Type[])null, (Type[])null)) })); Plugin.Logger.LogDebug((object)"Transpiler (Shotgun blast): Pre-process shotgun targets"); } } return list; } } [HarmonyPatch] internal class SpikeTrapPatches { [HarmonyPatch(typeof(SpikeRoofTrap), "StickBodyToSpikes")] [HarmonyPostfix] private static void PostStickBodyToSpikes(DeadBodyInfo body) { if (!Compatibility.DISABLE_PLAYERMODEL_PATCHES) { body.MakeCorpseBloody(); } } } [HarmonyPatch] internal class SprayPaintPatches { [HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")] [HarmonyPrefix] private static void SprayPaintItemPreLateUpdate(SprayPaintItem __instance, ref bool ___isSpraying, ref float ___sprayInterval, DecalProjector ___delayedSprayPaintDecal) { if (___isSpraying) { if (((GrabbableObject)__instance).itemProperties.canBeInspected && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && ((GrabbableObject)__instance).playerHeldBy.IsInspectingItem) { ___isSpraying = false; __instance.StopSpraying(); } else if (!Compatibility.DISABLE_SPRAY_PAINT_PATCHES && !__instance.isWeedKillerSprayBottle && ___sprayInterval > 0f && (Object)(object)___delayedSprayPaintDecal != (Object)null && ((Behaviour)___delayedSprayPaintDecal).enabled && ___sprayInterval < __instance.sprayIntervalSpeed - Time.fixedDeltaTime) { ___sprayInterval = 0f; } } } [HarmonyPatch(typeof(SprayPaintItem), "ItemActivate")] [HarmonyPrefix] private static void SprayPaintItemPreItemActivate(SprayPaintItem __instance, ref bool buttonDown, float ___sprayCanTank) { if (buttonDown && ((GrabbableObject)__instance).itemProperties.canBeInspected && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && ((GrabbableObject)__instance).playerHeldBy.IsInspectingItem && ___sprayCanTank > 0f) { buttonDown = false; } } [HarmonyPatch(typeof(SprayPaintItem), "EquipItem")] [HarmonyPostfix] private static void SprayPaintItemPostEquipItem(SprayPaintItem __instance) { if (__instance.isWeedKillerSprayBottle) { ((GrabbableObject)__instance).playerHeldBy.equippedUsableItemQE = false; } } [HarmonyPatch(typeof(SprayPaintItem), "Start")] [HarmonyPostfix] private static void SprayPaintItemPostStart(SprayPaintItem __instance, ref int ___sprayCanMatsIndex) { if (!__instance.isWeedKillerSprayBottle) { if (!Compatibility.DISABLE_SPRAY_PAINT_PATCHES) { __instance.sprayIntervalSpeed = 0.037f; __instance.maxSprayPaintDecals = 2200; } if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS) { ___sprayCanMatsIndex = new Random((int)((NetworkBehaviour)__instance).NetworkObjectId).Next(__instance.particleMats.Length); ((Renderer)((Component)__instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = __instance.particleMats[___sprayCanMatsIndex]; ((Renderer)((Component)__instance.sprayCanNeedsShakingParticle).GetComponent<ParticleSystemRenderer>()).material = __instance.particleMats[___sprayCanMatsIndex]; Plugin.Logger.LogDebug((object)$"Rerolled spray can #{((NetworkBehaviour)__instance).NetworkObjectId} color"); } } } [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] [HarmonyPrefix] private static void PreAddSprayPaintLocal(SprayPaintItem __instance, ref int ___sprayPaintMask, ref int ___addSprayPaintWithFrameDelay, DecalProjector ___delayedSprayPaintDecal) { if (!Compatibility.DISABLE_SPRAY_PAINT_PATCHES) { int num = 67108864; if (((GrabbableObject)__instance).isInShipRoom || ((GrabbableObject)__instance).isInElevator || ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && (((GrabbableObject)__instance).playerHeldBy.isInHangarShipRoom || ((GrabbableObject)__instance).playerHeldBy.isInElevator)) || StartOfRound.Instance.inShipPhase || (Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null) { ___sprayPaintMask |= num; } else { ___sprayPaintMask &= ~num; } if (___addSprayPaintWithFrameDelay > 0) { ___addSprayPaintWithFrameDelay = 0; ((Behaviour)___delayedSprayPaintDecal).enabled = true; } } } [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TransAddSprayPaintLocal(IEnumerable<CodeInstruction> instructions) { if (Compatibility.DISABLE_SPRAY_PAINT_PATCHES) { return instructions; } List<CodeInstruction> list = instructions.ToList(); for (int i = 1; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.175f && list[i - 1].opcode == OpCodes.Call && list[i - 1].operand.ToString().Contains("Distance")) { list[i].operand = 0.1f; Plugin.Logger.LogDebug((object)"Transpiler (Spray paint): Decrease distance between decals"); return list; } } Plugin.Logger.LogError((object)"Spray paint transpiler failed"); return instructions; } } [HarmonyPatch] internal class ThrowablePatches { [HarmonyPatch(typeof(StunGrenadeItem), "Start")] [HarmonyPostfix] private static void StunGrenadeItemPostStartStart(ref int ___stunGrenadeMask) { ___stunGrenadeMask |= 1 << LayerMask.NameToLayer("Catwalk"); } } } namespace ButteryFixes.Patches.General { [HarmonyPatch] internal class GameNetworkManagerPatches { [HarmonyPatch(typeof(GameNetworkManager), "SaveGame")] [HarmonyPostfix] private static void PostSaveGame(GameNetworkManager __instance) { if (!__instance.isHostingGame || StartOfRound.Instance.isChallengeFile || !StartOfRound.Instance.inShipPhase) { return; } Terminal val = Object.FindObjectOfType<Terminal>(); if (!((Object)(object)val != (Object)null)) { return; } try { ES3.Save<int>("ButteryFixes_DeliveryVehicle", val.orderedVehicleFromTerminal, __instance.currentSaveFileName); if (val.vehicleInDropship) { Plugin.Logger.LogInfo((object)"Dropship inventory saved (Vehicle)"); return; } ES3.Save<List<int>>("ButteryFixes_DeliveryItems", val.orderedItemsFromTerminal, __instance.currentSaveFileName); Plugin.Logger.LogInfo((object)$"Dropship inventory saved ({val.numberOfItemsInDropship} items)"); } catch (Exception ex) { Plugin.Logger.LogError((object)("An error occurred while trying to save dropship inventory to file \"" + GameNetworkManager.Instance.currentSaveFileName + "\"")); Plugin.Logger.LogError((object)ex); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void GameNetworkManagerPostDisconnect() { GlobalReferences.allEnemiesList.Clear(); } } [HarmonyPatch] internal class HUDManagerPatches { [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")] [HarmonyPostfix] private static void PostUpdateScanNodes(HUDManager __instance, Dictionary<RectTransform, ScanNodeProperties> ___scanNodes) { //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_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!GlobalReferences.patchScanNodes || (Object)(object)GameNetworkManager.Instance?.localPlayerController == (Object)null) { return; } Rect rect = ((Component)__instance.playerScreenTexture).GetComponent<RectTransform>().rect; for (int i = 0; i < __instance.scanElements.Length; i++) { if (___scanNodes.TryGetValue(__instance.scanElements[i], out var value)) { Vector3 val = GameNetworkManager.Instance.localPlayerController.gameplayCamera.WorldToViewportPoint(((Component)value).transform.position); __instance.
BepInEx/plugins/ZoLoKinoBabo112/com.ctnoriginals.crosshair.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CrossHair.Utilities; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; 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("com.ctnoriginals.crosshair")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds a CrossHair to the center of your screen to indicate where you are aiming.")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("CrossHair")] [assembly: AssemblyTitle("com.ctnoriginals.crosshair")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CrossHair { [BepInPlugin("com.ctnoriginals.crosshair", "CrossHair", "1.1.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.ctnoriginals.crosshair"); public static ConfigFile Config = new ConfigFile(Paths.ConfigPath + "\\com.ctnoriginals.crosshair.cfg", true); public static ConfigEntry<string> CrossHairText; public static ConfigEntry<float> CrossHairSize; public static ConfigEntry<bool> CrossHairShadow; public static ConfigEntry<string> CrossHairColor; public static ConfigEntry<int> CrossHairOpacity; public static ConfigEntry<bool> CrossHairFading; public static ManualLogSource CLog; public static bool DebugMode = false; private void Awake() { CLog = ((BaseUnityPlugin)this).Logger; CLog.LogInfo((object)("Plugin com.ctnoriginals.crosshair is loaded! Version: 1.1.1 (" + (DebugMode ? "Debug" : "Release") + ")")); ConfigFile(); harmony.PatchAll(); } private void ConfigFile() { CrossHairText = Config.Bind<string>("!General", "CrossHairText", "- + -", "Text to display as crosshair (use \\n for new line)"); CrossHairSize = Config.Bind<float>("!General", "CrossHairSize", 50f, "Size of the crosshair"); CrossHairShadow = Config.Bind<bool>("!General", "CrossHairShadow", true, "Whether to display a shadow behind the crosshair"); CrossHairColor = Config.Bind<string>("Appearance", "CrossHairColor", "ffffff", "Color of the crosshair in hexadecimal (Do not include the #)"); CrossHairOpacity = Config.Bind<int>("Appearance", "CrossHairOpacity", 80, "Opacity of the crosshair (0 to 100)%"); CrossHairFading = Config.Bind<bool>("Appearance", "CrossHairFading", true, "Whether the crosshair should fade in and out in specific situations"); CrossHair.Utilities.Console.LogMessage("CrossHairText: " + CrossHairText.Value); CrossHair.Utilities.Console.LogMessage($"CrossHairSize: {CrossHairSize.Value}"); CrossHair.Utilities.Console.LogMessage($"CrossHairShadow: {CrossHairShadow.Value}"); CrossHair.Utilities.Console.LogMessage("CrossHairColor: " + CrossHairColor.Value); CrossHair.Utilities.Console.LogMessage($"CrossHairOpacity: {CrossHairOpacity.Value}"); CrossHair.Utilities.Console.LogMessage($"CrossHairFading: {CrossHairFading.Value}"); Config.Save(); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.ctnoriginals.crosshair"; public const string PLUGIN_NAME = "CrossHair"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace CrossHair.Utilities { public static class Console { public static void Log(string message) { SendLog(message, "Log"); } public static void LogInfo(string message) { SendLog(message, "LogInfo"); } public static void LogError(string message) { SendLog(message, "LogError"); } public static void LogWarning(string message) { SendLog(message, "LogWarning"); } public static void LogDebug(string message) { SendLog(message, "LogDebug"); } public static void LogFatal(string message) { SendLog(message, "LogFatal"); } public static void LogMessage(string message) { SendLog(message, "LogMessage"); } private static void SendLog(string message, string level = null) { if (!Plugin.DebugMode && (level == "LogDebug" || level == "LogInfo")) { return; } switch (level) { case "LogInfo": Plugin.CLog.LogInfo((object)message); return; case "LogError": Plugin.CLog.LogError((object)message); return; case "LogWarning": Plugin.CLog.LogWarning((object)message); return; case "LogDebug": Plugin.CLog.LogDebug((object)message); return; case "LogFatal": Plugin.CLog.LogFatal((object)message); return; case "LogMessage": Plugin.CLog.LogMessage((object)message); return; } if (level != "Log") { Debug.Log((object)("[" + level + "]: " + message)); } else { Debug.Log((object)message); } } } public class PrivateFieldAccessor<InstanceType> { private FieldInfo _field; private object _instance; public PrivateFieldAccessor(object instance, string fieldname) { _field = typeof(InstanceType).GetField(fieldname, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _instance = instance; } public T Get<T>() { return Utils.GetInstanceField<T>(_instance, _field.Name); } public void Set<T>(T value) { _field.SetValue(_instance, value); } } internal static class Utils { public static T GetInstanceField<T>(object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; return (T)instance.GetType().GetField(fieldName, bindingAttr).GetValue(instance); } } } namespace CrossHair.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { public static Transform CrossHair; public static TextMeshProUGUI CrossHairTMP; public static float CrossHairAlpha = 200f; public static Transform CrossHairShadow; public static float CrossHairShadowAlpha = 100f; [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ref HUDManager __instance) { //IL_0000: 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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) CrossHair = ((TMP_Text)Object.Instantiate<TextMeshProUGUI>(new GameObject().AddComponent<TextMeshProUGUI>())).transform; global::CrossHair.Utilities.Console.LogDebug(((Object)CrossHair).name ?? ""); ((Object)CrossHair).name = "CrossHair"; Transform transform = ((Component)((Component)__instance.PTTIcon).transform.parent.parent.parent.Find("PlayerCursor").Find("Cursor")).transform; CrossHairTMP = ((Component)CrossHair).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)CrossHairTMP).rectTransform; ((Transform)rectTransform).SetParent(transform, false); rectTransform.anchoredPosition = new Vector2(0f, 0f); ((Transform)rectTransform).localPosition = new Vector3(0f, 0f, 0f); rectTransform.offsetMin = new Vector2(-500f, -500f); rectTransform.offsetMax = new Vector2(500f, 500f); string text = Plugin.CrossHairColor.Value; if (text.Length != 6) { text = HexFormatException("character amount: \"" + text + "\""); } int num = 16777215; try { num = int.Parse(text.Replace("#", ""), NumberStyles.HexNumber); } catch (FormatException) { num = int.Parse(HexFormatException("color: \"" + text + "\""), NumberStyles.HexNumber); } Color color = Color.FromArgb(num); CrossHairAlpha = (int)(byte)(Plugin.CrossHairOpacity.Value * 255 / 100); CrossHairShadowAlpha = (int)(byte)(CrossHairAlpha * 50f / 100f); ((TMP_Text)CrossHairTMP).text = Plugin.CrossHairText.Value; ((TMP_Text)CrossHairTMP).fontSize = Plugin.CrossHairSize.Value; ((Graphic)CrossHairTMP).color = Color32.op_Implicit(new Color32(color.R, color.G, color.B, (byte)Mathf.RoundToInt(CrossHairAlpha))); global::CrossHair.Utilities.Console.LogDebug($"CrossHairColor: ({color.R}, {color.G}, {color.B}, {CrossHairAlpha})"); ((TMP_Text)CrossHairTMP).alignment = (TextAlignmentOptions)514; ((TMP_Text)CrossHairTMP).font = ((TMP_Text)__instance.controlTipLines[0]).font; ((Behaviour)CrossHairTMP).enabled = true; if (Plugin.CrossHairShadow.Value) { CrossHairShadow = Object.Instantiate<Transform>(CrossHair, transform); TextMeshProUGUI component = ((Component)CrossHairShadow).GetComponent<TextMeshProUGUI>(); ((Object)CrossHairShadow).name = "CrossHairShadow"; ((TMP_Text)component).fontSize = Plugin.CrossHairSize.Value; ((Graphic)component).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)CrossHairShadowAlpha)); ((Transform)((TMP_Text)component).rectTransform).localPosition = new Vector3(2f, -2f, 0f); ((Transform)rectTransform).SetAsLastSibling(); } } public static void SetCrossHairAlphaPercent(float target) { if (Object.op_Implicit((Object)(object)CrossHair)) { ((TMP_Text)((Component)CrossHair).GetComponent<TextMeshProUGUI>()).alpha = target * (CrossHairAlpha / 255f); if (Object.op_Implicit((Object)(object)CrossHairShadow)) { ((TMP_Text)((Component)CrossHairShadow).GetComponent<TextMeshProUGUI>()).alpha = target * (CrossHairShadowAlpha / 255f); } } } private static string HexFormatException(string message = "color") { global::CrossHair.Utilities.Console.LogMessage("Invalid hex " + message + ", using default color (ffffff)"); Plugin.CrossHairColor.Value = "ffffff"; Plugin.Config.Save(); return "ffffff"; } } public class TargetFieldHook { public string fieldName; public object targetValue; private float fadeValue; private float fadeOutDuration; private float fadeInDuration; public PrivateFieldAccessor<PlayerControllerB> field; private bool isFading; public float currentFade = 1f; private float fadeTimer; public TargetFieldHook(PlayerControllerB playerInstance, string fieldName, object targetValue, float fadeValue = 0.2f, float fadeOutDuration = 0.2f, float fadeInDuration = 0.5f) { this.fieldName = fieldName; this.targetValue = targetValue; this.fadeValue = fadeValue; this.fadeOutDuration = fadeOutDuration; this.fadeInDuration = fadeInDuration; field = new PrivateFieldAccessor<PlayerControllerB>(playerInstance, fieldName); } public bool GetState() { object obj = field.Get<object>(); try { object obj2 = targetValue; InteractTrigger val = (InteractTrigger)((obj2 is InteractTrigger) ? obj2 : null); if (val == null) { if (!(obj2 is bool flag)) { if (!(obj2 is float num)) { if (!(obj2 is int num2)) { if (obj2 is string text) { return (string)obj == text; } throw new TypeAccessException($"TargetFieldHook.GetState() - Unknown type: {targetValue.GetType()}"); } return (int)obj == num2; } return (float)obj == num; } return (bool)obj == flag; } return obj != null == Object.op_Implicit((Object)(object)val); } catch (TypeAccessException ex) { CrossHair.Utilities.Console.LogError(ex.ToString()); } CrossHair.Utilities.Console.LogDebug($"{fieldName} - Unknown type: {targetValue.GetType()}"); return false; } public void Update() { if (isFading) { if (!GetState()) { isFading = false; fadeTimer = currentFade; } else if (currentFade > fadeValue) { currentFade = Mathf.Lerp(1f, fadeValue, fadeTimer); fadeTimer += Time.deltaTime / fadeOutDuration; } } else if (GetState()) { isFading = true; fadeTimer = 1f - currentFade; } else if (currentFade < 1f) { currentFade = Mathf.Lerp(fadeValue, 1f, fadeTimer); fadeTimer += Time.deltaTime / fadeInDuration; } currentFade = Mathf.Clamp(currentFade, 0f, 1f); fadeTimer = Mathf.Clamp(fadeTimer, 0f, 1f); } public void LogValues() { CrossHair.Utilities.Console.LogDebug($"{fieldName}\nValue: {field.Get<object>()} - Target: {targetValue}\nFade: {fadeValue} - Duration: {fadeOutDuration} - {fadeInDuration}"); } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { private static List<TargetFieldHook> targetFields = new List<TargetFieldHook>(); [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] private static void ConnectClientToPlayerObject(ref PlayerControllerB __instance) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)__instance != (Object)(object)localPlayerController)) { CrossHair.Utilities.Console.LogInfo("PlayerControllerB.ConnectClientToPlayerObject() called"); if (Plugin.CrossHairFading.Value) { targetFields = new List<TargetFieldHook> { new TargetFieldHook(__instance, "isWalking", true, 0.5f, 1f, 0.25f), new TargetFieldHook(__instance, "isSprinting", true, 0.25f, 0.5f, 0.25f), new TargetFieldHook(__instance, "isJumping", true, 0.1f, 0.05f, 1f), new TargetFieldHook(__instance, "isFallingFromJump", true, 0.1f, 0.01f, 1f), new TargetFieldHook(__instance, "isFallingNoJump", true, 0.1f, 0.01f, 1f), new TargetFieldHook(__instance, "isCrouching", true, 0.5f, 0.5f, 1f), new TargetFieldHook(__instance, "isClimbingLadder", true, 0.01f, 0.25f, 2f), new TargetFieldHook(__instance, "twoHanded", true, 0.1f, 0.01f), new TargetFieldHook(__instance, "performingEmote", true, 0.05f, 0.2f, 2f), new TargetFieldHook(__instance, "isUnderwater", true, 0.025f, 0.1f, 1f), new TargetFieldHook(__instance, "inTerminalMenu", true, 0f, 0.2f, 1.5f), new TargetFieldHook(__instance, "isPlayerDead", true, 0.05f, 2.5f, 1f), new TargetFieldHook(__instance, "hasBegunSpectating", true, 0f, 5f, 50f), new TargetFieldHook(__instance, "isHoldingInteract", true, 0.1f, 0.5f) }; CrossHair.Utilities.Console.LogDebug($"PlayerControllerB.targetFields.Count: {targetFields.Count}"); } } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(ref PlayerControllerB __instance) { if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } float num = 1f; foreach (TargetFieldHook targetField in targetFields) { targetField.Update(); if (targetField.currentFade < num) { num = targetField.currentFade; _ = targetField.fieldName; } } if (Mathf.Abs(((TMP_Text)HUDManagerPatch.CrossHairTMP).alpha - num * (HUDManagerPatch.CrossHairAlpha / 255f)) > 0.0001f) { HUDManagerPatch.SetCrossHairAlphaPercent(num); } } } }
BepInEx/plugins/ZoLoKinoBabo112/com.spycibot.cozyimprovements.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using SpyciBot.LC.CozyImprovements.Improvements; using Unity.Netcode; using UnityEngine; [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("com.spycibot.cozyimprovements")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("\r\n Enhance the experience inside the ship to create a more immersive, cozy, and accessible environment. v47 compatible.\r\n ")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+39da0e927e7ba9e69220c8a7b7ef50abc7f605fb")] [assembly: AssemblyProduct("Cozy Improvements")] [assembly: AssemblyTitle("com.spycibot.cozyimprovements")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SpyciBot.LC.CozyImprovements { public class Config { public ConfigEntry<bool> configStorageLights; public ConfigEntry<bool> configLightSwitchGlow; public ConfigEntry<bool> configTerminalGlow; public ConfigEntry<bool> configTerminalMonitorAlwaysOn; public ConfigEntry<bool> configChargeStationGlow; public ConfigEntry<bool> configBigDoorButtons; public ConfigEntry<bool> configEasyLaunchLever; public ConfigEntry<bool> configBigTeleporterButtons; public ConfigEntry<bool> configBigMonitorButtons; public Config(ConfigFile cfg) { configStorageLights = cfg.Bind<bool>("General", "StorageLightsEnabled", true, "Enables the Storage Lights System"); configLightSwitchGlow = cfg.Bind<bool>("General", "LightSwitchGlowEnabled", true, "Makes the LightSwitch glow in the dark"); configTerminalGlow = cfg.Bind<bool>("General", "TerminalGlowEnabled", true, "Makes the Terminal glow active all the time"); configTerminalMonitorAlwaysOn = cfg.Bind<bool>("General", "TerminalMonitorAlwaysOn", true, "Makes the Terminal screen active all the time; Will show the screen you left it on"); configChargeStationGlow = cfg.Bind<bool>("General", "ChargeStationGlowEnabled", true, "Makes the Charging Station glow with a yellow light"); configBigDoorButtons = cfg.Bind<bool>("General.Accessibility", "BigDoorButtonsEnabled", false, "Enlarges the door buttons so they're easier to press"); configEasyLaunchLever = cfg.Bind<bool>("General.Accessibility", "EasyLaunchLeverEnabled", true, "Enlarges the hitbox for the Launch Lever to cover more of the table so it's easier to pull"); configBigTeleporterButtons = cfg.Bind<bool>("General.Accessibility", "BigTeleporterButtonsEnabled", false, "Enlarges the teleporter buttons so they're easier to press"); configBigMonitorButtons = cfg.Bind<bool>("General.Accessibility", "BigMonitorButtonsEnabled", false, "Enlarges the Monitor buttons so they're easier to press"); } } [BepInPlugin("com.spycibot.cozyimprovements", "Cozy Improvements", "1.2.2")] [HarmonyPatch] public class CozyImprovements : BaseUnityPlugin { private static GameObject gameObject; private static Terminal TermInst; public static Config CozyConfig { get; internal set; } private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Cozy Improvements - com.spycibot.cozyimprovements - 1.2.2 is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); CozyConfig = new Config(((BaseUnityPlugin)this).Config); } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void Postfix_Terminal_Start(Terminal __instance) { TermInst = __instance; if (CozyConfig.configTerminalMonitorAlwaysOn.Value) { TermInst.LoadNewNode(TermInst.terminalNodes.specialNodes[1]); } if (CozyConfig.configTerminalGlow.Value) { ((Behaviour)TermInst.terminalLight).enabled = true; } } [HarmonyPatch(typeof(Terminal), "waitUntilFrameEndToSetActive")] [HarmonyPrefix] private static void Prefix_Terminal_WaitUntilFrameEndToSetActive(Terminal __instance, ref bool active) { TermInst = __instance; if (CozyConfig.configTerminalMonitorAlwaysOn.Value) { active = true; } } [HarmonyPatch(typeof(Terminal), "SetTerminalInUseClientRpc")] [HarmonyPostfix] private static void Postfix_Terminal_SetTerminalInUseClientRpc(Terminal __instance, bool inUse) { TermInst = __instance; if (CozyConfig.configTerminalGlow.Value) { ((Behaviour)TermInst.terminalLight).enabled = true; } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void PostfixOnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed) { if (clientId == NetworkManager.Singleton.LocalClientId) { DoAllTheThings(); } } [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] [HarmonyPostfix] private static void PostfixLoadUnlockables(StartOfRound __instance) { DoAllTheThings(); } private static void DoAllTheThings() { try { manageInteractables(); } catch (Exception arg) { Debug.LogError((object)$"Caught Exception in manageInteractables(): {arg}"); } try { manageStorageCupboard(); } catch (Exception arg2) { Debug.LogError((object)$"Caught Exception in manageStorageCupboard(): {arg2}"); } } private static void manageInteractables() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) _ = GameNetworkManager.Instance.localPlayerController; GameObject[] array = GameObject.FindGameObjectsWithTag("InteractTrigger"); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == "LightSwitch" && CozyConfig.configLightSwitchGlow.Value) { makeEmissive(array[i], new Color32((byte)182, (byte)240, (byte)150, (byte)102)); makeEmissive(((Component)array[i].transform.GetChild(0)).gameObject, new Color32((byte)241, (byte)80, (byte)80, (byte)10), 0.15f); } if (((Object)array[i]).name == "Trigger" && ((Object)((Component)array[i].transform.parent).gameObject).name == "ChargeStationTrigger" && CozyConfig.configChargeStationGlow.Value) { GameObject val = ((Component)array[i].transform.parent.parent).gameObject; GameObject val2 = new GameObject("ChargeStationLight"); Light obj = val2.AddComponent<Light>(); obj.type = (LightType)2; obj.color = Color32.op_Implicit(new Color32((byte)240, (byte)240, (byte)140, byte.MaxValue)); obj.intensity = 0.05f; obj.range = 0.3f; obj.shadows = (LightShadows)2; val2.layer = LayerMask.NameToLayer("Room"); val2.transform.localPosition = new Vector3(0.5f, 0f, 0f); val2.transform.SetParent(val.transform, false); } if (((Object)array[i]).name == "Cube (2)" && ((Object)((Component)array[i].transform.parent).gameObject).name.StartsWith("CameraMonitor") && CozyConfig.configBigMonitorButtons.Value) { Accessibility.adjustMonitorButtons(array[i].gameObject); } } } private static void makeEmissive(GameObject gameObject, Color32 glowColor, float brightness = 0.02f) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); Material material = ((Renderer)component).material; material.SetColor("_EmissiveColor", Color32.op_Implicit(glowColor) * brightness); ((Renderer)component).material = material; } private static void manageStorageCupboard() { PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); for (int i = 0; i < array.Length; i++) { UnlockableItem obj = StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID]; _ = obj.unlockableType; if (obj.unlockableName == "Cupboard") { gameObject = ((Component)array[i].parentObject).gameObject; break; } } if (!((Object)(object)gameObject == (Object)null) && CozyConfig.configStorageLights.Value) { spawnStorageLights(gameObject); } } private static void spawnStorageLights(GameObject storageCloset) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) float num = -1.1175f; List<float> obj = new List<float> { 2.804f, 2.163f, 1.48f, 0.999f }; float num2 = 0.55f; float num3 = obj[0]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); num3 = obj[1]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); num3 = obj[2]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3), 2f); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3), 2f); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3), 2f); num3 = obj[3]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); } private static void AttachLightToStorageCloset(GameObject storageCloset, Vector3 lightPositionOffset, float intensity = 3f) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0102: 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) GameObject val = new GameObject("StorageClosetLight"); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer obj = val.AddComponent<MeshRenderer>(); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0); val2.mesh = val3.GetComponent<MeshFilter>().mesh; Material val4 = new Material(Shader.Find("HDRP/Lit")); Color val5 = Color32.op_Implicit(new Color32((byte)249, (byte)240, (byte)202, byte.MaxValue)); val4.SetColor("_BaseColor", val5); float num = 1f; val4.SetColor("_EmissiveColor", val5 * num); ((Renderer)obj).material = val4; Object.DestroyImmediate((Object)(object)val3); Light obj2 = val.AddComponent<Light>(); obj2.type = (LightType)0; obj2.color = val5; obj2.intensity = intensity; obj2.range = 1.05f; obj2.spotAngle = 125f; obj2.shadows = (LightShadows)2; val.layer = LayerMask.NameToLayer("Room"); val.transform.localScale = new Vector3(0.125f, 0.125f, 0.04f); val.transform.localPosition = lightPositionOffset; val.transform.rotation = Quaternion.Euler(170f, 0f, 0f); val.transform.SetParent(storageCloset.transform, false); } private static string padString(string baseStr, char padChar, int width) { int totalWidth = (width - (baseStr.Length + 8)) / 2 + (baseStr.Length + 8); return (" " + baseStr + " ").PadLeft(totalWidth, padChar).PadRight(width, padChar); } private static void obviousDebug(string baseStr) { Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)padString(baseStr ?? "", '~', 65)); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.spycibot.cozyimprovements"; public const string PLUGIN_NAME = "Cozy Improvements"; public const string PLUGIN_VERSION = "1.2.2"; } } namespace SpyciBot.LC.CozyImprovements.Improvements { [HarmonyPatch] public static class Accessibility { private static HangarShipDoor hangarShipDoor; [HarmonyPatch(typeof(StartMatchLever), "Start")] [HarmonyPostfix] private static void Postfix_StartMatchLever_Start(StartMatchLever __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (CozyImprovements.CozyConfig.configEasyLaunchLever.Value) { ((Component)__instance).transform.localScale = new Vector3(1.139f, 0.339f, 1.539f); ((Component)__instance).transform.localPosition = new Vector3(8.7938f, 1.479f, -7.0767f); ((Component)__instance).transform.GetChild(0).position = new Vector3(8.8353f, 0.2931f, -14.5767f); } } [HarmonyPatch(typeof(HangarShipDoor), "Start")] [HarmonyPostfix] private static void Postfix_HangarShipDoor_Start(HangarShipDoor __instance) { //IL_0043: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) if (!CozyImprovements.CozyConfig.configBigDoorButtons.Value) { return; } hangarShipDoor = __instance; GameObject gameObject = ((Component)__instance.hydraulicsDisplay.transform.parent).gameObject; gameObject.transform.localScale = new Vector3(-2f, -2f, -2f); gameObject.transform.localPosition = new Vector3(-5.2085f, 1.8882f, -8.823f); GameObject gameObject2 = ((Component)gameObject.transform.Find("StartButton")).gameObject; GameObject gameObject3 = ((Component)gameObject.transform.Find("StopButton")).gameObject; gameObject3.transform.localScale = new Vector3(-1.1986f, -0.1986f, -1.1986f); gameObject2.transform.localScale = gameObject3.transform.localScale; gameObject2.transform.GetChild(0).localPosition = gameObject3.transform.GetChild(0).localPosition; gameObject2.transform.GetChild(0).localScale = gameObject3.transform.GetChild(0).localScale; Material[] materials = ((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials; for (int i = 0; i < materials.Length; i++) { if (((Object)materials[i]).name == "GreenButton (Instance)") { materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)39, (byte)51, (byte)39, byte.MaxValue))); } if (((Object)materials[i]).name == "ButtonWhite (Instance)") { materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue))); } } ((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials = materials; Material[] materials2 = ((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials; for (int j = 0; j < materials2.Length; j++) { if (((Object)materials2[j]).name == "RedButton (Instance)") { materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)64, (byte)24, (byte)24, byte.MaxValue))); } if (((Object)materials2[j]).name == "ButtonWhite (Instance)") { materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue))); } } ((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials = materials2; Transform child = gameObject.transform.Find("StartButton").GetChild(0); Transform child2 = gameObject.transform.Find("StopButton").GetChild(0); ((Renderer)((Component)child).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32((byte)39, byte.MaxValue, (byte)39, byte.MaxValue)); ((Renderer)((Component)child2).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)24, (byte)24, byte.MaxValue)); Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(-3.7205f, 2.0504f, -16.3018f); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f); Vector3 localScale2 = default(Vector3); ((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f); child.position = position; child.localScale = localScale; child2.position = position; child2.localScale = localScale2; } [HarmonyPatch(typeof(StartOfRound), "SetShipDoorsClosed")] [HarmonyPostfix] private static void Postfix_StartOfRound_SetShipDoorsClosed(StartOfRound __instance, bool closed) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (CozyImprovements.CozyConfig.configBigDoorButtons.Value) { GameObject gameObject = ((Component)hangarShipDoor.hydraulicsDisplay.transform.parent).gameObject; Transform child = gameObject.transform.Find("StartButton").GetChild(0); Transform child2 = gameObject.transform.Find("StopButton").GetChild(0); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f); Vector3 localScale2 = default(Vector3); ((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f); child.localScale = localScale; child2.localScale = localScale; if (closed) { child.localScale = localScale; child2.localScale = localScale2; } else { child2.localScale = localScale; child.localScale = localScale2; } } } [HarmonyPatch(typeof(ShipTeleporter), "Awake")] [HarmonyPostfix] private static void Postfix_ShipTeleporter_Awake(ShipTeleporter __instance) { //IL_0031: 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) if (CozyImprovements.CozyConfig.configBigTeleporterButtons.Value) { ((Component)((Component)__instance.buttonTrigger).gameObject.transform.parent).gameObject.transform.localScale = Vector3.one * 3f; } } public static void adjustMonitorButtons(GameObject ButtonCube) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (CozyImprovements.CozyConfig.configBigMonitorButtons.Value) { GameObject gameObject = ((Component)ButtonCube.transform.parent).gameObject; gameObject.transform.localScale = new Vector3(1.852f, 1.8475f, 1.852f); if (((Object)gameObject).name == "CameraMonitorSwitchButton") { gameObject.transform.localPosition = new Vector3(-0.28f, -1.807f, -0.29f); } } } } }
BepInEx/plugins/ZoLoKinoBabo112/CullFactory.dll
Decompiled 2 years 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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using CullFactory.Behaviours.API; using CullFactory.Behaviours.CullingMethods; using CullFactory.Behaviours.Visualization; using CullFactory.Data; using CullFactory.Extenders; using CullFactory.Services; using CullFactoryBurst; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Burst; using Unity.Burst.LowLevel; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: AssemblyCompany("CullFactory")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cffa1b5f095ded0191175617a6b48b3898f7c2f7")] [assembly: AssemblyProduct("CullFactory")] [assembly: AssemblyTitle("CullFactory")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CullFactory { public static class Config { private const string DungeonFlowListDescription = "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."; private static readonly Version DefaultVersion = new Version(0, 0, 0); private static readonly string VersionFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "version"); private static readonly string[] DefaultFlowsToBlockCulling = Array.Empty<string>(); private static readonly string[] BaseSetOfInteriorsToUseFallbackPortals = new string[2] { "BunkerFlow", "School" }; private static ConfigEntry<CullingType> Culler; private static ConfigEntry<string> InteriorsToBlockCulling; private static ConfigEntry<string> InteriorsToForceCulling; public static string[] InteriorsWithDisabledCulling = Array.Empty<string>(); public static ConfigEntry<bool> Logging { get; private set; } public static ConfigEntry<float> UpdateFrequency { get; private set; } public static ConfigEntry<bool> DisableShadowDistanceFading { get; private set; } public static ConfigEntry<bool> DisableLODCulling { get; private set; } public static ConfigEntry<string> InteriorsToUseFallbackPortals { get; private set; } public static ConfigEntry<string> InteriorsToSkipFallbackPortals { get; private set; } public static ConfigEntry<int> MaxBranchingDepth { get; private set; } public static ConfigEntry<bool> CullDistanceEnabled { get; private set; } public static ConfigEntry<float> CullDistance { get; private set; } public static ConfigEntry<float> SurfaceCullDistance { get; private set; } public static ConfigEntry<string> OverrideMapSeed { get; private set; } public static ConfigEntry<bool> VisualizePortals { get; private set; } public static ConfigEntry<float> VisualizedPortalOutsetDistance { get; private set; } public static ConfigEntry<bool> VisualizeTileBounds { get; private set; } public static string[] InteriorsWithFallbackPortals { get; private set; } public static void Initialize(ConfigFile configFile) { Culler = configFile.Bind<CullingType>("General", "Culling type", CullingType.PortalOcclusionCulling, "The culling type to use.\n\nOptions:\n\"PortalOcclusionCulling\": Hides all the rooms that aren't visible to the camera (Recommended)\n\"DepthCulling\": Hides rooms that aren't adjacent to the player's current room"); InteriorsToBlockCulling = configFile.Bind<string>("General", "Disable culling for interiors", "", "A list of dungeon flows to disable culling on, separated by commas, i.e.\n\"Level1Flow, Level2Flow\"\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); string text = ((DefaultFlowsToBlockCulling.Length != 0) ? ("This can be used to override the internal blacklist containing " + DefaultFlowsToBlockCulling.HumanReadableList() + ".") : "This will have no effect as the internal blacklist is empty."); InteriorsToForceCulling = configFile.Bind<string>("General", "Force enable culling for interiors", "", "A list of dungeon flows to have culling force-enabled. " + text + "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); UpdateFrequency = configFile.Bind<float>("General", "Update frequency", 0f, "Higher values make culling more responsive at the cost of performance.\nCurrently this has no effect when portal occlusion culling is used.\nUpdate interval: 1 / value (seconds)"); DisableShadowDistanceFading = configFile.Bind<bool>("General", "Disable shadow distance fading", true, "Prevents lights' shadows from being hidden before the light itself becomes invisible.\nFixes issues that are common in Mansion where some lights will be visible through walls, and allows more lights/tiles to be culled within the interior.\nDisabling may have a negative impact on performance."); DisableLODCulling = configFile.Bind<bool>("General", "Disable LOD culling", true, "Forces the last LOD to stay visible for all static objects in the interior. This will prevent the stairs on the factory interior from disappearing at a distance, and should also prevent any other similar disappearing objects.\nObjects that have LOD groups will instead be culled based on visibility, so this has a minimal effect on performance."); InteriorsToUseFallbackPortals = configFile.Bind<string>("Portal occlusion culling", "Use fallback portals for interiors", "", "Uses the maximum possible doorway sizes in each tile for visibility testing in the specified interiors.\nThis is recommended for interiors with incorrect doorway sizes.\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); InteriorsToSkipFallbackPortals = configFile.Bind<string>("Portal occlusion culling", "Skip fallback portals for interiors", "", "Skip using fallback portals on previously problematic interiors:\n" + BaseSetOfInteriorsToUseFallbackPortals.JoinByComma() + "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); MaxBranchingDepth = configFile.Bind<int>("Depth culling", "Max branching depth", 4, "How many doors can be traversed before a room is culled."); CullDistanceEnabled = configFile.Bind<bool>("Distance culling", "Enabled", false, "Whether to override the camera's far plane distance. When this is false, the 'Cull distance' and 'Surface cull distance' options will have no effect.\nIf performance with portal occlusion culling enabled is insufficient this may provide a small boost in performance."); CullDistance = configFile.Bind<float>("Distance culling", "Cull distance", 40f, "The camera's far plane distance.\nObjects that are this far from the player will be culled.\nVanilla value: 400"); SurfaceCullDistance = configFile.Bind<float>("Distance culling", "Surface cull distance", 200f, "The camera's far plane distance when **on the surface**.\nObjects that are this far from the player will be culled.\nVanilla value: 400"); VisualizePortals = configFile.Bind<bool>("Debug", "Visualize portals", false, "Shows a rectangle representing the bounds of all portals that are used to determine visibility when portal occlusion culling is enabled. If the portal doesn't block the entirety of the visible portion of the next tile, then culling will not be correct."); VisualizedPortalOutsetDistance = configFile.Bind<float>("Debug", "Visualized portal outset distance", 0.2f, "The distance to offset each side of a portal visualizer out from the actual position of the portal. For doors that don't cover an entire tile wall, this allows seeing the exact bounds it covers."); VisualizeTileBounds = configFile.Bind<bool>("Debug", "Visualize tile bounds", false, "Shows a rectangular prism to represent the bounds all tiles. These bounds are used to determine which tile a camera resides in."); OverrideMapSeed = configFile.Bind<string>("Debug", "Override map seed", "", "INTENDED FOR BENCHMARKING ONLY. Leave this empty if you are playing normally.\nThis forces the map seed to be whatever is entered here, so that benchmarking numbers can remain as consistent as possible between runs."); Logging = configFile.Bind<bool>("Debug", "Show culling logs", false, "View culling activity in the console."); MigrateSettings(); Culler.SettingChanged += delegate { CullingMethod.Initialize(); }; InteriorsToBlockCulling.SettingChanged += delegate { UpdateInteriorsWithDisabledCulling(); }; InteriorsToForceCulling.SettingChanged += delegate { UpdateInteriorsWithDisabledCulling(); }; UpdateFrequency.SettingChanged += delegate { CullingMethod.Initialize(); }; DisableShadowDistanceFading.SettingChanged += delegate { RefreshCullingInfoAndMethod(); }; DisableLODCulling.SettingChanged += delegate { RefreshCullingInfoAndMethod(); }; InteriorsToUseFallbackPortals.SettingChanged += delegate { UpdateInteriorsWithFallbackPortals(); }; InteriorsToSkipFallbackPortals.SettingChanged += delegate { UpdateInteriorsWithFallbackPortals(); }; CullDistanceEnabled.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; CullDistance.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; SurfaceCullDistance.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; VisualizePortals.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; VisualizedPortalOutsetDistance.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; VisualizeTileBounds.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; UpdateInteriorsWithDisabledCulling(); UpdateInteriorsWithFallbackPortals(); } private static void MigrateSettings() { Version version = (File.Exists(VersionFile) ? Version.Parse(Encoding.UTF8.GetString(File.ReadAllBytes(VersionFile))) : DefaultVersion); if (version <= new Version(0, 8, 0)) { InteriorsToUseFallbackPortals.Value = InteriorsToUseFallbackPortals.Value.SplitByComma().Except(new <>z__ReadOnlyArray<string>(new string[2] { "CastleFlow", "SewerFlow" })).JoinByComma(); } if (version <= new Version(0, 8, 6)) { UpdateFrequency.Value = (float)((ConfigEntryBase)UpdateFrequency).DefaultValue; } using FileStream fileStream = File.Open(VersionFile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); fileStream.Write(Encoding.UTF8.GetBytes("1.4.2")); } private static void UpdateInteriorsWithDisabledCulling() { InteriorsWithDisabledCulling = DefaultFlowsToBlockCulling.Union(InteriorsToBlockCulling.Value.SplitByComma()).Except(InteriorsToForceCulling.Value.SplitByComma()).ToArray(); CullingMethod.Initialize(); } public static CullingType GetCullingType(DungeonFlow dungeonFlow) { if (InteriorsWithDisabledCulling.Contains(((Object)dungeonFlow).name)) { return CullingType.None; } return Culler.Value; } private static void UpdateInteriorsWithFallbackPortals() { InteriorsWithFallbackPortals = BaseSetOfInteriorsToUseFallbackPortals.Union(InteriorsToUseFallbackPortals.Value.SplitByComma()).Except(InteriorsToSkipFallbackPortals.Value.SplitByComma()).ToArray(); RefreshCullingInfoAndMethod(); } private static void RefreshCullingInfoAndMethod() { DungeonCullingInfo.RefreshCullingInfo(); CullingMethod.Initialize(); } } [BepInPlugin("com.fumiko.CullFactory", "CullFactory", "1.4.2")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.fumiko.CullFactory"; public const string Name = "CullFactory"; public const string Version = "1.4.2"; private Harmony _harmony = new Harmony("com.fumiko.CullFactory"); public static Plugin Instance { get; private set; } private void Awake() { Instance = this; Config.Initialize(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(LevelGenerationExtender)); _harmony.PatchAll(typeof(TeleportExtender)); _harmony.PatchAll(typeof(MapSeedOverride)); _harmony.PatchAll(typeof(GrabbableObjectExtender)); QualitySettings.shadowResolution = (ShadowResolution)0; LoadBurstAssembly(); Log("Plugin CullFactory is loaded!"); } private void LoadBurstAssembly() { string text = Path.Combine(new FileInfo(((BaseUnityPlugin)this).Info.Location).DirectoryName, "lib_burst_generated.data"); if (!File.Exists(text)) { LogError("CullFactory's Burst assembly 'lib_burst_generated.data' was not found, culling may be slower than normal."); return; } if (!BurstRuntime.LoadAdditionalLibrary(text)) { LogError("CullFactory's Burst assembly failed to load, culling may be slower than normal."); return; } if (!Plugin.IsRunningBurstLibrary()) { LogError("CullFactory's Burst plugin is not running its Burst-compiled code, culling may be slower than normal."); return; } LogAlways("Loaded CullFactory's Burst assembly."); _harmony.PatchAll(typeof(BurstErrorPrevention)); } public static void LogAlways(string s) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)s); } public static void Log(string s) { if (Config.Logging.Value) { LogAlways(s); } } public static void LogWarning(string s) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)s); } public static void LogError(string s) { ((BaseUnityPlugin)Instance).Logger.LogError((object)s); } public static void CreateCullingVisualizers() { if (!((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)) { GameObject gameObject = ((Component)RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon).gameObject; Object.DestroyImmediate((Object)(object)gameObject.GetComponent<CullingVisualizer>()); gameObject.AddComponent<CullingVisualizer>().RefreshVisualizers(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "CullFactory"; public const string PLUGIN_NAME = "CullFactory"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CullFactory.Services { public static class BoundsUtility { public static Plane[] GetPlanes(this Bounds bounds) { //IL_0017: 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_0029: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_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_0107: 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) return (Plane[])(object)new Plane[6] { new Plane(new Vector3(1f, 0f, 0f), 0f - ((Bounds)(ref bounds)).min.x), new Plane(new Vector3(0f, 1f, 0f), 0f - ((Bounds)(ref bounds)).min.y), new Plane(new Vector3(0f, 0f, 1f), 0f - ((Bounds)(ref bounds)).min.z), new Plane(new Vector3(-1f, 0f, 0f), ((Bounds)(ref bounds)).max.x), new Plane(new Vector3(0f, -1f, 0f), ((Bounds)(ref bounds)).max.y), new Plane(new Vector3(0f, 0f, -1f), ((Bounds)(ref bounds)).max.z) }; } public static void GetFarthestPlanesNonAlloc(this Bounds bounds, Vector3 point, Plane[] planes) { //IL_0002: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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) //IL_012e: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) planes[0] = ((point.x > ((Bounds)(ref bounds)).center.x) ? new Plane(new Vector3(1f, 0f, 0f), 0f - ((Bounds)(ref bounds)).min.x) : new Plane(new Vector3(-1f, 0f, 0f), ((Bounds)(ref bounds)).max.x)); planes[1] = ((point.y > ((Bounds)(ref bounds)).center.y) ? new Plane(new Vector3(0f, 1f, 0f), 0f - ((Bounds)(ref bounds)).min.y) : new Plane(new Vector3(0f, -1f, 0f), ((Bounds)(ref bounds)).max.y)); planes[2] = ((point.z > ((Bounds)(ref bounds)).center.z) ? new Plane(new Vector3(0f, 0f, 1f), 0f - ((Bounds)(ref bounds)).min.z) : new Plane(new Vector3(0f, 0f, -1f), ((Bounds)(ref bounds)).max.z)); } public static Plane[] GetFarthestPlanes(this Bounds bounds, Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Plane[] array = (Plane[])(object)new Plane[3]; bounds.GetFarthestPlanesNonAlloc(point, array); return array; } public static Vector3[] GetVertices(Vector3 min, Vector3 max) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009e: 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_00aa: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) return (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z) }; } public static Vector3[] GetVertices(this Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return GetVertices(((Bounds)(ref bounds)).min, ((Bounds)(ref bounds)).max); } } public class IdentityEqualityComparer<T> : IEqualityComparer<T> { public static readonly IdentityEqualityComparer<T> Instance = new IdentityEqualityComparer<T>(); public bool Equals(T x, T y) { return (object)x == (object)y; } public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); } } public static class LightUtility { public static bool Affects(this Light light, Bounds bounds) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) float range = light.range; if (((Bounds)(ref bounds)).SqrDistance(((Component)light).transform.position) > range * range) { return false; } if ((int)light.type == 0) { return Geometry.SpotLightInfluencesBounds(ref light, ref bounds); } return true; } public static bool Affects(this Light light, TileContents tile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return light.Affects(tile.rendererBounds); } public static bool Affects(this Light light, IEnumerable<TileContents> tiles) { foreach (TileContents tile in tiles) { if (light.Affects(tile)) { return true; } } return false; } public static bool HasShadows(this Light light) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 return (int)light.shadows > 0; } public static bool PassesThroughOccluders(this Light light) { if (light.HasShadows()) { HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>(); if (component != null) { return component.shadowDimmer < 1f; } return false; } return true; } public static void SetVisible(this Light light, bool visible) { if (!((Object)(object)light == (Object)null)) { if (light.cullingMask != -1 && light.cullingMask != 0) { Plugin.LogWarning($"Light {((Object)light).name}'s culling mask was an unexpected value of {light.cullingMask}."); } light.cullingMask = (visible ? (-1) : 0); } } public static void SetVisible(this IEnumerable<Light> lights, bool visible) { foreach (Light light in lights) { light.SetVisible(visible); } } } public static class ObjectContentsUtility { public static void SetSelfVisible(this IEnumerable<TileContents> tiles, bool visible) { foreach (TileContents tile in tiles) { tile.SetSelfVisible(visible); } } public static void SetVisible(this IEnumerable<GrabbableObjectContents> items, bool visible) { foreach (GrabbableObjectContents item in items) { item.SetVisible(visible); } } public static void AddContentsVisibleToCamera(this ICollection<TileContents> result, Camera camera) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (camera.orthographic) { result.AddContentsWithinCameraFrustum(camera); return; } TileContents tileContents = ((Component)camera).transform.position.GetTileContents(); if (tileContents != null) { VisibilityTesting.CallForEachLineOfSight(camera, tileContents, delegate(TileContents[] tiles, Plane[][] frustums, int index) { result.Add(tiles[index]); }); } } public static void AddContentsWithinCameraFrustum(this ICollection<TileContents> result, Camera camera) { Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = DungeonCullingInfo.AllTileContents; foreach (TileContents tileContents in allTileContents) { if (Geometry.TestPlanesAABB(ref array, ref tileContents.bounds)) { result.Add(tileContents); } } } } public static class StringUtility { public static IEnumerable<string> SplitByComma(this string input) { return from name in input.Split(',', StringSplitOptions.RemoveEmptyEntries) select name.Trim().Trim('"'); } public static string JoinByComma(this IEnumerable<string> input) { return string.Join(", ", input); } public static string HumanReadableList(this IEnumerable<string> input) { IEnumerator<string> enumerator = input.GetEnumerator(); if (!enumerator.MoveNext()) { return ""; } StringBuilder stringBuilder = new StringBuilder(enumerator.Current); if (!enumerator.MoveNext()) { return stringBuilder.ToString(); } string current; while (true) { current = enumerator.Current; if (!enumerator.MoveNext()) { break; } stringBuilder.Append(", "); stringBuilder.Append(current); } stringBuilder.Append(", and "); stringBuilder.Append(current); return stringBuilder.ToString(); } } public static class TransformUtility { public static string GetPath(this Transform obj) { StringBuilder stringBuilder = new StringBuilder(((Object)obj).name); Transform parent = obj.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, "/"); stringBuilder.Insert(0, ((Object)parent).name); parent = parent.parent; } return stringBuilder.ToString(); } public static bool TryGetComponentInParent<T>(this Transform transform, out T component) { component = ((Component)transform).GetComponentInParent<T>(); return component != null; } } public static class VisibilityTesting { public delegate void LineOfSightCallback(TileContents[] tileStack, Plane[][] frustumStack, int stackIndex); private const int MaxStackCapacity = 16; private static readonly TileContents[] TileStack = new TileContents[16]; private static readonly int[] IndexStack = new int[16]; private static readonly Plane[][] FrustumStack = new Plane[16][]; private static bool warnedThatStackWasExceeded = false; internal static bool IntersectsFrustums(this Bounds bounds, Plane[][] frustums, int lastFrustum) { for (int i = 0; i <= lastFrustum; i++) { if (!Geometry.TestPlanesAABB(ref frustums[i], ref bounds)) { return false; } } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool AdvanceToNextTile(Vector3 origin, ref int stackIndex) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) TileContents tileContents = TileStack[stackIndex]; int num = IndexStack[stackIndex]++; if (num >= tileContents.portals.Length) { stackIndex--; return false; } Portal portal = tileContents.portals[num]; TileContents nextTile = portal.NextTile; if (nextTile == null) { return false; } if (stackIndex > 0 && nextTile == TileStack[stackIndex - 1]) { return false; } if (!portal.Bounds.IntersectsFrustums(FrustumStack, stackIndex)) { return false; } stackIndex++; if (stackIndex >= 16) { stackIndex--; if (!warnedThatStackWasExceeded) { Plugin.LogWarning($"Exceeded the maximum portal occlusion culling depth of {16}."); warnedThatStackWasExceeded = true; } return false; } TileStack[stackIndex] = nextTile; IndexStack[stackIndex] = 0; if (FrustumStack[stackIndex] == null) { FrustumStack[stackIndex] = portal.GetFrustumPlanes(origin); } else { portal.GetFrustumPlanesNonAlloc(origin, FrustumStack[stackIndex]); } return true; } public static void CallForEachLineOfSight(Vector3 origin, TileContents originTile, Plane[] frustum, LineOfSightCallback callback) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) TileStack[0] = originTile; IndexStack[0] = 0; FrustumStack[0] = frustum; int stackIndex = 0; callback(TileStack, FrustumStack, stackIndex); while (stackIndex >= 0) { if (AdvanceToNextTile(origin, ref stackIndex)) { callback(TileStack, FrustumStack, stackIndex); } } } public static void CallForEachLineOfSight(Camera camera, TileContents originTile, LineOfSightCallback callback) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) CallForEachLineOfSight(((Component)camera).transform.position, originTile, GeometryUtility.CalculateFrustumPlanes(camera), callback); } public static void CallForEachLineOfSight(Vector3 origin, TileContents originTile, LineOfSightCallback callback) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) CallForEachLineOfSight(origin, originTile, Array.Empty<Plane>(), callback); } private static bool FrustumIntersectsAnyTile(Plane[] frustum, HashSet<TileContents> tiles) { foreach (TileContents tile in tiles) { if (Geometry.TestPlanesAABB(ref frustum, ref tile.bounds)) { return true; } } return false; } public static bool CallForEachLineOfSightTowardTiles(Vector3 origin, TileContents originTile, Plane[] frustum, HashSet<TileContents> goalTiles, LineOfSightCallback callback) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) TileStack[0] = originTile; IndexStack[0] = 0; FrustumStack[0] = frustum; int stackIndex = 0; callback(TileStack, FrustumStack, stackIndex); bool result = goalTiles.Contains(originTile); while (stackIndex >= 0) { if (!AdvanceToNextTile(origin, ref stackIndex)) { continue; } if (!FrustumIntersectsAnyTile(FrustumStack[stackIndex], goalTiles)) { stackIndex--; continue; } if (goalTiles.Contains(TileStack[stackIndex])) { result = true; } callback(TileStack, FrustumStack, stackIndex); } return result; } public static bool CallForEachLineOfSightTowardTiles(Vector3 origin, TileContents originTile, HashSet<TileContents> goalTiles, LineOfSightCallback callback) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CallForEachLineOfSightTowardTiles(origin, originTile, Array.Empty<Plane>(), goalTiles, callback); } } } namespace CullFactory.Extenders { internal static class BurstErrorPrevention { [HarmonyTranspiler] [HarmonyPatch(typeof(BurstCompiler), "GetILPPMethodFunctionPointer2")] private static IEnumerable<CodeInstruction> PatchGetILPPMethodFunctionPointer2(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"ilppMethod", (string)null), new CodeMatch((OpCode?)OpCodes.Newobj, (object)typeof(ArgumentNullException).GetConstructor(new Type[1] { typeof(string) }), (string)null), new CodeMatch((OpCode?)OpCodes.Throw, (object)null, (string)null) }); if (val.IsInvalid) { Plugin.LogError("Failed to find Burst function pointer getter's throw statement"); return instructions; } val.RemoveInstructions(3).Insert((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ret, (object)null) }); return val.Instructions(); } [HarmonyTranspiler] [HarmonyPatch(typeof(BurstCompiler), "Compile", new Type[] { typeof(object), typeof(MethodInfo), typeof(bool), typeof(bool) })] private static IEnumerable<CodeInstruction> PatchCompile(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); MethodInfo method = typeof(BurstCompilerService).GetMethod("GetAsyncCompiledAsyncDelegateMethod", new Type[1] { typeof(int) }); if (method == null) { Plugin.LogError("Failed to find the Burst async compilation method"); return instructions; } val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Call, (object)method, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null) }).Advance(1); Label? label = default(Label?); if (val.IsInvalid || !CodeInstructionExtensions.Branches(val.Instruction, ref label)) { Plugin.LogAlways($"{val.Instruction}"); Plugin.LogError("Failed to find the call to the Burst async compilation method"); return instructions; } val.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Conv_U, (object)null), new CodeInstruction(OpCodes.Bne_Un, (object)label) }); CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[9] { new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Conv_U, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Bne_Un, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)typeof(string).GetMethod("Format", new Type[2] { typeof(string), typeof(object) }), (string)null), new CodeMatch((OpCode?)OpCodes.Newobj, (object)typeof(InvalidOperationException).GetConstructor(new Type[1] { typeof(string) }), (string)null), new CodeMatch((OpCode?)OpCodes.Throw, (object)null, (string)null) }; val.MatchForward(false, array); if (val.IsInvalid) { Plugin.LogError("Failed to find Burst compilation failure throw statement"); return instructions; } List<Label> labels = val.Instruction.labels; val.RemoveInstructions(array.Length).Labels.AddRange(labels); return val.Instructions(); } } [HarmonyPatch(typeof(GrabbableObject))] internal static class GrabbableObjectExtender { [HarmonyPostfix] [HarmonyPatch("Start")] private static void GrabbableObjectStarted(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("FallToGround")] private static void GrabbableObjectFalling(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("EnablePhysics")] private static void GrabbableObjectDropped(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("EnableItemMeshes")] private static void GrabbableObjectShownOrHidden(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("GrabItemFromEnemy")] private static void GrabbableObjectPickedUpByEnemy(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("DiscardItemFromEnemy")] private static void GrabbableObjectDroppedByEnemy(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } } public static class LevelGenerationExtender { [HarmonyPostfix] [HarmonyPatch(typeof(RoundManager), "SetLevelObjectVariables")] private static void OnLevelGenerated() { DungeonCullingInfo.OnLevelGenerated(); CullingMethod.Initialize(); Plugin.CreateCullingVisualizers(); DynamicObjects.CollectAllTrackedObjects(); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "PassTimeToNextDay")] private static void OnRoundEnded() { DungeonCullingInfo.ClearAll(); DynamicObjects.CollectAllTrackedObjects(); } } internal static class MapSeedOverride { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRound_StartPostfix(StartOfRound __instance) { if (int.TryParse(Config.OverrideMapSeed.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { __instance.overrideRandomSeed = true; __instance.overrideSeedNumber = result; } else { __instance.overrideRandomSeed = false; } } } [HarmonyPatch(typeof(EntranceTeleport))] public static class TeleportExtender { private static float[] _initialPlayerCameraFarPlanes; public static void SetInitialFarClipPlane() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (_initialPlayerCameraFarPlanes == null) { _initialPlayerCameraFarPlanes = new float[allPlayerScripts.Length]; for (int i = 0; i < allPlayerScripts.Length; i++) { _initialPlayerCameraFarPlanes[i] = allPlayerScripts[i].gameplayCamera.farClipPlane; } } if (!Config.CullDistanceEnabled.Value) { for (int j = 0; j < allPlayerScripts.Length; j++) { allPlayerScripts[j].gameplayCamera.farClipPlane = _initialPlayerCameraFarPlanes[j]; } } else { for (int k = 0; k < allPlayerScripts.Length; k++) { UpdateFarPlane(allPlayerScripts[k]); } } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void GameStarted() { SetInitialFarClipPlane(); DynamicObjects.CollectAllPlayerLights(); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")] private static void OnTeleportPlayerController(PlayerControllerB __instance) { OnPlayerTeleported(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerClientRpc")] private static void OnTeleportOtherPlayerThroughEntrance(ref int playerObj) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; if (!((Object)(object)val == (Object)(object)StartOfRound.Instance.localPlayerController)) { OnPlayerTeleported(val); } } private static void OnPlayerTeleported(PlayerControllerB player) { UpdateFarPlane(player); DynamicObjects.OnPlayerTeleported(player); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "SetEnemyOutside")] private static void OnEnemySetOutsideOrInside(EnemyAI __instance) { OnEnemyTeleported(__instance); } private static void OnEnemyTeleported(EnemyAI enemy) { DynamicObjects.OnEnemyTeleported(enemy); } private static void UpdateFarPlane(PlayerControllerB player) { if (Config.CullDistanceEnabled.Value) { player.gameplayCamera.farClipPlane = (DynamicObjects.PlayerIsInInterior(player) ? Config.CullDistance.Value : Config.SurfaceCullDistance.Value); Plugin.Log(string.Format("{0} is{1} in the factory, set far plane distance to {2}", player.playerUsername, player.isInsideFactory ? string.Empty : " not", player.gameplayCamera.farClipPlane)); } } } } namespace CullFactory.Data { public enum CullingType { None, PortalOcclusionCulling, DepthCulling } public static class DungeonCullingInfo { private const int RendererIntrusionTileDepth = 2; private const float RendererIntrusionDistance = 0.01f; public static Bounds DungeonBounds; public static TileContents[] AllTileContents { get; private set; } public static Dictionary<Tile, TileContents> TileContentsForTile { get; private set; } public static Light[] AllLightsInDungeon { get; private set; } public static void OnLevelGenerated() { string name = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name; Plugin.LogAlways($"{name} has finished generating with seed {StartOfRound.Instance.randomMapSeed}."); bool num = Array.IndexOf(Config.InteriorsWithFallbackPortals, name) != -1; if (num) { Plugin.LogAlways("Using tile bounds to determine the size of portals for " + name + "."); } double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble; CollectAllTileContents(num); Plugin.Log($"Preparing tile information for the dungeon took {(Time.realtimeSinceStartupAsDouble - realtimeSinceStartupAsDouble) * 1000.0:0.###}ms"); } public static void ClearAll() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (AllTileContents != null) { AllTileContents = null; TileContentsForTile.Clear(); AllLightsInDungeon = null; DungeonBounds = default(Bounds); } } public static void RefreshCullingInfo() { if (AllTileContents != null) { OnLevelGenerated(); } } private static void AddIntersectingRenderers(Bounds bounds, HashSet<Renderer> toCollection, HashSet<TileContents> visitedTiles, TileContents currentTile, int tilesLeft) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!visitedTiles.Add(currentTile)) { return; } Renderer[] renderers = currentTile.renderers; foreach (Renderer val in renderers) { Bounds bounds2 = val.bounds; if (((Bounds)(ref bounds2)).Intersects(bounds)) { toCollection.Add(val); } } if (--tilesLeft > 0) { Portal[] portals = currentTile.portals; foreach (Portal portal in portals) { AddIntersectingRenderers(bounds, toCollection, visitedTiles, portal.NextTile, tilesLeft - 1); } } visitedTiles.Remove(currentTile); } private static HashSet<Renderer> GetIntrudingRenderers(TileContents originTile) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) HashSet<Renderer> hashSet = new HashSet<Renderer>(); Bounds bounds = originTile.bounds; ((Bounds)(ref bounds)).Expand(-0.01f); HashSet<TileContents> visitedTiles = new HashSet<TileContents> { originTile }; Portal[] portals = originTile.portals; foreach (Portal portal in portals) { AddIntersectingRenderers(bounds, hashSet, visitedTiles, portal.NextTile, 2); } return hashSet; } internal static bool ShouldShadowFadingBeDisabledForLight(HDAdditionalLightData light) { return (double)light.shadowFadeDistance >= (double)light.fadeDistance * 0.75 - 15.0; } internal static bool ShouldShadowFadingBeDisabledForLight(Light light) { if (!Config.DisableShadowDistanceFading.Value) { return false; } HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>(); if (component != null) { return ShouldShadowFadingBeDisabledForLight(component); } return false; } private static void CollectAllTileContents(bool derivePortalBoundsFromTile) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) ReadOnlyCollection<Tile> allTiles = RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.AllTiles; TileContentsForTile = new Dictionary<Tile, TileContents>(allTiles.Count); List<Light> list = new List<Light>(); Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; foreach (Tile item in allTiles) { TileContents tileContents = new TileContents(item); TileContentsForTile[item] = tileContents; list.AddRange(tileContents.lights); Vector3 val3 = val; Bounds rendererBounds = tileContents.rendererBounds; val = Vector3.Min(val3, ((Bounds)(ref rendererBounds)).min); Vector3 val4 = val2; rendererBounds = tileContents.rendererBounds; val2 = Vector3.Max(val4, ((Bounds)(ref rendererBounds)).max); } AllTileContents = new TileContents[TileContentsForTile.Count]; int num = 0; foreach (TileContents value in TileContentsForTile.Values) { List<Doorway> usedDoorways = value.tile.UsedDoorways; int count = usedDoorways.Count; List<Portal> list2 = new List<Portal>(count); for (int i = 0; i < count; i++) { Doorway val5 = usedDoorways[i]; if (!((Object)(object)val5.ConnectedDoorway == (Object)null)) { list2.Add(new Portal(val5, derivePortalBoundsFromTile, TileContentsForTile[val5.ConnectedDoorway.Tile])); } } value.portals = list2.ToArray(); AllTileContents[num++] = value; } AllLightsInDungeon = list.ToArray(); ((Bounds)(ref DungeonBounds)).min = val; ((Bounds)(ref DungeonBounds)).max = val2; HashSet<Renderer>[] array = new HashSet<Renderer>[AllTileContents.Length]; for (num = 0; num < AllTileContents.Length; num++) { array[num] = GetIntrudingRenderers(AllTileContents[num]); } for (num = 0; num < AllTileContents.Length; num++) { TileContents tileContents2; Renderer[] renderers = (tileContents2 = AllTileContents[num]).renderers; HashSet<Renderer> hashSet = array[num]; int num2 = 0; Renderer[] array2 = (Renderer[])(object)new Renderer[renderers.Length + hashSet.Count]; ReadOnlySpan<Renderer> readOnlySpan = new ReadOnlySpan<Renderer>(renderers); readOnlySpan.CopyTo(new Span<Renderer>(array2).Slice(num2, readOnlySpan.Length)); num2 += readOnlySpan.Length; foreach (Renderer item2 in hashSet) { array2[num2] = item2; num2++; } tileContents2.renderers = array2; } foreach (var item3 in AllTileContents.SelectMany((TileContents tile) => tile.lights.Select((Light light) => (tile, light)))) { var (tileContents3, light2) = item3; if (!((Component)light2).gameObject.activeInHierarchy) { continue; } bool flag = light2.HasShadows(); bool lightPassesThroughWalls = ShouldShadowFadingBeDisabledForLight(light2) || light2.PassesThroughOccluders(); if (lightPassesThroughWalls) { TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents4 in allTileContents) { if (light2.Affects(tileContents4)) { Light[] externalLights = tileContents4.externalLights; int num3 = 0; Light[] array3 = (Light[])(object)new Light[1 + externalLights.Length]; ReadOnlySpan<Light> readOnlySpan2 = new ReadOnlySpan<Light>(externalLights); readOnlySpan2.CopyTo(new Span<Light>(array3).Slice(num3, readOnlySpan2.Length)); num3 += readOnlySpan2.Length; array3[num3] = light2; num3++; tileContents4.externalLights = array3; if (flag) { List<Renderer> list3 = new List<Renderer>(); list3.AddRange(tileContents4.externalRenderers.Union(tileContents3.renderers)); tileContents4.externalRenderers = list3.ToArray(); } } } } if (!flag) { continue; } Vector3 lightOrigin = ((Component)light2).transform.position; VisibilityTesting.CallForEachLineOfSight(lightOrigin, tileContents3, delegate(TileContents[] tiles, Plane[][] frustums, int index) { //IL_0040: 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_004d: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (index >= 1) { TileContents tileContents5 = tiles[index]; if (light2.Affects(tileContents5)) { bool flag2 = false; List<Renderer> list4 = new List<Renderer>(); for (int num4 = index - 1; num4 >= 0; num4--) { Renderer[] renderers2 = tiles[num4].renderers; foreach (Renderer val6 in renderers2) { Bounds bounds = val6.bounds; if (light2.Affects(bounds) && bounds.IntersectsFrustums(frustums, num4)) { flag2 = true; list4.Add(val6); } } } List<Renderer> list5 = new List<Renderer>(); list5.AddRange(tileContents5.externalRenderers.Union(list4)); tileContents5.externalRenderers = list5.ToArray(); if (flag2) { List<Plane> list6 = new List<Plane>(); for (int k = 1; k <= index; k++) { list6.AddRange(frustums[k]); } list6.AddRange(tileContents5.bounds.GetFarthestPlanes(lightOrigin)); Plane[][] externalLightLinesOfSight = tileContents5.externalLightLinesOfSight; int j = 0; Plane[][] array4 = new Plane[1 + externalLightLinesOfSight.Length][]; ReadOnlySpan<Plane[]> readOnlySpan3 = new ReadOnlySpan<Plane[]>(externalLightLinesOfSight); readOnlySpan3.CopyTo(new Span<Plane[]>(array4).Slice(j, readOnlySpan3.Length)); j += readOnlySpan3.Length; array4[j] = list6.ToArray(); j++; tileContents5.externalLightLinesOfSight = array4; if (!lightPassesThroughWalls) { Light[] externalLights2 = tileContents5.externalLights; j = 0; Light[] array5 = (Light[])(object)new Light[1 + externalLights2.Length]; ReadOnlySpan<Light> readOnlySpan4 = new ReadOnlySpan<Light>(externalLights2); readOnlySpan4.CopyTo(new Span<Light>(array5).Slice(j, readOnlySpan4.Length)); j += readOnlySpan4.Length; array5[j] = light2; j++; tileContents5.externalLights = array5; } } } } }); } } public static TileContents GetTileContents(this Vector3 point) { //IL_0011: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) TileContents result = null; TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents in allTileContents) { Bounds val = tileContents.bounds; if (((Bounds)(ref val)).Contains(point)) { return tileContents; } val = tileContents.rendererBounds; if (((Bounds)(ref val)).Contains(point)) { result = tileContents; } } return result; } public static void CollectAllTilesWithinCameraFrustum(Camera camera, List<TileContents> intoList) { Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents in allTileContents) { if (Geometry.TestPlanesAABB(ref array, ref tileContents.bounds)) { intoList.Add(tileContents); } } } } public static class DynamicObjects { public static readonly HashSet<Light> AllLightsOutside = new HashSet<Light>(); public static readonly HashSet<Light> AllLightsInInterior = new HashSet<Light>(); public static readonly HashSet<Light> AllUnpredictableLights = new HashSet<Light>(); public static HashSet<GrabbableObjectContents> AllGrabbableObjectContentsOutside = new HashSet<GrabbableObjectContents>(); public static HashSet<GrabbableObjectContents> AllGrabbableObjectContentsInInterior = new HashSet<GrabbableObjectContents>(); public static Dictionary<GrabbableObject, GrabbableObjectContents> GrabbableObjectToContents = new Dictionary<GrabbableObject, GrabbableObjectContents>(); public static Dictionary<EnemyAI, HashSet<GrabbableObjectContents>> ItemsHeldByEnemies = new Dictionary<EnemyAI, HashSet<GrabbableObjectContents>>(); private static Light[][] allPlayerLights; private static HashSet<GrabbableObjectContents> GrabbableObjectsToRefresh = new HashSet<GrabbableObjectContents>(); internal static void CollectAllPlayerLights() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = allPlayerScripts.Length; allPlayerLights = new Light[num][]; for (int i = 0; i < num; i++) { if (!((Object)(object)allPlayerScripts[i] == (Object)null)) { allPlayerLights[i] = ((Component)allPlayerScripts[i]).GetComponentsInChildren<Light>(true); } } } internal static bool IsInInterior(Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (DungeonCullingInfo.AllTileContents == null) { return false; } if (((Bounds)(ref DungeonCullingInfo.DungeonBounds)).Contains(position)) { return true; } return false; } internal static bool PlayerIsInInterior(PlayerControllerB player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return IsInInterior(((Component)player).transform.position); } internal static void MarkGrabbableObjectDirty(GrabbableObject item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (((Enum)((Object)item).hideFlags).HasFlag((Enum)(object)(HideFlags)52)) { return; } Scene scene = ((Component)item).gameObject.scene; if (((Scene)(ref scene)).isLoaded) { if (GrabbableObjectToContents.TryGetValue(item, out var value)) { AllLightsOutside.ExceptWith(value.lights); AllLightsInInterior.ExceptWith(value.lights); } else { Plugin.Log("Adding contents of " + ((Object)item).name); value = new GrabbableObjectContents(item); GrabbableObjectToContents[item] = value; } GrabbableObjectsToRefresh.Add(value); } } internal static void RefreshGrabbableObjects() { foreach (GrabbableObjectContents item in GrabbableObjectsToRefresh) { RefreshGrabbableObject(item); } GrabbableObjectsToRefresh.Clear(); } internal static void RefreshGrabbableObject(GrabbableObjectContents contents) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) GrabbableObject item = contents.item; if ((Object)(object)item == (Object)null) { return; } Plugin.Log($"Refreshing contents of {((Object)item).name} @ {((Component)item).transform.position}"); contents.SetVisible(visible: true); contents.CollectContents(); CullingMethod.Instance?.OnItemCreatedOrChanged(contents); Vector3 position = ((Component)item).transform.position; if ((Object)(object)item.parentObject != (Object)null) { position = item.parentObject.position; } if ((Object)(object)item.parentObject != (Object)null && ((Component)item.parentObject).transform.TryGetComponentInParent<EnemyAI>(out var component)) { contents.heldByEnemy = component; if (!ItemsHeldByEnemies.TryGetValue(component, out var value)) { ItemsHeldByEnemies.Add(component, value = new HashSet<GrabbableObjectContents>()); } value.Add(contents); } else if (contents.heldByEnemy != null) { if (ItemsHeldByEnemies.TryGetValue(contents.heldByEnemy, out var value2)) { value2.Remove(contents); } contents.heldByEnemy = null; } if (IsInInterior(position)) { AllLightsOutside.ExceptWith(contents.lights); AllLightsInInterior.UnionWith(contents.lights); AllGrabbableObjectContentsOutside.Remove(contents); AllGrabbableObjectContentsInInterior.Add(contents); } else { AllLightsOutside.UnionWith(contents.lights); AllLightsInInterior.ExceptWith(contents.lights); AllGrabbableObjectContentsOutside.Add(contents); AllGrabbableObjectContentsInInterior.Remove(contents); } } internal static void OnPlayerTeleported(PlayerControllerB player) { CollectAllPlayerLights(); int num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player); if (num == -1) { return; } Light[] other = allPlayerLights[num]; if (PlayerIsInInterior(player)) { AllLightsOutside.ExceptWith(other); AllLightsInInterior.UnionWith(other); } else { AllLightsOutside.UnionWith(other); AllLightsInInterior.ExceptWith(other); } GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null)) { MarkGrabbableObjectDirty(val); } } } internal static void OnEnemyTeleported(EnemyAI enemy) { if (!ItemsHeldByEnemies.TryGetValue(enemy, out var value)) { return; } foreach (GrabbableObjectContents item in value) { if (!((Object)(object)item.item == (Object)null)) { MarkGrabbableObjectDirty(item.item); } } } internal static void CollectAllLightsInWorld() { IEnumerable<Light> enumerable = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0).AsEnumerable(); if (DungeonCullingInfo.AllLightsInDungeon != null) { enumerable = enumerable.Except(DungeonCullingInfo.AllLightsInDungeon); } AllLightsOutside.UnionWith(enumerable.Where((Light light) => !((Bounds)(ref DungeonCullingInfo.DungeonBounds)).Contains(((Component)light).transform.position))); AllLightsInInterior.UnionWith(enumerable.Except(AllLightsOutside)); } internal static void CollectAllUnpredictableLights() { AllUnpredictableLights.Clear(); Light item = default(Light); if (((Component)StartOfRound.Instance.spectateCamera).TryGetComponent<Light>(ref item)) { AllUnpredictableLights.Add(item); } AllUnpredictableLights.UnionWith(((Component)StartOfRound.Instance.mapScreen.mapCamera).GetComponentsInChildren<Light>()); GameObject val = GameObject.Find("ImpMap"); if ((Object)(object)val != (Object)null) { AllUnpredictableLights.UnionWith(val.GetComponentsInChildren<Light>()); } UpdateAllUnpredictableLights(); } internal static void UpdateAllUnpredictableLights() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) foreach (Light allUnpredictableLight in AllUnpredictableLights) { if (!((Object)(object)allUnpredictableLight == (Object)null) && ((Behaviour)allUnpredictableLight).isActiveAndEnabled) { if (IsInInterior(((Component)allUnpredictableLight).transform.position)) { AllLightsOutside.Remove(allUnpredictableLight); AllLightsInInterior.Add(allUnpredictableLight); } else { AllLightsInInterior.Remove(allUnpredictableLight); AllLightsOutside.Add(allUnpredictableLight); } } } } internal static void CollectAllTrackedObjects() { AllLightsOutside.Clear(); AllLightsInInterior.Clear(); AllGrabbableObjectContentsOutside.Clear(); AllGrabbableObjectContentsInInterior.Clear(); GrabbableObjectToContents.Clear(); ItemsHeldByEnemies.Clear(); CollectAllLightsInWorld(); CollectAllUnpredictableLights(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; for (int i = 0; i < allPlayerScripts.Length; i++) { OnPlayerTeleported(allPlayerScripts[i]); } GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { MarkGrabbableObjectDirty(array[i]); } CullingMethod.Instance?.OnDynamicLightsCollected(); } } public sealed class GrabbableObjectContents : IEquatable<GrabbableObjectContents> { public static readonly Vector3 Vector3NaN = new Vector3(float.NaN, float.NaN, float.NaN); public readonly GrabbableObject item; public Renderer[] renderers; public Light[] lights; public Vector3[] boundingVertices; public Bounds bounds; public EnemyAI heldByEnemy; public bool HasBounds { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (float.IsNaN(((Bounds)(ref bounds)).center.x)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).center.y)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).center.z)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.x)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.y)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.z)) { return false; } return true; } } public GrabbableObjectContents(GrabbableObject item) { this.item = item; renderers = Array.Empty<Renderer>(); lights = Array.Empty<Light>(); boundingVertices = Array.Empty<Vector3>(); base..ctor(); } public void CollectContents() { renderers = ((Component)item).GetComponentsInChildren<Renderer>(); lights = ((Component)item).GetComponentsInChildren<Light>(); CalculateLocalBounds(); } private void CalculateLocalBounds() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; Renderer[] array = renderers; foreach (Renderer val3 in array) { if (!((Object)(object)val3 == (Object)null) && val3.enabled && ((Component)val3).gameObject.activeInHierarchy) { Bounds val4 = val3.bounds; val = Vector3.Min(val, ((Bounds)(ref val4)).min); val2 = Vector3.Max(val2, ((Bounds)(ref val4)).max); } } if (((Vector3)(ref val)).Equals(Vector3.positiveInfinity) || ((Vector3)(ref val2)).Equals(Vector3.negativeInfinity)) { boundingVertices = Array.Empty<Vector3>(); return; } boundingVertices = BoundsUtility.GetVertices(val, val2); ((Component)item).transform.InverseTransformPoints((Span<Vector3>)boundingVertices); CalculateBounds(); } public void CalculateBounds() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (boundingVertices.Length == 0 || (Object)(object)item == (Object)null) { bounds = new Bounds(Vector3NaN, Vector3NaN); } else { bounds = GeometryUtility.CalculateBounds(boundingVertices, ((Component)item).transform.localToWorldMatrix); } } public bool IsVisible(Plane[] planes) { if (!HasBounds) { return false; } return Geometry.TestPlanesAABB(ref planes, ref bounds); } public bool IsVisible(Plane[][] planes, int lastIndex) { for (int i = 0; i <= lastIndex; i++) { if (!IsVisible(planes[i])) { return false; } } return true; } public bool IsWithin(Bounds bounds) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!HasBounds) { return false; } return ((Bounds)(ref this.bounds)).Intersects(bounds); } public bool IsWithin(TileContents tile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return IsWithin(tile.rendererBounds); } public bool IsWithin(IEnumerable<TileContents> tiles) { foreach (TileContents tile in tiles) { if (IsWithin(tile)) { return true; } } return false; } public void SetVisible(bool visible) { Renderer[] array = renderers; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null)) { val.forceRenderingOff = !visible; } } } public override string ToString() { if ((Object)(object)item == (Object)null) { return "Destroyed"; } return ((Object)item).name; } public override int GetHashCode() { return ((object)item).GetHashCode(); } public bool Equals(GrabbableObjectContents other) { return item == other.item; } public override bool Equals(object other) { if (other is GrabbableObjectContents other2) { return Equals(other2); } return false; } } public class Portal { private const float PlaneOffset = 0.001f; public readonly Vector3[] Corners; public readonly Bounds Bounds; public readonly TileContents NextTile; private readonly Plane _plane; public Portal(Doorway doorway, bool useTileBounds, TileContents nextTile) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)doorway).transform; float num = doorway.Socket.Size.x / 2f; float y = doorway.Socket.Size.y; if (useTileBounds) { Bounds val = UnityUtil.InverseTransformBounds(transform, doorway.Tile.Bounds); num = Mathf.Min(0f - ((Bounds)(ref val)).min.x, ((Bounds)(ref val)).max.x); y = ((Bounds)(ref val)).max.y; } Corners = (Vector3[])(object)new Vector3[4] { new Vector3(num, 0f, 0f), new Vector3(num, y, 0f), new Vector3(0f - num, y, 0f), new Vector3(0f - num, 0f, 0f) }; for (int i = 0; i < Corners.Length; i++) { Corners[i] = transform.position + transform.rotation * Corners[i]; } Vector3 val2 = Corners[0]; Vector3 val3 = Corners[0]; for (int j = 1; j < Corners.Length; j++) { Vector3 val4 = Corners[j]; val2 = Vector3.Min(val2, val4); val3 = Vector3.Max(val3, val4); } Bounds bounds = default(Bounds); ((Bounds)(ref bounds)).min = val2; ((Bounds)(ref bounds)).max = val3; Bounds = bounds; NextTile = nextTile; _plane = new Plane(Corners[0], Corners[1], Corners[2]); ref readonly Plane plane = ref _plane; ((Plane)(ref plane)).distance = ((Plane)(ref plane)).distance - 0.001f; } internal void GetFrustumPlanesNonAlloc(Vector3 origin, Plane[] planes) { //IL_0009: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) planes[0] = new Plane(Corners[0], Corners[1], origin); planes[1] = new Plane(Corners[1], Corners[2], origin); planes[2] = new Plane(Corners[2], Corners[3], origin); planes[3] = new Plane(Corners[3], Corners[0], origin); planes[4] = _plane; } internal Plane[] GetFrustumPlanes(Vector3 origin) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Plane[] array = (Plane[])(object)new Plane[5]; GetFrustumPlanesNonAlloc(origin, array); return array; } } public sealed class TileContents { private const float MaxRendererBoundsSizeIncreaseOverTileBounds = 40f; public readonly Tile tile; public readonly Bounds bounds; public Portal[] portals; public readonly Bounds rendererBounds; public Renderer[] renderers; public readonly Light[] lights; public Renderer[] externalRenderers = Array.Empty<Renderer>(); public Light[] externalLights = Array.Empty<Light>(); public Plane[][] externalLightLinesOfSight = Array.Empty<Plane[]>(); private static bool _warnedNullObject; public TileContents(Tile tile) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) this.tile = tile; if (tile.OverrideAutomaticTileBounds) { bounds = UnityUtil.CondenseBounds(tile.Bounds, (IEnumerable<Doorway>)((Component)tile).GetComponentsInChildren<Doorway>()); } else { bounds = UnityUtil.TransformBounds(((Component)tile).transform.parent, tile.Placement.Bounds); } List<Renderer> list = new List<Renderer>(((Component)tile).GetComponentsInChildren<Renderer>(true)); List<Light> list2 = new List<Light>(((Component)tile).GetComponentsInChildren<Light>(true)); foreach (Doorway usedDoorway in tile.UsedDoorways) { if (!((Object)(object)usedDoorway.doorComponent == (Object)null)) { list.AddRange(((Component)usedDoorway).GetComponentsInChildren<Renderer>(true)); list2.AddRange(((Component)usedDoorway).GetComponentsInChildren<Light>(true)); } } rendererBounds = bounds; foreach (Renderer item in list) { ((Bounds)(ref rendererBounds)).Encapsulate(item.bounds); } Bounds val = bounds; ((Bounds)(ref val)).Expand(40f); ((Bounds)(ref rendererBounds)).min = Vector3.Max(((Bounds)(ref rendererBounds)).min, ((Bounds)(ref val)).min); ((Bounds)(ref rendererBounds)).max = Vector3.Min(((Bounds)(ref rendererBounds)).max, ((Bounds)(ref val)).max); renderers = list.ToArray(); lights = list2.ToArray(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool IsInvalid(Component obj) { if ((Object)(object)obj == (Object)null) { if (!_warnedNullObject) { Plugin.LogWarning("A " + ((object)obj).GetType().Name + " in " + ((Object)tile).name + " was unexpectedly destroyed."); } _warnedNullObject = true; return true; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SetVisible(Renderer[] renderers, bool visible) { foreach (Renderer val in renderers) { if (!IsInvalid((Component)(object)val)) { val.forceRenderingOff = !visible; } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SetVisible(Light[] lights, bool visible) { int num = lights.Length; for (int i = 0; i < num; i++) { Light val = lights[i]; if (!IsInvalid((Component)(object)val)) { val.SetVisible(visible); } } } public void SetRenderersVisible(bool visible) { SetVisible(renderers, visible); } public void SetLightsVisible(bool visible) { SetVisible(lights, visible); } public void SetSelfVisible(bool visible) { SetRenderersVisible(visible); SetLightsVisible(visible); } public void SetExternalInfluencesVisible(bool visible) { SetVisible(externalRenderers, visible); SetVisible(externalLights, visible); } public override string ToString() { if ((Object)(object)tile == (Object)null) { return "Destroyed"; } return ((Object)tile).name; } } } namespace CullFactory.Behaviours.Visualization { internal class CullingVisualizer : MonoBehaviour { private const float TileBoundsInset = 0.00025f; private static readonly Color[] ColorRotation = (Color[])(object)new Color[6] { Color.red, Color.yellow, Color.green, Color.blue, Color.cyan, Color.grey }; private GameObject _portalVisualizersRoot; private GameObject _tileBoundsVisualizersRoot; private void OnEnable() { RefreshVisualizers(); } public void RefreshVisualizers() { SpawnPortalVisualizers(); SpawnTileBoundsVisualizers(); } private void SpawnPortalVisualizer(Transform prefab, Doorway doorway) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Transform obj = Object.Instantiate<Transform>(prefab, _portalVisualizersRoot.transform); obj.position = ((Component)doorway).transform.position; obj.rotation = ((Component)doorway).transform.rotation; obj.localScale = new Vector3(doorway.Socket.Size.x, doorway.Socket.Size.y, 1f); } private void SpawnPortalVisualizers() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Object.Destroy((Object)(object)_portalVisualizersRoot); if (!Config.VisualizePortals.Value) { return; } _portalVisualizersRoot = new GameObject("PortalVisualizers"); Transform val = CreatePortalVisualizer(); foreach (DoorwayConnection connection in RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.Connections) { SpawnPortalVisualizer(val, connection.A); SpawnPortalVisualizer(val, connection.B); } Object.Destroy((Object)(object)((Component)val).gameObject); } private void SpawnTileBoundsVisualizers() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)_tileBoundsVisualizersRoot); if (Config.VisualizeTileBounds.Value) { _tileBoundsVisualizersRoot = new GameObject("TileBoundsVisualizers"); Renderer val = CreateTileBoundsVisualizer(); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.00025f, 0.00025f, 0.00025f); for (int i = 0; i < DungeonCullingInfo.AllTileContents.Length; i++) { TileContents tileContents = DungeonCullingInfo.AllTileContents[i]; Renderer obj = Object.Instantiate<Renderer>(val, _tileBoundsVisualizersRoot.transform); Transform transform = ((Component)obj).transform; Bounds bounds = tileContents.bounds; transform.position = ((Bounds)(ref bounds)).center; Transform transform2 = ((Component)obj).transform; bounds = tileContents.bounds; transform2.localScale = ((Bounds)(ref bounds)).size - val2; obj.material.color = ColorRotation[i % ColorRotation.Length]; } Object.Destroy((Object)(object)((Component)val).gameObject); } } private static Transform CreatePortalVisualizer() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val).name = "PortalVisualizer"; Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); Renderer component = val.GetComponent<Renderer>(); component.material = new Material(Shader.Find("HDRP/Unlit")) { name = "PortalVisualizerMaterial", color = Color.white }; component.shadowCastingMode = (ShadowCastingMode)0; Mesh mesh = val.GetComponent<MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 0.5f, 0f - Config.VisualizedPortalOutsetDistance.Value); for (int i = 0; i < vertices.Length; i++) { ref Vector3 reference = ref vertices[i]; reference += val2; } mesh.vertices = vertices; mesh.RecalculateBounds(); return val.transform; } private static Renderer CreateTileBoundsVisualizer() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "TileBounds"; Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); Renderer component = obj.GetComponent<Renderer>(); component.material = new Material(Shader.Find("HDRP/Unlit")) { name = "TileBoundsVisualizerMaterial", color = Color.yellow }; component.shadowCastingMode = (ShadowCastingMode)0; Mesh sharedMesh = obj.GetComponent<MeshFilter>().sharedMesh; List<int> list = new List<int>(); list.AddRange(sharedMesh.triangles); list.AddRange(sharedMesh.triangles.Reverse()); sharedMesh.triangles = list.ToArray(); return component; } private void OnDisable() { Object.Destroy((Object)(object)_portalVisualizersRoot); Object.Destroy((Object)(object)_tileBoundsVisualizersRoot); } } } namespace CullFactory.Behaviours.CullingMethods { public abstract class CullingMethod : MonoBehaviour { public struct VisibilitySets { public readonly HashSet<TileContents> directTiles; public readonly HashSet<TileContents> indirectTiles; public readonly HashSet<GrabbableObjectContents> items; public readonly HashSet<Light> dynamicLights; public VisibilitySets() { directTiles = new HashSet<TileContents>(IdentityEqualityComparer<TileContents>.Instance); indirectTiles = new HashSet<TileContents>(IdentityEqualityComparer<TileContents>.Instance); items = new HashSet<GrabbableObjectContents>(EqualityComparer<GrabbableObjectContents>.Default); dynamicLights = new HashSet<Light>(IdentityEqualityComparer<Light>.Instance); } public void ClearAll() { directTiles.Clear(); indirectTiles.Clear(); items.Clear(); dynamicLights.Clear(); } } public const float ExtraShadowFadeDistance = 1.1111112f; protected Camera _hudCamera; protected bool _benchmarking; protected long _totalCalls; private float _updateInterval; private float _lastUpdateTime; private bool _renderedThisFrame; private List<Camera> _camerasToCullThisPass = new List<Camera>(); private VisibilitySets _visibility = new VisibilitySets(); private VisibilitySets _visibilityLastCall = new VisibilitySets(); private float[] _lightShadowFadeDistances; private Dictionary<LODGroup, float> _lastLODScreenHeights; protected TileContents _debugTile; private double _cullingTime; public static CullingMethod Instance { get; private set; } public static void Initialize() { if ((Object)(object)Instance != (Object)null) { Object.DestroyImmediate((Object)(object)Instance); Instance = null; } if ((Object)(object)RoundManager.Instance == (Object)null || (Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null) { return; } DungeonGenerator generator = RoundManager.Instance.dungeonGenerator.Generator; GameObject gameObject = ((Component)generator.CurrentDungeon).gameObject; CullingMethod cullingMethod = null; switch (Config.GetCullingType(generator.DungeonFlow)) { case CullingType.PortalOcclusionCulling: cullingMethod = gameObject.AddComponent<PortalOcclusionCuller>(); break; case CullingType.DepthCulling: cullingMethod = gameObject.AddComponent<DepthCuller>(); break; default: throw new ArgumentOutOfRangeException(); case CullingType.None: break; } if (!((Object)(object)cullingMethod == (Object)null)) { if (Config.UpdateFrequency.Value > 0f) { cullingMethod._updateInterval = 1f / Config.UpdateFrequency.Value; } else { cullingMethod._updateInterval = 0f; } } } private void Awake() { Instance = this; Canvas componentInParent = ((Component)HUDManager.Instance.HUDContainer.transform).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { _hudCamera = componentInParent.worldCamera; } else { Plugin.LogWarning("Failed to find the HUD canvas, culling will be calculated unnecessarily for the HUD camera."); } } private void OnEnable() { DungeonCullingInfo.AllTileContents.SetSelfVisible(visible: false); DynamicObjects.AllGrabbableObjectContentsOutside.SetVisible(visible: false); DynamicObjects.AllGrabbableObjectContentsInInterior.SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsOutside).SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsInInterior).SetVisible(visible: false); DisableShadowDistanceFading(); DisableInteriorLODCulling(); RenderPipelineManager.beginContextRendering += DoCulling; } internal void OnDynamicLightsCollected() { ((IEnumerable<Light>)DynamicObjects.AllLightsOutside).SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsInInterior).SetVisible(visible: false); ((IEnumerable<Light>)_visibilityLastCall.dynamicLights).SetVisible(visible: true); } internal void OnItemCreatedOrChanged(GrabbableObjectContents item) { item.SetVisible(_visibilityLastCall.items.Contains(item)); } protected virtual void BenchmarkEnded() { double num = _cullingTime / (double)_totalCalls; Plugin.Log($"Total culling time {num * 1000000.0:0.####} microseconds."); _cullingTime = 0.0; } private void Update() { if (Config.Logging.Value && UnityInput.Current.GetKey("LeftAlt") && UnityInput.Current.GetKeyUp("B")) { _benchmarking = !_benchmarking; if (!_benchmarking) { BenchmarkEnded(); _totalCalls = 0L; } } } private void LateUpdate() { _renderedThisFrame = false; } protected abstract void AddVisibleObjects(List<Camera> cameras, VisibilitySets visibility); protected void AddAllObjectsWithinOrthographicCamera(Camera camera, VisibilitySets visibility) { Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = DungeonCullingInfo.AllTileContents; foreach (TileContents tileContents in allTileContents) { if (Geometry.TestPlanesAABB(ref planes, ref tileContents.bounds)) {
BepInEx/plugins/ZoLoKinoBabo112/CullFactoryBurstPlugin.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using CullFactoryBurst; using Unity.Burst; using Unity.Mathematics; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.TestPlanesAABB_00000004$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeBoundsHeightInterval_00000007$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.AppendEdge_00000008$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ApplyFaceConfiguration_0000000A$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.EdgeHasPointInsideCone_0000000C$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.CandidatesHavePointInsideCone_0000000D$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ConeIntersectsBounds_0000000E$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.IsRunningBurstLibrary_00000012$BurstDirectCall))] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { MonoScriptData result = default(MonoScriptData); result.FilePathsData = new byte[98] { 0, 0, 0, 5, 0, 0, 0, 42, 92, 65, 115, 115, 101, 116, 115, 92, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 80, 108, 117, 103, 105, 110, 92, 71, 101, 111, 109, 101, 116, 114, 121, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 40, 92, 65, 115, 115, 101, 116, 115, 92, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 80, 108, 117, 103, 105, 110, 92, 80, 108, 117, 103, 105, 110, 46, 99, 115 }; result.TypesData = new byte[220] { 0, 0, 0, 0, 25, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 124, 71, 101, 111, 109, 101, 116, 114, 121, 0, 0, 0, 0, 30, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 67, 111, 110, 101, 0, 0, 0, 0, 37, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 69, 100, 103, 101, 73, 110, 100, 105, 99, 101, 115, 0, 0, 0, 0, 38, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 70, 97, 99, 101, 73, 110, 100, 101, 120, 83, 101, 116, 0, 0, 0, 0, 37, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 70, 97, 99, 101, 73, 110, 100, 105, 99, 101, 115, 0, 0, 0, 0, 23, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 124, 80, 108, 117, 103, 105, 110 }; result.TotalFiles = 2; result.TotalTypes = 6; result.IsEditorOnly = false; return result; } } namespace CullFactoryBurst; [BurstCompile] public static class Geometry { private struct Cone { internal Vector3 origin; internal Vector3 direction; internal float length; internal float cosAngle; internal Cone(Vector3 origin, Vector3 direction, float length, float angle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.origin = origin; this.direction = direction; this.length = length; cosAngle = math.cos(math.radians(angle / 2f)); } } private struct EdgeIndices { internal int a; internal int b; internal EdgeIndices(int a, int b) { this.a = a; this.b = b; } } private struct FaceIndexSet { internal int a; internal int b; internal int c; internal int d; internal FaceIndexSet(int a, int b, int c, int d) { this.a = a; this.b = b; this.c = c; this.d = d; } } private struct FaceIndices { internal FaceIndexSet vertices; internal FaceIndexSet edges; internal FaceIndices(FaceIndexSet vertices, FaceIndexSet edges) { this.vertices = vertices; this.edges = edges; } } public unsafe delegate bool TestPlanesAABB_00000004$PostfixBurstDelegate(Plane* planes, int planeCount, in Bounds bounds); internal static class TestPlanesAABB_00000004$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(TestPlanesAABB_00000004$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static TestPlanesAABB_00000004$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(Plane* planes, int planeCount, in Bounds bounds) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<Plane*, int, ref Bounds, bool>)functionPointer)(planes, planeCount, ref bounds); } } return TestPlanesAABB$BurstManaged(planes, planeCount, in bounds); } } public delegate void ComputeBoundsHeightInterval_00000007$PostfixBurstDelegate(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight); internal static class ComputeBoundsHeightInterval_00000007$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeBoundsHeightInterval_00000007$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeBoundsHeightInterval_00000007$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref Bounds, ref Cone, ref float, ref float, void>)functionPointer)(ref bounds, ref cone, ref minHeight, ref maxHeight); return; } } ComputeBoundsHeightInterval$BurstManaged(in bounds, in cone, out minHeight, out maxHeight); } } public unsafe delegate void AppendEdge_00000008$PostfixBurstDelegate(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge); internal static class AppendEdge_00000008$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(AppendEdge_00000008$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static AppendEdge_00000008$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<EdgeIndices*, ref int, ref EdgeIndices, void>)functionPointer)(edges, ref edgeCount, ref edge); return; } } AppendEdge$BurstManaged(edges, ref edgeCount, in edge); } } public unsafe delegate void ComputeCandidatesOnBoundsEdges_00000009$PostfixBurstDelegate(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount); internal static class ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeCandidatesOnBoundsEdges_00000009$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref Cone, float3*, float*, float*, EdgeIndices*, ref int, void>)functionPointer)(ref cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); return; } } ComputeCandidatesOnBoundsEdges$BurstManaged(in cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } } public unsafe delegate void ApplyFaceConfiguration_0000000A$PostfixBurstDelegate(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount); internal static class ApplyFaceConfiguration_0000000A$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ApplyFaceConfiguration_0000000A$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ApplyFaceConfiguration_0000000A$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref FaceIndices, float*, int, EdgeIndices*, ref int, void>)functionPointer)(ref face, projections, baseIndex, candidates, ref candidateCount); return; } } ApplyFaceConfiguration$BurstManaged(in face, projections, baseIndex, candidates, ref candidateCount); } } public unsafe delegate void ComputeCandidatesOnBoundsFaces_0000000B$PostfixBurstDelegate(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount); internal static class ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeCandidatesOnBoundsFaces_0000000B$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<float3*, float*, float*, EdgeIndices*, ref int, void>)functionPointer)(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); return; } } ComputeCandidatesOnBoundsFaces$BurstManaged(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } } public delegate bool EdgeHasPointInsideCone_0000000C$PostfixBurstDelegate(in float3 pointA, in float3 pointB, in Cone cone); internal static class EdgeHasPointInsideCone_0000000C$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(EdgeHasPointInsideCone_0000000C$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static EdgeHasPointInsideCone_0000000C$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in float3 pointA, in float3 pointB, in Cone cone) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref float3, ref float3, ref Cone, bool>)functionPointer)(ref pointA, ref pointB, ref cone); } } return EdgeHasPointInsideCone$BurstManaged(in pointA, in pointB, in cone); } } public unsafe delegate bool CandidatesHavePointInsideCone_0000000D$PostfixBurstDelegate(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount); internal static class CandidatesHavePointInsideCone_0000000D$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(CandidatesHavePointInsideCone_0000000D$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static CandidatesHavePointInsideCone_0000000D$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref Cone, float3*, EdgeIndices*, int, bool>)functionPointer)(ref cone, vertices, candidates, candidateCount); } } return CandidatesHavePointInsideCone$BurstManaged(in cone, vertices, candidates, candidateCount); } } public delegate bool ConeIntersectsBounds_0000000E$PostfixBurstDelegate(in Cone cone, in Bounds bounds); internal static class ConeIntersectsBounds_0000000E$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ConeIntersectsBounds_0000000E$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ConeIntersectsBounds_0000000E$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in Cone cone, in Bounds bounds) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref Cone, ref Bounds, bool>)functionPointer)(ref cone, ref bounds); } } return ConeIntersectsBounds$BurstManaged(in cone, in bounds); } } private static bool WarnedCallWasNotBurstCompiled = false; private static readonly EdgeIndices[] edges = new EdgeIndices[12] { new EdgeIndices(0, 1), new EdgeIndices(1, 3), new EdgeIndices(2, 3), new EdgeIndices(0, 2), new EdgeIndices(4, 5), new EdgeIndices(5, 7), new EdgeIndices(6, 7), new EdgeIndices(4, 6), new EdgeIndices(0, 4), new EdgeIndices(1, 5), new EdgeIndices(3, 7), new EdgeIndices(2, 6) }; private const int CornerVertexCount = 8; private const int MaxVertexCount = 32; private const int ClipVerticesMinBaseIndex = 8; private const int ClipVerticesMaxBaseIndex = 20; private const int BoxEdgeCount = 12; private const int MaxEdgeCandidateCount = 496; private static readonly FaceIndices[] faces = new FaceIndices[6] { new FaceIndices(new FaceIndexSet(0, 4, 6, 2), new FaceIndexSet(8, 7, 11, 3)), new FaceIndices(new FaceIndexSet(1, 3, 7, 5), new FaceIndexSet(1, 10, 5, 9)), new FaceIndices(new FaceIndexSet(0, 1, 5, 4), new FaceIndexSet(0, 9, 4, 8)), new FaceIndices(new FaceIndexSet(2, 6, 7, 3), new FaceIndexSet(11, 6, 10, 2)), new FaceIndices(new FaceIndexSet(0, 2, 3, 1), new FaceIndexSet(3, 2, 1, 0)), new FaceIndices(new FaceIndexSet(4, 5, 7, 6), new FaceIndexSet(4, 5, 6, 7)) }; [BurstDiscard] public static void WarnIfNotBurstCompiled() { if (!WarnedCallWasNotBurstCompiled) { Debug.LogWarning((object)"Methods intended to be Burst-compiled in CullFactoryBurstPlugin are not using Burst."); WarnedCallWasNotBurstCompiled = true; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool TestPlanesAABB(Plane* planes, int planeCount, in Bounds bounds) { return TestPlanesAABB_00000004$BurstDirectCall.Invoke(planes, planeCount, in bounds); } public unsafe static bool TestPlanesAABB(in Plane[] planes, in Bounds bounds) { fixed (Plane* planes2 = planes) { return TestPlanesAABB(planes2, planes.Length, in bounds); } } public unsafe static bool TestPlanesAABB(in Span<Plane> planes, in Bounds bounds) { fixed (Plane* planes2 = planes) { return TestPlanesAABB(planes2, planes.Length, in bounds); } } [BurstCompile(/*Could not decode attribute arguments.*/)] private static void ComputeBoundsHeightInterval(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { ComputeBoundsHeightInterval_00000007$BurstDirectCall.Invoke(in bounds, in cone, out minHeight, out maxHeight); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void AppendEdge(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { AppendEdge_00000008$BurstDirectCall.Invoke(edges, ref edgeCount, in edge); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ComputeCandidatesOnBoundsEdges(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall.Invoke(in cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ApplyFaceConfiguration(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { ApplyFaceConfiguration_0000000A$BurstDirectCall.Invoke(in face, projections, baseIndex, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ComputeCandidatesOnBoundsFaces(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall.Invoke(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private static bool EdgeHasPointInsideCone(in float3 pointA, in float3 pointB, in Cone cone) { return EdgeHasPointInsideCone_0000000C$BurstDirectCall.Invoke(in pointA, in pointB, in cone); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static bool CandidatesHavePointInsideCone(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { return CandidatesHavePointInsideCone_0000000D$BurstDirectCall.Invoke(in cone, vertices, candidates, candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private static bool ConeIntersectsBounds(in Cone cone, in Bounds bounds) { return ConeIntersectsBounds_0000000E$BurstDirectCall.Invoke(in cone, in bounds); } public static bool SpotLightInfluencesBounds(in Light light, in Bounds bounds) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)light).transform; Cone cone = new Cone(transform.position, transform.forward, light.range, light.spotAngle); return ConeIntersectsBounds(in cone, in bounds); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool TestPlanesAABB$BurstManaged(Plane* planes, int planeCount, in Bounds bounds) { //IL_0017: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) WarnIfNotBurstCompiled(); for (int i = 0; i < planeCount; i++) { Plane val = (Plane)((byte*)planes)[(nint)i * (nint)Unsafe.SizeOf<Plane>()]; float x = ((Plane)(ref val)).normal.x; Bounds val2 = bounds; float num = x * ((Bounds)(ref val2)).center.x; float y = ((Plane)(ref val)).normal.y; val2 = bounds; float num2 = num + y * ((Bounds)(ref val2)).center.y; float z = ((Plane)(ref val)).normal.z; val2 = bounds; float num3 = num2 + z * ((Bounds)(ref val2)).center.z; float num4 = math.abs(((Plane)(ref val)).normal.x); val2 = bounds; float num5 = num4 * ((Bounds)(ref val2)).extents.x; float num6 = math.abs(((Plane)(ref val)).normal.y); val2 = bounds; float num7 = num5 + num6 * ((Bounds)(ref val2)).extents.y; float num8 = math.abs(((Plane)(ref val)).normal.z); val2 = bounds; float num9 = num7 + num8 * ((Bounds)(ref val2)).extents.z; if (num3 + num9 + ((Plane)(ref val)).distance <= 0f) { return false; } } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public static void ComputeBoundsHeightInterval$BurstManaged(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { //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_000a: 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_0014: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0057: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) Bounds val = bounds; float3 val2 = float3.op_Implicit(((Bounds)(ref val)).center); val = bounds; float3 val3 = float3.op_Implicit(((Bounds)(ref val)).extents); float3 val4 = float3.op_Implicit(cone.origin); float3 val5 = float3.op_Implicit(cone.direction); float num = math.dot(val5, val2 - val4); val = bounds; float num2 = ((Bounds)(ref val)).extents.x * math.abs(val5.x); val = bounds; float num3 = num2 + ((Bounds)(ref val)).extents.y * math.abs(val5.y) + val3.z * math.abs(val5.z); minHeight = num - num3; maxHeight = num + num3; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void AppendEdge$BurstManaged(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { edges[edgeCount++] = edge; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ComputeCandidatesOnBoundsEdges$BurstManaged(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a6: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 8; i++) { float num = math.dot(float3.op_Implicit(cone.direction), (float3)((byte*)vertices)[(nint)i * (nint)Unsafe.SizeOf<float3>()]); projectionsMin[i] = 0f - num; projectionsMax[i] = num - cone.length; } int num2 = 8; int num3 = 20; for (int num4 = 0; num4 < 12; num4++) { EdgeIndices edge = edges[num4]; float num5 = projectionsMin[edge.a]; float num6 = projectionsMin[edge.b]; int num7; if (!(num5 < 0f) || !(num6 > 0f)) { if (num5 > 0f) { num7 = ((num6 < 0f) ? 1 : 0); if (num7 != 0) { goto IL_00ab; } } else { num7 = 0; } goto IL_0104; } num7 = 1; goto IL_00ab; IL_00ab: Unsafe.Write((byte*)vertices + (nint)num2 * (nint)Unsafe.SizeOf<float3>(), (num6 * (float3)((byte*)vertices)[(nint)edge.a * (nint)Unsafe.SizeOf<float3>()] - num5 * (float3)((byte*)vertices)[(nint)edge.b * (nint)Unsafe.SizeOf<float3>()]) / (num6 - num5)); goto IL_0104; IL_0104: float num8 = projectionsMax[edge.a]; float num9 = projectionsMax[edge.b]; bool flag = (num8 < 0f && num9 > 0f) || (num8 > 0f && num9 < 0f); if (flag) { Unsafe.Write((byte*)vertices + (nint)num3 * (nint)Unsafe.SizeOf<float3>(), (num9 * (float3)((byte*)vertices)[(nint)edge.a * (nint)Unsafe.SizeOf<float3>()] - num8 * (float3)((byte*)vertices)[(nint)edge.b * (nint)Unsafe.SizeOf<float3>()]) / (num9 - num8)); } if (num7 != 0) { if (flag) { EdgeIndices edge2 = new EdgeIndices(num2, num3); AppendEdge(candidates, ref candidateCount, in edge2); } else if (num5 < 0f) { EdgeIndices edge2 = new EdgeIndices(edge.a, num2); AppendEdge(candidates, ref candidateCount, in edge2); } else { EdgeIndices edge2 = new EdgeIndices(edge.b, num2); AppendEdge(candidates, ref candidateCount, in edge2); } } else if (flag) { if (num8 < 0f) { EdgeIndices edge2 = new EdgeIndices(edge.a, num3); AppendEdge(candidates, ref candidateCount, in edge2); } else { EdgeIndices edge2 = new EdgeIndices(edge.b, num3); AppendEdge(candidates, ref candidateCount, in edge2); } } else if (num5 <= 0f && num6 <= 0f && num8 <= 0f && num9 <= 0f) { AppendEdge(candidates, ref candidateCount, in edge); } num2++; num3++; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ApplyFaceConfiguration$BurstManaged(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { float num = projections[face.vertices.a]; float num2 = projections[face.vertices.b]; float num3 = projections[face.vertices.c]; float num4 = projections[face.vertices.d]; int num5 = ((!(num < 0f)) ? ((!(num > 0f)) ? 1 : 2) : 0); int num6 = ((!(num2 < 0f)) ? ((!(num2 > 0f)) ? 1 : 2) : 0); int num7 = ((!(num3 < 0f)) ? ((!(num3 > 0f)) ? 1 : 2) : 0); switch (((!(num4 < 0f)) ? ((!(num4 > 0f)) ? 1 : 2) : 0) + 3 * (num7 + 3 * (num6 + 3 * num5))) { case 2: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 5: { EdgeIndices edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 6: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 7: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 8: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 11: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 14: { EdgeIndices edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 15: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 16: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 17: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 18: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 19: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 20: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 21: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 22: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 23: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 24: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 25: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 26: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 29: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 32: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 33: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 34: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 35: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 38: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 41: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 42: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 43: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 45: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 46: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 47: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 48: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 49: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 51: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 54: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 55: { EdgeIndices edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 56: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 57: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 58: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 59: { EdgeIndices edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 60: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 61: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 62: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 63: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 64: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 65: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 66: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 69: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 72: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 73: { EdgeIndices edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 74: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 75: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 78: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 3: case 4: case 9: case 10: case 12: case 13: case 27: case 28: case 30: case 31: case 36: case 37: case 39: case 40: case 44: case 50: case 52: case 53: case 67: case 68: case 70: case 71: case 76: case 77: break; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ComputeCandidatesOnBoundsFaces$BurstManaged(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { for (int i = 0; i < 6; i++) { FaceIndices face = faces[i]; ApplyFaceConfiguration(in face, projectionsMin, 8, candidates, ref candidateCount); ApplyFaceConfiguration(in face, projectionsMax, 20, candidates, ref candidateCount); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public static bool EdgeHasPointInsideCone$BurstManaged(in float3 pointA, in float3 pointB, in Cone cone) { //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_000c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (math.dot(float3.op_Implicit(cone.direction), pointA) - cone.cosAngle * math.length(pointA) > 0f) { return true; } if (math.dot(float3.op_Implicit(cone.direction), pointB) - cone.cosAngle * math.length(pointB) > 0f) { return true; } float3 val = pointB - pointA; float3 val2 = math.cross(pointA, float3.op_Implicit(cone.direction)); float3 val3 = math.cross(pointA, val); float num = math.dot(val3, val2); if (num > 0f) { float3 val4 = math.cross(pointB, float3.op_Implicit(cone.direction)); float num2 = math.dot(val3, val4); if (num2 < 0f) { float num3 = num / (num - num2); float3 val5 = pointA + num3 * val; if (math.dot(float3.op_Implicit(cone.direction), val5) - cone.cosAngle * math.length(val5) > 0f) { return true; } } } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool CandidatesHavePointInsideCone$BurstManaged(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0040: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < candidateCount; i++) { EdgeIndices edgeIndices = candidates[i]; float3 pointA = (float3)((byte*)vertices)[(nint)edgeIndices.a * (nint)Unsafe.SizeOf<float3>()]; float3 pointB = (float3)((byte*)vertices)[(nint)edgeIndices.b * (nint)Unsafe.SizeOf<float3>()]; if (EdgeHasPointInsideCone(in pointA, in pointB, in cone)) { return true; } } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool ConeIntersectsBounds$BurstManaged(in Cone cone, in Bounds bounds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01ff: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) WarnIfNotBurstCompiled(); ComputeBoundsHeightInterval(in bounds, in cone, out var minHeight, out var maxHeight); if (maxHeight <= 0f || minHeight >= cone.length) { return false; } Bounds val = bounds; float num = default(float); if (((Bounds)(ref val)).IntersectRay(new Ray(cone.origin, cone.direction), ref num)) { return true; } val = bounds; float3 val2 = float3.op_Implicit(((Bounds)(ref val)).min); val = bounds; float3 val3 = float3.op_Implicit(((Bounds)(ref val)).max); float3 val4 = float3.op_Implicit(cone.origin); float3* ptr = (float3*)stackalloc float3[32]; Unsafe.Write(ptr, new float3(val2.x, val2.y, val2.z) - val4); Unsafe.Write((byte*)ptr + Unsafe.SizeOf<float3>(), new float3(val3.x, val2.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)2 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val3.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)3 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val3.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)4 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val2.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)5 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val2.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)6 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val3.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)7 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val3.y, val3.z) - val4); EdgeIndices* ptr2 = stackalloc EdgeIndices[1024]; int candidateCount = 0; if (minHeight >= 0f && maxHeight <= cone.length) { for (int i = 0; i < 12; i++) { ptr2[i] = edges[i]; candidateCount++; } return CandidatesHavePointInsideCone(in cone, ptr, ptr2, candidateCount); } float* projectionsMin = stackalloc float[8]; float* projectionsMax = stackalloc float[8]; ComputeCandidatesOnBoundsEdges(in cone, ptr, projectionsMin, projectionsMax, ptr2, ref candidateCount); ComputeCandidatesOnBoundsFaces(ptr, projectionsMin, projectionsMax, ptr2, ref candidateCount); return CandidatesHavePointInsideCone(in cone, ptr, ptr2, candidateCount); } } [BurstCompile] public static class Plugin { public delegate bool IsRunningBurstLibrary_00000012$PostfixBurstDelegate(); internal static class IsRunningBurstLibrary_00000012$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(IsRunningBurstLibrary_00000012$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static IsRunningBurstLibrary_00000012$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke() { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<bool>)functionPointer)(); } } return IsRunningBurstLibrary$BurstManaged(); } } [BurstDiscard] private static void SetValueFalseIfManaged(ref bool value) { value = false; } [BurstCompile] public static bool IsRunningBurstLibrary() { return IsRunningBurstLibrary_00000012$BurstDirectCall.Invoke(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile] public static bool IsRunningBurstLibrary$BurstManaged() { bool value = true; SetValueFalseIfManaged(ref value); return value; } } internal static class $BurstDirectCallInitializer { [RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)] private static void Initialize() { Geometry.TestPlanesAABB_00000004$BurstDirectCall.Initialize(); Geometry.ComputeBoundsHeightInterval_00000007$BurstDirectCall.Initialize(); Geometry.AppendEdge_00000008$BurstDirectCall.Initialize(); Geometry.ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall.Initialize(); Geometry.ApplyFaceConfiguration_0000000A$BurstDirectCall.Initialize(); Geometry.ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall.Initialize(); Geometry.EdgeHasPointInsideCone_0000000C$BurstDirectCall.Initialize(); Geometry.CandidatesHavePointInsideCone_0000000D$BurstDirectCall.Initialize(); Geometry.ConeIntersectsBounds_0000000E$BurstDirectCall.Initialize(); Plugin.IsRunningBurstLibrary_00000012$BurstDirectCall.Initialize(); } }
BepInEx/plugins/ZoLoKinoBabo112/DiversityLib.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DiversityLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DiversityLib")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f3aa347e-bdfa-4c6a-b93f-1429e4f206c4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace DiversityLib { public static class DiversityLib { public static Texture2D RenderToTexture2D(this RenderTexture rTex) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(((Texture)rTex).width, ((Texture)rTex).height, (TextureFormat)4, false); RenderTexture.active = rTex; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)rTex).width, (float)((Texture)rTex).height), 0, 0); val.Apply(); return val; } public static Color[] GetPixels(this RenderTexture texture) { Texture2D val = texture.RenderToTexture2D(); return val.GetPixels(); } public static float CalculateAverageLuminance(this RenderTexture texture, bool useAlpha = false) { //IL_002d: 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_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = texture.RenderToTexture2D(); float num = ((Texture)val).width * ((Texture)val).height; float num2 = 0f; Color[] pixels = val.GetPixels(); foreach (Color color in pixels) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static float CalculateAverageLuminance(this Texture2D texture, bool useAlpha = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; Color[] pixels = texture.GetPixels(); foreach (Color color in pixels) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static float CalculateAverageLuminance(this Color[] colorArray, bool useAlpha = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) float num = colorArray.Length; float num2 = 0f; foreach (Color color in colorArray) { num2 += color.CalculateLuminance(useAlpha); } return num2 / num; } public static Color AverageDifference(this Texture2D texture, Texture2D secondTexture) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_009e: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; for (int i = 0; i < ((Texture)texture).width; i++) { for (int j = 0; j < ((Texture)texture).height; j++) { Color pixel = texture.GetPixel(i, j); Color pixel2 = secondTexture.GetPixel(i, j); num2 += Mathf.Abs(pixel.r - pixel2.r); num3 += Mathf.Abs(pixel.g - pixel2.g); num4 += Mathf.Abs(pixel.b - pixel2.b); num5 += Mathf.Abs(pixel.a - pixel2.a); } } num2 /= num; num3 /= num; num4 /= num; num5 /= num; return new Color(num2, num3, num4, num5); } public static float BW(this Color col) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return col.r + col.g + col.b; } public static float CalculateLuminance(this Color color, bool useAlpha = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0041: 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) return 0.299f * color.r * (useAlpha ? color.a : 1f) + 0.587f * color.g * (useAlpha ? color.a : 1f) + 0.114f * color.b * (useAlpha ? color.a : 1f); } public static Color GetAverageRGBA(this RenderTexture texture) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Texture2D texture2 = texture.RenderToTexture2D(); return texture2.GetAverageRGBA(); } public static Color GetAverageRGBA(this Texture2D texture) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; Color[] pixels = texture.GetPixels(); foreach (Color val in pixels) { num2 += val.r; num3 += val.g; num4 += val.b; num5 += val.a; } return new Color(num2 / num, num3 / num, num4 / num, num5 / num); } public static Color GetAverageRGBA(this Color[] colorArray) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) float num = colorArray.Length; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; foreach (Color val in colorArray) { num2 += val.r; num3 += val.g; num4 += val.b; num5 += val.a; } return new Color(num2 / num, num3 / num, num4 / num, num5 / num); } public static float Remap(this float value, float from1, float to1, float from2, float to2) { return (value - from1) / (to1 - from1) * (to2 - from2) + from2; } public static float OneMinus(this float f) { return 1f - f; } public static float Negate(this float f) { return 0f - f; } public static uint Random(this uint u) { Random random = new Random(); uint num = (uint)random.Next(1073741824); uint num2 = (uint)random.Next(4); return (num << 2) | num2; } public static float Volume(this Vector3 v3) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return v3.x * v3.y * v3.z; } } }
BepInEx/plugins/ZoLoKinoBabo112/FairAI.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FairAI.Component; using FairAI.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalThings; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FairAI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FairAI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("42deea12-f73e-4d63-81e9-5359e98c8d53")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace FairAI { internal class FAIR_AI : NetworkBehaviour { public EnemyAI targetWithRotation; private void Awake() { targetWithRotation = null; } [ClientRpc] public void SwitchedTargetedEnemyClientRpc(Turret turret, EnemyAI enemy, bool setModeToCharging = false) { targetWithRotation = enemy; if (setModeToCharging) { Type typeFromHandle = typeof(Turret); MethodInfo method = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(turret, new object[1] { 1 }); } } [ClientRpc] public void RemoveTargetedEnemyClientRpc() { targetWithRotation = null; } } [BepInPlugin("GoldenKitten.FairAI", "Fair AI", "1.3.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string modGUID = "GoldenKitten.FairAI"; private const string modName = "Fair AI"; private const string modVersion = "1.3.8"; private Harmony harmony = new Harmony("GoldenKitten.FairAI"); public static Plugin Instance; public static ManualLogSource logger; public static List<EnemyType> enemies; public static List<Item> items; public static Assembly surfacedAssembly; public const string ltModID = "evaisa.lethalthings"; public const string surfacedModID = "Surfaced"; public static bool playersEnteredInside = false; public static bool surfacedEnabled = false; public static bool lethalThingsEnabled = false; public static int wallsAndEnemyLayerMask = 524288; public static int enemyMask = 524288; public static int allHittablesMask; private static float onMeshThreshold = 3f; private async void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } surfacedAssembly = null; harmony = new Harmony("GoldenKitten.FairAI"); logger = Logger.CreateLogSource("GoldenKitten.FairAI"); harmony.PatchAll(typeof(Plugin)); CreateHarmonyPatch(harmony, typeof(RoundManager), "Start", null, typeof(RoundManagerPatch), "PatchStart", isPrefix: false); CreateHarmonyPatch(harmony, typeof(StartOfRound), "Start", null, typeof(StartOfRoundPatch), "PatchStart", isPrefix: false); CreateHarmonyPatch(harmony, typeof(StartOfRound), "Update", null, typeof(StartOfRoundPatch), "PatchUpdate", isPrefix: false); CreateHarmonyPatch(harmony, typeof(Turret), "Update", null, typeof(TurretAIPatch), "PatchUpdate", isPrefix: true); CreateHarmonyPatch(harmony, typeof(Turret), "SetTargetToPlayerBody", null, typeof(TurretAIPatch), "PatchSetTargetToPlayerBody", isPrefix: true); CreateHarmonyPatch(harmony, typeof(Turret), "TurnTowardsTargetIfHasLOS", null, typeof(TurretAIPatch), "PatchTurnTowardsTargetIfHasLOS", isPrefix: true); CreateHarmonyPatch(harmony, typeof(Landmine), "SpawnExplosion", new Type[8] { typeof(Vector3), typeof(bool), typeof(float), typeof(float), typeof(int), typeof(float), typeof(GameObject), typeof(bool) }, typeof(MineAIPatch), "PatchSpawnExplosion", isPrefix: false); CreateHarmonyPatch(harmony, typeof(Landmine), "OnTriggerEnter", null, typeof(MineAIPatch), "PatchOnTriggerEnter", isPrefix: false); CreateHarmonyPatch(harmony, typeof(Landmine), "OnTriggerExit", null, typeof(MineAIPatch), "PatchOnTriggerExit", isPrefix: false); CreateHarmonyPatch(harmony, typeof(Landmine), "Detonate", null, typeof(MineAIPatch), "DetonatePatch", isPrefix: false); await WaitForProcess(1); logger.LogInfo((object)"Fair AI initiated!"); } public static async Task<IEnumerable<int>> WaitForProcess(int waitTime) { await Task.Delay(waitTime); bool done = false; while (!done) { await Instance.DelayedInitialization(); done = true; } return new List<int>(); } private async Task DelayedInitialization() { await Task.Run(delegate { TryLoadLethalThings(); TryLoadSurfaced(); logger.LogInfo((object)"Optional Components initiated!"); }); } private void TryLoadLethalThings() { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly assembly = null; Assembly[] array = assemblies; foreach (Assembly assembly2 in array) { if (assembly2.GetName().Name == "LethalThings") { assembly = assembly2; break; } } if (assembly != null) { Type type = assembly.GetType("LethalThings.RoombaAI"); if (type != null && BoombaPatch.enabled) { CreateHarmonyPatch(harmony, type, "Start", null, typeof(BoombaPatch), "PatchStart", isPrefix: false); CreateHarmonyPatch(harmony, type, "DoAIInterval", null, typeof(BoombaPatch), "PatchDoAIInterval", isPrefix: false); lethalThingsEnabled = true; logger.LogInfo((object)"LethalThings Component Initiated!"); } } else { logger.LogWarning((object)"LethalThings assembly not found. Skipping optional patch."); } } catch (Exception ex) { logger.LogError((object)("An error occurred while trying to apply patches for LethalThings: " + ex.Message)); } } private void TryLoadSurfaced() { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly[] array = assemblies; foreach (Assembly assembly in array) { if (assembly.GetName().Name == "Surfaced") { surfacedAssembly = assembly; break; } } if (surfacedAssembly != null) { Type type = surfacedAssembly.GetType("Seamine"); if (type != null) { if (SurfacedMinePatch.enabled) { CreateHarmonyPatch(harmony, type, "OnTriggerEnter", new Type[1] { typeof(Collider) }, typeof(SurfacedMinePatch), "PatchOnTriggerEnter", isPrefix: false); surfacedEnabled = true; logger.LogInfo((object)"Surfaced Component Initiated!"); } } else { logger.LogInfo((object)"Surfaced Component Not Found!"); } } else { logger.LogWarning((object)"Surfaced assembly not found. Skipping optional patch."); } } catch (Exception ex) { logger.LogError((object)("An error occurred while trying to apply patches for Surfaced: " + ex.Message)); } } public static List<PlayerControllerB> GetActivePlayers() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { if ((Object)val != (Object)null && !val.isPlayerDead && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled) { list.Add(val); } } return list; } public static bool AllowFairness(Vector3 position) { //IL_0027: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance != (Object)null && Can("CheckForPlayersInside")) { if (IsAPlayersOutside()) { if (!(position.y > -80f)) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(position)) { goto IL_005c; } } return true; } goto IL_005c; } return true; IL_005c: return playersEnteredInside; } public static bool IsAPlayersOutside() { List<PlayerControllerB> activePlayers = GetActivePlayers(); for (int i = 0; i < activePlayers.Count; i++) { PlayerControllerB val = activePlayers[i]; if (!val.isInsideFactory) { return true; } } return false; } public static bool IsAPlayerInsideShip() { List<PlayerControllerB> activePlayers = GetActivePlayers(); for (int i = 0; i < activePlayers.Count; i++) { PlayerControllerB val = activePlayers[i]; if (val.isInHangarShipRoom) { return true; } } return false; } public static bool IsAPlayerInsideDungeon() { List<PlayerControllerB> activePlayers = GetActivePlayers(); for (int i = 0; i < activePlayers.Count; i++) { PlayerControllerB val = activePlayers[i]; if (val.isInsideFactory) { return true; } } return false; } public static bool CanMob(string parentIdentifier, string identifier, string mobName) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown string text = RemoveInvalidCharacters(mobName).ToUpper(); if (((BaseUnityPlugin)Instance).Config[new ConfigDefinition("Mobs", parentIdentifier)].BoxedValue.ToString().ToUpper().Equals("TRUE")) { foreach (ConfigDefinition key in ((BaseUnityPlugin)Instance).Config.Keys) { if (RemoveInvalidCharacters(key.Key.ToUpper()).Equals(RemoveInvalidCharacters(text + identifier.ToUpper()))) { return ((BaseUnityPlugin)Instance).Config[key].BoxedValue.ToString().ToUpper().Equals("TRUE"); } } return false; } return false; } public static bool Can(string identifier) { foreach (ConfigDefinition key in ((BaseUnityPlugin)Instance).Config.Keys) { if (RemoveInvalidCharacters(key.Key.ToUpper()).Equals(RemoveInvalidCharacters(identifier.ToUpper()))) { return ((BaseUnityPlugin)Instance).Config[key].BoxedValue.ToString().ToUpper().Equals("TRUE"); } } return false; } public static string RemoveWhitespaces(string source) { return string.Join("", source.Split((string[]?)null, StringSplitOptions.RemoveEmptyEntries)); } public static string RemoveSpecialCharacters(string source) { StringBuilder stringBuilder = new StringBuilder(); foreach (char c in source) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } public static string RemoveInvalidCharacters(string source) { return RemoveWhitespaces(RemoveSpecialCharacters(source)); } public static Type FindType(string fullName) { try { if ((from a in AppDomain.CurrentDomain.GetAssemblies() where !a.IsDynamic select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName)) != null) { return (from a in AppDomain.CurrentDomain.GetAssemblies() where !a.IsDynamic select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName)); } } catch { return null; } return null; } public static void CreateHarmonyPatch(Harmony harmony, Type typeToPatch, string methodToPatch, Type[] parameters, Type patchType, string patchMethod, bool isPrefix, bool isTranspiler = false) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown if (typeToPatch == null || patchType == null) { logger.LogInfo((object)"Type is either incorrect or does not exist!"); return; } MethodInfo methodInfo = AccessTools.Method(typeToPatch, methodToPatch, parameters, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(patchType, patchMethod, (Type[])null, (Type[])null); if (isTranspiler) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null); } else if (isPrefix) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } public static bool IsAgentOnNavMesh(GameObject agentObject) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector3 position = agentObject.transform.position; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, onMeshThreshold, -1) && Mathf.Approximately(position.x, ((NavMeshHit)(ref val)).position.x) && Mathf.Approximately(position.z, ((NavMeshHit)(ref val)).position.z)) { return position.y >= ((NavMeshHit)(ref val)).position.y; } return false; } public static bool AttackTargets(Vector3 aimPoint, Vector3 forward, float range) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return HitTargets(GetTargets(aimPoint, forward, range), forward); } public static List<GameObject> GetTargets(Vector3 aimPoint, Vector3 forward, float range) { //IL_0009: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); Ray val = default(Ray); ((Ray)(ref val))..ctor(aimPoint, forward); RaycastHit[] array = Physics.RaycastAll(val, range, -5, (QueryTriggerInteraction)2); Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); Vector3 val2 = aimPoint + forward * range; IHittable val3 = default(IHittable); EnemyAI val6 = default(EnemyAI); for (int i = 0; i < array.Length; i++) { GameObject gameObject = ((Component)((RaycastHit)(ref array[i])).transform).gameObject; Transform transform = ((RaycastHit)(ref array[i])).transform; if (((Component)transform).TryGetComponent<IHittable>(ref val3)) { EnemyAI val4 = null; EnemyAICollisionDetect val5 = (EnemyAICollisionDetect)(object)((val3 is EnemyAICollisionDetect) ? val3 : null); if (val5 != null) { val4 = val5.mainScript; } if ((Object)(object)val4 != (Object)null && !val4.isEnemyDead && val4.enemyHP > 0) { list.Add(((Component)transform).gameObject); } val2 = ((RaycastHit)(ref array[i])).point; } else { if (((Component)transform).TryGetComponent<EnemyAI>(ref val6) && !val6.isEnemyDead && val6.enemyHP > 0) { list.Add(((Component)val6).gameObject); val2 = ((RaycastHit)(ref array[i])).point; } val2 = ((RaycastHit)(ref array[i])).point; } } return list; } public static bool HitTargets(List<GameObject> targets, Vector3 forward) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) bool hits = false; if (!targets.Any()) { return hits; } targets.ForEach(delegate(GameObject t) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)t != (Object)null) { if ((Object)(object)t.GetComponent<EnemyAI>() != (Object)null) { EnemyAI component = t.GetComponent<EnemyAI>(); int num = 1; if (CanMob("TurretDamageAllMobs", ".Turret Damage", component.enemyType.enemyName)) { if (component is NutcrackerEnemyAI) { if (((EnemyAI)(NutcrackerEnemyAI)component).currentBehaviourStateIndex > 0) { component.HitEnemyOnLocalClient(num, default(Vector3), (PlayerControllerB)null, false, -1); hits = true; } } else { component.HitEnemyOnLocalClient(num, default(Vector3), (PlayerControllerB)null, false, -1); hits = true; } } } else if (t.GetComponent<IHittable>() != null) { IHittable component2 = t.GetComponent<IHittable>(); if (component2 is EnemyAICollisionDetect) { EnemyAICollisionDetect val = (EnemyAICollisionDetect)component2; int num2 = 1; if (CanMob("TurretDamageAllMobs", ".Turret Damage", val.mainScript.enemyType.enemyName)) { if (val.mainScript is NutcrackerEnemyAI) { if (((EnemyAI)(NutcrackerEnemyAI)val.mainScript).currentBehaviourStateIndex > 0) { val.mainScript.HitEnemyOnLocalClient(num2, default(Vector3), (PlayerControllerB)null, false, -1); hits = true; } } else { val.mainScript.HitEnemyOnLocalClient(num2, default(Vector3), (PlayerControllerB)null, false, -1); hits = true; } } } else if (!(component2 is PlayerControllerB)) { component2.Hit(1, forward, (PlayerControllerB)null, true, -1); hits = true; } } } }); return hits; } } } namespace FairAI.Patches { public static class BoombaPatch { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchStart(ref RoombaAI __instance) { ((Component)__instance).gameObject.AddComponent<BoombaTimer>(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchDoAIInterval(ref RoombaAI __instance) { //IL_0008: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.AllowFairness(((Component)__instance).transform.position) || !Plugin.IsAgentOnNavMesh(((Component)__instance).gameObject) || (((EnemyAI)__instance).currentSearch == null && !((EnemyAI)__instance).movingTowardsTargetPlayer) || (!__instance.mineAudio.isPlaying && !__instance.mineFarAudio.isPlaying) || !((Component)__instance).GetComponent<BoombaTimer>().IsActiveBomb()) { return; } Vector3 val = ((Component)__instance).transform.position + Vector3.up; Collider[] array = Physics.OverlapSphere(val, 6f, 2621448, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { float num = Vector3.Distance(val, ((Component)array[i]).transform.position); if ((num > 4f && Physics.Linecast(val, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) || !((Object)(object)((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>() != (Object)null)) { continue; } EnemyAICollisionDetect component = ((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>(); if (!((Object)(object)((Component)component.mainScript).gameObject != (Object)(object)((Component)__instance).gameObject) || !Plugin.CanMob("BoombaAllMobs", ".Boomba", component.mainScript.enemyType.enemyName)) { continue; } if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component.mainScript).IsOwner && !component.mainScript.isEnemyDead) { Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, val, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); if (num < 3f) { component.mainScript.KillEnemyOnOwnerClient(true); } else if (num < 6f) { component.mainScript.HitEnemyOnLocalClient(2, default(Vector3), (PlayerControllerB)null, false, -1); } } if (((NetworkBehaviour)__instance).IsServer) { ((EnemyAI)__instance).KillEnemy(true); } else { ((EnemyAI)__instance).KillEnemyServerRpc(true); } } } } internal class EnemyAIPatch { } internal class MineAIPatch { public static void PatchOnTriggerEnter(ref Landmine __instance, Collider other, ref float ___pressMineDebounceTimer) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Plugin.AllowFairness(((Component)__instance).transform.position)) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && Plugin.CanMob("ExplodeAllMobs", ".Mine", component.mainScript.enemyType.enemyName.ToUpper())) { ___pressMineDebounceTimer = 0.5f; __instance.PressMineServerRpc(); } } } public static void PatchOnTriggerExit(ref Landmine __instance, Collider other, ref bool ___sendingExplosionRPC) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Plugin.AllowFairness(((Component)__instance).transform.position)) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && Plugin.CanMob("ExplodeAllMobs", ".Mine", component.mainScript.enemyType.enemyName.ToUpper()) && !__instance.hasExploded) { __instance.SetOffMineAnimation(); ___sendingExplosionRPC = true; __instance.ExplodeMineServerRpc(); } } } public static void DetonatePatch(ref Landmine __instance) { if (!((Object)(object)__instance == (Object)null)) { ((MonoBehaviour)__instance).StartCoroutine(WaitForUpdate(1.5f, __instance)); } } public static IEnumerator WaitForUpdate(float waitTime, Landmine mine) { yield return (object)new WaitForSeconds(waitTime); if (!((Object)(object)mine == (Object)null)) { if ((Object)(object)((Component)mine).GetComponent<NetworkObject>() != (Object)null) { ((Component)mine).GetComponent<NetworkObject>().Despawn(true); } else { Object.Destroy((Object)(object)((Component)mine).gameObject); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchSpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f, int nonLethalDamage = 50, float physicsForce = 0f, GameObject overridePrefab = null, bool goThroughCar = false) { //IL_0004: 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_0027: 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_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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) bool flag = true; Collider[] array = Physics.OverlapSphere(explosionPosition, 6f, 2621448, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { float num = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (Plugin.surfacedEnabled && Plugin.surfacedAssembly != null) { Type type = Plugin.surfacedAssembly.GetType("Seamine"); if (type != null && (Object)(object)((Component)array[i]).gameObject.GetComponent(type) != (Object)null) { Component component = ((Component)array[i]).gameObject.GetComponent(type); FieldInfo field = type.GetField("mineActivated", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = type.GetField("hasExploded", BindingFlags.Instance | BindingFlags.Public); if (!(bool)field2.GetValue(component) || !(bool)field.GetValue(component)) { break; } if (Plugin.AllowFairness(component.transform.position)) { MethodInfo method = type.GetMethod("TriggerMineOnLocalClientByExiting", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(component, new object[0]); } } } if (!((Object)(object)((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>() != (Object)null)) { continue; } EnemyAICollisionDetect component2 = ((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component2 != (Object)null && ((NetworkBehaviour)component2.mainScript).IsOwner && !component2.mainScript.isEnemyDead) { if (num < killRange) { component2.mainScript.HitEnemyOnLocalClient(component2.mainScript.enemyHP, default(Vector3), (PlayerControllerB)null, false, -1); } else if (num < damageRange) { component2.mainScript.HitEnemyOnLocalClient(Mathf.RoundToInt((float)(component2.mainScript.enemyHP / 2)), default(Vector3), (PlayerControllerB)null, false, -1); } } } } } internal class RoundManagerPatch { public static void PatchStart(ref RoundManager __instance) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown Plugin.enemies = (from EnemyType e in Resources.FindObjectsOfTypeAll(typeof(EnemyType)) where (Object)(object)e != (Object)null select e).ToList(); Plugin.items = (from Item i in Resources.FindObjectsOfTypeAll(typeof(Item)) where (Object)(object)i != (Object)null select i).ToList(); Plugin.allHittablesMask = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x280008 | Plugin.enemyMask; if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "ExplodeAllMobs"))) { ConfigEntry<bool> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "ExplodeAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Mines."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "BoombaAllMobs"))) { ConfigEntry<bool> val2 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "BoombaAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Boombas."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretTargetAllMobs"))) { ConfigEntry<bool> val3 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretTargetAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Targeted By Turrets."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretDamageAllMobs"))) { ConfigEntry<bool> val4 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretDamageAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Killed By Turrets."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "CheckForPlayersInside"))) { ConfigEntry<bool> val5 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "CheckForPlayersInside", false, "Whether to check for players inside the dungeon before anything else occurs."); } foreach (EnemyType enemy in Plugin.enemies) { string text = Plugin.RemoveInvalidCharacters(enemy.enemyName); if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Mine"))) { ConfigEntry<bool> val6 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Mine", true, "Does it set off the landmine or not?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Boomba"))) { ConfigEntry<bool> val7 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Boomba", true, "Does it set off the boomba or not?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Target"))) { ConfigEntry<bool> val8 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Target", true, "Is it targetable by turrets?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Damage"))) { ConfigEntry<bool> val9 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Damage", true, "Is it damageable by turrets?"); } } } } internal class StartOfRoundPatch { public static void PatchStart(ref StartOfRound __instance) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown Plugin.enemies = (from EnemyType e in Resources.FindObjectsOfTypeAll(typeof(EnemyType)) where (Object)(object)e != (Object)null select e).ToList(); Plugin.items = (from Item i in Resources.FindObjectsOfTypeAll(typeof(Item)) where (Object)(object)i != (Object)null select i).ToList(); Plugin.allHittablesMask = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x280008 | Plugin.enemyMask; if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "ExplodeAllMobs"))) { ConfigEntry<bool> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "ExplodeAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Mines."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "BoombaAllMobs"))) { ConfigEntry<bool> val2 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "BoombaAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Boombas."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretTargetAllMobs"))) { ConfigEntry<bool> val3 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretTargetAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Targeted By Turrets."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretDamageAllMobs"))) { ConfigEntry<bool> val4 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretDamageAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Killed By Turrets."); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "CheckForPlayersInside"))) { ConfigEntry<bool> val5 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "CheckForPlayersInside", false, "Whether to check for players inside the dungeon before anything else occurs."); } foreach (EnemyType enemy in Plugin.enemies) { string text = Plugin.RemoveInvalidCharacters(enemy.enemyName); if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Mine"))) { ConfigEntry<bool> val6 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Mine", true, "Does it set off the landmine or not?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Boomba"))) { ConfigEntry<bool> val7 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Boomba", true, "Does it set off the boomba or not?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Target"))) { ConfigEntry<bool> val8 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Target", true, "Is it targetable by turrets?"); } if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Damage"))) { ConfigEntry<bool> val9 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Damage", true, "Is it damageable by turrets?"); } } } public static void PatchUpdate(ref StartOfRound __instance) { if (Plugin.Can("CheckForPlayersInside")) { if (__instance.shipIsLeaving) { Plugin.playersEnteredInside = false; } else { Plugin.playersEnteredInside = Plugin.IsAPlayerInsideDungeon(); } } } } public static class SurfacedMinePatch { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("Surfaced"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchOnTriggerEnter(ref Seamine __instance, Collider other) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) Type typeFromHandle = typeof(Seamine); FieldInfo field = typeFromHandle.GetField("mineActivated", BindingFlags.Instance | BindingFlags.NonPublic); if (!__instance.hasExploded && (bool)field.GetValue(__instance) && Plugin.AllowFairness(((Component)__instance).transform.position)) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && Plugin.CanMob("ExplodeAllMobs", ".Mine", component.mainScript.enemyType.enemyName.ToUpper())) { MethodInfo method = typeFromHandle.GetMethod("TriggerMineOnLocalClientByExiting", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(__instance, new object[0]); } } } } internal class TurretAIPatch { public static float viewRadius = 16f; public static float viewAngle = 90f; public static void PatchUpdate(ref Turret __instance) { //IL_001b: 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_00a9: 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_00ad: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected I4, but got Unknown //IL_0166: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01a6: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !Plugin.AllowFairness(((Component)__instance).transform.position)) { return; } FAIR_AI fAIR_AI = ((Component)__instance).gameObject.GetComponent<FAIR_AI>(); if ((Object)(object)fAIR_AI == (Object)null) { fAIR_AI = ((Component)__instance).gameObject.AddComponent<FAIR_AI>(); } Type typeFromHandle = typeof(Turret); FieldInfo field = typeFromHandle.GetField("wasTargetingPlayerLastFrame", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = typeFromHandle.GetField("hasLineOfSight", BindingFlags.Instance | BindingFlags.NonPublic); if ((Object)(object)fAIR_AI == (Object)null) { return; } FieldInfo field3 = typeFromHandle.GetField("turretInterval", BindingFlags.Instance | BindingFlags.NonPublic); TurretMode turretMode = __instance.turretMode; TurretMode val = turretMode; switch (val - 1) { case 0: if ((float)field3.GetValue(__instance) >= 1.5f) { Debug.Log((object)"Charging timer is up, setting to firing mode"); if (!(bool)field2.GetValue(__instance)) { Debug.Log((object)"hasLineOfSight is false"); fAIR_AI.targetWithRotation = null; fAIR_AI.RemoveTargetedEnemyClientRpc(); } else { __instance.turretMode = (TurretMode)2; __instance.SetToModeClientRpc(2); } } break; case 1: if ((float)field3.GetValue(__instance) >= 0.21f) { Vector3 forward2 = __instance.aimPoint.forward; forward2 = Quaternion.Euler(0f, (float)(int)(0f - __instance.rotationRange) / 3f, 0f) * forward2; Plugin.AttackTargets(__instance.centerPoint.position, forward2, 30f); } break; case 2: if ((float)field3.GetValue(__instance) >= 0.21f) { Vector3 forward = __instance.aimPoint.forward; forward = Quaternion.Euler(0f, (float)(int)(0f - __instance.rotationRange) / 3f, 0f) * forward; Plugin.AttackTargets(__instance.centerPoint.position, forward, 30f); } break; } } public static void PatchSetTargetToPlayerBody(ref Turret __instance) { if ((Object)(object)__instance == (Object)null) { return; } Type typeFromHandle = typeof(Turret); FieldInfo field = typeFromHandle.GetField("targetingDeadPlayer", BindingFlags.Instance | BindingFlags.NonPublic); FAIR_AI component = ((Component)__instance).gameObject.GetComponent<FAIR_AI>(); if ((Object)(object)component.targetWithRotation != (Object)null) { if (!(bool)field.GetValue(__instance)) { field.SetValue(__instance, true); } if (!((Component)component.targetWithRotation).GetComponent<EnemyAI>().isEnemyDead) { field.SetValue(__instance, false); __instance.targetTransform = ((Component)component.targetWithRotation).transform; } } } public static void PatchTurnTowardsTargetIfHasLOS(ref Turret __instance) { TurnTowardsTargetEnemyIfHasLOS(__instance); } public static bool TurnTowardsTargetEnemyIfHasLOS(Turret turret) { //IL_0050: 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_006b: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) bool flag = true; Type typeFromHandle = typeof(Turret); FieldInfo field = typeFromHandle.GetField("targetingDeadPlayer", BindingFlags.Instance | BindingFlags.NonPublic); object value = field.GetValue(turret); FieldInfo field2 = typeFromHandle.GetField("hasLineOfSight", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field3 = typeFromHandle.GetField("lostLOSTimer", BindingFlags.Instance | BindingFlags.NonPublic); if ((bool)value || Vector3.Angle(turret.targetTransform.position - turret.centerPoint.position, turret.forwardFacingPos.forward) > turret.rotationRange) { flag = false; } if (Physics.Linecast(turret.aimPoint.position, turret.targetTransform.position, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { flag = false; } List<EnemyAICollisionDetect> actualTargets = GetActualTargets(turret); if (flag && actualTargets != null && actualTargets.Any()) { field2.SetValue(turret, true); field3.SetValue(turret, 0f); if ((Object)(object)((Component)turret).GetComponent<FAIR_AI>() != (Object)null) { FAIR_AI component = ((Component)turret).GetComponent<FAIR_AI>(); if ((Object)(object)component.targetWithRotation == (Object)null) { component.targetWithRotation = actualTargets[0].mainScript; } turret.tempTransform.position = ((Component)component.targetWithRotation).transform.position; Transform tempTransform = turret.tempTransform; tempTransform.position -= Vector3.up * 0.15f; turret.turnTowardsObjectCompass.LookAt(turret.tempTransform); } } if (!flag) { object value2 = field2.GetValue(turret); if ((bool)value2) { field2.SetValue(turret, false); field3.SetValue(turret, 0f); } if (!((NetworkBehaviour)turret).IsServer) { field3.SetValue(turret, (float)field3.GetValue(turret) + Time.deltaTime); FAIR_AI component2 = ((Component)turret).gameObject.GetComponent<FAIR_AI>(); List<EnemyAICollisionDetect> actualTargets2 = GetActualTargets(turret); if (actualTargets2.Any()) { component2.targetWithRotation = actualTargets2[0].mainScript; component2.SwitchedTargetedEnemyClientRpc(turret, actualTargets2[0].mainScript); } else { component2.targetWithRotation = null; component2.RemoveTargetedEnemyClientRpc(); } } } return flag; } public static List<EnemyAICollisionDetect> GetActualTargets(Turret turret) { List<EnemyAICollisionDetect> list = new List<EnemyAICollisionDetect>(); List<EnemyAICollisionDetect> targets = GetTargets(turret); if (targets != null) { targets.RemoveAll((EnemyAICollisionDetect t) => (Object)(object)t == (Object)null); if (targets.Any()) { foreach (EnemyAICollisionDetect item in targets) { if ((Object)(object)item != (Object)null) { list.Add(item); } } } } return list; } private static List<EnemyAICollisionDetect> GetTargets(Turret turret, float radius = 2f, bool angleRangeCheck = false) { List<Transform> list = FindVisibleTargets(turret); List<EnemyAICollisionDetect> en = new List<EnemyAICollisionDetect>(); if (list.Any()) { list.ForEach(delegate(Transform e) { EnemyAICollisionDetect component = ((Component)e).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null) { en.Add(component); } }); } return en; } public static Vector3 DirectionFromAngle(Turret turret, float angleInDegrees, bool angleIsGlobal) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) if (!angleIsGlobal) { angleInDegrees += ((Component)turret).transform.eulerAngles.y; } return new Vector3(Mathf.Sin(angleInDegrees * ((float)Math.PI / 180f)), 0f, Mathf.Cos(angleInDegrees * ((float)Math.PI / 180f))); } public static List<Transform> FindVisibleTargets(Turret turret) { //IL_0007: 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_0050: 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_005a: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) Collider[] array = Physics.OverlapSphere(turret.aimPoint.position, viewRadius, 0x280008 | Plugin.enemyMask | StartOfRound.Instance.playersMask); List<Transform> list = new List<Transform>(); for (int i = 0; i < array.Length; i++) { Transform transform = ((Component)array[i]).transform; Vector3 val = transform.position - turret.aimPoint.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (!(Vector3.Angle(turret.aimPoint.forward, normalized) < viewAngle / 2f)) { continue; } float num = Vector3.Distance(turret.aimPoint.position, transform.position); if (!Physics.Raycast(turret.aimPoint.position, normalized, num, ~(0x280008 | Plugin.enemyMask | StartOfRound.Instance.playersMask))) { if ((Object)(object)((Component)transform).GetComponent<EnemyAICollisionDetect>() != (Object)null) { list.Add(transform); } else if ((Object)(object)((Component)transform).GetComponent<EnemyAI>() != (Object)null) { list.Add(transform); } } } return list; } } } namespace FairAI.Component { internal class BoombaTimer : MonoBehaviour { private bool isActiveBomb = false; private void Start() { ((MonoBehaviour)this).StartCoroutine(StartBombTimer()); Plugin.logger.LogInfo((object)"Boomba has been set active."); } public IEnumerator StartBombTimer() { SetActiveBomb(isActive: false); yield return (object)new WaitForSeconds(3f); SetActiveBomb(isActive: true); } public void SetActiveBomb(bool isActive) { isActiveBomb = isActive; } public bool IsActiveBomb() { return isActiveBomb; } } }
BepInEx/plugins/ZoLoKinoBabo112/Frailty.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Frailty.Manager; using Frailty.Patches; using Frailty.Properties; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Frailty")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Frailty")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fe19d81f-566d-4e7e-aa89-f207acbc7d11")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace Frailty { public class Configuration { public static ConfigEntry<bool> fracturedLeg; public static ConfigEntry<float> fracturedLegTime; public static ConfigEntry<float> fracturedLegChance; public static ConfigEntry<bool> fracturedArm; public static ConfigEntry<float> fracturedArmTime; public static ConfigEntry<float> fracturedArmChance; public static ConfigEntry<bool> brokenLeg; public static ConfigEntry<float> brokenLegTime; public static ConfigEntry<float> brokenLegChance; public static ConfigEntry<bool> brokenArm; public static ConfigEntry<float> brokenArmTime; public static ConfigEntry<float> brokenArmChance; public static ConfigEntry<bool> bleeding; public static ConfigEntry<float> bleedingTime; public static ConfigEntry<float> bleedingChance; public static ConfigEntry<bool> blindness; public static ConfigEntry<float> blindnessTime; public static ConfigEntry<float> blindnessChance; public static ConfigEntry<bool> concussed; public static ConfigEntry<float> concussedTime; public static ConfigEntry<float> concussedChance; public static void Load() { fracturedLeg = Plugin.config.Bind<bool>("Conditions", "Fractured Leg", true, "Can players fracture their legs? (Will also disable broken legs.)"); fracturedLegTime = Plugin.config.Bind<float>("Condition Times", "Fractured Leg Time", 120f, "How long should fractured legs last?"); fracturedLegChance = Plugin.config.Bind<float>("Condition Chances", "Fractured Leg Chance", 0.25f, "Chance of fractured legs to occur. (From 0 to 1.)"); fracturedArm = Plugin.config.Bind<bool>("Conditions", "Fractured Arm", true, "Can players fracture their arms? (Will also disable broken arms."); fracturedArmTime = Plugin.config.Bind<float>("Condition Times", "Fractured Arm Time", 120f, "How long should fractured arms last?"); fracturedArmChance = Plugin.config.Bind<float>("Condition Chances", "Fractured Arm Chance", 0.2f, "Chance of fractured arms to occur. (From 0 to 1.)"); brokenLeg = Plugin.config.Bind<bool>("Conditions", "Broken Leg", true, "Can players break their legs?"); brokenLegTime = Plugin.config.Bind<float>("Condition Times", "Broken Leg Time", 180f, "How long should broken legs last?"); brokenLegChance = Plugin.config.Bind<float>("Condition Chances", "Broken Leg Chance", 0.25f, "Chance of broken legs to occur. (From 0 to 1.)"); brokenArm = Plugin.config.Bind<bool>("Conditions", "Broken Arm", true, "Can players break their arms?"); brokenArmTime = Plugin.config.Bind<float>("Condition Times", "Broken Arm Time", 180f, "How long should broken arms last?"); brokenArmChance = Plugin.config.Bind<float>("Condition Chances", "Broken Arm Chance", 0.2f, "Chance of broken arms to occur. (From 0 to 1.)"); bleeding = Plugin.config.Bind<bool>("Conditions", "Bleeding", true, "Can players bleed?"); bleedingTime = Plugin.config.Bind<float>("Condition Times", "Bleeding Time", 45f, "How long should bleeding last?"); bleedingChance = Plugin.config.Bind<float>("Condition Chances", "Bleeding Chance", 0.25f, "Chance of bleeding to occur. (From 0 to 1.)"); blindness = Plugin.config.Bind<bool>("Conditions", "Blindness", true, "Can players be blinded?"); blindnessTime = Plugin.config.Bind<float>("Condition Times", "Blindness Time", 15f, "How long should blindness last? (in seconds)"); blindnessChance = Plugin.config.Bind<float>("Condition Chances", "Blindness Chance", 0.1f, "Chance of blindness to occur. (From 0 to 1.)"); concussed = Plugin.config.Bind<bool>("Conditions", "Concussed", true, "Can players concussed?"); concussedTime = Plugin.config.Bind<float>("Condition Times", "Concussed Time", 30f, "How long should concussed last? (in seconds)"); concussedChance = Plugin.config.Bind<float>("Condition Chances", "Concussed Chance", 0.1f, "Chance of concussed to occur. (From 0 to 1.)"); } } public class Content { public static AssetBundle MainContent; public static void Load() { Plugin.mls.LogDebug((object)"Loading internal assets..."); MainContent = AssetBundle.LoadFromMemory(Plugin.assetFile); Plugin.mls.LogDebug((object)"Internal assets loaded!"); } } [BepInPlugin("Chaos.Frailty", "Frailty", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Chaos.Frailty"; private const string modName = "Frailty"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Chaos.Frailty"); public static Plugin Instance; public static ManualLogSource mls; public static ConfigFile config; public static byte[] assetFile; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } assetFile = Resources.frailty; mls = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Configuration.Load(); Content.Load(); mls.LogDebug((object)"Patching Frailty..."); harmony.PatchAll(typeof(HUDPatch)); harmony.PatchAll(typeof(PlayerPatch)); harmony.PatchAll(typeof(SteamValveHazardPatch)); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls.LogInfo((object)"Frailty loaded."); } } } namespace Frailty.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("Frailty.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] frailty { get { object @object = ResourceManager.GetObject("frailty", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace Frailty.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDPatch { public static GameObject conditionHud; public static Transform bleedingHud; public static Transform blindnessHud; public static Transform brokenArmHud; public static Transform brokenLegHud; public static Transform concussedHud; public static Transform fracturedArmHud; public static Transform fracturedLegHud; public static Volume concussed; public static Volume blindness; [HarmonyPatch(typeof(HUDManager), "Awake")] [HarmonyPrefix] private static void Awake(HUDManager __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) conditionHud = Object.Instantiate<GameObject>(Content.MainContent.LoadAsset<GameObject>("Assets/custom/Frailty/hud/Conditions.prefab"), new Vector3(15.85f, 23.4f, -5.55f), Quaternion.Euler(0f, -14.141f, 0f), __instance.HUDContainer.transform); RectTransform component = conditionHud.GetComponent<RectTransform>(); component.anchoredPosition3D = new Vector3(15.85f, 23.4f, -5.55f); ((Transform)component).rotation = Quaternion.Euler(0f, -14.141f, 0f); ((Transform)component).localScale = Vector3.one; bleedingHud = conditionHud.transform.Find("Bleeding"); blindnessHud = conditionHud.transform.Find("Blindness"); brokenArmHud = conditionHud.transform.Find("BrokenArm"); brokenLegHud = conditionHud.transform.Find("BrokenLeg"); concussedHud = conditionHud.transform.Find("Concussed"); fracturedArmHud = conditionHud.transform.Find("FracturedArm"); fracturedLegHud = conditionHud.transform.Find("FracturedLeg"); Plugin.mls.LogDebug((object)"The condition hud has been added."); concussed = ((Component)__instance).gameObject.AddComponent<Volume>(); concussed.profile = Content.MainContent.LoadAsset<VolumeProfile>("Assets/custom/Frailty/volumes/concussed.asset"); concussed.isGlobal = true; concussed.weight = 0f; concussed.sharedProfile = Content.MainContent.LoadAsset<VolumeProfile>("Assets/custom/Frailty/volumes/concussed.asset"); blindness = ((Component)__instance).gameObject.AddComponent<Volume>(); blindness.profile = Content.MainContent.LoadAsset<VolumeProfile>("Assets/custom/Frailty/volumes/blind.asset"); blindness.isGlobal = true; blindness.weight = 0f; blindness.sharedProfile = Content.MainContent.LoadAsset<VolumeProfile>("Assets/custom/Frailty/volumes/blind.asset"); Plugin.mls.LogDebug((object)"Frailty volumes added!"); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerPatch { [HarmonyPatch(typeof(PlayerControllerB), "Awake")] [HarmonyPrefix] private static void Awake(PlayerControllerB __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<ConditionManager>())) { ((Component)__instance).gameObject.AddComponent<ConditionManager>(); } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPrefix] private static void DamagePlayer(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3)) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) ConditionManager conditionManager = default(ConditionManager); if (((Component)__instance).gameObject.TryGetComponent<ConditionManager>(ref conditionManager)) { Plugin.mls.LogDebug((object)(__instance.playerUsername + " got damaged! Triggering OnDamage!")); conditionManager.OnDamage(causeOfDeath, damageNumber); } } } [HarmonyPatch(typeof(SteamValveHazard))] internal class SteamValveHazardPatch { [HarmonyPatch(typeof(SteamValveHazard), "Update")] [HarmonyPrefix] private static void Update(SteamValveHazard __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) ConditionManager conditionManager = default(ConditionManager); if (__instance.valveHasBurst && Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance.valveAudio).transform.position) < 9f && ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.TryGetComponent<ConditionManager>(ref conditionManager)) { conditionManager.OnDamage(OtherDamageType.Gaz); } } } } namespace Frailty.Manager { public class ConditionManager : NetworkBehaviour { public List<Condition> conditions = new List<Condition>(); private PlayerControllerB player; private float concussedIntensity = 0f; private float blindnessIntensity = 0f; private void Start() { player = ((Component)this).GetComponent<PlayerControllerB>(); } private void Update() { if (((NetworkBehaviour)this).IsOwner && (Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController) { HUDPatch.concussed.weight = Mathf.Lerp(HUDPatch.concussed.weight, concussedIntensity, 2f * Time.deltaTime); HUDPatch.blindness.weight = Mathf.Lerp(HUDPatch.blindness.weight, blindnessIntensity, 2f * Time.deltaTime); } if (((NetworkBehaviour)this).IsOwner && player.isPlayerControlled) { if ((Object)(object)HUDPatch.concussed == (Object)null || (Object)(object)HUDPatch.blindness == (Object)null) { return; } foreach (Condition item in conditions.ToList()) { float num = item.startTime + item.duration - Time.realtimeSinceStartup; if (num <= 0f) { RemoveConditionServerRpc(item.type); continue; } float num2 = 1f; if (player.drunkness > 0.02f) { num2 *= Mathf.Abs(StartOfRound.Instance.drunknessSpeedEffect.Evaluate(player.drunkness) - 1.25f); } switch (item.type) { case ConditionType.BrokenLeg: if (player.isSprinting) { player.sprintMeter = Mathf.Clamp(player.sprintMeter - Time.deltaTime / (player.sprintTime / 1.5f) * player.carryWeight * num2, 0f, 1f); } else if (player.isMovementHindered > 0) { if (player.isWalking) { player.sprintMeter = Mathf.Clamp(player.sprintMeter - Time.deltaTime / (player.sprintTime / 1.5f) * num2 * 0.5f, 0f, 1f); } } else if (!player.isWalking) { player.sprintMeter = Mathf.Clamp(player.sprintMeter + Time.deltaTime / (player.sprintTime / 1.5f + 4f) * num2, 0f, 1f); } else { player.sprintMeter = Mathf.Clamp(player.sprintMeter + Time.deltaTime / (player.sprintTime / 1.5f + 9f) * num2, 0f, 1f); } break; case ConditionType.BrokenArm: if ((Object)(object)player.currentlyHeldObject != (Object)null) { GrabbableObject currentlyHeldObject2 = player.currentlyHeldObject; Item itemProperties3 = currentlyHeldObject2.itemProperties; float num5 = Mathf.Clamp(itemProperties3.weight - 1f, 0f, 100f) * 105f; if (num5 > 15f && ((NetworkBehaviour)player).IsOwner) { if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem) { return; } ((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard()); } } else { if (!((Object)(object)player.currentlyHeldObjectServer != (Object)null)) { break; } GrabbableObject currentlyHeldObjectServer2 = player.currentlyHeldObjectServer; Item itemProperties4 = currentlyHeldObjectServer2.itemProperties; float num6 = Mathf.Clamp(itemProperties4.weight - 1f, 0f, 100f) * 105f; if (num6 > 15f && ((NetworkBehaviour)player).IsOwner) { if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem) { return; } ((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard()); } } break; case ConditionType.FracturedLeg: if (player.isSprinting) { player.sprintMeter = Mathf.Clamp(player.sprintMeter - Time.deltaTime / (player.sprintTime / 1.2f) * player.carryWeight * num2, 0f, 1f); } else if (player.isMovementHindered > 0) { if (player.isWalking) { player.sprintMeter = Mathf.Clamp(player.sprintMeter - Time.deltaTime / (player.sprintTime / 1.2f) * num2 * 0.5f, 0f, 1f); } } else if (!player.isWalking) { player.sprintMeter = Mathf.Clamp(player.sprintMeter + Time.deltaTime / (player.sprintTime / 1.2f + 4f) * num2, 0f, 1f); } else { player.sprintMeter = Mathf.Clamp(player.sprintMeter + Time.deltaTime / (player.sprintTime / 1.2f + 9f) * num2, 0f, 1f); } break; case ConditionType.FracturedArm: if ((Object)(object)player.currentlyHeldObject != (Object)null) { GrabbableObject currentlyHeldObject = player.currentlyHeldObject; Item itemProperties = currentlyHeldObject.itemProperties; float num3 = Mathf.Clamp(itemProperties.weight - 1f, 0f, 100f) * 105f; if (num3 > 25f && ((NetworkBehaviour)player).IsOwner) { if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem) { return; } ((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard()); } } else { if (!((Object)(object)player.currentlyHeldObjectServer != (Object)null)) { break; } GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; Item itemProperties2 = currentlyHeldObjectServer.itemProperties; float num4 = Mathf.Clamp(itemProperties2.weight - 1f, 0f, 100f) * 105f; if (num4 > 25f && ((NetworkBehaviour)player).IsOwner) { if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem) { return; } ((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard()); } } break; case ConditionType.Bleeding: player.healthRegenerateTimer = 1f; break; case ConditionType.Blindness: blindnessIntensity = 1f; break; case ConditionType.Concussed: concussedIntensity = 1f; break; } } } foreach (Condition item2 in conditions.ToList()) { switch (item2.type) { case ConditionType.BrokenLeg: player.limpMultiplier = 1f; break; case ConditionType.Bleeding: player.bleedingHeavily = true; break; } } if (!HasCondition(ConditionType.Bleeding)) { player.bleedingHeavily = false; } if (conditions.Count > 0 && player.isPlayerDead) { Plugin.mls.LogDebug((object)"PLAYER IS DEAD! REMOVING CONDITIONS!"); if (((NetworkBehaviour)this).IsOwner) { ClearAllConditions(); } } } public void OnDamage(CauseOfDeath damageType, int damage) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 if (!((NetworkBehaviour)this).IsOwner) { return; } if ((int)damageType == 6 || (int)damageType == 7 || (int)damageType == 15 || (int)damageType == 17 || (int)damageType == 14) { if (ShouldApplyCondition(((int)damageType == 7) ? 1f : Configuration.bleedingChance.Value, damage) && Configuration.bleeding.Value) { AddConditionServerRpc(ConditionType.Bleeding, Configuration.bleedingTime.Value); } } else if ((int)damageType == 1 || (int)damageType == 3 || (int)damageType == 12 || (int)damageType == 16) { if (ShouldApplyCondition(Configuration.concussedChance.Value, damage) && Configuration.concussed.Value) { AddConditionServerRpc(ConditionType.Concussed, Configuration.concussedTime.Value); } if (!ShouldApplyCondition(HasCondition(ConditionType.FracturedArm) ? Configuration.brokenArmChance.Value : Configuration.fracturedArmChance.Value, damage)) { return; } if (!HasCondition(ConditionType.FracturedArm) && !HasCondition(ConditionType.BrokenArm)) { if (Configuration.fracturedArm.Value) { AddConditionServerRpc(ConditionType.FracturedArm, Configuration.fracturedArmTime.Value); } return; } if (HasCondition(ConditionType.FracturedArm)) { RemoveConditionServerRpc(ConditionType.FracturedArm); } if (Configuration.brokenArm.Value) { AddConditionServerRpc(ConditionType.BrokenArm, Configuration.brokenArmTime.Value); } } else if ((int)damageType == 2) { if (!ShouldApplyCondition(HasCondition(ConditionType.FracturedLeg) ? Configuration.brokenLegChance.Value : Configuration.fracturedLegChance.Value, damage)) { return; } if (!HasCondition(ConditionType.FracturedLeg) && !HasCondition(ConditionType.BrokenLeg)) { if (Configuration.fracturedLeg.Value) { AddConditionServerRpc(ConditionType.FracturedLeg, Configuration.fracturedLegTime.Value); } return; } RemoveConditionServerRpc(ConditionType.FracturedLeg); if (Configuration.brokenLeg.Value) { AddConditionServerRpc(ConditionType.BrokenLeg, Configuration.brokenLegTime.Value); } } else { Plugin.mls.LogWarning((object)("Damage type isn't supported yet: " + ((object)(CauseOfDeath)(ref damageType)).ToString())); } } public void OnDamage(OtherDamageType damageType) { if (((NetworkBehaviour)this).IsOwner && damageType == OtherDamageType.Gaz && ShouldApplyCondition(Configuration.blindnessChance.Value, 0) && Configuration.blindness.Value) { AddConditionServerRpc(ConditionType.Blindness, Configuration.blindnessTime.Value); } } public void OnDeath() { if (((NetworkBehaviour)this).IsOwner) { ClearAllConditions(); } } private void ClearAllConditions() { Plugin.mls.LogDebug((object)("Removing all conditions of " + player.playerUsername + ".")); foreach (Condition item in conditions.ToList()) { RemoveConditionServerRpc(item.type); } } private float CalculateConditionProbability(int damage) { return (player.health == 0) ? 1f : Mathf.Clamp01((float)((1 + (1 - player.health / 100)) / 2 + damage / player.health / 2)); } private bool ShouldApplyCondition(float chance, int damage) { return Random.value * CalculateConditionProbability(damage) <= chance; } [ServerRpc] public void AddConditionServerRpc(ConditionType type, float duration) { AddConditionClientRpc(type, duration); } [ClientRpc] public void AddConditionClientRpc(ConditionType type, float duration) { if (player.isPlayerDead) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (HasCondition(type)) { conditions.Where((Condition x) => x.type == type).ToArray()[0].duration = duration; conditions.Where((Condition x) => x.type == type).ToArray()[0].startTime = realtimeSinceStartup; } else { conditions.Add(new Condition { startTime = realtimeSinceStartup, duration = duration, type = type }); } if (((NetworkBehaviour)this).IsOwner) { ShowConditionHUD(type); } Plugin.mls.LogDebug((object)("Player '" + player.playerUsername + "' received the condition: " + type.ToString() + ".")); } private void ShowConditionHUD(ConditionType type) { switch (type) { case ConditionType.BrokenLeg: HUDPatch.brokenLegHud.SetAsFirstSibling(); ((Component)HUDPatch.brokenLegHud).gameObject.SetActive(true); ((Component)HUDPatch.brokenLegHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.BrokenArm: HUDPatch.brokenArmHud.SetAsFirstSibling(); ((Component)HUDPatch.brokenArmHud).gameObject.SetActive(true); ((Component)HUDPatch.brokenArmHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.FracturedLeg: HUDPatch.fracturedLegHud.SetAsFirstSibling(); ((Component)HUDPatch.fracturedLegHud).gameObject.SetActive(true); ((Component)HUDPatch.fracturedLegHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.FracturedArm: HUDPatch.fracturedArmHud.SetAsFirstSibling(); ((Component)HUDPatch.fracturedArmHud).gameObject.SetActive(true); ((Component)HUDPatch.fracturedArmHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.Bleeding: HUDPatch.bleedingHud.SetAsFirstSibling(); ((Component)HUDPatch.bleedingHud).gameObject.SetActive(true); ((Component)HUDPatch.bleedingHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.Blindness: HUDPatch.blindnessHud.SetAsFirstSibling(); ((Component)HUDPatch.blindnessHud).gameObject.SetActive(true); ((Component)HUDPatch.blindnessHud).GetComponent<Animator>().SetBool("Visible", true); break; case ConditionType.Concussed: HUDPatch.concussedHud.SetAsFirstSibling(); ((Component)HUDPatch.concussedHud).gameObject.SetActive(true); ((Component)HUDPatch.concussedHud).GetComponent<Animator>().SetBool("Visible", true); break; } } private void HideConditionHUD(ConditionType type) { switch (type) { case ConditionType.BrokenLeg: ((Component)HUDPatch.brokenLegHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.brokenLegHud).GetComponent<Animator>())); break; case ConditionType.BrokenArm: ((Component)HUDPatch.brokenArmHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.brokenArmHud).GetComponent<Animator>())); break; case ConditionType.FracturedLeg: ((Component)HUDPatch.fracturedLegHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.fracturedLegHud).GetComponent<Animator>())); break; case ConditionType.FracturedArm: ((Component)HUDPatch.fracturedArmHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.fracturedArmHud).GetComponent<Animator>())); break; case ConditionType.Bleeding: ((Component)HUDPatch.bleedingHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.bleedingHud).GetComponent<Animator>())); break; case ConditionType.Blindness: ((Component)HUDPatch.blindnessHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.blindnessHud).GetComponent<Animator>())); break; case ConditionType.Concussed: ((Component)HUDPatch.concussedHud).GetComponent<Animator>().SetBool("Visible", false); ((MonoBehaviour)this).StartCoroutine(WaitFade(((Component)HUDPatch.concussedHud).GetComponent<Animator>())); break; } } [ServerRpc] public void RemoveConditionServerRpc(ConditionType type) { RemoveConditionClientRpc(type); } [ClientRpc] public void RemoveConditionClientRpc(ConditionType type) { if (!HasCondition(type)) { return; } conditions.Remove(conditions.Where((Condition x) => x.type == type).ToArray()[0]); if (((NetworkBehaviour)this).IsOwner) { HideConditionHUD(type); switch (type) { case ConditionType.Blindness: blindnessIntensity = 0f; break; case ConditionType.Concussed: concussedIntensity = 0f; break; } } Plugin.mls.LogDebug((object)("Player '" + player.playerUsername + "' lost the condition: " + type.ToString() + ".")); } private bool HasCondition(ConditionType type) { return conditions.Any((Condition x) => x.type == type); } public IEnumerator WaitFade(Animator anim) { yield return (object)new WaitUntil((Func<bool>)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = anim.GetCurrentAnimatorStateInfo(1); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f; }); ((Component)anim).gameObject.SetActive(false); } } public class Condition { public float startTime; public float duration; public ConditionType type; } public enum ConditionType { BrokenLeg, BrokenArm, FracturedLeg, FracturedArm, Bleeding, Blindness, Concussed } public enum OtherDamageType { Gaz } }
BepInEx/plugins/ZoLoKinoBabo112/Full Darkness.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DiversityLib; using Full Darkness.NetcodePatcher; using Full_Darkness.Manager; using Full_Darkness.Patches; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Full Darkness")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Full Darkness")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1327764d-af71-48a4-ba41-6cbf7eed6d59")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Full_Darkness { public class Configuration { public static ConfigEntry<float> fullDarknessIntensity; public static void Load() { fullDarknessIntensity = Plugin.config.Bind<float>("Full Darkness", "Full Darkness Intensity", 1f, "How intense should full darkness be?"); } } [BepInPlugin("Chaos.FullDarkness", "Full Darkness", "1.0.1")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Chaos.FullDarkness"; private const string modName = "Full Darkness"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("Chaos.FullDarkness"); public static Plugin Instance; public static ManualLogSource mls; public static ConfigFile config; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Configuration.Load(); mls.LogDebug((object)"Patching full darkness..."); harmony.PatchAll(typeof(FullDarknessPatch)); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls.LogInfo((object)"Full Darkness loaded."); } } } namespace Full_Darkness.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class FullDarknessPatch { [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] private static void Awake(StartOfRound __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<FullDarknessManager>())) { ((Component)__instance).gameObject.AddComponent<FullDarknessManager>(); } } } } namespace Full_Darkness.Manager { public class FullDarknessManager : NetworkBehaviour { public float intensityValue = 0f; public float nightVisionValue = 0f; public bool setup = false; public static FullDarknessManager Instance { get; private set; } private void Awake() { Instance = this; } private void Start() { //IL_0044: 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) if (((NetworkBehaviour)this).IsOwner) { Plugin.mls.LogDebug((object)"I am the Host! Setting up full darkness locally..."); SetupFullDarkness(Configuration.fullDarknessIntensity.Value); } else { Plugin.mls.LogDebug((object)"I am not the Host! Requesting host's config..."); RequestDataServerRpc(); } } private void Update() { if (!setup) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (nightVisionValue * DiversityLib.OneMinus(intensityValue) != val.nightVision.intensity) { val.nightVision.intensity = nightVisionValue * DiversityLib.OneMinus(intensityValue); } } } [ServerRpc(RequireOwnership = false)] public void RequestDataServerRpc(ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1194691710u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1194691710u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; ClientRpcParams val2 = default(ClientRpcParams); val2.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { senderClientId } }; ClientRpcParams clientRpcParams = val2; Plugin.mls.LogDebug((object)("Client: " + senderClientId + " is requesting config data...")); RequestDataClientRpc(Configuration.fullDarknessIntensity.Value, clientRpcParams); } } } [ClientRpc] public void RequestDataClientRpc(float _intensityValue, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2393552199u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref _intensityValue, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2393552199u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner && !setup) { SetupFullDarkness(_intensityValue); } } } public void SetupFullDarkness(float _intensityValue) { Plugin.mls.LogDebug((object)"Setting up full darkness..."); intensityValue = _intensityValue; PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); Plugin.mls.LogDebug((object)("Setting full darkness for the local player to " + intensityValue * 100f + "%.")); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val in array2) { nightVisionValue = val.nightVision.intensity; Light nightVision = val.nightVision; nightVision.intensity *= DiversityLib.OneMinus(intensityValue); } setup = true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_FullDarknessManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1194691710u, new RpcReceiveHandler(__rpc_handler_1194691710)); NetworkManager.__rpc_func_table.Add(2393552199u, new RpcReceiveHandler(__rpc_handler_2393552199)); } private static void __rpc_handler_1194691710(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((FullDarknessManager)(object)target).RequestDataServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2393552199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((FullDarknessManager)(object)target).RequestDataClientRpc(num, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "FullDarknessManager"; } } } namespace Full Darkness.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/ZoLoKinoBabo112/HidePlayerNames.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HidePlayerNames")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HidePlayerNames")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2b33fbb6-cfd0-478e-a9c4-8fadf0990b33")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HidePlayerNames { [BepInPlugin("Miodec.HidePlayerNames", "Hide Player Names", "1.0.1")] public class HidePlayerNames : BaseUnityPlugin { private const string modGUID = "Miodec.HidePlayerNames"; private const string modName = "Hide Player Names"; private const string modVersion = "1.0.1"; private static HidePlayerNames Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Miodec.HidePlayerNames"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } } namespace HidePlayerNames.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("ShowNameBillboard")] [HarmonyPrefix] public static bool ShowNameBillBoard() { return false; } } }
BepInEx/plugins/ZoLoKinoBabo112/LCBetterEXP.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCBetterEXP.patches; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCBetterEXP")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCBetterEXP")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3d1909e4-ce70-48f2-a2d1-28b67cea8eee")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCBetterEXP { internal class JobTrackingManager { public class JobLog { public int scrapCollected = 0; public int totalAvailableScrap = 0; public string scrapGrade = "F"; public string moon = "?? Unknown"; public string weather = "Clear"; public int levelInteriorType = 0; public float dayLengthInSeconds = 0f; public int jobPlayedTime = 0; public VisualEXPPatch.BetterEXPLog betterExpGained; public JobLogPlayer[] players; public void CalculateScrapGrade() { float num = (float)scrapCollected / (float)totalAvailableScrap; if (num >= 1f) { scrapGrade = "S"; } else if (num >= 0.6f) { scrapGrade = "A"; } else if (num >= 0.3f) { scrapGrade = "B"; } else if (num >= 0.1f) { scrapGrade = "C"; } else { scrapGrade = "D"; } } } public class JobLogPlayer { public JobLogPlayerStats statistics; public string[] playerNotes; public string playerName = "????????"; public bool disconnected = false; public JobLogPlayerDeathInformation deathInformation = null; public ulong steamID = 0uL; public bool isLocalPlayer = false; } public class JobLogPlayerDeathInformation { public string formattedCauseOfDeath; public CauseOfDeath causeOfDeath; public string formattedDayTimeOfDeath; public float normalizedTimeOfDeath; public float realLifeTimeOfDeathInSeconds; } public class JobLogPlayerStats { public int damageTaken = 0; public int stepsTaken = 0; public int scrapDelivered = 0; public int objectsDelivered = 0; public int turns = 0; public float indoorTime = 0f; public float outdoorTime = 0f; public float shipTime = 0f; public int jumps = 0; public int scrapFound = 0; public int scrapFoundDeliveredToShip = 0; public int enemyKills = 0; public JobLogPlayerStats FillFromVanillaStats(PlayerStats stats) { damageTaken = stats.damageTaken; stepsTaken = stats.stepsTaken; scrapDelivered = stats.profitable; turns = stats.turnAmount; return this; } public JobLogPlayerStats FillFromCustomStats(NotesPatch.CustomPlayerStat stats) { indoorTime = stats.indoorTime; outdoorTime = stats.outdoorTime; shipTime = stats.shipTime; jumps = stats.jumps; objectsDelivered = stats.objectsDelivered; scrapFound = stats.scrapFound; scrapFoundDeliveredToShip = stats.scrapFoundDeliveredToShip; return this; } } public static float timeAtStartOfDay; public static float timeAtEndOfDay; public static void LogJobUsingContext(int scrapCollected) { VisualEXPPatch.scrapCollectedOnServer = scrapCollected; if (!BetterEXPPlugin.EnableDayLogging.Value) { return; } JobLog jobLog = new JobLog { scrapCollected = VisualEXPPatch.scrapCollectedOnServer, totalAvailableScrap = (int)RoundManager.Instance.totalScrapValueInLevel, moon = RoundManager.Instance.currentLevel.PlanetName, weather = ((object)(LevelWeatherType)(ref TimeOfDay.Instance.currentLevelWeather)).ToString().Replace("None", "Clear"), levelInteriorType = RoundManager.Instance.currentDungeonType, dayLengthInSeconds = Math.Max(0f, timeAtEndOfDay - timeAtStartOfDay), betterExpGained = VisualEXPPatch.CalculateBXPGain(XPPatch.betterXp, VisualEXPPatch.scrapCollectedOnServer, (int)RoundManager.Instance.totalScrapValueInLevel, GameNetworkManager.Instance.localPlayerController.isPlayerDead, StartOfRound.Instance.allPlayersDead), jobPlayedTime = GetUnixTimestamp(DateTime.UtcNow) }; jobLog.CalculateScrapGrade(); List<JobLogPlayer> list = new List<JobLogPlayer>(); for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if ((Object)(object)val == (Object)null || (!val.isPlayerDead && !val.isPlayerControlled && !val.disconnectedMidGame)) { continue; } JobLogPlayer jobLogPlayer = new JobLogPlayer { disconnected = val.disconnectedMidGame, playerName = val.playerUsername, steamID = val.playerSteamId, isLocalPlayer = ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) }; List<string> list2 = new List<string>(); foreach (StartOfRoundPatch.PlayerNote item in StartOfRoundPatch.notesToAdd) { if (item.id == i) { list2.Add(item.unstyledNote ?? item.note); } } if (val.isPlayerDead && PlayerControllerBPatch.PlayerDeathInformation.ContainsKey(i)) { jobLogPlayer.deathInformation = PlayerControllerBPatch.PlayerDeathInformation[i]; } JobLogPlayerStats jobLogPlayerStats = new JobLogPlayerStats(); jobLogPlayerStats.FillFromVanillaStats(StartOfRound.Instance.gameStats.allPlayerStats[i]); if (NotesPatch.CustomPlayerStats.ContainsKey(i)) { jobLogPlayerStats.FillFromCustomStats(NotesPatch.CustomPlayerStats[i]); } if (EnemyAIPatch.playerEnemyKills.ContainsKey(i)) { jobLogPlayerStats.enemyKills = EnemyAIPatch.playerEnemyKills[i]; } jobLogPlayer.statistics = jobLogPlayerStats; jobLogPlayer.playerNotes = list2.ToArray(); list.Add(jobLogPlayer); } jobLog.players = list.ToArray(); Saving.SaveJobToDisk(jobLog); } public static int GetUnixTimestamp(DateTime time) { return (int)time.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; } } [BepInPlugin("Swaggies.BetterEXP", "BetterEXP", "2.4.0")] public class BetterEXPPlugin : BaseUnityPlugin { public enum CollectedDisplayOptionSettings { [Description("No display")] NONE, [Description("Display below name")] BELOW_NAME, [Description("Display next to name")] BESIDE_NAME } public enum DisplayEnemyKillOptionSettings { [Description("Hide kill notifications")] NONE, [Description("Show notifications for enemies you kill")] FROM_SELF, [Description("Show notifications for enemies any player kills")] FROM_ANY_PLAYER } private const string _GUID = "Swaggies.BetterEXP"; private const string _NAME = "BetterEXP"; private const string _VER = "2.4.0"; private readonly Harmony harmony = new Harmony("Swaggies.BetterEXP"); private static BetterEXPPlugin Instance; public static ManualLogSource logr; public static ConfigEntry<DisplayEnemyKillOptionSettings> showEnemyKillNotifs; public static ConfigEntry<bool> showRoundSummary; public static ConfigEntry<bool> showRankInMenu; public static ConfigEntry<CollectedDisplayOptionSettings> collectedDisplayOption; public static ConfigEntry<bool> EnableDayLogging; public static ConfigEntry<bool> PerformanceReportStyling; public static ConfigEntry<bool> PerformanceReportStats; public static ConfigEntry<bool> NegativeNotes; public static ConfigEntry<bool> MostActiveNote; public static ConfigEntry<bool> LeastProfitableNote; public static ConfigEntry<bool> LethalNote; public static ConfigEntry<bool> JumpingNote; public static ConfigEntry<bool> BraveryNote; public static ConfigEntry<bool> ShipDutyNote; public static ConfigEntry<bool> ScavengerNote; public static bool hasAssignedInitialRank; public static bool hasLoaded; public static bool hasLoadedV2; private void Awake() { //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Expected O, but got Unknown //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Expected O, but got Unknown //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } logr = Logger.CreateLogSource("Swaggies.BetterEXP"); harmony.PatchAll(typeof(HUDManagerPatch)); harmony.PatchAll(typeof(BetterEXPPlugin)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(VisualEXPPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(WeatherPatch)); harmony.PatchAll(typeof(PauseDisplayPatch)); harmony.PatchAll(typeof(NotesPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); logr.LogInfo((object)"BetterEXP up and running."); int num = Saving.Load(); if (num == 1) { hasLoaded = true; } if (num >= 2) { hasLoadedV2 = true; } else { logr.LogInfo((object)"Couldn't load V2 xp."); } showEnemyKillNotifs = ((BaseUnityPlugin)this).Config.Bind<DisplayEnemyKillOptionSettings>("General", "ShowEnemyKillNotifications", DisplayEnemyKillOptionSettings.NONE, "Whether you should receive a notification about your BXP gain when an enemy dies. This may spoil gameplay.\nFROM_SELF: only shows for enemies YOU kill.\nFROM_ANY_PLAYER: shows for enemies any player kills."); showRoundSummary = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowRoundSummary", true, "Whether to show a breakdown of your BXP gains at the end of each day. Doesn't affect gameplay."); showRankInMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowRankInPauseMenu", true, "Whether to show your current BXP rank in the pause menu. Doesn't affect gameplay, but could conflict or overlap with other elements from other mods."); collectedDisplayOption = ((BaseUnityPlugin)this).Config.Bind<CollectedDisplayOptionSettings>("General", "ScrapCollectedDisplayType", CollectedDisplayOptionSettings.BELOW_NAME, new ConfigDescription("Where to show how much scrap a player collected on the Performance Report screen.", (AcceptableValueBase)null, Array.Empty<object>())); EnableDayLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Day Logging", false, "[BETA] Saves each day's performance report, including statistics for each player, into a local JSON file that may be viewed or used later. No data will be collected/uploaded anywhere. Useful for developers who'd want to make something cool involving this."); PerformanceReportStyling = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Performance Report Styling", true, new ConfigDescription("Whether or not to style notes on the Performance Report with colors.", (AcceptableValueBase)null, Array.Empty<object>())); PerformanceReportStats = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Performance Report Stats", true, new ConfigDescription("Whether or not to show the exact statistic for each note. (such as showing \"(1234 steps)\" for the most active employee)", (AcceptableValueBase)null, Array.Empty<object>())); NegativeNotes = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Negative Notes", true, new ConfigDescription("Whether or not to enable negative notes (employees with the LEAST of something), such as Least Profitable or The Laziest.", (AcceptableValueBase)null, Array.Empty<object>())); MostActiveNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Most Active", true, new ConfigDescription("Enables the Most Active note, given to players with the most amount of steps taken.", (AcceptableValueBase)null, Array.Empty<object>())); LeastProfitableNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Least Profitable", true, new ConfigDescription("Enables the Least Profitable note, given to players with the least amount of scrap collected.", (AcceptableValueBase)null, Array.Empty<object>())); LethalNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Lethality", true, new ConfigDescription("Enables the Most Lethal and The Pacifist notes, given to players with the most amount of entity kills and players whom are the only crewmate with zero kills.", (AcceptableValueBase)null, Array.Empty<object>())); JumpingNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Jumpy", false, new ConfigDescription("Enables the Most Jumpy and Most Grounded notes, given to players with the most and least amount of jumps in a day.", (AcceptableValueBase)null, Array.Empty<object>())); BraveryNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Bravery", false, new ConfigDescription("Enables The Bravest and Most Outdoors notes, given to players whom spend the longest inside and outside respectively.", (AcceptableValueBase)null, Array.Empty<object>())); ShipDutyNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: Ship Guy", false, new ConfigDescription("Enables the Ship Guy note, given to the employee who spends the most time in the ship.", (AcceptableValueBase)null, Array.Empty<object>())); ScavengerNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance Report", "Custom Note: The Scavenger", true, new ConfigDescription("Enables the Number 1 Scavenger and Empty-Handed notes, given to the employees who find the most or zero scrap inside the facility respectively.", (AcceptableValueBase)null, Array.Empty<object>())); } public static int AssignInitialRank(int currentPlayerVanillaEXP) { if (hasAssignedInitialRank || hasLoaded) { return XPPatch.betterXp; } if (currentPlayerVanillaEXP >= 0) { XPPatch.betterXp = 0; } if (currentPlayerVanillaEXP >= 25) { XPPatch.betterXp = 25; } if (currentPlayerVanillaEXP >= 75) { XPPatch.betterXp = 50; } if (currentPlayerVanillaEXP >= 175) { XPPatch.betterXp = 100; } if (currentPlayerVanillaEXP >= 500) { XPPatch.betterXp = 200; } if (currentPlayerVanillaEXP >= 1000) { XPPatch.betterXp = 300; } if (currentPlayerVanillaEXP >= 1500) { XPPatch.betterXp = 500; } if (currentPlayerVanillaEXP >= 2000) { XPPatch.betterXp = 700; } if (currentPlayerVanillaEXP >= 2500) { XPPatch.betterXp = 1000; } if (currentPlayerVanillaEXP >= 3000) { XPPatch.betterXp = 1250; } hasAssignedInitialRank = true; hasLoadedV2 = true; XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(XPPatch.betterXp); return XPPatch.betterXp; } public static int AssignVersionTwoInitialRank(int oldBetterXp) { XPPatch.betterXp = (int)Mathf.Clamp((float)Math.Sqrt(Math.Pow(oldBetterXp, 1.5)), 0f, 1000f); hasAssignedInitialRank = true; hasLoadedV2 = true; XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(XPPatch.betterXp); return XPPatch.betterXp; } [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] [HarmonyPrefix] private static void RunChatCommand(HUDManager __instance) { string text = __instance.chatTextField.text; string text2 = text.ToLower(); if (text2.StartsWith("bxp/")) { string[] array = new string[1] { text2 }; if (text2.Contains(" ")) { array = text2.Split(new char[1] { ' ' }); } string command = array[0].Remove(0, 4); int num = ChatCommand.Command(command, array); __instance.chatTextField.text = ""; if (num == 0) { Helpers.DisplayGlobalMessage("<color=#ff0000ff>BetterXP command not found.</color>"); } } } } } namespace LCBetterEXP.patches { internal class ChatCommand { public static int Command(string command, string[] args) { if (command.Contains("level")) { return LevelCommand(); } if (command.Contains("vanilla")) { return VanillaLevelCommand(); } return 0; } private static int LevelCommand() { int betterXp = XPPatch.betterXp; string name = XPPatch.GetPlayerBetterLevel(betterXp).name; Helpers.DisplayGlobalMessage($"Rank: <color=#00ff00ff>{name}</color>.\nBetterXP: <color=#00ff00ff>{betterXp} BXP</color>."); return 1; } private static int VanillaLevelCommand() { int localPlayerXP = HUDManager.Instance.localPlayerXP; Helpers.DisplayGlobalMessage($"Your current vanilla xp is <color=#00ff00ff>{localPlayerXP} EXP</color>."); return 2; } } [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { public class EnemyKillBonus { public int experience = 0; public string name = ""; public EnemyKillBonus(string enemyName, int expGain) { experience = expGain; name = enemyName; } } public class EnemyTarget { public int player; public float lastHitTime; } public static int totalXpFromEnemyKills = 0; public static int highestXpFromEnemyKills = 0; public static Dictionary<int, int> playerEnemyKills = new Dictionary<int, int>(); public static Dictionary<ulong, EnemyTarget> enemyLastHitTargets = new Dictionary<ulong, EnemyTarget>(); public static void ResetAllEnemyKills() { playerEnemyKills.Clear(); enemyLastHitTargets.Clear(); highestXpFromEnemyKills = 0; totalXpFromEnemyKills = 0; } private static EnemyKillBonus GetXpFromEnemy(EnemyAI enemy) { if (enemy is ForestGiantAI) { return new EnemyKillBonus("a Forest Giant", 16); } if (enemy is BushWolfEnemy) { return new EnemyKillBonus("a Kidnapper Fox", 14); } if (enemy is CaveDwellerAI) { return new EnemyKillBonus("a Maneater", 14); } if (enemy is MouthDogAI) { return new EnemyKillBonus("an Eyeless Dog", 12); } if (enemy is BaboonBirdAI) { return new EnemyKillBonus("a Baboon Hawk", 8); } if (enemy is FlowermanAI) { return new EnemyKillBonus("a Bracken", 8); } if (enemy is NutcrackerEnemyAI) { return new EnemyKillBonus("a Nutcracker", 8); } if (enemy is ButlerEnemyAI) { return new EnemyKillBonus("a Butler", 8); } if (enemy is MaskedPlayerEnemy) { return new EnemyKillBonus("a Masked", 6); } if (enemy is CrawlerAI) { return new EnemyKillBonus("a Thumper", 6); } if (enemy is SandSpiderAI) { return new EnemyKillBonus("a Bunker Spider", 6); } if (enemy is HoarderBugAI) { return new EnemyKillBonus("a Hoarding Bug", 4); } if (enemy is CentipedeAI) { return new EnemyKillBonus("a Snare Flea", 4); } if (enemy is DoublewingAI) { return new EnemyKillBonus("a Manticoil", 2); } if (enemy is FlowerSnakeEnemy) { return new EnemyKillBonus("a Tulip Snake", 1); } if (enemy is LassoManAI) { return new EnemyKillBonus("a Lasso", 1); } return new EnemyKillBonus("an Enemy", 3); } [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void DamageEnemyKillCheck(ref EnemyAI __instance, ref PlayerControllerB playerWhoHit) { if (!((Object)(object)playerWhoHit == (Object)null) && __instance.enemyType.canDie) { SetNewEnemyTarget(__instance, (int)playerWhoHit.playerClientId); } } [HarmonyPatch("HitEnemyOnLocalClient")] [HarmonyPrefix] private static void DamageEnemySelfCheck(ref EnemyAI __instance, ref PlayerControllerB playerWhoHit) { if (!((Object)(object)playerWhoHit == (Object)null) && __instance.enemyType.canDie) { SetNewEnemyTarget(__instance, (int)playerWhoHit.playerClientId); } } [HarmonyPatch("HitEnemyServerRpc")] [HarmonyPrefix] private static void DamageEnemyServerCheck(ref EnemyAI __instance, ref int playerWhoHit) { if (playerWhoHit != -1 && __instance.enemyType.canDie) { SetNewEnemyTarget(__instance, playerWhoHit); } } [HarmonyPatch("KillEnemy")] [HarmonyPostfix] private static void KillEnemyPatch(ref EnemyAI __instance) { if (__instance.enemyType.canDie) { EnemyAI enemy = __instance; ((MonoBehaviour)RoundManager.Instance).StartCoroutine(DelayedEnemyKillPatch(enemy)); } } private static IEnumerator DelayedEnemyKillPatch(EnemyAI enemy) { if (enemyLastHitTargets.ContainsKey(((NetworkBehaviour)enemy).NetworkObjectId) && !(Time.realtimeSinceStartup - enemyLastHitTargets[((NetworkBehaviour)enemy).NetworkObjectId].lastHitTime > 5f)) { yield return (object)new WaitForSeconds(0.4f); KillEnemyForXp(enemy, StartOfRound.Instance.allPlayerScripts[enemyLastHitTargets[((NetworkBehaviour)enemy).NetworkObjectId].player]); } } private static void SetNewEnemyTarget(EnemyAI enemy, int target) { if (target >= 0) { ulong networkObjectId = ((NetworkBehaviour)enemy).NetworkObjectId; if (enemyLastHitTargets.ContainsKey(networkObjectId)) { enemyLastHitTargets[networkObjectId] = new EnemyTarget { player = target, lastHitTime = Time.realtimeSinceStartup }; } else { enemyLastHitTargets.Add(networkObjectId, new EnemyTarget { player = target, lastHitTime = Time.realtimeSinceStartup }); } } } private static void KillEnemyForXp(EnemyAI enemy, PlayerControllerB player = null) { if ((Object)(object)player == (Object)null) { return; } string playerUsername = player.playerUsername; int key = (int)player.playerClientId; bool flag = (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController; EnemyKillBonus xpFromEnemy = GetXpFromEnemy(enemy); if (playerEnemyKills.ContainsKey(key)) { playerEnemyKills[key]++; } else { playerEnemyKills.Add(key, 1); } if (!flag) { if (BetterEXPPlugin.showEnemyKillNotifs.Value == BetterEXPPlugin.DisplayEnemyKillOptionSettings.FROM_ANY_PLAYER) { Helpers.DisplayGlobalMessage(playerUsername + " killed " + xpFromEnemy.name + "!"); } return; } int xpFromKilledEnemies = GetXpFromKilledEnemies(); if (xpFromEnemy.experience > highestXpFromEnemyKills) { highestXpFromEnemyKills = xpFromEnemy.experience; } totalXpFromEnemyKills += xpFromEnemy.experience; if (BetterEXPPlugin.showEnemyKillNotifs.Value != 0) { int num = GetXpFromKilledEnemies() - xpFromKilledEnemies; Helpers.DisplayGlobalMessage("You killed " + xpFromEnemy.name + "!" + ((num > 0) ? $"\n<color=#00ff00ff>Got {num} BXP</color>" : "")); } } public static int GetXpFromKilledEnemies() { int num = highestXpFromEnemyKills; int num2 = totalXpFromEnemyKills - highestXpFromEnemyKills; double a = Math.Sqrt(Math.Pow(num2, 1.25) + (double)num2); return num + (int)Math.Ceiling(a); } } internal class Helpers { public static void DisplayGlobalMessage(string msg) { HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); ((TMP_Text)HUDManager.Instance.globalNotificationText).text = msg; HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.globalNotificationSFX); } public static double NumBetween(double value, double min, double max, bool clamp = true) { double num = max - min; double num2 = value - min; if (!clamp) { return num2; } return Mathf.Clamp01((float)(num2 / num)); } public static string FormatTime(int timeInSeconds) { int num = (int)((float)timeInSeconds / 60f); int num2 = timeInSeconds % 60; return $"{num:00}:{num2:00}"; } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void OnHudStart() { if (!BetterEXPPlugin.hasLoadedV2) { if (BetterEXPPlugin.hasLoaded && !BetterEXPPlugin.hasLoadedV2) { int betterXp = XPPatch.betterXp; int num = BetterEXPPlugin.AssignVersionTwoInitialRank(betterXp); BetterEXPPlugin.logr.LogMessage((object)$"V1 XP: {betterXp} -> V2 XP: {num}"); } else if (!BetterEXPPlugin.hasLoadedV2 && !BetterEXPPlugin.hasLoaded) { int localPlayerXP = HUDManager.Instance.localPlayerXP; int num2 = BetterEXPPlugin.AssignInitialRank(localPlayerXP); BetterEXPPlugin.logr.LogMessage((object)$"Vanilla XP: {localPlayerXP} -> BetterXP: {num2}"); } } } } internal class NotesPatch { public class CustomPlayerStat { public int playerID; public float indoorTime = 0f; public float outdoorTime = 0f; public float shipTime = 0f; public int jumps = 0; public int scrapFound = 0; public int scrapFoundDeliveredToShip = 0; public int objectsDelivered = 0; } public class BXPScrap { public int foundBy = -1; public bool deliveredToShip = false; } public static Dictionary<int, CustomPlayerStat> CustomPlayerStats = new Dictionary<int, CustomPlayerStat>(); public static Dictionary<GrabbableObject, BXPScrap> ThisMoonObjects = new Dictionary<GrabbableObject, BXPScrap>(); public static List<GrabbableObject> BlacklistedMoonObjects = new List<GrabbableObject>(); public static void TryCreateCustomPlayerStat(int playerID) { if (!CustomPlayerStats.ContainsKey(playerID)) { CustomPlayerStats.Add(playerID, new CustomPlayerStat { playerID = playerID }); } } [HarmonyPatch(typeof(RoundManager), "SetLevelObjectVariables")] [HarmonyPostfix] private static void ResetNotesAtStartOfGame() { CustomPlayerStats.Clear(); } [HarmonyPatch(typeof(PlayerControllerB), "PlayerJump")] [HarmonyPrefix] private static void PlayerJumpSelf(ref PlayerControllerB __instance) { PlayerJump(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "PlayerJumpedClientRpc")] [HarmonyPostfix] private static void PlayerJumpClient(ref PlayerControllerB __instance) { if (!((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PlayerJump(__instance); } } private static void PlayerJump(PlayerControllerB __instance) { if (!__instance.isPlayerDead && __instance.isPlayerControlled && !__instance.disconnectedMidGame && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving) { TryCreateCustomPlayerStat((int)__instance.playerClientId); CustomPlayerStats[(int)__instance.playerClientId].jumps++; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void PlayerUpdate(ref PlayerControllerB __instance) { if (!__instance.isPlayerDead && __instance.isPlayerControlled && !__instance.disconnectedMidGame && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving) { TryCreateCustomPlayerStat((int)__instance.playerClientId); if (__instance.isInsideFactory) { CustomPlayerStats[(int)__instance.playerClientId].indoorTime += Time.deltaTime; } else { CustomPlayerStats[(int)__instance.playerClientId].outdoorTime += Time.deltaTime; } if (__instance.isInHangarShipRoom) { CustomPlayerStats[(int)__instance.playerClientId].shipTime += Time.deltaTime; } } } [HarmonyPatch(typeof(StartMatchLever), "PullLeverAnim")] [HarmonyPrefix] private static void StartGamePatch(ref bool leverPulled) { if (leverPulled) { ThisMoonObjects.Clear(); BlacklistedMoonObjects.Clear(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); GrabbableObject[] array2 = array; foreach (GrabbableObject item in array2) { BlacklistedMoonObjects.Add(item); } } } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] private static void PlayerGrabObject(ref PlayerControllerB __instance, ref bool grabValidated, ref NetworkObjectReference grabbedObject) { NetworkObject val = default(NetworkObject); if (!grabValidated || !((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null)) { return; } GrabbableObject componentInChildren = ((Component)val).gameObject.GetComponentInChildren<GrabbableObject>(); if (componentInChildren.itemProperties.isScrap && !BlacklistedMoonObjects.Contains(componentInChildren)) { if (!ThisMoonObjects.ContainsKey(componentInChildren)) { ThisMoonObjects.Add(componentInChildren, new BXPScrap()); } int num = (int)__instance.playerClientId; if (ThisMoonObjects[componentInChildren].foundBy == -1) { TryCreateCustomPlayerStat(num); CustomPlayerStats[num].scrapFound += componentInChildren.scrapValue; ThisMoonObjects[componentInChildren].foundBy = num; } } } [HarmonyPatch(typeof(PlayerControllerB), "SetItemInElevator")] [HarmonyPostfix] private static void SetObjectInShip(ref bool droppedInShipRoom, ref GrabbableObject gObject) { if (ThisMoonObjects.ContainsKey(gObject) && droppedInShipRoom != ThisMoonObjects[gObject].deliveredToShip) { ThisMoonObjects[gObject].deliveredToShip = droppedInShipRoom; if (ThisMoonObjects[gObject].foundBy != -1) { TryCreateCustomPlayerStat(ThisMoonObjects[gObject].foundBy); CustomPlayerStats[ThisMoonObjects[gObject].foundBy].scrapFoundDeliveredToShip += (droppedInShipRoom ? gObject.scrapValue : (-gObject.scrapValue)); CustomPlayerStats[ThisMoonObjects[gObject].foundBy].objectsDelivered += (droppedInShipRoom ? 1 : (-1)); } } } } internal class PauseDisplayPatch { private static TextMeshProUGUI bxpText; private static TextMeshProUGUI rankText; private static GameObject displayObject; private static GameObject bxpProgress; [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] [HarmonyPostfix] private static void PauseMenuPatch(QuickMenuManager __instance) { if (__instance.isMenuOpen) { if (!Object.op_Implicit((Object)(object)displayObject) || !Object.op_Implicit((Object)(object)bxpProgress)) { CreateRankDisplayObject(); } displayObject.SetActive(true); bxpProgress.SetActive(true); } } [HarmonyPatch(typeof(QuickMenuManager), "Update")] [HarmonyPostfix] private static void PauseMenuUpdatePatch(QuickMenuManager __instance) { if (!Object.op_Implicit((Object)(object)displayObject) || !Object.op_Implicit((Object)(object)bxpProgress)) { return; } if (!BetterEXPPlugin.showRankInMenu.Value) { displayObject.SetActive(false); bxpProgress.SetActive(false); ((Component)rankText).gameObject.SetActive(false); ((Component)bxpText).gameObject.SetActive(false); return; } displayObject.SetActive(__instance.mainButtonsPanel.activeSelf); bxpProgress.SetActive(__instance.mainButtonsPanel.activeSelf); ((Component)rankText).gameObject.SetActive(__instance.mainButtonsPanel.activeSelf); ((Component)bxpText).gameObject.SetActive(__instance.mainButtonsPanel.activeSelf); if (__instance.mainButtonsPanel.activeSelf) { XPPatch.BetterLevel playerBetterLevel = XPPatch.GetPlayerBetterLevel(XPPatch.betterXp); int num = XPPatch.betterXp - playerBetterLevel.xp; int num2 = playerBetterLevel.xpEnd - playerBetterLevel.xp; ((TMP_Text)bxpText).text = $"<color=#ffff00>{XPPatch.betterXp} BXP</color>"; ((TMP_Text)rankText).text = $"{XPPatch.GetPlayerBetterLevel(XPPatch.betterXp).name} <size=70%><color=#ff00ffff>{num}/{num2}</color></size>"; bxpProgress.GetComponent<Image>().fillAmount = XPPatch.GetRankProgress(XPPatch.betterXp); ((TMP_Text)bxpText).outlineWidth = 0f; ((TMP_Text)rankText).outlineWidth = 0f; ((TMP_Text)rankText).enableWordWrapping = false; } } public static void CreateRankDisplayObject() { //IL_0073: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu"); if (!Object.op_Implicit((Object)(object)displayObject)) { displayObject = Object.Instantiate<GameObject>(GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpBox")); ((Object)displayObject).name = "BXPDisplay"; displayObject.transform.SetParent(val.transform, false); displayObject.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); displayObject.transform.localPosition = new Vector3(224f, -194f, 0f); bxpProgress = Object.Instantiate<GameObject>(GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpMeter")); ((Object)bxpProgress).name = "BXPBarProgress"; bxpProgress.transform.SetParent(displayObject.transform, false); bxpProgress.transform.localScale = new Vector3(0.597f, 5.21f, 1f); bxpProgress.transform.localPosition = new Vector3(0f, 0f, 0f); bxpText = Object.Instantiate<GameObject>(GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total")).GetComponent<TextMeshProUGUI>(); ((Object)bxpText).name = "BXPText"; ((TMP_Text)bxpText).alignment = (TextAlignmentOptions)516; ((TMP_Text)bxpText).fontSize = 32f; ((TMP_Text)bxpText).font = ((TMP_Text)HUDManager.Instance.clockNumber).font; ((TMP_Text)bxpText).transform.SetParent(displayObject.transform, false); ((TMP_Text)bxpText).transform.localScale = new Vector3(1f, 1f, 1f); ((TMP_Text)bxpText).transform.localPosition = new Vector3(36f, -25f, 55f); rankText = Object.Instantiate<GameObject>(GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total")).GetComponent<TextMeshProUGUI>(); ((Object)rankText).name = "BXPRankText"; ((TMP_Text)rankText).alignment = (TextAlignmentOptions)513; ((TMP_Text)rankText).font = ((TMP_Text)HUDManager.Instance.clockNumber).font; ((TMP_Text)rankText).transform.SetParent(displayObject.transform, false); ((TMP_Text)rankText).transform.localScale = new Vector3(0.9f, 1f, 1f); ((TMP_Text)rankText).transform.localPosition = new Vector3(0f, 17f, 55f); } } } internal class PlayerControllerBPatch { public static Dictionary<int, JobTrackingManager.JobLogPlayerDeathInformation> PlayerDeathInformation = new Dictionary<int, JobTrackingManager.JobLogPlayerDeathInformation>(); public static void TryCreateDeathInfo(int playerID) { if (!PlayerDeathInformation.ContainsKey(playerID)) { PlayerDeathInformation.Add(playerID, null); } } [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] [HarmonyPostfix] private static void CollectAllAlreadyCollectedItems() { if (!NetworkManager.Singleton.IsHost) { GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { GameNetworkManager.Instance.localPlayerController.SetItemInElevator(true, true, val); } } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPrefix] private static void KillLocalPlayerPatch(ref PlayerControllerB __instance, ref CauseOfDeath causeOfDeath) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath()) { TryCreateDeathInfo((int)__instance.playerClientId); PlayerDeathInformation[(int)__instance.playerClientId] = new JobTrackingManager.JobLogPlayerDeathInformation { causeOfDeath = causeOfDeath, formattedCauseOfDeath = ((object)(CauseOfDeath)(ref causeOfDeath)).ToString(), realLifeTimeOfDeathInSeconds = Math.Max(0f, Time.realtimeSinceStartup - JobTrackingManager.timeAtStartOfDay), normalizedTimeOfDeath = TimeOfDay.Instance.currentDayTime / TimeOfDay.Instance.totalTime, formattedDayTimeOfDeath = GetFormattedTimeFromNormalizedTime(TimeOfDay.Instance.normalizedTimeOfDay, TimeOfDay.Instance.numberOfHours) }; } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")] [HarmonyPrefix] private static void KillNonLocalPlayerPatch(ref PlayerControllerB __instance, ref int playerId, ref int causeOfDeath) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner && playerId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { TryCreateDeathInfo((int)__instance.playerClientId); Dictionary<int, JobTrackingManager.JobLogPlayerDeathInformation> playerDeathInformation = PlayerDeathInformation; int key = (int)__instance.playerClientId; JobTrackingManager.JobLogPlayerDeathInformation obj = new JobTrackingManager.JobLogPlayerDeathInformation { causeOfDeath = (CauseOfDeath)causeOfDeath }; CauseOfDeath val = (CauseOfDeath)causeOfDeath; obj.formattedCauseOfDeath = ((object)(CauseOfDeath)(ref val)).ToString(); obj.realLifeTimeOfDeathInSeconds = Math.Max(0f, Time.realtimeSinceStartup - JobTrackingManager.timeAtStartOfDay); obj.normalizedTimeOfDeath = TimeOfDay.Instance.currentDayTime / TimeOfDay.Instance.totalTime; obj.formattedDayTimeOfDeath = GetFormattedTimeFromNormalizedTime(TimeOfDay.Instance.normalizedTimeOfDay, TimeOfDay.Instance.numberOfHours); playerDeathInformation[key] = obj; } } private static string GetFormattedTimeFromNormalizedTime(float timeNormalized, float numberOfHours) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = (int)Mathf.Floor((float)num / 60f); if (num2 >= 24) { return "12:00 AM"; } string arg = ((num2 >= 12) ? "PM" : "AM"); if (num2 > 12) { num2 %= 12; } int num3 = num % 60; return $"{num2:00}:{num3:00} {arg}"; } } internal class Saving { public static readonly string bxpFileLocation = GetSavePathLocation() + "/bxp.txt"; public static readonly string bxpV2FileLocation = GetSavePathLocation() + "/bxp_v2.txt"; public static readonly string bxpJobsFileLocation = GetSavePathLocation() + "/Jobs"; public static string bxpJobsSessionLocation = bxpJobsFileLocation + "/session_unknown"; public static string GetSavePathLocation() { return Application.persistentDataPath + "/swaggies/BetterEXP"; } public static void Save() { BetterEXPPlugin.logr.LogInfo((object)"Saving data..."); ES3.Save<int>("BetterXP", XPPatch.betterXp, "BetterEXP"); } public static int Load() { BetterEXPPlugin.logr.LogMessage((object)"Attempting to load..."); bxpJobsSessionLocation = $"{bxpJobsFileLocation}/session_{JobTrackingManager.GetUnixTimestamp(DateTime.UtcNow)}"; int result = -1; int num = ES3.Load<int>("BetterXP", "BetterEXP", -1); if (num > -1) { XPPatch.betterXp = num; XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(XPPatch.betterXp); BetterEXPPlugin.logr.LogMessage((object)$"(V2.3.0) Loaded {XPPatch.betterXp} BXP - rank {XPPatch.GetPlayerBetterLevel(XPPatch.betterXp).name}."); return 3; } if (!Directory.Exists(GetSavePathLocation())) { return -1; } if (File.Exists(bxpFileLocation)) { XPPatch.betterXp = int.Parse(File.ReadAllText(bxpFileLocation)); XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(XPPatch.betterXp); result = 1; } if (File.Exists(bxpV2FileLocation)) { XPPatch.betterXp = int.Parse(File.ReadAllText(bxpV2FileLocation)); XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(XPPatch.betterXp); BetterEXPPlugin.logr.LogMessage((object)$"(V2) Loaded {XPPatch.betterXp} BXP - rank {XPPatch.GetPlayerBetterLevel(XPPatch.betterXp).name}."); result = 2; } return result; } public static void SaveJobToDisk(JobTrackingManager.JobLog job) { if (!Directory.Exists(bxpJobsFileLocation)) { Directory.CreateDirectory(bxpJobsFileLocation); } if (!Directory.Exists(bxpJobsSessionLocation)) { Directory.CreateDirectory(bxpJobsSessionLocation); } string text = bxpJobsSessionLocation + $"/{job.jobPlayedTime}" + "_" + job.moon + $"_{job.scrapCollected}" + $"-{job.totalAvailableScrap}" + ".json"; File.WriteAllText(text, JsonConvert.SerializeObject((object)job)); BetterEXPPlugin.logr.LogMessage((object)("successfully saved today's stats to " + text + ".")); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { public class NotesComparer { public List<int> players = new List<int>(); public int stat = 0; public NotesComparer(int initialStat) { stat = initialStat; } } public class PlayerNote { public int id; public string note; public string value; public string color; public string unstyledNote; } public static List<PlayerNote> notesToAdd = new List<PlayerNote>(); [HarmonyPatch("WritePlayerNotes")] [HarmonyPrefix] private static bool NotesOverride() { EndOfGameStats gameStats = StartOfRound.Instance.gameStats; int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; PlayerStats[] allPlayerStats = gameStats.allPlayerStats; notesToAdd = new List<PlayerNote>(); List<int> list = new List<int>(); for (int i = 0; i < gameStats.allPlayerStats.Length; i++) { if (StartOfRound.Instance.gameStats.allPlayerStats[i] != null) { StartOfRound.Instance.gameStats.allPlayerStats[i].isActivePlayer = StartOfRound.Instance.allPlayerScripts[i].isPlayerDead || StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled; if (StartOfRound.Instance.allPlayerScripts[i].disconnectedMidGame) { list.Add(i); } } } NotesComparer notesComparer = new NotesComparer(int.MaxValue); NotesComparer notesComparer2 = new NotesComparer(0); NotesComparer notesComparer3 = new NotesComparer(0); NotesComparer notesComparer4 = new NotesComparer(0); NotesComparer notesComparer5 = new NotesComparer(0); NotesComparer notesComparer6 = new NotesComparer(int.MaxValue); NotesComparer notesComparer7 = new NotesComparer(0); NotesComparer notesComparer8 = new NotesComparer(int.MaxValue); NotesComparer notesComparer9 = new NotesComparer(0); NotesComparer notesComparer10 = new NotesComparer(int.MaxValue); NotesComparer notesComparer11 = new NotesComparer(0); NotesComparer notesComparer12 = new NotesComparer(0); NotesComparer notesComparer13 = new NotesComparer(0); NotesComparer notesComparer14 = new NotesComparer(0); NotesComparer notesComparer15 = new NotesComparer(int.MaxValue); for (int j = 0; j < allPlayerStats.Length; j++) { PlayerStats val = allPlayerStats[j]; int num = 0; if (EnemyAIPatch.playerEnemyKills.ContainsKey(j)) { num = EnemyAIPatch.playerEnemyKills[j]; } if (!val.isActivePlayer || list.Contains(j)) { continue; } if (val.stepsTaken == notesComparer.stat) { notesComparer.players.Add(j); } else if (val.stepsTaken < notesComparer.stat) { notesComparer.players = new List<int> { j }; notesComparer.stat = val.stepsTaken; } if (val.stepsTaken == notesComparer2.stat) { notesComparer2.players.Add(j); } else if (val.stepsTaken > notesComparer2.stat) { notesComparer2.players = new List<int> { j }; notesComparer2.stat = val.stepsTaken; } if (val.turnAmount == notesComparer3.stat) { notesComparer3.players.Add(j); } else if (val.turnAmount > notesComparer3.stat) { notesComparer3.players = new List<int> { j }; notesComparer3.stat = val.turnAmount; } if (val.damageTaken == notesComparer4.stat) { notesComparer4.players.Add(j); } else if (val.damageTaken > notesComparer4.stat) { notesComparer4.players = new List<int> { j }; notesComparer4.stat = val.damageTaken; } if (val.profitable == notesComparer5.stat) { notesComparer5.players.Add(j); } else if (val.profitable > notesComparer5.stat) { notesComparer5.players = new List<int> { j }; notesComparer5.stat = val.profitable; } if (val.profitable == notesComparer6.stat) { notesComparer6.players.Add(j); } else if (val.profitable < notesComparer6.stat) { notesComparer6.players = new List<int> { j }; notesComparer6.stat = val.profitable; } if (num == notesComparer7.stat) { notesComparer7.players.Add(j); } else if (num > notesComparer7.stat) { notesComparer7.players = new List<int> { j }; notesComparer7.stat = num; } if (num == notesComparer8.stat) { notesComparer8.players.Add(j); } else if (num < notesComparer8.stat) { notesComparer8.players = new List<int> { j }; notesComparer8.stat = num; } if (NotesPatch.CustomPlayerStats.ContainsKey(j)) { NotesPatch.CustomPlayerStat customPlayerStat = NotesPatch.CustomPlayerStats[j]; int scrapFound = customPlayerStat.scrapFound; if (scrapFound == notesComparer14.stat) { notesComparer14.players.Add(j); } else if (scrapFound > notesComparer14.stat) { notesComparer14.players = new List<int> { j }; notesComparer14.stat = scrapFound; } if (scrapFound == notesComparer15.stat) { notesComparer15.players.Add(j); } else if (scrapFound < notesComparer15.stat) { notesComparer15.players = new List<int> { j }; notesComparer15.stat = scrapFound; } if (customPlayerStat.indoorTime % 1f >= 0.9f) { customPlayerStat.indoorTime += 1f; } if (customPlayerStat.outdoorTime % 1f >= 0.9f) { customPlayerStat.outdoorTime += 1f; } if (customPlayerStat.shipTime % 1f >= 0.9f) { customPlayerStat.shipTime += 1f; } int num2 = (int)customPlayerStat.indoorTime; int num3 = (int)customPlayerStat.outdoorTime; int num4 = (int)customPlayerStat.shipTime; if (customPlayerStat.jumps == notesComparer9.stat) { notesComparer9.players.Add(j); } else if (customPlayerStat.jumps > notesComparer9.stat) { notesComparer9.players = new List<int> { j }; notesComparer9.stat = customPlayerStat.jumps; } if (customPlayerStat.jumps == notesComparer10.stat) { notesComparer10.players.Add(j); } else if (customPlayerStat.jumps < notesComparer10.stat) { notesComparer10.players = new List<int> { j }; notesComparer10.stat = customPlayerStat.jumps; } if (num2 == notesComparer11.stat) { notesComparer11.players.Add(j); } else if (num2 > notesComparer11.stat) { notesComparer11.players = new List<int> { j }; notesComparer11.stat = num2; } if (num3 == notesComparer12.stat) { notesComparer12.players.Add(j); } else if (num3 > notesComparer12.stat) { notesComparer12.players = new List<int> { j }; notesComparer12.stat = num3; } if (num4 == notesComparer13.stat) { notesComparer13.players.Add(j); } else if (num4 > notesComparer13.stat) { notesComparer13.players = new List<int> { j }; notesComparer13.stat = num4; } } } bool flag = connectedPlayersAmount > 0; for (int k = 0; k < allPlayerStats.Length; k++) { PlayerStats val2 = allPlayerStats[k]; if (val2.isActivePlayer) { if (flag && notesComparer5.stat > 0 && notesComparer5.players.Contains(k)) { AddNote(k, BetterEXPPlugin.PerformanceReportStyling.Value ? "* <size=120%>Most Profitable!</size>" : "* Most Profitable!", $"${notesComparer5.stat}", "#00ff69", "* Most Profitable!"); } if (notesComparer14.stat > 0 && notesComparer14.players.Contains(k) && BetterEXPPlugin.ScavengerNote.Value) { AddNote(k, BetterEXPPlugin.PerformanceReportStyling.Value ? "* <size=110%>#1 Scavenger</size>" : "* #1 Scavenger", $"${notesComparer14.stat} found", "#36ff36", "* #1 Scavenger"); } if (notesComparer15.stat == 0 && notesComparer15.players.Contains(k) && BetterEXPPlugin.ScavengerNote.Value && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* Empty-Handed", $"${notesComparer15.stat} found", "#094d85"); } if (notesComparer7.stat > 0 && notesComparer7.players.Contains(k) && BetterEXPPlugin.LethalNote.Value) { string arg = ((notesComparer7.stat == 1) ? "kill" : "kills"); AddNote(k, "* Most Lethal", $"{notesComparer7.stat} {arg}", "#ff00ea"); } if (flag && notesComparer11.stat > 0 && notesComparer11.players.Contains(k) && BetterEXPPlugin.BraveryNote.Value) { AddNote(k, "* The Bravest", Helpers.FormatTime(notesComparer11.stat) + " inside", "#a5fc03"); } if (notesComparer2.stat > 0 && notesComparer2.players.Contains(k) && BetterEXPPlugin.MostActiveNote.Value) { AddNote(k, "* Most Active", $"{notesComparer2.stat} steps", "#eeee36"); } if (flag && notesComparer9.stat > 0 && notesComparer9.players.Contains(k) && BetterEXPPlugin.JumpingNote.Value) { AddNote(k, "* Most Jumpy", $"{notesComparer9.stat} jumps", "#3cb4fa"); } if (notesComparer4.stat > 0 && notesComparer4.players.Contains(k)) { AddNote(k, "* Most Injured", $"{notesComparer4.stat} damage", "#ee7726"); } if (notesComparer3.stat > 0 && flag && notesComparer3.players.Contains(k) && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* Most Paranoid", $"{notesComparer3.stat} turns", "#ff4269"); } if (flag && notesComparer.players.Contains(k) && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* The Laziest", $"{notesComparer.stat} steps", "#4296ee"); } if (flag && notesComparer13.stat > 0 && notesComparer13.players.Contains(k) && BetterEXPPlugin.ShipDutyNote.Value) { AddNote(k, "* The Ship Guy", Helpers.FormatTime(notesComparer13.stat) + " on ship", "#babed1"); } if (flag && notesComparer10.players.Contains(k) && BetterEXPPlugin.JumpingNote.Value && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* Most Grounded", $"{notesComparer10.stat} jumps", "#1b7a4f"); } if (flag && notesComparer6.players.Contains(k) && BetterEXPPlugin.NegativeNotes.Value && BetterEXPPlugin.LeastProfitableNote.Value) { AddNote(k, "* Least Profitable", $"${notesComparer6.stat}", "#6926cc"); } if (flag && notesComparer12.stat > 0 && notesComparer12.players.Contains(k) && BetterEXPPlugin.BraveryNote.Value && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* Most Outdoors", Helpers.FormatTime(notesComparer12.stat) + " outside", "#80c484"); } if (notesComparer8.stat == 0 && notesComparer8.players.Contains(k) && notesComparer8.players.Count == 1 && BetterEXPPlugin.LethalNote.Value && BetterEXPPlugin.NegativeNotes.Value) { AddNote(k, "* The Pacifist", $"{notesComparer8.stat} kills", "#93bfa2"); } } } int num5 = (int)GameNetworkManager.Instance.localPlayerController.playerClientId; XPPatch.profitable = allPlayerStats[num5].profitable; XPPatch.isMostProfitable = notesComparer5.players.Contains(num5); return false; } [HarmonyPatch("openingDoorsSequence")] [HarmonyPrefix] private static void SetTimeAtStartOfDay() { JobTrackingManager.timeAtStartOfDay = Time.realtimeSinceStartup; } [HarmonyPatch("ShipHasLeft")] [HarmonyPrefix] private static void SetTimeAtEndOfDay() { JobTrackingManager.timeAtEndOfDay = Time.realtimeSinceStartup; } [HarmonyPatch(typeof(HUDManager), "FillEndGameStats")] [HarmonyPostfix] private static void CompleteNotes(ref HUDManager __instance, ref int scrapCollected) { foreach (PlayerNote item in notesToAdd) { if (item.id >= __instance.statsUIElements.playerNotesText.Length) { continue; } TextMeshProUGUI val = __instance.statsUIElements.playerNotesText[item.id]; string text = (BetterEXPPlugin.PerformanceReportStyling.Value ? ("<color=" + item.color + ">" + item.note + "</color>") : item.note); ((TMP_Text)val).text = ((TMP_Text)val).text + text; if (BetterEXPPlugin.PerformanceReportStats.Value) { if (BetterEXPPlugin.PerformanceReportStyling.Value) { ((TMP_Text)val).text = ((TMP_Text)val).text + " <size=75%><color=#ff96bb>(" + item.value + ")</color></size>"; } else { ((TMP_Text)val).text = ((TMP_Text)val).text + " <size=75%>(" + item.value + ")</size>"; } } ((TMP_Text)val).text = ((TMP_Text)val).text + "\n"; } for (int i = 0; i < StartOfRound.Instance.gameStats.allPlayerStats.Length; i++) { PlayerStats val2 = StartOfRound.Instance.gameStats.allPlayerStats[i]; TextMeshProUGUI val3 = __instance.statsUIElements.playerNamesText[i]; if (!val2.isActivePlayer) { string text2 = ((TMP_Text)val3).text; if (!(text2 == "") && !(text2 == " ")) { ((TMP_Text)val3).text = "<color=#969696><s>" + text2 + "</s></color>"; if (BetterEXPPlugin.collectedDisplayOption.Value == BetterEXPPlugin.CollectedDisplayOptionSettings.BELOW_NAME) { ((TMP_Text)val3).text = ((TMP_Text)val3).text + "<size=85%>\n<color=#bbbbbb><i>Disconnected.</i></color></size>\n"; } } } else if (BetterEXPPlugin.collectedDisplayOption.Value == BetterEXPPlugin.CollectedDisplayOptionSettings.BELOW_NAME) { ((TMP_Text)val3).text = ((TMP_Text)val3).text + $"<size=85%>\n<color=#ff96bb>Collected: ${val2.profitable}</color></size>\n"; } else if (BetterEXPPlugin.collectedDisplayOption.Value == BetterEXPPlugin.CollectedDisplayOptionSettings.BESIDE_NAME) { ((TMP_Text)val3).text = ((TMP_Text)val3).text + $"<size=75%><color=#ff96bb> ${val2.profitable}</color></size>\n"; } } JobTrackingManager.LogJobUsingContext(scrapCollected); notesToAdd.Clear(); } private static void AddNote(int id, string note, string value, string color, string unstyledNote = null) { notesToAdd.Add(new PlayerNote { id = id, note = note, value = value, color = color, unstyledNote = unstyledNote }); } [HarmonyPatch("ResetStats")] [HarmonyPrefix] private static bool ResetStatsFix() { for (int i = 0; i < StartOfRound.Instance.gameStats.allPlayerStats.Length; i++) { StartOfRound.Instance.gameStats.allPlayerStats[i].damageTaken = 0; StartOfRound.Instance.gameStats.allPlayerStats[i].jumps = 0; StartOfRound.Instance.gameStats.allPlayerStats[i].stepsTaken = 0; StartOfRound.Instance.gameStats.allPlayerStats[i].profitable = 0; StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount = 0; StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Clear(); } NotesPatch.CustomPlayerStats.Clear(); NotesPatch.ThisMoonObjects.Clear(); PlayerControllerBPatch.PlayerDeathInformation.Clear(); return false; } } internal class VisualEXPPatch { private enum RankChangeDirection { UP, DOWN, NONE } public class BetterEXPLog { public int scrapXp = 0; public int contributionXp = 0; public int scavengerXp = 0; public int enemyKillXp = 0; public int deathPenalty = 0; public int weatherBonusXp = 0; public int totalGain = 0; public int oldBXP = 0; public int newBXP = 0; } public static int scrapCollectedOnServer; private static int _expGain; private static int _deadReduction; private static int _scrapBonus; private static int _profitable; private static int _enemyBonus; private static int _weather; private static int _scavengerBonus; private static bool _hadWeather; [HarmonyPatch(typeof(HUDManager), "SetPlayerLevelSmoothly")] [HarmonyPrefix] private static bool SetPlayerLevelSmoothlyPatch(int XPGain) { return false; } private static IEnumerator EXPProcess(int XPGain, float changingPlayerXP, int changingPlayerLevel, int targetXPLevel) { bool hasReachedTargetXP = false; int amountToChange = Math.Abs(XPGain); if (XPGain < 0) { HUDManager.Instance.LevellingAudio.clip = HUDManager.Instance.decreaseXPSFX; } else { HUDManager.Instance.LevellingAudio.clip = HUDManager.Instance.increaseXPSFX; } HUDManager.Instance.LevellingAudio.Play(); RankChangeDirection rankChangeDirection = RankChangeDirection.NONE; float timeAtStart = Time.realtimeSinceStartup; while (!hasReachedTargetXP) { if (Time.realtimeSinceStartup - timeAtStart > 2.5f) { FinishEXPProcess(targetXPLevel, rankChangeDirection); yield break; } if (XPGain < 0) { changingPlayerXP -= (float)amountToChange * Time.deltaTime / 1.05f; if (changingPlayerXP <= (float)targetXPLevel) { hasReachedTargetXP = true; changingPlayerXP = targetXPLevel; } if (changingPlayerLevel - 1 >= 0 && changingPlayerXP < (float)XPPatch.betterLevels[changingPlayerLevel].xp) { changingPlayerLevel--; HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.levelDecreaseSFX); HUDManager.Instance.playerLevelBoxAnimator.SetTrigger("Shake"); rankChangeDirection = RankChangeDirection.DOWN; } } else { changingPlayerXP += (float)amountToChange * Time.deltaTime / 1.95f; if (changingPlayerXP >= (float)targetXPLevel) { hasReachedTargetXP = true; changingPlayerXP = targetXPLevel; } if (changingPlayerLevel + 1 < XPPatch.betterLevels.Length && changingPlayerXP >= (float)XPPatch.betterLevels[changingPlayerLevel].xpEnd) { changingPlayerLevel++; HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.levelIncreaseSFX); HUDManager.Instance.playerLevelBoxAnimator.SetTrigger("Shake"); rankChangeDirection = RankChangeDirection.UP; } } HUDManager.Instance.playerLevelMeter.fillAmount = (changingPlayerXP - (float)XPPatch.betterLevels[changingPlayerLevel].xp) / (float)(XPPatch.betterLevels[changingPlayerLevel].xpEnd - XPPatch.betterLevels[changingPlayerLevel].xp); ((TMP_Text)HUDManager.Instance.playerLevelText).text = XPPatch.betterLevels[changingPlayerLevel].name; ((TMP_Text)HUDManager.Instance.playerLevelXPCounter).text = $"<color=#ffff00>{(int)changingPlayerXP} BXP</color>"; switch (rankChangeDirection) { case RankChangeDirection.UP: ((TMP_Text)HUDManager.Instance.playerLevelText).text = "<color=#ffff00>" + XPPatch.betterLevels[changingPlayerLevel].name + "</color>"; break; default: ((TMP_Text)HUDManager.Instance.playerLevelText).text = "<color=#6969ff>" + XPPatch.betterLevels[changingPlayerLevel].name + "</color>"; break; case RankChangeDirection.NONE: break; } yield return null; } FinishEXPProcess(targetXPLevel, rankChangeDirection); } private static void FinishEXPProcess(int targetXPLevel, RankChangeDirection rankChangeDirection) { HUDManager.Instance.LevellingAudio.Stop(); XPPatch.betterXp = targetXPLevel; XPPatch.level = XPPatch.GetPlayerBetterLevelIndex(targetXPLevel); ((TMP_Text)HUDManager.Instance.playerLevelText).text = XPPatch.betterLevels[XPPatch.level].name; switch (rankChangeDirection) { case RankChangeDirection.UP: ((TMP_Text)HUDManager.Instance.playerLevelText).text = "<color=#ffff00>" + XPPatch.betterLevels[XPPatch.level].name + "</color>"; break; default: ((TMP_Text)HUDManager.Instance.playerLevelText).text = "<color=#6969ff>" + XPPatch.betterLevels[XPPatch.level].name + "</color>"; break; case RankChangeDirection.NONE: break; } ((TMP_Text)HUDManager.Instance.playerLevelXPCounter).text = $"<color=#ffff00>{Mathf.RoundToInt((float)XPPatch.betterXp)} BXP</color>"; HUDManager.Instance.SyncPlayerLevelServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, HUDManager.Instance.localPlayerLevel, false); Saving.Save(); } private static void HandleOldLevelling(bool isDead, bool mostProfitable, bool allPlayersDead) { int num = (isDead ? (-3) : 10); if (mostProfitable) { num += 15; } if (allPlayersDead) { num -= 5; } if (num > 0) { float num2 = Mathf.Clamp((float)RoundManager.Instance.scrapCollectedInLevel, 0f, RoundManager.Instance.totalScrapValueInLevel) / RoundManager.Instance.totalScrapValueInLevel; num = (int)((float)num * num2); } HUDManager instance = HUDManager.Instance; instance.localPlayerXP += num; int localPlayerLevel = 0; for (int i = 0; i < HUDManager.Instance.playerLevels.Length; i++) { if (i == HUDManager.Instance.playerLevels.Length - 1) { localPlayerLevel = i; break; } if (HUDManager.Instance.localPlayerXP >= HUDManager.Instance.playerLevels[i].XPMin && HUDManager.Instance.localPlayerXP < HUDManager.Instance.playerLevels[i].XPMax) { localPlayerLevel = i; break; } } HUDManager.Instance.localPlayerLevel = localPlayerLevel; } [HarmonyPatch(typeof(HUDManager), "SetPlayerLevel")] [HarmonyPrefix] private static bool CancelOGExp(ref bool isDead, ref bool allPlayersDead) { ReplaceEXP(isDead, allPlayersDead); return false; } private static float GetWeatherModifier() { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown LevelWeatherType currentWeather = WeatherPatch.currentWeather; LevelWeatherType val = currentWeather; return (val - -1) switch { 0 => 0f, 2 => 0.1f, 4 => 0.15f, 5 => 0.2f, 3 => 0.25f, 6 => 0.3f, _ => 0f, }; } private static int GetDeathXp(int currentXp, bool dead, bool allPlayersDead, int scrapXp, int contributionXp, int enemyKillXp) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 if (!dead) { return 0; } if ((int)GameNetworkManager.Instance.localPlayerController.causeOfDeath == 1) { return -1; } float num = Mathf.Clamp((float)Math.Sqrt(currentXp) / 2f, 0f, 100f); if (allPlayersDead) { num = Mathf.Clamp(num * 1.2f, 0f, 100f); } if ((int)GameNetworkManager.Instance.localPlayerController.causeOfDeath == 10) { return (int)Math.Max(0f - num, -10f); } return (int)Math.Ceiling(num) * -1; } private static double GetMoonMaxXp(int scrapTotal) { double num = 0.0; num += Helpers.NumBetween(scrapTotal, 0.0, 300.0) * 7.0; num += Helpers.NumBetween(scrapTotal, 300.0, 500.0) * 8.0; num += Helpers.NumBetween(scrapTotal, 500.0, 700.0) * 10.0; num += Helpers.NumBetween(scrapTotal, 700.0, 1000.0) * 11.0; num += Helpers.NumBetween(scrapTotal, 1000.0, 1600.0) * 24.0; num += Helpers.NumBetween(scrapTotal, 1600.0, 2000.0) * 10.0; num += Helpers.NumBetween(scrapTotal, 2000.0, 2500.0) * 10.0; num += Helpers.NumBetween(scrapTotal, 2500.0, 3000.0) * 8.0; num += Helpers.NumBetween(scrapTotal, 3000.0, 4000.0) * 12.0; num += Helpers.NumBetween(scrapTotal, 4000.0, 8000.0) * 15.0; return num + Helpers.NumBetween(scrapTotal, 8000.0, 9999.0) * 5.0; } private static int GetScrapXp(int scrapCollected, int scrapTotal) { double moonMaxXp = GetMoonMaxXp(scrapTotal); double value = Mathf.Clamp(Mathf.Clamp((float)scrapCollected, 0f, 9999f) / Mathf.Clamp((float)scrapTotal, 1f, 9999f), 0f, 1f); double num = 0.0; num += Helpers.NumBetween(value, 0.0, 0.2) * 0.22; num += Helpers.NumBetween(value, 0.2, 0.4) * 0.3; num += Helpers.NumBetween(value, 0.4, 0.6) * 0.24; num += Helpers.NumBetween(value, 0.6, 0.8) * 0.14; num += Helpers.NumBetween(value, 0.8, 1.0) * 0.1; return (int)Math.Ceiling(moonMaxXp * num); } private static int GetMVPScrapBonusXp(int originalXp, int selfProfits, int scrapTotal) { return (int)((float)originalXp * Mathf.Clamp(0.25f * (float)selfProfits / Math.Max(scrapTotal, 1f), 0f, 0.25f)); } private static int GetWeatherBonusXp(int totalXp) { return (int)((float)totalXp * GetWeatherModifier()); } private static int GetScavengerBonusXp(int totalAvailableScrap) { float num = 0f; int key = (int)GameNetworkManager.Instance.localPlayerController.playerClientId; if (!NotesPatch.CustomPlayerStats.ContainsKey(key)) { return 0; } num += (float)NotesPatch.CustomPlayerStats[key].scrapFoundDeliveredToShip; num += 0.32f * (float)(NotesPatch.CustomPlayerStats[key].scrapFound - NotesPatch.CustomPlayerStats[key].scrapFoundDeliveredToShip); return (int)(GetMoonMaxXp(totalAvailableScrap) * (double)Mathf.Clamp01(num / (float)totalAvailableScrap)); } public static BetterEXPLog CalculateBXPGain(int currentXP, int scrapCollected, int scrapTotal, bool localPlayerDead, bool allPlayersDead) { int scrapXp = GetScrapXp(scrapCollected, scrapTotal); int mVPScrapBonusXp = GetMVPScrapBonusXp(scrapXp, XPPatch.profitable, scrapTotal); int scavengerBonusXp = GetScavengerBonusXp(scrapTotal); int xpFromKilledEnemies = EnemyAIPatch.GetXpFromKilledEnemies(); int deathXp = GetDeathXp(currentXP, localPlayerDead, allPlayersDead, scrapXp, mVPScrapBonusXp, xpFromKilledEnemies); int weatherBonusXp = GetWeatherBonusXp(scrapXp + mVPScrapBonusXp + xpFromKilledEnemies + deathXp); int num = scrapXp + mVPScrapBonusXp + scavengerBonusXp + xpFromKilledEnemies + deathXp + weatherBonusXp; return new BetterEXPLog { scrapXp = scrapXp, contributionXp = mVPScrapBonusXp, scavengerXp = scavengerBonusXp, enemyKillXp = xpFromKilledEnemies, deathPenalty = deathXp, weatherBonusXp = weatherBonusXp, totalGain = num, oldBXP = XPPatch.betterXp, newBXP = XPPatch.betterXp + num }; } public static void ReplaceEXP(bool isDead, bool allPlayersDead) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 int betterXp = XPPatch.betterXp; bool isMostProfitable = XPPatch.isMostProfitable; int scrapXp = GetScrapXp(scrapCollectedOnServer, (int)RoundManager.Instance.totalScrapValueInLevel); int mVPScrapBonusXp = GetMVPScrapBonusXp(scrapXp, XPPatch.profitable, (int)RoundManager.Instance.totalScrapValueInLevel); int scavengerBonusXp = GetScavengerBonusXp((int)RoundManager.Instance.totalScrapValueInLevel); int xpFromKilledEnemies = EnemyAIPatch.GetXpFromKilledEnemies(); int deathXp = GetDeathXp(betterXp, isDead, allPlayersDead, scrapXp, mVPScrapBonusXp, xpFromKilledEnemies); int weatherBonusXp = GetWeatherBonusXp(scrapXp + mVPScrapBonusXp + xpFromKilledEnemies + deathXp); HandleOldLevelling(isDead, isMostProfitable, allPlayersDead); int num = scrapXp + mVPScrapBonusXp + xpFromKilledEnemies + deathXp + weatherBonusXp + scavengerBonusXp; EnemyAIPatch.ResetAllEnemyKills(); SetExpGains(num, deathXp, scrapXp, mVPScrapBonusXp, xpFromKilledEnemies, weatherBonusXp, (int)WeatherPatch.currentWeather != -1, scavengerBonusXp); if (num == 0) { FinishEXPProcess(betterXp, RankChangeDirection.NONE); } else { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(EXPProcess(num, XPPatch.betterXp, XPPatch.level, Mathf.Clamp(XPPatch.betterXp + num, 0, XPPatch.maxBetterXp))); } } private static void SetExpGains(int expGain, int deadReduction, int scrapBonus, int profitable, int enemyBonus, int weatherBonus, bool hadWeather, int scavengerBonus) { _expGain = expGain; _deadReduction = deadReduction; _scrapBonus = scrapBonus; _profitable = profitable; _enemyBonus = enemyBonus; _weather = weatherBonus; _hadWeather = hadWeather; _scavengerBonus = scavengerBonus; } [HarmonyPatch(typeof(StartOfRound), "PassTimeToNextDay")] [HarmonyPostfix] private static void BeginShowExpGains() { Saving.Save(); if (StartOfRound.Instance.currentLevel.planetHasTime) { ((MonoBehaviour)HUDManager.Instance).StartCoroutine(ShowExpGains()); } } private static IEnumerator ShowExpGains() { if (BetterEXPPlugin.showRoundSummary.Value) { string badcolor = "#000096"; string neutralcolor = "#424242"; string goodcoloralt = "#ff00ff"; string goodcolor = "#6900ff"; string color = ((_expGain > 0) ? goodcolor : ((_expGain == 0) ? neutralcolor : badcolor)); if (_expGain >= 100) { color = goodcoloralt; } string roundExperience = $"Today's Results: <color={color}>{_expGain} BXP</color>"; string scrapColor = ((_scrapBonus + _profitable == 0) ? neutralcolor : goodcolor); string weatherColor = ((_weather > 0) ? goodcoloralt : ((_weather == 0) ? neutralcolor : badcolor)); string weatherSign = ((_weather < 0) ? "-" : " "); string weatherString = $"{weatherSign}{Math.Abs(_weather)} BXP"; string deathPenalty = $"Death Penalty . . . . <color={badcolor}>-{Math.Abs(_deadReduction)} BXP</color>\n"; string scrapFinal = $"Scrap Delivered . . . <color={scrapColor}> {_scrapBonus + _profitable} BXP</color>\n"; string scavenger = $"Scrap You Found . . . <color={scrapColor}> {_scavengerBonus} BXP</color>\n"; string enemyKills = $"Lethality Bonus . . . <color={goodcoloralt}> {_enemyBonus} BXP</color>\n"; string weather = "Weather Bonus . . . . <color=" + weatherColor + ">" + weatherString + "</color>"; string deathFinal = ((_deadReduction == 0) ? "" : deathPenalty); string scavengerFinal = ((_scavengerBonus > 0) ? scavenger : "") ?? ""; string enemyFinal = ((_enemyBonus > 0) ? enemyKills : "") ?? ""; string weatherFinal = (_hadWeather ? weather : ""); yield return (object)new WaitForSeconds(1.85f); HUDManager.Instance.DisplayTip(roundExperience, "<size=90%>" + deathFinal + scrapFinal + scavengerFinal + enemyFinal + weatherFinal + "</size>", false, false, "LC_Tip1"); } } } internal class WeatherPatch { public static LevelWeatherType currentWeather = (LevelWeatherType)(-1); public static bool currentPlanetHasSnow = false; [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] private static void SetWeatherType() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) currentWeather = TimeOfDay.Instance.currentLevelWeather; currentPlanetHasSnow = TimeOfDay.Instance.currentLevel.levelIncludesSnowFootprints; } } internal class XPPatch : MonoBehaviour { public class BetterLevel { public string name; public int xp; public int xpEnd; public BetterLevel(string levelName, int startXp, int endXp) { name = levelName; xp = startXp; xpEnd = endXp; } } public static int level = -1; public static int betterXp = 0; public static int profitable = 0; public static bool isMostProfitable = false; public static readonly int maxBetterXp = 999999999; public static BetterLevel[] betterLevels = new BetterLevel[69] { new BetterLevel("Intern", 0, 25), new BetterLevel("Trainee", 25, 50), new BetterLevel("Apprentice", 50, 100), new BetterLevel("Part-Timer", 100, 200), new BetterLevel("Full-Timer", 200, 300), new BetterLevel("Employee", 300, 400), new BetterLevel("Leader", 400, 600), new BetterLevel("Manager", 600, 800), new BetterLevel("Sr. Manager", 800, 1000), new BetterLevel("3rd Boss", 1000, 1300), new BetterLevel("2nd Boss", 1300, 1600), new BetterLevel("1st Boss", 1600, 2000), new BetterLevel("3rd Vice President", 2000, 2300), new BetterLevel("2nd Vice President", 2300, 2600), new BetterLevel("1st Vice President", 2600, 3000), new BetterLevel("3rd Executive V.P.", 3000, 3300), new BetterLevel("2nd Executive V.P.", 3300, 3600), new BetterLevel("1st Executive V.P.", 3600, 4000), new BetterLevel("3rd Deputy President", 4000, 4300), new BetterLevel("2nd Deputy President", 4300, 4600), new BetterLevel("1st Deputy President", 4600, 5000), new BetterLevel("President", 5000, 5500), new BetterLevel("Sr. President", 5500, 6000), new BetterLevel("Vice Chairman", 6000, 6500), new BetterLevel("Chairman", 6500, 7500), new BetterLevel("First-Class Asset", 7500, 8500), new BetterLevel("Co-Founder", 8500, 10000), new BetterLevel("Founder", 10000, 11000), new BetterLevel("Greatest Asset", 11000, 12000), new BetterLevel("Greatest Asset II", 12000, 13000), new BetterLevel("Greatest Asset III", 13000, 14000), new BetterLevel("Greatest Asset IV", 14000, 15000), new BetterLevel("Greatest Asset V", 15000, 16000), new BetterLevel("Greatest Asset VI", 16000, 17500), new BetterLevel("Greatest Asset VII", 17500, 19000), new BetterLevel("Greatest Asset VIII", 19000, 21000), new BetterLevel("Greatest Asset IX", 21000, 23000), new BetterLevel("Greatest Asset X", 23000, 25000), new BetterLevel("The Company", 25000, 30000), new BetterLevel("The Company II", 30000, 35000), new BetterLevel("The Company III", 35000, 40000), new BetterLevel("The Company IV", 40000, 45000), new BetterLevel("The Company V", 45000, 50000), new BetterLevel("The Company VI", 50000, 60000), new BetterLevel("The Company VII", 60000, 70000), new BetterLevel("The Company VIII", 70000, 80000), new BetterLevel("The Company IX", 80000, 90000), new BetterLevel("The Company X", 90000, 100000), new BetterLevel("VIP Employee", 100000, 150000), new BetterLevel("VIP Employee II", 150000, 200000), new BetterLevel("VIP Employee III", 200000, 250000), new BetterLevel("VIP Employee IV", 250000, 300000), new BetterLevel("VIP Employee V", 300000, 400000), new BetterLevel("VIP Employee VI", 400000, 500000), new BetterLevel("VIP Employee VII", 500000, 600000), new BetterLevel("VIP Employee VIII", 600000, 700000), new BetterLevel("VIP Employee IX", 700000, 850000), new BetterLevel("VIP Employee X", 850000, 1000000), new BetterLevel("SUPER Employee", 1000000, 1500000), new BetterLevel("SUPER Employee II", 1500000, 2000000), new BetterLevel("SUPER Employee III", 2000000, 3000000), new BetterLevel("SUPER Employee IV", 3000000, 6000000), new BetterLevel("SUPER Employee V", 6000000, 10000000), new BetterLevel("SUPER Employee VI", 10000000, 20000000), new BetterLevel("SUPER Employee VII", 20000000, 50000000), new BetterLevel("SUPER Employee VIII", 50000000, 100000000), new BetterLevel("SUPER Employee IX", 100000000, 300000000), new BetterLevel("SUPER Employee X", 300000000, 600000000), new BetterLevel("MOST VALUABLE ASSET", 600000000, maxBetterXp + 1) }; public static int GetPlayerBetterLevelIndex(int bxp) { for (int i = 0; i < betterLevels.Length; i++) { if (bxp < betterLevels[i].xpEnd) { return i; } } return betterLevels.Length - 1; } public static BetterLevel GetPlayerBetterLevel(int bxp) { int playerBetterLevelIndex = GetPlayerBetterLevelIndex(bxp); return betterLevels[playerBetterLevelIndex]; } public static float GetRankProgress(int bxp) { BetterLevel playerBetterLevel = GetPlayerBetterLevel(bxp); float num = bxp - playerBetterLevel.xp; float num2 = playerBetterLevel.xpEnd - playerBetterLevel.xp; return num / num2; } } }
BepInEx/plugins/ZoLoKinoBabo112/LethalBestiary.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using LethalBestiary.Modules; using LethalBestiary.NetcodePatcher; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Xilef992")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lightweight version for Lethal Lib for registering new enemies!")] [assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyInformationalVersion("0.0.0-dev.5+1066fcad873f53ff493f6e79e46189f3bc6bf919")] [assembly: AssemblyProduct("LethalBestiary")] [assembly: AssemblyTitle("LethalBestiary")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/FelixAllard/Xilef-LethalBestiary-LC")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalBestiary { public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalBestiary"; public const string PLUGIN_NAME = "LethalBestiary"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("Xilef.LethalBestiary", "LethalBestiary", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "Xilef.LethalBestiary"; public const string ModName = "LethalBestiary"; public const string ModVersion = "1.0.0"; public static AssetBundle MainAssets; public static ManualLogSource logger; public static ConfigFile config; public static Plugin Instance; public static ConfigEntry<bool> extendedLogging; private void Awake() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) Instance = this; config = ((BaseUnityPlugin)this).Config; logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalBestiary Is loading ..."); extendedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging"); new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook)); Enemies.Init(); Utilities.Init(); NetworkPrefabs.Init(); Utilities.Init(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalBestiary Is Loaded"); } private void IlHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown try { ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public)) }); val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } catch (Exception) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"ILHook already applied! LethalBestiary is skipping Method Patching!"); } } private static string GetLineOrIL(StackFrame instance) { int fileLineNumber = instance.GetFileLineNumber(); if (fileLineNumber == -1 || fileLineNumber == 0) { return "IL_" + instance.GetILOffset().ToString("X4"); } return fileLineNumber.ToString(); } } } namespace LethalBestiary.Modules { public class Enemies { public struct EnemyAssetInfo { public EnemyType EnemyAsset; public TerminalKeyword keyword; } public enum SpawnType { Default, Daytime, Outside } public class SpawnableEnemy { public EnemyType enemy; public SpawnType spawnType; public TerminalNode terminalNode; public TerminalKeyword infoKeyword; public string modName; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType, string[] spawnLevelOverrides = null) { this.enemy = enemy; this.spawnLevels = spawnLevels; this.spawnType = spawnType; if (spawnLevelOverrides != null) { foreach (string levelName in spawnLevelOverrides) { customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public SpawnableEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { this.enemy = enemy; this.spawnType = spawnType; if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = Levels.Compatibility.LLLifyLevelRarityDictionary(customLevelRarities); } } } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__RegisterLevelEnemies; public static hook_Start <1>__Terminal_Start; public static hook_Start <2>__QuickMenuManager_Start; public static hook_Start <3>__RegisterLevelEnemiesforLLL_RoundManager_Start; public static hook_Start <4>__RegisterLevelEnemiesforLE_Terminal_Start; } private static List<SelectableLevel> levelsAlreadyAddedTo = new List<SelectableLevel>(); private static bool addedToDebug = false; public static Terminal terminal; public static List<EnemyAssetInfo> enemyAssetInfos = new List<EnemyAssetInfo>(); public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__RegisterLevelEnemies; if (obj == null) { hook_Awake val = RegisterLevelEnemies; <>O.<0>__RegisterLevelEnemies = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_Start; if (obj2 == null) { hook_Start val2 = Terminal_Start; <>O.<1>__Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; object obj3 = <>O.<2>__QuickMenuManager_Start; if (obj3 == null) { hook_Start val3 = QuickMenuManager_Start; <>O.<2>__QuickMenuManager_Start = val3; obj3 = (object)val3; } QuickMenuManager.Start += (hook_Start)obj3; } private static void QuickMenuManager_Start(orig_Start orig, QuickMenuManager self) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (addedToDebug) { orig.Invoke(self); return; } SelectableLevel testAllEnemiesLevel = self.testAllEnemiesLevel; List<SpawnableEnemyWithRarity> enemies = testAllEnemiesLevel.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = testAllEnemiesLevel.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = testAllEnemiesLevel.OutsideEnemies; foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { continue; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = spawnableEnemy.rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { enemies.Add(item); } break; case SpawnType.Daytime: if (!daytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { daytimeEnemies.Add(item); } break; case SpawnType.Outside: if (!outsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { outsideEnemies.Add(item); } break; } if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {spawnableEnemy.enemy.enemyName} to DebugList [{spawnableEnemy.spawnType}]"); } } addedToDebug = true; orig.Invoke(self); } private static void Terminal_Start(orig_Start orig, Terminal self) { //IL_0252: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown terminal = self; TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); List<string> list = new List<string>(); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (list.Contains(spawnableEnemy.enemy.enemyName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } if ((Object)(object)spawnableEnemy.terminalNode == (Object)null) { spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>(); spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n"; spawnableEnemy.terminalNode.clearPreviousText = true; spawnableEnemy.terminalNode.maxCharactersToType = 35; spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName; } if (self.enemyFiles.Any((TerminalNode x) => x.creatureName == spawnableEnemy.terminalNode.creatureName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } TerminalKeyword keyword2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val)); keyword2.defaultVerb = val; List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); if (!list2.Any((TerminalKeyword x) => x.word == keyword2.word)) { list2.Add(keyword2); self.terminalNodes.allKeywords = list2.ToArray(); } List<CompatibleNoun> list3 = val.compatibleNouns.ToList(); if (!list3.Any((CompatibleNoun x) => x.noun.word == keyword2.word)) { list3.Add(new CompatibleNoun { noun = keyword2, result = spawnableEnemy.terminalNode }); } val.compatibleNouns = list3.ToArray(); spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count; self.enemyFiles.Add(spawnableEnemy.terminalNode); ScanNodeProperties[] componentsInChildren = spawnableEnemy.enemy.enemyPrefab.GetComponentsInChildren<ScanNodeProperties>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].creatureScanID = spawnableEnemy.terminalNode.creatureFileID; } EnemyAssetInfo enemyAssetInfo = default(EnemyAssetInfo); enemyAssetInfo.EnemyAsset = spawnableEnemy.enemy; enemyAssetInfo.keyword = keyword2; EnemyAssetInfo item = enemyAssetInfo; enemyAssetInfos.Add(item); } orig.Invoke(self); } private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_006f: 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_007a: Expected O, but got Unknown orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader") || Chainloader.PluginInfos.ContainsKey("iambatby.lethallevelloader")) { object obj = <>O.<3>__RegisterLevelEnemiesforLLL_RoundManager_Start; if (obj == null) { hook_Start val = RegisterLevelEnemiesforLLL_RoundManager_Start; <>O.<3>__RegisterLevelEnemiesforLLL_RoundManager_Start = val; obj = (object)val; } RoundManager.Start += (hook_Start)obj; } if (Chainloader.PluginInfos.ContainsKey("LethalExpansion")) { object obj2 = <>O.<4>__RegisterLevelEnemiesforLE_Terminal_Start; if (obj2 == null) { hook_Start val2 = RegisterLevelEnemiesforLE_Terminal_Start; <>O.<4>__RegisterLevelEnemiesforLE_Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; } } private static void RegisterLevelEnemiesforLLL_RoundManager_Start(orig_Start orig, RoundManager self) { orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); } private static void RegisterLevelEnemiesforLE_Terminal_Start(orig_Start orig, Terminal self) { orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); } private static void RegisterLethalLibEnemiesForAllLevels() { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (levelsAlreadyAddedTo.Contains(val)) { continue; } foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { AddEnemyToLevel(spawnableEnemy, val); } levelsAlreadyAddedTo.Add(val); } } private static void AddEnemyToLevel(SpawnableEnemy spawnableEnemy, SelectableLevel level) { //IL_01a7: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown SpawnableEnemy spawnableEnemy2 = spawnableEnemy; string text = ((Object)level).name; bool flag = spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.All) || (spawnableEnemy2.customLevelRarities != null && spawnableEnemy2.customLevelRarities.ContainsKey(text)); if (spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), text)) { flag = true; } Levels.LevelTypes levelTypes = Levels.LevelTypes.None; bool flag2 = false; if (Enum.IsDefined(typeof(Levels.LevelTypes), text)) { levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), text); flag2 = true; } else { text = Levels.Compatibility.GetLLLNameOfLevel(text); } if (!(flag2 || flag)) { return; } Levels.LevelTypes key = (flag ? Levels.LevelTypes.All : levelTypes); if (!flag && !spawnableEnemy2.levelRarities.ContainsKey(key)) { return; } int num = 0; if (flag2 && spawnableEnemy2.levelRarities.ContainsKey(levelTypes)) { num = spawnableEnemy2.levelRarities[levelTypes]; } else if (!flag2 && spawnableEnemy2.customLevelRarities != null && spawnableEnemy2.customLevelRarities.ContainsKey(text)) { num = spawnableEnemy2.customLevelRarities[text]; } else if (!flag2 && spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Modded)) { num = spawnableEnemy2.levelRarities[Levels.LevelTypes.Modded]; } else if (spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.All)) { num = spawnableEnemy2.levelRarities[Levels.LevelTypes.All]; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy2.enemy, rarity = num }; switch (spawnableEnemy2.spawnType) { case SpawnType.Default: if (!level.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.Enemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} and SpawnType [Default]"); } } break; case SpawnType.Daytime: if (!level.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.DaytimeEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} andSpawnType [Daytime]"); } } break; case SpawnType.Outside: if (!level.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.OutsideEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} and SpawnType [Outside]"); } } break; } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; EnemyNullCheck(enemy2); SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelFlags != Levels.LevelTypes.None) { spawnableEnemy.levelRarities.Add(levelFlags, rarity); } if (spawnLevelOverrides != null) { foreach (string levelName in spawnLevelOverrides) { spawnableEnemy.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } } else { spawnableEnemy = new SpawnableEnemy(enemy2, rarity, levelFlags, spawnType, spawnLevelOverrides); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; FinalizeRegisterEnemy(spawnableEnemy); } } public static void RegisterEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; EnemyNullCheck(enemy2); SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { spawnableEnemy.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { spawnableEnemy.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(customLevelRarity.Key), customLevelRarity.Value); } return; } } spawnableEnemy = new SpawnableEnemy(enemy2, spawnType, levelRarities, customLevelRarities); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; FinalizeRegisterEnemy(spawnableEnemy); } private static void FinalizeRegisterEnemy(SpawnableEnemy spawnableEnemy) { string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; if (spawnableEnemy.enemy.enemyPrefab == null) { throw new NullReferenceException("Cannot register enemy '" + spawnableEnemy.enemy.enemyName + "', because enemy.enemyPrefab is null!"); } EnemyAICollisionDetect[] componentsInChildren = spawnableEnemy.enemy.enemyPrefab.GetComponentsInChildren<EnemyAICollisionDetect>(); foreach (EnemyAICollisionDetect val in componentsInChildren) { if (val.mainScript == null) { Plugin.logger.LogWarning((object)("An Enemy AI Collision Detect Script on GameObject '" + ((Object)((Component)val).gameObject).name + "' of enemy '" + spawnableEnemy.enemy.enemyName + "' does not reference a 'Main Script', and could cause Null Reference Exceptions.")); } } spawnableEnemies.Add(spawnableEnemy); } private static void EnemyNullCheck(EnemyType enemy) { if (enemy == null) { throw new ArgumentNullException("enemy", "The first argument of RegisterEnemy was null!"); } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, spawnLevelOverrides, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, spawnType, levelRarities, customLevelRarities, infoNode, infoKeyword); } public static void RemoveEnemyFromLevels(EnemyType enemyType, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { EnemyType enemyType2 = enemyType; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; if (!Enum.IsDefined(typeof(Levels.LevelTypes), name)) { name = Levels.Compatibility.GetLLLNameOfLevel(name); } bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => Levels.Compatibility.GetLLLNameOfLevel(item).ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { List<SpawnableEnemyWithRarity> enemies = val.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = val.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = val.OutsideEnemies; enemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); daytimeEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); outsideEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Removed Enemy " + ((Object)enemyType2).name + " from Level " + name)); } } } } } public class Levels { [Flags] public enum LevelTypes { None = 1, ExperimentationLevel = 4, AssuranceLevel = 8, VowLevel = 0x10, OffenseLevel = 0x20, MarchLevel = 0x40, RendLevel = 0x80, DineLevel = 0x100, TitanLevel = 0x200, Vanilla = 0x3FC, Modded = 0x400, All = -1 } internal static class Compatibility { private const string illegalCharacters = ".,?!@#$%^&*()_+-=';:'\""; private static string GetNumberlessPlanetName(string planetName) { if (planetName != null) { return new string(planetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } return string.Empty; } private static string StripSpecialCharacters(string input) { string text = string.Empty; for (int i = 0; i < input.Length; i++) { char c = input[i]; if ((!".,?!@#$%^&*()_+-=';:'\"".ToCharArray().Contains(c) && char.IsLetterOrDigit(c)) || c.ToString() == " ") { text += c; } } return text; } internal static string GetLLLNameOfLevel(string levelName) { string text = StripSpecialCharacters(GetNumberlessPlanetName(levelName)); if (!text.EndsWith("Level")) { text += "Level"; } return text; } internal static Dictionary<string, int> LLLifyLevelRarityDictionary(Dictionary<string, int> keyValuePairs) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<string> list = keyValuePairs.Keys.ToList(); List<int> list2 = keyValuePairs.Values.ToList(); for (int i = 0; i < keyValuePairs.Count; i++) { dictionary.Add(GetLLLNameOfLevel(list[i]), list2[i]); } return dictionary; } } } public class NetworkPrefabs { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GameNetworkManager_Start; } private static List<GameObject> _networkPrefabs = new List<GameObject>(); internal static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_Start; if (obj == null) { hook_Start val = GameNetworkManager_Start; <>O.<0>__GameNetworkManager_Start = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; } public static void RegisterNetworkPrefab(GameObject prefab) { if (prefab == null) { throw new ArgumentNullException("prefab", "The given argument for RegisterNetworkPrefab is null!"); } if (!_networkPrefabs.Contains(prefab)) { _networkPrefabs.Add(prefab); } } private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); Debug.Log((object)"Registering All Prefabs!"); foreach (GameObject networkPrefab in _networkPrefabs) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkPrefab)) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } } } public class PrefabUtils { internal static Lazy<GameObject> _prefabParent; internal static GameObject prefabParent => _prefabParent.Value; static PrefabUtils() { _prefabParent = new Lazy<GameObject>((Func<GameObject>)delegate { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject("LethalLibGeneratedPrefabs") { hideFlags = (HideFlags)61 }; val.SetActive(false); return val; }); } public static GameObject ClonePrefab(GameObject prefabToClone, string newName = null) { GameObject val = Object.Instantiate<GameObject>(prefabToClone, prefabParent.transform); ((Object)val).hideFlags = (HideFlags)61; if (newName != null) { ((Object)val).name = newName; } else { ((Object)val).name = ((Object)prefabToClone).name; } return val; } public static GameObject CreatePrefab(string name) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameObject val = new GameObject(name) { hideFlags = (HideFlags)61 }; val.transform.SetParent(prefabParent.transform); return val; } } public class TerminalUtils { public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false) { TerminalKeyword obj = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)obj).name = word; obj.word = word; obj.isVerb = isVerb; obj.compatibleNouns = compatibleNouns; obj.specialKeywordResult = specialKeywordResult; obj.defaultVerb = defaultVerb; obj.accessTerminalObjects = accessTerminalObjects; return obj; } } public class Utilities { [CompilerGenerated] private static class <>O { public static hook_Start <0>__StartOfRound_Start; public static hook_Start <1>__MenuManager_Start; } public static List<GameObject> prefabsToFix = new List<GameObject>(); public static List<GameObject> fixedPrefabs = new List<GameObject>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_003b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Start; if (obj == null) { hook_Start val = StartOfRound_Start; <>O.<0>__StartOfRound_Start = val; obj = (object)val; } StartOfRound.Start += (hook_Start)obj; object obj2 = <>O.<1>__MenuManager_Start; if (obj2 == null) { hook_Start val2 = MenuManager_Start; <>O.<1>__MenuManager_Start = val2; obj2 = (object)val2; } MenuManager.Start += (hook_Start)obj2; } private static void StartOfRound_Start(orig_Start orig, StartOfRound self) { AudioMixer diageticMixer = SoundManager.Instance.diageticMixer; if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Diagetic mixer is " + ((Object)diageticMixer).name)); } Plugin.logger.LogInfo((object)$"Found {prefabsToFix.Count} prefabs to fix"); List<GameObject> list = new List<GameObject>(); for (int num = prefabsToFix.Count - 1; num >= 0; num--) { GameObject val = prefabsToFix[num]; AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(); foreach (AudioSource val2 in componentsInChildren) { if ((Object)(object)val2.outputAudioMixerGroup == (Object)null || !(((Object)val2.outputAudioMixerGroup.audioMixer).name == "Diagetic")) { continue; } AudioMixerGroup val3 = diageticMixer.FindMatchingGroups(((Object)val2.outputAudioMixerGroup).name)[0]; if ((Object)(object)val3 != (Object)null) { val2.outputAudioMixerGroup = val3; if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Set mixer group for " + ((Object)val2).name + " in " + ((Object)val).name + " to Diagetic:" + ((Object)val3).name)); } list.Add(val); } } } foreach (GameObject item in list) { prefabsToFix.Remove(item); } orig.Invoke(self); } private static void MenuManager_Start(orig_Start orig, MenuManager self) { orig.Invoke(self); if ((Object)(object)((Component)self).GetComponent<AudioSource>() == (Object)null) { return; } AudioMixer audioMixer = ((Component)self).GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer; List<GameObject> list = new List<GameObject>(); for (int num = prefabsToFix.Count - 1; num >= 0; num--) { GameObject val = prefabsToFix[num]; AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(); foreach (AudioSource val2 in componentsInChildren) { if ((Object)(object)val2.outputAudioMixerGroup == (Object)null || !(((Object)val2.outputAudioMixerGroup.audioMixer).name == "NonDiagetic")) { continue; } AudioMixerGroup val3 = audioMixer.FindMatchingGroups(((Object)val2.outputAudioMixerGroup).name)[0]; if ((Object)(object)val3 != (Object)null) { val2.outputAudioMixerGroup = val3; if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Set mixer group for " + ((Object)val2).name + " in " + ((Object)val).name + " to NonDiagetic:" + ((Object)val3).name)); } list.Add(val); } } } foreach (GameObject item in list) { prefabsToFix.Remove(item); } } public static void FixMixerGroups(GameObject prefab) { if (!fixedPrefabs.Contains(prefab)) { fixedPrefabs.Add(prefab); prefabsToFix.Add(prefab); } } } } namespace LethalBestiary.Extras { [CreateAssetMenu(menuName = "ScriptableObjects/DungeonDef")] public class DungeonDef : ScriptableObject { public DungeonFlow dungeonFlow; [Range(0f, 300f)] public int rarity; public AudioClip firstTimeDungeonAudio; } [CreateAssetMenu(menuName = "ScriptableObjects/DungeonGraphLine")] public class DungeonGraphLineDef : ScriptableObject { public GraphLine graphLine; } public static class ScriptableObjectExtension { public static T Clone<T>(this T scriptableObject) where T : ScriptableObject { if ((Object)(object)scriptableObject == (Object)null) { Debug.LogError((object)$"ScriptableObject was null. Returning default {typeof(T)} object."); return (T)(object)ScriptableObject.CreateInstance(typeof(T)); } T val = Object.Instantiate<T>(scriptableObject); ((Object)(object)val).name = ((Object)(object)scriptableObject).name; return val; } } [CreateAssetMenu(menuName = "ScriptableObjects/GameObjectChance")] public class GameObjectChanceDef : ScriptableObject { public GameObjectChance gameObjectChance; } [CreateAssetMenu(menuName = "ScriptableObjects/SpawnableMapObject")] public class SpawnableMapObjectDef : ScriptableObject { public SpawnableMapObject spawnableMapObject; } [CreateAssetMenu(menuName = "ScriptableObjects/SpawnableOutsideObject")] public class SpawnableOutsideObjectDef : ScriptableObject { public SpawnableOutsideObjectWithRarity spawnableMapObject; } } namespace LethalLib { public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalBestiary"; public const string PLUGIN_NAME = "LethalBestiary"; public const string PLUGIN_VERSION = "1.2.1"; } } namespace LethalLib.EnemyHelper { public static class FlashLightEnemyHelper { public static bool CheckIfEnemyFlashed(Vector3 EnemyPosition, float angle = 20f) { //IL_001c: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.HasLineOfSightToPosition(EnemyPosition, 45f, 60, -1f)) { continue; } GrabbableObject[] itemSlots = val.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject.GetComponent<FlashlightItem>() != (Object)null && ((GrabbableObject)((Component)val2).gameObject.GetComponent<FlashlightItem>()).isBeingUsed && Vector3.Distance(((Component)val).transform.position, EnemyPosition) < 3f && val.LineOfSightToPositionAngle(EnemyPosition, 60, -1f) < 20f) { return true; } } } return false; } public static bool CheckIfEnemyFlashedByPlayer(Vector3 EnemyPosition, PlayerControllerB PlayerToCheck, float angle = 20f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (PlayerToCheck.HasLineOfSightToPosition(EnemyPosition, 45f, 60, -1f)) { GrabbableObject[] itemSlots = PlayerToCheck.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject.GetComponent<FlashlightItem>() != (Object)null && ((GrabbableObject)((Component)val).gameObject.GetComponent<FlashlightItem>()).isBeingUsed && Vector3.Distance(((Component)PlayerToCheck).transform.position, EnemyPosition) < 3f && PlayerToCheck.LineOfSightToPositionAngle(EnemyPosition, 60, -1f) < angle) { return true; } } } return false; } public static bool CheckIfPlayerHasFlashlight(PlayerControllerB PlayerToCheck, bool CheckIfOpened) { GrabbableObject[] itemSlots = PlayerToCheck.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject.GetComponent<FlashlightItem>() != (Object)null && CheckIfOpened && ((GrabbableObject)((Component)val).gameObject.GetComponent<FlashlightItem>()).isBeingUsed) { return true; } } return false; } } public static class TeleportEnemy { public static void FindValidTeleportPositionRadius(Vector3 position, float MinRadius, float MaxRadius, bool MustHavePath = true) { } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace LethalBestiary.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/ZoLoKinoBabo112/LethalLib.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using LethalLib.Extras; using LethalLib.Modules; using LethalLib.NetcodePatcher; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("Evaisa")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Content-addition API for Lethal Company")] [assembly: AssemblyFileVersion("0.16.1.0")] [assembly: AssemblyInformationalVersion("0.16.1+1544246572e61ff167c447c6c4ceee7f9c8c05d5")] [assembly: AssemblyProduct("LethalLib")] [assembly: AssemblyTitle("LethalLib")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EvaisaDev/LethalLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalLib { [BepInPlugin("evaisa.lethallib", "LethalLib", "0.16.1")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "evaisa.lethallib"; public const string ModName = "LethalLib"; public const string ModVersion = "0.16.1"; public static AssetBundle MainAssets; public static ManualLogSource logger; public static ConfigFile config; public static Plugin Instance; public static ConfigEntry<bool> extendedLogging; private void Awake() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Instance = this; config = ((BaseUnityPlugin)this).Config; logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalLib loaded!!"); extendedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging"); MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lethallib")); new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook)); Enemies.Init(); Items.Init(); Unlockables.Init(); MapObjects.Init(); Dungeon.Init(); Weathers.Init(); Player.Init(); Utilities.Init(); NetworkPrefabs.Init(); } private void IlHook(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown ILCursor val = new ILCursor(il); MethodInfo getFileLineNumberMethod = typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)getFileLineNumberMethod) })) { val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } } private static string GetLineOrIL(StackFrame instance) { int fileLineNumber = instance.GetFileLineNumber(); if (fileLineNumber == -1 || fileLineNumber == 0) { return "IL_" + instance.GetILOffset().ToString("X4"); } return fileLineNumber.ToString(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalLib"; public const string PLUGIN_NAME = "LethalLib"; public const string PLUGIN_VERSION = "0.16.1"; } } namespace LethalLib.Modules { public class ContentLoader { public class CustomContent { private string id = ""; public string ID => id; public CustomContent(string id) { this.id = id; } } public class CustomItem : CustomContent { public Action<Item> registryCallback = delegate { }; public string contentPath = ""; internal Item item; public Item Item => item; public CustomItem(string id, string contentPath, Action<Item> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } } } public class ShopItem : CustomItem { public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public void RemoveFromShop() { Items.RemoveShopItem(base.Item); } public void SetPrice(int price) { Items.UpdateShopItemPrice(base.Item, price); } public ShopItem(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; } } public class ScrapItem : CustomItem { public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public int Rarity => 0; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Items.RemoveScrapFromLevels(base.Item, levelFlags); } public ScrapItem(string id, string contentPath, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelFlags != Levels.LevelTypes.None) { levelRarities.Add(levelFlags, rarity); } else if (levelOverrides != null) { foreach (string key in levelOverrides) { customLevelRarities.Add(key, rarity); } } } public ScrapItem(string id, string contentPath, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } } } public class Unlockable : CustomContent { public Action<UnlockableItem> registryCallback = delegate { }; internal UnlockableItem unlockable; public string contentPath = ""; public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public StoreType storeType; public UnlockableItem UnlockableItem => unlockable; public void RemoveFromShop() { Unlockables.DisableUnlockable(UnlockableItem); } public void SetPrice(int price) { Unlockables.UpdateUnlockablePrice(UnlockableItem, price); } public Unlockable(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, StoreType storeType = StoreType.None, Action<UnlockableItem> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; this.storeType = storeType; } } public class CustomEnemy : CustomContent { public Action<EnemyType> registryCallback = delegate { }; public string contentPath = ""; internal EnemyType enemy; public string infoNodePath; public string infoKeywordPath; public int rarity; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1); public EnemyType Enemy => enemy; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Enemies.RemoveEnemyFromLevels(Enemy, levelFlags); } public CustomEnemy(string id, string contentPath, int rarity = 0, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1), string[] levelOverrides = null, string infoNodePath = null, string infoKeywordPath = null, Action<EnemyType> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } this.infoNodePath = infoNodePath; this.infoKeywordPath = infoKeywordPath; this.rarity = rarity; LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnType = spawnType; } } public class MapHazard : CustomContent { public Action<SpawnableMapObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableMapObjectDef hazard; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableMapObjectDef Hazard => hazard; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveMapObject(Hazard, levelFlags, levelOverrides); } public MapHazard(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableMapObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public class OutsideObject : CustomContent { public Action<SpawnableOutsideObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableOutsideObjectDef mapObject; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableOutsideObjectDef MapObject => mapObject; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveOutsideObject(MapObject, levelFlags, levelOverrides); } public OutsideObject(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableOutsideObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public PluginInfo modInfo; private AssetBundle modBundle; public Action<CustomContent, GameObject> prefabCallback = delegate { }; public Dictionary<string, CustomContent> LoadedContent { get; } = new Dictionary<string, CustomContent>(); public string modName => modInfo.Metadata.Name; public string modVersion => modInfo.Metadata.Version.ToString(); public string modGUID => modInfo.Metadata.GUID; public ContentLoader(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { this.modInfo = modInfo; this.modBundle = modBundle; if (prefabCallback != null) { this.prefabCallback = prefabCallback; } } public ContentLoader Create(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { return new ContentLoader(modInfo, modBundle, prefabCallback); } public void Register(CustomContent content) { if (LoadedContent.ContainsKey(content.ID)) { Debug.LogError((object)("[LethalLib] " + modName + " tried to register content with ID " + content.ID + " but it already exists!")); return; } if (content is CustomItem customItem) { Item val = (customItem.item = modBundle.LoadAsset<Item>(customItem.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); prefabCallback(customItem, val.spawnPrefab); customItem.registryCallback(val); if (content is ShopItem shopItem) { TerminalNode buyNode = null; TerminalNode buyNode2 = null; TerminalNode itemInfo = null; if (shopItem.buyNode1Path != null) { buyNode = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode1Path); } if (shopItem.buyNode2Path != null) { buyNode2 = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode2Path); } if (shopItem.itemInfoPath != null) { itemInfo = modBundle.LoadAsset<TerminalNode>(shopItem.itemInfoPath); } Items.RegisterShopItem(val, buyNode, buyNode2, itemInfo, shopItem.initPrice); } else if (content is ScrapItem scrapItem) { Items.RegisterScrap(val, scrapItem.levelRarities, scrapItem.customLevelRarities); } else { Items.RegisterItem(val); } } else if (content is Unlockable unlockable) { UnlockableItemDef unlockableItemDef = modBundle.LoadAsset<UnlockableItemDef>(unlockable.contentPath); if ((Object)(object)unlockableItemDef.unlockable.prefabObject != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(unlockableItemDef.unlockable.prefabObject); prefabCallback(content, unlockableItemDef.unlockable.prefabObject); Utilities.FixMixerGroups(unlockableItemDef.unlockable.prefabObject); } unlockable.unlockable = unlockableItemDef.unlockable; unlockable.registryCallback(unlockableItemDef.unlockable); TerminalNode buyNode3 = null; TerminalNode buyNode4 = null; TerminalNode itemInfo2 = null; if (unlockable.buyNode1Path != null) { buyNode3 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode1Path); } if (unlockable.buyNode2Path != null) { buyNode4 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode2Path); } if (unlockable.itemInfoPath != null) { itemInfo2 = modBundle.LoadAsset<TerminalNode>(unlockable.itemInfoPath); } Unlockables.RegisterUnlockable(unlockableItemDef, unlockable.storeType, buyNode3, buyNode4, itemInfo2, unlockable.initPrice); } else if (content is CustomEnemy customEnemy) { EnemyType val2 = modBundle.LoadAsset<EnemyType>(customEnemy.contentPath); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); Utilities.FixMixerGroups(val2.enemyPrefab); customEnemy.enemy = val2; prefabCallback(content, val2.enemyPrefab); customEnemy.registryCallback(val2); TerminalNode infoNode = null; TerminalKeyword infoKeyword = null; if (customEnemy.infoNodePath != null) { infoNode = modBundle.LoadAsset<TerminalNode>(customEnemy.infoNodePath); } if (customEnemy.infoKeywordPath != null) { infoKeyword = modBundle.LoadAsset<TerminalKeyword>(customEnemy.infoKeywordPath); } if (customEnemy.spawnType == (Enemies.SpawnType)(-1)) { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.levelOverrides, infoNode, infoKeyword); } else { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.spawnType, customEnemy.levelOverrides, infoNode, infoKeyword); } } else if (content is MapHazard mapHazard) { SpawnableMapObjectDef spawnableMapObjectDef = (mapHazard.hazard = modBundle.LoadAsset<SpawnableMapObjectDef>(mapHazard.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); prefabCallback(content, spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); mapHazard.registryCallback(spawnableMapObjectDef); MapObjects.RegisterMapObject(spawnableMapObjectDef, mapHazard.LevelTypes, mapHazard.levelOverrides, mapHazard.spawnRateFunction); } else if (content is OutsideObject outsideObject) { SpawnableOutsideObjectDef spawnableOutsideObjectDef = (outsideObject.mapObject = modBundle.LoadAsset<SpawnableOutsideObjectDef>(outsideObject.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); prefabCallback(content, spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); outsideObject.registryCallback(spawnableOutsideObjectDef); MapObjects.RegisterOutsideObject(spawnableOutsideObjectDef, outsideObject.LevelTypes, outsideObject.levelOverrides, outsideObject.spawnRateFunction); } LoadedContent.Add(content.ID, content); } public void RegisterAll(CustomContent[] content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Length} content items!"); foreach (CustomContent content2 in content) { Register(content2); } } public void RegisterAll(List<CustomContent> content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Count} content items!"); foreach (CustomContent item in content) { Register(item); } } } public class Dungeon { public class CustomDungeonArchetype { public DungeonArchetype archeType; public Levels.LevelTypes LevelTypes; public int lineIndex = -1; } public class CustomGraphLine { public GraphLine graphLine; public Levels.LevelTypes LevelTypes; } public class CustomDungeon { public int rarity; public DungeonFlow dungeonFlow; public Levels.LevelTypes LevelTypes; public string[] levelOverrides; public int dungeonIndex = -1; public AudioClip firstTimeDungeonAudio; } [CompilerGenerated] private static class <>O { public static hook_GenerateNewFloor <0>__RoundManager_GenerateNewFloor; public static hook_Start <1>__RoundManager_Start; } public static List<CustomDungeonArchetype> customDungeonArchetypes = new List<CustomDungeonArchetype>(); public static List<CustomGraphLine> customGraphLines = new List<CustomGraphLine>(); public static Dictionary<string, TileSet> extraTileSets = new Dictionary<string, TileSet>(); public static Dictionary<string, GameObjectChance> extraRooms = new Dictionary<string, GameObjectChance>(); public static List<CustomDungeon> customDungeons = new List<CustomDungeon>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_003b: Expected O, but got Unknown object obj = <>O.<0>__RoundManager_GenerateNewFloor; if (obj == null) { hook_GenerateNewFloor val = RoundManager_GenerateNewFloor; <>O.<0>__RoundManager_GenerateNewFloor = val; obj = (object)val; } RoundManager.GenerateNewFloor += (hook_GenerateNewFloor)obj; object obj2 = <>O.<1>__RoundManager_Start; if (obj2 == null) { hook_Start val2 = RoundManager_Start; <>O.<1>__RoundManager_Start = val2; obj2 = (object)val2; } RoundManager.Start += (hook_Start)obj2; } private static void RoundManager_Start(orig_Start orig, RoundManager self) { orig.Invoke(self); } private static void RoundManager_GenerateNewFloor(orig_GenerateNewFloor orig, RoundManager self) { string name = ((Object)self.currentLevel).name; if (Enum.IsDefined(typeof(Levels.LevelTypes), name)) { Levels.LevelTypes levelEnum = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name); int index = 0; self.dungeonGenerator.Generator.DungeonFlow.Lines.ForEach(delegate(GraphLine line) { foreach (CustomDungeonArchetype customDungeonArchetype in customDungeonArchetypes) { if (customDungeonArchetype.LevelTypes.HasFlag(levelEnum) && !line.DungeonArchetypes.Contains(customDungeonArchetype.archeType) && (customDungeonArchetype.lineIndex == -1 || customDungeonArchetype.lineIndex == index)) { line.DungeonArchetypes.Add(customDungeonArchetype.archeType); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)customDungeonArchetype.archeType).name + " to " + name)); } } } foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { string name2 = ((Object)dungeonArchetype).name; if (extraTileSets.ContainsKey(name2)) { TileSet val4 = extraTileSets[name2]; if (!dungeonArchetype.TileSets.Contains(val4)) { dungeonArchetype.TileSets.Add(val4); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)val4).name + " to " + name)); } } } foreach (TileSet tileSet in dungeonArchetype.TileSets) { string name3 = ((Object)tileSet).name; if (extraRooms.ContainsKey(name3)) { GameObjectChance item = extraRooms[name3]; if (!tileSet.TileWeights.Weights.Contains(item)) { tileSet.TileWeights.Weights.Add(item); } } } } index++; }); foreach (CustomGraphLine customGraphLine in customGraphLines) { if (customGraphLine.LevelTypes.HasFlag(levelEnum) && !self.dungeonGenerator.Generator.DungeonFlow.Lines.Contains(customGraphLine.graphLine)) { self.dungeonGenerator.Generator.DungeonFlow.Lines.Add(customGraphLine.graphLine); } } } orig.Invoke(self); NetworkManager val = Object.FindObjectOfType<NetworkManager>(); RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val2 in array) { for (int j = 0; j < val2.spawnablePrefabs.Count; j++) { string prefabName = ((Object)val2.spawnablePrefabs[j]).name; NetworkPrefab val3 = ((IEnumerable<NetworkPrefab>)val.NetworkConfig.Prefabs.m_Prefabs).FirstOrDefault((Func<NetworkPrefab, bool>)((NetworkPrefab x) => ((Object)x.Prefab).name == prefabName)); if (val3 != null && (Object)(object)val3.Prefab != (Object)(object)val2.spawnablePrefabs[j]) { val2.spawnablePrefabs[j] = val3.Prefab; } else if (val3 == null) { Plugin.logger.LogError((object)("DungeonGeneration - Could not find network prefab (" + prefabName + ")! Make sure your assigned prefab is registered with the network manager, or named identically to the vanilla prefab you are referencing.")); } } } } public static void AddArchetype(DungeonArchetype archetype, Levels.LevelTypes levelFlags, int lineIndex = -1) { CustomDungeonArchetype customDungeonArchetype = new CustomDungeonArchetype(); customDungeonArchetype.archeType = archetype; customDungeonArchetype.LevelTypes = levelFlags; customDungeonArchetype.lineIndex = lineIndex; customDungeonArchetypes.Add(customDungeonArchetype); } public static void AddLine(GraphLine line, Levels.LevelTypes levelFlags) { CustomGraphLine customGraphLine = new CustomGraphLine(); customGraphLine.graphLine = line; customGraphLine.LevelTypes = levelFlags; customGraphLines.Add(customGraphLine); } public static void AddLine(DungeonGraphLineDef line, Levels.LevelTypes levelFlags) { AddLine(line.graphLine, levelFlags); } public static void AddTileSet(TileSet set, string archetypeName) { extraTileSets.Add(archetypeName, set); } public static void AddRoom(GameObjectChance room, string tileSetName) { extraRooms.Add(tileSetName, room); } public static void AddRoom(GameObjectChanceDef room, string tileSetName) { AddRoom(room.gameObjectChance, tileSetName); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags, string[] levelOverrides) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, levelOverrides, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio }); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, string[] levelOverrides = null, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio, levelOverrides = levelOverrides }); } } public class Enemies { public struct EnemyAssetInfo { public EnemyType EnemyAsset; public TerminalKeyword keyword; } public enum SpawnType { Default, Daytime, Outside } public class SpawnableEnemy { public EnemyType enemy; public SpawnType spawnType; public TerminalNode terminalNode; public TerminalKeyword infoKeyword; public string modName; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType, string[] spawnLevelOverrides = null) { this.enemy = enemy; this.spawnLevels = spawnLevels; this.spawnType = spawnType; if (spawnLevelOverrides != null) { foreach (string levelName in spawnLevelOverrides) { customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public SpawnableEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { this.enemy = enemy; this.spawnType = spawnType; if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = Levels.Compatibility.LLLifyLevelRarityDictionary(customLevelRarities); } } } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__RegisterLevelEnemies; public static hook_Start <1>__Terminal_Start; public static hook_Start <2>__QuickMenuManager_Start; public static hook_Start <3>__RegisterLevelEnemiesforLLL_RoundManager_Start; public static hook_Start <4>__RegisterLevelEnemiesforLE_Terminal_Start; } private static List<SelectableLevel> levelsAlreadyAddedTo = new List<SelectableLevel>(); private static bool addedToDebug = false; public static Terminal terminal; public static List<EnemyAssetInfo> enemyAssetInfos = new List<EnemyAssetInfo>(); public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_003b: Expected O, but got Unknown //IL_0050: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__RegisterLevelEnemies; if (obj == null) { hook_Awake val = RegisterLevelEnemies; <>O.<0>__RegisterLevelEnemies = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_Start; if (obj2 == null) { hook_Start val2 = Terminal_Start; <>O.<1>__Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; object obj3 = <>O.<2>__QuickMenuManager_Start; if (obj3 == null) { hook_Start val3 = QuickMenuManager_Start; <>O.<2>__QuickMenuManager_Start = val3; obj3 = (object)val3; } QuickMenuManager.Start += (hook_Start)obj3; } private static void QuickMenuManager_Start(orig_Start orig, QuickMenuManager self) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (addedToDebug) { orig.Invoke(self); return; } SelectableLevel testAllEnemiesLevel = self.testAllEnemiesLevel; List<SpawnableEnemyWithRarity> enemies = testAllEnemiesLevel.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = testAllEnemiesLevel.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = testAllEnemiesLevel.OutsideEnemies; foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { continue; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = spawnableEnemy.rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { enemies.Add(item); } break; case SpawnType.Daytime: if (!daytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { daytimeEnemies.Add(item); } break; case SpawnType.Outside: if (!outsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { outsideEnemies.Add(item); } break; } if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {spawnableEnemy.enemy.enemyName} to DebugList [{spawnableEnemy.spawnType}]"); } } addedToDebug = true; orig.Invoke(self); } private static void Terminal_Start(orig_Start orig, Terminal self) { //IL_0252: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown terminal = self; TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); List<string> list = new List<string>(); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (list.Contains(spawnableEnemy.enemy.enemyName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } if ((Object)(object)spawnableEnemy.terminalNode == (Object)null) { spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>(); spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n"; spawnableEnemy.terminalNode.clearPreviousText = true; spawnableEnemy.terminalNode.maxCharactersToType = 35; spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName; } if (self.enemyFiles.Any((TerminalNode x) => x.creatureName == spawnableEnemy.terminalNode.creatureName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } TerminalKeyword keyword2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val)); keyword2.defaultVerb = val; List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); if (!list2.Any((TerminalKeyword x) => x.word == keyword2.word)) { list2.Add(keyword2); self.terminalNodes.allKeywords = list2.ToArray(); } List<CompatibleNoun> list3 = val.compatibleNouns.ToList(); if (!list3.Any((CompatibleNoun x) => x.noun.word == keyword2.word)) { list3.Add(new CompatibleNoun { noun = keyword2, result = spawnableEnemy.terminalNode }); } val.compatibleNouns = list3.ToArray(); spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count; self.enemyFiles.Add(spawnableEnemy.terminalNode); ScanNodeProperties[] componentsInChildren = spawnableEnemy.enemy.enemyPrefab.GetComponentsInChildren<ScanNodeProperties>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].creatureScanID = spawnableEnemy.terminalNode.creatureFileID; } EnemyAssetInfo enemyAssetInfo = default(EnemyAssetInfo); enemyAssetInfo.EnemyAsset = spawnableEnemy.enemy; enemyAssetInfo.keyword = keyword2; EnemyAssetInfo item = enemyAssetInfo; enemyAssetInfos.Add(item); } orig.Invoke(self); } private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_006f: 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_007a: Expected O, but got Unknown orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader") || Chainloader.PluginInfos.ContainsKey("iambatby.lethallevelloader")) { object obj = <>O.<3>__RegisterLevelEnemiesforLLL_RoundManager_Start; if (obj == null) { hook_Start val = RegisterLevelEnemiesforLLL_RoundManager_Start; <>O.<3>__RegisterLevelEnemiesforLLL_RoundManager_Start = val; obj = (object)val; } RoundManager.Start += (hook_Start)obj; } if (Chainloader.PluginInfos.ContainsKey("LethalExpansion")) { object obj2 = <>O.<4>__RegisterLevelEnemiesforLE_Terminal_Start; if (obj2 == null) { hook_Start val2 = RegisterLevelEnemiesforLE_Terminal_Start; <>O.<4>__RegisterLevelEnemiesforLE_Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; } } private static void RegisterLevelEnemiesforLLL_RoundManager_Start(orig_Start orig, RoundManager self) { orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); } private static void RegisterLevelEnemiesforLE_Terminal_Start(orig_Start orig, Terminal self) { orig.Invoke(self); RegisterLethalLibEnemiesForAllLevels(); } private static void RegisterLethalLibEnemiesForAllLevels() { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (levelsAlreadyAddedTo.Contains(val)) { continue; } foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { AddEnemyToLevel(spawnableEnemy, val); } levelsAlreadyAddedTo.Add(val); } } private static void AddEnemyToLevel(SpawnableEnemy spawnableEnemy, SelectableLevel level) { //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown SpawnableEnemy spawnableEnemy2 = spawnableEnemy; string text = ((Object)level).name; bool flag = spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.All) || spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Vanilla) || (spawnableEnemy2.customLevelRarities != null && spawnableEnemy2.customLevelRarities.ContainsKey(text)); if (spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), text)) { flag = true; } Levels.LevelTypes levelTypes = Levels.LevelTypes.None; bool flag2 = false; if (Enum.IsDefined(typeof(Levels.LevelTypes), text)) { levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), text); flag2 = true; } else { text = Levels.Compatibility.GetLLLNameOfLevel(text); } if (!(flag2 || flag)) { return; } Levels.LevelTypes key = (flag ? Levels.LevelTypes.All : levelTypes); if (!flag && !spawnableEnemy2.levelRarities.ContainsKey(key)) { return; } int num = 0; if (flag2 && spawnableEnemy2.levelRarities.ContainsKey(levelTypes)) { num = spawnableEnemy2.levelRarities[levelTypes]; } else if (flag2 && spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Vanilla)) { num = spawnableEnemy2.levelRarities[Levels.LevelTypes.Vanilla]; } else if (!flag2 && spawnableEnemy2.customLevelRarities != null && spawnableEnemy2.customLevelRarities.ContainsKey(text)) { num = spawnableEnemy2.customLevelRarities[text]; } else if (!flag2 && spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.Modded)) { num = spawnableEnemy2.levelRarities[Levels.LevelTypes.Modded]; } else if (spawnableEnemy2.levelRarities.ContainsKey(Levels.LevelTypes.All)) { num = spawnableEnemy2.levelRarities[Levels.LevelTypes.All]; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy2.enemy, rarity = num }; switch (spawnableEnemy2.spawnType) { case SpawnType.Default: if (!level.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.Enemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} and SpawnType [Default]"); } } break; case SpawnType.Daytime: if (!level.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.DaytimeEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} andSpawnType [Daytime]"); } } break; case SpawnType.Outside: if (!level.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy2.enemy)) { level.OutsideEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"To {text} added {((Object)spawnableEnemy2.enemy).name} with weight {num} and SpawnType [Outside]"); } } break; } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; EnemyNullCheck(enemy2); SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelFlags != Levels.LevelTypes.None) { spawnableEnemy.levelRarities.Add(levelFlags, rarity); } if (spawnLevelOverrides != null) { foreach (string levelName in spawnLevelOverrides) { spawnableEnemy.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } } else { spawnableEnemy = new SpawnableEnemy(enemy2, rarity, levelFlags, spawnType, spawnLevelOverrides); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; FinalizeRegisterEnemy(spawnableEnemy); } } public static void RegisterEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; EnemyNullCheck(enemy2); SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { spawnableEnemy.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { spawnableEnemy.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(customLevelRarity.Key), customLevelRarity.Value); } return; } } spawnableEnemy = new SpawnableEnemy(enemy2, spawnType, levelRarities, customLevelRarities); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; FinalizeRegisterEnemy(spawnableEnemy); } private static void FinalizeRegisterEnemy(SpawnableEnemy spawnableEnemy) { string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; if (spawnableEnemy.enemy.enemyPrefab == null) { throw new NullReferenceException("Cannot register enemy '" + spawnableEnemy.enemy.enemyName + "', because enemy.enemyPrefab is null!"); } EnemyAICollisionDetect[] componentsInChildren = spawnableEnemy.enemy.enemyPrefab.GetComponentsInChildren<EnemyAICollisionDetect>(); foreach (EnemyAICollisionDetect val in componentsInChildren) { if (val.mainScript == null) { Plugin.logger.LogWarning((object)("An Enemy AI Collision Detect Script on GameObject '" + ((Object)((Component)val).gameObject).name + "' of enemy '" + spawnableEnemy.enemy.enemyName + "' does not reference a 'Main Script', and could cause Null Reference Exceptions.")); } } spawnableEnemies.Add(spawnableEnemy); } private static void EnemyNullCheck(EnemyType enemy) { if (enemy == null) { throw new ArgumentNullException("enemy", "The first argument of RegisterEnemy was null!"); } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, spawnLevelOverrides, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyNullCheck(enemy); SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, spawnType, levelRarities, customLevelRarities, infoNode, infoKeyword); } public static void RemoveEnemyFromLevels(EnemyType enemyType, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { EnemyType enemyType2 = enemyType; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; if (!Enum.IsDefined(typeof(Levels.LevelTypes), name)) { name = Levels.Compatibility.GetLLLNameOfLevel(name); } bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => Levels.Compatibility.GetLLLNameOfLevel(item).ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { List<SpawnableEnemyWithRarity> enemies = val.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = val.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = val.OutsideEnemies; enemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); daytimeEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); outsideEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Removed Enemy " + ((Object)enemyType2).name + " from Level " + name)); } } } } } public class Items { public struct ItemSaveOrderData { public int itemId; public string itemName; public string assetName; } public struct BuyableItemAssetInfo { public Item itemAsset; public TerminalKeyword keyword; } public class ScrapItem { public Item item; public Item origItem; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public string modName = "Unknown"; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.LevelTypes.None, string[] spawnLevelOverrides = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (spawnLevelOverrides != null) { foreach (string levelName in spawnLevelOverrides) { customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public ScrapItem(Item item, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (customLevelRarities != null) { this.customLevelRarities = Levels.Compatibility.LLLifyLevelRarityDictionary(customLevelRarities); } if (levelRarities != null) { this.levelRarities = levelRarities; } } } public class PlainItem { public Item item; public string modName; public PlainItem(Item item) { this.item = item; } } public class ShopItem { public Item item; public Item origItem; public TerminalNode buyNode1; public TerminalNode buyNode2; public TerminalNode itemInfo; public bool wasRemoved; public int price; public string modName; public ShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0) { origItem = item; this.item = item; this.price = price; if ((Object)(object)buyNode1 != (Object)null) { this.buyNode1 = buyNode1; } if ((Object)(object)buyNode2 != (Object)null) { this.buyNode2 = buyNode2; } if ((Object)(object)itemInfo != (Object)null) { this.itemInfo = itemInfo; } } } [CompilerGenerated] private static class <>O { public static hook_Start <0>__StartOfRound_Start; public static hook_Awake <1>__Terminal_Awake; public static hook_TextPostProcess <2>__Terminal_TextPostProcess; public static hook_Start <3>__RegisterLevelScrapforLLL_RoundManager_Start; public static hook_Start <4>__RegisterLevelScrapforLE_Terminal_Start; } public static ConfigEntry<bool> useSavedataFix; public static GameObject scanNodePrefab; private static List<SelectableLevel> levelsAlreadyAddedTo = new List<SelectableLevel>(); public static List<Item> LethalLibItemList = new List<Item>(); public static List<BuyableItemAssetInfo> buyableItemAssetInfos = new List<BuyableItemAssetInfo>(); public static Terminal terminal; public static List<ScrapItem> scrapItems = new List<ScrapItem>(); public static List<ShopItem> shopItems = new List<ShopItem>(); public static List<PlainItem> plainItems = new List<PlainItem>(); public static void Init() { //IL_0043: 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_004e: Expected O, but got Unknown //IL_0063: 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_006e: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown useSavedataFix = Plugin.config.Bind<bool>("Items", "EnableItemSaveFix", false, "Allow for LethalLib to store/reorder the item list, which should fix issues where items get reshuffled when loading an old save. This is experimental and may cause save corruptions occasionally."); scanNodePrefab = Plugin.MainAssets.LoadAsset<GameObject>("Assets/Custom/ItemScanNode.prefab"); object obj = <>O.<0>__StartOfRound_Start; if (obj == null) { hook_Start val = StartOfRound_Start; <>O.<0>__StartOfRound_Start = val; obj = (object)val; } StartOfRound.Start += (hook_Start)obj; object obj2 = <>O.<1>__Terminal_Awake; if (obj2 == null) { hook_Awake val2 = Terminal_Awake; <>O.<1>__Terminal_Awake = val2; obj2 = (object)val2; } Terminal.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__Terminal_TextPostProcess; if (obj3 == null) { hook_TextPostProcess val3 = Terminal_TextPostProcess; <>O.<2>__Terminal_TextPostProcess = val3; obj3 = (object)val3; } Terminal.TextPostProcess += (hook_TextPostProcess)obj3; } private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node) { List<Item> list = self.buyableItemsList.ToList(); List<Item> list2 = self.buyableItemsList.ToList(); list2.RemoveAll((Item x) => shopItems.FirstOrDefault((ShopItem item) => (Object)(object)item.origItem == (Object)(object)x || (Object)(object)item.item == (Object)(object)x)?.wasRemoved ?? false); self.buyableItemsList = list2.ToArray(); string result = orig.Invoke(self, modifiedDisplayText, node); self.buyableItemsList = list.ToArray(); return result; } private static void StartOfRound_Start(orig_Start orig, StartOfRound self) { if (useSavedataFix.Value && ((NetworkBehaviour)self).IsHost) { Plugin.logger.LogInfo((object)"Fixing Item savedata!!"); List<ItemSaveOrderData> itemList = new List<ItemSaveOrderData>(); StartOfRound.Instance.allItemsList.itemsList.ForEach(delegate(Item item) { itemList.Add(new ItemSaveOrderData { itemId = item.itemId, itemName = item.itemName, assetName = ((Object)item).name }); }); if (ES3.KeyExists("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName)) { itemList = ES3.Load<List<ItemSaveOrderData>>("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName); } List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList; List<Item> list = new List<Item>(); foreach (ItemSaveOrderData item2 in itemList) { Item val = ((IEnumerable<Item>)itemsList).FirstOrDefault((Func<Item, bool>)((Item x) => x.itemId == item2.itemId && x.itemName == item2.itemName && item2.assetName == ((Object)x).name)); if ((Object)(object)val != (Object)null) { list.Add(val); } else { list.Add(ScriptableObject.CreateInstance<Item>()); } } foreach (Item item3 in itemsList) { if (!list.Contains(item3)) { list.Add(item3); } } StartOfRound.Instance.allItemsList.itemsList = list; ES3.Save<List<ItemSaveOrderData>>("LethalLibAllItemsList", itemList, GameNetworkManager.Instance.currentSaveFileName); } orig.Invoke(self); } private static void RegisterLevelScrapforLLL_RoundManager_Start(orig_Start orig, RoundManager self) { orig.Invoke(self); RegisterLethalLibScrapItemsForAllLevels(); } private static void RegisterLevelScrapforLE_Terminal_Start(orig_Start orig, Terminal self) { orig.Invoke(self); RegisterLethalLibScrapItemsForAllLevels(); } private static void RegisterLethalLibScrapItemsForAllLevels() { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (levelsAlreadyAddedTo.Contains(val)) { continue; } foreach (ScrapItem scrapItem in scrapItems) { AddScrapItemToLevel(scrapItem, val); } levelsAlreadyAddedTo.Add(val); } } private static void AddScrapItemToLevel(ScrapItem scrapItem, SelectableLevel level) { //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0229: Expected O, but got Unknown ScrapItem scrapItem2 = scrapItem; string text = ((Object)level).name; bool flag = scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.All) || scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.Vanilla) || (scrapItem2.customLevelRarities != null && scrapItem2.customLevelRarities.ContainsKey(text)); if (scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), text)) { flag = true; } Levels.LevelTypes key = Levels.LevelTypes.None; bool flag2 = false; if (Enum.IsDefined(typeof(Levels.LevelTypes), text)) { key = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), text); flag2 = true; } else { text = Levels.Compatibility.GetLLLNameOfLevel(text); } if (!(flag2 || flag)) { return; } Levels.LevelTypes key2 = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), text))); if (!flag && !scrapItem2.levelRarities.ContainsKey(key2)) { return; } int rarity = 0; if (flag2 && scrapItem2.levelRarities.ContainsKey(key)) { rarity = scrapItem2.levelRarities[key]; } else if (flag2 && scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.Vanilla)) { rarity = scrapItem2.levelRarities[Levels.LevelTypes.Vanilla]; } else if (!flag2 && scrapItem2.customLevelRarities != null && scrapItem2.customLevelRarities.ContainsKey(text)) { rarity = scrapItem2.customLevelRarities[text]; } else if (!flag2 && scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.Modded)) { rarity = scrapItem2.levelRarities[Levels.LevelTypes.Modded]; } else if (scrapItem2.levelRarities.ContainsKey(Levels.LevelTypes.All)) { rarity = scrapItem2.levelRarities[Levels.LevelTypes.All]; } SpawnableItemWithRarity item = new SpawnableItemWithRarity { spawnableItem = scrapItem2.item, rarity = rarity }; if (!level.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrapItem2.item)) { level.spawnableScrap.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("To " + text + " added " + ((Object)scrapItem2.item).name)); } } } private static void RegisterScrapAsItem(StartOfRound startOfRound) { foreach (ScrapItem scrapItem in scrapItems) { if (startOfRound.allItemsList.itemsList.Contains(scrapItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (scrapItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(scrapItem.modName + " registered scrap item: " + scrapItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered scrap item: " + scrapItem.item.itemName)); } } LethalLibItemList.Add(scrapItem.item); startOfRound.allItemsList.itemsList.Add(scrapItem.item); } } private static void Terminal_Awake(orig_Awake orig, Terminal self) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Expected O, but got Unknown //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Expected O, but got Unknown //IL_070a: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Expected O, but got Unknown StartOfRound instance = StartOfRound.Instance; RegisterLethalLibScrapItemsForAllLevels(); if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader") || Chainloader.PluginInfos.ContainsKey("iambatby.lethallevelloader")) { object obj = <>O.<3>__RegisterLevelScrapforLLL_RoundManager_Start; if (obj == null) { hook_Start val = RegisterLevelScrapforLLL_RoundManager_Start; <>O.<3>__RegisterLevelScrapforLLL_RoundManager_Start = val; obj = (object)val; } RoundManager.Start += (hook_Start)obj; } if (Chainloader.PluginInfos.ContainsKey("LethalExpansion")) { object obj2 = <>O.<4>__RegisterLevelScrapforLE_Terminal_Start; if (obj2 == null) { hook_Start val2 = RegisterLevelScrapforLE_Terminal_Start; <>O.<4>__RegisterLevelScrapforLE_Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; } RegisterScrapAsItem(instance); foreach (ShopItem shopItem in shopItems) { if (instance.allItemsList.itemsList.Contains(shopItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (shopItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(shopItem.modName + " registered shop item: " + shopItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered shop item: " + shopItem.item.itemName)); } } LethalLibItemList.Add(shopItem.item); instance.allItemsList.itemsList.Add(shopItem.item); } foreach (PlainItem plainItem in plainItems) { if (instance.allItemsList.itemsList.Contains(plainItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (plainItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(plainItem.modName + " registered item: " + plainItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered item: " + plainItem.item.itemName)); } } LethalLibItemList.Add(plainItem.item); instance.allItemsList.itemsList.Add(plainItem.item); } terminal = self; List<Item> list = self.buyableItemsList.ToList(); TerminalKeyword val3 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); TerminalNode result = val3.compatibleNouns[0].result.terminalOptions[1].result; TerminalKeyword val4 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); Plugin.logger.LogInfo((object)$"Adding {shopItems.Count} items to terminal"); foreach (ShopItem item in shopItems) { if (list.Any((Item x) => x.itemName == item.item.itemName) && !item.wasRemoved) { Plugin.logger.LogInfo((object)("Item " + item.item.itemName + " already exists in terminal, skipping")); continue; } item.wasRemoved = false; if (item.price == -1) { item.price = item.item.creditsWorth; } else { item.item.creditsWorth = item.price; } int num = -1; if (!list.Any((Item x) => (Object)(object)x == (Object)(object)item.item)) { list.Add(item.item); } else { num = list.IndexOf(item.item); } int buyItemIndex = ((num == -1) ? (list.Count - 1) : num); string itemName = item.item.itemName; _ = itemName[itemName.Length - 1]; string text = itemName; TerminalNode val5 = item.buyNode2; if ((Object)(object)val5 == (Object)null) { val5 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val5).name = itemName.Replace(" ", "-") + "BuyNode2"; val5.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n"; val5.clearPreviousText = true; val5.maxCharactersToType = 15; } val5.buyItemIndex = buyItemIndex; val5.isConfirmationNode = false; val5.itemCost = item.price; val5.playSyncedClip = 0; TerminalNode val6 = item.buyNode1; if ((Object)(object)val6 == (Object)null) { val6 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val6).name = itemName.Replace(" ", "-") + "BuyNode1"; val6.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n"; val6.clearPreviousText = true; val6.maxCharactersToType = 35; } val6.buyItemIndex = buyItemIndex; val6.isConfirmationNode = true; val6.overrideOptions = true; val6.itemCost = item.price; val6.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"), result = val5 }, new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"), result = result } }; TerminalKeyword val7 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val3); List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); list2.Add(val7); self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list3 = val3.compatibleNouns.ToList(); list3.Add(new CompatibleNoun { noun = val7, result = val6 }); val3.compatibleNouns = list3.ToArray(); TerminalNode val8 = item.itemInfo; if ((Object)(object)val8 == (Object)null) { val8 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val8).name = itemName.Replace(" ", "-") + "InfoNode"; val8.displayText = "[No information about this object was found.]\n\n"; val8.clearPreviousText = true; val8.maxCharactersToType = 25; } self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list4 = val4.compatibleNouns.ToList(); list4.Add(new CompatibleNoun { noun = val7, result = val8 }); val4.compatibleNouns = list4.ToArray(); BuyableItemAssetInfo buyableItemAssetInfo = default(BuyableItemAssetInfo); buyableItemAssetInfo.itemAsset = item.item; buyableItemAssetInfo.keyword = val7; BuyableItemAssetInfo item2 = buyableItemAssetInfo; buyableItemAssetInfos.Add(item2); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {itemName} to terminal (Item price: {val6.itemCost}, Item Index: {val6.buyItemIndex}, Terminal keyword: {val7.word})"); } } self.buyableItemsList = list.ToArray(); orig.Invoke(self); } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } if (levelOverrides != null) { foreach (string levelName in levelOverrides) { scrapItem.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(levelName), rarity); } } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags, levelOverrides); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { scrapItem.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { scrapItem.customLevelRarities.Add(Levels.Compatibility.GetLLLNameOfLevel(customLevelRarity.Key), customLevelRarity.Value); } return; } } scrapItem = new ScrapItem(spawnableItem2, levelRarities, customLevelRarities); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } public static void RegisterShopItem(Item shopItem, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, buyNode1, buyNode2, itemInfo, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterShopItem(Item shopItem, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, null, null, null, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterItem(Item plainItem) { PlainItem plainItem2 = new PlainItem(plainItem); string name = Assembly.GetCallingAssembly().GetName().Name; plainItem2.modName = name; plainItems.Add(plainItem2); } public static void RemoveScrapFromLevels(Item scrapItem, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item scrapItem2 = scrapItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; if (!Enum.IsDefined(typeof(Levels.LevelTypes), name)) { name = Levels.Compatibility.GetLLLNameOfLevel(name); } bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => Levels.Compatibility.GetLLLNameOfLevel(item).ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !levelFlags.HasFlag(levelTypes)) { continue; } ScrapItem actualItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)scrapItem2 || (Object)(object)x.item == (Object)(object)scrapItem2); SpawnableItemWithRarity val2 = ((IEnumerable<SpawnableItemWithRarity>)val.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)actualItem.item)); if (val2 != null) { if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Removed Item " + ((Object)val2.spawnableItem).name + " from Level " + name)); } val.spawnableScrap.Remove(val2); } } } public static void RemoveShopItem(Item shopItem) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.wasRemoved = true; List<TerminalKeyword> list = terminal.terminalNodes.allKeywords.ToList(); TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); List<CompatibleNoun> list2 = val.compatibleNouns.ToList(); List<CompatibleNoun> list3 = obj.compatibleNouns.ToList(); if (buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); list.Remove(asset.keyword); list2.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); list3.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); } terminal.terminalNodes.allKeywords = list.ToArray(); val.compatibleNouns = list2.ToArray(); obj.compatibleNouns = list3.ToArray(); } public static void UpdateShopItemPrice(Item shopItem, int price) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.item.creditsWorth = price; TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); _ = obj.compatibleNouns[0].result.terminalOptions[1].result; List<CompatibleNoun> source = obj.compatibleNouns.ToList(); if (!buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { return; } BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); if (!source.Any((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword)) { return; } TerminalNode result = source.First((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword).result; result.itemCost = price; if (result.terminalOptions.Length == 0) { return; } CompatibleNoun[] terminalOptions = result.terminalOptions; foreach (CompatibleNoun val in terminalOptions) { if ((Object)(object)val.result != (Object)null && val.result.buyItemIndex != -1) { val.result.itemCost = price; } } } } public class Levels { [Flags] public enum LevelTypes { None = 1, ExperimentationLevel = 4, AssuranceLevel = 8, VowLevel = 0x10, OffenseLevel = 0x20, MarchLevel = 0x40, RendLevel = 0x80, DineLevel = 0x100, TitanLevel = 0x200, AdamanceLevel = 0x800, ArtificeLevel = 0x1000, EmbrionLevel = 0x2000, Vanilla = 0x3BFC, Modded = 0x400, All = -1 } internal static class Compatibility { private const string illegalCharacters = ".,?!@#$%^&*()_+-=';:'\""; private static string GetNumberlessPlanetName(string planetName) { if (planetName != null) { return new string(planetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } return string.Empty; } private static string StripSpecialCharacters(string input) { string text = string.Empty; for (int i = 0; i < input.Length; i++) { char c = input[i]; if ((!".,?!@#$%^&*()_+-=';:'\"".ToCharArray().Contains(c) && char.IsLetterOrDigit(c)) || c.ToString() == " ") { text += c; } } return text; } internal static string GetLLLNameOfLevel(string levelName) { string text = StripSpecialCharacters(GetNumberlessPlanetName(levelName)); if (!text.EndsWith("Level")) { text += "Level"; } return text; } internal static Dictionary<string, int> LLLifyLevelRarityDictionary(Dictionary<string, int> keyValuePairs) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<string> list = keyValuePairs.Keys.ToList(); List<int> list2 = keyValuePairs.Values.ToList(); for (int i = 0; i < keyValuePairs.Count; i++) { dictionary.Add(GetLLLNameOfLevel(list[i]), list2[i]); } return dictionary; } } } public class MapObjects { public class RegisteredMapObject { public SpawnableMapObject mapObject; public SpawnableOutsideObjectWithRarity outsideObject; public Levels.LevelTypes levels; public string[] spawnLevelOverrides; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; public static hook_SpawnMapObjects <1>__RoundManager_SpawnMapObjects; } public static List<RegisteredMapObject> mapObjects = new List<RegisteredMapObject>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_003b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__RoundManager_SpawnMapObjects; if (obj2 == null) { hook_SpawnMapObjects val2 = RoundManager_SpawnMapObjects; <>O.<1>__RoundManager_SpawnMapObjects = val2; obj2 = (object)val2; } RoundManager.SpawnMapObjects += (hook_SpawnMapObjects)obj2; } private static void RoundManager_SpawnMapObjects(orig_SpawnMapObjects orig, RoundManager self) { RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val in array) { foreach (RegisteredMapObject mapObject in mapObjects) { if (mapObject.mapObject != null && !val.spawnablePrefabs.Any((GameObject prefab) => (Object)(object)prefab == (Object)(object)mapObject.mapObject.prefabToSpawn)) { val.spawnablePrefabs.Add(mapObject.mapObject.prefabToSpawn); } } } orig.Invoke(self); } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (RegisteredMapObject mapObject in mapObjects) { SelectableLevel[] levels = self.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = mapObject.levels.HasFlag(Levels.LevelTypes.All) || (mapObject.spawnLevelOverrides != null && mapObject.spawnLevelOverrides.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant())); if (mapObject.levels.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !mapObject.levels.HasFlag(levelTypes)) { continue; } if (mapObject.mapObject != null) { if (val.spawnableMapObjects.Any((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn)) { List<SpawnableMapObject> list = val.spawnableMapObjects.ToList(); list.RemoveAll((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn); val.spawnableMapObjects = list.ToArray(); } SpawnableMapObject mapObject2 = mapObject.mapObject; if (mapObject.spawnRateFunction != null) { mapObject2.numberToSpawn = mapObject.spawnRateFunction(val); } List<SpawnableMapObject> list2 = val.spawnableMapObjects.ToList(); list2.Add(mapObject2); val.spawnableMapObjects = list2.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)mapObject2.prefabToSpawn).name + " to " + name)); } } else { if (mapObject.outsideObject == null) { continue; } if (val.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn)) { List<SpawnableOutsideObjectWithRarity> list3 = val.spawnableOutsideObjects.ToList(); list3.RemoveAll((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn); val.spawnableOutsideObjects = list3.ToArray(); } SpawnableOutsideObjectWithRarity outsideObject = mapObject.outsideObject; if (mapObject.spawnRateFunction != null) { outsideObject.randomAmount = mapObject.spawnRateFunction(val); } List<SpawnableOutsideObjectWithRarity> list4 = val.spawnableOutsideObjects.ToList(); list4.Add(outsideObject); val.spawnableOutsideObjects = list4.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)outsideObject.spawnableObject.prefabToSpawn).name + " to " + name)); } } } } } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RemoveMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveMapObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableMapObject mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableMapObjects = val.spawnableMapObjects.Where((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn != (Object)(object)mapObject2.prefabToSpawn).ToArray(); } } } public static void RemoveOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveOutsideObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableOutsideObjectWithRarity mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableOutsideObjects = val.spawnableOutsideObjects.Where((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn != (Object)(object)mapObject2.spawnableObject.prefabToSpawn).ToArray(); } } } } public class NetworkPrefabs { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GameNetworkManager_Start; } private static List<GameObject> _networkPrefabs = new List<GameObject>(); internal static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_Start; if (obj == null) { hook_Start val = GameNetworkManager_Start; <>O.<0>__GameNetworkManager_Start = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; } public static void RegisterNetworkPrefab(GameObject prefab) { if (prefab == null) { throw new ArgumentNullException("prefab", "The given argument for RegisterNetworkPrefab is null!"); } if (!_networkPrefabs.Contains(prefab)) { _networkPrefabs.Add(prefab); } } public static GameObject CreateNetworkPrefab(string name) { GameObject obj = PrefabUtils.CreatePrefab(name); obj.AddComponent<NetworkObject>(); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + name)); obj.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(obj); return obj; } public static GameObject CloneNetworkPrefab(GameObject prefabToClone, string newName = null) { GameObject val = PrefabUtils.ClonePrefab(prefabToClone, newName); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + ((Object)val).name)); val.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(val); return val; } private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); foreach (GameObject networkPrefab in _networkPrefabs) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkPrefab)) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } } } public class Player { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; } public static Dictionary<string, GameObject> ragdollRefs = new Dictionary<string, GameObject>(); public static Dictionary<string, int> ragdollIndexes = new Dictionary<string, int>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (KeyValuePair<string, GameObject> ragdollRef in ragdollRefs) { if (!self.playerRagdolls.Contains(ragdollRef.Value)) { self.playerRagdolls.Add(ragdollRef.Value); int value = self.playerRagdolls.Count - 1; if (ragdollIndexes.ContainsKey(ragdollRef.Key)) { ragdollIndexes[ragdollRef.Key] = value; } else { ragdollIndexes.Add(ragdollRef.Key, value); } } } } public static int GetRagdollIndex(string id) { return ragdollIndexes[id]; } public static GameObject GetRagdoll(string id) { return ragdollRefs[id]; } public static void RegisterPlayerRagdoll(string id, GameObject ragdoll) { Plugin.logger.LogInfo((object)("Registering player ragdoll " + id)); ragdollRefs.Add(id, ragdoll); } } public class PrefabUtils { internal static Lazy<GameObject> _prefabParent; internal static GameObject prefabParent => _prefabParent.Value; static PrefabUtils() { _prefabParent = new Lazy<GameObject>((Func<GameObject>)delegate { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject("LethalLibGeneratedPrefabs") { hideFlags = (HideFlags)61 }; val.SetActive(false); return val; }); } public static GameObject ClonePrefab(GameObject prefabToClone, string newName = null) { GameObject val = Object.Instantiate<GameObjec
BepInEx/plugins/ZoLoKinoBabo112/LethalRadiation.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalRadiation.Patches; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("LethalRadiation")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Makes removeing the apparatus actaully cause radiation in the facility which can harm players overtime.")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2")] [assembly: AssemblyProduct("LethalRadiation")] [assembly: AssemblyTitle("LethalRadiation")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalRadiation { internal class LRConfig { public static ConfigEntry<bool> DamageEnabled; public static ConfigEntry<int> BaseDamage; public static ConfigEntry<int> DamageInterval; public static ConfigEntry<bool> BlurEnabled; public static ConfigEntry<float> BaseBlur; public static ConfigEntry<float> BlurInterval; public static ConfigEntry<bool> OverrideApparatusValue; public static ConfigEntry<int> ApparatusValue; public static void Setup() { DamageEnabled = Plugin.Instance.Config.Bind<bool>("Damage", "Enable", true, "Determines if radiation should do damage to the player at the top of each hour"); BaseDamage = Plugin.Instance.Config.Bind<int>("Damage", "BaseAmount", 10, "The starting amount of damage radiation will do to players before it is increased"); DamageInterval = Plugin.Instance.Config.Bind<int>("Damage", "DamageIncreaseAmount", 1, "How much damage increases by at the top of each hour"); BlurEnabled = Plugin.Instance.Config.Bind<bool>("Screen Blur", "Enable", true, "Determine if radiation should cause a player's screen to get blurry while in the building"); BaseBlur = Plugin.Instance.Config.Bind<float>("Screen Blur", "BaseAmount", 0.02f, "The starting amount of screen blur radiation will cause before it is increased"); BlurInterval = Plugin.Instance.Config.Bind<float>("Screen Blur", "BlurIncreaseAmount", 0.02f, "How much screen blur gets worse by at the top of each hour"); OverrideApparatusValue = Plugin.Instance.Config.Bind<bool>("Apparatus", "OverrideApparatusValue", false, "Determines if the value of the apparatus should be overrided by the Value variable below"); ApparatusValue = Plugin.Instance.Config.Bind<int>("Apparatus", "Value", 80, "The scrap value of the apparatus. [NOTE] Will not work if OverrideApparatusValue is set to false"); } } [BepInPlugin("LethalRadiation", "LethalRadiation", "1.2.2")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalRadiation"); public static int CurrentDamageAmount; public static float CurrentBlurAmount; public static int CurrentHour; public static bool IsLungDocked; public static BaseUnityPlugin Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = (BaseUnityPlugin)(object)this; } LRConfig.Setup(); CurrentDamageAmount = LRConfig.BaseDamage.Value; CurrentBlurAmount = LRConfig.BaseBlur.Value; CurrentHour = 0; IsLungDocked = true; harmony.PatchAll(typeof(EntranceTeleportPatch)); harmony.PatchAll(typeof(LungPropPatch)); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(TimeOfDayPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalRadiation is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalRadiation"; public const string PLUGIN_NAME = "LethalRadiation"; public const string PLUGIN_VERSION = "1.2.2"; } } namespace LethalRadiation.Patches { [HarmonyPatch(typeof(EntranceTeleport))] internal class EntranceTeleportPatch { private static bool radiationPresentLastCheck; [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(ref bool ___enemyNearLastCheck, ref bool ___isEntranceToBuilding, ref InteractTrigger ___triggerScript) { if (!((Object)(object)___triggerScript == (Object)null) && ___isEntranceToBuilding) { if (!Plugin.IsLungDocked && !___enemyNearLastCheck && !radiationPresentLastCheck) { radiationPresentLastCheck = true; ___triggerScript.hoverTip = "[Radiation detected!]"; } else { radiationPresentLastCheck = false; ___triggerScript.hoverTip = "Enter: [LMB]"; } } } } [HarmonyPatch(typeof(LungProp))] internal class LungPropPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(LungProp __instance) { if (LRConfig.OverrideApparatusValue.Value) { ((GrabbableObject)__instance).scrapValue = LRConfig.ApparatusValue.Value; } } [HarmonyPatch("EquipItem")] [HarmonyPrefix] private static void EquipItemPatch(ref bool ___isLungDocked) { if (___isLungDocked) { Plugin.IsLungDocked = false; } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("ResetEnemySpawningVariables")] [HarmonyPrefix] private static void ResetEnemySpawningVariablesPatch() { Plugin.IsLungDocked = true; Plugin.CurrentDamageAmount = LRConfig.BaseDamage.Value; Plugin.CurrentBlurAmount = LRConfig.BaseBlur.Value; Plugin.CurrentHour = 0; Debug.Log((object)$"LR variables reset! docked? {Plugin.IsLungDocked}"); } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(TimeOfDay __instance) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameNetworkManager.Instance == (Object)null || Plugin.IsLungDocked) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (__instance.hour != Plugin.CurrentHour) { Debug.Log((object)$"Hour changed, hour: {__instance.hour}, currentHour: {Plugin.CurrentHour}, docked: {Plugin.IsLungDocked}, damage value: {LRConfig.DamageInterval.Value}, total damage: {Plugin.CurrentDamageAmount}, blur value: {LRConfig.BlurInterval.Value}, blur amount: {Plugin.CurrentBlurAmount}"); if (LRConfig.DamageEnabled.Value && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled && localPlayerController.isInsideFactory) { localPlayerController.DamagePlayer(Plugin.CurrentDamageAmount, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); } Plugin.CurrentDamageAmount += LRConfig.DamageInterval.Value; Plugin.CurrentBlurAmount += LRConfig.BlurInterval.Value; Plugin.CurrentHour = __instance.hour; } if (LRConfig.BlurEnabled.Value && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled && localPlayerController.isInsideFactory && localPlayerController.drunkness <= Plugin.CurrentBlurAmount) { localPlayerController.drunkness = Plugin.CurrentBlurAmount; } } } }
BepInEx/plugins/ZoLoKinoBabo112/LetMeLookDown.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LetMeLookDown")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LetMeLookDown")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a9c88d54-8f01-44a7-be0d-bd61d38aadcb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LetMeLookDown { [BepInPlugin("FlipMods.LetMeLookDown", "LetMeLookDown", "1.0.2")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; private static Plugin instance; public static float maxAngle = 80f; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("LetMeLookDown"); _harmony.PatchAll(); instance = this; Log("LetMeLookDown mod loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.LetMeLookDown"; public const string PLUGIN_NAME = "LetMeLookDown"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace LetMeLookDown.Patches { [HarmonyPatch] internal class AdjustSmoothLookingPatcher { [HarmonyPatch(typeof(PlayerControllerB), "CalculateSmoothLookingInput")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f) { list[i].operand = Plugin.maxAngle; break; } } return list.AsEnumerable(); } } [HarmonyPatch] internal class AdjustNormalLookingPatcher { [HarmonyPatch(typeof(PlayerControllerB), "CalculateNormalLookingInput")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f) { list[i].operand = Plugin.maxAngle; break; } } return list.AsEnumerable(); } } }
BepInEx/plugins/ZoLoKinoBabo112/LocalFlashlight.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LocalFlashlight.NetcodePatcher; using LocalFlashlight.Networking; using Microsoft.CodeAnalysis; using TMPro; using TerminalApi; using TerminalApi.Classes; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LocalFlashlight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0b1e44eae724efbb9a787ce025ca3bc0af57ca0d")] [assembly: AssemblyProduct("LocalFlashlight")] [assembly: AssemblyTitle("LocalFlashlight")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } public enum BatteryDisplayOptions { Disabled, Bar, Percentage, VerticalBar, CircularBar, All } public enum TextDisplayOptions { Percent, AccuratePercent, Time, All } public enum SoundOptions { OriginalLightSounds, InGameFlashlight, OtherwordlyLight } public enum RechargeOptions { Time, Shake, Dynamo, ShipRecharge, FacilityPowered } public enum GlobalFlashlightOptions { CrewUpgrade, Unrestricted } namespace LocalFlashlight { internal class LightScript : MonoBehaviour { private PlayerControllerB player_controller; public ulong clientId; private GameObject player; private GameObject cameraObject; private GameObject dynamoLightObj; private static GameObject lightObject; public static AudioClip[] flashlightClips = (AudioClip[])(object)new AudioClip[25]; public static int[] activeClips = new int[15]; private static AudioSource flashSource; private static AudioSource dynamoAudioSource; private Light localLight; private bool flashState; public static bool publicFlashState; private bool canToggle = true; private SoundOptions selectedSoundOption; private RechargeOptions selectedRechargeOption; private float playerMovementSpeed; public static float UIHideTime; public static float maxBatteryTime; public static float BatteryPercent; public static float truePercentBattery; public static float BatteryClamped; public static float batteryTime = maxBatteryTime; private float batteryRegen; private float regenCool; private float batteryCooldown; private float burnOutCooldown; private float shakeCool; private float soundCool; private float lastShakeTime = 0f; private bool rechargeKeyHeld = false; private float targetVolume = 0f; private float targetPitch = 0f; private float windRechargeMult = 0f; public static Color flashColor; private int toggleAmount = 0; private float flashOnTime = 0f; private int timesCommandUsed = 0; private void Start() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown Plugin.mls.LogInfo((object)"Mod script started, setting mod values and making light..."); FindLocalPlayer(); if (!(((Object)(object)player == (Object)null) | ((Object)(object)cameraObject == (Object)null))) { SetModValues(); SetFlashlightSounds(); MakeLocalLight(); if (Plugin.enableNetworking.Value) { LFNetworkHandler.Instance.RequestAllLightsUpdateServerRpc(); } ((Behaviour)localLight).enabled = false; TerminalApi.AddCommand("LocalFlashlight", new CommandInfo { Category = "other", Description = (Plugin.enableNetworking.Value ? "Shows the state of the flashlight upgrade if you already have it unlocked. If not, use \"LocalFlashlight buy\" to buy it instead!" : "Displays statistics about the flashlight's usage"), DisplayTextSupplier = onCommandParse }, (string)null, true); } } public void Update() { if (((Object)(object)player == (Object)null) | ((Object)(object)player_controller == (Object)null) | ((Object)(object)cameraObject == (Object)null) | ((Object)(object)lightObject == (Object)null)) { return; } try { UpdateModValues(); if (batteryTime > maxBatteryTime) { batteryTime = maxBatteryTime; if (selectedRechargeOption == RechargeOptions.Time) { PlayNoise(activeClips[3], 0.7f, playForWorld: true); } } if (flashState) { batteryTime -= Time.deltaTime; flashOnTime += Time.deltaTime; if (batteryTime < 0f) { if (Plugin.flickerOnBatteryBurn.Value) { ((MonoBehaviour)this).StartCoroutine(FlickerAndStop()); } else { Toggle(); } } } if (((double)BatteryPercent <= 99.75) | flashState) { UIHideTime = Plugin.HideUIDelay.Value; } if ((double)BatteryPercent > 99.75 && !flashState) { UIHideTime -= Time.deltaTime; } UpdateBatteryValues(); if (Plugin.flashlightToggleInstance.toggleKey.triggered) { if (player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat | player_controller.inSpecialInteractAnimation | ((Object)(object)localLight == (Object)null)) { return; } if (batteryTime > 0f) { if (flashState) { Toggle(); } else if (!flashState && canToggle) { Toggle(); } else if (Patches.isFlashlightHeld) { PlayNoise(22, 0.3f, playForWorld: false); } } else { PlayNoise(22, 0.7f, playForWorld: false); } } if (Plugin.flashlightToggleInstance.switchLightPosKey.triggered && !(player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat | player_controller.inSpecialInteractAnimation | ((Object)(object)localLight == (Object)null))) { ChangeLightPosition(); } } catch (Exception arg) { Plugin.mls.LogError((object)$"something went wrong in the update script!! might be either from battery update, mod value update, or whatever else there is in this script:\n{arg}"); } } private void Toggle() { if ((Object)(object)player == (Object)null || (Object)(object)cameraObject == (Object)null) { return; } flashState = !flashState; publicFlashState = flashState; ((Behaviour)localLight).enabled = flashState; if (Plugin.enableNetworking.Value) { LFNetworkHandler.Instance.ToggleLightServerRpc(player_controller.playerClientId, flashState); } if (flashState) { PlayNoise(activeClips[0], 0.3f, playForWorld: true); toggleAmount++; return; } if (batteryTime <= 0f && Plugin.BatteryBurnOut.Value) { regenCool = burnOutCooldown; } else { regenCool = batteryCooldown; toggleAmount++; } if (batteryTime <= 0f) { PlayNoise(activeClips[2], 0.5f, playForWorld: true); } else { PlayNoise(activeClips[1], 0.6f, playForWorld: true); } } private void ChangeLightPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) float x = lightObject.transform.localPosition.x; float y = lightObject.transform.localRotation.y; lightObject.transform.localPosition = new Vector3(0f - x, -0.55f, 0.5f); lightObject.transform.localRotation = Quaternion.Euler(-10f, 0f - y, 0f); PlayNoise(21, 0.3f, playForWorld: false); } public static void PlayNoise(int clipIndex, float volume, bool playForWorld) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) AudioSource obj = flashSource; if (obj != null) { obj.PlayOneShot(flashlightClips[clipIndex]); } if (playForWorld) { Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(lightObject.transform.position, 8f, volume, 0, StartOfRound.Instance.localPlayerController.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0); if (Plugin.enableNetworking.Value) { LFNetworkHandler.Instance.PlayNetworkedSoundServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, clipIndex); } } } private void holdCallback(CallbackContext context) { if (!((selectedRechargeOption != RechargeOptions.Dynamo) | player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat)) { targetVolume = (float)Plugin.FlashVolume.Value / 200f; targetPitch = 1f; if ((Object)(object)dynamoAudioSource != (Object)null) { dynamoAudioSource.loop = true; dynamoAudioSource.clip = flashlightClips[activeClips[5]]; dynamoAudioSource.Play(); } rechargeKeyHeld = true; } } private void releaseCallback(CallbackContext context) { if (selectedRechargeOption == RechargeOptions.Dynamo) { targetVolume = 0f; targetPitch = 0f; if ((Object)(object)dynamoAudioSource != (Object)null) { dynamoAudioSource.loop = false; } soundCool = 0.25f; rechargeKeyHeld = false; } } private void SetFlashlightSounds() { try { selectedSoundOption = Plugin.soundOption.Value; flashlightClips[0] = Plugin.bundle.LoadAsset<AudioClip>("lighton"); flashlightClips[1] = Plugin.bundle.LoadAsset<AudioClip>("lighton1"); flashlightClips[2] = Plugin.bundle.LoadAsset<AudioClip>("lighton2"); flashlightClips[3] = Plugin.bundle.LoadAsset<AudioClip>("lightoff"); flashlightClips[4] = Plugin.bundle.LoadAsset<AudioClip>("lighton1"); flashlightClips[5] = Plugin.bundle.LoadAsset<AudioClip>("lighton2"); flashlightClips[6] = Plugin.bundle.LoadAsset<AudioClip>("lowtoggle"); flashlightClips[7] = Plugin.bundle.LoadAsset<AudioClip>("lowtoggle2"); flashlightClips[8] = Plugin.bundle.LoadAsset<AudioClip>("lowtoggle1"); flashlightClips[9] = Plugin.bundle.LoadAsset<AudioClip>("recharged"); flashlightClips[10] = Plugin.bundle.LoadAsset<AudioClip>("recharged1"); flashlightClips[11] = Plugin.bundle.LoadAsset<AudioClip>("recharged2"); flashlightClips[12] = Plugin.bundle.LoadAsset<AudioClip>("reloadlight"); flashlightClips[13] = Plugin.bundle.LoadAsset<AudioClip>("reloadlight"); flashlightClips[14] = Plugin.bundle.LoadAsset<AudioClip>("reloadlight"); flashlightClips[15] = Plugin.bundle.LoadAsset<AudioClip>("dynamo"); flashlightClips[16] = Plugin.bundle.LoadAsset<AudioClip>("dynamo1"); flashlightClips[17] = Plugin.bundle.LoadAsset<AudioClip>("dynamo2"); flashlightClips[18] = Plugin.bundle.LoadAsset<AudioClip>("flashDown"); flashlightClips[19] = Plugin.bundle.LoadAsset<AudioClip>("flashDown1"); flashlightClips[20] = Plugin.bundle.LoadAsset<AudioClip>("flashDown2"); flashlightClips[21] = Plugin.bundle.LoadAsset<AudioClip>("changepos.ogg"); flashlightClips[22] = Plugin.bundle.LoadAsset<AudioClip>("denytoggle"); Plugin.mls.LogDebug((object)"loaded assets..."); switch (selectedSoundOption) { case SoundOptions.OriginalLightSounds: activeClips[0] = 0; activeClips[1] = 3; activeClips[2] = 6; activeClips[3] = 9; activeClips[4] = 12; activeClips[5] = 16; activeClips[6] = 19; break; case SoundOptions.OtherwordlyLight: activeClips[0] = 1; activeClips[1] = 4; activeClips[2] = 7; activeClips[3] = 11; activeClips[4] = 13; activeClips[5] = 17; activeClips[6] = 18; break; case SoundOptions.InGameFlashlight: activeClips[0] = 2; activeClips[1] = 5; activeClips[2] = 8; activeClips[3] = 10; activeClips[4] = 14; activeClips[5] = 15; activeClips[6] = 20; break; } } catch (Exception arg) { Plugin.mls.LogError((object)$"error while setting localflashlight mod sounds:\n{arg}"); } } private void SetModValues() { try { flashState = false; canToggle = true; rechargeKeyHeld = false; maxBatteryTime = Plugin.BatteryLife.Value; batteryTime = maxBatteryTime; batteryRegen = Plugin.RechargeMult.Value; burnOutCooldown = Plugin.BurnOutCool.Value; batteryCooldown = Plugin.BatteryCool.Value; UIHideTime = 2f + Plugin.HideUIDelay.Value; selectedRechargeOption = Plugin.rechargeOption.Value; shakeCool = Plugin.shakeActionCooldown.Value; playerMovementSpeed = player_controller.movementSpeed; ColorUtility.TryParseHtmlString(Plugin.flashlightColorHex.Value, ref flashColor); } catch (Exception arg) { Plugin.mls.LogError((object)$"error while setting initial localflashlight mod values:\n{arg}"); } } private void FindLocalPlayer() { if ((Object)(object)player != (Object)null) { return; } try { Plugin.mls.LogInfo((object)"Attempting to find local player controller!"); player = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject; if ((Object)(object)player != (Object)null) { player_controller = player.GetComponent<PlayerControllerB>(); cameraObject = ((Component)player_controller.gameplayCamera).gameObject; clientId = GameNetworkManager.Instance.localPlayerController.playerClientId; } } catch (Exception arg) { Plugin.mls.LogError((object)$"error while finding the local player controller! it may be null or the mod just can't find it for whatever reason\n{arg}"); } } private void MakeLocalLight() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown if ((Object)(object)player == (Object)null) { Plugin.mls.LogError((object)"no player!!!!!!!"); return; } try { AudioMixerGroup outputAudioMixerGroup = ((Component)GameNetworkManager.Instance.localPlayerController.itemAudio).GetComponent<AudioSource>().outputAudioMixerGroup; lightObject = new GameObject(); lightObject.transform.SetParent(cameraObject.transform, false); ((Object)lightObject).name = "lightObject (LOCAL)"; localLight = lightObject.AddComponent<Light>(); localLight.type = (LightType)0; localLight.shape = (LightShape)0; localLight.color = flashColor; localLight.intensity = Plugin.Intensity.Value; localLight.range = Plugin.Range.Value; localLight.shadows = (LightShadows)1; localLight.spotAngle = Plugin.Angle.Value; flashSource = lightObject.AddComponent<AudioSource>(); flashSource.loop = false; flashSource.playOnAwake = false; flashSource.volume = (float)Plugin.FlashVolume.Value / 100f; flashSource.priority = 0; flashSource.spatialize = true; flashSource.outputAudioMixerGroup = outputAudioMixerGroup; lightObject.transform.localPosition = new Vector3(-0.15f, -0.55f, 0.5f); lightObject.transform.Rotate(new Vector3(-12f, 3f, 0f)); if (selectedRechargeOption == RechargeOptions.Dynamo) { dynamoLightObj = new GameObject("DynamoAudioSource (ONLY USED FOR DYNAMO RECHARGE)"); dynamoLightObj.transform.SetParent(lightObject.transform, false); dynamoAudioSource = dynamoLightObj.AddComponent<AudioSource>(); ((Object)dynamoAudioSource).name = "yeah no idea why this happens but every time its a nullreferenceexception per frame if i dont keep this, nevermind i fixed it"; dynamoAudioSource.loop = true; dynamoAudioSource.priority = 0; dynamoAudioSource.spatialize = true; dynamoAudioSource.outputAudioMixerGroup = outputAudioMixerGroup; } if (Plugin.ShadowsEnabled.Value) { HDAdditionalLightData val = lightObject.AddComponent<HDAdditionalLightData>(); val.EnableShadows(true); val.SetShadowNearPlane(0.35f); } lightObject.SetActive(true); Plugin.mls.LogInfo((object)"light up and working!"); } catch (Exception arg) { Plugin.mls.LogError((object)$"error while creating the light object:\n{arg}"); } } private void UpdateModValues() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) regenCool -= Time.deltaTime; BatteryPercent = (int)Math.Ceiling(batteryTime / maxBatteryTime * 100f); BatteryClamped = batteryTime / maxBatteryTime; truePercentBattery = BatteryClamped * 100f; ColorUtility.TryParseHtmlString(Plugin.flashlightColorHex.Value, ref flashColor); localLight.color = flashColor; localLight.range = Plugin.Range.Value; localLight.spotAngle = Plugin.Angle.Value; flashSource.volume = (float)Plugin.FlashVolume.Value / 100f; if (selectedRechargeOption == RechargeOptions.Dynamo && (Object)(object)dynamoAudioSource != (Object)null) { dynamoAudioSource.volume = Mathf.Lerp(dynamoAudioSource.volume, targetVolume, Time.deltaTime * 6f); dynamoAudioSource.pitch = Mathf.Lerp(dynamoAudioSource.pitch, targetPitch, Time.deltaTime * 6f); } canToggle = !Plugin.flashlightToggleModSynergyquestionmark.Value || (!((Behaviour)player_controller.helmetLight).enabled && !Patches.isFlashlightPocketed && !Patches.isFlashlightHeld); if (player_controller.isPlayerDead) { flashState = false; ((Behaviour)localLight).enabled = false; batteryTime = maxBatteryTime; regenCool = 0f; canToggle = true; rechargeKeyHeld = false; } float val = Mathf.Lerp(0f, 1f, BatteryClamped); val = Math.Max(val, (float)Plugin.flashlightStopDimBatteryValue.Value / 100f); if (FlashlightItem.globalFlashlightInterferenceLevel >= 1) { localLight.intensity = Plugin.Intensity.Value * ((selectedRechargeOption == RechargeOptions.FacilityPowered) ? Plugin.apparaticeFlashlightIntensityMult.Value : 1f) * Patches.randomLightInterferenceMultiplier; } else { localLight.intensity = (Plugin.dimEnabled.Value ? (Plugin.Intensity.Value * val) : Plugin.Intensity.Value); } } private void UpdateBatteryValues() { switch (selectedRechargeOption) { case RechargeOptions.Time: if (!flashState && (double)batteryTime <= (double)maxBatteryTime - 0.001 && regenCool < 0f) { batteryTime += batteryRegen * Time.deltaTime; } break; case RechargeOptions.Shake: if (Plugin.flashlightToggleInstance.rechargeKey.triggered && Time.time - lastShakeTime > shakeCool && !player_controller.quickMenuManager.isMenuOpen && !player_controller.isPlayerDead && !player_controller.inTerminalMenu && !player_controller.isTypingChat) { if (player_controller.sprintMeter > 0.25f) { batteryTime += maxBatteryTime * 0.07f * batteryRegen; PlayNoise(activeClips[4], 0.6f, playForWorld: true); PlayerControllerB obj = player_controller; obj.sprintMeter -= (float)Plugin.shakeStaminaConsume.Value / 100f; lastShakeTime = Time.time; } else { PlayNoise(22, 0.7f, playForWorld: false); } } break; case RechargeOptions.Dynamo: if (!player_controller.quickMenuManager.isMenuOpen || !player_controller.isPlayerDead || !player_controller.isTypingChat || !player_controller.inSpecialInteractAnimation) { Plugin.flashlightToggleInstance.rechargeKey.performed += holdCallback; Plugin.flashlightToggleInstance.rechargeKey.canceled += releaseCallback; } else { Plugin.flashlightToggleInstance.rechargeKey.performed -= holdCallback; } if (rechargeKeyHeld) { WindUpFlashlight(); windRechargeMult += Time.deltaTime * 3f; } else if (windRechargeMult > 0f) { windRechargeMult -= Time.deltaTime * 5f; } batteryTime += Time.deltaTime * batteryRegen * windRechargeMult; windRechargeMult = Mathf.Clamp(windRechargeMult, 0f, 1.5f); player_controller.movementSpeed = (rechargeKeyHeld ? (playerMovementSpeed * Plugin.dynamoUseMoveMult.Value) : playerMovementSpeed); break; case RechargeOptions.FacilityPowered: if (Patches.isFacilityPowered) { batteryTime = maxBatteryTime; } break; case RechargeOptions.ShipRecharge: batteryTime = (player_controller.isInHangarShipRoom ? maxBatteryTime : batteryTime); break; } } private void WindUpFlashlight() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (selectedRechargeOption == RechargeOptions.Dynamo) { PlayerControllerB obj = player_controller; obj.sprintMeter -= Time.deltaTime * 0.03f; if (soundCool < 0f) { Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)player_controller).transform.position, 8f, 0.5f, 0, player_controller.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0); soundCool = 0.4f; } soundCool -= Time.deltaTime; } } private IEnumerator FlickerAndStop() { regenCool = 0.3f + (Plugin.BatteryBurnOut.Value ? burnOutCooldown : batteryCooldown); flashState = false; publicFlashState = flashState; PlayNoise(8, 0.6f, playForWorld: true); if (Plugin.enableNetworking.Value) { LFNetworkHandler.Instance.FlickerOutServerRpc(player_controller.playerClientId); } ((Behaviour)localLight).enabled = false; yield return (object)new WaitForSeconds(0.1f); ((Behaviour)localLight).enabled = true; yield return (object)new WaitForSeconds(0.1f); ((Behaviour)localLight).enabled = false; } private string onCommandParse() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown string text = null; text += "the command isn't fully implemented, nor is the upgrade system, so here's some stats from your entire game session up to this point\n\n"; text = text + "Flashlight toggle count: " + toggleAmount + "\n"; text = text + "Time spent using the light: " + $"{flashOnTime:.00}" + " seconds\n"; text = text + "Flashlight recharge method: " + selectedRechargeOption.ToString() + "\n"; timesCommandUsed++; text = text + "Times you used this command: " + timesCommandUsed + "\n"; if (timesCommandUsed <= 1) { text += "\nsadly these stats will get reset when starting up the game again but i'll try making it an actual mini-save file if it turns out to be a good feature to add in\n"; } if (Plugin.enableNetworking.Value) { TerminalApi.AddCommand("Localflashlight sayhi", new CommandInfo { DisplayTextSupplier = terminalSayHi, Category = null }, (string)null, true); } return text; } private string terminalSayHi() { LFNetworkHandler.Instance.SayHiServerRpc(player_controller.playerClientId); return "Said hello to all the people in the server!\n\nhow'd you find this anyway?\n"; } } internal class Patches : MonoBehaviour { private static GameObject UIContainer; private static GameObject frameObj; private static GameObject meterObj; private static GameObject textObj; private static GameObject warningObj; private static TextMeshProUGUI textmesh; private static Image frameImage; private static Image meterImage; private static Image warningImage; private static Sprite frame; private static Sprite meter; private static readonly Sprite warning = Plugin.bundle.LoadAsset<Sprite>("warning"); public static Color UIColorHex; private static bool warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value; private static float warningPercent = Plugin.LowBatteryWarningPercentage.Value; private static BatteryDisplayOptions selectedStyle; private static TextDisplayOptions selectedText; private static RechargeOptions selectedRecharge; private static float elemScale; public static bool isFlashlightHeld = false; public static bool isFlashlightPocketed = false; public static bool isFacilityPowered = true; public static float randomLightInterferenceMultiplier; private static float targetAlpha; private static float soundCd = 1f; private static float lastSoundTime = 0f; [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] internal static void MakeLightController() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("LightController"); val.transform.SetParent(((Component)StartOfRound.Instance.localPlayerController).transform, false); val.AddComponent<LightScript>(); StartOfRound.Instance.localPlayerController.nightVision.intensity = StartOfRound.Instance.localPlayerController.nightVision.intensity * ((float)Plugin.DarkVisionMult.Value / 100f); } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] internal static void DestroyLightController() { GameObject val = GameObject.Find("LightController"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } TerminalApi.DeleteKeyword("LocalFlashlight"); } [HarmonyPatch(typeof(HUDManager), "Awake")] [HarmonyPostfix] internal static void GetBatteryUI(ref HUDManager __instance) { selectedStyle = Plugin.BatteryDisplay.Value; selectedText = Plugin.TextDisplay.Value; warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value; warningPercent = Plugin.LowBatteryWarningPercentage.Value; elemScale = Plugin.UIScale.Value; selectedRecharge = Plugin.rechargeOption.Value; isFacilityPowered = true; ColorUtility.TryParseHtmlString(Plugin.HUDColorHex.Value, ref UIColorHex); MakeIndicator(__instance); } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] internal static void UpdateBatteryInfo(ref HUDManager __instance) { //IL_0060: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)UIContainer == (Object)null) { MakeIndicator(__instance); return; } try { float batteryTime = LightScript.batteryTime; float num = Mathf.FloorToInt(batteryTime / 60f); float num2 = Mathf.FloorToInt(batteryTime % 60f); UIContainer.transform.localPosition = Vector2.op_Implicit(new Vector2(Plugin.UIPositionX.Value, Plugin.UIPositionY.Value)); elemScale = Plugin.UIScale.Value; UIContainer.transform.localScale = new Vector3(elemScale, elemScale, elemScale); UIContainer.GetComponent<CanvasGroup>().alpha = Mathf.Lerp(UIContainer.GetComponent<CanvasGroup>().alpha, targetAlpha, Time.deltaTime * 6f); if ((selectedStyle == BatteryDisplayOptions.Percentage) | (selectedStyle == BatteryDisplayOptions.Bar) | (selectedStyle == BatteryDisplayOptions.VerticalBar) | (selectedStyle == BatteryDisplayOptions.CircularBar) | (selectedStyle == BatteryDisplayOptions.All)) { targetAlpha = ((!Plugin.HideUI.Value) ? 1f : ((LightScript.UIHideTime < 0f) ? Plugin.UIHiddenAlpha.Value : 1f)); if (selectedStyle != BatteryDisplayOptions.Percentage) { meterImage.fillAmount = LightScript.BatteryClamped; } } if (selectedStyle == BatteryDisplayOptions.Disabled) { UIContainer.SetActive(warningEnabled && LightScript.truePercentBattery <= warningPercent); } ColorUtility.TryParseHtmlString(Plugin.HUDColorHex.Value, ref UIColorHex); if ((Object)(object)frameObj != (Object)null && selectedStyle == BatteryDisplayOptions.Bar) { ((Graphic)frameImage).color = UIColorHex; } if ((Object)(object)meterObj != (Object)null) { ((Graphic)meterImage).color = UIColorHex; } if ((Object)(object)warningObj != (Object)null) { ((Graphic)warningImage).color = UIColorHex; warningPercent = Plugin.LowBatteryWarningPercentage.Value; warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value; } if ((Object)(object)textObj != (Object)null) { ((Graphic)textmesh).color = UIColorHex; } if (!((selectedStyle == BatteryDisplayOptions.All) | (selectedStyle == BatteryDisplayOptions.Percentage)) || (Object)(object)textmesh == (Object)null) { return; } switch (selectedText) { case TextDisplayOptions.Percent: if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = LightScript.BatteryPercent + "%"; } if (LightScript.batteryTime <= 0f) { ((TMP_Text)textmesh).text = "0%"; } if (LightScript.batteryTime >= LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = "100%"; } break; case TextDisplayOptions.AccuratePercent: if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = LightScript.truePercentBattery.ToString("0.0") + "%"; } if (LightScript.batteryTime <= 0f) { ((TMP_Text)textmesh).text = "0.0%"; } if (LightScript.batteryTime >= LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = "100.0%"; } break; case TextDisplayOptions.Time: if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = $"{num:0}:{num2:00}"; } if (LightScript.batteryTime <= 0f) { ((TMP_Text)textmesh).text = "0:00"; } if (LightScript.batteryTime >= LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = $"{Mathf.FloorToInt(LightScript.maxBatteryTime / 60f):0}:{Mathf.RoundToInt(LightScript.maxBatteryTime % 60f):00}"; } break; case TextDisplayOptions.All: if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = LightScript.truePercentBattery.ToString("0.0") + "%" + $" | {num:0}:{num2:00}"; } if (LightScript.batteryTime <= 0f) { ((TMP_Text)textmesh).text = "0.0% | 0:00"; } if (LightScript.batteryTime >= LightScript.maxBatteryTime) { ((TMP_Text)textmesh).text = "100.0%" + $" | {Mathf.FloorToInt(LightScript.maxBatteryTime / 60f):0}:{Mathf.RoundToInt(LightScript.maxBatteryTime % 60f):00}"; } break; } } catch (Exception arg) { Plugin.mls.LogError((object)$"error while updating hud!! is the light script even there?? is the hud even there????\n{arg}"); } } [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] [HarmonyPostfix] internal static void ReDisableHUD() { if (selectedRecharge == RechargeOptions.FacilityPowered) { UIContainer.SetActive(false); } isFacilityPowered = true; if (StartOfRound.Instance.localPlayerController.isPlayerDead) { StartOfRound.Instance.localPlayerController.pocketedFlashlight = null; } } [HarmonyPatch(typeof(StartOfRound), "openingDoorsSequence")] [HarmonyPostfix] internal static void FixValues() { isFlashlightHeld = false; isFlashlightPocketed = false; randomLightInterferenceMultiplier = Random.Range(0.1f, 0.4f); } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] internal static void PocketedFlashlightChecks() { try { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((!((NetworkBehaviour)localPlayerController).IsOwner || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject)) && !localPlayerController.isTestingPlayer) { return; } if (!localPlayerController.isPlayerDead) { if (localPlayerController.currentlyHeldObjectServer is FlashlightItem && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)(object)localPlayerController.pocketedFlashlight) { localPlayerController.pocketedFlashlight = localPlayerController.currentlyHeldObjectServer; } if (!((Object)(object)localPlayerController.pocketedFlashlight == (Object)null)) { if (localPlayerController.currentlyHeldObjectServer is FlashlightItem && localPlayerController.isHoldingObject && !localPlayerController.pocketedFlashlight.insertedBattery.empty) { isFlashlightHeld = true; } else { isFlashlightHeld = false; } if (localPlayerController.pocketedFlashlight is FlashlightItem && localPlayerController.pocketedFlashlight.isHeld && !localPlayerController.pocketedFlashlight.insertedBattery.empty) { isFlashlightPocketed = true; } else { isFlashlightPocketed = false; } } } else { localPlayerController.pocketedFlashlight = null; isFlashlightHeld = false; isFlashlightPocketed = false; } } catch { } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPostfix] internal static void ClearLightA(ref PlayerControllerB __instance) { __instance.pocketedFlashlight = null; isFlashlightHeld = false; isFlashlightPocketed = false; } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] internal static void ClearLightB() { isFlashlightHeld = false; isFlashlightPocketed = false; } [HarmonyPatch(typeof(RoundManager), "PowerSwitchOnClientRpc")] [HarmonyPostfix] private static void TurnOnFlashlightPower() { isFacilityPowered = true; if (selectedRecharge == RechargeOptions.FacilityPowered) { UIContainer.SetActive(!isFacilityPowered); } lastSoundTime = Time.time; } [HarmonyPatch(typeof(RoundManager), "PowerSwitchOffClientRpc")] [HarmonyPostfix] private static void TurnOffFlashlightPower() { isFacilityPowered = false; if (selectedRecharge == RechargeOptions.FacilityPowered) { UIContainer.SetActive(!isFacilityPowered); if (Time.time - lastSoundTime > soundCd) { LightScript.PlayNoise(LightScript.activeClips[6], 0.2f, playForWorld: false); } } } private static void MakeIndicator(HUDManager hudManager) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0121: Expected O, but got Unknown //IL_016b: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: 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_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Expected O, but got Unknown //IL_094f: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Expected O, but got Unknown //IL_0a11: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a62: Unknown result type (might be due to invalid IL or missing references) //IL_0a67: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Expected O, but got Unknown //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Expected O, but got Unknown //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0854: 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_03cf: Expected O, but got Unknown //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Expected O, but got Unknown //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Expected O, but got Unknown //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0aeb: Expected O, but got Unknown //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b59: Unknown result type (might be due to invalid IL or missing references) try { UIContainer = new GameObject("LocalFlashlightHUDElements", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); UIContainer.transform.SetParent(hudManager.HUDContainer.transform, false); UIContainer.transform.localPosition = Vector2.op_Implicit(new Vector2(Plugin.UIPositionX.Value, Plugin.UIPositionY.Value)); UIContainer.transform.localScale = new Vector3(elemScale, elemScale, elemScale); switch (selectedStyle) { case BatteryDisplayOptions.Bar: frame = Plugin.bundle.LoadAsset<Sprite>("frame.png"); meter = Plugin.bundle.LoadAsset<Sprite>("meter.png"); frameObj = new GameObject("FrameHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); frameObj.transform.SetParent(UIContainer.transform, false); frameObj.GetComponent<RectTransform>(); frameImage = frameObj.GetComponent<Image>(); frameImage.sprite = frame; ((Graphic)frameImage).color = UIColorHex; frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.5f, 1.25f)); meterObj = new GameObject("MeterHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); meterObj.transform.SetParent(UIContainer.transform, false); meterObj.GetComponent<RectTransform>(); meterImage = meterObj.GetComponent<Image>(); meterImage.sprite = meter; ((Graphic)meterImage).color = UIColorHex; meterImage.type = (Type)3; meterImage.fillMethod = (FillMethod)0; meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.5f, 1.25f)); UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered); frameObj.SetActive(true); meterObj.SetActive(true); break; case BatteryDisplayOptions.Percentage: { textmesh = UIContainer.AddComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)textmesh).rectTransform; ((Transform)rectTransform).SetParent(UIContainer.transform, false); ((TMP_Text)textmesh).font = ((TMP_Text)hudManager.controlTipLines[0]).font; ((Graphic)textmesh).color = UIColorHex; ((TMP_Text)textmesh).fontSize = 23f; ((TMP_Text)textmesh).overflowMode = (TextOverflowModes)0; ((Behaviour)textmesh).enabled = true; ((TMP_Text)textmesh).text = ""; UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered); break; } case BatteryDisplayOptions.All: { frame = Plugin.bundle.LoadAsset<Sprite>("meter.png"); meter = Plugin.bundle.LoadAsset<Sprite>("meter.png"); textObj = new GameObject("TextHUD", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); textObj.transform.SetParent(UIContainer.transform, false); textObj.GetComponent<RectTransform>(); textmesh = textObj.GetComponent<TextMeshProUGUI>(); RectTransform rectTransform2 = ((TMP_Text)textmesh).rectTransform; ((Transform)rectTransform2).SetParent(textObj.transform, false); ((Transform)rectTransform2).localPosition = Vector2.op_Implicit(new Vector2(15f, 0f)); ((TMP_Text)textmesh).font = ((TMP_Text)hudManager.controlTipLines[0]).font; ((Graphic)textmesh).color = UIColorHex; ((TMP_Text)textmesh).fontSize = 20f; ((TMP_Text)textmesh).overflowMode = (TextOverflowModes)0; ((Behaviour)textmesh).enabled = true; ((TMP_Text)textmesh).text = ""; frameObj = new GameObject("FrameHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); frameObj.transform.SetParent(UIContainer.transform, false); frameObj.GetComponent<RectTransform>(); frameImage = frameObj.GetComponent<Image>(); frameImage.sprite = frame; ((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.5f); frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(2.625f, 0.875f)); meterObj = new GameObject("MeterHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); meterObj.transform.SetParent(UIContainer.transform, false); meterObj.GetComponent<RectTransform>(); meterImage = meterObj.GetComponent<Image>(); meterImage.sprite = meter; ((Graphic)meterImage).color = UIColorHex; meterImage.type = (Type)3; meterImage.fillMethod = (FillMethod)0; meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(2.625f, 0.875f)); UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered); break; } case BatteryDisplayOptions.CircularBar: frame = Plugin.bundle.LoadAsset<Sprite>("meter2.png"); meter = Plugin.bundle.LoadAsset<Sprite>("meter2.png"); frameObj = new GameObject("FrameHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); frameObj.transform.SetParent(UIContainer.transform, false); frameObj.GetComponent<RectTransform>(); frameImage = frameObj.GetComponent<Image>(); frameImage.sprite = frame; ((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.3f); frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(0.7f, 0.7f)); meterObj = new GameObject("MeterHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); meterObj.transform.SetParent(UIContainer.transform, false); meterObj.GetComponent<RectTransform>(); meterImage = meterObj.GetComponent<Image>(); meterImage.sprite = meter; ((Graphic)meterImage).color = UIColorHex; meterImage.type = (Type)3; meterImage.fillMethod = (FillMethod)4; meterImage.fillClockwise = false; meterImage.fillOrigin = 2; meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(0.7f, 0.7f)); UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered); frameObj.SetActive(true); meterObj.SetActive(true); break; case BatteryDisplayOptions.VerticalBar: frame = Plugin.bundle.LoadAsset<Sprite>("meter3.png"); meter = Plugin.bundle.LoadAsset<Sprite>("meter3.png"); frameObj = new GameObject("FrameHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); frameObj.transform.SetParent(UIContainer.transform, false); frameObj.GetComponent<RectTransform>(); frameImage = frameObj.GetComponent<Image>(); frameImage.sprite = frame; ((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.5f); frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.25f, 3f)); meterObj = new GameObject("MeterHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); meterObj.transform.SetParent(UIContainer.transform, false); meterObj.GetComponent<RectTransform>(); meterImage = meterObj.GetComponent<Image>(); meterImage.sprite = meter; ((Graphic)meterImage).color = UIColorHex; meterImage.type = (Type)3; meterImage.fillMethod = (FillMethod)1; meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero); meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.25f, 3f)); UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered); frameObj.SetActive(true); meterObj.SetActive(true); break; case BatteryDisplayOptions.Disabled: if (warningEnabled) { warningObj = new GameObject("WarningHUD", new Type[2] { typeof(RectTransform), typeof(Image) }); warningObj.transform.SetParent(UIContainer.transform, false); warningObj.GetComponent<RectTransform>(); warningObj.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); warningImage = warningObj.GetComponent<Image>(); warningImage.sprite = warning; ((Graphic)warningImage).color = UIColorHex; } UIContainer.SetActive(false); break; } } catch (Exception arg) { Plugin.mls.LogError((object)$"error while making the hud?\n{arg}"); } } } public class ToggleButton : LcInputActions { [InputAction("<Keyboard>/f", Name = "Toggle key")] public InputAction toggleKey { get; set; } [InputAction("<Keyboard>/h", Name = "Position and angle switch key")] public InputAction switchLightPosKey { get; set; } [InputAction("<Keyboard>/q", Name = "Recharge key")] public InputAction rechargeKey { get; set; } } [BepInPlugin("command.localFlashlight", "LocalFlashlight", "1.4.13")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string VERSION = "1.4.13"; public const string GUID = "command.localFlashlight"; public const string NAME = "LocalFlashlight"; public static AssetBundle bundle; internal static ToggleButton flashlightToggleInstance = new ToggleButton(); private readonly Harmony har = new Harmony("command.localFlashlight"); private static string sceneName; public static ConfigEntry<float> Intensity { get; private set; } public static ConfigEntry<float> Range { get; private set; } public static ConfigEntry<float> Angle { get; private set; } public static ConfigEntry<float> BatteryLife { get; private set; } public static ConfigEntry<float> RechargeMult { get; private set; } public static ConfigEntry<float> BurnOutCool { get; private set; } public static ConfigEntry<bool> BatteryBurnOut { get; private set; } public static ConfigEntry<float> BatteryCool { get; private set; } public static ConfigEntry<BatteryDisplayOptions> BatteryDisplay { get; private set; } public static ConfigEntry<TextDisplayOptions> TextDisplay { get; private set; } public static ConfigEntry<SoundOptions> soundOption { get; private set; } public static ConfigEntry<RechargeOptions> rechargeOption { get; private set; } public static ConfigEntry<bool> HideUI { get; private set; } public static ConfigEntry<float> HideUIDelay { get; private set; } public static ConfigEntry<float> UIScale { get; private set; } public static ConfigEntry<float> UIHiddenAlpha { get; private set; } public static ConfigEntry<bool> UIDisabledLowBatteryWarning { get; private set; } public static ConfigEntry<int> LowBatteryWarningPercentage { get; private set; } public static ConfigEntry<int> FlashVolume { get; private set; } public static ConfigEntry<float> UIPositionX { get; private set; } public static ConfigEntry<float> UIPositionY { get; private set; } public static ConfigEntry<bool> ShadowsEnabled { get; private set; } public static ConfigEntry<bool> soundAggros { get; private set; } public static ConfigEntry<bool> flashlightToggleModSynergyquestionmark { get; private set; } public static ConfigEntry<int> shakeStaminaConsume { get; private set; } public static ConfigEntry<float> shakeActionCooldown { get; private set; } public static ConfigEntry<float> apparaticeFlashlightIntensityMult { get; private set; } public static ConfigEntry<float> dynamoUseMoveMult { get; private set; } public static ConfigEntry<bool> dimEnabled { get; private set; } public static ConfigEntry<int> flashlightStopDimBatteryValue { get; private set; } public static ConfigEntry<bool> flickerOnBatteryBurn { get; private set; } public static ConfigEntry<bool> enableNetworking { get; private set; } public static ConfigEntry<string> flashlightColorHex { get; private set; } public static ConfigEntry<string> HUDColorHex { get; private set; } public static ConfigEntry<int> DarkVisionMult { get; private set; } public static ConfigEntry<bool> rechargeInOrbit { get; private set; } public static ManualLogSource mls { get; private set; } private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Expected O, but got Unknown //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Expected O, but got Unknown //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Expected O, but got Unknown //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_03ce: Expected O, but got Unknown //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Expected O, but got Unknown //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Expected O, but got Unknown //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Expected O, but got Unknown //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Expected O, but got Unknown //IL_0441: Expected O, but got Unknown //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Expected O, but got Unknown //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Expected O, but got Unknown //IL_04b4: Expected O, but got Unknown //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Expected O, but got Unknown //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Expected O, but got Unknown //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Expected O, but got Unknown //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Expected O, but got Unknown //IL_0527: Expected O, but got Unknown //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Expected O, but got Unknown //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Expected O, but got Unknown //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Expected O, but got Unknown //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Expected O, but got Unknown //IL_059a: Expected O, but got Unknown //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Expected O, but got Unknown //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Expected O, but got Unknown //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Expected O, but got Unknown //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Expected O, but got Unknown //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Expected O, but got Unknown //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Expected O, but got Unknown //IL_063a: Expected O, but got Unknown //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Expected O, but got Unknown //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Expected O, but got Unknown //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Expected O, but got Unknown //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Expected O, but got Unknown //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Expected O, but got Unknown //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Expected O, but got Unknown //IL_06db: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Expected O, but got Unknown //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Expected O, but got Unknown //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Expected O, but got Unknown //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Expected O, but got Unknown //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Expected O, but got Unknown //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Expected O, but got Unknown //IL_078d: Expected O, but got Unknown //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Expected O, but got Unknown //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Expected O, but got Unknown //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Expected O, but got Unknown //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Expected O, but got Unknown //IL_0825: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Expected O, but got Unknown //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Expected O, but got Unknown //IL_0863: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Expected O, but got Unknown //IL_0879: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Expected O, but got Unknown //IL_08b6: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Expected O, but got Unknown //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Expected O, but got Unknown //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08fc: Expected O, but got Unknown //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Expected O, but got Unknown //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Expected O, but got Unknown //IL_0940: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Expected O, but got Unknown //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Expected O, but got Unknown //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Expected O, but got Unknown //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Expected O, but got Unknown //IL_09c8: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Expected O, but got Unknown //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Expected O, but got Unknown //IL_09ee: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Expected O, but got Unknown //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Expected O, but got Unknown //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) //IL_0a46: Expected O, but got Unknown //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Expected O, but got Unknown //IL_0a55: Expected O, but got Unknown //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Expected O, but got Unknown //IL_0a81: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Expected O, but got Unknown //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0aa4: Expected O, but got Unknown //IL_0aa7: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Expected O, but got Unknown //IL_0adc: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae9: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Expected O, but got Unknown //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Expected O, but got Unknown //IL_0b06: Expected O, but got Unknown //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b0b: Expected O, but got Unknown //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b43: Unknown result type (might be due to invalid IL or missing references) //IL_0b4e: Expected O, but got Unknown //IL_0b4f: Unknown result type (might be due to invalid IL or missing references) //IL_0b5a: Expected O, but got Unknown //IL_0b60: Expected O, but got Unknown //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) //IL_0b65: Expected O, but got Unknown //IL_0b90: Unknown result type (might be due to invalid IL or missing references) //IL_0b95: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Expected O, but got Unknown //IL_0ba9: Unknown result type (might be due to invalid IL or missing references) //IL_0bb4: Expected O, but got Unknown //IL_0bba: Expected O, but got Unknown //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0bbf: Expected O, but got Unknown //IL_0bdc: Unknown result type (might be due to invalid IL or missing references) //IL_0be6: Expected O, but got Unknown //IL_0bf1: Unknown result type (might be due to invalid IL or missing references) //IL_0bf6: Unknown result type (might be due to invalid IL or missing references) //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) //IL_0c05: Expected O, but got Unknown //IL_0c06: Unknown result type (might be due to invalid IL or missing references) //IL_0c0e: Expected O, but got Unknown //IL_0c14: Expected O, but got Unknown //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) //IL_0c19: Expected O, but got Unknown //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c49: Unknown result type (might be due to invalid IL or missing references) //IL_0c51: Unknown result type (might be due to invalid IL or missing references) //IL_0c5c: Expected O, but got Unknown //IL_0c5d: Unknown result type (might be due to invalid IL or missing references) //IL_0c68: Expected O, but got Unknown //IL_0c6e: Expected O, but got Unknown //IL_0c69: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Expected O, but got Unknown //IL_0c9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ca4: Expected O, but got Unknown //IL_0cb4: Unknown result type (might be due to invalid IL or missing references) //IL_0cbe: Expected O, but got Unknown //IL_0cd8: Unknown result type (might be due to invalid IL or missing references) //IL_0ce2: Expected O, but got Unknown //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d10: Expected O, but got Unknown //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d2c: Expected O, but got Unknown //IL_0d2f: Unknown result type (might be due to invalid IL or missing references) //IL_0d39: Expected O, but got Unknown mls = ((BaseUnityPlugin)this).Logger; Intensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light intensity", 350f, new ConfigDescription("The intensity of the light (in lumens, i think)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 5000f), Array.Empty<object>())); ConfigEntry<float> intensity = Intensity; FloatInputFieldOptions val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig); ((BaseRangeOptions<float>)(object)val).Min = 10f; ((BaseRangeOptions<float>)(object)val).Max = 5000f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(intensity, val)); Range = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light range", 17f, new ConfigDescription("The range of the light (in units)", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<float> range = Range; val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig); ((BaseRangeOptions<float>)(object)val).Min = 1f; ((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(range, val)); Angle = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light angle", 55f, new ConfigDescription("The size of the light's circle (Spot angle)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>())); ConfigEntry<float> angle = Angle; val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig); ((BaseRangeOptions<float>)(object)val).Min = 1f; ((BaseRangeOptions<float>)(object)val).Max = 120f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(angle, val)); BatteryLife = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery life", 12f, new ConfigDescription("The battery life of the flashlight (in seconds)", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<float> batteryLife = BatteryLife; val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifyConfig); ((BaseRangeOptions<float>)(object)val).Min = 1f; ((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(batteryLife, val)); RechargeMult = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Recharge Multiplier", 0.8f, new ConfigDescription("The flashlight's battery recharge multiplier (For instance, setting it to 1 will make it recharge at about the same rate that it is depleted when using the Time recharge method, however this config also applies to other recharge methods)", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<float> rechargeMult = RechargeMult; val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifyConfig); ((BaseRangeOptions<float>)(object)val).Min = 0f; ((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(rechargeMult, val)); BatteryDisplay = ((BaseUnityPlugin)this).Config.Bind<BatteryDisplayOptions>("Indicator", "Battery Details", BatteryDisplayOptions.Bar, "How the indicator displays the flashlight's remaining battery time"); ConfigEntry<BatteryDisplayOptions> batteryDisplay = BatteryDisplay; EnumDropDownOptions val2 = new EnumDropDownOptions(); ((BaseOptions)val2).RequiresRestart = false; ((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<BatteryDisplayOptions>(batteryDisplay, val2)); TextDisplay = ((BaseUnityPlugin)this).Config.Bind<TextDisplayOptions>("Indicator", "Battery text display", TextDisplayOptions.Percent, "(Only applies to \"Text\" and \"All\" indicator display options) Wherether the mod should display the battery information text in percents, accurate percents or time left"); ConfigEntry<TextDisplayOptions> textDisplay = TextDisplay; val2 = new EnumDropDownOptions(); ((BaseOptions)val2).RequiresRestart = false; ((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<TextDisplayOptions>(textDisplay, val2)); HideUI = ((BaseUnityPlugin)this).Config.Bind<bool>("Indicator", "Indicator fading", true, "When true, the indicator will hide after a while of not using the flashlight"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HideUI, new BoolCheckBoxOptions { RequiresRestart = false })); HideUIDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Battery indicator fade delay", 1.5f, new ConfigDescription("The delay before fading out the indicator (in seconds)", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<float> hideUIDelay = HideUIDelay; FloatInputFieldOptions val3 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val3).Min = 0f; ((BaseRangeOptions<float>)val3).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(hideUIDelay, val3)); UIHiddenAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Indicator faded out opacity", 0.2f, new ConfigDescription("The opacity of the indicator when the indicator is faded out", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); ConfigEntry<float> uIHiddenAlpha = UIHiddenAlpha; FloatInputFieldOptions val4 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val4).Min = 0f; ((BaseRangeOptions<float>)val4).Max = 1f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(uIHiddenAlpha, val4)); UIScale = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Indicator scale", 1f, new ConfigDescription("The scale of the indicator, updates in-game", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); ConfigEntry<float> uIScale = UIScale; FloatInputFieldOptions val5 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val5).Min = 0.1f; ((BaseRangeOptions<float>)val5).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(uIScale, val5)); UIPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "IndicatorPositionX", 350f, new ConfigDescription("The position of the UI on the X axis, updates in-game", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-450f, 450f), Array.Empty<object>())); ConfigEntry<float> uIPositionX = UIPositionX; FloatSliderOptions val6 = new FloatSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val6).Min = -450f; ((BaseRangeOptions<float>)val6).Max = 450f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(uIPositionX, val6)); UIPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "IndicatorPositionY", -150f, new ConfigDescription("The position of the UI on the Y axis, updates in-game", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-280f, 280f), Array.Empty<object>())); ConfigEntry<float> uIPositionY = UIPositionY; FloatSliderOptions val7 = new FloatSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val7).Min = -280f; ((BaseRangeOptions<float>)val7).Max = 280f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(uIPositionY, val7)); UIDisabledLowBatteryWarning = ((BaseUnityPlugin)this).Config.Bind<bool>("Indicator", "Low Battery Warning Toggle", true, "(Only applies to when the indicator is disabled) When true, shows a warning on the HUD when the battery reaches a certain percentage"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(UIDisabledLowBatteryWarning, new BoolCheckBoxOptions { RequiresRestart = false })); LowBatteryWarningPercentage = ((BaseUnityPlugin)this).Config.Bind<int>("Indicator", "Low Battery Warning Percentage", 30, new ConfigDescription("(Only applies when the indicator is disabled) The percentage at which the low battery warning shows up", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ConfigEntry<int> lowBatteryWarningPercentage = LowBatteryWarningPercentage; IntInputFieldOptions val8 = new IntInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val8).Min = 0; ((BaseRangeOptions<int>)val8).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(lowBatteryWarningPercentage, val8)); flashlightColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "Flashlight Color (Hex)", "#FFFFFF", new ConfigDescription("very important, add the # before the hex! if it breaks or doesn't work, try resetting the config and typing the code in manually", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<string> obj = flashlightColorHex; TextInputFieldOptions val9 = new TextInputFieldOptions(); ((BaseOptions)val9).RequiresRestart = false; ((BaseOptions)val9).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(obj, val9)); HUDColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "Indicator Color (Hex)", "#FFFFFF", new ConfigDescription("very important, add the # before the hex! if it breaks or doesn't work, try resetting the config and typing the code in manually", (AcceptableValueBase)null, Array.Empty<object>())); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(HUDColorHex, new TextInputFieldOptions { RequiresRestart = false })); flashlightToggleModSynergyquestionmark = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Prioritize flashlights in player inventory", true, "Setting this to true will prevent the light turning on while you have a flashlight in your inventory, however the local flashlight can still be turned off in case you picked up an active flashlight"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(flashlightToggleModSynergyquestionmark, new BoolCheckBoxOptions { RequiresRestart = false })); FlashVolume = ((BaseUnityPlugin)this).Config.Bind<int>("Other", "Flashlight volume", 50, new ConfigDescription("Volume of all of the sounds that the flashlight makes. Does not apply to how well others can hear it.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ConfigEntry<int> flashVolume = FlashVolume; IntSliderOptions val10 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val10).Min = 0; ((BaseRangeOptions<int>)val10).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(flashVolume, val10)); soundOption = ((BaseUnityPlugin)this).Config.Bind<SoundOptions>("Other", "Sound options", SoundOptions.InGameFlashlight, "The flashlight has different sounds depending on what you chose. Does not apply to other players if you have networking enabled."); ConfigEntry<SoundOptions> obj2 = soundOption; val2 = new EnumDropDownOptions(); ((BaseOptions)val2).RequiresRestart = false; ((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<SoundOptions>(obj2, val2)); ShadowsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Enable shadows", true, "When set to true, the light will also emit shadows"); ConfigEntry<bool> shadowsEnabled = ShadowsEnabled; BoolCheckBoxOptions val11 = new BoolCheckBoxOptions(); ((BaseOptions)val11).RequiresRestart = false; ((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(shadowsEnabled, val11)); rechargeOption = ((BaseUnityPlugin)this).Config.Bind<RechargeOptions>("Other", "Recharge method", RechargeOptions.Time, "The way that the flashlight can be recharged. Time, Shake and Dynamo are intended for shorter battery times while FacilityPowered and ShipRecharge are intended for longer battery times"); ConfigEntry<RechargeOptions> obj3 = rechargeOption; val2 = new EnumDropDownOptions(); ((BaseOptions)val2).RequiresRestart = false; ((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<RechargeOptions>(obj3, val2)); rechargeInOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Fully recharge in orbit", true, "When set to true, fully recharges the flashlight when reaching orbit (when the round ends)"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(rechargeInOrbit, new BoolCheckBoxOptions { RequiresRestart = false })); DarkVisionMult = ((BaseUnityPlugin)this).Config.Bind<int>("Other", "Ambient light intensity multiplier", 100, new ConfigDescription("Sets the multiplier of the ambient light. Useful if you feel like forcing yourself to use the flashlight more", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ConfigEntry<int> darkVisionMult = DarkVisionMult; IntSliderOptions val12 = new IntSliderOptions(); ((BaseOptions)val12).RequiresRestart = false; ((BaseOptions)val12).CanModifyCallback = new CanModifyDelegate(modifyConfig); ((BaseRangeOptions<int>)(object)val12).Min = 0; ((BaseRangeOptions<int>)(object)val12).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(darkVisionMult, val12)); flickerOnBatteryBurn = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Enable light flickering", true, "When true, the flashlight attempts to flicker like the in-game flashlights, and also flickers when its battery runs out"); ConfigEntry<bool> obj4 = flickerOnBatteryBurn; val11 = new BoolCheckBoxOptions(); ((BaseOptions)val11).RequiresRestart = false; ((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(obj4, val11)); dimEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Enable light dimming", false, "When true, the intensity of the light dims down to a certain point"); ConfigEntry<bool> obj5 = dimEnabled; val11 = new BoolCheckBoxOptions(); ((BaseOptions)val11).RequiresRestart = false; ((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(obj5, val11)); flashlightStopDimBatteryValue = ((BaseUnityPlugin)this).Config.Bind<int>("Other", "Minimum battery amount dim", 15, new ConfigDescription("The battery percentage at which the light stops dimming", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ConfigEntry<int> obj6 = flashlightStopDimBatteryValue; IntInputFieldOptions val13 = new IntInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val13).Min = 0; ((BaseRangeOptions<int>)val13).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(obj6, val13)); BatteryBurnOut = ((BaseUnityPlugin)this).Config.Bind<bool>("Time battery recharge configs", "Battery burnout", true, "When true, if the flashlight turns off with no battery left, the cooldown before starting to recharge lasts longer"); ConfigEntry<bool> batteryBurnOut = BatteryBurnOut; val11 = new BoolCheckBoxOptions(); ((BaseOptions)val11).RequiresRestart = false; ((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(modifyConfig); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(batteryBurnOut, val11)); BatteryCool = ((BaseUnityPlugin)this).Config.Bind<float>("Time battery recharge configs", "Battery recharge cooldown", 1f, "The cooldown before the battery starts recharging normally"); ConfigEntry<float> batteryCool = BatteryCool; FloatInputFieldOptions val14 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val14).Min = 0f; ((BaseRangeOptions<float>)val14).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(batteryCool, val14)); BurnOutCool = ((BaseUnityPlugin)this).Config.Bind<float>("Time battery recharge configs", "Battery recharge cooldown (no battery)", 3f, "The cooldown before the battery starts recharging when it is fully depleted"); ConfigEntry<float> burnOutCool = BurnOutCool; FloatInputFieldOptions val15 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val15).Min = 0f; ((BaseRangeOptions<float>)val15).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(burnOutCool, val15)); shakeActionCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Shake battery recharge configs", "Shake cooldown", 0.2f, "The time needed to wait before you can recharge the flashlight again via shaking it"); ConfigEntry<float> obj7 = shakeActionCooldown; FloatInputFieldOptions val16 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val16).Min = 0f; ((BaseRangeOptions<float>)val16).Max = float.PositiveInfinity; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj7, val16)); shakeStaminaConsume = ((BaseUnityPlugin)this).Config.Bind<int>("Shake battery recharge configs", "Consumed stamina amount", 3, new ConfigDescription("The amount of stamina shaking the flashlight consumes", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<int> obj8 = shakeStaminaConsume; IntInputFieldOptions val17 = new IntInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val17).Min = 0; ((BaseRangeOptions<int>)val17).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(obj8, val17)); dynamoUseMoveMult = ((BaseUnityPlugin)this).Config.Bind<float>("Dynamo battery recharge configs", "Movespeed multiplier when recharging", 0.75f, "The multiplier of the player's normal movement speed while recharging the flashlight"); ConfigEntry<float> obj9 = dynamoUseMoveMult; FloatInputFieldOptions val18 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val18).Min = 0f; ((BaseRangeOptions<float>)val18).Max = 1f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj9, val18)); apparaticeFlashlightIntensityMult = ((BaseUnityPlugin)this).Config.Bind<float>("Facility powered battery recharge configs", "Light intensity multiplier", 0.5f, "The multiplier of the light intensity when using the Facility Powered recharge option"); ConfigEntry<float> obj10 = apparaticeFlashlightIntensityMult; val = new FloatInputFieldOptions(); ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig); ((BaseRangeOptions<float>)(object)val).Min = 0f; ((BaseRangeOptions<float>)(object)val).Max = 1f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj10, val)); enableNetworking = ((BaseUnityPlugin)this).Config.Bind<bool>("Networking", "(EXPERIMENTAL) Enable networking", false, "Enables networking. While this is enabled, you cannot join other servers without this mod and its networking also enabled. However, you can see other players' lights (alongside the intensity, range, angle and color they set) and hear their flashlight sounds"); ConfigEntry<bool> obj11 = enableNetworking; val11 = new BoolCheckBoxOptions(); ((BaseOptions)val11).RequiresRestart = true; ((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(denyNetworkConfigModify); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(obj11, val11)); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "localbundle"); bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)bundle == (Object)null) { mls.LogError((object)"failed to get mod assets!"); } SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; har.PatchAll(typeof(Patches)); if (enableNetworking.Value) { mls.LogWarning((object)"NETWORKING ENABLED!!!! this is EXPERIMENTAL territory, and you're pretty much stuck joining servers where the host has LocalFlashlight and also has networking enabled! you may also encounter many many bugs!!!!! if you didn't mean to have this enabled, go back to the mod manager of your choice, disable the enable networking config that resides in the Networking category, and then restart the game."); har.PatchAll(typeof(NetworkingPatches)); NetcodePatcher(); } else { mls.LogInfo((object)"Networking disabled"); } } private static void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) { //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) Scene activeScene = SceneManager.GetActiveScene(); sceneName = ((Scene)(ref activeScene)).name; } private static CanModifyResult modifyConfig() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit((sceneName == "MainMenu", "This setting cannot be changed while in a lobby.")); } private static CanModifyResult denyNetworkConfigModify() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit((false, "Enabling or disabling networking cannot be done while the game is open.\nEdit it from your mod manager of choice instead.")); } private static CanModifyResult modifySpecialConfig() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (enableNetworking.Value) { return CanModifyResult.op_Implicit((sceneName == "MainMenu", "Setting cannot be changed while in a lobby when networking is enabled.")); } return CanModifyResult.op_Implicit((true, "?")); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace LocalFlashlight.Networking { public class LFNetworkHandler : NetworkBehaviour { public static LFNetworkHandler Instance { get; private set; } public override void OnNetworkSpawn() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { LFNetworkHandler instance = Instance; if (instance != null) { ((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ServerRpc(RequireOwnership = false)] public void RequestAllLightsUpdateServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4188426817u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4188426817u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Plugin.mls.LogInfo((object)"Recieved request to update lights on all clients!!"); AcceptAllLightUpdateRequestClientRpc(); } } } [ClientRpc] public void AcceptAllLightUpdateRequestClientRpc() { //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_00ee: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4106604540u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4106604540u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Plugin.mls.LogInfo((object)"Updating local light for all clients!"); Color color = default(Color); ColorUtility.TryParseHtmlString(Plugin.flashlightColorHex.Value, ref color); MakeLightServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, color, Plugin.Intensity.Value, Plugin.Range.Value, Plugin.Angle.Value, LightScript.publicFlashState); } } } [ServerRpc(RequireOwnership = false)] public void MakeLightServerRpc(ulong clientId, Color color, float intensity, float range, float angle, bool currentState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be du
BepInEx/plugins/ZoLoKinoBabo112/MaskedEnemyRework.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using MaskedEnemyRework.Patches; using Microsoft.CodeAnalysis; using MoreCompany; using MoreCompany.Cosmetics; using UnityEngine; [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("MaskedEnemyRework")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lethal Company Mod")] [assembly: AssemblyFileVersion("3.3.0.0")] [assembly: AssemblyInformationalVersion("3.3.0")] [assembly: AssemblyProduct("MaskedEnemyRework")] [assembly: AssemblyTitle("MaskedEnemyRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MaskedEnemyRework { public class PluginConfig { public bool RemoveMasks = Cfg("General", "Remove Mask From Masked Enemy", defaultVal: true, "Whether or not the Masked Enemy has a mask on."); public bool RevealMasks = Cfg("General", "Reveal Mask When Attacking", defaultVal: false, "The enemy would reveal their mask permanently after trying to attack someone. Mask would be off until the attempt to attack is made"); public bool RemoveZombieArms = Cfg("General", "Remove Zombie Arms", defaultVal: true, "Remove the animation where the Masked raise arms like a zombie."); public bool TriggerMines = Cfg("General", "Masked Trigger Mines", defaultVal: true, "Masked go KABOOM when walking over a mine."); public int Health = Cfg("General", "Masked Health", 4, "Number of shovel hits required to kill a Masked."); public bool UseVanillaSpawns = Cfg("General", "Use Vanilla Spawns", defaultVal: false, "Disables all spawning rules from this mod. Only uses the above settings from this config. Will not spawn on all moons. will ignore EVERYTHING in the config below this point."); public bool DontTouchMimickingPlayer = Cfg("General", "Dont Touch MaskedPlayerEnemy.mimickingPlayer", defaultVal: false, "Experimental. Give control to other mods (like qwbarch-Mirage) to set which players are impersonated."); public bool ShowMaskedNames = Cfg("General", "Show Masked Usernames", defaultVal: false, "[UNUSED FOR NOW] Will show username of player being mimicked."); public bool UseSpawnRarity = Cfg("Spawns", "Use Spawn Rarity", defaultVal: false, "Use custom spawn rate from config. If this is false, the masked spawns at the same rate as the Bracken. If true, will spawn at whatever rarity is given in Spawn Rarity config option"); public int SpawnRarity = Cfg("Spawns", "Spawn Rarity", 15, "The rarity for the Masked Enemy to spawn. The higher the number, the more likely to spawn. Can go to 1000000000, any higher will break. Use Spawn Rarity must be set to True"); public bool CanSpawnOutside = Cfg("Spawns", "Allow Masked To Spawn Outside", defaultVal: false, "Whether the Masked Enemy can spawn outside the building"); public int MaxSpawnCount = Cfg("Spawns", "Max Number of Masked", 3, "Vents will stop spawning Masked when this limit is hit. Masked can still spawn through other means, like players getting possessed."); public float PowerLevel = Cfg("Spawns", "Masked Power Level", 1f, "How much of the moon's Power Level each Masked consumes. Higher = Less entities"); public bool BoostMoonPowerLevel = Cfg("Spawns", "Boost Moon Power Level", defaultVal: false, "Increase moon indoor max power level by (Max Masked * Masked Power Level). Allows more Masked and other monsters to spawn. Original MEO behavior."); public bool ZombieApocalypseMode = Cfg("Zombie Apocalypse Mode", "Always Zombie Apocalypse", defaultVal: false, "Only spawns Masked! Make sure to crank up the Max Spawn Count in this config! Would also recommend bringing a gun (mod), a shovel works fine too though.... This mode does not play nice with other mods that affect spawn rates. Disable those before playing for best results"); public int ZombieApocalypeRandomChance = Cfg("Zombie Apocalypse Mode", "Random Zombie Apocalypse", -1, "[Must Be Whole Number] The percent chance from 1 to 100 that a day could contain a zombie apocalypse. Put at -1 to never have the chance arise and don't have Only Spawn Masked turned on"); public int MaxZombies = Cfg("Zombie Apocalypse Mode", "Max Zombies", 6, "Max Masked for Zombie Apocalypse. Vents will stop spawning Masked when this limit is hit."); public float ZombiePowerLevel = Cfg("Zombie Apocalypse Mode", "Zombie Power Level", 2f, "Masked power level during Zombie Apocalypse. Higher = Less Zombies. This can limit max zombies by moon difficulty, even if it's lower than what the 'Max Zombies' option allows. Set to 0 to use Max Zombies for all moons. Moon Indoor Power Levels for reference: [Experimentation: 4, Offense: 12, Titan: 18]"); public bool UseZombieSpawnCurve = Cfg("Zombie Apocalypse Mode", "Use Spawn Curves", defaultVal: false, "[BUGGED: This likely permanently modifies the level spawning options until the game is restarted] Edit level spawn curves during a Zombie Apocalypse; options below. Original MEO behavior."); public float InsideEnemySpawnCurve = Cfg("Zombie Apocalypse Mode", "StartOfDay Inside Masked Spawn Curve", 0.1f, "Spawn curve for masked inside, start of the day. Crank this way up for immediate action. More info in the readme"); public float MiddayInsideEnemySpawnCurve = Cfg("Zombie Apocalypse Mode", "Midday Inside Masked Spawn Curve", 500f, "Spawn curve for masked inside, midday."); public float StartOutsideEnemySpawnCurve = Cfg("Zombie Apocalypse Mode", "StartOfDay Masked Outside Spawn Curve", -30f, "Spawn curve for outside masked, start of the day."); public float MidOutsideEnemySpawnCurve = Cfg("Zombie Apocalypse Mode", "Midday Outside Masked Spawn Curve", -30f, "Spawn curve for outside masked, midday."); public float EndOutsideEnemySpawnCurve = Cfg("Zombie Apocalypse Mode", "EOD Outside Masked Spawn Curve", 10f, "Spawn curve for outside masked, end of day"); public static List<ConfigEntryBase> entries = new List<ConfigEntryBase>(); public static T Cfg<T>(string category, string name, T defaultVal, string description) { ConfigEntry<T> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(category, name, defaultVal, description); entries.Add((ConfigEntryBase)(object)val); return val.Value; } } [BepInPlugin("MaskedEnemyRework", "MaskedEnemyRework", "3.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("MaskedEnemyRework"); public static Plugin Instance; public static ManualLogSource logger; public static PluginConfig cfg; public static List<int> PlayerMimicList; public static int PlayerMimicIndex; public static int InitialPlayerCount; public static SpawnableEnemyWithRarity maskedPrefab; public static SpawnableEnemyWithRarity flowerPrefab; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PlayerMimicList = new List<int>(); PlayerMimicIndex = 0; InitialPlayerCount = 0; cfg = new PluginConfig(); logger = Logger.CreateLogSource("MaskedEnemyRework"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MaskedEnemyRework is loaded! Woohoo!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetMaskedPrefabForLaterUse)); harmony.PatchAll(typeof(MaskedVisualRework)); harmony.PatchAll(typeof(MaskedSpawnSettings)); if (cfg.TriggerMines) { harmony.PatchAll(typeof(LandmineVsMasked)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "MaskedEnemyRework"; public const string PLUGIN_NAME = "MaskedEnemyRework"; public const string PLUGIN_VERSION = "3.3.0"; } } namespace MaskedEnemyRework.Patches { [HarmonyPatch] internal class GetMaskedPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); SelectableLevel[] array = ___moonsCatalogueList; for (int i = 0; i < array.Length; i++) { foreach (SpawnableEnemyWithRarity enemy in array[i].Enemies) { if (enemy.enemyType.enemyName == "Masked") { val.LogInfo((object)"Found Masked!"); Plugin.maskedPrefab = enemy; } else if (enemy.enemyType.enemyName == "Flowerman") { Plugin.flowerPrefab = enemy; val.LogInfo((object)"Found Flowerman!"); } } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPrefix] private static void LookingAtMasked(ref PlayerControllerB __instance) { //IL_001b: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.cfg.ShowMaskedNames) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward); LayerMask val2 = LayerMask.op_Implicit(524288); RaycastHit val3 = default(RaycastHit); if (!__instance.isFreeCamera && Physics.Raycast(val, ref val3, 5f, LayerMask.op_Implicit(val2))) { EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val3)).collider).gameObject.GetComponent<EnemyAICollisionDetect>(); if (Object.op_Implicit((Object)(object)component)) { ((Component)component.mainScript).gameObject.GetComponent<MaskedPlayerEnemy>(); } } } } [HarmonyPatch(typeof(Landmine))] internal class LandmineVsMasked { [HarmonyPatch("OnTriggerEnter")] [HarmonyPostfix] private static void OnTriggerEnter(Collider other, Landmine __instance, ref bool ___hasExploded, ref float ___pressMineDebounceTimer) { if (!___hasExploded && !(___pressMineDebounceTimer > 0f) && ((Component)other).CompareTag("Player") && ((Object)other).name.StartsWith("Masked")) { ___pressMineDebounceTimer = 0.5f; __instance.PressMineServerRpc(); } } [HarmonyPatch("OnTriggerExit")] [HarmonyPostfix] private static void OnTriggerExit(Collider other, Landmine __instance, ref bool ___hasExploded, ref bool ___mineActivated) { if (!___hasExploded && ___mineActivated && ((Component)other).CompareTag("Player") && ((Object)other).name.StartsWith("Masked")) { typeof(Landmine).GetMethod("TriggerMineOnLocalClientByExiting", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, null); } } } [HarmonyPatch(typeof(RoundManager))] internal class MaskedSpawnSettings { private static Predicate<SpawnableEnemyWithRarity> isMasked = (SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Masked"; private static Predicate<SpawnableEnemyWithRarity> isFlowerman = (SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Flowerman"; private static FieldInfo powerLevelField = typeof(EnemyType).GetField("PowerLevel"); private static FieldInfo currentMaxInsidePowerField = typeof(RoundManager).GetField("currentMaxInsidePower"); public static bool isZombieApocalypse = false; public static T StupidGet<T>(object obj, FieldInfo field) { return (T)Convert.ChangeType(field.GetValue(obj), typeof(T)); } [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_0246: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Expected O, but got Unknown PluginConfig cfg = Plugin.cfg; if (cfg.UseVanillaSpawns) { return; } ManualLogSource logger = Plugin.logger; logger.LogInfo((object)"Starting Round Manager"); SpawnableEnemyWithRarity maskedPrefab = Plugin.maskedPrefab; SpawnableEnemyWithRarity val = ___currentLevel.Enemies.Find(isFlowerman) ?? Plugin.flowerPrefab; isZombieApocalypse = cfg.ZombieApocalypseMode || StartOfRound.Instance.randomMapSeed % 100 < cfg.ZombieApocalypeRandomChance; try { maskedPrefab.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP = cfg.Health; float num = 0f; foreach (SpawnableEnemyWithRarity item in ___currentLevel.Enemies.FindAll(isMasked)) { num -= (float)item.enemyType.MaxCount * StupidGet<float>(item.enemyType, powerLevelField); } ___currentLevel.Enemies.RemoveAll(isMasked); ___currentLevel.Enemies.Add(maskedPrefab); if (cfg.CanSpawnOutside) { ___currentLevel.OutsideEnemies.RemoveAll(isMasked); ___currentLevel.OutsideEnemies.Add(maskedPrefab); ___currentLevel.DaytimeEnemies.RemoveAll(isMasked); ___currentLevel.DaytimeEnemies.Add(maskedPrefab); } float num2 = (isZombieApocalypse ? cfg.ZombiePowerLevel : cfg.PowerLevel); powerLevelField.SetValue(maskedPrefab.enemyType, Convert.ChangeType(num2, powerLevelField.FieldType)); maskedPrefab.enemyType.probabilityCurve = val.enemyType.probabilityCurve; maskedPrefab.enemyType.isOutsideEnemy = cfg.CanSpawnOutside; if (isZombieApocalypse) { logger.LogInfo((object)"ZOMBIE APOCALYPSE"); maskedPrefab.enemyType.MaxCount = cfg.MaxZombies; maskedPrefab.rarity = 1000000; if (cfg.UseZombieSpawnCurve) { ___currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, cfg.InsideEnemySpawnCurve), new Keyframe(0.5f, cfg.MiddayInsideEnemySpawnCurve) }); ___currentLevel.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 7f), new Keyframe(0.5f, 7f) }); ___currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, cfg.StartOutsideEnemySpawnCurve), new Keyframe(20f, cfg.MidOutsideEnemySpawnCurve), new Keyframe(21f, cfg.EndOutsideEnemySpawnCurve) }); } } else { logger.LogInfo((object)"no zombies :("); maskedPrefab.enemyType.MaxCount = cfg.MaxSpawnCount; maskedPrefab.rarity = (cfg.UseSpawnRarity ? cfg.SpawnRarity : val.rarity); } num += (float)maskedPrefab.enemyType.MaxCount * num2; if (cfg.BoostMoonPowerLevel) { logger.LogInfo((object)$"Adjusting power levels: [maxEnemyPowerCount: {___currentLevel.maxEnemyPowerCount}+{num}, maxDaytimeEnemyPowerCount: {___currentLevel.maxDaytimeEnemyPowerCount}+{num}, maxOutsideEnemyPowerCount: {___currentLevel.maxOutsideEnemyPowerCount}+{num}]"); SelectableLevel obj = ___currentLevel; obj.maxEnemyPowerCount += (int)num; SelectableLevel obj2 = ___currentLevel; obj2.maxDaytimeEnemyPowerCount += (int)num; SelectableLevel obj3 = ___currentLevel; obj3.maxOutsideEnemyPowerCount += (int)num; } } catch (Exception ex) { logger.LogInfo((object)ex); } } [HarmonyPatch("AssignRandomEnemyToVent")] [HarmonyPrefix] private static bool ZombieVent(EnemyVent vent, float spawnTime, ref RoundManager __instance, ref bool __result, ref SelectableLevel ___currentLevel, ref TimeOfDay ___timeScript, ref bool ___cannotSpawnMoreInsideEnemies, ref bool ___firstTimeSpawningEnemies, ref int ___currentEnemyPower, ref int ___currentHour) { if (Plugin.cfg.UseVanillaSpawns || !isZombieApocalypse) { return true; } if (___firstTimeSpawningEnemies) { foreach (SpawnableEnemyWithRarity enemy in ___currentLevel.Enemies) { enemy.enemyType.numberSpawned = 0; } } ___firstTimeSpawningEnemies = false; ManualLogSource logger = Plugin.logger; int num = ___currentLevel.Enemies.FindIndex(isMasked); SpawnableEnemyWithRarity val = ___currentLevel.Enemies[num]; if (num == -1) { logger.LogInfo((object)"No masked found in enemy list?"); return true; } if (val.enemyType.numberSpawned >= val.enemyType.MaxCount) { __result = false; ___cannotSpawnMoreInsideEnemies = true; logger.LogInfo((object)"Max masked spawned"); return false; } float num2 = StupidGet<float>(val.enemyType, powerLevelField); float num3 = StupidGet<float>(__instance, currentMaxInsidePowerField) - (float)___currentEnemyPower; logger.LogInfo((object)("available inside power: " + num3)); if (num2 > num3) { __result = false; ___cannotSpawnMoreInsideEnemies = true; logger.LogInfo((object)"Max power"); return false; } ___currentEnemyPower += (int)num2; vent.enemyType = val.enemyType; vent.enemyTypeIndex = num; vent.occupied = true; vent.spawnTime = spawnTime; if (___timeScript.hour - ___currentHour > 0) { logger.LogInfo((object)"Round manager catching up to time yada yada UvU."); } else { vent.SyncVentSpawnTimeClientRpc((int)spawnTime, num); } EnemyType enemyType = val.enemyType; enemyType.numberSpawned++; logger.LogInfo((object)"Spawned a masked"); __result = true; return false; } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedVisualRework { private static IEnumerator coroutine; [HarmonyPatch("Start")] [HarmonyBefore(new string[] { "AdvancedCompany" })] [HarmonyPostfix] private static void ReformVisuals(ref MaskedPlayerEnemy __instance) { //IL_0060: 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_0093: Unknown result type (might be due to invalid IL or missing references) ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); if (!Plugin.cfg.DontTouchMimickingPlayer) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = StartOfRound.Instance.ClientPlayerList.Count; if (num == 0) { num = 1; val.LogError((object)"Player count was zero"); } if (Plugin.PlayerMimicList.Count <= 1 || Plugin.InitialPlayerCount != num) { Plugin.InitialPlayerCount = num; State state = Random.state; Random.InitState(1234); for (int i = 0; i < 50; i++) { Plugin.PlayerMimicList.Add(Random.Range(0, num)); } Random.state = state; } int num2 = Plugin.PlayerMimicList[Plugin.PlayerMimicIndex % 50] % num; Plugin.PlayerMimicIndex++; if ((Object)(object)__instance.mimickingPlayer == (Object)null) { __instance.mimickingPlayer = allPlayerScripts[num2]; } __instance.SetSuit(__instance.mimickingPlayer.currentSuitID); } if (Plugin.cfg.RemoveMasks || Plugin.cfg.RevealMasks) { ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false); ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false); } if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } } [HarmonyPatch("SetHandsOutClientRpc")] [HarmonyPrefix] private static void MaskAndArmsReveal(ref bool setOut, ref MaskedPlayerEnemy __instance) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (Plugin.cfg.RevealMasks && !gameObject.activeSelf && ((EnemyAI)__instance).currentBehaviourStateIndex == 1) { Logger.CreateLogSource("MaskedEnemyRework"); IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: true, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } if (Plugin.cfg.RemoveZombieArms) { setOut = false; } } [HarmonyPatch("SetEnemyOutside")] [HarmonyPostfix] [HarmonyPriority(300)] private static void HideCosmeticsIfMarked(ref MaskedPlayerEnemy __instance) { if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] private static void HideRevealedMask(ref MaskedPlayerEnemy __instance) { if (Plugin.cfg.RevealMasks && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (gameObject.activeSelf) { IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: false, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdateMaskName(ref MaskedPlayerEnemy __instance) { } private static IEnumerator FadeInAndOut(GameObject mask, bool fadeIn, float duration) { float counter = 0f; mask.SetActive(true); float startLoc; float endLoc; if (fadeIn) { startLoc = 0.095f; endLoc = 0.215f; } else { startLoc = 0.215f; endLoc = 0.095f; } while (counter < duration) { counter += Time.deltaTime; float num = Mathf.Lerp(startLoc, endLoc, counter / duration); mask.transform.localPosition = new Vector3(-0.009f, 0.143f, num); yield return null; } if (!fadeIn) { mask.SetActive(false); } } } internal class MoreCompanyPatch { public static void ApplyCosmetics(MaskedPlayerEnemy masked) { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (MainClass.playerIdsAndCosmetics.Count == 0) { return; } FieldInfo field = typeof(MainClass).GetField("showCosmetics"); FieldInfo field2 = typeof(MainClass).GetField("cosmeticsSyncOther"); if (field != null) { if (!(bool)field.GetValue(null)) { return; } } else if (!(field2 != null) || !((ConfigEntry<bool>)field2.GetValue(null)).Value) { return; } Transform val = ((Component)masked).transform.Find("ScavengerModel").Find("metarig"); CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); ((EnemyAI)masked).skinnedMeshRenderers = ((Component)masked).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); ((EnemyAI)masked).meshRenderers = ((Component)masked).gameObject.GetComponentsInChildren<MeshRenderer>(); } List<string> list = MainClass.playerIdsAndCosmetics[(int)masked.mimickingPlayer.playerClientId]; component = ((Component)val).gameObject.AddComponent<CosmeticApplication>(); foreach (string item in list) { component.ApplyCosmetic(item, true); } foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } } } internal class RemoveZombieArms { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetHandsOutClientRpc")] [HarmonyPrefix] private static void RemoveArms(ref bool setOut) { if (Plugin.cfg.RemoveZombieArms) { setOut = false; } } } }
BepInEx/plugins/ZoLoKinoBabo112/me.loaforc.fairermimics.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Mimics; using Mimics.API; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Mimics")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("me.loaforc.fairermimics")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("FairerMimics")] [assembly: AssemblyTitle("me.loaforc.fairermimics")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FairerMimics { [BepInPlugin("me.loaforc.fairermimics", "FairerMimics", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class FairerMimics : BaseUnityPlugin { internal int Damage; public static FairerMimics Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony Harmony { get; set; } private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown Logger = Logger.CreateLogSource("me.loaforc.fairermimics"); Instance = this; Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.fairermimics"); Damage = ((BaseUnityPlugin)this).Config.Bind<int>("Attacking", "Damage", 60, new ConfigDescription("How much damage should mimics deal, instead of just instantly killing", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())).Value; Logger.LogInfo((object)"me.loaforc.fairermimics:1.0.3 by loaforc has loaded :3"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "me.loaforc.fairermimics"; public const string PLUGIN_NAME = "FairerMimics"; public const string PLUGIN_VERSION = "1.0.3"; } } namespace FairerMimics.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void EnsureAllClientsHaveMod() { //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_0013: Expected O, but got Unknown GameObject val = new GameObject("me.loaforc.fairermimics") { hideFlags = (HideFlags)61 }; NetworkObject val2 = val.AddComponent<NetworkObject>(); val2.GlobalObjectIdHash = BitConverter.ToUInt32(Encoding.UTF8.GetBytes(((Object)val).name), 0); NetworkManager.Singleton.AddNetworkPrefab(val); } } [HarmonyPatch(typeof(MimicDoor))] internal static class MimicDoorPatch { [HarmonyPatch("Attack")] [HarmonyPostfix] private static void ReplaceKillPlayerWithDamage(MimicDoor __instance, int playerId, ref IEnumerator __result) { try { __result = ReplacementAttack(playerId, __instance); } catch (Exception ex) { FairerMimics.Logger.LogError((object)"Failed to replace .Attack() !!"); FairerMimics.Logger.LogError((object)ex); } } private static IEnumerator ReplacementAttack(int playerId, MimicDoor door) { FairerMimics.Logger.LogDebug((object)"replacement attack"); PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId]; MimicsAPI.MainAPI.OnMimicAttackStart(door, player); door.attacking = true; door.interactTrigger.interactable = false; door.mimicAnimator.SetTrigger("Attack"); door.playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); door.playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); door.playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); door.playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)door.frameBox).transform.position); if (num < 8f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } yield return (object)new WaitForSeconds(0.2f); if (((NetworkBehaviour)player).IsOwner && Vector3.Distance(((Component)player).transform.position, ((Component)door).transform.position) < 8.45f) { GameNetworkManager.Instance.localPlayerController.DamagePlayer(FairerMimics.Instance.Damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 4f)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = door.grabPoint.transform; player.deadBody.attachedLimb = player.deadBody.bodyParts[5]; player.deadBody.matchPositionExactly = true; for (int i = 0; i < player.deadBody.bodyParts.Length; i++) { ((Component)player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1); } } yield return (object)new WaitForSeconds(2f); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = null; player.deadBody.attachedLimb = null; player.deadBody.matchPositionExactly = false; ((Component)((Component)player.deadBody).transform.GetChild(0)).gameObject.SetActive(false); player.deadBody = null; } yield return (object)new WaitForSeconds(4.5f); door.attacking = false; door.interactTrigger.interactable = true; MimicsAPI.MainAPI.OnMimicAttackEnd(door); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/ZoLoKinoBabo112/Mimics.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyMimics.Properties; using Microsoft.CodeAnalysis; using Mimics.API; using Mimics.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [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("Mimics")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that adds mimics to Lethal Company")] [assembly: AssemblyFileVersion("2.6.4.0")] [assembly: AssemblyInformationalVersion("2.6.4")] [assembly: AssemblyProduct("Mimics")] [assembly: AssemblyTitle("Mimics")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.6.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalCompanyMimics.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LethalCompanyMimics.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] mimicdoor { get { object @object = ResourceManager.GetObject("mimicdoor", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace Mimics { [BepInPlugin("x753.Mimics", "Mimics", "2.6.4")] public class Mimics : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(MimicNetworkerPrefab); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer && (Object)(object)MimicNetworker.Instance == (Object)null) { GameObject val = Object.Instantiate<GameObject>(MimicNetworkerPrefab); val.GetComponent<NetworkObject>().Spawn(true); MimicNetworker.SpawnWeight0.Value = SpawnRates[0]; MimicNetworker.SpawnWeight1.Value = SpawnRates[1]; MimicNetworker.SpawnWeight2.Value = SpawnRates[2]; MimicNetworker.SpawnWeight3.Value = SpawnRates[3]; MimicNetworker.SpawnWeight4.Value = SpawnRates[4]; MimicNetworker.SpawnWeightMax.Value = SpawnRates[5]; MimicNetworker.SpawnRateDynamic.Value = DynamicSpawnRate; } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartOfRound __instance) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); if (!Object.op_Implicit((Object)(object)val.enemyFiles.Find((TerminalNode node) => node.creatureName == "Mimics"))) { MimicCreatureID = val.enemyFiles.Count; MimicFile.creatureFileID = MimicCreatureID; val.enemyFiles.Add(MimicFile); TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val3 = new TerminalKeyword { word = "mimics", isVerb = false, defaultVerb = val2 }; List<CompatibleNoun> list = val2.compatibleNouns.ToList(); list.Add(new CompatibleNoun { noun = val3, result = MimicFile }); val2.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val3); val.terminalNodes.allKeywords = list2.ToArray(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SetExitIDs")] [HarmonyPostfix] private static void SetExitIDsPatch(ref RoundManager __instance, Vector3 mainEntrancePosition) { //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Expected O, but got Unknown //IL_0931: Unknown result type (might be due to invalid IL or missing references) //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_08d2: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } MimicsAPI.MainAPI.RefreshMimicEventHandler(); MimicDoor.allMimics = new List<MimicDoor>(); int num = 0; Dungeon currentDungeon = __instance.dungeonGenerator.Generator.CurrentDungeon; if (!InteriorWhitelist.Contains(((Object)currentDungeon.DungeonFlow).name.ToLower().Trim())) { return; } int num2 = 0; int[] array = new int[6] { MimicNetworker.SpawnWeight0.Value, MimicNetworker.SpawnWeight1.Value, MimicNetworker.SpawnWeight2.Value, MimicNetworker.SpawnWeight3.Value, MimicNetworker.SpawnWeight4.Value, MimicNetworker.SpawnWeightMax.Value }; int num3 = 0; int[] array2 = array; foreach (int num4 in array2) { num3 += num4; } Random random = new Random(StartOfRound.Instance.randomMapSeed + 753); int num5 = random.Next(0, num3); int num6 = 0; for (int j = 0; j < array.Length; j++) { if (num5 < array[j] + num6) { num2 = j; break; } num6 += array[j]; } if (num2 == 5) { num2 = 999; } EntranceTeleport[] array3 = Object.FindObjectsOfType<EntranceTeleport>(false); int num7 = (array3.Length - 2) / 2; if (MimicNetworker.SpawnRateDynamic.Value && num2 < num7 && num7 > 1) { num2 += random.Next(0, 2); } if (MimicNetworker.SpawnRateDynamic.Value && currentDungeon.AllTiles.Count > 100) { num2 += random.Next(0, 2); } if (((NetworkBehaviour)RoundManager.Instance).IsOwner) { Debug.Log((object)("I am the host. Desired mimics: " + num2)); } else { Debug.Log((object)("I am the client. Desired mimics: " + num2)); } List<Doorway> list = new List<Doorway>(); Bounds val2 = default(Bounds); foreach (Tile allTile in currentDungeon.AllTiles) { foreach (Doorway unusedDoorway in allTile.UnusedDoorways) { if (!MimicsAPI.MainAPI.IgnoreDefaultPlacementValidation(unusedDoorway)) { if (unusedDoorway.HasDoorPrefabInstance || (Object)(object)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true) == (Object)null) { continue; } GameObject gameObject = ((Component)((Component)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; if (!((Object)gameObject).name.StartsWith("AlleyExitDoorContainer") || gameObject.activeSelf) { continue; } bool flag = false; Matrix4x4 val = Matrix4x4.TRS(((Component)unusedDoorway).transform.position, ((Component)unusedDoorway).transform.rotation, new Vector3(1f, 1f, 1f)); ((Bounds)(ref val2))..ctor(new Vector3(0f, 1.5f, 5.5f), new Vector3(2f, 6f, 8f)); ((Bounds)(ref val2)).center = ((Matrix4x4)(ref val)).MultiplyPoint3x4(((Bounds)(ref val2)).center); Collider[] array4 = Physics.OverlapBox(((Bounds)(ref val2)).center, ((Bounds)(ref val2)).extents, ((Component)unusedDoorway).transform.rotation, LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" })); Collider[] array5 = array4; int num8 = 0; if (num8 < array5.Length) { Collider val3 = array5[num8]; flag = true; } if (flag) { continue; } foreach (Tile allTile2 in currentDungeon.AllTiles) { if (!((Object)(object)allTile == (Object)(object)allTile2)) { Vector3 origin = ((Component)unusedDoorway).transform.position + 5f * ((Component)unusedDoorway).transform.forward; Bounds val4 = UnityUtil.CalculateProxyBounds(((Component)allTile2).gameObject, true, Vector3.up); Ray val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.up; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("Catwalk") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || (((Object)allTile2).name.Contains("StartRoom") && !((Object)allTile2).name.Contains("Manor")))) { flag = true; } val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.down; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("MediumRoomHallway1B") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || ((Object)allTile2).name.Contains("StartRoom"))) { flag = true; } } } if (flag) { continue; } } if (MimicsAPI.MainAPI.IsPlacementValid(unusedDoorway)) { list.Add(unusedDoorway); } } } Shuffle(list, StartOfRound.Instance.randomMapSeed); List<Vector3> list2 = new List<Vector3>(); foreach (Doorway item in list) { if (num >= num2) { break; } bool flag2 = false; Vector3 val6 = ((Component)item).transform.position + 5f * ((Component)item).transform.forward; foreach (Vector3 item2 in list2) { if (Vector3.Distance(val6, item2) < 4f) { flag2 = true; break; } } if (flag2) { continue; } list2.Add(val6); GameObject gameObject2 = ((Component)((Component)((Component)item).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; GameObject val7 = Object.Instantiate<GameObject>(MimicPrefab, ((Component)item).transform); val7.transform.position = gameObject2.transform.position; MimicDoor component = val7.GetComponent<MimicDoor>(); component.scanNode.creatureScanID = MimicCreatureID; AudioSource[] componentsInChildren = val7.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val8 in componentsInChildren) { val8.volume = MimicVolume / 100f; val8.outputAudioMixerGroup = StartOfRound.Instance.ship3DAudio.outputAudioMixerGroup; } if (SpawnRates[5] == 9753 && num == 0) { val7.transform.position = new Vector3(-7f, 0f, -10f); } MimicDoor.allMimics.Add(component); component.mimicIndex = num; num++; GameObject gameObject3 = ((Component)((Component)item).transform.GetChild(0)).gameObject; gameObject3.SetActive(false); Bounds bounds = ((Collider)component.frameBox).bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = ((Collider)component.frameBox).bounds; Collider[] array6 = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, Quaternion.identity); foreach (Collider val9 in array6) { if (((Object)((Component)val9).gameObject).name.Contains("Shelf")) { ((Component)val9).gameObject.SetActive(false); } } Light componentInChildren = gameObject2.GetComponentInChildren<Light>(true); ((Component)componentInChildren).transform.parent.SetParent(val7.transform); MeshRenderer[] componentsInChildren2 = val7.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array7 = componentsInChildren2; foreach (MeshRenderer val10 in array7) { Material[] materials = ((Renderer)val10).materials; foreach (Material val11 in materials) { val11.shader = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.shader; val11.renderQueue = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.renderQueue; } } component.interactTrigger.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)component.interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)component.TouchMimic); MimicsAPI.MainAPI.OnMimicCreated(component, item); if (MimicsAPI.MainAPI.OverrideDefaultImperfectionCreation(component, item)) { MimicsAPI.MainAPI.OnMimicCreateImperfections(component); break; } if (MimicPerfection) { continue; } component.interactTrigger.timeToHold = 0.9f; if (!ColorBlindMode) { if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.490566f, 0.1226415f, 0.1302275f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.4339623f, 0.1043965f, 0.1150277f); componentInChildren.colorTemperature = 1250f; } else { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.5f, 0.1580188f, 0.1657038f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(43f / 106f, 0.1358579f, 0.1393619f); componentInChildren.colorTemperature = 1300f; } } else if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { component.interactTrigger.timeToHold = 1.1f; } else { component.interactTrigger.timeToHold = 1f; } if (!EasyMode) { continue; } Random random2 = new Random(StartOfRound.Instance.randomMapSeed + num); switch (random2.Next(0, 4)) { case 0: if (!ColorBlindMode) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); } else { component.interactTrigger.timeToHold = 1.5f; } break; case 1: component.interactTrigger.hoverTip = "Feed : [LMB]"; component.interactTrigger.holdTip = "Feed : [LMB]"; break; case 2: component.interactTrigger.hoverIcon = component.LostFingersIcon; break; case 3: component.interactTrigger.holdTip = "DIE : [LMB]"; component.interactTrigger.timeToHold = 0.5f; break; default: component.interactTrigger.hoverTip = "BUG, REPORT TO DEVELOPER"; break; } } } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { private static FieldInfo SprayHit = typeof(SprayPaintItem).GetField("sprayHit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("SprayPaintClientRpc")] [HarmonyPostfix] private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot) { //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) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } RaycastHit val = (RaycastHit)SprayHit.GetValue(__instance); if ((Object)(object)((RaycastHit)(ref val)).collider != (Object)null && ((Object)((RaycastHit)(ref val)).collider).name == "MimicSprayCollider") { MimicDoor component = ((Component)((Component)((RaycastHit)(ref val)).collider).transform.parent.parent).GetComponent<MimicDoor>(); component.sprayCount++; if (component.sprayCount > 8) { MimicNetworker.Instance.MimicAddAnger(1, component.mimicIndex); } } } } [HarmonyPatch(typeof(LockPicker))] internal class LockPickerPatch { private static FieldInfo RayHit = typeof(LockPicker).GetField("hit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void ItemActivatePatch(LockPicker __instance, bool used, bool buttonDown = true) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } RaycastHit val = (RaycastHit)RayHit.GetValue(__instance); if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((object)(RaycastHit)(ref val)).Equals((object)default(RaycastHit)) && !((Object)(object)((RaycastHit)(ref val)).transform.parent == (Object)null)) { Transform parent = ((RaycastHit)(ref val)).transform.parent; if (((Object)parent).name.StartsWith("MimicDoor")) { MimicNetworker.Instance.MimicLockPick(__instance, ((Component)parent).GetComponent<MimicDoor>().mimicIndex); } } } } private const string modGUID = "x753.Mimics"; private const string modName = "Mimics"; private const string modVersion = "2.6.4"; private readonly Harmony harmony = new Harmony("x753.Mimics"); internal static ManualLogSource MimicsLogger; private static Mimics Instance; public static GameObject MimicPrefab; public static GameObject MimicNetworkerPrefab; public static TerminalNode MimicFile; public static int MimicCreatureID; public static int[] SpawnRates; public static bool MimicPerfection; public static bool UpgradeCompatibility; public static bool EasyMode; public static bool ColorBlindMode; public static float MimicVolume; public static bool DynamicSpawnRate; public static List<string> InteriorWhitelist; private void Awake() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.mimicdoor); MimicPrefab = val.LoadAsset<GameObject>("Assets/MimicDoor.prefab"); MimicNetworkerPrefab = val.LoadAsset<GameObject>("Assets/MimicNetworker.prefab"); MimicFile = val.LoadAsset<TerminalNode>("Assets/MimicFile.asset"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); MimicsLogger = Logger.CreateLogSource("x753.Mimics"); MimicsLogger.LogInfo((object)"Plugin Mimics is loaded!!"); string value = ((BaseUnityPlugin)this).Config.Bind<string>("Compatibility", "Interiors Whitelist", "Level1Flow, Level1Flow3Exits, Level1FlowExtraLarge, Level2Flow, SDMLevel, OfficeDungeonFlow, TranquillityManorFlow", "Comma separated list of interiors that mimics can spawn in. Not all interiors will work.").Value; InteriorWhitelist = (from s in value.ToLower().Split(',') select s.Trim()).ToList(); SpawnRates = new int[6] { ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Zero Mimics", 23, "Weight of zero mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "One Mimic", 69, "Weight of one mimic spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Two Mimics", 7, "Weight of two mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Three Mimics", 1, "Weight of three mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Four Mimics", 0, "Weight of four mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Mimics", 0, "Weight of maximum mimics spawning").Value }; DynamicSpawnRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn Rate", "Dynamic Spawn Rate", true, "Increases mimic spawn rate based on dungeon size and the number of instances of the real thing.").Value; MimicPerfection = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Perfect Mimics", false, "Select this if you want mimics to be the exact same color as the real thing. Overrides all difficulty settings.").Value; UpgradeCompatibility = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Upgrade Compatibility", false, "Mimics won't instantly attack when struck with a powerful blow, such as an upgraded shovel.").Value; EasyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Easy Mode", false, "Each mimic will have one of several possible imperfections to help you tell if it's a mimic.").Value; ColorBlindMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Color Blind Mode", false, "Replaces all color differences with another way to differentiate mimics.").Value; MimicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SFX Volume", 100, "Volume of the mimic's SFX (0-100)").Value; if (MimicVolume < 0f) { MimicVolume = 0f; } if (MimicVolume > 100f) { MimicVolume = 100f; } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static void Shuffle<T>(IList<T> list, int seed) { Random random = new Random(seed); int num = list.Count; while (num > 1) { num--; int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public class MimicNetworker : NetworkBehaviour { public static MimicNetworker Instance; public static NetworkVariable<int> SpawnWeight0 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight1 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight2 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight3 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight4 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeightMax = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<bool> SpawnRateDynamic = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private void Awake() { Instance = this; } public void MimicAttack(int playerId, int mimicIndex, bool ownerOnly = false) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicAttackServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicAttackClientRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2885019175u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2885019175u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].Attack(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAttackServerRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1024971481u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1024971481u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } } } public void MimicAddAnger(int amount, int mimicIndex) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } else { Instance.MimicAddAngerServerRpc(amount, mimicIndex); } } [ClientRpc] public void MimicAddAngerClientRpc(int amount, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1137632670u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1137632670u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].AddAnger(amount)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAddAngerServerRpc(int amount, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(669208889u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 669208889u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } } } public void MimicLockPick(LockPicker lockPicker, int mimicIndex, bool ownerOnly = false) { int playerId = (int)((GrabbableObject)lockPicker).playerHeldBy.playerClientId; if (((NetworkBehaviour)this).IsOwner) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicLockPickServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicLockPickClientRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3716888238u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3716888238u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].MimicLockPick(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicLockPickServerRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1897916243u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1897916243u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } } } protected override void __initializeVariables() { if (SpawnWeight0 == null) { throw new Exception("MimicNetworker.SpawnWeight0 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight0).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight0, "SpawnWeight0"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight0); if (SpawnWeight1 == null) { throw new Exception("MimicNetworker.SpawnWeight1 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight1).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight1, "SpawnWeight1"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight1); if (SpawnWeight2 == null) { throw new Exception("MimicNetworker.SpawnWeight2 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight2).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight2, "SpawnWeight2"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight2); if (SpawnWeight3 == null) { throw new Exception("MimicNetworker.SpawnWeight3 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight3).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight3, "SpawnWeight3"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight3); if (SpawnWeight4 == null) { throw new Exception("MimicNetworker.SpawnWeight4 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight4).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight4, "SpawnWeight4"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight4); if (SpawnWeightMax == null) { throw new Exception("MimicNetworker.SpawnWeightMax cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeightMax).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeightMax, "SpawnWeightMax"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeightMax); if (SpawnRateDynamic == null) { throw new Exception("MimicNetworker.SpawnRateDynamic cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnRateDynamic).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnRateDynamic, "SpawnRateDynamic"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnRateDynamic); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MimicNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2885019175u, new RpcReceiveHandler(__rpc_handler_2885019175)); NetworkManager.__rpc_func_table.Add(1024971481u, new RpcReceiveHandler(__rpc_handler_1024971481)); NetworkManager.__rpc_func_table.Add(1137632670u, new RpcReceiveHandler(__rpc_handler_1137632670)); NetworkManager.__rpc_func_table.Add(669208889u, new RpcReceiveHandler(__rpc_handler_669208889)); NetworkManager.__rpc_func_table.Add(3716888238u, new RpcReceiveHandler(__rpc_handler_3716888238)); NetworkManager.__rpc_func_table.Add(1897916243u, new RpcReceiveHandler(__rpc_handler_1897916243)); } private static void __rpc_handler_2885019175(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAttackClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1024971481(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAttackServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1137632670(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAddAngerClientRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_669208889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAddAngerServerRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3716888238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicLockPickClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1897916243(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicLockPickServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MimicNetworker"; } } public class MimicDoor : MonoBehaviour { public GameObject playerTarget; public BoxCollider frameBox; public Sprite LostFingersIcon; public Animator mimicAnimator; public GameObject grabPoint; public InteractTrigger interactTrigger; public ScanNodeProperties scanNode; public int anger; public bool angering; public int sprayCount; private bool attacking; public static List<MimicDoor> allMimics; public int mimicIndex; private static MethodInfo RetractClaws = typeof(LockPicker).GetMethod("RetractClaws", BindingFlags.Instance | BindingFlags.NonPublic); public void TouchMimic(PlayerControllerB player) { if (!attacking) { MimicNetworker.Instance.MimicAttack((int)player.playerClientId, mimicIndex); } } public IEnumerator Attack(int playerId) { PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId]; MimicsAPI.MainAPI.OnMimicAttackStart(this, player); attacking = true; interactTrigger.interactable = false; mimicAnimator.SetTrigger("Attack"); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)frameBox).transform.position); if (num < 8f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } yield return (object)new WaitForSeconds(0.2f); if (((NetworkBehaviour)player).IsOwner && Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position) < 8.45f) { player.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3)); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 4f)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = grabPoint.transform; player.deadBody.attachedLimb = player.deadBody.bodyParts[5]; player.deadBody.matchPositionExactly = true; for (int i = 0; i < player.deadBody.bodyParts.Length; i++) { ((Component)player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1); } } yield return (object)new WaitForSeconds(2f); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = null; player.deadBody.attachedLimb = null; player.deadBody.matchPositionExactly = false; ((Component)((Component)player.deadBody).transform.GetChild(0)).gameObject.SetActive(false); player.deadBody = null; } yield return (object)new WaitForSeconds(4.5f); attacking = false; interactTrigger.interactable = true; MimicsAPI.MainAPI.OnMimicAttackEnd(this); } public IEnumerator MimicLockPick(int playerId) { if (angering || attacking) { yield break; } LockPicker lockPicker = default(LockPicker); ref LockPicker reference = ref lockPicker; GrabbableObject currentlyHeldObjectServer = StartOfRound.Instance.allPlayerScripts[playerId].currentlyHeldObjectServer; reference = (LockPicker)(object)((currentlyHeldObjectServer is LockPicker) ? currentlyHeldObjectServer : null); if ((Object)(object)lockPicker == (Object)null) { yield break; } attacking = true; interactTrigger.interactable = false; AudioSource component = ((Component)lockPicker).GetComponent<AudioSource>(); component.PlayOneShot(lockPicker.placeLockPickerClips[Random.Range(0, lockPicker.placeLockPickerClips.Length)]); lockPicker.armsAnimator.SetBool("mounted", true); lockPicker.armsAnimator.SetBool("picking", true); component.Play(); component.pitch = Random.Range(0.94f, 1.06f); lockPicker.isOnDoor = true; lockPicker.isPickingLock = true; ((GrabbableObject)lockPicker).grabbable = false; if (((NetworkBehaviour)lockPicker).IsOwner) { ((GrabbableObject)lockPicker).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)MimicNetworker.Instance).NetworkObject, ((Component)this).transform.position + ((Component)this).transform.up * 1.5f - ((Component)this).transform.forward * 1.15f, true); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => !((GrabbableObject)lockPicker).isHeld || Time.timeSinceLevelLoad - startTime > 10f)); ((Component)lockPicker).transform.localEulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, ((Component)this).transform.eulerAngles.y + 90f, ((Component)this).transform.eulerAngles.z); yield return (object)new WaitForSeconds(5f); RetractClaws.Invoke(lockPicker, null); ((Component)lockPicker).transform.SetParent((Transform)null); ((GrabbableObject)lockPicker).startFallingPosition = ((Component)lockPicker).transform.position; ((GrabbableObject)lockPicker).FallToGround(false); ((GrabbableObject)lockPicker).grabbable = true; yield return (object)new WaitForSeconds(1f); anger = 3; attacking = false; interactTrigger.interactable = false; PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } else { interactTrigger.interactable = true; } } public IEnumerator AddAnger(int amount) { if (angering || attacking) { yield break; } angering = true; anger += amount; if (anger == 1) { Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger == 2) { interactTrigger.holdTip = "DIE : [LMB]"; interactTrigger.timeToHold = 0.25f; Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger > 2) { PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } } sprayCount = 0; angering = false; } } public class MimicCollider : MonoBehaviour, IHittable { public MimicDoor mimic; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (Mimics.UpgradeCompatibility) { force = 1; } MimicNetworker.Instance.MimicAddAnger(force, mimic.mimicIndex); return true; } } public class MimicListener : MonoBehaviour, INoiseListener { public MimicDoor mimic; private int tolerance = 100; void INoiseListener.DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((noiseLoudness >= 0.9f || noiseID == 101158) && Vector3.Distance(noisePosition, ((Component)mimic).transform.position) < 5f) { switch (noiseID) { case 75: tolerance--; break; case 5: tolerance -= 15; break; case 101158: tolerance -= 35; break; default: tolerance -= 30; break; } if (tolerance <= 0) { tolerance = 100; MimicNetworker.Instance.MimicAddAnger(1, mimic.mimicIndex); } } } } } namespace Mimics.API { public static class MimicsAPI { private static MainMimicsAPI _API; internal static MainMimicsAPI MainAPI { get { if (_API == null) { _API = new MainMimicsAPI(); } return _API; } } public static IMimicsAPI GetAPI() { return MainAPI; } } public interface IMimicsAPI { void RegisterMimicEventHandler(MimicEventHandler handler); MimicEventHandler GetCurrentMimicEventHandler(); } internal class MainMimicsAPI : IMimicsAPI { internal List<MimicEventHandler> mimicEventHandlers = new List<MimicEventHandler>(); internal MimicEventHandler _currentMimicEventHandler; public void RegisterMimicEventHandler(MimicEventHandler handler) { Mimics.MimicsLogger.LogInfo((object)("Registered handler for " + handler.ModGUID)); mimicEventHandlers.Add(handler); } public MimicEventHandler GetCurrentMimicEventHandler() { return _currentMimicEventHandler; } internal void RefreshMimicEventHandler() { _currentMimicEventHandler = null; foreach (MimicEventHandler mimicEventHandler in mimicEventHandlers) { try { if (mimicEventHandler.IsMyInteriorLoaded && (_currentMimicEventHandler == null || mimicEventHandler.Priority > _currentMimicEventHandler.Priority)) { _currentMimicEventHandler = mimicEventHandler; } } catch (Exception ex) { string text = ((_currentMimicEventHandler != null) ? _currentMimicEventHandler.ModGUID : "NULL"); Mimics.MimicsLogger.LogError((object)("Error with IsMyInteriorLoaded/Priority function for handler " + mimicEventHandler.ModGUID + " or " + text)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } } } internal bool IgnoreDefaultPlacementValidation(Doorway doorway) { try { if (_currentMimicEventHandler == null) { return false; } return _currentMimicEventHandler.IgnoreDefaultPlacementValidation(doorway); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with IgnoreDefaultPlacementValidation function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } return false; } internal bool IsPlacementValid(Doorway doorway) { try { if (_currentMimicEventHandler == null) { return true; } return _currentMimicEventHandler.IsPlacementValid(doorway); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with IsPlacementValid function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } return true; } internal bool OverrideDefaultImperfectionCreation(MimicDoor mimicDoor, Doorway doorway) { try { if (_currentMimicEventHandler == null) { return false; } return _currentMimicEventHandler.OverrideDefaultImperfectionCreation(mimicDoor, doorway); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with OverrideDefaultImperfectionCreation function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } return false; } internal void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) { try { _currentMimicEventHandler?.OnMimicCreated(mimicDoor, doorway); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with OnMimicCreated function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } } internal void OnMimicCreateImperfections(MimicDoor mimicDoor) { try { _currentMimicEventHandler?.OnMimicCreateImperfections(mimicDoor); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with OnMimicCreateImperfections function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } } internal void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack) { try { _currentMimicEventHandler?.OnMimicAttackStart(mimicDoor, playerToAttack); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with OnMimicAttackStart function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } } internal void OnMimicAttackEnd(MimicDoor mimicDoor) { try { _currentMimicEventHandler?.OnMimicAttackEnd(mimicDoor); } catch (Exception ex) { Mimics.MimicsLogger.LogError((object)("Error with OnMimicAttackEnd function for handler " + _currentMimicEventHandler.ModGUID)); Mimics.MimicsLogger.LogError((object)ex.ToString()); } } } public abstract class MimicEventHandler { public abstract string ModGUID { get; } public virtual bool IsMyInteriorLoaded => false; public virtual int Priority => 0; public virtual bool IsPlacementValid(Doorway doorway) { return true; } public virtual bool IgnoreDefaultPlacementValidation(Doorway doorway) { return false; } public virtual bool OverrideDefaultImperfectionCreation(MimicDoor mimicDoor, Doorway doorway) { return false; } public virtual void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) { } public virtual void OnMimicCreateImperfections(MimicDoor mimicDoor) { } public virtual void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack) { } public virtual void OnMimicAttackEnd(MimicDoor mimicDoor) { } } } namespace Mimics.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/ZoLoKinoBabo112/PiggysReanimation.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PiggysAnimation.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RadiationIsCool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RadiationIsCool")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PiggysAnimation { [BepInPlugin("Piggy.PiggysAnimation", "PiggysAnimation", "0.0.1")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Piggy.PiggysAnimation"; private const string modName = "PiggysAnimation"; private const string modVersion = "0.0.1"; private readonly Harmony harmony = new Harmony("Piggy.PiggysAnimation"); private static Plugin Instance; public static ManualLogSource mls; public static AssetBundle Bundle; public static bool enableSkinWalkers; public static bool useTerminal; public static bool useTerminalCredit; public static bool maskedShipDeparture; public static GameObject jesterInteraction; public static RuntimeAnimatorController endgameStats; public static RuntimeAnimatorController ingamePlayerHUD; public static RuntimeAnimatorController profitQuota; public static RuntimeAnimatorController rewardsScreen; public static RuntimeAnimatorController scrapItemInfo; public static string PluginDirectory; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PluginDirectory = ((BaseUnityPlugin)this).Info.Location; LoadAssets(); mls = Logger.CreateLogSource("Piggy.PiggysAnimation"); mls.LogInfo((object)"Piggy's animation is loaded"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(StartOfRoundPatch)); } private void LoadAssets() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "reanimationpack")); } catch (Exception ex) { mls.LogError((object)("Couldn't load asset bundle: " + ex.Message)); return; } try { endgameStats = Bundle.LoadAsset<RuntimeAnimatorController>("RE_EndgameStats.controller"); ingamePlayerHUD = Bundle.LoadAsset<RuntimeAnimatorController>("RE_IngamePlayerHUD.controller"); profitQuota = Bundle.LoadAsset<RuntimeAnimatorController>("RE_ProfitQuota.controller"); rewardsScreen = Bundle.LoadAsset<RuntimeAnimatorController>("RE_RewardsScreen.controller"); scrapItemInfo = Bundle.LoadAsset<RuntimeAnimatorController>("RE_ScrapItemInfo.controller"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message)); } } } } namespace PiggysAnimation.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_PreFix() { GameObject.Find("EndgameStats").GetComponent<Animator>().runtimeAnimatorController = Plugin.endgameStats; GameObject.Find("ProfitQuota").GetComponent<Animator>().runtimeAnimatorController = Plugin.profitQuota; } } }
BepInEx/plugins/ZoLoKinoBabo112/PiggyVarietyMod.dll
Decompiled 2 years 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.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreEmotes.Patch; using PiggyVarietyMod.Patches; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RadiationIsCool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RadiationIsCool")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class AxeItem : GrabbableObject { public int shovelHitForce = 1; public bool reelingUp; public bool isHoldingButton; private RaycastHit rayHit; private Coroutine reelingUpCoroutine; private RaycastHit[] objectsHitByShovel; private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>(); public AudioClip reelUp; public AudioClip swing; public AudioClip[] hitSFX; public AudioSource shovelAudio; private PlayerControllerB previousPlayerHeldBy; private int shovelMask = 11012424; public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } Debug.Log((object)$"Is player pressing down button?: {buttonDown}"); isHoldingButton = buttonDown; Debug.Log((object)("PLAYER ACTIVATED ITEM TO HIT WITH SHOVEL. Who sent this log: " + ((Object)((Component)GameNetworkManager.Instance.localPlayerController).gameObject).name)); if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; Debug.Log((object)$"Set previousPlayerHeldBy: {previousPlayerHeldBy}"); if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel()); } } private IEnumerator reelUpShovel() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); shovelAudio.PlayOneShot(reelUp); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { ReelUpSFXClientRpc(); } [ClientRpc] public void ReelUpSFXClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { shovelAudio.PlayOneShot(reelUp); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; } ((GrabbableObject)this).DiscardItem(); } public void SwingShovel(bool cancel = false) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { shovelAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitShovel(bool cancel = false) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01aa: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called."); return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; bool flag3 = false; int num = -1; if (!cancel) { previousPlayerHeldBy.twoHanded = false; objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2); objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); List<EnemyAI> list = new List<EnemyAI>(); IHittable val2 = default(IHittable); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < objectsHitByShovelList.Count; i++) { Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; RaycastHit val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { val = objectsHitByShovelList[i]; if (!((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)) { val = objectsHitByShovelList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByShovelList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { goto IL_0221; } } val = objectsHitByShovelList[i]; TerrainObstacleTrigger componentInChildren = ((Component)((RaycastHit)(ref val)).collider).GetComponentInChildren<TerrainObstacleTrigger>(); if ((Object)(object)componentInChildren != (Object)null && ((NetworkBehaviour)this).IsOwner) { RoundManager.Instance.DestroyTreeOnLocalClient(((Component)componentInChildren).transform.position); } } } goto IL_0221; IL_0221: val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByShovelList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByShovelList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val = objectsHitByShovelList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position2 = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByShovelList[i]; if (Physics.Linecast(position2, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } flag = true; try { val = objectsHitByShovelList[i]; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)component.mainScript == (Object)null || list.Contains(component.mainScript)) { continue; } goto IL_045c; } val = objectsHitByShovelList[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null)) { goto IL_045c; } if (flag3) { continue; } flag3 = true; goto IL_045c; IL_045c: bool flag4 = val2.Hit(shovelHitForce, forward, previousPlayerHeldBy, true, 1); if (flag4 && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } if (!flag2) { flag2 = flag4; } } catch (Exception arg) { Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}"); } continue; } } val = objectsHitByShovelList[i]; if (((RaycastHit)(ref val)).collider.isTrigger) { continue; } flag = true; val = objectsHitByShovelList[i]; string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { num = j; break; } } } } if (flag) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); if (!flag2 && num != -1) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit"); HitShovelServerRpc(num); } } [ServerRpc] public void HitShovelServerRpc(int hitSurfaceID) { HitShovelClientRpc(hitSurfaceID); } [ClientRpc] public void HitShovelClientRpc(int hitSurfaceID) { if (!((NetworkBehaviour)this).IsOwner) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); if (hitSurfaceID != -1) { HitSurfaceWithShovel(hitSurfaceID); } } } private void HitSurfaceWithShovel(int hitSurfaceID) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } } namespace PiggyVarietyMod { [BepInPlugin("Piggy.PiggyVarietyMod", "PiggyVarietyMod", "1.3.14")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Piggy.PiggyVarietyMod"; private const string modName = "PiggyVarietyMod"; private const string modVersion = "1.3.14"; private readonly Harmony harmony = new Harmony("Piggy.PiggyVarietyMod"); private static Plugin Instance; public static ManualLogSource mls; public static AssetBundle Bundle; public static GameObject teslaGateSpawn; public static GameObject teslaGatePrefab; public static AudioClip teslaIdleStart; public static AudioClip teslaIdle; public static AudioClip teslaIdleEnd; public static AudioClip teslaCrack; public static AudioClip teslaBeep; public static AudioClip teslaWindUp; public static AudioClip teslaUnderbass; public static AudioClip teslaClimax; public static AudioClip flashlightShake; public static AudioClip gummylightClick; public static AudioClip gummylightOutage; public static AudioClip flashFlicker; public static Material flashlightBulb; public static Material blackRubber; public static GameObject gummylightPrefab; public static GameObject m4Prefab; public static GameObject axePrefab; public static Item revolverItem; public static Item revolverAmmoItem; public static Item gummyFlashlight; public static Item arItem; public static Item arMagItem; public static Item axeItem; public static Item bulbItem; public static Item chemicalItem; public static int revolverRarity; public static int revolverAmmoRarity; public static int revolverMaxPlayerDamage; public static int revolverMaxMonsterDamage; public static int rifleMaxPlayerDamage; public static int rifleMonsterDamage; public static bool customGunInfinityAmmo; public static int revolverPrice; public static int revolverAmmoPrice; public static int riflePrice; public static int rifleMagPrice; public static int rifleRarity; public static int rifleMagRarity; public static bool twoHandedRifle; public static int bulbRarity; public static int chemicalRarity; public static float teslaSpawnWeight; public static float teslaSoundVolume; public static bool teslaShake; public static bool translateKorean; public static AudioClip revolverAmmoInsert; public static AudioClip revolverCylinderOpen; public static AudioClip revolverCylinderClose; public static AudioClip revolverDryFire; public static AudioClip revolverBlast1; public static AudioClip revolverBlast2; public static AudioClip m4FireClip; public static AudioClip m4ReloadClip; public static AudioClip m4InspectClip; public static AudioClip m4TriggerClip; public static RuntimeAnimatorController playerAnimator; public static RuntimeAnimatorController otherPlayerAnimator; public static bool foundMoreEmotes; public static string PluginDirectory; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PluginDirectory = ((BaseUnityPlugin)this).Info.Location; LoadAssets(); mls = Logger.CreateLogSource("Piggy.PiggyVarietyMod"); mls.LogInfo((object)"Piggy's Variety Mod is loaded"); teslaSoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Generic", "TeslaGateVolume", 1f, "(Default 1) Sets the sound volume for Tesla Gate.").Value; teslaShake = ((BaseUnityPlugin)this).Config.Bind<bool>("Generic", "TeslaGateShake", false, "(Experimental, Default false) Shake the screen when near Tesla Gate.").Value; revolverMaxPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RevolverMaxPlayerDamage", 70, "(Default 70) Sets the maximum amount of damage the Revolver can deals on the player.").Value; revolverMaxMonsterDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RevolverMaxMonsterDamage", 4, "(Default 4) Sets the maximum amount of damage the Revolver can deals on the monster.").Value; rifleMaxPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RifleMaxPlayerDamage", 22, "(Default 22) Sets the maximum amount of damage the Rifle can deals on the player.").Value; rifleMonsterDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RifleMonsterDamage", 1, "(Default 1) Sets the amount of damage the Rifle deals to monsters.").Value; customGunInfinityAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Generic", "CustomGunInfinityAmmo", false, "(Default false) If true, reloading custom guns will no longer require ammo.").Value; twoHandedRifle = ((BaseUnityPlugin)this).Config.Bind<bool>("Generic", "TwoHandedRifle", false, "(Default false) If true, changes the rifle to a two-handed item.").Value; teslaSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn", "TeslaGateWeight", 1f, "(Default 1) Sets the spawn weight for the Tesla Gate.").Value; revolverRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RevolverRarity", 20, "(Default 20) Sets the spawn rarity for the Revolver.").Value; revolverAmmoRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RevolverAmmoRarity", 60, "(Default 60) Sets the spawn rarity for the Revolver ammo.").Value; revolverPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RevolverPrice", -1, "(Recommended -1 or 550) Set the price of the Revolver. If -1, removes the item from the store list.").Value; revolverAmmoPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RevolverAmmoPrice", -1, "(Recommended -1 or 30) Set the price of the Revolver ammo. If -1, removes the item from the store list.").Value; riflePrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RiflePrice", -1, "(Recommended -1 or 1,000~) Set the price of the Rifle (M4A1). If -1, removes the item from the store list.").Value; rifleMagPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RifleMagPrice", -1, "(Recommended -1 or 400~) Set the price of the Rifle magazine. If -1, removes the item from the store list.").Value; rifleRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RifleRarity", 20, "(Default 20) Sets the spawn rarity for the Rifle.").Value; rifleMagRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RifleMagRarity", 60, "(Default 60) Sets the spawn rarity for the Rifle magazine.").Value; bulbRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "BulbRarity", 30, "(Default 30) Sets the spawn rarity for the Bulb.").Value; chemicalRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "ChemicalRarity", 30, "(Default 30) Sets the spawn rarity for the Chemical.").Value; translateKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value; NetworkPrefabs.RegisterNetworkPrefab(teslaGatePrefab); NetworkPrefabs.RegisterNetworkPrefab(revolverItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(revolverAmmoItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(gummyFlashlight.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(arItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(arMagItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(axeItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(bulbItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(chemicalItem.spawnPrefab); Utilities.FixMixerGroups(revolverItem.spawnPrefab); Utilities.FixMixerGroups(revolverAmmoItem.spawnPrefab); Utilities.FixMixerGroups(gummyFlashlight.spawnPrefab); Utilities.FixMixerGroups(arItem.spawnPrefab); Utilities.FixMixerGroups(arMagItem.spawnPrefab); Utilities.FixMixerGroups(axeItem.spawnPrefab); Utilities.FixMixerGroups(bulbItem.spawnPrefab); Utilities.FixMixerGroups(chemicalItem.spawnPrefab); Items.RegisterItem(revolverItem); Items.RegisterItem(revolverAmmoItem); Items.RegisterItem(gummyFlashlight); Items.RegisterItem(arItem); Items.RegisterItem(arMagItem); Items.RegisterItem(axeItem); Items.RegisterItem(bulbItem); Items.RegisterItem(chemicalItem); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { BepInPlugin metadata = pluginInfo.Value.Metadata; if (metadata.GUID.Equals("MoreEmotes", StringComparison.OrdinalIgnoreCase) || metadata.GUID.Equals("BetterEmotes", StringComparison.OrdinalIgnoreCase)) { foundMoreEmotes = true; mls.LogInfo((object)"[Piggys Variety Mod] Detected More Emotes / Better Emotes!"); mls.LogInfo((object)"[Piggys Variety Mod] More Emotes / Better Emotes may not be compatible!"); } } if (translateKorean) { Translate(); } CreateShopItem(); Items.RegisterScrap(revolverItem, revolverRarity, (LevelTypes)(-1)); Items.RegisterScrap(revolverAmmoItem, revolverAmmoRarity, (LevelTypes)(-1)); Items.RegisterScrap(arItem, rifleRarity, (LevelTypes)(-1)); Items.RegisterScrap(arMagItem, rifleMagRarity, (LevelTypes)(-1)); Items.RegisterScrap(bulbItem, bulbRarity, (LevelTypes)(-1)); Items.RegisterScrap(chemicalItem, chemicalRarity, (LevelTypes)(-1)); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } private void LoadAssets() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "piggyvarietymod")); } catch (Exception ex) { mls.LogError((object)("Couldn't load asset bundle: " + ex.Message)); return; } try { teslaGateSpawn = Bundle.LoadAsset<GameObject>("TeslaGateSpawn.prefab"); teslaGatePrefab = Bundle.LoadAsset<GameObject>("TeslaGate.prefab"); teslaGatePrefab.AddComponent<TeslaGate>(); teslaCrack = Bundle.LoadAsset<AudioClip>("Tesla_Crack.ogg"); teslaBeep = Bundle.LoadAsset<AudioClip>("Tesla_Beeps.ogg"); teslaWindUp = Bundle.LoadAsset<AudioClip>("Tesla_WindUp.ogg"); teslaUnderbass = Bundle.LoadAsset<AudioClip>("Tesla_Underbass.ogg"); teslaClimax = Bundle.LoadAsset<AudioClip>("Tesla_Climax.ogg"); teslaIdleStart = Bundle.LoadAsset<AudioClip>("Tesla_IdleStarts.ogg"); teslaIdle = Bundle.LoadAsset<AudioClip>("Tesla_IdleLoop.ogg"); teslaIdleEnd = Bundle.LoadAsset<AudioClip>("Tesla_IdleEnd.ogg"); flashlightShake = Bundle.LoadAsset<AudioClip>("FlashlightShake.wav"); gummylightClick = Bundle.LoadAsset<AudioClip>("GummyFlashlightClick.wav"); gummylightOutage = Bundle.LoadAsset<AudioClip>("GummylightBatteryOutage.wav"); flashFlicker = Bundle.LoadAsset<AudioClip>("FlashlightFlicker.ogg"); flashlightBulb = Bundle.LoadAsset<Material>("FlashlightBulb1.mat"); blackRubber = Bundle.LoadAsset<Material>("BlackRubber1.mat"); Plugin.revolverItem = Bundle.LoadAsset<Item>("Revolver.asset"); revolverAmmoItem = Bundle.LoadAsset<Item>("RevolverAmmo.asset"); arItem = Bundle.LoadAsset<Item>("M4A1.asset"); arMagItem = Bundle.LoadAsset<Item>("Magazine.asset"); Plugin.axeItem = Bundle.LoadAsset<Item>("Axe.asset"); gummyFlashlight = Bundle.LoadAsset<Item>("GummyFlashlight.asset"); chemicalItem = Bundle.LoadAsset<Item>("Chemical.asset"); bulbItem = Bundle.LoadAsset<Item>("Bulb.asset"); gummylightPrefab = Bundle.LoadAsset<GameObject>("GummylightItem.prefab"); m4Prefab = Bundle.LoadAsset<GameObject>("M4Item.prefab"); axePrefab = Bundle.LoadAsset<GameObject>("AxeItem.prefab"); revolverAmmoInsert = Bundle.LoadAsset<AudioClip>("RevolverReload.wav"); revolverCylinderOpen = Bundle.LoadAsset<AudioClip>("RevolverCylinderOpen.wav"); revolverCylinderClose = Bundle.LoadAsset<AudioClip>("RevolverCylinderClose.wav"); revolverDryFire = Bundle.LoadAsset<AudioClip>("RevolverDryFire.wav"); revolverBlast1 = Bundle.LoadAsset<AudioClip>("RevolverBlast1.wav"); revolverBlast2 = Bundle.LoadAsset<AudioClip>("RevolverBlast2.wav"); m4FireClip = Bundle.LoadAsset<AudioClip>("M4Fire1.wav"); m4InspectClip = Bundle.LoadAsset<AudioClip>("InspectM4v2.wav"); m4TriggerClip = Bundle.LoadAsset<AudioClip>("M4Trigger.wav"); m4ReloadClip = Bundle.LoadAsset<AudioClip>("M4Reload.wav"); playerAnimator = Bundle.LoadAsset<RuntimeAnimatorController>("PlayerAnimator.controller"); otherPlayerAnimator = Bundle.LoadAsset<RuntimeAnimatorController>("OtherPlayerAnimator.controller"); RevolverItem revolverItem = Plugin.revolverItem.spawnPrefab.AddComponent<RevolverItem>(); ((GrabbableObject)revolverItem).grabbable = true; ((GrabbableObject)revolverItem).grabbableToEnemies = true; revolverItem.gunReloadSFX = revolverAmmoInsert; revolverItem.cylinderOpenSFX = revolverCylinderOpen; revolverItem.cylinderCloseSFX = revolverCylinderClose; revolverItem.gunShootSFX.Add(revolverBlast1); revolverItem.gunShootSFX.Add(revolverBlast2); revolverItem.noAmmoSFX = revolverDryFire; revolverItem.gunSafetySFX = revolverDryFire; revolverItem.switchSafetyOffSFX = revolverDryFire; revolverItem.switchSafetyOnSFX = revolverDryFire; revolverItem.gunAudio = ((Component)revolverItem).gameObject.GetComponent<AudioSource>(); revolverItem.gunShootAudio = ((Component)((Component)revolverItem).gameObject.transform.GetChild(1)).GetComponent<AudioSource>(); revolverItem.gunBulletsRicochetAudio = ((Component)((Component)revolverItem).gameObject.transform.GetChild(2)).GetComponent<AudioSource>(); revolverItem.gunAnimator = ((Component)revolverItem).gameObject.GetComponent<Animator>(); revolverItem.revolverRayPoint = ((Component)revolverItem).gameObject.transform.GetChild(3); revolverItem.gunShootParticle = ((Component)((Component)revolverItem).gameObject.transform.GetChild(3).GetChild(0)).GetComponent<ParticleSystem>(); revolverItem.cylinderTransform = ((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(0)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(1)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(2)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(3)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(4)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0) .GetChild(5)).GetComponent<MeshRenderer>()); revolverItem.revolverAmmoInHandTransform = ((Component)revolverItem).gameObject.transform.GetChild(0); revolverItem.revolverAmmoInHand = ((Component)((Component)revolverItem).gameObject.transform.GetChild(0).GetChild(0)).GetComponent<MeshRenderer>(); revolverItem.gunCompatibleAmmoID = 500; ((GrabbableObject)revolverItem).itemProperties = Plugin.revolverItem; arItem.spawnPrefab = m4Prefab; M4Item m4Item = arItem.spawnPrefab.AddComponent<M4Item>(); ((GrabbableObject)m4Item).grabbable = true; ((GrabbableObject)m4Item).isInFactory = true; ((GrabbableObject)m4Item).itemProperties = arItem; ((GrabbableObject)m4Item).grabbableToEnemies = true; m4Item.gunCompatibleAmmoID = 485; m4Item.gunAnimator = ((Component)m4Item).gameObject.GetComponent<Animator>(); m4Item.gunAudio = ((Component)m4Item).gameObject.GetComponent<AudioSource>(); m4Item.gunShootAudio = ((Component)((Component)m4Item).transform.GetChild(0)).GetComponent<AudioSource>(); m4Item.gunBulletsRicochetAudio = ((Component)((Component)m4Item).transform.GetChild(1)).GetComponent<AudioSource>(); m4Item.gunShootSFX = m4FireClip; m4Item.gunReloadSFX = m4ReloadClip; m4Item.gunInspectSFX = m4InspectClip; m4Item.noAmmoSFX = m4TriggerClip; m4Item.gunShootParticle = ((Component)((Component)m4Item).transform.GetChild(5).GetChild(0)).GetComponent<ParticleSystem>(); m4Item.gunRayPoint = ((Component)m4Item).transform.GetChild(5); if (twoHandedRifle) { arItem.twoHanded = true; } gummyFlashlight.spawnPrefab = gummylightPrefab; GummylightItem gummylightItem = gummyFlashlight.spawnPrefab.AddComponent<GummylightItem>(); ((GrabbableObject)gummylightItem).useCooldown = 0.12f; ((GrabbableObject)gummylightItem).itemProperties = gummyFlashlight; ((GrabbableObject)gummylightItem).mainObjectRenderer = ((Component)((Component)gummylightItem).transform.GetChild(2)).GetComponent<MeshRenderer>(); ((GrabbableObject)gummylightItem).insertedBattery.charge = 1f; ((GrabbableObject)gummylightItem).grabbableToEnemies = true; gummylightItem.flashlightBulb = ((Component)((Component)gummylightItem).transform.GetChild(0)).GetComponent<Light>(); gummylightItem.flashlightBulbGlow = ((Component)((Component)gummylightItem).transform.GetChild(1)).GetComponent<Light>(); gummylightItem.flashlightAudio = ((Component)gummylightItem).GetComponent<AudioSource>(); gummylightItem.flashlightClips = (AudioClip[])(object)new AudioClip[1] { gummylightClick }; gummylightItem.outOfBatteriesClip = gummylightOutage; gummylightItem.flashlightFlicker = flashFlicker; gummylightItem.bulbLight = flashlightBulb; gummylightItem.bulbDark = blackRubber; gummylightItem.flashlightMesh = ((Component)((Component)gummylightItem).transform.GetChild(2)).GetComponent<MeshRenderer>(); gummylightItem.changeMaterial = true; ((GrabbableObject)gummylightItem).isInFactory = true; ((GrabbableObject)gummylightItem).grabbable = true; gummylightItem.flashlightTypeID = 10; Object.Destroy((Object)(object)gummyFlashlight.spawnPrefab.GetComponent<FlashlightItem>()); Plugin.axeItem.spawnPrefab = axePrefab; AxeItem axeItem = Plugin.axeItem.spawnPrefab.AddComponent<AxeItem>(); Shovel component = Plugin.axeItem.spawnPrefab.GetComponent<Shovel>(); ((GrabbableObject)axeItem).itemProperties = Plugin.axeItem; ((GrabbableObject)axeItem).grabbable = true; ((GrabbableObject)axeItem).isInFactory = true; ((GrabbableObject)axeItem).grabbableToEnemies = true; axeItem.shovelHitForce = 1; axeItem.reelUp = component.reelUp; axeItem.swing = component.swing; axeItem.hitSFX = component.hitSFX; axeItem.shovelAudio = component.shovelAudio; Object.Destroy((Object)(object)component); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message)); } } private void Translate() { revolverItem.toolTips[0] = "격발 : [RMB]"; revolverItem.toolTips[1] = "탄약 삽탄하기 : [E]"; revolverItem.toolTips[2] = "실린더 열기 : [Q]"; gummyFlashlight.toolTips[0] = "전등 전환하기 : [RMB]"; gummyFlashlight.toolTips[1] = "손전등 흔들기 : [Q]"; arItem.toolTips[0] = "격발 : [RMB]"; arItem.toolTips[1] = "재장전 : [E]"; arItem.toolTips[2] = "탄약 확인하기 : [Q]"; axeItem.toolTips[0] = "도끼 휘두르기 : [RMB]"; revolverItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "리볼버"; revolverAmmoItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "총알"; arItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "소총"; arMagItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "탄창"; bulbItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "전구"; chemicalItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "화학 약품"; } private void CreateShopItem() { if (translateKorean) { revolverAmmoItem.itemName = "총알"; revolverItem.itemName = "리볼버"; gummyFlashlight.itemName = "젤리"; arMagItem.itemName = "탄창"; arItem.itemName = "소총"; axeItem.itemName = "도끼"; chemicalItem.itemName = "화학 약품"; bulbItem.itemName = "전구"; } else { revolverAmmoItem.itemName = "Bullet"; revolverItem.itemName = "Revolver"; gummyFlashlight.itemName = "Gummy flashlight"; arMagItem.itemName = "Magazine"; arItem.itemName = "Rifle"; axeItem.itemName = "Axe"; } TerminalNode val = NewTerminalNode("리볼버를 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n", "You have requested to order revolvers. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"); TerminalNode val2 = NewTerminalNode("[variableAmount]개의 리볼버를 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다.\n\n", "Ordered [variableAmount] revolvers. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n"); TerminalNode val3 = NewTerminalNode("\n더욱 강력한 자기 보호를 위해!\n실린더를 열고 리볼버 탄약을 삽탄하여 장전하세요.\n\n", "\nFor more powerful self-defense!\nOpen the cylinder and insert revolver ammo to load it.\n\n"); TerminalNode val4 = NewTerminalNode("리볼버 탄약을 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n", "You have requested to order revolver ammos. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"); TerminalNode val5 = NewTerminalNode("[variableAmount]개의 리볼버 탄약을 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다.\n\n", "Ordered [variableAmount] revolver ammos. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n"); TerminalNode val6 = NewTerminalNode("\n리볼버에 장전하고 <b>치명적인</b> 순간에 격발하세요!\n\n", "\nLoad to your revolver and fire at LETHAL moments!\n\n"); TerminalNode val7 = NewTerminalNode("소총을 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n", "You have requested to order rifles. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"); TerminalNode val8 = NewTerminalNode("[variableAmount]개의 소총을 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다.\n\n", "Ordered [variableAmount] rifles. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n"); TerminalNode val9 = NewTerminalNode("\n더욱 강력한 자기 보호를 위해!\n탄창을 장전하여 사용하세요.\n\n", "\nFor more powerful self-defense!\nload magazine to fire it.\n\n"); TerminalNode val10 = NewTerminalNode("소총 탄창을 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n", "You have requested to order rifle magazines. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"); TerminalNode val11 = NewTerminalNode("[variableAmount]개의 소총 탄창을 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다.\n\n", "Ordered [variableAmount] rifle magazines. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n"); TerminalNode val12 = NewTerminalNode("\n소총에 장전하고 <b>치명적인</b> 순간에 격발하세요!\n\n", "\nLoad to your rifle and fire at LETHAL moments!\n\n"); TerminalNode val13 = NewTerminalNode("젤리 손전등을 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n", "You have requested to order gummy flashlights. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"); TerminalNode val14 = NewTerminalNode("[variableAmount]개의 젤리 손전등을 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다.\n\n", "Ordered [variableAmount] gummy flashlights. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n"); TerminalNode val15 = NewTerminalNode("\n자가발전 손전등입니다.\n그저 평범한 장난감이지만, 배터리가 다 떨어졌을 때 여러분의 어두운 앞길을 비춰 줄 것입니다!\n\n", "\nA self-powered flashlight.\nIt's just a toy, but it'll light up your dark path when the batteries run out!\n\n"); if (revolverPrice > -1) { Items.RegisterShopItem(revolverItem, val, val2, val3, revolverPrice); } if (revolverAmmoPrice > -1) { Items.RegisterShopItem(revolverAmmoItem, val4, val5, val6, revolverAmmoPrice); } if (riflePrice > -1) { Items.RegisterShopItem(arItem, val7, val8, val9, riflePrice); } if (rifleMagPrice > -1) { Items.RegisterShopItem(arMagItem, val10, val11, val12, rifleMagPrice); } } public TerminalNode NewTerminalNode(string korean, string english) { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); if (translateKorean) { val.displayText = korean; } else { val.displayText = english; } val.clearPreviousText = true; val.maxCharactersToType = 15; val.buyRerouteToMoon = -1; val.displayPlanetInfo = -1; val.shipUnlockableID = -1; val.creatureFileID = -1; val.storyLogFileID = -1; return val; } } } namespace PiggyVarietyMod.Patches { public class CustomTouchInteractTrigger : MonoBehaviour { public bool isIdleTrigger; public bool isKillTrigger; public TeslaGate teslaGate; private void OnTriggerEnter(Collider collider) { //IL_01f3: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB component = ((Component)collider).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { Plugin.mls.LogInfo((object)("Tesla gate detected player: " + component.playerUsername + ", Idle: " + isIdleTrigger + ", Kill: " + isKillTrigger)); if (!component.isPlayerDead) { if (isIdleTrigger) { teslaGate.activatePlayerList.Add(component); teslaGate.activateList.Add(((Component)collider).gameObject); } else if (!isIdleTrigger && !isKillTrigger) { teslaGate.engagingPlayerList.Add(component); teslaGate.engagingList.Add(((Component)collider).gameObject); } } } EnemyAICollisionDetect component2 = ((Component)collider).GetComponent<EnemyAICollisionDetect>(); IHittable val = default(IHittable); if ((Object)(object)component2 != (Object)null && ((Component)((Component)component2).transform).TryGetComponent<IHittable>(ref val)) { Plugin.mls.LogInfo((object)("Tesla gate detected enemy: " + component2.mainScript.enemyType.enemyName + ", Idle: " + isIdleTrigger + ", Kill: " + isKillTrigger)); if (isIdleTrigger) { } if (isKillTrigger && (Object)(object)component2 != (Object)null && (Object)(object)component2.mainScript != (Object)null && ((NetworkBehaviour)component2.mainScript).IsOwner && component2.mainScript.enemyType.canDie && !component2.mainScript.isEnemyDead) { val.Hit(5, Vector3.zero, (PlayerControllerB)null, true, -1); } } } private void OnTriggerStay(Collider collider) { //IL_004c: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!isKillTrigger) { return; } PlayerControllerB component = ((Component)collider).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController && !component.isPlayerDead) { GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.down * 17f, true, (CauseOfDeath)11, 0, default(Vector3)); return; } EnemyAICollisionDetect component2 = ((Component)collider).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.mainScript != (Object)null && ((NetworkBehaviour)component2.mainScript).IsOwner && component2.mainScript.enemyType.canDie && !component2.mainScript.isEnemyDead) { component2.mainScript.KillEnemyOnOwnerClient(false); } } private void OnTriggerExit(Collider collider) { PlayerControllerB component = ((Component)collider).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { teslaGate.engagingPlayerList.Remove(component); teslaGate.engagingList.Remove(((Component)collider).gameObject); if (isIdleTrigger) { teslaGate.activatePlayerList.Remove(component); teslaGate.activateList.Remove(((Component)collider).gameObject); } } } } [HarmonyPatch(typeof(Dungeon))] internal class DungeonPatch { [HarmonyPrefix] [HarmonyPatch("SpawnDoorPrefab")] private static void SpawnDoorPrefab_Prefix(Doorway a, Doorway b, RandomStream randomStream) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown for (int i = 0; i < a.ConnectorPrefabWeights.Count; i++) { GameObjectWeight val = a.ConnectorPrefabWeights[i]; if (((Object)val.GameObject).name == "TeslaGateSpawn") { return; } if (((Object)val.GameObject).name == "BigDoorSpawn") { GameObjectWeight val2 = new GameObjectWeight(); a.ConnectorPrefabWeights.Add(val2); val2.Weight = 0.05f * Plugin.teslaSpawnWeight; val2.GameObject = Plugin.teslaGateSpawn; Plugin.mls.LogInfo((object)("added tesla to " + ((Object)((Component)a).gameObject).name)); } } for (int j = 0; j < b.ConnectorPrefabWeights.Count; j++) { GameObjectWeight val3 = b.ConnectorPrefabWeights[j]; if (((Object)val3.GameObject).name == "TeslaGateSpawn") { break; } if (((Object)val3.GameObject).name == "BigDoorSpawn") { GameObjectWeight val4 = new GameObjectWeight(); b.ConnectorPrefabWeights.Add(val4); val4.Weight = 0.07f * Plugin.teslaSpawnWeight; val4.GameObject = Plugin.teslaGateSpawn; Plugin.mls.LogInfo((object)("added tesla to " + ((Object)((Component)b).gameObject).name)); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { public static AnimationClip middleFinger; public static AnimationClip middleFinger_D; public static AnimationClip clap; public static AnimationClip clap_D; public static AnimationClip shy; public static AnimationClip griddy; public static AnimationClip twerk; public static AnimationClip salute; public static AnimationClip prisyadka; public static AnimationClip sign; public static AnimationClip sign_D; private static bool pv_isPlayerFirstFrame; private static void UpdateAnimator(PlayerControllerB __instance, Animator ___playerBodyAnimator) { } private static void UpdateMoreEmotesAnimator(PlayerControllerB __instance, Animator ___playerBodyAnimator) { //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown if ((Object)(object)middleFinger == (Object)null || (Object)(object)middleFinger_D == (Object)null || (((Object)(object)clap == (Object)null) | ((Object)(object)clap_D == (Object)null)) || (((Object)(object)shy == (Object)null) | ((Object)(object)griddy == (Object)null)) || (Object)(object)twerk == (Object)null || (Object)(object)salute == (Object)null || (Object)(object)prisyadka == (Object)null || (Object)(object)sign == (Object)null || (Object)(object)sign_D == (Object)null) { GetMoreEmotes(___playerBodyAnimator.runtimeAnimatorController); } if (!((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.playerAnimator) || !((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.otherPlayerAnimator)) { return; } if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController) { if ((Object)(object)middleFinger != (Object)null && (Object)(object)middleFinger_D != (Object)null && (Object)(object)clap != (Object)null && (Object)(object)clap_D != (Object)null && (Object)(object)shy != (Object)null && (Object)(object)griddy != (Object)null && (Object)(object)twerk != (Object)null && (Object)(object)salute != (Object)null && (Object)(object)prisyadka != (Object)null && (Object)(object)sign != (Object)null && (Object)(object)sign_D != (Object)null) { if (!(__instance.playerBodyAnimator.runtimeAnimatorController is AnimatorOverrideController)) { __instance.playerBodyAnimator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController); } __instance.SpawnPlayerAnimation(); UpdateAnimatorVariable(Plugin.playerAnimator); EmotePatch.local = Plugin.playerAnimator; Plugin.mls.LogInfo((object)"Replace More Emotes Animator!"); } } else if ((Object)(object)middleFinger != (Object)null && (Object)(object)middleFinger_D != (Object)null && (Object)(object)clap != (Object)null && (Object)(object)clap_D != (Object)null && (Object)(object)shy != (Object)null && (Object)(object)griddy != (Object)null && (Object)(object)twerk != (Object)null && (Object)(object)salute != (Object)null && (Object)(object)prisyadka != (Object)null && (Object)(object)sign != (Object)null && (Object)(object)sign_D != (Object)null) { UpdateAnimatorVariable(Plugin.otherPlayerAnimator); EmotePatch.others = Plugin.otherPlayerAnimator; Plugin.mls.LogInfo((object)"Replace More Emotes Other Animator!"); if (!(__instance.playerBodyAnimator.runtimeAnimatorController is AnimatorOverrideController)) { __instance.playerBodyAnimator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController); } } } private static void OnFirstLocalPlayerFrameWithNewAnimator(PlayerControllerB __instance) { pv_isPlayerFirstFrame = false; __instance.SpawnPlayerAnimation(); } private static void GetMoreEmotes(RuntimeAnimatorController animator) { AnimationClip[] animationClips = animator.animationClips; foreach (AnimationClip val in animationClips) { if ((Object)(object)middleFinger == (Object)null && ((Object)val).name == "Middle_Finger") { middleFinger = val; } if ((Object)(object)middleFinger_D == (Object)null && ((Object)val).name == "D_Middle_Finger") { middleFinger_D = val; } if ((Object)(object)clap == (Object)null && ((Object)val).name == "Clap") { clap = val; } if ((Object)(object)clap_D == (Object)null && ((Object)val).name == "D_Clap") { clap_D = val; } if ((Object)(object)shy == (Object)null && ((Object)val).name == "Shy") { shy = val; } if ((Object)(object)griddy == (Object)null && ((Object)val).name == "The_Griddy") { griddy = val; } if ((Object)(object)twerk == (Object)null && ((Object)val).name == "Twerk") { twerk = val; } if ((Object)(object)salute == (Object)null && ((Object)val).name == "Salute") { salute = val; } if ((Object)(object)prisyadka == (Object)null && ((Object)val).name == "Prisyadka") { prisyadka = val; } if ((Object)(object)sign == (Object)null && ((Object)val).name == "Sign") { sign = val; } if ((Object)(object)sign_D == (Object)null && ((Object)val).name == "D_Sign") { sign_D = val; } } } private static void UpdateAnimatorVariable(RuntimeAnimatorController animator) { AnimationClip[] animationClips = animator.animationClips; for (int i = 0; i < animationClips.Length; i++) { switch (((Object)animationClips[i]).name) { case "Middle_Finger": animationClips[i] = middleFinger; break; case "D_Middle_Finger": animationClips[i] = middleFinger_D; break; case "Clap": animationClips[i] = clap; break; case "D_Clap": animationClips[i] = clap_D; break; case "Shy": animationClips[i] = shy; break; case "The_Griddy": animationClips[i] = griddy; break; case "Twerk": animationClips[i] = twerk; break; case "Salute": animationClips[i] = salute; break; case "Prisyadka": animationClips[i] = prisyadka; break; case "Sign": animationClips[i] = sign; break; case "D_Sign": animationClips[i] = sign_D; break; } } } } public class GummylightItem : GrabbableObject { [Space(15f)] public bool usingPlayerHelmetLight; public int flashlightInterferenceLevel; public static int globalFlashlightInterferenceLevel; public Light flashlightBulb; public Light flashlightBulbGlow; public AudioSource flashlightAudio; public AudioClip[] flashlightClips; public AudioClip outOfBatteriesClip; public AudioClip flashlightFlicker; public Material bulbLight; public Material bulbDark; public MeshRenderer flashlightMesh; public int flashlightTypeID; public bool changeMaterial = true; private float initialIntensity; private PlayerControllerB previousPlayerHeldBy; public override void Start() { base.useCooldown = 0.12f; base.itemProperties = Plugin.gummyFlashlight; base.mainObjectRenderer = ((Component)((Component)this).transform.GetChild(2)).GetComponent<MeshRenderer>(); base.insertedBattery.charge = 1f; base.grabbableToEnemies = true; flashlightBulb = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Light>(); flashlightBulbGlow = ((Component)((Component)this).transform.GetChild(1)).GetComponent<Light>(); flashlightAudio = ((Component)this).GetComponent<AudioSource>(); flashlightClips = (AudioClip[])(object)new AudioClip[1] { Plugin.gummylightClick }; outOfBatteriesClip = Plugin.gummylightOutage; flashlightFlicker = Plugin.flashFlicker; bulbLight = Plugin.flashlightBulb; bulbDark = Plugin.blackRubber; flashlightMesh = ((Component)((Component)this).transform.GetChild(2)).GetComponent<MeshRenderer>(); changeMaterial = true; base.isInFactory = true; base.grabbable = true; flashlightTypeID = 0; Object.Destroy((Object)(object)((Component)this).GetComponent<FlashlightItem>()); ((GrabbableObject)this).Start(); initialIntensity = flashlightBulb.intensity; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (flashlightInterferenceLevel < 2) { SwitchFlashlight(used); } flashlightAudio.PlayOneShot(flashlightClips[Random.Range(0, flashlightClips.Length)]); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } public override void UseUpBatteries() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).UseUpBatteries(); SwitchFlashlight(on: false); flashlightAudio.PlayOneShot(outOfBatteriesClip, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 13f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } public override void PocketItem() { previousPlayerHeldBy.equippedUsableItemQE = false; if (!((NetworkBehaviour)this).IsOwner) { ((GrabbableObject)this).PocketItem(); return; } if ((Object)(object)previousPlayerHeldBy != (Object)null) { ((Behaviour)flashlightBulb).enabled = false; ((Behaviour)flashlightBulbGlow).enabled = false; if (base.isBeingUsed && ((Object)(object)previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot] == (Object)null || previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId != 1 || previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId != 6)) { ((Behaviour)previousPlayerHeldBy.helmetLight).enabled = true; previousPlayerHeldBy.pocketedFlashlight = (GrabbableObject)(object)this; usingPlayerHelmetLight = true; PocketFlashlightServerRpc(stillUsingFlashlight: true); } else { base.isBeingUsed = false; usingPlayerHelmetLight = false; ((Behaviour)flashlightBulbGlow).enabled = false; SwitchFlashlight(on: false); PocketFlashlightServerRpc(); } } else { Debug.Log((object)"Could not find what player was holding this flashlight item"); } if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).PocketItem(); } [ServerRpc] public void PocketFlashlightServerRpc(bool stillUsingFlashlight = false) { PocketFlashlightClientRpc(stillUsingFlashlight); } [ClientRpc] public void PocketFlashlightClientRpc(bool stillUsingFlashlight) { if (((NetworkBehaviour)this).IsOwner) { return; } ((Behaviour)flashlightBulb).enabled = false; ((Behaviour)flashlightBulbGlow).enabled = false; if (stillUsingFlashlight) { if (!((Object)(object)previousPlayerHeldBy == (Object)null)) { ((Behaviour)previousPlayerHeldBy.helmetLight).enabled = true; previousPlayerHeldBy.pocketedFlashlight = (GrabbableObject)(object)this; usingPlayerHelmetLight = true; } } else { base.isBeingUsed = false; usingPlayerHelmetLight = false; ((Behaviour)flashlightBulbGlow).enabled = false; SwitchFlashlight(on: false); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } if ((Object)(object)previousPlayerHeldBy != (Object)null) { ((Behaviour)previousPlayerHeldBy.helmetLight).enabled = false; ((Behaviour)flashlightBulb).enabled = base.isBeingUsed; ((Behaviour)flashlightBulbGlow).enabled = base.isBeingUsed; } ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { previousPlayerHeldBy = base.playerHeldBy; base.playerHeldBy.equippedUsableItemQE = true; base.playerHeldBy.ChangeHelmetLight(flashlightTypeID, true); ((Behaviour)base.playerHeldBy.helmetLight).enabled = false; usingPlayerHelmetLight = false; if (base.isBeingUsed) { SwitchFlashlight(on: true); } ((GrabbableObject)this).EquipItem(); } public void SwitchFlashlight(bool on) { base.isBeingUsed = on; if (!((NetworkBehaviour)this).IsOwner) { Debug.Log((object)$"Flashlight click. playerheldby null?: {(Object)(object)base.playerHeldBy != (Object)null}"); Debug.Log((object)$"Flashlight being disabled or enabled: {on}"); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.ChangeHelmetLight(flashlightTypeID, on); } ((Behaviour)flashlightBulb).enabled = false; ((Behaviour)flashlightBulbGlow).enabled = false; } else { ((Behaviour)flashlightBulb).enabled = on; ((Behaviour)flashlightBulbGlow).enabled = on; } if (usingPlayerHelmetLight && (Object)(object)base.playerHeldBy != (Object)null) { ((Behaviour)base.playerHeldBy.helmetLight).enabled = on; } if (changeMaterial) { Material[] sharedMaterials = ((Renderer)flashlightMesh).sharedMaterials; if (on) { sharedMaterials[1] = bulbLight; } else { sharedMaterials[1] = bulbDark; } ((Renderer)flashlightMesh).sharedMaterials = sharedMaterials; } } public override void Update() { ((GrabbableObject)this).Update(); int num = ((flashlightInterferenceLevel <= globalFlashlightInterferenceLevel) ? globalFlashlightInterferenceLevel : flashlightInterferenceLevel); if (num >= 2) { flashlightBulb.intensity = 0f; } else if (num == 1) { flashlightBulb.intensity = Random.Range(0f, 200f); } else { flashlightBulb.intensity = initialIntensity; } } public override void ItemInteractLeftRight(bool right) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"r/l activate: {right}"); ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && (Object)(object)base.playerHeldBy != (Object)null) { flashlightAudio.PlayOneShot(Plugin.flashlightShake); WalkieTalkie.TransmitOneShotAudio(flashlightAudio, Plugin.flashlightShake, 1f); base.playerHeldBy.playerBodyAnimator.SetTrigger("shakeItem"); float num = base.insertedBattery.charge * 100f + 8f; if (num <= 100f) { base.insertedBattery = new Battery(false, num * 0.01f); ((GrabbableObject)this).SyncBatteryServerRpc((int)num); } else { base.insertedBattery = new Battery(false, num * 0.01f); ((GrabbableObject)this).SyncBatteryServerRpc(100); } if (((NetworkBehaviour)this).IsOwner) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 5f, 0.2f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 941); } } } } public class M4Item : GrabbableObject { public static Dictionary<ulong, RuntimeAnimatorController> playerAnimatorDictionary = new Dictionary<ulong, RuntimeAnimatorController>(); private bool isCrouching; private bool isJumping; private bool isWalking; private bool isSprinting; private AnimatorStateInfo currentStateInfo; private float currentAnimationTime; public int gunCompatibleAmmoID = 1410; public bool isReloading; public bool isInspecting; public bool cantFire; public bool isFiring; public int ammosLoaded; public Animator gunAnimator; public AudioSource gunAudio; public AudioSource gunShootAudio; public AudioSource gunBulletsRicochetAudio; private Coroutine gunCoroutine; public AudioClip gunShootSFX; public AudioClip gunReloadSFX; public AudioClip gunInspectSFX; public AudioClip noAmmoSFX; private bool hasHitGroundWithSafetyOff = true; private int ammoSlotToUse = -1; private bool localClientSendingShootGunRPC; private PlayerControllerB previousPlayerHeldBy; public ParticleSystem gunShootParticle; public Transform gunRayPoint; private RaycastHit[] enemyColliders; private RaycastHit[] playerColliders; private EnemyAI heldByEnemy; public override void Start() { ((GrabbableObject)this).Start(); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return ammosLoaded; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); ammosLoaded = saveData; } public override void Update() { ((GrabbableObject)this).Update(); if (!isInspecting && isFiring && !isReloading && !cantFire && !base.playerHeldBy.playerBodyAnimator.GetBool("ReloadM4") && ammosLoaded > 0) { ShootGunAndSync(heldByPlayer: true); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); previousPlayerHeldBy = base.playerHeldBy; previousPlayerHeldBy.equippedUsableItemQE = true; hasHitGroundWithSafetyOff = false; if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: false); } if (Plugin.translateKorean) { KR_SetAmmoControlTip(isChecking: false); } else { SetAmmoControlTip(isChecking: false); } } public override void GrabItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: false); } ((GrabbableObject)this).GrabItem(); } public override void GrabItemFromEnemy(EnemyAI enemy) { ((GrabbableObject)this).GrabItemFromEnemy(enemy); heldByEnemy = enemy; hasHitGroundWithSafetyOff = false; } public override void DiscardItemFromEnemy() { ((GrabbableObject)this).DiscardItemFromEnemy(); heldByEnemy = null; } public override void ItemActivate(bool used, bool buttonDown = false) { Debug.Log((object)buttonDown); ((GrabbableObject)this).ItemActivate(used, buttonDown); isFiring = buttonDown; if (!isInspecting && !isReloading && !cantFire && !base.playerHeldBy.playerBodyAnimator.GetBool("ReloadM4") && ammosLoaded <= 0) { gunAudio.PlayOneShot(noAmmoSFX); } } public void ShootGunAndSync(bool heldByPlayer) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0085: Unknown result type (might be due to invalid IL or missing references) Vector3 gunPosition; Vector3 forward; if (!heldByPlayer) { gunPosition = gunRayPoint.position; forward = gunRayPoint.forward; } else { gunPosition = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position - ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.45f; forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward; } ShootGun(gunPosition, forward); } [ServerRpc(RequireOwnership = false)] public void ShootGunServerRpc(Vector3 gunPosition, Vector3 gunForward) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) ShootGunClientRpc(gunPosition, gunForward); } [ClientRpc] public void ShootGunClientRpc(Vector3 gunPosition, Vector3 gunForward) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Shoot gun client rpc received"); if (localClientSendingShootGunRPC) { localClientSendingShootGunRPC = false; Debug.Log((object)"localClientSendingShootGunRPC was true"); } else { ShootGun(gunPosition, gunForward); } } public IEnumerator FireDelay() { cantFire = true; yield return (object)new WaitForSeconds(0.07f); cantFire = false; } public void ShootGun(Vector3 gunPosition, Vector3 gunForward) { //IL_01a0: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01f0: 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_01f3: 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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) if (Plugin.translateKorean) { KR_SetAmmoControlTip(isChecking: false); } else { SetAmmoControlTip(isChecking: false); } CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0); FlowerSnakeEnemy[] array2 = Object.FindObjectsByType<FlowerSnakeEnemy>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].clingingToPlayer == (Object)(object)base.playerHeldBy) { ((EnemyAI)array[i]).HitEnemy(2, base.playerHeldBy, true, -1); } } for (int j = 0; j < array2.Length; j++) { if ((Object)(object)array2[j].clingingToPlayer == (Object)(object)base.playerHeldBy) { ((EnemyAI)array2[j]).HitEnemy(2, base.playerHeldBy, true, -1); } } ((MonoBehaviour)this).StartCoroutine(FireDelay()); bool flag = false; if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootM4"); flag = true; } gunAnimator.SetTrigger("Fire"); gunShootAudio.PlayOneShot(gunShootSFX); WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX, 1f); gunShootParticle.Play(true); ammosLoaded = Mathf.Clamp(ammosLoaded - 1, 0, 30); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } float num = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)gunRayPoint).transform.position); bool flag2 = false; int num2 = 0; float num3 = 0f; Vector3 val = localPlayerController.playerCollider.ClosestPoint(gunPosition); if (!flag && !Physics.Linecast(gunPosition, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Vector3.Angle(gunForward, val - gunPosition) < 30f) { flag2 = true; } if (num < 12f) { num3 = 0.25f; HUDManager.Instance.ShakeCamera((ScreenShakeType)0); num2 = 100; } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward); if (enemyColliders == null) { enemyColliders = (RaycastHit[])(object)new RaycastHit[35]; } RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref val3, float.PositiveInfinity, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { ((Component)gunBulletsRicochetAudio).transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.5f); gunBulletsRicochetAudio.Play(); } if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController) { int num4 = Physics.SphereCastNonAlloc(val2, 0.25f, enemyColliders, float.PositiveInfinity, 524288, (QueryTriggerInteraction)2); IHittable val4 = default(IHittable); for (int k = 0; k < num4; k++) { Debug.Log((object)"Raycasting enemy"); if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[k])).transform).GetComponent<EnemyAICollisionDetect>())) { continue; } EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[k])).transform).GetComponent<EnemyAICollisionDetect>().mainScript; if ((Object)(object)heldByEnemy != (Object)null && (Object)(object)heldByEnemy == (Object)(object)mainScript) { Debug.Log((object)"Rifle is held by enemy, skipping enemy raycast"); continue; } Debug.Log((object)("Hit enemy " + mainScript.enemyType.enemyName)); if (((RaycastHit)(ref enemyColliders[k])).distance == 0f) { Debug.Log((object)"Spherecast started inside enemy collider"); } else if (Physics.Linecast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[k])).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Debug.DrawRay(((RaycastHit)(ref val3)).point, Vector3.up, Color.red, 15f); Debug.DrawLine(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[k])).point, Color.cyan, 15f); Plugin.mls.LogInfo((object)("Raycast hit wall: " + ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name + ", distance: " + ((RaycastHit)(ref val3)).distance)); } else if (((Component)((RaycastHit)(ref enemyColliders[k])).transform).TryGetComponent<IHittable>(ref val4)) { Vector3 forward = ((Component)base.playerHeldBy.gameplayCamera).transform.forward; float num5 = Vector3.Distance(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[k])).point); Plugin.mls.LogInfo((object)("Damage to enemy, damage: " + Plugin.rifleMonsterDamage + ", distance:" + num5)); val4.Hit(Plugin.rifleMonsterDamage, forward, base.playerHeldBy, true, -1); } else { Plugin.mls.LogInfo((object)("Could not get hittable script from collider, transform: " + ((Object)((RaycastHit)(ref enemyColliders[k])).transform).name)); } } } if (playerColliders == null) { playerColliders = (RaycastHit[])(object)new RaycastHit[10]; } int num6 = Physics.SphereCastNonAlloc(val2, 0.3f, playerColliders, float.PositiveInfinity, StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers, (QueryTriggerInteraction)2); for (int l = 0; l < num6; l++) { if ((Object)(object)((Component)((RaycastHit)(ref playerColliders[l])).transform).GetComponent<PlayerControllerB>() != (Object)null && (Object)(object)((Component)((RaycastHit)(ref playerColliders[l])).transform).GetComponent<PlayerControllerB>() != (Object)(object)base.playerHeldBy) { float num7 = Vector3.Distance(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref playerColliders[l])).point); if (num7 < 10f) { ((Component)((RaycastHit)(ref playerColliders[l])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Plugin.rifleMaxPlayerDamage, true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f); } else if (num7 < 25f) { ((Component)((RaycastHit)(ref playerColliders[l])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Mathf.RoundToInt((float)(Plugin.rifleMaxPlayerDamage - Plugin.rifleMaxPlayerDamage / 3)), true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f); } else { ((Component)((RaycastHit)(ref playerColliders[l])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Mathf.RoundToInt((float)(Plugin.rifleMaxPlayerDamage / 3)), true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f); } Debug.Log((object)"Rifle vs Player why COD"); } } } private IEnumerator delayedEarsRinging(float effectSeverity) { yield return (object)new WaitForSeconds(0.25f); SoundManager.Instance.earsRingingTimer = effectSeverity; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!((Object)(object)base.playerHeldBy == (Object)null)) { Debug.Log((object)$"r/l activate: {right}"); if (!right) { StartCheckMagazine(); } else if (!isInspecting && !isReloading && ammosLoaded < 30) { StartReloadGun(); } } } private void StartReloadGun() { if ((Plugin.customGunInfinityAmmo || ReloadedGun()) && !isReloading) { ((MonoBehaviour)this).StartCoroutine(ReloadGunAnimation()); } else { gunAudio.PlayOneShot(noAmmoSFX); } } private void StartCheckMagazine() { if (!isInspecting) { ((MonoBehaviour)this).StartCoroutine(CheckAmmoGunAnimation()); } else { gunAudio.PlayOneShot(noAmmoSFX); } } private IEnumerator CheckAmmoGunAnimation() { base.playerHeldBy.playerBodyAnimator.SetTrigger("InspectM4"); isInspecting = true; gunAudio.PlayOneShot(gunInspectSFX); if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController) { WalkieTalkie.TransmitOneShotAudio(gunAudio, gunInspectSFX, 1f); } yield return (object)new WaitForSeconds(1f); if (Plugin.translateKorean) { KR_SetAmmoControlTip(isChecking: true); } else { SetAmmoControlTip(isChecking: true); } yield return (object)new WaitForSeconds(1f); isInspecting = false; } private void SetAmmoControlTip(bool isChecking) { string text = "Check ammo : [Q]"; if (ammosLoaded == 30) { text = (isChecking ? "Check ammo : [Q] [Full]" : "Check ammo : [Q] [??]"); } else if (ammosLoaded >= 20 && 30 > ammosLoaded) { text = (isChecking ? "Check ammo : [Q] [<30]" : "Check ammo : [Q] [??]"); } else if (ammosLoaded >= 10 && 20 > ammosLoaded) { text = (isChecking ? "Check ammo : [Q] [<20]" : "Check ammo : [Q] [??]"); } else if (ammosLoaded >= 1 && 10 > ammosLoaded) { text = (isChecking ? "Check ammo : [Q] [<10]" : "Check ammo : [Q] [??]"); } else if (ammosLoaded <= 0) { text = (isChecking ? "Check ammo : [Q] [Empty]" : "Check ammo : [Q] [??]"); } if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTip(3, text, false); } } private void KR_SetAmmoControlTip(bool isChecking) { string text = "탄약 확인하기 : [Q]"; if (ammosLoaded == 30) { text = (isChecking ? "탄약 확인하기 : [Q] [가득 참]" : "탄약 확인하기 : [Q] [??]"); } else if (ammosLoaded >= 20 && 30 > ammosLoaded) { text = (isChecking ? "탄약 확인하기 : [Q] [<30]" : "탄약 확인하기 : [Q] [??]"); } else if (ammosLoaded >= 10 && 20 > ammosLoaded) { text = (isChecking ? "탄약 확인하기 : [Q] [<20]" : "탄약 확인하기 : [Q] [??]"); } else if (ammosLoaded >= 1 && 10 > ammosLoaded) { text = (isChecking ? "탄약 확인하기 : [Q] [<10]" : "탄약 확인하기 : [Q] [??]"); } else if (ammosLoaded <= 0) { text = (isChecking ? "탄약 확인하기 : [Q] [비어 있음]" : "탄약 확인하기 : [Q] [??]"); } if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTip(3, text, false); } } private IEnumerator ReloadGunAnimation() { base.playerHeldBy.playerBodyAnimator.SetTrigger("ReloadM4"); gunAnimator.SetTrigger("Reloading"); isReloading = true; gunAudio.PlayOneShot(gunReloadSFX); if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController) { WalkieTalkie.TransmitOneShotAudio(gunAudio, gunReloadSFX, 1f); } yield return (object)new WaitForSeconds(2f); if (isReloading) { if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController && !Plugin.customGunInfinityAmmo) { base.playerHeldBy.DestroyItemInSlotAndSync(ammoSlotToUse); } ammoSlotToUse = -1; ammosLoaded = 30; if (Plugin.translateKorean) { KR_SetAmmoControlTip(isChecking: true); } else { SetAmmoControlTip(isChecking: true); } } yield return (object)new WaitForSeconds(0.55f); isReloading = false; } private bool ReloadedGun() { int num = FindAmmoInInventory(); if (num == -1) { Debug.Log((object)"not reloading"); return false; } Debug.Log((object)"reloading!"); ammoSlotToUse = num; return true; } private int FindAmmoInInventory() { for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null)) { GrabbableObject obj = base.playerHeldBy.ItemSlots[i]; GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null); Debug.Log((object)$"Ammo null in slot #{i}?: {(Object)(object)val == (Object)null}"); if ((Object)(object)val != (Object)null) { Debug.Log((object)$"Ammo in slot #{i} id: {val.ammoType}"); } if ((Object)(object)val != (Object)null && val.ammoType == gunCompatibleAmmoID) { return i; } } } return -1; } public override void PocketItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: true); } ((GrabbableObject)this).PocketItem(); StopUsingGun(); } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: true); } ((GrabbableObject)this).DiscardItem(); StopUsingGun(); } private void StopUsingGun() { previousPlayerHeldBy.equippedUsableItemQE = false; if (gunCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(gunCoroutine); } gunAudio.Stop(); isReloading = false; previousPlayerHeldBy.playerBodyAnimator.SetTrigger("SwitchHoldAnimation"); gunAnimator.SetTrigger("Reset"); isInspecting = false; } private void UpdateAnimator(PlayerControllerB player, Animator playerBodyAnimator, bool restore) { if (!restore) { if ((Object)(object)playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.playerAnimator && (Object)(object)playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.otherPlayerAnimator) { if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController) { SaveAnimatorStates(playerBodyAnimator); playerBodyAnimator.runtimeAnimatorController = Plugin.playerAnimator; RestoreAnimatorStates(playerBodyAnimator); Plugin.mls.LogInfo((object)"Replace Player Animator!"); } else { SaveAnimatorStates(playerBodyAnimator); playerBodyAnimator.runtimeAnimatorController = Plugin.otherPlayerAnimator; RestoreAnimatorStates(playerBodyAnimator); Plugin.mls.LogInfo((object)"Replace Other Player Animator!"); } } } else if (playerAnimatorDictionary.ContainsKey(player.playerClientId)) { playerBodyAnimator.runtimeAnimatorController = playerAnimatorDictionary[player.playerClientId]; playerAnimatorDictionary.Remove(player.playerClientId); Plugin.mls.LogInfo((object)"Restored Player Animator!"); } } private void SaveAnimatorStates(Animator animator) { //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) isCrouching = animator.GetBool("crouching"); isJumping = animator.GetBool("Jumping"); isWalking = animator.GetBool("Walking"); isSprinting = animator.GetBool("Sprinting"); currentStateInfo = animator.GetCurrentAnimatorStateInfo(0); currentAnimationTime = ((AnimatorStateInfo)(ref currentStateInfo)).normalizedTime; } public void RestoreAnimatorStates(Animator animator) { animator.Play(((AnimatorStateInfo)(ref currentStateInfo)).fullPathHash, 0, currentAnimationTime); animator.SetBool("crouching", isCrouching); animator.SetBool("Jumping", isJumping); animator.SetBool("Walking", isWalking); animator.SetBool("Sprinting", isSprinting); } } public class RevolverItem : GrabbableObject { public static Dictionary<ulong, RuntimeAnimatorController> playerAnimatorDictionary = new Dictionary<ulong, RuntimeAnimatorController>(); private bool isCrouching; private bool isJumping; private bool isWalking; private bool isSprinting; private AnimatorStateInfo currentStateInfo; private float currentAnimationTime; public int gunCompatibleAmmoID = 1410; public bool isReloading; public bool cantFire; public Transform cylinderTransform; public bool isCylinderMoving; public int ammosLoaded; public Animator gunAnimator; public AudioSource gunAudio; public AudioSource gunShootAudio; public AudioSource gunBulletsRicochetAudio; private Coroutine gunCoroutine; public List<AudioClip> gunShootSFX = new List<AudioClip>(); public AudioClip gunReloadSFX; public AudioClip cylinderOpenSFX; public AudioClip cylinderCloseSFX; public AudioClip gunReloadFinishSFX; public AudioClip noAmmoSFX; public AudioClip gunSafetySFX; public AudioClip switchSafetyOnSFX; public AudioClip switchSafetyOffSFX; private bool hasHitGroundWithSafetyOff = true; private int ammoSlotToUse = -1; private bool localClientSendingShootGunRPC; private PlayerControllerB previousPlayerHeldBy; public ParticleSystem gunShootParticle; public Transform revolverRayPoint; public List<MeshRenderer> revolverAmmos = new List<MeshRenderer>(); public MeshRenderer revolverAmmoInHand; public Transform revolverAmmoInHandTransform; private RaycastHit[] enemyColliders; private RaycastHit[] playerColliders; private EnemyAI heldByEnemy; public override void Start() { ((GrabbableObject)this).Start(); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return ammosLoaded; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); ammosLoaded = saveData; } public override void Update() { //IL_0055: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((GrabbableObject)this).Update(); if (!isReloading) { switch (ammosLoaded) { case 0: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 0f, 0f)), Time.deltaTime * 25f); break; case 1: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 60f, 0f)), Time.deltaTime * 25f); break; case 2: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 120f, 0f)), Time.deltaTime * 25f); break; case 3: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 180f, 0f)), Time.deltaTime * 25f); break; case 4: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 240f, 0f)), Time.deltaTime * 25f); break; case 5: cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 300f, 0f)), Time.deltaTime * 25f); break; case 6: cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); break; } } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); SyncRevolverAmmoServerRpc(ammosLoaded); if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: false); } base.playerHeldBy.playerBodyAnimator.SetBool("ReloadRevolver", false); gunAnimator.SetBool("Reloading", false); ((Renderer)revolverAmmoInHand).enabled = false; previousPlayerHeldBy = base.playerHeldBy; previousPlayerHeldBy.equippedUsableItemQE = true; isCylinderMoving = false; hasHitGroundWithSafetyOff = false; foreach (MeshRenderer revolverAmmo in revolverAmmos) { ((Renderer)revolverAmmo).enabled = false; } if (ammosLoaded > 0) { for (int i = 0; i <= ammosLoaded - 1; i++) { ((Renderer)revolverAmmos[i]).enabled = true; } } } public override void GrabItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { UpdateAnimator(base.playerHeldBy, base.playerHeldBy.playerBodyAnimator, restore: false); } ((GrabbableObject)this).GrabItem(); } public override void GrabItemFromEnemy(EnemyAI enemy) { ((GrabbableObject)this).GrabItemFromEnemy(enemy); heldByEnemy = enemy; hasHitGroundWithSafetyOff = false; } public override void DiscardItemFromEnemy() { ((GrabbableObject)this).DiscardItemFromEnemy(); heldByEnemy = null; } public override void ItemActivate(bool used, bool buttonDown = true) { SyncRevolverAmmoServerRpc(ammosLoaded); ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!isReloading && !cantFire && !gunAnimator.GetBool("Reloading")) { if (ammosLoaded > 0) { gunAnimator.SetBool("Reloading", false); ShootGunAndSync(heldByPlayer: true); } else { ((MonoBehaviour)this).StartCoroutine(FireDelay()); gunAnimator.SetTrigger("Fire"); gunAudio.PlayOneShot(noAmmoSFX); } } } public void ShootGunAndSync(bool heldByPlayer) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) Vector3 revolverPosition; Vector3 forward; if (!heldByPlayer) { revolverPosition = revolverRayPoint.position; forward = revolverRayPoint.forward; } else { revolverPosition = ((Component)base.playerHeldBy.gameplayCamera).transform.position - ((Component)base.playerHeldBy.gameplayCamera).transform.up * 0.45f; forward = ((Component)base.playerHeldBy.gameplayCamera).transform.forward; } ShootGun(revolverPosition, forward); } public IEnumerator FireDelay() { cantFire = true; yield return (object)new WaitForSeconds(0.2f); cantFire = false; } public void ShootGun(Vector3 revolverPosition, Vector3 revolverForward) { //IL_021e: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0375: 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_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_086c: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0928: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0); FlowerSnakeEnemy[] array2 = Object.FindObjectsByType<FlowerSnakeEnemy>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].clingingToPlayer == (Object)(object)base.playerHeldBy) { ((EnemyAI)array[i]).HitEnemy(5, base.playerHeldBy, true, -1); } } for (int j = 0; j < array2.Length; j++) { if ((Object)(object)array2[j].clingingToPlayer == (Object)(object)base.playerHeldBy) { ((EnemyAI)array2[j]).HitEnemy(5, base.playerHeldBy, true, -1); } } ((MonoBehaviour)this).StartCoroutine(FireDelay()); bool flag = false; if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootRevolver"); flag = true; } gunAnimator.SetTrigger("Fire"); RoundManager.PlayRandomClip(gunShootAudio, gunShootSFX.ToArray(), true, 1f, 1840, 1000); WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX[0], 1f); gunShootParticle.Play(true); ammosLoaded = Mathf.Clamp(ammosLoaded - 1, 0, 6); foreach (MeshRenderer revolverAmmo in revolverAmmos) { ((Renderer)revolverAmmo).enabled = false; } if (ammosLoaded > 0) { for (int k = 0; k <= ammosLoaded - 1; k++) {
BepInEx/plugins/ZoLoKinoBabo112/RemoveCameraFilter.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using UnityEngine; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RemoveCameraFilter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RemoveCameraFilter")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8119b276-5c2c-446f-a321-72045794dc73")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace RemoveCameraFilter; [BepInPlugin("kruumy.RemoveCameraFilter", "Remove Camera Filter", "1.0.0")] public class Main : BaseUnityPlugin { private void Awake() { SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; } private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) { Object[] array = Object.FindObjectsOfTypeAll(typeof(CustomPassVolume)); foreach (Object obj in array) { CustomPassVolume val = (CustomPassVolume)(object)((obj is CustomPassVolume) ? obj : null); if (val != null) { ((Behaviour)val).enabled = false; val.isGlobal = false; } } } }
BepInEx/plugins/ZoLoKinoBabo112/TerminalApi.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using TerminalApi.Classes; using TerminalApi.Interfaces; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("NotAtomicBomb")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Terminal Api for the terminal in Lethal Company")] [assembly: AssemblyFileVersion("1.5.4.0")] [assembly: AssemblyInformationalVersion("1.5.4+230812eb359f012999d6df8272f5274b84e4394f")] [assembly: AssemblyProduct("TerminalApi")] [assembly: AssemblyTitle("TerminalApi")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/NotAtomicBomb/TerminalApi")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TerminalApi { internal class DelayedAddTerminalKeyword : IDelayedAction { internal Action<TerminalKeyword, CommandInfo> Action { get; set; } internal CommandInfo CommandInfo { get; set; } internal TerminalKeyword Keyword { get; set; } public void Run() { Action(Keyword, CommandInfo); } } [BepInPlugin("atomic.terminalapi", "Terminal Api", "1.5.4")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry<bool> configEnableLogs; public ManualLogSource Log; internal void SetupConfig() { configEnableLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableLogs", true, "Whether or not to display logs pertaining to TerminalAPI. Will still log that the mod has loaded."); } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) SetupConfig(); object obj = this; obj = (object)((!configEnableLogs.Value) ? ((ManualLogSource)null) : new ManualLogSource("Terminal Api")); ((Plugin)obj).Log = (ManualLogSource)obj; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TerminalApi is loaded!"); if (Log != null) { Logger.Sources.Add((ILogSource)(object)Log); } TerminalApi.plugin = this; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } public static class TerminalApi { public static Plugin plugin; internal static List<IDelayedAction> QueuedDelayedActions = new List<IDelayedAction>(); internal static List<CommandInfo> CommandInfos = new List<CommandInfo>(); public static Terminal Terminal { get; internal set; } public static List<TerminalNode> SpecialNodes => Terminal.terminalNodes.specialNodes; public static string CurrentText => Terminal.currentText; public static TMP_InputField ScreenText => Terminal.screenText; public static bool IsInGame() { try { return Terminal != null; } catch (NullReferenceException) { return false; } } public static void AddCommand(string commandWord, string displayText, string verbWord = null, bool clearPreviousText = true) { commandWord = commandWord.ToLower(); TerminalKeyword val = CreateTerminalKeyword(commandWord); TerminalNode val2 = CreateTerminalNode(displayText, clearPreviousText); if (verbWord != null) { verbWord = verbWord.ToLower(); TerminalKeyword terminalKeyword = CreateTerminalKeyword(verbWord, isVerb: true); AddTerminalKeyword(val.defaultVerb = terminalKeyword.AddCompatibleNoun(val, val2)); AddTerminalKeyword(val); } else { val.specialKeywordResult = val2; AddTerminalKeyword(val); } } public static void AddCommand(string commandWord, CommandInfo commandInfo, string verbWord = null, bool clearPreviousText = true) { commandWord = commandWord.ToLower(); TerminalKeyword val = CreateTerminalKeyword(commandWord); TerminalNode val3 = (commandInfo.TriggerNode = CreateTerminalNode("", clearPreviousText)); if (verbWord != null) { verbWord = verbWord.ToLower(); TerminalKeyword terminalKeyword = CreateTerminalKeyword(verbWord, isVerb: true); AddTerminalKeyword(val.defaultVerb = terminalKeyword.AddCompatibleNoun(val, val3)); AddTerminalKeyword(val, commandInfo); } else { val.specialKeywordResult = val3; AddTerminalKeyword(val, commandInfo); } } public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, TerminalNode triggeringNode = null) { TerminalKeyword obj = ScriptableObject.CreateInstance<TerminalKeyword>(); obj.word = word.ToLower(); obj.isVerb = isVerb; obj.specialKeywordResult = triggeringNode; return obj; } public static TerminalKeyword CreateTerminalKeyword(string word, string displayText, bool clearPreviousText = false, string terminalEvent = "") { TerminalKeyword obj = ScriptableObject.CreateInstance<TerminalKeyword>(); obj.word = word.ToLower(); obj.isVerb = false; obj.specialKeywordResult = CreateTerminalNode(displayText, clearPreviousText, terminalEvent); return obj; } public static TerminalNode CreateTerminalNode(string displayText, bool clearPreviousText = false, string terminalEvent = "") { TerminalNode obj = ScriptableObject.CreateInstance<TerminalNode>(); obj.displayText = displayText; obj.clearPreviousText = clearPreviousText; obj.terminalEvent = terminalEvent; return obj; } public static void AddTerminalKeyword(TerminalKeyword terminalKeyword) { if (IsInGame()) { if (GetKeyword(terminalKeyword.word) == null) { Terminal.terminalNodes.allKeywords = Terminal.terminalNodes.allKeywords.Add(terminalKeyword); ManualLogSource log = plugin.Log; if (log != null) { log.LogMessage((object)("Added " + terminalKeyword.word + " keyword to terminal keywords.")); } } else { ManualLogSource log2 = plugin.Log; if (log2 != null) { log2.LogWarning((object)("Failed to add " + terminalKeyword.word + " keyword. Already exists.")); } } } else { ManualLogSource log3 = plugin.Log; if (log3 != null) { log3.LogMessage((object)("Not in game, waiting to be in game to add " + terminalKeyword.word + " keyword.")); } Action<TerminalKeyword, CommandInfo> action = AddTerminalKeyword; DelayedAddTerminalKeyword item = new DelayedAddTerminalKeyword { Action = action, Keyword = terminalKeyword }; QueuedDelayedActions.Add(item); } } public static void AddTerminalKeyword(TerminalKeyword terminalKeyword, CommandInfo commandInfo = null) { if (IsInGame()) { if (GetKeyword(terminalKeyword.word) == null) { if (commandInfo?.DisplayTextSupplier != null) { if (commandInfo?.TriggerNode == null) { commandInfo.TriggerNode = terminalKeyword.specialKeywordResult; } CommandInfos.Add(commandInfo); } if (commandInfo != null) { ((Object)terminalKeyword).name = commandInfo.Title ?? (terminalKeyword.word.Substring(0, 1).ToUpper() + terminalKeyword.word.Substring(1)); string text = "\n>" + ((Object)terminalKeyword).name.ToUpper() + "\n" + commandInfo.Description + "\n\n"; if (commandInfo.Category == null) { string text3 = (commandInfo.Category = "Other"); } NodeAppendLine(commandInfo.Category, text); } Terminal.terminalNodes.allKeywords = Terminal.terminalNodes.allKeywords.Add(terminalKeyword); ManualLogSource log = plugin.Log; if (log != null) { log.LogMessage((object)("Added " + terminalKeyword.word + " keyword to terminal keywords.")); } } else { ManualLogSource log2 = plugin.Log; if (log2 != null) { log2.LogWarning((object)("Failed to add " + terminalKeyword.word + " keyword. Already exists.")); } } } else { ManualLogSource log3 = plugin.Log; if (log3 != null) { log3.LogMessage((object)("Not in game, waiting to be in game to add " + terminalKeyword.word + " keyword.")); } Action<TerminalKeyword, CommandInfo> action = AddTerminalKeyword; DelayedAddTerminalKeyword item = new DelayedAddTerminalKeyword { Action = action, Keyword = terminalKeyword, CommandInfo = commandInfo }; QueuedDelayedActions.Add(item); } } public static void NodeAppendLine(string word, string text) { if (!IsInGame()) { return; } TerminalKeyword keyword = GetKeyword(word.ToLower()); if ((Object)(object)keyword != (Object)null) { if ((Object)(object)keyword.specialKeywordResult == (Object)null) { ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)("Failed to add text to " + word + ". Does not have specialKeywordResult.")); } } else { keyword.specialKeywordResult.displayText = keyword.specialKeywordResult.displayText.Trim() + "\n" + text; } } else { ManualLogSource log2 = plugin.Log; if (log2 != null) { log2.LogWarning((object)("Failed to add text to " + word + ". Does not exist.")); } } } public static TerminalKeyword GetKeyword(string keyword) { if (IsInGame()) { return ((IEnumerable<TerminalKeyword>)Terminal.terminalNodes.allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword Kw) => Kw.word == keyword)); } return null; } public static void UpdateKeyword(TerminalKeyword keyword) { if (!IsInGame()) { return; } for (int i = 0; i < Terminal.terminalNodes.allKeywords.Length; i++) { if (Terminal.terminalNodes.allKeywords[i].word == keyword.word) { Terminal.terminalNodes.allKeywords[i] = keyword; return; } } ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)("Failed to update " + keyword.word + ". Was not found in keywords.")); } } public static void DeleteKeyword(string word) { if (!IsInGame()) { return; } for (int i = 0; i < Terminal.terminalNodes.allKeywords.Length; i++) { if (Terminal.terminalNodes.allKeywords[i].word == word.ToLower()) { int newSize = Terminal.terminalNodes.allKeywords.Length - 1; for (int j = i + 1; j < Terminal.terminalNodes.allKeywords.Length; j++) { Terminal.terminalNodes.allKeywords[j - 1] = Terminal.terminalNodes.allKeywords[j]; } Array.Resize(ref Terminal.terminalNodes.allKeywords, newSize); ManualLogSource log = plugin.Log; if (log != null) { log.LogMessage((object)(word + " was deleted successfully.")); } return; } } ManualLogSource log2 = plugin.Log; if (log2 != null) { log2.LogWarning((object)("Failed to delete " + word + ". Was not found in keywords.")); } } public static void UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode newTriggerNode) { if (!IsInGame() || !verbKeyword.isVerb) { return; } for (int i = 0; i < verbKeyword.compatibleNouns.Length; i++) { CompatibleNoun val = verbKeyword.compatibleNouns[i]; if (val.noun.word == noun) { val.result = newTriggerNode; UpdateKeyword(verbKeyword); return; } } ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)$"WARNING: No noun found for {verbKeyword}"); } } public static void UpdateKeywordCompatibleNoun(string verbWord, string noun, TerminalNode newTriggerNode) { if (!IsInGame()) { return; } TerminalKeyword keyword = GetKeyword(verbWord); if (!keyword.isVerb || verbWord == null) { return; } for (int i = 0; i < keyword.compatibleNouns.Length; i++) { CompatibleNoun val = keyword.compatibleNouns[i]; if (val.noun.word == noun) { val.result = newTriggerNode; UpdateKeyword(keyword); return; } } ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)$"WARNING: No noun found for {keyword}"); } } public static void UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, string newDisplayText) { if (!IsInGame() || !verbKeyword.isVerb) { return; } for (int i = 0; i < verbKeyword.compatibleNouns.Length; i++) { CompatibleNoun val = verbKeyword.compatibleNouns[i]; if (val.noun.word == noun) { val.result.displayText = newDisplayText; UpdateKeyword(verbKeyword); return; } } ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)$"WARNING: No noun found for {verbKeyword}"); } } public static void UpdateKeywordCompatibleNoun(string verbWord, string noun, string newDisplayText) { if (!IsInGame()) { return; } TerminalKeyword keyword = GetKeyword(verbWord); if (!keyword.isVerb) { return; } for (int i = 0; i < keyword.compatibleNouns.Length; i++) { CompatibleNoun val = keyword.compatibleNouns[i]; if (val.noun.word == noun) { val.result.displayText = newDisplayText; UpdateKeyword(keyword); return; } } ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)$"WARNING: No noun found for {keyword}"); } } public static void AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, string displayText, bool clearPreviousText = false) { if (IsInGame()) { TerminalKeyword keyword = GetKeyword(noun); verbKeyword = verbKeyword.AddCompatibleNoun(keyword, displayText, clearPreviousText); UpdateKeyword(verbKeyword); } } public static void AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode triggerNode) { if (IsInGame()) { TerminalKeyword keyword = GetKeyword(noun); verbKeyword = verbKeyword.AddCompatibleNoun(keyword, triggerNode); UpdateKeyword(verbKeyword); } } public static void AddCompatibleNoun(string verbWord, string noun, TerminalNode triggerNode) { if (!IsInGame()) { return; } TerminalKeyword keyword = GetKeyword(verbWord); TerminalKeyword keyword2 = GetKeyword(noun); if ((Object)(object)keyword == (Object)null) { ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)"The verb given does not exist."); } } else { keyword = keyword.AddCompatibleNoun(keyword2, triggerNode); UpdateKeyword(keyword); } } public static void AddCompatibleNoun(string verbWord, string noun, string displayText, bool clearPreviousText = false) { if (!IsInGame()) { return; } TerminalKeyword keyword = GetKeyword(verbWord); TerminalKeyword keyword2 = GetKeyword(noun); if ((Object)(object)keyword == (Object)null) { ManualLogSource log = plugin.Log; if (log != null) { log.LogWarning((object)"The verb given does not exist."); } } else { keyword = keyword.AddCompatibleNoun(keyword2, displayText, clearPreviousText); UpdateKeyword(keyword); } } public static string GetTerminalInput() { if (IsInGame()) { return CurrentText.Substring(CurrentText.Length - Terminal.textAdded); } return ""; } public static void SetTerminalInput(string terminalInput) { Terminal.TextChanged(CurrentText.Substring(0, CurrentText.Length - Terminal.textAdded) + terminalInput); ScreenText.text = CurrentText; Terminal.textAdded = terminalInput.Length; } } public static class TerminalExtenstionMethods { public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, TerminalNode result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (terminalKeyword.isVerb) { CompatibleNoun val = new CompatibleNoun { noun = noun, result = result }; if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val }; } else { terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val); } return terminalKeyword; } return null; } public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, TerminalNode result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (terminalKeyword.isVerb) { CompatibleNoun val = new CompatibleNoun { noun = TerminalApi.CreateTerminalKeyword(noun), result = result }; if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val }; } else { terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val); } return terminalKeyword; } return null; } public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, string displayText) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (terminalKeyword.isVerb) { CompatibleNoun val = new CompatibleNoun { noun = TerminalApi.CreateTerminalKeyword(noun), result = TerminalApi.CreateTerminalNode(displayText) }; if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val }; } else { terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val); } return terminalKeyword; } return null; } public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, string displayText, bool clearPreviousText = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (terminalKeyword.isVerb) { CompatibleNoun val = new CompatibleNoun { noun = noun, result = TerminalApi.CreateTerminalNode(displayText, clearPreviousText) }; if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val }; } else { terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val); } return terminalKeyword; } return null; } internal static T[] Add<T>(this T[] array, T newItem) { int num = array.Length + 1; Array.Resize(ref array, num); array[num - 1] = newItem; return array; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TerminalApi"; public const string PLUGIN_NAME = "TerminalApi"; public const string PLUGIN_VERSION = "1.5.4"; } } namespace TerminalApi.Interfaces { internal interface IDelayedAction { internal void Run(); } } namespace TerminalApi.Events { [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] [HarmonyPatch(typeof(Terminal))] public static class Events { public class TerminalEventArgs : EventArgs { public Terminal Terminal { get; set; } } public delegate void TerminalEventHandler(object sender, TerminalEventArgs e); public class TerminalParseSentenceEventArgs : TerminalEventArgs { public TerminalNode ReturnedNode { get; set; } public string SubmittedText { get; set; } } public delegate void TerminalParseSentenceEventHandler(object sender, TerminalParseSentenceEventArgs e); public class TerminalTextChangedEventArgs : TerminalEventArgs { public string NewText; public string CurrentInputText; } public delegate void TerminalTextChangedEventHandler(object sender, TerminalTextChangedEventArgs e); public static event TerminalEventHandler TerminalAwake; public static event TerminalEventHandler TerminalWaking; public static event TerminalEventHandler TerminalStarted; public static event TerminalEventHandler TerminalStarting; public static event TerminalEventHandler TerminalBeginUsing; public static event TerminalEventHandler TerminalBeganUsing; public static event TerminalEventHandler TerminalExited; public static event TerminalParseSentenceEventHandler TerminalParsedSentence; public static event TerminalTextChangedEventHandler TerminalTextChanged; [HarmonyPatch("Awake")] [HarmonyPostfix] public static void Awake(ref Terminal __instance) { TerminalApi.Terminal = __instance; if (TerminalApi.QueuedDelayedActions.Count > 0) { ManualLogSource log = TerminalApi.plugin.Log; if (log != null) { log.LogMessage((object)"In game, applying any changes now."); } foreach (IDelayedAction queuedDelayedAction in TerminalApi.QueuedDelayedActions) { queuedDelayedAction.Run(); } TerminalApi.QueuedDelayedActions.Clear(); } Events.TerminalAwake?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("BeginUsingTerminal")] [HarmonyPostfix] public static void BeganUsing(ref Terminal __instance) { Events.TerminalBeganUsing?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("QuitTerminal")] [HarmonyPostfix] public static void OnQuitTerminal(ref Terminal __instance) { Events.TerminalExited?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("BeginUsingTerminal")] [HarmonyPrefix] public static void OnBeginUsing(ref Terminal __instance) { Events.TerminalBeginUsing?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("ParsePlayerSentence")] [HarmonyPostfix] public static void ParsePlayerSentence(ref Terminal __instance, TerminalNode __result) { CommandInfo commandInfo = TerminalApi.CommandInfos.FirstOrDefault((CommandInfo cI) => (Object)(object)cI.TriggerNode == (Object)(object)__result); if (commandInfo != null) { __result.displayText = commandInfo?.DisplayTextSupplier(); } string submittedText = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded); Events.TerminalParsedSentence?.Invoke(__instance, new TerminalParseSentenceEventArgs { Terminal = __instance, SubmittedText = submittedText, ReturnedNode = __result }); } [HarmonyPatch("Start")] [HarmonyPostfix] public static void Started(ref Terminal __instance) { Events.TerminalStarted?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("Start")] [HarmonyPrefix] public static void Starting(ref Terminal __instance) { Events.TerminalStarting?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } [HarmonyPatch("TextChanged")] [HarmonyPostfix] public static void OnTextChanged(ref Terminal __instance, string newText) { string currentInputText = ""; if (newText.Trim().Length >= __instance.textAdded) { currentInputText = newText.Substring(newText.Length - __instance.textAdded); } Events.TerminalTextChanged?.Invoke(__instance, new TerminalTextChangedEventArgs { Terminal = __instance, NewText = newText, CurrentInputText = currentInputText }); } [HarmonyPatch("Awake")] [HarmonyPrefix] public static void Waking(ref Terminal __instance) { Events.TerminalWaking?.Invoke(__instance, new TerminalEventArgs { Terminal = __instance }); } } } namespace TerminalApi.Classes { public class CommandInfo { public string Title { get; set; } public string Category { get; set; } public string Description { get; set; } public TerminalNode TriggerNode { get; set; } public Func<string> DisplayTextSupplier { get; set; } } }
BepInEx/plugins/ZoLoKinoBabo112/TreysHealthText.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TreysHealthText")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Displays Player Health as a Number")] [assembly: AssemblyFileVersion("1.3.3.0")] [assembly: AssemblyInformationalVersion("1.3.3")] [assembly: AssemblyProduct("TreysHealthText")] [assembly: AssemblyTitle("TreysHealthText")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HealthText { [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] public static class RoundManager_LoadNewLevel_Patch { private static void Postfix(RoundManager __instance) { } } } namespace TreysHealthText { [HarmonyPatch(typeof(HUDManager), "Awake")] public static class HUDManager_Awake_Patch { private static void Postfix(HUDManager __instance) { Plugin.PluginLogger.LogInfo((object)"HUDManager Patch Ran"); PlayerControllerB val = Object.FindObjectOfType<PlayerControllerB>(); if ((Object)(object)val != (Object)null) { int health = val.health; HUDManager.Instance.UpdateHealthUI(health, Plugin.HideSystemsOnline.Value); Plugin.PluginLogger.LogInfo((object)"UpdatedHealth"); } else { Plugin.PluginLogger.LogError((object)"PlayerControllerB not found."); } } } [HarmonyPatch(typeof(HUDManager), "UpdateHealthUI")] public static class HUDManager_UpdateHealthUI_Patch { public static TextMeshProUGUI healthText; private static void Postfix(HUDManager __instance, int health) { Plugin.PluginLogger.LogInfo((object)"UpdateHealthUI Patch Ran"); if ((Object)(object)healthText == (Object)null) { CreateHealthText(__instance, 100, health); } string value = Plugin.HpTextPosition.Value; bool value2 = Plugin.UnderlineTopLine.Value; UpdateHealthText(health, rainbow: false); } private static void UpdateHealthText(int health, bool rainbow) { string value = Plugin.HpTextPosition.Value; bool value2 = Plugin.UnderlineTopLine.Value; string value3 = Plugin.HPLabelName.Value; if (rainbow) { Plugin.PluginLogger.LogInfo((object)"Updated Text Color"); } string text; string text2; if (value.Equals("Above")) { text = value3; text2 = health.ToString(); } else if (value.Equals("Below")) { text = health.ToString(); text2 = value3; } else if (value.Equals("Right")) { text = health + value3; text2 = ""; } else { text = value3 + health; text2 = ""; } if (value2) { text = "<u>" + text + "</u>"; } ((TMP_Text)healthText).text = text + "\n" + text2; } private static void CreateHealthText(HUDManager hudManager, int initialHealth, int health) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner"); if ((Object)(object)val == (Object)null) { Plugin.PluginLogger.LogError((object)"'TopLeftCorner' not found."); return; } GameObject val2 = new GameObject("PlayerHealthText"); val2.transform.SetParent(val.transform, false); healthText = val2.AddComponent<TextMeshProUGUI>(); if ((Object)(object)hudManager.weightCounter != (Object)null) { TextMeshProUGUI weightCounter = hudManager.weightCounter; ((TMP_Text)healthText).font = ((TMP_Text)weightCounter).font; ((TMP_Text)healthText).fontSize = ((TMP_Text)weightCounter).fontSize; ((Graphic)healthText).color = ParseColor(Plugin.TextColor.Value); ((TMP_Text)healthText).alignment = (TextAlignmentOptions)514; ((TMP_Text)healthText).enableAutoSizing = ((TMP_Text)weightCounter).enableAutoSizing; ((TMP_Text)healthText).fontSizeMin = ((TMP_Text)weightCounter).fontSizeMin; ((TMP_Text)healthText).fontSizeMax = ((TMP_Text)weightCounter).fontSizeMax; if ((Object)(object)((TMP_Text)weightCounter).fontMaterial != (Object)null) { ((TMP_Text)healthText).fontSharedMaterial = new Material(((TMP_Text)weightCounter).fontMaterial); } if ((Object)(object)((TMP_Text)weightCounter).transform.parent != (Object)null) { RectTransform component = ((Component)((TMP_Text)weightCounter).transform.parent).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { RectTransform component2 = ((Component)healthText).GetComponent<RectTransform>(); ((Transform)component2).localRotation = ((Transform)component).localRotation; } } } else { ((TMP_Text)healthText).fontSize = 24f; ((Graphic)healthText).color = Color.red; ((TMP_Text)healthText).alignment = (TextAlignmentOptions)514; } RectTransform component3 = val2.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(0f, 1f); component3.pivot = new Vector2(0f, 1f); int value = Plugin.XOffset.Value; int value2 = Plugin.YOffset.Value; component3.anchoredPosition = new Vector2((float)(-53 + value), (float)(-95 + value2)); UpdateHealthText(health, rainbow: false); } private static Color ParseColor(string rgb) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) string[] array = rgb.Split(new string[1] { ", " }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 3) { return Color.white; } if (float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3)) { return new Color(result / 255f, result2 / 255f, result3 / 255f); } return Color.white; } } [HarmonyPatch(typeof(HUDManager), "Update")] public static class HUDManager_Update_Patch { private static float hue; private static void Postfix(HUDManager __instance) { //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_006f: 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) if (Plugin.RainbowText.Value) { TextMeshProUGUI healthText = HUDManager_UpdateHealthUI_Patch.healthText; if ((Object)(object)healthText == (Object)null) { Plugin.PluginLogger.LogWarning((object)"healthText is null in Update patch"); return; } hue = (hue + Time.deltaTime * Plugin.RainbowSpeed.Value) % 1f; Color val2 = (((Graphic)healthText).color = Color.HSVToRGB(hue, 1f, 1f)); Plugin.PluginLogger.LogInfo((object)$"Updated color: {val2}"); } } } [BepInPlugin("TreysHealthText", "TreysHealthText", "1.3.3")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource PluginLogger; internal static ConfigEntry<bool> HideSystemsOnline; internal static ConfigEntry<string> HpTextPosition; internal static ConfigEntry<bool> UnderlineTopLine; internal static ConfigEntry<string> HPLabelName; internal static ConfigEntry<string> TextColor; internal static ConfigEntry<int> XOffset; internal static ConfigEntry<int> YOffset; internal static ConfigEntry<bool> RainbowText; internal static ConfigEntry<float> RainbowSpeed; private void Awake() { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown PluginLogger = ((BaseUnityPlugin)this).Logger; HideSystemsOnline = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideSystemsOnline", false, "Does Systems Online text pop up when joining lobbies? (Bug turned into a feature :D)"); HpTextPosition = ((BaseUnityPlugin)this).Config.Bind<string>("General", "HpTextPosition", "Right", "Choose to display the 'HP' text above, below, left, or right of the number. Options: Above, Below, Left, Right"); UnderlineTopLine = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UnderlineTopLine", false, "Set to true to underline the top line of the health text. Options: true, false"); HPLabelName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "HPLabelName", "HP", "Set to whatever label you want for the display, leave blank if you don't want a label."); TextColor = ((BaseUnityPlugin)this).Config.Bind<string>("General", "TextColor", "243.015, 100.47, 0", "Color of the text in RGB format (e.g., '255,0,0' for red)."); XOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Position", "XOffset", 0, "Horizontal offset for the health text position."); YOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Position", "YOffset", 0, "Vertical offset for the health text position."); RainbowText = ((BaseUnityPlugin)this).Config.Bind<bool>("Funny", "RainbowText", false, "Set the true if you want a laggy rainbow nightmare. Options: true, false"); RainbowSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Funny", "RainbowSpeed", 0.3f, "Changes speed at which the rainbow color cycles :D (Input as a float)"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TreysHealthText is loaded!"); Harmony val = new Harmony("TreysHealthText"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied."); } } public static class PluginInfo { public const string PLUGIN_GUID = "TreysHealthText"; public const string PLUGIN_NAME = "TreysHealthText"; public const string PLUGIN_VERSION = "1.3.3"; } }
BepInEx/plugins/ZoLoKinoBabo112/UsualScrap.dll
Decompiled 2 years 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.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; using UsualScrap.Behaviors; using UsualScrap.Behaviors.Effects; using UsualScrap.Behaviors.OvertimeEffects; using UsualScrap.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("UsualScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds 15+ unique equipment and scrap items that try to keep the vanilla tone")] [assembly: AssemblyFileVersion("1.6.8.0")] [assembly: AssemblyInformationalVersion("1.6.8")] [assembly: AssemblyProduct("UsualScrap")] [assembly: AssemblyTitle("UsualScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UsualScrap { [BepInPlugin("Emil.UsualScrap", "UsualScrap", "1.6.8")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "Emil.UsualScrap"; public const string PLUGIN_NAME = "UsualScrap"; public const string PLUGIN_VERSION = "1.6.8"; public static Plugin instance; internal static UsualScrapConfigs BoundConfig { get; private set; } public void Registerstoreitem(Item name, string description, int price) { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; val.displayText = description + "\n\n"; Items.RegisterShopItem(name, (TerminalNode)null, (TerminalNode)null, val, price); } public void ScriptSetUp(GrabbableObject script, bool grabbable, bool grabbableToEnemies, bool isInFactory, Item itemProperties) { script.grabbable = grabbable; script.grabbableToEnemies = grabbableToEnemies; script.isInFactory = isInFactory; script.itemProperties = itemProperties; } public void Awake() { //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) //IL_09f1: Unknown result type (might be due to invalid IL or missing references) Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } instance = this; AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "usualscrapassetbundle")); Item val2 = val.LoadAsset<Item>("Assets/Items/ExplosiveTankAssets/ExplosiveTank_Item.asset"); Item val3 = val.LoadAsset<Item>("Assets/Items/HandlampAssets/Handlamp_Item.asset"); Item val4 = val.LoadAsset<Item>("Assets/Items/BandagesAssets/Bandages_Item.asset"); Item val5 = val.LoadAsset<Item>("Assets/Items/MedicalKitAssets/MedicalKit_Item.asset"); Item val6 = val.LoadAsset<Item>("Assets/Items/DefibrillatorAssets/Defibrillator_Item.asset"); Item val7 = val.LoadAsset<Item>("Assets/Items/ToolboxAssets/Toolbox_Item.asset"); Item val8 = val.LoadAsset<Item>("Assets/Items/WalkingCaneAssets/WalkingCane_Item.asset"); Item val9 = val.LoadAsset<Item>("Assets/Items/RadioactiveCellAssets/RadioactiveCell_Item.asset"); Item val10 = val.LoadAsset<Item>("Assets/Items/ScissorsAssets/Scissors_Item.asset"); Item val11 = val.LoadAsset<Item>("Assets/Items/RoseAssets/Rose_Item.asset"); Item val12 = val.LoadAsset<Item>("Assets/Items/GoldenTicketAssets/GoldenTicket_Item.asset"); Item val13 = val.LoadAsset<Item>("Assets/Items/TicketAssets/Ticket_Item.asset"); Item val14 = val.LoadAsset<Item>("Assets/Items/PocketWatchAssets/PocketWatch_Item.asset"); Item val15 = val.LoadAsset<Item>("Assets/Items/PadlockAssets/Padlock_Item.asset"); Item val16 = val.LoadAsset<Item>("Assets/Items/CrowbarAssets/Crowbar_Item.asset"); Item val17 = val.LoadAsset<Item>("Assets/Items/CandyDispenserAssets/CandyDispenser_Item.asset"); Item val18 = val.LoadAsset<Item>("Assets/Items/CandyAssets/Lollipop_Item.asset"); Item val19 = val.LoadAsset<Item>("Assets/Items/CandyAssets/Peppermint_Item.asset"); Item val20 = val.LoadAsset<Item>("Assets/Items/CandyAssets/Caramel_Item.asset"); Item val21 = val.LoadAsset<Item>("Assets/Items/EmergencyInjectorAssets/EmergencyInjector_Item.asset"); Item val22 = val.LoadAsset<Item>("Assets/Items/ShiftControllerAssets/ShiftController_Item.asset"); Item val23 = val.LoadAsset<Item>("Assets/Items/GloomyCapsuleAssets/GloomyCapsule_Item.asset"); Item val24 = val.LoadAsset<Item>("Assets/Items/InfernalCapsuleAssets/InfernalCapsule_Item.asset"); Item val25 = val.LoadAsset<Item>("Assets/Items/SanguineCapsuleAssets/SanguineCapsule_Item.asset"); List<Item> list = new List<Item> { val2, val3, val4, val5, val6, val21, val22, val7, val9, val23, val24, val25, val15, val16, val8, val10, val11, val12, val13, val14, val17, val20, val18, val20 }; foreach (Item item in list) { if ((Object)(object)item != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Utilities.FixMixerGroups(item.spawnPrefab); } } HandlampScript script = val3.spawnPrefab.AddComponent<HandlampScript>(); ScriptSetUp((GrabbableObject)(object)script, grabbable: true, grabbableToEnemies: true, isInFactory: false, val3); ToolboxScript toolboxScript = val7.spawnPrefab.AddComponent<ToolboxScript>(); ScriptSetUp((GrabbableObject)(object)toolboxScript, grabbable: true, grabbableToEnemies: true, isInFactory: false, val7); ((GrabbableObject)toolboxScript).useCooldown = 0.1f; PadlockScript script2 = val15.spawnPrefab.AddComponent<PadlockScript>(); ScriptSetUp((GrabbableObject)(object)script2, grabbable: true, grabbableToEnemies: true, isInFactory: true, val15); CrowbarScript script3 = val16.spawnPrefab.AddComponent<CrowbarScript>(); ScriptSetUp((GrabbableObject)(object)script3, grabbable: true, grabbableToEnemies: true, isInFactory: true, val16); Items.RegisterItem(val16); ExplosiveTankScript script4 = val2.spawnPrefab.AddComponent<ExplosiveTankScript>(); ScriptSetUp((GrabbableObject)(object)script4, grabbable: true, grabbableToEnemies: true, isInFactory: true, val2); RadioactiveCellScript script5 = val9.spawnPrefab.AddComponent<RadioactiveCellScript>(); ScriptSetUp((GrabbableObject)(object)script5, grabbable: true, grabbableToEnemies: true, isInFactory: true, val9); GloomyCapsuleScript script6 = val23.spawnPrefab.AddComponent<GloomyCapsuleScript>(); ScriptSetUp((GrabbableObject)(object)script6, grabbable: true, grabbableToEnemies: true, isInFactory: true, val23); InfernalCapsuleScript script7 = val24.spawnPrefab.AddComponent<InfernalCapsuleScript>(); ScriptSetUp((GrabbableObject)(object)script7, grabbable: true, grabbableToEnemies: true, isInFactory: true, val24); SanguineCapsuleScript script8 = val25.spawnPrefab.AddComponent<SanguineCapsuleScript>(); ScriptSetUp((GrabbableObject)(object)script8, grabbable: true, grabbableToEnemies: true, isInFactory: true, val25); BandagesScript bandagesScript = val4.spawnPrefab.AddComponent<BandagesScript>(); ScriptSetUp((GrabbableObject)(object)bandagesScript, grabbable: true, grabbableToEnemies: true, isInFactory: false, val4); ((GrabbableObject)bandagesScript).useCooldown = 0.5f; MedicalKitScript script9 = val5.spawnPrefab.AddComponent<MedicalKitScript>(); ScriptSetUp((GrabbableObject)(object)script9, grabbable: true, grabbableToEnemies: true, isInFactory: false, val5); DefibrillatorScript script10 = val6.spawnPrefab.AddComponent<DefibrillatorScript>(); ScriptSetUp((GrabbableObject)(object)script10, grabbable: true, grabbableToEnemies: true, isInFactory: false, val6); EmergencyInjectorScript script11 = val21.spawnPrefab.AddComponent<EmergencyInjectorScript>(); ScriptSetUp((GrabbableObject)(object)script11, grabbable: true, grabbableToEnemies: true, isInFactory: false, val21); ShiftControllerScript script12 = val22.spawnPrefab.AddComponent<ShiftControllerScript>(); ScriptSetUp((GrabbableObject)(object)script12, grabbable: true, grabbableToEnemies: true, isInFactory: false, val22); CaneScript script13 = val8.spawnPrefab.AddComponent<CaneScript>(); ScriptSetUp((GrabbableObject)(object)script13, grabbable: true, grabbableToEnemies: true, isInFactory: true, val8); ScissorsScript script14 = val10.spawnPrefab.AddComponent<ScissorsScript>(); ScriptSetUp((GrabbableObject)(object)script14, grabbable: true, grabbableToEnemies: true, isInFactory: true, val10); RoseScript script15 = val11.spawnPrefab.AddComponent<RoseScript>(); ScriptSetUp((GrabbableObject)(object)script15, grabbable: true, grabbableToEnemies: true, isInFactory: true, val11); GoldenTicketScript script16 = val12.spawnPrefab.AddComponent<GoldenTicketScript>(); ScriptSetUp((GrabbableObject)(object)script16, grabbable: true, grabbableToEnemies: true, isInFactory: true, val12); TicketScript script17 = val13.spawnPrefab.AddComponent<TicketScript>(); ScriptSetUp((GrabbableObject)(object)script17, grabbable: true, grabbableToEnemies: true, isInFactory: true, val13); CandyDispenserScript script18 = val17.spawnPrefab.AddComponent<CandyDispenserScript>(); ScriptSetUp((GrabbableObject)(object)script18, grabbable: true, grabbableToEnemies: true, isInFactory: true, val17); CandyScript script19 = val18.spawnPrefab.AddComponent<CandyScript>(); ScriptSetUp((GrabbableObject)(object)script19, grabbable: true, grabbableToEnemies: true, isInFactory: true, val18); CandyScript script20 = val20.spawnPrefab.AddComponent<CandyScript>(); ScriptSetUp((GrabbableObject)(object)script20, grabbable: true, grabbableToEnemies: true, isInFactory: true, val20); CandyScript script21 = val19.spawnPrefab.AddComponent<CandyScript>(); ScriptSetUp((GrabbableObject)(object)script21, grabbable: true, grabbableToEnemies: true, isInFactory: true, val19); PocketWatchPlaceholder script22 = val14.spawnPrefab.AddComponent<PocketWatchPlaceholder>(); ScriptSetUp((GrabbableObject)(object)script22, grabbable: true, grabbableToEnemies: true, isInFactory: true, val14); LevelTypes val26 = (LevelTypes)13184; BoundConfig = new UsualScrapConfigs(((BaseUnityPlugin)this).Config); if (BoundConfig.ExplosiveTankLoaded.Value) { if (BoundConfig.ExplosiveTankSpawnsAsScrap.Value) { Items.RegisterScrap(val2, BoundConfig.ExplosiveTankSpawnWeight.Value, (LevelTypes)(-1)); } else { Items.RegisterItem(val2); } } if (BoundConfig.RadioactiveCellLoaded.Value) { if (BoundConfig.RadioactiveCellSpawnsAsScrap.Value) { Items.RegisterScrap(val9, BoundConfig.RadioactiveCellSpawnWeight.Value, (LevelTypes)(-1)); } else { Items.RegisterItem(val9); } } if (BoundConfig.CrowbarLoaded.Value) { if (BoundConfig.CrowbarSpawnsAsScrap.Value) { Items.RegisterScrap(val16, BoundConfig.CrowbarSpawnWeight.Value, (LevelTypes)(-1)); } else { Items.RegisterItem(val16); } } if (BoundConfig.PadlockLoaded.Value) { if (BoundConfig.PadlockSpawnsAsScrap.Value) { Items.RegisterScrap(val15, BoundConfig.PadlockSpawnWeight.Value, (LevelTypes)(-1)); } if (BoundConfig.PadlockIsStoreItem.Value) { Registerstoreitem(val15, "This Padlock can be used to lock doors on your enemies..or coworkers.", BoundConfig.PadlockStorePrice.Value); } if (!BoundConfig.PadlockSpawnsAsScrap.Value && !BoundConfig.PadlockIsStoreItem.Value) { Items.RegisterItem(val15); } } if (BoundConfig.WalkingCaneLoaded.Value) { if (BoundConfig.WalkingCaneSpawnsAsScrap.Value) { Items.RegisterScrap(val8, BoundConfig.WalkingCaneSpawnWeight.Value, val26); } else { Items.RegisterItem(val8); } } if (BoundConfig.ScissorsLoaded.Value) { if (BoundConfig.ScissorsSpawnsAsScrap.Value) { Items.RegisterScrap(val10, BoundConfig.ScissorsSpawnWeight.Value, val26); } else { Items.RegisterItem(val10); } } if (BoundConfig.RoseLoaded.Value) { if (BoundConfig.RoseSpawnsAsScrap.Value) { Items.RegisterScrap(val11, BoundConfig.RoseSpawnWeight.Value, val26); } else { Items.RegisterItem(val11); } } if (BoundConfig.TicketLoaded.Value) { if (BoundConfig.TicketSpawnsAsScrap.Value) { Items.RegisterScrap(val13, BoundConfig.TicketSpawnWeight.Value, val26); } else { Items.RegisterItem(val13); } } if (BoundConfig.GoldenTicketLoaded.Value) { if (BoundConfig.GoldenTicketSpawnsAsScrap.Value) { Items.RegisterScrap(val12, BoundConfig.GoldenTicketSpawnWeight.Value, val26); } else { Items.RegisterItem(val12); } } if (BoundConfig.CandyDispenserLoaded.Value) { if (BoundConfig.CandyDispenserSpawnsAsScrap.Value) { Items.RegisterScrap(val17, BoundConfig.CandyDispenserSpawnWeight.Value, val26); Items.RegisterItem(val20); Items.RegisterItem(val18); Items.RegisterItem(val19); } else { Items.RegisterItem(val17); Items.RegisterItem(val20); Items.RegisterItem(val18); Items.RegisterItem(val19); } } if (BoundConfig.PocketWatchLoaded.Value) { if (BoundConfig.PocketWatchSpawnsAsScrap.Value) { Items.RegisterScrap(val14, BoundConfig.PocketWatchSpawnWeight.Value, val26); } else { Items.RegisterItem(val14); } } if (BoundConfig.HandlampLoaded.Value) { if (BoundConfig.HandlampIsStoreItem.Value) { Registerstoreitem(val3, "The Handlamp is perfect for illuminating your surroundings..and possibly blinding you.", BoundConfig.HandlampStorePrice.Value); } else { Items.RegisterItem(val3); } } if (BoundConfig.BandagesLoaded.Value) { if (BoundConfig.BandagesIsStoreItem.Value) { Registerstoreitem(val4, "The Bandages will get you up and going in no time at all!", BoundConfig.BandagesStorePrice.Value); } else { Items.RegisterItem(val4); } } if (BoundConfig.MedicalKitLoaded.Value) { if (BoundConfig.MedicalKitIsStoreItem.Value) { Registerstoreitem(val5, "The Medical Kit can heal anything if given time!", BoundConfig.MedicalKitStorePrice.Value); } else { Items.RegisterItem(val5); } } if (BoundConfig.ShiftControllerLoaded.Value) { if (BoundConfig.ShiftControllerIsStoreItem.Value) { Registerstoreitem(val22, "The Shift Controller is a portable teleporter that allows you to set the teleport position.", BoundConfig.ShiftControllerStorePrice.Value); } else { Items.RegisterItem(val22); } } if (BoundConfig.EmergencyInjectorLoaded.Value) { if (BoundConfig.EmergencyInjectorIsStoreItem.Value) { Registerstoreitem(val21, "The Emergency Injector boosts your movement capabilities for a while and gives a small amount of health, don't take too much!", BoundConfig.EmergencyInjectorStorePrice.Value); } else { Items.RegisterItem(val21); } } if (BoundConfig.DefibrillatorLoaded.Value) { if (BoundConfig.DefibrillatorIsStoreItem.Value) { Registerstoreitem(val6, "The Defibrillator can revive those employees lost to stupidity.", BoundConfig.DefibrillatorStorePrice.Value); } else { Items.RegisterItem(val6); } } if (BoundConfig.ToolboxLoaded.Value) { if (BoundConfig.ToolboxIsStoreItem.Value) { Registerstoreitem(val7, "The Toolbox can deconstruct some traps for a fine reward.", BoundConfig.ToolboxStorePrice.Value); } else { Items.RegisterItem(val7); } } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Emil.UsualScrap"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Emil.UsualScrap is loaded!"); } } internal class UsualScrapConfigs { public readonly ConfigEntry<bool> ExplosiveTankLoaded; public readonly ConfigEntry<bool> ExplosiveTankSpawnsAsScrap; public readonly ConfigEntry<int> ExplosiveTankSpawnWeight; public readonly ConfigEntry<bool> RadioactiveCellLoaded; public readonly ConfigEntry<bool> RadioactiveCellSpawnsAsScrap; public readonly ConfigEntry<int> RadioactiveCellSpawnWeight; public readonly ConfigEntry<bool> CrowbarLoaded; public readonly ConfigEntry<bool> CrowbarSpawnsAsScrap; public readonly ConfigEntry<int> CrowbarSpawnWeight; public readonly ConfigEntry<bool> PadlockLoaded; public readonly ConfigEntry<bool> PadlockSpawnsAsScrap; public readonly ConfigEntry<int> PadlockSpawnWeight; public readonly ConfigEntry<bool> PadlockIsStoreItem; public readonly ConfigEntry<int> PadlockStorePrice; public readonly ConfigEntry<bool> WalkingCaneLoaded; public readonly ConfigEntry<bool> WalkingCaneSpawnsAsScrap; public readonly ConfigEntry<int> WalkingCaneSpawnWeight; public readonly ConfigEntry<bool> ScissorsLoaded; public readonly ConfigEntry<bool> ScissorsSpawnsAsScrap; public readonly ConfigEntry<int> ScissorsSpawnWeight; public readonly ConfigEntry<bool> RoseLoaded; public readonly ConfigEntry<bool> RoseSpawnsAsScrap; public readonly ConfigEntry<int> RoseSpawnWeight; public readonly ConfigEntry<bool> TicketLoaded; public readonly ConfigEntry<bool> TicketSpawnsAsScrap; public readonly ConfigEntry<int> TicketSpawnWeight; public readonly ConfigEntry<bool> GoldenTicketLoaded; public readonly ConfigEntry<bool> GoldenTicketSpawnsAsScrap; public readonly ConfigEntry<int> GoldenTicketSpawnWeight; public readonly ConfigEntry<bool> CandyDispenserLoaded; public readonly ConfigEntry<bool> CandyDispenserSpawnsAsScrap; public readonly ConfigEntry<int> CandyDispenserSpawnWeight; public readonly ConfigEntry<bool> PocketWatchLoaded; public readonly ConfigEntry<bool> PocketWatchSpawnsAsScrap; public readonly ConfigEntry<int> PocketWatchSpawnWeight; public readonly ConfigEntry<bool> HandlampLoaded; public readonly ConfigEntry<bool> HandlampIsStoreItem; public readonly ConfigEntry<int> HandlampStorePrice; public readonly ConfigEntry<bool> BandagesLoaded; public readonly ConfigEntry<bool> BandagesIsStoreItem; public readonly ConfigEntry<int> BandagesStorePrice; public readonly ConfigEntry<bool> MedicalKitLoaded; public readonly ConfigEntry<bool> MedicalKitIsStoreItem; public readonly ConfigEntry<int> MedicalKitStorePrice; public readonly ConfigEntry<bool> DefibrillatorLoaded; public readonly ConfigEntry<bool> DefibrillatorIsStoreItem; public readonly ConfigEntry<int> DefibrillatorStorePrice; public readonly ConfigEntry<bool> ShiftControllerLoaded; public readonly ConfigEntry<bool> ShiftControllerIsStoreItem; public readonly ConfigEntry<int> ShiftControllerStorePrice; public readonly ConfigEntry<bool> EmergencyInjectorLoaded; public readonly ConfigEntry<bool> EmergencyInjectorIsStoreItem; public readonly ConfigEntry<int> EmergencyInjectorStorePrice; public readonly ConfigEntry<bool> ToolboxLoaded; public readonly ConfigEntry<bool> ToolboxIsStoreItem; public readonly ConfigEntry<int> ToolboxStorePrice; public UsualScrapConfigs(ConfigFile cfg) { cfg.SaveOnConfigSet = false; ExplosiveTankLoaded = cfg.Bind<bool>("Loading", "Explosive Tank", true, "Whether or not the Explosive Tank is loaded."); ExplosiveTankSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Explosive Tank", true, "Whether or not the Explosive Tank spawns as scrap."); ExplosiveTankSpawnWeight = cfg.Bind<int>("Spawn Weight", "Explosive Tank", 30, "How often the Explosive Tank spawns as scrap."); RadioactiveCellLoaded = cfg.Bind<bool>("Loading", "Radioactive Cell", true, "Whether or not the Radioactive Cell is loaded."); RadioactiveCellSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Radioactive Cell", true, "Whether or not the Radioactive Cell spawns as scrap."); RadioactiveCellSpawnWeight = cfg.Bind<int>("Spawn Weight", "Radioactive Cell", 15, "How often the Radioactive Cell spawns as scrap."); CrowbarLoaded = cfg.Bind<bool>("Loading", "Crowbar", true, "Whether or not the Crowbar is loaded."); CrowbarSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Crowbar", true, "Whether or not the Crowbar spawns as scrap."); CrowbarSpawnWeight = cfg.Bind<int>("Spawn Weight", "Crowbar", 35, "How often the Crowbar spawns as scrap."); PadlockLoaded = cfg.Bind<bool>("Loading", "Padlock", true, "Whether or not the Padlock is loaded."); PadlockSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Padlock", true, "Whether or not the Padlock spawns as scrap."); PadlockSpawnWeight = cfg.Bind<int>("Spawn Weight", "Padlock", 35, "How often the Padlock spawns as scrap."); PadlockIsStoreItem = cfg.Bind<bool>("Store Items", "Padlock", false, "Whether or not the Padlock is a store item."); PadlockStorePrice = cfg.Bind<int>("Store Price", "Padlock", 15, "The store price of the Padlock."); WalkingCaneLoaded = cfg.Bind<bool>("Loading", "Walking Cane", true, "Whether or not the Walking Cane is loaded."); WalkingCaneSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Walking Cane", true, "Whether or not the Walking Cane spawns as scrap."); WalkingCaneSpawnWeight = cfg.Bind<int>("Spawn Weight", "Walking Cane", 30, "How often the Walking Cane spawns as scrap."); ScissorsLoaded = cfg.Bind<bool>("Loading", "Scissors", true, "Whether or not the Scissors are loaded."); ScissorsSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Scissors", true, "Whether or not the Scissors spawn as scrap."); ScissorsSpawnWeight = cfg.Bind<int>("Spawn Weight", "Scissors", 30, "How often the Scissors spawn as scrap."); RoseLoaded = cfg.Bind<bool>("Loading", "Rose", true, "Whether or not the Rose is loaded."); RoseSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Rose", true, "Whether or not the Rose spawns as scrap."); RoseSpawnWeight = cfg.Bind<int>("Spawn Weight", "Rose", 40, "How often the Rose spawns as scrap."); TicketLoaded = cfg.Bind<bool>("Loading", "Ticket", true, "Whether or not the Ticket is loaded."); TicketSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Ticket", true, "Whether or not the Ticket spawns as scrap."); TicketSpawnWeight = cfg.Bind<int>("Spawn Weight", "Ticket", 40, "How often the Ticket spawns as scrap."); GoldenTicketLoaded = cfg.Bind<bool>("Loading", "Golden Ticket", true, "Whether or not the Golden Ticket is loaded."); GoldenTicketSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Golden Ticket", true, "Whether or not the Golden Ticket spawns as scrap."); GoldenTicketSpawnWeight = cfg.Bind<int>("Spawn Weight", "Golden Ticket", 5, "How often the Golden Ticket spawns as scrap."); CandyDispenserLoaded = cfg.Bind<bool>("Loading", "Candy Dispenser & drops", true, "Whether or not the Candy Dispenser and its drops are loaded."); CandyDispenserSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Candy Dispenser", true, "Whether or not the Candy Dispenser spawns as scrap."); CandyDispenserSpawnWeight = cfg.Bind<int>("Spawn Weight", "Candy Dispenser", 30, "How often the Candy Dispenser spawns as scrap."); PocketWatchLoaded = cfg.Bind<bool>("Loading", "Pocket Watch", true, "Whether or not the Pocket Watch is loaded."); PocketWatchSpawnsAsScrap = cfg.Bind<bool>("Scrap", "Pocket Watch", true, "Whether or not the pocket Watch spawns as scrap."); PocketWatchSpawnWeight = cfg.Bind<int>("Spawn Weight", "Pocket Watch", 40, "How often the Pocket Watch spawns as scrap."); HandlampLoaded = cfg.Bind<bool>("Loading", "Handlamp", true, "Whether or not the Handlamp is loaded."); HandlampIsStoreItem = cfg.Bind<bool>("Store Items", "Handlamp", true, "Whether or not the Handlamp is a store item"); HandlampStorePrice = cfg.Bind<int>("Store Price", "Handlamp", 25, "The store price of the Handlamp."); BandagesLoaded = cfg.Bind<bool>("Loading", "Bandages", true, "Whether or not the Bandages are loaded."); BandagesIsStoreItem = cfg.Bind<bool>("Store Items", "Bandages", true, "Whether or not the Bandages are a store item"); BandagesStorePrice = cfg.Bind<int>("Store Price", "Bandages", 20, "The store price of the Bandages."); MedicalKitLoaded = cfg.Bind<bool>("Loading", "Medical Kit", true, "Whether or not the Medical Kit is loaded."); MedicalKitIsStoreItem = cfg.Bind<bool>("Store Items", "Medical Kit", true, "Whether or not the Medical Kit is a store item"); MedicalKitStorePrice = cfg.Bind<int>("Store Price", "Medical Kit", 90, "The store price of the Medical Kit."); DefibrillatorLoaded = cfg.Bind<bool>("Loading", "Defibrillator", true, "Whether or not the Defibrillator is loaded."); DefibrillatorIsStoreItem = cfg.Bind<bool>("Store Items", "Defibrillator", true, "Whether or not the Defibrillator is a store item"); DefibrillatorStorePrice = cfg.Bind<int>("Store Price", "Defibrillator", 375, "The store price of the Defibrillator."); ShiftControllerLoaded = cfg.Bind<bool>("Loading", "Shift Controller", true, "Whether or not the Shift Controller is loaded."); ShiftControllerIsStoreItem = cfg.Bind<bool>("Store Items", "Shift Controller", true, "Whether or not the Shift Controller is a store item"); ShiftControllerStorePrice = cfg.Bind<int>("Store Price", "Shift Controller", 225, "The store price of the Shift Controller."); EmergencyInjectorLoaded = cfg.Bind<bool>("Loading", "Emergency Injector", true, "Whether or not the Emergency Injector is loaded."); EmergencyInjectorIsStoreItem = cfg.Bind<bool>("Store Items", "Emergency Injector", true, "Whether or not the Emergency Injector is a store item"); EmergencyInjectorStorePrice = cfg.Bind<int>("Store Price", "Emergency Injector", 60, "The store price of the Emergency Injector."); ToolboxLoaded = cfg.Bind<bool>("Loading", "Toolbox", true, "Whether or not the Toolbox is loaded."); ToolboxIsStoreItem = cfg.Bind<bool>("Store Items", "Toolbox", true, "Whether or not the Toolbox is a store item"); ToolboxStorePrice = cfg.Bind<int>("Store Price", "Toolbox", 115, "The store price of the Toolbox."); ClearOrphanedEntries(cfg); cfg.Save(); cfg.SaveOnConfigSet = true; } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } } namespace UsualScrap.Behaviors { internal class BandagesScript : GrabbableObject { private int uses = 3; private ParticleSystem particle; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy.health < 100) { HealServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void HealServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(87823207u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 87823207u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HealClientRpc(); } } } [ClientRpc] public void HealClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2085797069u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2085797069u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Heal(); } } } public void Heal() { //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) particle = ((Component)this).GetComponentInChildren<ParticleSystem>(); ParticleSystem val = Object.Instantiate<ParticleSystem>(particle, ((Component)this).transform.position, Quaternion.identity); val.Play(); if (uses > 1 && base.playerHeldBy.health < 80) { base.playerHeldBy.health = base.playerHeldBy.health + 20; uses--; } else if (uses > 1 && base.playerHeldBy.health >= 80 && base.playerHeldBy.health < 100) { base.playerHeldBy.health = base.playerHeldBy.health + (100 - base.playerHeldBy.health); uses--; } else if (uses <= 1 && base.playerHeldBy.health < 80) { base.playerHeldBy.health = base.playerHeldBy.health + 20; if (base.isHeld) { base.playerHeldBy.DespawnHeldObject(); } } else if (uses <= 1 && base.playerHeldBy.health >= 80 && base.playerHeldBy.health < 100) { base.playerHeldBy.health = base.playerHeldBy.health + (100 - base.playerHeldBy.health); if (base.isHeld) { base.playerHeldBy.DespawnHeldObject(); } } if (base.playerHeldBy.health > 20) { if (base.playerHeldBy.criticallyInjured || base.playerHeldBy.bleedingHeavily) { base.playerHeldBy.criticallyInjured = false; base.playerHeldBy.bleedingHeavily = false; } if ((Object)(object)base.playerHeldBy.playerBodyAnimator != (Object)null) { base.playerHeldBy.playerBodyAnimator.SetBool("Limp", false); } HUDManager.Instance.UpdateHealthUI(base.playerHeldBy.health, false); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BandagesScript() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(87823207u, new RpcReceiveHandler(__rpc_handler_87823207)); NetworkManager.__rpc_func_table.Add(2085797069u, new RpcReceiveHandler(__rpc_handler_2085797069)); } private static void __rpc_handler_87823207(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; ((BandagesScript)(object)target).HealServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2085797069(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)2; ((BandagesScript)(object)target).HealClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BandagesScript"; } } internal class CandyDispenserScript : GrabbableObject { private RaycastHit[] objectsHitByDispenser; private List<RaycastHit> objectsHitByDispenserList = new List<RaycastHit>(); private bool isHoldingButton; private bool reelingUp; private Coroutine reelingUpCoroutine; private PlayerControllerB previousPlayerHeldBy; private static Item _lollipopItem; private static Item _caramelItem; private static Item _peppermintItem; private GameObject dispenserBase; private MeshRenderer dispenserMesh; private int dispenserMask = 1084754248; private int dispenserHitForce = 2; private AudioSource dispenserAudio; private AudioClip swing; private AudioClip Dispense; private AudioClip[] hitSFX; private Color setColor; public void Awake() { dispenserAudio = ((Component)((Component)this).transform.Find("CandyDispenserSounds")).gameObject.GetComponent<AudioSource>(); AudioSource[] components = ((Component)((Component)this).transform.Find("CandyDispenserSounds")).gameObject.GetComponents<AudioSource>(); swing = components[1].clip; Dispense = components[2].clip; hitSFX = (AudioClip[])(object)new AudioClip[1] { dispenserAudio.clip }; } public override void Start() { ((GrabbableObject)this).Start(); SetColorServerRPC(); } [ServerRpc(RequireOwnership = false)] public void SetColorServerRPC() { //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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3606619266u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3606619266u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { float num = new Random().Next(2, 11); float num2 = new Random().Next(2, 11); float num3 = new Random().Next(2, 11); float num4 = 0.9f / num; float num5 = 0.9f / num2; float num6 = 0.9f / num3; setColor = new Color(num4, num5, num6, 1f); SetColorClientRPC(setColor); } } } [ClientRpc] public void SetColorClientRPC(Color color) { //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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(809217553u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref color); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 809217553u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { dispenserBase = ((Component)((Component)((Component)this).transform.Find("CandyDispenserModel")).gameObject.transform.Find("DispenserBase")).gameObject; dispenserMesh = dispenserBase.GetComponent<MeshRenderer>(); ((Renderer)dispenserMesh).material.color = color; } } } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } isHoldingButton = buttonDown; if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpDispenser()); } } private IEnumerator reelUpDispenser() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("dispenserHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingDispenser(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitDispenser(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1864758460u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1864758460u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReelUpSFXClientRpc(); } } [ClientRpc] public void ReelUpSFXClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1880468153u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1880468153u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { } } } public void SwingDispenser(bool cancel = false) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { dispenserAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitDispenser(bool cancel = false) { //IL_0050: 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_006f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; int num = -1; if (!cancel) { previousPlayerHeldBy.twoHanded = false; objectsHitByDispenser = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, dispenserMask, (QueryTriggerInteraction)2); objectsHitByDispenserList = objectsHitByDispenser.OrderBy(delegate(RaycastHit x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) RaycastHit val4 = x; return ((RaycastHit)(ref val4)).distance; }).ToList(); IHittable val2 = default(IHittable); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < objectsHitByDispenserList.Count; i++) { RaycastHit val = objectsHitByDispenserList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = objectsHitByDispenserList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByDispenserList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByDispenserList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val = objectsHitByDispenserList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByDispenserList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; val2.Hit(dispenserHitForce, forward, previousPlayerHeldBy, true, 1); continue; } } val = objectsHitByDispenserList[i]; if (((RaycastHit)(ref val)).collider.isTrigger) { continue; } flag = true; val = objectsHitByDispenserList[i]; string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { num = j; dispenserAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX); break; } } } float num2 = new Random().Next(1, 25); if (num2 == 1f) { if (StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || !TimeOfDay.Instance.currentLevel.planetHasTime) { MonoBehaviour.print((object)"Candy spawning disabled, land at a moon with a time cycle!"); return; } dispenserAudio.PlayOneShot(Dispense); SpawnScrapServerRpc(); } } if (flag) { int sound = RoundManager.PlayRandomClip(dispenserAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); base.playerHeldBy.playerBodyAnimator.SetTrigger("dispenserHit"); HitDispenserServerRpc(sound); } } [ServerRpc] public void HitDispenserServerRpc(int sound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3161520678u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, sound); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3161520678u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HitDispenserClientRpc(sound); } } [ClientRpc] public void HitDispenserClientRpc(int sound) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3067530259u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, sound); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3067530259u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HitSurfaceWithDispenser(sound); } } } private void HitSurfaceWithDispenser(int sound) { if (!((NetworkBehaviour)this).IsOwner) { dispenserAudio.PlayOneShot(hitSFX[sound]); } WalkieTalkie.TransmitOneShotAudio(dispenserAudio, hitSFX[sound], 1f); } [ServerRpc(RequireOwnership = false)] public void SpawnScrapServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2364265404u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2364265404u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SpawnCandy(); } } } public void SpawnCandy() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b6: Unknown result type (might be due to invalid IL or missing references) Item val = PullLollipop(); Item val2 = PullCaramel(); Item val3 = PullPeppermint(); GameObject val4; switch (new Random().Next(1, 4)) { case 1: { val4 = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)base.playerHeldBy).transform.position + Vector3.up, Quaternion.identity); GrabbableObject component3 = val4.GetComponent<GrabbableObject>(); component3.fallTime = 0f; ((NetworkBehaviour)component3).NetworkObject.Spawn(false); component3.SetScrapValue(10); break; } case 2: { val4 = Object.Instantiate<GameObject>(val2.spawnPrefab, ((Component)base.playerHeldBy).transform.position + Vector3.up, Quaternion.identity); GrabbableObject component2 = val4.GetComponent<GrabbableObject>(); component2.fallTime = 0f; ((NetworkBehaviour)component2).NetworkObject.Spawn(false); component2.SetScrapValue(10); break; } default: { val4 = Object.Instantiate<GameObject>(val3.spawnPrefab, ((Component)base.playerHeldBy).transform.position + Vector3.up, Quaternion.identity); GrabbableObject component = val4.GetComponent<GrabbableObject>(); component.fallTime = 0f; ((NetworkBehaviour)component).NetworkObject.Spawn(false); component.SetScrapValue(10); break; } } if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom) { previousPlayerHeldBy.SetItemInElevator(true, true, val4.GetComponent<GrabbableObject>()); } } public static Item PullLollipop() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)_lollipopItem == (Object)null) { _lollipopItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "Lollipop_Item"); } return _lollipopItem; } public static Item PullCaramel() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)_caramelItem == (Object)null) { _caramelItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "Caramel_Item"); } return _caramelItem; } public static Item PullPeppermint() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)_peppermintItem == (Object)null) { _peppermintItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "Peppermint_Item"); } return _peppermintItem; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CandyDispenserScript() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3606619266u, new RpcReceiveHandler(__rpc_handler_3606619266)); NetworkManager.__rpc_func_table.Add(809217553u, new RpcReceiveHandler(__rpc_handler_809217553)); NetworkManager.__rpc_func_table.Add(1864758460u, new RpcReceiveHandler(__rpc_handler_1864758460)); NetworkManager.__rpc_func_table.Add(1880468153u, new RpcReceiveHandler(__rpc_handler_1880468153)); NetworkManager.__rpc_func_table.Add(3161520678u, new RpcReceiveHandler(__rpc_handler_3161520678)); NetworkManager.__rpc_func_table.Add(3067530259u, new RpcReceiveHandler(__rpc_handler_3067530259)); NetworkManager.__rpc_func_table.Add(2364265404u, new RpcReceiveHandler(__rpc_handler_2364265404)); } private static void __rpc_handler_3606619266(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; ((CandyDispenserScript)(object)target).SetColorServerRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_809217553(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color colorClientRPC = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref colorClientRPC); target.__rpc_exec_stage = (__RpcExecStage)2; ((CandyDispenserScript)(object)target).SetColorClientRPC(colorClientRPC); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1864758460(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((CandyDispenserScript)(object)target).ReelUpSFXServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1880468153(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)2; ((CandyDispenserScript)(object)target).ReelUpSFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3161520678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int sound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sound); target.__rpc_exec_stage = (__RpcExecStage)1; ((CandyDispenserScript)(object)target).HitDispenserServerRpc(sound); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3067530259(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 sound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sound); target.__rpc_exec_stage = (__RpcExecStage)2; ((CandyDispenserScript)(object)target).HitDispenserClientRpc(sound); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2364265404(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; ((CandyDispenserScript)(object)target).SpawnScrapServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CandyDispenserScript"; } } internal class CandyScript : GrabbableObject { public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { ((Component)base.playerHeldBy).gameObject.AddComponent<CandySpeedEffect>(); base.playerHeldBy.DespawnHeldObject(); } } [ServerRpc] public void DestroyRadarIconServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2453058261u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2453058261u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { DestroyRadarIconClientRpc(); } } [ClientRpc] public void DestroyRadarIconClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1150975139u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1150975139u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Object.Destroy((Object)(object)((Component)base.radarIcon).gameObject); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CandyScript() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2453058261u, new RpcReceiveHandler(__rpc_handler_2453058261)); NetworkManager.__rpc_func_table.Add(1150975139u, new RpcReceiveHandler(__rpc_handler_1150975139)); } private static void __rpc_handler_2453058261(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((CandyScript)(object)target).DestroyRadarIconServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1150975139(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)2; ((CandyScript)(object)target).DestroyRadarIconClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CandyScript"; } } internal class CaneScript : GrabbableObject { private float movementbuff = 1f; public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.movementSpeed = base.playerHeldBy.movementSpeed + movementbuff; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); base.playerHeldBy.movementSpeed = base.playerHeldBy.movementSpeed - movementbuff; } public override void DiscardItem() { base.playerHeldBy.movementSpeed = base.playerHeldBy.movementSpeed - movementbuff; ((GrabbableObject)this).DiscardItem(); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "CaneScript"; } } internal class CrowbarScript : GrabbableObject { private RaycastHit[] objectsHitByCrowbar; private List<RaycastHit> objectsHitByCrowbarList = new List<RaycastHit>(); private bool isHoldingButton; private bool reelingUp; private Coroutine reelingUpCoroutine; private PlayerControllerB previousPlayerHeldBy; private DoorLock viewedDoorLock; private int hitsToOpen = new Random().Next(2, 3); private int crowbarMask = 1084754248; private int crowbarHitForce = 1; private AudioSource crowbarAudio; private AudioClip swing; private AudioClip[] hitSFX; public void Awake() { crowbarAudio = ((Component)((Component)this).transform.Find("CrowbarSounds")).gameObject.GetComponent<AudioSource>(); AudioSource[] components = ((Component)((Component)this).transform.Find("CrowbarSounds")).gameObject.GetComponents<AudioSource>(); swing = components[1].clip; hitSFX = (AudioClip[])(object)new AudioClip[1] { crowbarAudio.clip }; } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } isHoldingButton = buttonDown; if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpCrowbar()); } } private IEnumerator reelUpCrowbar() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("crowbarHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingCrowbar(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitCrowbar(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3090105070u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3090105070u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReelUpSFXClientRpc(); } } [ClientRpc] public void ReelUpSFXClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1927536923u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1927536923u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { } } } public void SwingCrowbar(bool cancel = false) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { crowbarAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitCrowbar(bool cancel = false) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0458: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: 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) if ((Object)(object)previousPlayerHeldBy == (Object)null) { return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; int num = -1; if (!cancel) { previousPlayerHeldBy.twoHanded = false; RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, LayerMask.GetMask(new string[1] { "InteractableObject" }))) { viewedDoorLock = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>(); if ((Object)(object)viewedDoorLock != (Object)null && viewedDoorLock.isLocked && hitsToOpen > 0) { hitsToOpen--; } else if ((Object)(object)viewedDoorLock != (Object)null && viewedDoorLock.isLocked && hitsToOpen == 0) { UnlockDoorServerRpc(); OpenDoorServerRpc(); hitsToOpen = new Random().Next(2, 3); } if ((Object)(object)viewedDoorLock != (Object)null && !viewedDoorLock.isLocked) { OpenDoorServerRpc(); } } objectsHitByCrowbar = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, crowbarMask, (QueryTriggerInteraction)2); objectsHitByCrowbarList = objectsHitByCrowbar.OrderBy(delegate(RaycastHit x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) RaycastHit val5 = x; return ((RaycastHit)(ref val5)).distance; }).ToList(); IHittable val3 = default(IHittable); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < objectsHitByCrowbarList.Count; i++) { RaycastHit val2 = objectsHitByCrowbarList[i]; if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 8) { val2 = objectsHitByCrowbarList[i]; if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 11) { val2 = objectsHitByCrowbarList[i]; if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3)) { continue; } val2 = objectsHitByCrowbarList[i]; if ((Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val2 = objectsHitByCrowbarList[i]; if (!(((RaycastHit)(ref val2)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; val2 = objectsHitByCrowbarList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val2)).point, ref val4, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; val3.Hit(crowbarHitForce, forward, previousPlayerHeldBy, true, 1); continue; } } val2 = objectsHitByCrowbarList[i]; if (((RaycastHit)(ref val2)).collider.isTrigger) { continue; } flag = true; val2 = objectsHitByCrowbarList[i]; string tag = ((Component)((RaycastHit)(ref val2)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { num = j; crowbarAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX); break; } } } } if (flag) { int sound = RoundManager.PlayRandomClip(crowbarAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); base.playerHeldBy.playerBodyAnimator.SetTrigger("crowbarHit"); HitCrowbarServerRpc(sound); } } [ServerRpc] public void HitCrowbarServerRpc(int sound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2631909418u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, sound); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2631909418u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HitCrowbarClientRpc(sound); } } [ClientRpc] public void HitCrowbarClientRpc(int sound) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(463415256u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, sound); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 463415256u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HitSurfaceWithCrowbar(sound); } } } private void HitSurfaceWithCrowbar(int sound) { if (!((NetworkBehaviour)this).IsOwner) { crowbarAudio.PlayOneShot(hitSFX[sound]); } WalkieTalkie.TransmitOneShotAudio(crowbarAudio, hitSFX[sound], 1f); } [ServerRpc(RequireOwnership = false)] public void OpenDoorServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(121767703u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 121767703u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { OpenDoorClientRpc(); } } } [ClientRpc] public void OpenDoorClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4047106965u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4047106965u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { viewedDoorLock.OpenOrCloseDoor(base.playerHeldBy); viewedDoorLock.SetDoorAsOpen(true); } } } [ServerRpc(RequireOwnership = false)] public void UnlockDoorServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1016317823u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1016317823u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UnlockDoorClientRpc(); } } } [ClientRpc] public void UnlockDoorClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3693078860u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3693078860u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { viewedDoorLock.UnlockDoor(); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CrowbarScript() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3090105070u, new RpcReceiveHandler(__rpc_handler_3090105070)); NetworkManager.__rpc_func_table.Add(1927536923u, new RpcReceiveHandler(__rpc_handler_1927536923)); NetworkManager.__rpc_func_table.Add(2631909418u, new RpcReceiveHandler(__rpc_handler_2631909418)); NetworkManager.__rpc_func_table.Add(463415256u, new RpcReceiveHandler(__rpc_handler_463415256)); NetworkManager.__rpc_func_table.Add(121767703u, new RpcReceiveHandler(__rpc_handler_121767703)); NetworkManager.__rpc_func_table.Add(4047106965u, new RpcReceiveHandler(__rpc_handler_4047106965)); NetworkManager.__rpc_func_table.Add(1016317823u, new RpcReceiveHandler(__rpc_handler_1016317823)); NetworkManager.__rpc_func_table.Add(3693078860u, new RpcReceiveHandler(__rpc_handler_3693078860)); } private static void __rpc_handler_3090105070(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((CrowbarScript)(object)target).ReelUpSFXServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1927536923(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)2; ((CrowbarScript)(object)target).ReelUpSFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2631909418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int sound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sound); target.__rpc_exec_stage = (__RpcExecStage)1; ((CrowbarScript)(object)target).HitCrowbarServerRpc(sound); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_463415256(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036
Customsouzd/BepInEx/plugins/ZoLoKinoBabo112/BetterClock.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BetterClock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterClock")] [assembly: AssemblyCopyright("Copyright © BlueAmulet 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("de27b4d1-820d-4505-a953-6001420281e4")] [assembly: AssemblyFileVersion("1.0.3")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.3.0")] namespace BetterClock { [BepInPlugin("BlueAmulet.BetterClock", "BetterClock", "1.0.3")] public class BetterClock : BaseUnityPlugin { internal const string Name = "BetterClock"; internal const string Author = "BlueAmulet"; internal const string ID = "BlueAmulet.BetterClock"; internal const string Version = "1.0.3"; public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Settings.InitConfig(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("BlueAmulet.BetterClock"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches"); val.PatchAll(Assembly.GetExecutingAssembly()); int num = 0; foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name)); num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied")); } } internal static class Settings { internal static ConfigEntry<bool> compact; internal static ConfigEntry<bool> leadingZero; internal static ConfigEntry<bool> darkZero; internal static ConfigEntry<bool> fasterUpdate; internal static ConfigEntry<bool> raiseClock; internal static ConfigEntry<bool> hours24; internal static ConfigEntry<bool> properTime; internal static ConfigEntry<float> visibilityShip; internal static ConfigEntry<float> visibilityOutside; internal static ConfigEntry<float> visibilityInside; internal static ConfigEntry<float> visibilityOverride; internal static ConfigEntry<KeyboardShortcut> overrideKeybind; internal static ConfigEntry<bool> overrideToggle; public static void InitConfig(ConfigFile config) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) compact = config.Bind<bool>("Clock", "CompactClock", true, "Makes the clock more compact"); leadingZero = config.Bind<bool>("Clock", "LeadingZero", true, "Adds a leading zero to hours before 10"); darkZero = config.Bind<bool>("Clock", "DarkZero", true, "Leading zeros are dark"); fasterUpdate = config.Bind<bool>("Clock", "FasterUpdate", true, "Update the clock more often"); raiseClock = config.Bind<bool>("Clock", "RaiseClock", true, "Raise the clock near the top of the screen"); hours24 = config.Bind<bool>("Clock", "24Hours", false, "Use 24 hour time"); properTime = config.Bind<bool>("Clock", "ProperTime", true, "Fix time formatting caused by the game or other mods"); visibilityShip = config.Bind<float>("Clock", "VisibilityShip", 1f, "Visibility of clock inside ship"); visibilityOutside = config.Bind<float>("Clock", "VisibilityOutside", 1f, "Visibility of clock outside"); visibilityInside = config.Bind<float>("Clock", "VisibilityInside", 0.25f, "Visibility of clock inside factory"); visibilityOverride = config.Bind<float>("Clock", "VisibilityOverride", 1f, "Visibility when using override keybind"); overrideKeybind = config.Bind<KeyboardShortcut>("Clock", "OverrideKeybind", KeyboardShortcut.Empty, "Keybind to trigger visibility override"); overrideToggle = config.Bind<bool>("Clock", "OverrideToggle", false, "Switch the override keybind between toggle or hold"); } } } namespace BetterClock.Patches { [HarmonyPatch(typeof(HUDManager))] internal static class ClockPatch { private static int lastTime = -1; private static bool overrideDisplay = false; [HarmonyPostfix] [HarmonyPatch("Awake")] public static void PostfixAwake(ref HUDManager __instance) { //IL_00a0: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0149: 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_0063: 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_0076: 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_008f: Unknown result type (might be due to invalid IL or missing references) if (!Settings.compact.Value) { return; } Transform parent = ((TMP_Text)__instance.clockNumber).transform.parent; if (Settings.raiseClock.Value) { Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos; if (pluginInfos.ContainsKey("SolosRingCompass") || pluginInfos.ContainsKey("LineCompassPlugin")) { parent.localPosition += new Vector3(0f, 20f, 0f); } else { parent.localPosition += new Vector3(0f, 40f, 0f); } } RectTransform component = ((Component)parent).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, 50f); ((TMP_Text)__instance.clockNumber).enableWordWrapping = false; RectTransform component2 = ((Component)__instance.clockIcon).GetComponent<RectTransform>(); component2.sizeDelta *= 0.6f; if (!Settings.hours24.Value) { Transform transform = ((TMP_Text)__instance.clockNumber).transform; transform.localPosition += new Vector3(10f, -1f, 0f); Transform transform2 = ((Component)__instance.clockIcon).transform; transform2.localPosition += new Vector3(-25f, -2f, 0f); } } [HarmonyPrefix] [HarmonyPatch("SetClockVisible")] public static bool PrefixVisible(ref HUDManager __instance) { //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) KeyboardShortcut value = Settings.overrideKeybind.Value; if (Settings.overrideToggle.Value) { if (((KeyboardShortcut)(ref value)).IsDown()) { overrideDisplay = !overrideDisplay; } } else { overrideDisplay = ((KeyboardShortcut)(ref value)).IsPressed(); } if (overrideDisplay) { __instance.Clock.targetAlpha = Settings.visibilityOverride.Value; return false; } GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = null; if ((Object)(object)instance != (Object)null) { val = instance.localPlayerController; } if ((Object)(object)val != (Object)null) { if (val.isInHangarShipRoom) { __instance.Clock.targetAlpha = Settings.visibilityShip.Value; } else if (val.isInsideFactory) { __instance.Clock.targetAlpha = Settings.visibilityInside.Value; } else { __instance.Clock.targetAlpha = Settings.visibilityOutside.Value; } return false; } return true; } [HarmonyPostfix] [HarmonyPatch("SetClock")] public static void PostfixSetClock(ref HUDManager __instance, ref float timeNormalized, ref float numberOfHours) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = num / 60 % 24; int num3 = num % 60; string text = ((!Settings.hours24.Value) ? ((TMP_Text)__instance.clockNumber).text : $"{num2}:{num3:00}"); if (Settings.properTime.Value) { if (text.Length >= 3 && text[0] == '0' && text[2] == ':') { text = text.Substring(1); } else if (text.StartsWith("24:")) { text = "0:" + text.Substring(3); } if (text.StartsWith("0:") && text.EndsWith("M")) { text = "12:" + text.Substring(2); } if (num2 < 12 && text.EndsWith("PM")) { text = text.Substring(0, text.Length - 2) + "AM"; } else if (num2 >= 12 && text.EndsWith("AM")) { text = text.Substring(0, text.Length - 2) + "PM"; } } if (Settings.compact.Value) { text = text.Replace('\n', ' ').Replace(" ", " "); } if (Settings.leadingZero.Value && (text.Length <= 4 || text.Length == 7)) { text = ((!Settings.darkZero.Value) ? ("0" + text) : ("<color=#602000>0</color>" + text)); } ((TMP_Text)__instance.clockNumber).text = text; } [HarmonyPostfix] [HarmonyPatch(typeof(TimeOfDay))] [HarmonyPatch("MoveTimeOfDay")] public static void PostfixMoveTimeOfDay(ref TimeOfDay __instance, ref float ___changeHUDTimeInterval) { if (Settings.fasterUpdate.Value) { int num = (int)(__instance.normalizedTimeOfDay * (60f * (float)__instance.numberOfHours)); if (num != lastTime) { lastTime = num; HUDManager.Instance.SetClock(__instance.normalizedTimeOfDay, (float)__instance.numberOfHours, true); ___changeHUDTimeInterval = 0f; } } } } }
Customsouzd/BepInEx/plugins/ZoLoKinoBabo112/CustomSounds.dll
Decompiled 2 years agousing 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.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using CustomSounds.Networking; using CustomSounds.Patches; using HarmonyLib; using LCSoundTool; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CustomSounds")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomSounds")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9e086160-a7fd-4721-ba09-3e8534cb7011")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { } } namespace CustomSounds { [BepInPlugin("CustomSounds", "Custom Sounds", "2.3.2")] public class Plugin : BaseUnityPlugin { public struct SoundData { public string SoundName; public float? RandomPercentage; public string CustomName; public string FilePath; public string FileExtension; public string PackName; public string AudioSource; public string DirectoryPath; public string RelativeDirectoryPath; } public class FolderTree { public Dictionary<string, FolderTree> SubFolders { get; set; } public List<SoundData> Files { get; set; } public FolderTree() { SubFolders = new Dictionary<string, FolderTree>(); Files = new List<SoundData>(); } } public static class SoundDataProcessor { public static FolderTree BuildFolderTree(List<SoundData> soundDataList) { FolderTree folderTree = new FolderTree(); foreach (SoundData soundData in soundDataList) { string relativeDirectoryPath = soundData.RelativeDirectoryPath; string[] array = relativeDirectoryPath.Split(Path.DirectorySeparatorChar, '\u0001'); FolderTree folderTree2 = folderTree; string[] array2 = array; foreach (string key in array2) { if (!folderTree2.SubFolders.ContainsKey(key)) { folderTree2.SubFolders[key] = new FolderTree(); } folderTree2 = folderTree2.SubFolders[key]; } folderTree2.Files.Add(soundData); } return folderTree; } public static string DisplayTree(bool isListing, FolderTree tree, int indent = 0, bool isRoot = true, int soundCount = 0) { StringBuilder stringBuilder = new StringBuilder(); if (isRoot) { soundCount = CountSounds(tree); string text = (isListing ? "Listing all currently loaded custom sounds:" : "Customsounds reloaded."); stringBuilder.AppendLine(text + $" ({soundCount} sounds)"); } foreach (KeyValuePair<string, FolderTree> subFolder in tree.SubFolders) { if (isRoot) { stringBuilder.Append("\n"); } string text2 = subFolder.Key; if (text2.EndsWith("-AS")) { text2 = subFolder.Key.Substring(0, subFolder.Key.Length - 3) + " (AudioSource)"; } stringBuilder.AppendLine(new string(' ', indent * 2) + ((indent > 0) ? "∟ " : "") + text2 + " :"); stringBuilder.Append(DisplayTree(isListing, subFolder.Value, indent + 1, isRoot: false)); } foreach (SoundData file in tree.Files) { string text3 = ((!file.RandomPercentage.HasValue) ? "" : $" (Random: {file.RandomPercentage * 100f}%)"); string text4 = ((file.CustomName == "") ? "" : (" [" + file.CustomName + "]")); stringBuilder.AppendLine(new string(' ', indent * 2) + "- " + file.SoundName + text3 + text4 + " [" + file.FileExtension.ToUpper() + "]"); } return stringBuilder.ToString(); } private static int CountSounds(FolderTree tree) { int num = tree.Files.Count; foreach (KeyValuePair<string, FolderTree> subFolder in tree.SubFolders) { num += CountSounds(subFolder.Value); } return num; } } private const string PLUGIN_GUID = "CustomSounds"; private const string PLUGIN_NAME = "Custom Sounds"; private const string PLUGIN_VERSION = "2.3.2"; public static Plugin Instance; internal ManualLogSource logger; private Harmony harmony; public HashSet<string> currentSounds = new HashSet<string>(); public HashSet<string> oldSounds = new HashSet<string>(); public HashSet<string> modifiedSounds = new HashSet<string>(); public Dictionary<string, string> soundHashes = new Dictionary<string, string>(); public Dictionary<string, string> soundPacks = new Dictionary<string, string>(); public static bool hasAcceptedSync = false; public static List<SoundData> soundDataList = new List<SoundData>(); public static bool Initialized { get; private set; } private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!((Object)(object)Instance == (Object)null)) { return; } Instance = this; logger = Logger.CreateLogSource("CustomSounds"); harmony = new Harmony("CustomSounds"); harmony.PatchAll(typeof(TerminalParsePlayerSentencePatch)); modifiedSounds = new HashSet<string>(); string customSoundsFolderPath = GetCustomSoundsFolderPath(); if (!Directory.Exists(customSoundsFolderPath)) { logger.LogInfo((object)"\"CustomSounds\" folder not found. Creating it now."); string path = Path.Combine(customSoundsFolderPath, "YourOwnSoundPack"); Directory.CreateDirectory(path); string contents = "If you're interested in creating your own sound pack, please refer to the 'For Sound Packs Creator' section on the CustomSounds Thunderstore page. If you simply wish to replace a few sounds on your own, you can drop the desired sounds into the 'YourOwnSoundPack' folder."; File.WriteAllText(Path.Combine(customSoundsFolderPath, "READ-ME-PLEASE.txt"), contents); } string path2 = Path.Combine(Paths.BepInExConfigPath); try { List<string> list = File.ReadAllLines(path2).ToList(); int num = list.FindIndex((string line) => line.StartsWith("HideManagerGameObject")); if (num != -1 && list[num].Contains("false")) { logger.LogInfo((object)"\"HideManagerGameObject\" value not correctly set. Fixing it now."); list[num] = "HideManagerGameObject = true"; File.WriteAllLines(path2, list); harmony.PatchAll(typeof(MenuPatcher)); } else if (num != -1) { logger.LogInfo((object)"\"HideManagerGameObject\" is correctly set to true."); } } catch (Exception ex) { logger.LogError((object)("Error modifying config file: " + ex.Message)); } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger.LogInfo((object)"Plugin CustomSounds is loaded!"); } internal void Start() { Initialize(); } internal void OnDestroy() { Initialize(); } internal void Initialize() { if (!Initialized) { Initialized = true; ReloadSounds(); } } private void OnApplicationQuit() { } public GameObject LoadNetworkPrefabFromEmbeddedResource() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = "CustomSounds.Bundle.audionetworkhandler"; using Stream stream = executingAssembly.GetManifestResourceStream(name); if (stream == null) { Debug.LogError((object)"Asset bundle not found in embedded resources."); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); AssetBundle val = AssetBundle.LoadFromMemory(array); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"Failed to load AssetBundle from memory."); return null; } return val.LoadAsset<GameObject>("audionetworkhandler"); } public string GetCustomSoundsFolderPath() { return Path.Combine(Paths.PluginPath, "CustomSounds"); } public void RevertSounds() { if (currentSounds == null || currentSounds.Count == 0) { logger.LogInfo((object)"No sounds to revert."); return; } HashSet<string> hashSet = new HashSet<string>(); foreach (string currentSound in currentSounds) { string text = currentSound; if (currentSound.Contains("-")) { text = currentSound.Substring(0, currentSound.IndexOf("-")); } if (!hashSet.Contains(text)) { logger.LogInfo((object)(text + " restored.")); SoundTool.RestoreAudioClip(text); hashSet.Add(text); } } logger.LogInfo((object)"Original game sounds restored."); } public void ReloadSounds() { oldSounds = new HashSet<string>(currentSounds); currentSounds.Clear(); modifiedSounds.Clear(); soundDataList.Clear(); string directoryName = Path.GetDirectoryName(Paths.PluginPath); ProcessDirectory(directoryName); } private string GetRelativePathToCustomSounds(string filePath) { Debug.Log((object)("FilePath: " + filePath)); string[] array = filePath.Split(new char[1] { Path.DirectorySeparatorChar }); int num = Array.IndexOf(array, "CustomSounds"); if (num == -1 || num == array.Length - 1) { return ""; } string[] paths = array.Skip(num + 1).ToArray(); return Path.Combine(paths); } private void ProcessDirectory(string directoryPath) { string[] directories = Directory.GetDirectories(directoryPath, "*", SearchOption.AllDirectories); foreach (string text in directories) { string fileName = Path.GetFileName(text); ProcessSoundFiles(text, fileName); } } private void ProcessSoundFiles(string directoryPath, string packName) { string[] array = new string[3] { "*.wav", "*.ogg", "*.mp3" }; string[] array2 = array; foreach (string searchPattern in array2) { string[] files = Directory.GetFiles(directoryPath, searchPattern); foreach (string text in files) { if (text.Contains("CustomSounds")) { ProcessSingleFile(text, packName); } } } } private void ProcessSingleFile(string file, string packName) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); (string soundName, float? percentage, string customName) tuple = ParseSoundFileName(fileNameWithoutExtension); string item = tuple.soundName; float? item2 = tuple.percentage; string item3 = tuple.customName; string fileExtension = Path.GetExtension(file).TrimStart(new char[1] { '.' }).ToLower(); string relativePathToCustomSounds = GetRelativePathToCustomSounds(file); string fileName = Path.GetFileName(Path.GetDirectoryName(file)); string text = (fileName.EndsWith("-AS") ? fileName.Substring(0, fileName.Length - 3) : null); SoundData soundData = default(SoundData); soundData.SoundName = item; soundData.RandomPercentage = item2; soundData.CustomName = item3; soundData.FilePath = file; soundData.FileExtension = fileExtension; soundData.PackName = packName; soundData.AudioSource = text; soundData.DirectoryPath = Path.GetDirectoryName(file); soundData.RelativeDirectoryPath = Path.GetDirectoryName(relativePathToCustomSounds); SoundData item4 = soundData; soundDataList.Add(item4); string text2 = "Sound replaced: " + item; if (item4.RandomPercentage.HasValue) { text2 += $" (Percentage = {item4.RandomPercentage.Value * 100f}%)"; } if (!string.IsNullOrEmpty(item4.CustomName)) { text2 = text2 + " (Custom Name = " + item4.CustomName + ")"; } text2 = text2 + " (File Extension = " + item4.FileExtension + ")"; Debug.Log((object)text2); AudioClip audioClip = SoundTool.GetAudioClip(Path.GetDirectoryName(file), file); ((Object)audioClip).name = fileNameWithoutExtension; currentSounds.Add(item4.SoundName); if (item4.RandomPercentage.HasValue) { if (item4.AudioSource != null) { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.RandomPercentage.Value, item4.AudioSource); } else { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.RandomPercentage.Value); } } else if (text != null) { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.AudioSource); } else { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip); } } private (string soundName, float? percentage, string customName) ParseSoundFileName(string fullSoundName) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullSoundName); string[] array = fileNameWithoutExtension.Split(new char[1] { '-' }); string s = array[^1]; if (int.TryParse(s, out var result)) { string item = array[0]; string item2 = string.Join(" ", array.Skip(1).Take(array.Length - 2)); float value = (float)result / 100f; return (item, value, item2); } return (array[0], null, string.Join(" ", array.Skip(1))); } } } namespace CustomSounds.Patches { [HarmonyPatch] public class NetworkObjectManager { private static GameObject networkPrefab; private static GameObject networkHandlerHost; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPrefix] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = Plugin.Instance.LoadNetworkPrefabFromEmbeddedResource(); networkPrefab.AddComponent<AudioNetworkHandler>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); Plugin.Instance.logger.LogInfo((object)"Created AudioNetworkHandler prefab"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Plugin.Instance.logger.LogInfo((object)"Spawning network handler"); networkHandlerHost = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); if (networkHandlerHost.GetComponent<NetworkObject>().IsSpawned) { Debug.Log((object)"NetworkObject is spawned and active."); } else { Debug.Log((object)"Failed to spawn NetworkObject."); } networkHandlerHost.GetComponent<NetworkObject>().Spawn(true); if ((Object)(object)AudioNetworkHandler.Instance != (Object)null) { Debug.Log((object)"Successfully accessed AudioNetworkHandler instance."); } else { Debug.Log((object)"AudioNetworkHandler instance is null."); } } } catch { Plugin.Instance.logger.LogError((object)"Failed to spawned network handler"); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] private static void DestroyNetworkHandler() { try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Plugin.Instance.logger.LogInfo((object)"Destroying network handler"); Object.Destroy((Object)(object)networkHandlerHost); networkHandlerHost = null; } } catch { Plugin.Instance.logger.LogError((object)"Failed to destroy network handler"); } } } [HarmonyPatch(typeof(MenuManager))] internal class MenuPatcher { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPostFix(MenuManager __instance) { ((MonoBehaviour)__instance).StartCoroutine(DelayedMainMenuModification()); } private static IEnumerator DelayedMainMenuModification() { yield return (object)new WaitForSeconds(0f); ChangeHostButtonFromMainMenu(); } private static void ChangeHostButtonFromMainMenu() { Debug.Log((object)"Attempting to add a description to the Host button..."); GameObject val = GameObject.Find("MenuContainer"); Transform val2 = ((val != null) ? val.transform.Find("MainButtons") : null); object obj; if (val2 == null) { obj = null; } else { Transform obj2 = val2.Find("HostButton"); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null)) { string text = ((TMP_Text)val3.GetComponentInChildren<TextMeshProUGUI>()).text; ((TMP_Text)val3.GetComponentInChildren<TextMeshProUGUI>()).text = "<line-height=0.28em>" + text + "\n<size=8><color=#B0B0B0> Please restart the game for <color=#E6B800>CustomSounds</color> to work properly!</color></size></line-height>"; } } } [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] public static class TerminalParsePlayerSentencePatch { public static bool Prefix(Terminal __instance, ref TerminalNode __result) { string[] array = __instance.screenText.text.Split(new char[1] { '\n' }); if (array.Length == 0) { return true; } string[] array2 = array.Last().Trim().ToLower() .Split(new char[1] { ' ' }); if (array2.Length == 0 || (array2[0] != "customsounds" && array2[0] != "cs")) { return true; } Plugin.Instance.logger.LogInfo((object)("Received terminal command: " + string.Join(" ", array2))); if (array2.Length > 1 && (array2[0] == "customsounds" || array2[0] == "cs")) { switch (array2[1]) { case "reload": case "rl": Plugin.Instance.RevertSounds(); Plugin.Instance.ReloadSounds(); __result = CreateTerminalNode(Plugin.SoundDataProcessor.DisplayTree(isListing: false, Plugin.SoundDataProcessor.BuildFolderTree(Plugin.soundDataList))); return false; case "revert": case "rv": Plugin.Instance.RevertSounds(); __result = CreateTerminalNode("Game sounds reverted to original.\n\n"); return false; case "list": case "l": __result = CreateTerminalNode(Plugin.SoundDataProcessor.DisplayTree(isListing: true, Plugin.SoundDataProcessor.BuildFolderTree(Plugin.soundDataList))); return false; case "help": case "h": if (NetworkManager.Singleton.IsHost) { __result = CreateTerminalNode("CustomSounds commands \n(Can also be used with 'CS' as an alias).\n\n>CUSTOMSOUNDS LIST/L\nTo display all currently loaded sounds\n\n>CUSTOMSOUNDS RELOAD/RL\nTo reload and apply sounds from the 'CustomSounds' folder and its subfolders.\n\n>CUSTOMSOUNDS REVERT/RV\nTo unload all custom sounds and restore original game sounds\n\n"); } else { __result = CreateTerminalNode("CustomSounds commands \n(Can also be used with 'CS' as an alias).\n\n>CUSTOMSOUNDS LIST/L\nTo display all currently loaded sounds\n\n>CUSTOMSOUNDS RELOAD/RL\nTo reload and apply sounds from the 'CustomSounds' folder and its subfolders.\n\n>CUSTOMSOUNDS REVERT/RV\nTo unload all custom sounds and restore original game sounds\n\n"); } return false; case "sync": case "s": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; case "unsync": case "u": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; case "fu": case "force-unsync": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; default: __result = CreateTerminalNode("Unknown customsounds command.\n\n"); return false; } } return true; } private static TerminalNode CreateTerminalNode(string message) { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = message; val.clearPreviousText = true; return val; } } } namespace CustomSounds.Networking { public class AudioNetworkHandler : NetworkBehaviour { public static AudioNetworkHandler Instance { get; private set; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "AudioNetworkHandler"; } } }
Customsouzd/BepInEx/plugins/ZoLoKinoBabo112/LCMaxSoundsFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; [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("LCMaxSoundsFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Simple mod that increase max number of simultaneous playing sounds, hopefully fixing missing footsteps and other missing sound problems.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+9a4b27ad682db1b4d7bf4f4f8177235f287bb642")] [assembly: AssemblyProduct("LCMaxSoundsFix")] [assembly: AssemblyTitle("LCMaxSoundsFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCMaxSoundFix { public class AcceptableValueListSorted<T> : AcceptableValueList<T> where T : IEquatable<T>, IComparable<T> { public AcceptableValueListSorted(params T[] acceptableValues) : base(acceptableValues) { Array.Sort(((AcceptableValueList<T>)this).AcceptableValues); } public override object Clamp(object value) { if (value is IComparable<T>) { int num = 0; T other = (T)value; for (int i = 0; i < ((AcceptableValueList<T>)this).AcceptableValues.Length; i++) { int num2 = ((AcceptableValueList<T>)this).AcceptableValues[i].CompareTo(other); if (num2 == 0) { num = i; break; } if (num2 < 0) { num = i; } else if (num2 > 0) { if (i == 0) { num = i; } else if (typeof(T) == typeof(int)) { int num3 = Math.Abs(Convert.ToInt32(((AcceptableValueList<T>)this).AcceptableValues[i]) - (int)value); int num4 = Math.Abs(Convert.ToInt32(((AcceptableValueList<T>)this).AcceptableValues[i - 1]) - (int)value); num = ((num3 < num4) ? i : (i - 1)); } break; } } return ((AcceptableValueList<T>)this).AcceptableValues[num]; } return base.Clamp(value); } } internal static class AudioConfig { private static ConfigEntry<int> _numRealVoices = null; private static ConfigEntry<int> _numVirtualVoices = null; private static readonly int[] _validNumVoices = new int[13] { 1, 2, 4, 8, 16, 32, 50, 64, 100, 128, 256, 512, 1024 }; public static void Bind(BaseUnityPlugin plugin) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if (plugin == null) { throw new ArgumentNullException("plugin"); } Unbind(); _numRealVoices = plugin.Config.Bind<int>("Audio Settings", "Real Voices", 128, new ConfigDescription("The current maximum number of simultaneously audible sounds in the game. Game default: 40", (AcceptableValueBase)(object)new AcceptableValueListSorted<int>(_validNumVoices), Array.Empty<object>())); _numVirtualVoices = plugin.Config.Bind<int>("Audio Settings", "Virtual Voices", 1024, new ConfigDescription("The maximum number of managed sounds in the game. Beyond this limit sounds will simply stop playing. Game default: 512", (AcceptableValueBase)(object)new AcceptableValueListSorted<int>(_validNumVoices), Array.Empty<object>())); _numRealVoices.SettingChanged += OnSettingChanged; _numVirtualVoices.SettingChanged += OnSettingChanged; ApplyChanges(); } public static void Unbind() { if (_numRealVoices != null) { _numRealVoices.SettingChanged -= OnSettingChanged; ((ConfigEntryBase)_numRealVoices).ConfigFile.Remove(((ConfigEntryBase)_numRealVoices).Definition); _numRealVoices = null; } if (_numVirtualVoices != null) { _numVirtualVoices.SettingChanged -= OnSettingChanged; ((ConfigEntryBase)_numVirtualVoices).ConfigFile.Remove(((ConfigEntryBase)_numVirtualVoices).Definition); _numVirtualVoices = null; } } private static void OnSettingChanged(object sender, EventArgs e) { ApplyChanges(); } private static void ApplyChanges() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) ManualLogSource logger = Plugin.Logger; if (logger != null) { logger.LogDebug((object)"Applying audio settings..."); } AudioConfiguration configuration = AudioSettings.GetConfiguration(); configuration.numRealVoices = _numRealVoices.Value; configuration.numVirtualVoices = _numVirtualVoices.Value; AudioSettings.Reset(configuration); ManualLogSource logger2 = Plugin.Logger; if (logger2 != null) { logger2.LogInfo((object)$"Audio settings (numRealVoices={_numRealVoices.Value}; numVirtualVoices={_numVirtualVoices.Value}) are applied."); } } } [BepInPlugin(".LCMaxSoundsFix", "LCMaxSoundsFix", "1.2.0")] internal class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; private set; } protected Plugin() { Logger = ((BaseUnityPlugin)this).Logger; } protected void Awake() { ManualLogSource logger = Logger; if (logger != null) { logger.LogInfo((object)"Plugin LCMaxSoundsFix is loaded!"); } ManualLogSource logger2 = Logger; if (logger2 != null) { logger2.LogDebug((object)"Binding audio config..."); } AudioConfig.Bind((BaseUnityPlugin)(object)this); } } public static class PluginInfo { public const string PLUGIN_GUID = "LCMaxSoundsFix"; public const string PLUGIN_NAME = "LCMaxSoundsFix"; public const string PLUGIN_VERSION = "1.2.0"; } }
Customsouzd/BepInEx/plugins/ZoLoKinoBabo112/LC_SoundTool.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LCSoundTool.Networking; using LCSoundTool.Patches; using LCSoundTool.Resources; using LCSoundTool.Utilities; using LCSoundToolMod.Properties; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LC_SoundTool")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Various audio related functions. Mainly logs all sounds that are playing and what type of playback they're into the BepInEx console.")] [assembly: AssemblyFileVersion("1.5.1.0")] [assembly: AssemblyInformationalVersion("1.5.1+88559329ca22fd77bccf008b2fc220541ba49b23")] [assembly: AssemblyProduct("LC_SoundTool")] [assembly: AssemblyTitle("LC_SoundTool")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/no00ob/LCSoundTool")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCSoundToolMod { public static class PluginInfo { public const string PLUGIN_GUID = "LC_SoundTool"; public const string PLUGIN_NAME = "LC_SoundTool"; public const string PLUGIN_VERSION = "1.5.1"; } } namespace LCSoundToolMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LCSoundToolMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] soundtool { get { object @object = ResourceManager.GetObject("soundtool", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace LCSoundTool { public class AudioSourceExtension : MonoBehaviour { public AudioSource audioSource; public bool playOnAwake = false; public bool loop = false; private bool updateHasBeenLogged = false; private bool hasPlayed = false; private void OnEnable() { if (!((Object)(object)audioSource == (Object)null) && !audioSource.isPlaying) { if (playOnAwake) { audioSource.Play(); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Started playback of {audioSource} with clip {audioSource.clip} in OnEnable function!"); } updateHasBeenLogged = false; hasPlayed = false; } } private void OnDisable() { if (!((Object)(object)audioSource == (Object)null) && audioSource.isPlaying) { if (playOnAwake) { audioSource.Stop(); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Stopped playback of {audioSource} with clip {audioSource.clip} in OnDisable function!"); } updateHasBeenLogged = false; hasPlayed = false; } } private void Update() { if ((Object)(object)audioSource == (Object)null) { return; } if ((Object)(object)audioSource.clip == (Object)null) { hasPlayed = false; } if (audioSource.isPlaying) { updateHasBeenLogged = false; } else if (!((Behaviour)audioSource).isActiveAndEnabled) { hasPlayed = false; } else { if (!playOnAwake) { return; } if ((Object)(object)audioSource.clip != (Object)null && !hasPlayed) { audioSource.Play(); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Started playback of {audioSource} with clip {audioSource.clip} in Update function!"); } updateHasBeenLogged = false; hasPlayed = true; } else if ((Object)(object)audioSource.clip == (Object)null && !updateHasBeenLogged) { updateHasBeenLogged = true; if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Can not start playback of {audioSource} with missing clip in Update function!"); } } } } } public class RandomAudioClip { public AudioClip clip; [Range(0f, 1f)] public float chance = 1f; public RandomAudioClip(AudioClip clip, float chance) { this.clip = clip; this.chance = chance; } } public class ReplacementAudioClip { public List<RandomAudioClip> clips; public string source = string.Empty; public bool canPlay = true; private bool initialized = false; public ReplacementAudioClip(AudioClip clip, float chance, string source) { if (!initialized) { Initialize(); } RandomAudioClip randomAudioClip = new RandomAudioClip(clip, chance); if (!clips.ContainsThisRandomAudioClip(randomAudioClip)) { clips.Add(randomAudioClip); this.source = source; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"RandomAudioClip {randomAudioClip.clip.GetName()} ({Mathf.RoundToInt(chance * 100f)}%) already exists withing this AudioClipContainer!"); SoundTool.Instance.logger.LogDebug((object)"- This AudioClipContainer contains the following clip(s):"); for (int i = 0; i < clips.Count; i++) { SoundTool.Instance.logger.LogDebug((object)$"-- Clip {i + 1} - {clips[i].clip.GetName()} with a chance of {Mathf.RoundToInt(clips[i].chance * 100f)}%"); } } } public ReplacementAudioClip(string source) { Initialize(); this.source = source; } public ReplacementAudioClip() { Initialize(); source = string.Empty; } public void AddClip(AudioClip clip, float chance) { if (!initialized) { Initialize(); } RandomAudioClip randomAudioClip = new RandomAudioClip(clip, chance); if (!clips.ContainsThisRandomAudioClip(randomAudioClip)) { clips.Add(randomAudioClip); } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"RandomAudioClip {randomAudioClip.clip.GetName()} ({Mathf.RoundToInt(chance * 100f)}%) already exists withing this AudioClipContainer!"); SoundTool.Instance.logger.LogDebug((object)"- This AudioClipContainer contains the following clip(s):"); for (int i = 0; i < clips.Count; i++) { SoundTool.Instance.logger.LogDebug((object)$"-- Clip {i + 1} - {clips[i].clip.GetName()} with a chance of {Mathf.RoundToInt(clips[i].chance * 100f)}%"); } } } public bool Full() { if (!initialized) { Initialize(); } float num = 0f; for (int i = 0; i < clips.Count; i++) { num += clips[i].chance; } return num >= 1f; } public bool ContainsClip(AudioClip clip, float chance) { if (!initialized) { Initialize(); } RandomAudioClip thisClip = new RandomAudioClip(clip, chance); return clips.ContainsThisRandomAudioClip(thisClip); } public float TotalChance() { if (!initialized) { Initialize(); } float num = 0f; for (int i = 0; i < clips.Count; i++) { num += clips[i].chance; } return num; } private void Initialize() { clips = new List<RandomAudioClip>(); initialized = true; } } [BepInPlugin("LCSoundTool", "LC Sound Tool", "1.5.1")] public class SoundTool : BaseUnityPlugin { public enum AudioType { wav, ogg, mp3 } private const string PLUGIN_GUID = "LCSoundTool"; private const string PLUGIN_NAME = "LC Sound Tool"; private ConfigEntry<bool> configUseNetworking; private ConfigEntry<bool> configSyncRandomSeed; private ConfigEntry<float> configPlayOnAwakePatchRepeatDelay; private ConfigEntry<bool> configPrintInfoByDefault; private readonly Harmony harmony = new Harmony("LCSoundTool"); public static SoundTool Instance; internal ManualLogSource logger; public static bool debugAudioSources; public static bool indepthDebugging; public static bool infoDebugging; public static bool networkingInitialized { get; private set; } public static bool networkingAvailable { get; private set; } public static Dictionary<string, ReplacementAudioClip> replacedClips { get; private set; } public static Dictionary<string, AudioClip> networkedClips => NetworkHandler.networkedAudioClips; public static event Action ClientNetworkedAudioChanged { add { NetworkHandler.ClientNetworkedAudioChanged += value; } remove { NetworkHandler.ClientNetworkedAudioChanged -= value; } } public static event Action HostNetworkedAudioChanged { add { NetworkHandler.HostNetworkedAudioChanged += value; } remove { NetworkHandler.HostNetworkedAudioChanged -= value; } } public static bool IsDebuggingOn() { if (debugAudioSources || indepthDebugging || infoDebugging) { return true; } return false; } private void Awake() { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) networkingAvailable = true; if ((Object)(object)Instance == (Object)null) { Instance = this; } configUseNetworking = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "EnableNetworking", false, "Whether or not to use the networking built into this plugin. If set to true everyone in the lobby needs LCSoundTool installed and networking enabled to join."); configSyncRandomSeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "SyncUnityRandomSeed", false, "Whether or not to sync the default Unity randomization seed with all clients. For this feature, networking has to be set to true. Will send the UnityEngine.Random.seed from the host to all clients automatically upon loading a networked scene."); configPlayOnAwakePatchRepeatDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Experimental", "NewPlayOnAwakePatchRepeatDelay", 90f, "How long to wait between checks for new playOnAwake AudioSources. Runs the same patching that is done when each scene is loaded with this delay between each run. DO NOT set too low or high. Anything below 10 or above 600 can cause issues. This time is in seconds. Set to 0 to disable rerunning the patch, but be warned that this might break runtime initialized playOnAwake AudioSources."); configPrintInfoByDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "PrintInfoByDefault", false, "Whether or not to print additional information logs created by this mod by default. If set to false, informational logs may be toggled on any time with LeftAlt + F5."); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger = Logger.CreateLogSource("LCSoundTool"); logger.LogInfo((object)"Plugin LCSoundTool is loaded!"); InputHelper.Initialize(); InputHelper.keybinds.Add("toggleAudioSourceDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[0]), ToggleDebug)); InputHelper.keybinds.Add("toggleIndepthDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), ToggleIndepthDebug)); InputHelper.keybinds.Add("toggleInformationalDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), ToggleInfoDebug)); InputHelper.keybinds.Add("printAllSoundsDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), PrintAllReplacedSounds)); InputHelper.keybinds.Add("printAllCurrentSoundsDebugLog", new Keybind(new KeyboardShortcut((KeyCode)287, (KeyCode[])(object)new KeyCode[0]), PrintAllCurrentSounds)); debugAudioSources = false; indepthDebugging = false; if (configPrintInfoByDefault.Value) { infoDebugging = true; } else { infoDebugging = false; } replacedClips = new Dictionary<string, ReplacementAudioClip>(); } private void Start() { if (!configUseNetworking.Value) { networkingAvailable = false; Instance.logger.LogWarning((object)"Networking disabled. Mod in fully client side mode, but no networked actions can take place! You can safely ignore this if you want the mod to run fully client side."); } else { networkingAvailable = true; } if (configUseNetworking.Value) { logger.LogDebug((object)"Loading SoundTool AssetBundle..."); Assets.bundle = AssetBundle.LoadFromMemory(LCSoundToolMod.Properties.Resources.soundtool); if ((Object)(object)Assets.bundle == (Object)null) { logger.LogError((object)"Failed to load SoundTool AssetBundle!"); } else { logger.LogDebug((object)"Finished loading SoundTool AssetBundle!"); } } harmony.PatchAll(typeof(AudioSourcePatch)); if (configUseNetworking.Value) { harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); } SceneManager.sceneLoaded += OnSceneLoaded; } private void Update() { if (configUseNetworking.Value) { if (!networkingInitialized) { if ((Object)(object)NetworkHandler.Instance != (Object)null) { networkingInitialized = true; } } else if ((Object)(object)NetworkHandler.Instance == (Object)null) { networkingInitialized = false; } } else { networkingInitialized = false; } if (!InputHelper.CheckInput("printAllCurrentSoundsDebugLog") && !InputHelper.CheckInput("printAllSoundsDebugLog") && !InputHelper.CheckInput("toggleInformationalDebugLog") && !InputHelper.CheckInput("toggleIndepthDebugLog") && !InputHelper.CheckInput("toggleAudioSourceDebugLog")) { } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0013: 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) if (!((Object)(object)Instance == (Object)null)) { PatchPlayOnAwakeAudio(scene); OnSceneLoadedNetworking(); if (((Scene)(ref scene)).name.ToLower().Contains("level")) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(PatchPlayOnAwakeDelayed(scene, 1f)); } } } private IEnumerator PatchPlayOnAwakeDelayed(Scene scene, float wait) { //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) if (infoDebugging) { logger.LogDebug((object)$"Started playOnAwake patch coroutine with delay of {wait} seconds"); } yield return (object)new WaitForSecondsRealtime(wait); if (infoDebugging) { logger.LogDebug((object)"Running playOnAwake patch coroutine!"); } PatchPlayOnAwakeAudio(scene); float repeatWait = configPlayOnAwakePatchRepeatDelay.Value; if (repeatWait != 0f) { if (repeatWait < 10f) { repeatWait = 10f; } if (repeatWait > 600f) { repeatWait = 600f; } ((MonoBehaviour)this).StartCoroutine(PatchPlayOnAwakeDelayed(scene, repeatWait)); } } private void PatchPlayOnAwakeAudio(Scene scene) { if (infoDebugging) { Instance.logger.LogDebug((object)("Grabbing all playOnAwake AudioSources for loaded scene " + ((Scene)(ref scene)).name)); } AudioSource[] allPlayOnAwakeAudioSources = GetAllPlayOnAwakeAudioSources(); if (infoDebugging) { Instance.logger.LogDebug((object)$"Found a total of {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSource(s)!"); Instance.logger.LogDebug((object)$"Starting setup on {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSource(s)..."); } AudioSource[] array = allPlayOnAwakeAudioSources; AudioSourceExtension audioSourceExtension = default(AudioSourceExtension); foreach (AudioSource val in array) { val.Stop(); if (((Component)((Component)val).transform).TryGetComponent<AudioSourceExtension>(ref audioSourceExtension)) { audioSourceExtension.audioSource = val; audioSourceExtension.playOnAwake = true; audioSourceExtension.loop = val.loop; val.playOnAwake = false; if (infoDebugging) { Instance.logger.LogDebug((object)$"-Set- {Array.IndexOf(allPlayOnAwakeAudioSources, val) + 1} {val} done!"); } continue; } AudioSourceExtension audioSourceExtension2 = ((Component)val).gameObject.AddComponent<AudioSourceExtension>(); audioSourceExtension2.audioSource = val; audioSourceExtension2.playOnAwake = true; audioSourceExtension2.loop = val.loop; val.playOnAwake = false; if (infoDebugging) { Instance.logger.LogDebug((object)$"-Add- {Array.IndexOf(allPlayOnAwakeAudioSources, val) + 1} {val} done!"); } } if (infoDebugging) { Instance.logger.LogDebug((object)$"Done setting up {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSources!"); } } private void OnSceneLoadedNetworking() { if (networkingAvailable && networkingInitialized && configSyncRandomSeed.Value) { int num = (int)DateTime.Now.Ticks; Random.InitState(num); SendUnityRandomSeed(num); } } public AudioSource[] GetAllPlayOnAwakeAudioSources() { AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true); List<AudioSource> list = new List<AudioSource>(); for (int i = 0; i < array.Length; i++) { if (array[i].playOnAwake) { list.Add(array[i]); } } return list.ToArray(); } public static void ReplaceAudioClip(string originalName, AudioClip newClip) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else { ReplaceAudioClipInternal(originalName, newClip, 1f, string.Empty); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, string.Empty); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalName, newClip, chance, string.Empty); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, string.Empty); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, string source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Plugin LCSoundTool is trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalName, newClip, 1f, source); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, string source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Plugin LCSoundTool is trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, source); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, string[] source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalName, newClip, 1f, string.Join(",", list)); } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, string[] source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, string.Join(",", list)); } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance, string source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalName, newClip, chance, source); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance, string source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or the specified original clip has no name! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, source); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance, string[] source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalName, newClip, chance, string.Join(",", list)); } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance, string[] source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, string.Join(",", list)); } private static void ReplaceAudioClipInternal(string originalName, AudioClip newClip, float chance, string source) { string text = originalName; string name = newClip.GetName(); if (!string.IsNullOrEmpty(source)) { text = originalName + "#" + source; } if (replacedClips.ContainsKey(text)) { replacedClips[text].AddClip(newClip, chance); } else { replacedClips.Add(text, new ReplacementAudioClip(newClip, chance, source)); } float num = 0f; for (int i = 0; i < replacedClips[text].clips.Count(); i++) { num += replacedClips[text].clips[i].chance; } int num2 = Mathf.RoundToInt(num * 100f); if (infoDebugging) { Instance.logger.LogDebug((object)$"The current total combined chance for replaced {replacedClips[text].clips.Count()} random audio clips for audio clip {text} does not equal 100%. Currently {num2}% (at least yet?)"); } } public static void RemoveRandomAudioClip(string name, float chance) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to restore an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { RemoveRandomAudioClipInternal(name, chance, string.Empty); } } public static void RemoveRandomAudioClip(string name, float chance, string source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RemoveRandomAudioClipInternal(name, chance, source); } } public static void RemoveRandomAudioClip(string name, float chance, string[] source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RemoveRandomAudioClipInternal(name, chance, string.Join(",", list)); } private static void RemoveRandomAudioClipInternal(string name, float chance, string source) { if (!string.IsNullOrEmpty(source)) { name = name + "#" + source; } if (!(chance > 0f)) { return; } for (int i = 0; i < replacedClips[name].clips.Count(); i++) { if (replacedClips[name].clips[i].chance == chance) { replacedClips[name].clips.RemoveAt(i); if (replacedClips[name].clips.Count <= 0) { Instance.logger.LogDebug((object)("Removed replaced AudioClip " + name + " completely as all of it's random clips have been removed.")); replacedClips.Remove(name); } break; } } } public static void RestoreAudioClip(string name) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RestoreAudioClipInternal(name, string.Empty); } } public static void RestoreAudioClip(string name, string source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RestoreAudioClipInternal(name, source); } } public static void RestoreAudioClip(string name, string[] source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); return; } if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RestoreAudioClipInternal(name, string.Join(",", list)); } public static void RestoreAudioClip(AudioClip clip) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); } else { RestoreAudioClipInternal(clip.GetName(), string.Empty); } } public static void RestoreAudioClip(AudioClip clip, string source) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); } else { RestoreAudioClipInternal(clip.GetName(), source); } } public static void RestoreAudioClip(AudioClip clip, string[] source) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RestoreAudioClipInternal(clip.GetName(), string.Join(",", list)); } private static void RestoreAudioClipInternal(string name, string source) { if (!string.IsNullOrEmpty(source)) { name = name + "#" + source; } replacedClips.Remove(name); } public static AudioClip GetAudioClip(string modFolder, string soundName) { return GetAudioClip(modFolder, string.Empty, soundName); } public static AudioClip GetAudioClip(string modFolder, string subFolder, string soundName) { AudioType audioType = AudioType.wav; string[] array = soundName.Split('.'); if (array[^1].ToLower().Contains("wav")) { audioType = AudioType.wav; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as a PCM WAVE file!"); } } else if (array[^1].ToLower().Contains("ogg")) { audioType = AudioType.ogg; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as an Ogg Vorbis file!"); } } else if (array[^1].ToLower().Contains("mp3")) { audioType = AudioType.mp3; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as a MPEG MP3 file!"); } } else { audioType = AudioType.wav; Instance.logger.LogWarning((object)("Failed to detect file type of a sound file! This may cause issues with other mod functionality. Sound defaulted to WAV. Sound: " + soundName)); } return GetAudioClip(modFolder, subFolder, soundName, audioType); } public static AudioClip GetAudioClip(string modFolder, string soundName, AudioType audioType) { return GetAudioClip(modFolder, string.Empty, soundName, audioType); } public static AudioClip GetAudioClip(string modFolder, string subFolder, string soundName, AudioType audioType) { bool flag = true; bool flag2 = false; string text = " "; string text2 = Path.Combine(Paths.PluginPath, modFolder, subFolder, soundName); string text3 = Path.Combine(Paths.PluginPath, modFolder, soundName); string path = Path.Combine(Paths.PluginPath, modFolder, subFolder); string text4 = Path.Combine(Paths.PluginPath, subFolder, soundName); string path2 = Path.Combine(Paths.PluginPath, subFolder); if (!Directory.Exists(path)) { if (!string.IsNullOrEmpty(subFolder)) { Instance.logger.LogWarning((object)("Requested directory at BepInEx/Plugins/" + modFolder + "/" + subFolder + " does not exist!")); } else { Instance.logger.LogWarning((object)("Requested directory at BepInEx/Plugins/" + modFolder + " does not exist!")); if (!modFolder.Contains("-")) { Instance.logger.LogWarning((object)"This sound mod might not be compatable with mod managers. You should contact the sound mod's author."); } } flag = false; } else { if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } if (!File.Exists(text2)) { Instance.logger.LogWarning((object)("Requested audio file does not exist at path " + text2 + "!")); flag = false; Instance.logger.LogDebug((object)("Looking for audio file from mod root instead at " + text3 + "...")); if (File.Exists(text3)) { Instance.logger.LogDebug((object)("Found audio file at path " + text3 + "!")); text2 = text3; flag = true; if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } else { Instance.logger.LogWarning((object)("Requested audio file does not exist at mod root path " + text3 + "!")); } } else { if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } if (Directory.Exists(path2) && !flag2) { if (!string.IsNullOrEmpty(subFolder)) { Instance.logger.LogWarning((object)("Legacy directory location at BepInEx/Plugins/" + subFolder + " found!")); } else if (!modFolder.Contains("-")) { Instance.logger.LogWarning((object)"Legacy directory location at BepInEx/Plugins found!"); } } if (File.Exists(text4) && !flag2) { Instance.logger.LogWarning((object)("Legacy path contains the requested audio file at path " + text4 + "!")); text = " legacy "; text2 = text4; flag = true; } switch (audioType) { case AudioType.wav: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as a WAV file!"); } break; case AudioType.ogg: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as an Ogg Vorbis file!"); } break; case AudioType.mp3: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as a MPEG MP3 file!"); } break; default: if (infoDebugging) { Instance.logger.LogDebug((object)"File type not defined and was defaulted to WAV file!"); } break; } AudioClip val = null; if (flag) { Instance.logger.LogDebug((object)("Loading AudioClip " + soundName + " from" + text + "path: " + text2)); switch (audioType) { case AudioType.wav: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)20); break; case AudioType.ogg: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)14); break; case AudioType.mp3: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)13); break; } Instance.logger.LogDebug((object)$"Finished loading AudioClip {soundName} with length of {val.length}!"); } else { Instance.logger.LogWarning((object)("Failed to load AudioClip " + soundName + " from invalid" + text + "path at " + text2 + "!")); } if (string.IsNullOrEmpty(val.GetName())) { string empty = string.Empty; string[] array = new string[0]; switch (audioType) { case AudioType.wav: empty = soundName.Replace(".wav", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; case AudioType.ogg: empty = soundName.Replace(".ogg", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; case AudioType.mp3: empty = soundName.Replace(".mp3", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; } } if ((Object)(object)val != (Object)null) { string name = val.GetName(); } return val; } public static void SendNetworkedAudioClip(AudioClip audioClip) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)$"Networking disabled! Failed to send {audioClip}!"); } else if ((Object)(object)audioClip == (Object)null) { Instance.logger.LogWarning((object)$"audioClip variable of SendAudioClip not assigned! Failed to send {audioClip}!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)$"Instance of SoundTool not found or networking has not finished initializing. Failed to send {audioClip}! If you're sending things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SendAudioClipServerRpc(audioClip.GetName(), AudioUtility.AudioClipToByteArray(audioClip, out var _), audioClip.channels, audioClip.frequency); } } public static void RemoveNetworkedAudioClip(AudioClip audioClip) { RemoveNetworkedAudioClip(audioClip.GetName()); } public static void RemoveNetworkedAudioClip(string audioClip) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)("Networking disabled! Failed to remove " + audioClip + "!")); } else if (string.IsNullOrEmpty(audioClip)) { Instance.logger.LogWarning((object)("audioClip variable of RemoveAudioClip not assigned! Failed to remove " + audioClip + "!")); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)("Instance of SoundTool not found or networking has not finished initializing. Failed to remove " + audioClip + "! If you're removing things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!")); } else { NetworkHandler.Instance.RemoveAudioClipServerRpc(audioClip); } } public static void SyncNetworkedAudioClips() { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)"Networking disabled! Failed to sync audio clips!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)"Instance of SoundTool not found or networking has not finished initializing. Failed to sync networked audio! If you're syncing things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SyncAudioClipsServerRpc(); } } public static void SendUnityRandomSeed(int seed) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)"Networking disabled! Failed to send Unity random seed!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)"Instance of SoundTool not found or networking has not finished initializing. Failed to send Unity Random seed! If you're sending the seed in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked methods run only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SendSeedToClientsServerRpc(seed); } } public void ToggleDebug() { debugAudioSources = !debugAudioSources; if (indepthDebugging && !debugAudioSources) { indepthDebugging = false; } Instance.logger.LogDebug((object)$"Toggling AudioSource debug logs {debugAudioSources}!"); } public void ToggleIndepthDebug() { debugAudioSources = !debugAudioSources; indepthDebugging = debugAudioSources; infoDebugging = debugAudioSources; Instance.logger.LogDebug((object)$"Toggling in-depth AudioSource debug logs {debugAudioSources}!"); } public void ToggleInfoDebug() { infoDebugging = !infoDebugging; Instance.logger.LogDebug((object)$"Toggling informational debug logs {infoDebugging}!"); } public void PrintAllReplacedSounds() { Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Printing all currently replaced sounds..."); Instance.logger.LogDebug((object)" "); string[] array = replacedClips.Keys.ToArray(); for (int i = 0; i < replacedClips.Count; i++) { ReplacementAudioClip replacementAudioClip = replacedClips[array[i]]; Instance.logger.LogDebug((object)$"Clip named {array[i]} with {replacementAudioClip.clips.Count} replacement clip(s)"); Instance.logger.LogDebug((object)$"- Clip can play? {replacementAudioClip.canPlay}"); Instance.logger.LogDebug((object)("- Clip audio source(s)? " + replacementAudioClip.source)); Instance.logger.LogDebug((object)$"- All {replacementAudioClip.clips.Count} clip(s):"); for (int j = 0; j < replacementAudioClip.clips.Count; j++) { Instance.logger.LogDebug((object)$"-- Clip {j + 1} - {replacementAudioClip.clips[j].clip.GetName()} with chance of {Mathf.RoundToInt(replacementAudioClip.clips[j].chance * 100f)}%"); } Instance.logger.LogDebug((object)$"-- Total - All clips combined chance {Mathf.RoundToInt(replacementAudioClip.TotalChance() * 100f)}%"); } Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Finished printing all currently replaced sounds!"); Instance.logger.LogDebug((object)" "); } private void PrintAllCurrentSounds() { //IL_01a3: Unknown result type (might be due to invalid IL or missing references) Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Printing all sounds in currently loaded scenes..."); Instance.logger.LogDebug((object)" "); AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true); AudioSourceExtension audioSourceExtension = default(AudioSourceExtension); for (int i = 0; i < array.Length; i++) { Instance.logger.LogDebug((object)$"AudioSource {array[i]} with clip {array[i].clip}"); Instance.logger.LogDebug((object)$"- Volume: {array[i].volume}"); Instance.logger.LogDebug((object)$"- Priority: {array[i].priority}"); Instance.logger.LogDebug((object)$"- Plays on awake? {array[i].playOnAwake}"); Instance.logger.LogDebug((object)$"- Loops? {array[i].loop}"); Instance.logger.LogDebug((object)$"- Needs custom LCSoundTool component? {array[i].playOnAwake}"); Instance.logger.LogDebug((object)$"- Contains custom LCSoundTool component? {((Component)((Component)array[i]).transform).TryGetComponent<AudioSourceExtension>(ref audioSourceExtension)}"); Instance.logger.LogDebug((object)$"- Used by PlayAudioAnimationEvent component? {array[i].UsedByAnimationEventScript()}"); Instance.logger.LogDebug((object)$"- Located in Scene: {((Component)array[i]).gameObject.scene}"); Instance.logger.LogDebug((object)"- Located on the following GameObject:"); Transform val = ((Component)array[i]).transform; Instance.logger.LogDebug((object)$"-- (This) {val}"); while ((Object)(object)val != (Object)(object)((Component)array[i]).transform.root) { val = val.parent; Instance.logger.LogDebug((object)$"-- {val}"); } } Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Finished printing all sounds in currently loaded scenes!"); Instance.logger.LogDebug((object)" "); } } } namespace LCSoundTool.Utilities { public static class AudioUtility { public static byte[] AudioClipToByteArray(AudioClip audioClip, out float[] samples) { samples = new float[audioClip.samples * audioClip.channels]; audioClip.GetData(samples, 0); byte[] array = new byte[samples.Length * 2]; int num = 32767; for (int i = 0; i < samples.Length; i++) { short value = (short)(samples[i] * (float)num); BitConverter.GetBytes(value).CopyTo(array, i * 2); } return array; } public static AudioClip LoadFromMemory(byte[] fileData, string clipName) { int channels = BitConverter.ToInt16(fileData, 22); int frequency = BitConverter.ToInt32(fileData, 24); int num = BitConverter.ToInt16(fileData, 34); byte[] array = new byte[fileData.Length - 44]; Array.Copy(fileData, 44, array, 0, array.Length); return ByteArrayToAudioClip(array, clipName, channels, frequency); } public static AudioClip ByteArrayToAudioClip(byte[] byteArray, string clipName, int channels, int frequency) { if (frequency < 1 || frequency > 48000) { frequency = 44100; } if (channels < 1 || channels > 2) { channels = 1; } int num = 16; int num2 = num / 8; AudioClip val = AudioClip.Create(clipName, byteArray.Length / num2, channels, frequency, false); val.SetData(ConvertByteArrayToFloatArray(byteArray), 0); return val; } private static float[] ConvertByteArrayToFloatArray(byte[] byteArray) { float[] array = new float[byteArray.Length / 2]; int num = 32767; for (int i = 0; i < array.Length; i++) { short num2 = BitConverter.ToInt16(byteArray, i * 2); array[i] = (float)num2 / (float)num; } return array; } public static AudioClip LoadFromDiskToAudioClip(string path, AudioType type) { //IL_0004: 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: Invalid comparison between Unknown and I4 AudioClip result = null; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, type); try { audioClip.SendWebRequest(); try { while (!audioClip.isDone) { } if ((int)audioClip.result != 1) { SoundTool.Instance.logger.LogError((object)("Failed to load WAV AudioClip from path: " + path + " Full error: " + audioClip.error)); } else { result = DownloadHandlerAudioClip.GetContent(audioClip); } } catch (Exception ex) { SoundTool.Instance.logger.LogError((object)(ex.Message + ", " + ex.StackTrace)); } } finally { ((IDisposable)audioClip)?.Dispose(); } return result; } } public static class Extensions { public static bool ContainsThisRandomAudioClip(this List<RandomAudioClip> list, RandomAudioClip thisClip) { for (int i = 0; i < list.Count; i++) { if (list[i].chance == thisClip.chance && list[i].clip.GetName() == thisClip.clip.GetName()) { return true; } } return false; } public static bool UsedByAnimationEventScript(this AudioSource source) { PlayAudioAnimationEvent componentInChildren = ((Component)((Component)source).transform.root).GetComponentInChildren<PlayAudioAnimationEvent>(); if ((Object)(object)componentInChildren != (Object)null) { return (Object)(object)componentInChildren.audioToPlay == (Object)(object)source || (Object)(object)componentInChildren.audioToPlayB == (Object)(object)source; } return false; } } public static class InputHelper { public static Dictionary<string, Keybind> keybinds; public static void Initialize() { keybinds = new Dictionary<string, Keybind>(); } public static bool CheckInput(string keybind) { if (keybinds.ContainsKey(keybind) && ((KeyboardShortcut)(ref keybinds[keybind].shortcut)).IsDown() && !keybinds[keybind].wasPressed) { keybinds[keybind].wasPressed = true; } return CheckInputResult(keybind); } private static bool CheckInputResult(string keybind) { if (keybinds.ContainsKey(keybind) && ((KeyboardShortcut)(ref keybinds[keybind].shortcut)).IsUp() && keybinds[keybind].wasPressed) { keybinds[keybind].wasPressed = false; keybinds[keybind].onPress(); return true; } return false; } } [Serializable] public class Keybind { public KeyboardShortcut shortcut; public Action onPress; public bool wasPressed; public Keybind(KeyboardShortcut shortcut, Action onPress, bool wasPressed = false) { //IL_0009: 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) this.shortcut = shortcut; this.onPress = onPress; this.wasPressed = wasPressed; } } } namespace LCSoundTool.Patches { [HarmonyPatch(typeof(AudioSource))] internal class AudioSourcePatch { private static Dictionary<string, AudioClip> originalClips = new Dictionary<string, AudioClip>(); [HarmonyPatch("Play", new Type[] { })] [HarmonyPrefix] public static void Play_Patch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("Play", new Type[] { typeof(ulong) })] [HarmonyPrefix] public static void Play_UlongPatch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("Play", new Type[] { typeof(double) })] [HarmonyPrefix] public static void Play_DoublePatch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("PlayDelayed", new Type[] { typeof(float) })] [HarmonyPrefix] public static void PlayDelayed_Patch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayDelayedMethod(__instance); } [HarmonyPatch("PlayClipAtPoint", new Type[] { typeof(AudioClip), typeof(Vector3), typeof(float) })] [HarmonyPrefix] public static bool PlayClipAtPoint_Patch(AudioClip clip, Vector3 position, float volume) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0018: 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) GameObject val = new GameObject($"ClipAtPoint_{clip}"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.spatialBlend = 1f; val2.volume = volume; val2.Play(); DebugPlayClipAtPointMethod(val2, position); Object.Destroy((Object)(object)val, clip.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale)); return false; } [HarmonyPatch("PlayOneShotHelper", new Type[] { typeof(AudioSource), typeof(AudioClip), typeof(float) })] [HarmonyPrefix] public static void PlayOneShotHelper_Patch(AudioSource source, ref AudioClip clip, float volumeScale) { clip = ReplaceClipWithNew(clip, source); DebugPlayOneShotMethod(source, clip); } private static void DebugPlayMethod(AudioSource instance) { if ((Object)(object)instance == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} at {((Component)instance).transform.root} is playing {((Object)instance.clip).name}"); } else if (SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} is playing {((Object)instance.clip).name} at"); Transform val = ((Component)instance).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)instance).transform.root}"); } } } private static void DebugPlayDelayedMethod(AudioSource instance) { if ((Object)(object)instance == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} at {((Component)instance).transform.root} is playing {((Object)instance.clip).name} with delay"); } else if (SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} is playing {((Object)instance.clip).name} with delay at"); Transform val = ((Component)instance).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)instance).transform.root}"); } } } private static void DebugPlayClipAtPointMethod(AudioSource audioSource, Vector3 position) { //IL_0065: 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) if ((Object)(object)audioSource == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)audioSource != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{audioSource} at {((Component)audioSource).transform.root} is playing {((Object)audioSource.clip).name} at point {position}"); } else if (SoundTool.indepthDebugging && (Object)(object)audioSource != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{audioSource} is playing {((Object)audioSource.clip).name} located at point {position} within "); Transform val = ((Component)audioSource).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)audioSource).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)audioSource).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)audioSource).transform.root}"); } } } private static void DebugPlayOneShotMethod(AudioSource source, AudioClip clip) { if ((Object)(object)source == (Object)null || (Object)(object)clip == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)source != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{source} at {((Component)source).transform.root} is playing one shot {((Object)clip).name}"); } else if (SoundTool.indepthDebugging && (Object)(object)source != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{source} is playing one shot {((Object)clip).name} at"); Transform val = ((Component)source).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)source).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)source).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)source).transform.root}"); } } } private static void RunDynamicClipReplacement(AudioSource instance) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"instance {instance} instance.clip {instance.clip}"); } if ((Object)(object)instance == (Object)null || (Object)(object)instance.clip == (Object)null) { return; } string name = ((Object)((Component)instance).gameObject).name; bool flag = true; string name2 = instance.clip.GetName(); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sourceName {((Object)((Component)instance).gameObject).name} clipName {name2} replaceClip {flag}"); } string text = name2; if (SoundTool.replacedClips.Keys.Count > 0) { string[] array = SoundTool.replacedClips.Keys.ToArray(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split("#"); if (array2.Length == 2 && array2[0].Contains(name2) && array2[1].Contains(((Object)((Component)instance).gameObject).name)) { text = name2 + "#" + array2[1]; } } } } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("finalName after splitName operation " + text)); } if (SoundTool.replacedClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips contained finalName"); } if (SoundTool.replacedClips[text].canPlay) { if (!originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("originalClips did not contain sourceName, adding sourceName " + name)); } originalClips.Add(name, instance.clip); } if (!string.IsNullOrEmpty(SoundTool.replacedClips[text].source)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source " + SoundTool.replacedClips[text].source + " was not null or empty")); } flag = false; string[] array3 = SoundTool.replacedClips[text].source.Split(','); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sources array {array3.Length} {array3}"); } if ((Object)(object)instance != (Object)null && ((Object)((Component)instance).gameObject).name != null) { if (array3.Length > 1) { for (int j = 0; j < array3.Length; j++) { if (array3[j] == ((Object)((Component)instance).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " matches instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " does not match instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } } } else if (array3[0] == ((Object)((Component)instance).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " matches instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " does not match instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source was empty or null '" + SoundTool.replacedClips[text].source + "'")); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replaceClip {flag}"); } List<RandomAudioClip> clips = SoundTool.replacedClips[text].clips; float num = 0f; foreach (RandomAudioClip item in clips) { num += item.chance; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"totalChance {num}"); } float num2 = Random.Range(0f, num); { foreach (RandomAudioClip item2 in clips) { if (num2 <= item2.chance) { if (flag) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip replaced with {item2.clip}"); } instance.clip = item2.clip; break; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was not replaced with {item2.clip}"); } if (originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"originalClips.ContainsKey(sourceName), clip was restored to {originalClips[name]}"); } instance.clip = originalClips[name]; originalClips.Remove(name); } break; } num2 -= item2.chance; } return; } } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replacedClips[finalName].canPlay {SoundTool.replacedClips[text].canPlay}"); } } else if (originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips did not contain finalName but originalClips contained sourceName"); } instance.clip = originalClips[name]; originalClips.Remove(name); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was restored to {originalClips[name]}"); } } } private static AudioClip ReplaceClipWithNew(AudioClip original, AudioSource source = null) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"original {original} source {source}"); } if ((Object)(object)original == (Object)null) { return original; } string name = original.GetName(); bool flag = true; string text = name; if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sourceName {((Object)((Component)source).gameObject).name} clipName {name} replaceClip {flag}"); } if ((Object)(object)source != (Object)null) { if (SoundTool.replacedClips.Keys.Count > 0) { string[] array = SoundTool.replacedClips.Keys.ToArray(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split("#"); if (array2.Length == 2 && array2[0].Contains(name) && array2[1].Contains(((Object)((Component)source).gameObject).name)) { text = name + "#" + array2[1]; } } } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"source was null, this means we can't check for sourceName for this sound!"); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("finalName after splitName operation " + text)); } if (SoundTool.replacedClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips contained finalName"); } if (!SoundTool.replacedClips[text].canPlay) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replacedClips[finalName].canPlay {SoundTool.replacedClips[text].canPlay}"); } return original; } if (!originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("originalClips did not contain finalName, adding finalName " + text)); } originalClips.Add(text, original); } if (!string.IsNullOrEmpty(SoundTool.replacedClips[text].source)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source " + SoundTool.replacedClips[text].source + " was not null or empty")); } flag = false; string[] array3 = SoundTool.replacedClips[text].source.Split(','); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sources array {array3.Length} {array3}"); } if ((Object)(object)source != (Object)null && ((Object)((Component)source).gameObject).name != null) { if (array3.Length > 1) { for (int j = 0; j < array3.Length; j++) { if (array3[j] == ((Object)((Component)source).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " matches instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " does not match instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } } } else if (array3[0] == ((Object)((Component)source).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " matches instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " does not match instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source was empty or null '" + SoundTool.replacedClips[text].source + "'")); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replaceClip {flag}"); } List<RandomAudioClip> clips = SoundTool.replacedClips[text].clips; float num = 0f; foreach (RandomAudioClip item in clips) { num += item.chance; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"totalChance {num}"); } float num2 = Random.Range(0f, num); foreach (RandomAudioClip item2 in clips) { if (num2 <= item2.chance) { if (flag) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip replaced with {item2.clip}"); } return item2.clip; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was not replaced with {item2.clip}"); } if (originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"originalClips.ContainsKey(finalName), clip was restored to {originalClips[text]}"); } AudioClip result = originalClips[text]; originalClips.Remove(text); return result; } return original; } num2 -= item2.chance; } } else if (originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips did not contain finalName but originalClips contained finalName"); } AudioClip result2 = originalClips[text]; originalClips.Remove(text); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was restored to {originalClips[text]}"); } return result2; } return original; } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { public static GameObject networkPrefab; public static GameObject networkHandlerHost; [HarmonyPatch("Start")] [HarmonyPrefix] public static void Start_Patch() { if (!((Object)(object)networkPrefab != (Object)null)) { SoundTool.Instance.logger.LogDebug((object)"Loading NetworkHandler prefab..."); networkPrefab = Assets.bundle.LoadAsset<GameObject>("SoundToolNetworkHandler.prefab"); if ((Object)(object)networkPrefab == (Object)null) { SoundTool.Instance.logger.LogError((object)"Failed to load NetworkHandler prefab!"); } if ((Object)(object)networkPrefab != (Object)null) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); SoundTool.Instance.logger.LogDebug((object)"Registered NetworkHandler prefab!"); } else { SoundTool.Instance.logger.LogWarning((object)"Failed to registered NetworkHandler prefab! No networking can take place."); } } } [HarmonyPatch("StartDisconnect")] [HarmonyPostfix] private static void StartDisconnect_Patch() { try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { SoundTool.Instance.logger.LogDebug((object)"Destroying NetworkHandler prefab!"); Object.Destroy((Object)(object)networkHandlerHost); networkHandlerHost = null; } } catch { SoundTool.Instance.logger.LogError((object)"Failed to destroy NetworkHandler prefab!"); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void SpawnNetworkHandler() { //IL_003a: 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) try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { SoundTool.Instance.logger.LogDebug((object)"Spawning NetworkHandler prefab!"); GameNetworkManagerPatch.networkHandlerHost = Object.Instantiate<GameObject>(GameNetworkManagerPatch.networkPrefab, Vector3.zero, Quaternion.identity); GameNetworkManagerPatch.networkHandlerHost.GetComponent<NetworkObject>().Spawn(true); } } catch { SoundTool.Instance.logger.LogError((object)"Failed to spawn NetworkHandler prefab!"); } } } } namespace LCSoundTool.Networking { public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } public static Dictionary<string, AudioClip> networkedAudioClips { get; private set; } public static event Action ClientNetworkedAudioChanged; public static event Action HostNetworkedAudioChanged; public override void OnNetworkSpawn() { Debug.Log((object)"LCSoundTool - NetworkHandler created!"); NetworkHandler.ClientNetworkedAudioChanged = null; NetworkHandler.HostNetworkedAudioChanged = null; networkedAudioClips = new Dictionary<string, AudioClip>(); Instance = this; } [ClientRpc] public void ReceiveAudioClipClientRpc(string clipName, byte[] audioData, int channels, int frequency) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(292212293u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } bool flag2 = audioData != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } BytePacker.WriteValueBitPacked(val2, channels); BytePacker.WriteValueBitPacked(val2, frequency); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 292212293u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (!networkedAudioClips.ContainsKey(clipName)) { AudioClip val3 = null; val3 = AudioUtility.ByteArrayToAudioClip(audioData, clipName, channels, frequency); networkedAudioClips.Add(clipName, val3); NetworkHandler.ClientNetworkedAudioChanged?.Invoke(); } else { SoundTool.Instance.logger.LogDebug((object)("Sound " + clipName + " already exists for this client! Skipping addition of this sound for this client.")); } } } [ClientRpc] public void RemoveAudioClipClientRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1355469546u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1355469546u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && networkedAudioClips.ContainsKey(clipName)) { networkedAudioClips.Remove(clipName); NetworkHandler.ClientNetworkedAudioChanged?.Invoke(); } } [ClientRpc] public void SyncAudioClipsClientRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2611915412u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2611915412u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !networkedAudioClips.ContainsKey(clipName)) { SendExistingAudioClipServerRpc(clipName); } } [ClientRpc] public void ReceiveSeedClientRpc(int seed) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1556253924u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, seed); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1556253924u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Random.InitState(seed); SoundTool.Instance.logger.LogDebug((object)$"Client received a new Unity Random seed of {seed}!"); } } } [ServerRpc(RequireOwnership = false)] public void SendAudioClipServerRpc(string clipName, byte[] audioData, int channels, int frequency) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2399630547u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } bool flag2 = audioData != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } BytePacker.WriteValueBitPacked(val2, channels); BytePacker.WriteValueBitPacked(val2, frequency); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2399630547u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReceiveAudioClipClientRpc(clipName, audioData, channels, frequency); NetworkHandler.HostNetworkedAudioChanged?.Invoke(); } } [ServerRpc(RequireOwnership = false)] public void RemoveAudioClipServerRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3103497155u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3103497155u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RemoveAudioClipClientRpc(clipName); NetworkHandler.HostNetworkedAudioChanged?.Invoke(); } } [ServerRpc(RequireOwnership = false)] public void SyncAudioClipsServerRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(178607916u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 178607916u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } string[] array = networkedAudioClips.Keys.ToArray(); if (array.Length < 1) { SoundTool.Instance.logger.LogDebug((object)"No sounds found in networkedClips. Syncing process cancelled!"); return; } for (int i = 0; i < array.Length; i++) { SyncAudioClipsClientRpc(array[i]); } } [ServerRpc(RequireOwnership = false)] public void SendExistingAudioClipServerRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4006259189u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4006259189u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (networkedAudioClips.ContainsKey(clipName)) { byte[] array = null; array = AudioUtility.AudioClipToByteArray(networkedAudioClips[clipName], out var _); ReceiveAudioClipClientRpc(clipName, array, networkedAudioClips[clipName].channels, networkedAudioClips[clipName].frequency); } else { SoundTool.Instance.logger.LogWarning((object)"Trying to obtain and sync a sound from the host that does not exist in the host's game!"); } } } [ServerRpc(RequireOwnership = false)] public void SendSeedToClientsServerRpc(int seed) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4286510828u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, seed); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4286510828u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsHost) { ReceiveSeedClientRpc(seed); SoundTool.Instance.logger.LogDebug((object)$"Sending a new Unity random seed of {seed} to all clients..."); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkHandler() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(292212293u, new RpcReceiveHandler(__rpc_handler_292212293)); NetworkManager.__rpc_func_table.Add(1355469546u, new RpcReceiveHandler(__rpc_handler_1355469546)); NetworkManager.__rpc_func_table.Add(2611915412u, new RpcReceiveHandler(__rpc_handler_2611915412)); NetworkManager.__rpc_func_table.Add(1556253924u, new RpcReceiveHandler(__rpc_handler_1556253924)); NetworkManager.__rpc_func_table.Add(2399630547u, new RpcReceiveHandler(__rpc_handler_2399630547)); NetworkManager.__rpc_func_table.Add(3103497155u, new RpcReceiveHandler(__rpc_handler_3103497155)); NetworkManager.__rpc_func_table.Add(178607916u, new RpcReceiveHandler(__rpc_handler_178607916)); NetworkManager.__rpc_func_table.Add(4006259189u, new RpcReceiveHandler(__rpc_handler_4006259189)); NetworkManager.__rpc_func_table.Add(4286510828u, new RpcReceiveHandler(__rpc_handler_4286510828)); } private static void __rpc_handler_292212293(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string clipName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] audioData = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref audioData, default(ForPrimitives)); } int channels = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref channels); int frequency = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref frequency); target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).ReceiveAudioClipClientRpc(clipName, audioData, channels, frequency); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1355469546(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && net