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.Permissions; using BaboonAPI.Hooks.Initializer; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using TootTallyCore; using TootTallyCore.Graphics; using TootTallyCore.Graphics.Animations; using TootTallyCore.Utils.Assets; using TootTallyCore.Utils.TootTallyGlobals; using TootTallyCore.Utils.TootTallyModules; using TootTallyCore.Utils.TootTallyNotifs; using TootTallySettings.TootTallySettingsObjects; using TrombLoader.Data; using UnityEngine; using UnityEngine.PostProcessing; 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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("TootTally")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Gameplay modifiers for global leaderboards and for fun")] [assembly: AssemblyFileVersion("1.2.12.0")] [assembly: AssemblyInformationalVersion("1.2.12+994800fb4b53b9e7e477391b566c72eac2010a72")] [assembly: AssemblyProduct("TootTallyGameModifiers")] [assembly: AssemblyTitle("TootTallyGameModifiers")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/TootTally/TootTallyGameModifiers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.12.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TootTallyGameModifiers { public class CustomPopup { public CustomButton openPopupButton; public GameObject popupBox; public bool isPopupEnabled = false; private TootTallyAnimation anim; public CustomPopup(string title, Transform buttonTransform, Vector2 buttonAnchoredPosition, Vector2 buttonSize, Sprite buttonImage, Transform popupTransform, Vector2 popupSize, int titleFontSize, Vector2 closeButtonSize) { //IL_0011: 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_0038: 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_0096: 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_00d6: 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_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) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_017e: 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) openPopupButton = GameObjectFactory.CreateCustomButton(buttonTransform, buttonAnchoredPosition, buttonSize, buttonImage, title + " Button", (Action)OnOpenButtonClick); popupBox = GameModifierFactory.GetBorderedVerticalBox(popupSize, 4, popupTransform); popupBox.transform.localScale = Vector2.op_Implicit(Vector2.zero); ((Object)popupBox).name = title; GameObject gameObject = ((Component)popupBox.transform.GetChild(0)).gameObject; ((Graphic)gameObject.GetComponent()).color = (TMPro_ExtensionMethods.CompareRGB(Theme.colors.leaderboard.text, Color.black) ? new Color(1f, 1f, 1f, 1f) : new Color(0f, 0f, 0f, 1f)); ((LayoutGroup)gameObject.GetComponent()).childAlignment = (TextAnchor)1; RectTransform component = popupBox.GetComponent(); component.anchorMin = (component.anchorMax = (component.pivot = Vector2.one / 2f)); TMP_Text val3 = GameObjectFactory.CreateSingleText(gameObject.transform, title + " Title", title, (TextFont)0); val3.fontSize = titleFontSize; val3.fontStyle = (FontStyles)1; val3.alignment = (TextAlignmentOptions)1026; val3.rectTransform.sizeDelta = new Vector2(450f, 30f); ((Component)GameObjectFactory.CreateCustomButton(gameObject.transform, Vector2.one * -5f, closeButtonSize, AssetManager.GetSprite("Close64.png"), "Close " + title + " Button", (Action)OnCloseAnimation)).gameObject.AddComponent().ignoreLayout = true; } public void OnCloseAnimation() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown isPopupEnabled = false; TootTallyAnimation obj = anim; if (obj != null) { obj.Dispose(); } anim = TootTallyAnimationManager.AddNewScaleAnimation(popupBox, Vector2.zero, 0.5f, new SecondDegreeDynamicsAnimation(3.5f, 1f, 1.1f), (Action)delegate { popupBox.gameObject.SetActive(false); anim = null; }); } public void OnOpenAnimation() { //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_0049: 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_006d: Expected O, but got Unknown isPopupEnabled = true; TootTallyAnimation obj = anim; if (obj != null) { obj.Dispose(); } popupBox.transform.localScale = Vector2.op_Implicit(Vector2.zero); popupBox.SetActive(true); anim = TootTallyAnimationManager.AddNewScaleAnimation(popupBox, Vector2.one, 0.6f, new SecondDegreeDynamicsAnimation(2.75f, 1f, 1.1f), (Action)null); } private void OnOpenButtonClick() { isPopupEnabled = !isPopupEnabled; if (isPopupEnabled) { OnOpenAnimation(); } else { OnCloseAnimation(); } } } public abstract class GameModifierBase { public abstract GameModifiers.Metadata Metadata { get; } public virtual void Initialize(GameController __instance) { } public virtual void Update(GameController __instance) { } public virtual void SpecialUpdate(GameController __instance) { } public virtual void SpecialUpdate(ref bool __value) { } } public static class GameModifierFactory { public static CustomPopup CreateModifiersPopup(Transform buttonTransform, Vector2 buttonAnchoredPosition, Vector2 buttonSize, Transform popupTransform, Vector2 popupSize, int titleFontSize, Vector2 closeButtonSize) { //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_0014: 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) return new CustomPopup("Modifiers", buttonTransform, buttonAnchoredPosition, buttonSize, AssetManager.GetSprite("ModifierButton.png"), popupTransform, popupSize, titleFontSize, closeButtonSize); } public static GameObject CreatePopupContainer(CustomPopup popup, Vector2 size, float padding, float spacing) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CreatePopupContainer(popup, size); } public static GameObject CreatePopupContainer(CustomPopup popup, Vector2 size) { //IL_0018: 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_004c: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)popup.popupBox.transform.GetChild(0)).gameObject; GameObject horizontalBox = GetHorizontalBox(size, gameObject.transform); HorizontalLayoutGroup val = default(HorizontalLayoutGroup); if (horizontalBox.TryGetComponent(ref val)) { Object.DestroyImmediate((Object)(object)val); } GridLayoutGroup val2 = horizontalBox.AddComponent(); val2.cellSize = Vector2.one * 32f; ((LayoutGroup)val2).childAlignment = (TextAnchor)1; return horizontalBox; } public static GameObject GetVerticalBox(Vector2 size, Transform parent = null) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(AssetBundleManager.GetPrefab("verticalbox"), parent); val.GetComponent().sizeDelta = size; return val; } public static GameObject GetHorizontalBox(Vector2 size, Transform parent = null) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(AssetBundleManager.GetPrefab("horizontalbox"), parent); val.GetComponent().sizeDelta = size; return val; } public static GameObject GetBorderedVerticalBox(Vector2 size, int bordersize, Transform parent = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002d: 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_0038: 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) GameObject val = Object.Instantiate(AssetBundleManager.GetPrefab("borderedverticalbox"), parent); ((LayoutGroup)val.GetComponent()).padding = new RectOffset(bordersize, bordersize, bordersize, bordersize); val.GetComponent().sizeDelta = size + Vector2.one * 2f * (float)bordersize; return val; } public static GameObject GetBorderedHorizontalBox(Vector2 size, int bordersize, Transform parent = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002d: 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_0038: 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) GameObject val = Object.Instantiate(AssetBundleManager.GetPrefab("borderedhorizontalbox"), parent); ((LayoutGroup)val.GetComponent()).padding = new RectOffset(bordersize, bordersize, bordersize, bordersize); val.GetComponent().sizeDelta = size + Vector2.one * 2f * (float)bordersize; return val; } } public static class GameModifierManager { private static bool _isInitialized; private static Dictionary _stringModifierDict; private static Dictionary _gameModifierDict; private static Dictionary _modifierButtonDict; private static string _modifiersBackup; private static GameModifierBase _hidden; private static GameModifierBase _flashlight; private static GameModifierBase _brutalMode; private static GameModifierBase _instaFail; private static GameModifierBase _easyMode; private static GameModifierBase _strictMode; private static GameModifierBase _noCursor; private static GameModifierBase _noBreathing; private static GameModifierBase _mirrorMode; private static GameModifierBase _scoreV2; private static GameModifierBase _keyboardMode; private static GameModifierBase _autoPilot; private static GameModifierBase _relaxMode; public static bool GetShouldSubmitScore => _gameModifierDict.Values.All((GameModifierBase m) => m.Metadata.ScoreSubmitEnabled); [HarmonyPatch(typeof(HomeController), "Start")] [HarmonyPostfix] private static void OnHomeControllerStartInitialize() { if (!_isInitialized) { Initialize(); } } private static void AddButton(Transform transform, GameModifiers.Metadata mod) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) bool active = _gameModifierDict.ContainsKey(mod.ModifierType); ModifierButton value = new ModifierButton(transform, mod, active, new Vector2(32f, 32f), 3, 8, useWorldPosition: true, delegate { Toggle(mod.ModifierType); }); _modifierButtonDict.Add(mod.ModifierType, value); } [HarmonyPatch(typeof(LevelSelectController), "Start")] [HarmonyPostfix] private static void OnLevelSelectControllerStartPostfix(LevelSelectController __instance) { //IL_0033: 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_005c: 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_0083: Unknown result type (might be due to invalid IL or missing references) if (!_isInitialized) { Initialize(); } _modifierButtonDict.Clear(); CustomPopup popup = GameModifierFactory.CreateModifiersPopup(((Component)__instance.fullpanel).transform, new Vector2(-420f, -150f), new Vector2(32f, 32f), ((Component)__instance.fullpanel).transform, new Vector2(175f, 150f), 20, new Vector2(20f, 20f)); GameObject val = GameModifierFactory.CreatePopupContainer(popup, new Vector2(0f, 65f)); AddButton(val.transform, GameModifiers.HIDDEN); AddButton(val.transform, GameModifiers.FLASHLIGHT); AddButton(val.transform, GameModifiers.BRUTAL); AddButton(val.transform, GameModifiers.INSTA_FAIL); AddButton(val.transform, GameModifiers.EASY_MODE); AddButton(val.transform, GameModifiers.STRICT_MODE); AddButton(val.transform, GameModifiers.HIDDEN_CURSOR); AddButton(val.transform, GameModifiers.NO_BREATHING); AddButton(val.transform, GameModifiers.MIRROR_MODE); AddButton(val.transform, GameModifiers.KEYBOARD_MODE); AddButton(val.transform, GameModifiers.AUTO_PILOT); AddButton(val.transform, GameModifiers.RELAX_MODE); __instance.sortdrop.transform.SetAsLastSibling(); } private static void Initialize() { _gameModifierDict = new Dictionary(); _modifierButtonDict = new Dictionary(); _stringModifierDict = new Dictionary { { GameModifiers.HIDDEN.Name, GameModifiers.HIDDEN }, { GameModifiers.FLASHLIGHT.Name, GameModifiers.FLASHLIGHT }, { GameModifiers.BRUTAL.Name, GameModifiers.BRUTAL }, { GameModifiers.INSTA_FAIL.Name, GameModifiers.INSTA_FAIL }, { GameModifiers.EASY_MODE.Name, GameModifiers.EASY_MODE }, { GameModifiers.STRICT_MODE.Name, GameModifiers.STRICT_MODE }, { GameModifiers.HIDDEN_CURSOR.Name, GameModifiers.HIDDEN_CURSOR }, { GameModifiers.NO_BREATHING.Name, GameModifiers.NO_BREATHING }, { GameModifiers.MIRROR_MODE.Name, GameModifiers.MIRROR_MODE }, { GameModifiers.SCORE_V2.Name, GameModifiers.SCORE_V2 }, { GameModifiers.KEYBOARD_MODE.Name, GameModifiers.KEYBOARD_MODE }, { GameModifiers.AUTO_PILOT.Name, GameModifiers.AUTO_PILOT }, { GameModifiers.RELAX_MODE.Name, GameModifiers.RELAX_MODE } }; _modifiersBackup = ""; _isInitialized = true; } [HarmonyPatch(typeof(GameController), "Start")] [HarmonyPostfix] private static void InitializeModifers(GameController __instance) { if (!_isInitialized) { return; } string modifiersString = GetModifiersString(); Plugin.LogInfo("Active modifiers: " + modifiersString); foreach (GameModifierBase value in _gameModifierDict.Values) { value.Initialize(__instance); } _gameModifierDict.TryGetValue(GameModifiers.ModifierType.Hidden, out _hidden); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.Flashlight, out _flashlight); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.Brutal, out _brutalMode); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.InstaFail, out _instaFail); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.EasyMode, out _easyMode); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.StrictMode, out _strictMode); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.HiddenCursor, out _noCursor); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.NoBreathing, out _noBreathing); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.MirrorMode, out _mirrorMode); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.ScoreV2, out _scoreV2); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.KeyboardMode, out _keyboardMode); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.AutoPilot, out _autoPilot); _gameModifierDict.TryGetValue(GameModifiers.ModifierType.RelaxMode, out _relaxMode); if (_flashlight == null) { ((PostProcessingModel)__instance.gameplayppp.vignette).enabled = false; } } [HarmonyPatch(typeof(GameController), "Start")] [HarmonyPostfix] public static void OnGameConatrollerStartSetTitleWithModifiers(GameController __instance) { string modifiersString = GetModifiersString(); if (!(modifiersString == "") && !__instance.freeplay) { string text = " [" + modifiersString + "]"; Text songtitle = __instance.songtitle; Text songtitleshadow = __instance.songtitleshadow; string text2 = (songtitleshadow.text += text); songtitle.text = text2; } } [HarmonyPatch(typeof(GameController), "Update")] [HarmonyPostfix] private static void UpdateModifiers(GameController __instance) { if (_isInitialized) { _hidden?.Update(__instance); _flashlight?.Update(__instance); _brutalMode?.Update(__instance); _strictMode?.Update(__instance); _noBreathing?.Update(__instance); _keyboardMode?.Update(__instance); _autoPilot?.Update(__instance); _relaxMode?.Update(__instance); } } [HarmonyPatch(typeof(GameController), "isNoteButtonPressed")] [HarmonyPostfix] private static void UpdateRelaxMode(GameController __instance, ref bool __result) { if (_isInitialized || __instance.freeplay || __instance.paused || __instance.quitting) { _relaxMode?.SpecialUpdate(ref __result); } } [HarmonyPatch(typeof(GameController), "doScoreText")] [HarmonyPostfix] private static void UpdateEasyAndHardMode(GameController __instance, int whichtext) { if (_isInitialized) { _brutalMode?.SpecialUpdate(__instance); if (whichtext <= 2) { _instaFail?.SpecialUpdate(__instance); } } } [HarmonyPatch(typeof(GameController), "getScoreAverage")] [HarmonyPrefix] private static void UpdateBrutalMode(GameController __instance) { if (_isInitialized) { _easyMode?.SpecialUpdate(__instance); _scoreV2?.SpecialUpdate(__instance); _strictMode?.SpecialUpdate(__instance); } } public static void Toggle(GameModifiers.ModifierType modifierType) { ModifierButton modifierButton = _modifierButtonDict[modifierType]; if (modifierButton.onCooldown) { return; } if (!modifierButton.modifier.AllowedInMultiplayer && TootTallyGlobalVariables.isPlayingMultiplayer) { TootTallyNotifManager.DisplayNotif($"{modifierType} is not allowed in multiplayer.", 6f); return; } modifierButton.onCooldown = true; if (!_gameModifierDict.ContainsKey(modifierType)) { modifierButton.ToggleOn(); Add(modifierType); } else { modifierButton.ToggleOff(); Remove(modifierType); } } public static void ClearAllModifiers() { _gameModifierDict.Clear(); } public static string GetModifiersString() { return (_gameModifierDict.Count > 0) ? GeneralExtensions.Join((IEnumerable)_gameModifierDict.Values, (Func)((GameModifierBase mod) => mod.Metadata.Name), ",") : ""; } internal static void Add(GameModifiers.ModifierType modifierType) { if (_gameModifierDict.ContainsKey(modifierType)) { Plugin.LogInfo($"Modifier of type {modifierType} is already in the modifier list."); } else { _gameModifierDict.Add(modifierType, CreateGameModifier(modifierType)); } } private static GameModifierBase CreateGameModifier(GameModifiers.ModifierType modifierType) { if (1 == 0) { } GameModifierBase result = modifierType switch { GameModifiers.ModifierType.Hidden => new GameModifiers.Hidden(), GameModifiers.ModifierType.Flashlight => new GameModifiers.Flashlight(), GameModifiers.ModifierType.Brutal => new GameModifiers.Brutal(), GameModifiers.ModifierType.InstaFail => new GameModifiers.InstaFail(), GameModifiers.ModifierType.EasyMode => new GameModifiers.EasyMode(), GameModifiers.ModifierType.StrictMode => new GameModifiers.StrictMode(), GameModifiers.ModifierType.HiddenCursor => new GameModifiers.HiddenCursor(), GameModifiers.ModifierType.NoBreathing => new GameModifiers.NoBreathing(), GameModifiers.ModifierType.MirrorMode => new GameModifiers.MirrorMode(), GameModifiers.ModifierType.ScoreV2 => new GameModifiers.ScoreV2(), GameModifiers.ModifierType.KeyboardMode => new GameModifiers.KeyboardMode(), GameModifiers.ModifierType.AutoPilot => new GameModifiers.AutoPilot(), GameModifiers.ModifierType.RelaxMode => new GameModifiers.RelaxMode(), _ => throw new NotImplementedException(), }; if (1 == 0) { } return result; } internal static void Remove(GameModifiers.ModifierType modifierType) { _gameModifierDict.Remove(modifierType); } public static void LoadModifiersFromString(string replayModifierString) { _modifiersBackup = GetModifiersString(); ClearAllModifiers(); Plugin.LogInfo("Received " + replayModifierString + " to load."); List modifierSet = GetModifierSet(replayModifierString); Plugin.LogInfo("Parsed " + GeneralExtensions.Join((IEnumerable)modifierSet, (Func)((GameModifiers.Metadata x) => x.Name), ",")); foreach (GameModifiers.Metadata item in modifierSet) { Add(item.ModifierType); } } public static List GetModifierSet(string replayModifierString) { if (replayModifierString == null || replayModifierString == "") { return new List(); } return (from modName in replayModifierString.Split(new char[1] { ',' }).Where(_stringModifierDict.ContainsKey) select _stringModifierDict[modName]).ToList(); } public static void LoadBackedupModifiers() { LoadModifiersFromString(_modifiersBackup); } } public static class GameModifiers { public class Hidden : GameModifierBase { public class FullNoteComponents { public Image startPoint; public Image endPoint; public Image startPointColor; public Image endPointColor; public LineRenderer outlineLine; public LineRenderer line; public Color alphaStart; public Color alphaEnd; public FullNoteComponents() { //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_0010: 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_0016: 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) alphaStart = (alphaEnd = Color.black); } } public Queue _activeNotesComponents; public Color _headOutColor; public Color _headInColor; public Color _tailOutColor; public Color _tailInColor; public Color _bodyOutStartColor; public Color _bodyOutEndColor; public Color _bodyInStartColor; public Color _bodyInEndColor; public static float START_FADEOUT_POSX = 3.5f; public static float END_FADEOUT_POSX = -1.6f; public static int _counter; public override Metadata Metadata => HIDDEN; public override void Initialize(GameController __instance) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00b4: 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_00d4: 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_00f4: 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_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_0168: Unknown result type (might be due to invalid IL or missing references) _counter = 1; _activeNotesComponents = new Queue(); GameObject val = __instance.allnotes.First(); _headOutColor = ((Graphic)((Component)val.transform.Find("StartPoint")).GetComponent()).color; _headInColor = ((Graphic)((Component)val.transform.Find("StartPoint/StartPointColor")).GetComponent()).color; _tailOutColor = ((Graphic)((Component)val.transform.Find("EndPoint")).GetComponent()).color; _tailInColor = ((Graphic)((Component)val.transform.Find("EndPoint/EndPointColor")).GetComponent()).color; _bodyOutStartColor = ((Component)val.transform.Find("OutlineLine")).GetComponent().startColor; _bodyOutEndColor = ((Component)val.transform.Find("OutlineLine")).GetComponent().endColor; _bodyInStartColor = ((Component)val.transform.Find("Line")).GetComponent().startColor; _bodyInEndColor = ((Component)val.transform.Find("Line")).GetComponent().endColor; foreach (GameObject item2 in from n in __instance.allnotes.Skip(1) where n.transform.position.x <= START_FADEOUT_POSX + 9.4f select n) { if (item2.transform.position.x <= START_FADEOUT_POSX + 9.4f) { FullNoteComponents item = new FullNoteComponents { startPoint = ((Component)item2.transform.Find("StartPoint")).GetComponent(), startPointColor = ((Component)item2.transform.Find("StartPoint/StartPointColor")).GetComponent(), endPoint = ((Component)item2.transform.Find("EndPoint")).GetComponent(), endPointColor = ((Component)item2.transform.Find("EndPoint/EndPointColor")).GetComponent(), outlineLine = ((Component)item2.transform.Find("OutlineLine")).GetComponent(), line = ((Component)item2.transform.Find("Line")).GetComponent() }; _activeNotesComponents.Enqueue(item); } } } public static void SetFadeOutValues(float startFadeOut, float endFadeOut) { START_FADEOUT_POSX = startFadeOut; END_FADEOUT_POSX = endFadeOut; } public override void Update(GameController __instance) { //IL_0050: 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_01da: 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_021a: 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_0232: 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_0251: 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_025d: 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_0277: 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_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02b5: 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_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) for (int i = _counter; i < __instance.allnotes.Count; i++) { GameObject currentNote = __instance.allnotes[i]; if (!_activeNotesComponents.Any((FullNoteComponents x) => (Object)(object)((Component)((Component)x.startPoint).transform.parent).gameObject == (Object)(object)currentNote)) { if (currentNote.transform.position.x > START_FADEOUT_POSX + 9.4f) { break; } FullNoteComponents item = new FullNoteComponents { startPoint = ((Component)currentNote.transform.GetChild(0)).GetComponent(), startPointColor = ((Component)currentNote.transform.GetChild(0).GetChild(0)).GetComponent(), endPoint = ((Component)currentNote.transform.GetChild(1)).GetComponent(), endPointColor = ((Component)currentNote.transform.GetChild(1).GetChild(0)).GetComponent(), outlineLine = ((Component)currentNote.transform.GetChild(2)).GetComponent(), line = ((Component)currentNote.transform.GetChild(3)).GetComponent() }; _counter++; _activeNotesComponents.Enqueue(item); } } for (int num = 0; num < _activeNotesComponents.Count; num++) { FullNoteComponents fullNoteComponents = _activeNotesComponents.ElementAt(num); fullNoteComponents.alphaStart.a = 1f - Mathf.Clamp((((Component)fullNoteComponents.startPoint).transform.position.x - END_FADEOUT_POSX) / (START_FADEOUT_POSX - END_FADEOUT_POSX), 0f, 1f); fullNoteComponents.alphaEnd.a = 1f - Mathf.Clamp((((Component)fullNoteComponents.endPoint).transform.position.x - END_FADEOUT_POSX) / (START_FADEOUT_POSX - END_FADEOUT_POSX), 0f, 1f); fullNoteComponents.outlineLine.startColor = _bodyOutStartColor - fullNoteComponents.alphaStart; fullNoteComponents.line.startColor = _bodyInStartColor - fullNoteComponents.alphaStart; ((Graphic)fullNoteComponents.startPoint).color = _headOutColor - fullNoteComponents.alphaStart; ((Graphic)fullNoteComponents.startPointColor).color = _headInColor - fullNoteComponents.alphaStart; fullNoteComponents.outlineLine.endColor = _bodyOutEndColor - fullNoteComponents.alphaEnd; fullNoteComponents.line.endColor = _bodyInEndColor - fullNoteComponents.alphaEnd; ((Graphic)fullNoteComponents.endPoint).color = _tailOutColor - fullNoteComponents.alphaEnd; ((Graphic)fullNoteComponents.endPointColor).color = _tailInColor - fullNoteComponents.alphaEnd; } while (_activeNotesComponents.Count > 0 && ((Component)_activeNotesComponents.Peek().endPoint).transform.position.x <= END_FADEOUT_POSX) { _activeNotesComponents.Dequeue(); } } } public class Flashlight : GameModifierBase { private Settings _settings; private Vector2 _pointerPos; private Color _color; private bool _isMirror; public override Metadata Metadata => FLASHLIGHT; public override void Initialize(GameController __instance) { //IL_0024: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_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_0095: 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_00bb: Unknown result type (might be due to invalid IL or missing references) ((PostProcessingModel)__instance.gameplayppp.vignette).enabled = true; _pointerPos = new Vector2(0.075f, (__instance.pointer.transform.localPosition.y + 215f) / 430f); _color = new Color(0.3f, 0.3f, 0.3f, 1f); _settings = new Settings { center = _pointerPos, color = _color, intensity = 0.8f, mode = (Mode)0, rounded = true, roundness = 1f, smoothness = 1f }; _isMirror = GameModifierManager.GetModifiersString().Contains("MR"); } public override void Update(GameController __instance) { //IL_00f2: 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_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_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_013b: Unknown result type (might be due to invalid IL or missing references) if (__instance.totalscore != 0) { float num = (float)__instance.defaultnotelength / (100f / (__instance.tempo * TootTallyGlobalVariables.gameSpeedMultiplier)); _settings.intensity = 325f / Mathf.Min(num, 325f) + __instance.breathcounter; if (__instance.notebuttonpressed && !__instance.outofbreath) { _color.r = (_color.g = (_color.b = 0f)); _color.a = 1f; } } if (_isMirror) { _pointerPos.y = (215f - __instance.pointer.transform.localPosition.y) / 430f; } else { _pointerPos.y = (__instance.pointer.transform.localPosition.y + 215f) / 430f; } _settings.center = _pointerPos; _settings.color = _color; __instance.gameplayppp.vignette.settings = _settings; } } public class Brutal : GameModifierBase { private float _defaultSpeed; private float _speed; private int _lastCombo; public override Metadata Metadata => BRUTAL; public override void Initialize(GameController __instance) { _defaultSpeed = 1f; _speed = _defaultSpeed; _lastCombo = 0; } public override void Update(GameController __instance) { if (__instance.paused || __instance.quitting || __instance.retrying || __instance.level_finished) { _speed = _defaultSpeed; Time.timeScale = 1f; } else if ((Object)(object)__instance.musictrack.outputAudioMixerGroup == (Object)(object)__instance.audmix_bgmus) { __instance.musictrack.outputAudioMixerGroup = __instance.audmix_bgmus_pitchshifted; } } public override void SpecialUpdate(GameController __instance) { if (_lastCombo != __instance.highestcombocounter || __instance.highestcombocounter == 0) { bool flag = _lastCombo < __instance.highestcombocounter && __instance.highestcombocounter != 0; _speed = Mathf.Clamp(_speed + (flag ? 0.015f : (-0.07f)), _defaultSpeed, 2f); Time.timeScale = _speed / _defaultSpeed; __instance.musictrack.pitch = _speed; __instance.audmix.SetFloat("pitchShifterMult", 1f / _speed); } _lastCombo = __instance.highestcombocounter; } } public class InstaFail : GameModifierBase { public override Metadata Metadata => INSTA_FAIL; public override void SpecialUpdate(GameController __instance) { if (!__instance.paused && !__instance.quitting && !__instance.retrying && !__instance.level_finished && !TootTallyGlobalVariables.isSpectating && !TootTallyGlobalVariables.isReplaying) { __instance.notebuttonpressed = false; __instance.musictrack.Pause(); __instance.sfxrefs.backfromfreeplay.Play(); __instance.quitting = true; __instance.pauseRetryLevel(); } } } public class EasyMode : GameModifierBase { public override Metadata Metadata => EASY_MODE; public override void SpecialUpdate(GameController __instance) { __instance.notescoreaverage = Mathf.Clamp(__instance.notescoreaverage * 1.15f, 0f, 100f); } } public class StrictMode : GameModifierBase { public override Metadata Metadata => STRICT_MODE; public override void Update(GameController __instance) { //IL_0007: 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) float num = __instance.noteholderr.anchoredPosition3D.x - __instance.zeroxpos; num = ((num > 0f) ? (-1f) : Mathf.Abs(num)); if (__instance.noteactive && !__instance.freeplay && !__instance.paused) { float num2 = (__instance.currentnoteend - num) / (__instance.currentnoteend - __instance.currentnotestart); num2 = Mathf.Abs(1f - num2); float num3 = __instance.easeInOutVal(num2, 0f, __instance.currentnotepshift, 1f); float num4 = __instance.pointerrect.anchoredPosition.y - (__instance.currentnotestarty + num3); if (__instance.currentnotepshift != 0f) { float num5 = (Mathf.Clamp(Mathf.Abs(__instance.currentnotepshift), 10f, 150f) - 10f) / 140f; float num6 = Mathf.Lerp(0.96f, 0.7f, num5); num4 *= num6; } float num7 = 100f - Mathf.Abs(num4); if (num7 < 0f || !__instance.noteplaying) { __instance.notescoresamples += 4.78f; __instance.notescoretotal = 0f; __instance.notescoreaverage = __instance.notescoretotal / __instance.notescoresamples; } } } } public class HiddenCursor : GameModifierBase { public override Metadata Metadata => HIDDEN_CURSOR; public override void Initialize(GameController __instance) { __instance.pointer.SetActive(false); } } public class NoBreathing : GameModifierBase { public override Metadata Metadata => NO_BREATHING; public override void Update(GameController __instance) { __instance.breathcounter = 0f; } } public class MirrorMode : GameModifierBase { public override Metadata Metadata => MIRROR_MODE; public override void Initialize(GameController __instance) { //IL_0020: 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_0074: 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) __instance.noteholder.transform.parent.localScale = new Vector3(1f, -1f, 1f); __instance.lyricsholder.transform.localScale = new Vector3(1f, -1f, 1f); for (int i = 0; i < 15; i++) { __instance.noteparticles.transform.GetChild(i).localScale = new Vector3(1f, -1f, 1f); } _ = __instance.gameplay_settings; int mousecontrolmode = GlobalVariables.localsettings.mousecontrolmode; if (1 == 0) { } int mouse_controldirection = mousecontrolmode switch { 0 => 1, 1 => 0, 2 => 3, 3 => 2, _ => 3, }; if (1 == 0) { } __instance.gameplay_settings.mouse_controldirection = mouse_controldirection; } } public class ScoreV2 : GameModifierBase { public override Metadata Metadata => SCORE_V2; public override void SpecialUpdate(GameController __instance) { } } public class RelaxMode : GameModifierBase { private GameController _gameController; private int _noteIndex; private float _latencyOffset; private float _trackTime; private float _lastTrackTime; private float _lastTimeSample; private float _currentNoteStartTime; private float _currentNoteEndTime; private float _lastNoteEndTime; private bool _isTooting; private bool _releasedBetweenNotes; private bool _shouldBreath; private bool _isNoteActive; private bool _isSlider; public override Metadata Metadata => RELAX_MODE; public override void Initialize(GameController __instance) { _gameController = __instance; _latencyOffset = _gameController.latency_offset; _isTooting = false; _isSlider = false; _shouldBreath = false; _isNoteActive = false; _releasedBetweenNotes = true; _noteIndex = -1; _lastNoteEndTime = -999f; _lastTrackTime = (_trackTime = 0f); _lastTimeSample = 0f; if (_gameController.leveldata.Count > 0) { _currentNoteStartTime = B2s(_gameController.leveldata[0][0], _gameController.tempo); _currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[0][1], _gameController.tempo); } } public override void Update(GameController __instance) { if (!_gameController.paused && !_gameController.quitting && _gameController.musictrack.isPlaying) { UpdateTrackData(); } if (!_shouldBreath && ((_gameController.breathcounter >= 0.95f && _isNoteActive) || (!_isNoteActive && _gameController.breathcounter >= 0.5f))) { _shouldBreath = true; } else if (_shouldBreath && ((_gameController.breathcounter <= 0.65f && _isNoteActive) || (!_isNoteActive && _gameController.breathcounter <= 0f))) { _shouldBreath = false; } _isTooting = ShouldToot(); if (!_isTooting) { _releasedBetweenNotes = true; } } public override void SpecialUpdate(ref bool __value) { __value = _isTooting; } private bool ShouldToot() { return ((_trackTime >= Mathf.Max(_currentNoteStartTime - _latencyOffset, _lastNoteEndTime) && _releasedBetweenNotes) || _trackTime <= _lastNoteEndTime || _isSlider) && !_shouldBreath && _trackTime > 0.01f; } private void UpdateTrackData() { float deltaTime = Time.deltaTime; _trackTime += deltaTime * TootTallyGlobalVariables.gameSpeedMultiplier; if (_lastTimeSample != (float)_gameController.musictrack.timeSamples) { _lastTrackTime = _gameController.musictrack.time - _gameController.noteoffset - _gameController.latency_offset; _lastTimeSample = _gameController.musictrack.timeSamples; } _trackTime += (_lastTrackTime - _trackTime) / 60f; if (_trackTime >= _currentNoteEndTime) { _noteIndex++; if (_noteIndex + 1 < _gameController.leveldata.Count) { _lastNoteEndTime = _currentNoteEndTime + 0.005f * TootTallyGlobalVariables.gameSpeedMultiplier; _isSlider = Mathf.Abs(_gameController.leveldata[_noteIndex + 1][0] - (_gameController.leveldata[_noteIndex][0] + _gameController.leveldata[_noteIndex][1])) < 0.05f; _currentNoteStartTime = B2s(_gameController.leveldata[_noteIndex + 1][0], _gameController.tempo); _currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[_noteIndex + 1][1], _gameController.tempo); _lastNoteEndTime = Mathf.Min(_lastNoteEndTime, _currentNoteStartTime - 0.01f); _releasedBetweenNotes = !_isTooting; } else { _currentNoteStartTime = float.MaxValue; _isSlider = false; } } _isNoteActive = _trackTime >= _currentNoteStartTime - deltaTime * 5f && _trackTime < _currentNoteEndTime + deltaTime * 5f; } public static float B2s(float time, float bpm) { return time / bpm * 60f; } } public class AutoPilot : GameModifierBase { private GameController _gameController; private RectTransform _pointerRect; private int _noteIndex; private float _trackTime; private float _lastTrackTime; private float _lastTimeSample; private float _currentNoteStartTime; private float _currentNoteEndTime; private float _currentNoteStartY; private float _currentNoteEndY; private float _lastNoteEndY; private float _lastNoteEndTime; private float _earlyTimingAdjustValue; private float _lateTimingAdjustValue; private Vector2 _pointerPosition; private BackgroundPuppetController _bgPuppetController; private Vector2 _screenDim; public override Metadata Metadata => AUTO_PILOT; public override void Initialize(GameController __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_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) _gameController = __instance; _gameController.controllermode = true; _pointerRect = _gameController.pointerrect; _noteIndex = -1; _lastNoteEndY = 0f; _lastNoteEndTime = -999f; _lastTrackTime = (_trackTime = 0f); _lastTimeSample = 0f; _pointerPosition = _pointerRect.anchoredPosition; if (_gameController.leveldata.Count > 0) { _currentNoteStartTime = B2s(_gameController.leveldata[0][0], _gameController.tempo); _currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[0][1], _gameController.tempo); _currentNoteStartY = _gameController.leveldata[0][2]; _currentNoteEndY = _gameController.leveldata[0][4]; } _earlyTimingAdjustValue = 0.005f * TootTallyGlobalVariables.gameSpeedMultiplier; _lateTimingAdjustValue = 0.005f * TootTallyGlobalVariables.gameSpeedMultiplier; _screenDim = new Vector2((float)Screen.width, (float)Screen.height); if ((Object)(object)__instance.bgcontroller != (Object)null) { _bgPuppetController = __instance.bgcontroller.fullbgobject.GetComponent(); } else { _bgPuppetController = null; } } public override void Update(GameController __instance) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_gameController == (Object)null || !((Behaviour)_gameController).enabled || _gameController.freeplay) { return; } if (!_gameController.paused && !_gameController.quitting && _gameController.musictrack.isPlaying) { UpdateTrackData(); } _pointerPosition.y = GetPositionY(); _pointerRect.anchoredPosition = _pointerPosition; if ((Object)(object)_gameController != (Object)null && (Object)(object)_gameController.puppet_humanc != (Object)null) { _gameController.puppet_humanc.doPuppetControl((0f - _pointerPosition.y) / 225f); BackgroundPuppetController bgPuppetController = _bgPuppetController; if (bgPuppetController != null) { bgPuppetController.DoPuppetControl((0f - _pointerPosition.y) / 225f, _gameController.vibratoamt); } } } private void UpdateTrackData() { float deltaTime = Time.deltaTime; _trackTime += deltaTime * TootTallyGlobalVariables.gameSpeedMultiplier; if (_lastTimeSample != (float)_gameController.musictrack.timeSamples) { _lastTrackTime = _gameController.musictrack.time - _gameController.noteoffset - _gameController.latency_offset; _lastTimeSample = _gameController.musictrack.timeSamples; } _trackTime += (_lastTrackTime - _trackTime) / 60f; if (_trackTime >= _currentNoteEndTime) { _noteIndex++; if (_noteIndex + 1 < _gameController.leveldata.Count) { _lastNoteEndTime = _currentNoteEndTime + _lateTimingAdjustValue; _lastNoteEndY = _currentNoteEndY; _currentNoteStartTime = B2s(_gameController.leveldata[_noteIndex + 1][0], _gameController.tempo); _currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[_noteIndex + 1][1], _gameController.tempo); _currentNoteStartY = _gameController.leveldata[_noteIndex + 1][2]; _currentNoteEndY = _gameController.leveldata[_noteIndex + 1][4]; _lastNoteEndTime = Mathf.Min(_lastNoteEndTime, _currentNoteStartTime - 0.01f); } else { _currentNoteStartTime = float.MaxValue; } } } private float GetPositionY() { float t; if (!(_trackTime >= _currentNoteStartTime - _earlyTimingAdjustValue) || !(_trackTime <= _currentNoteEndTime + _lateTimingAdjustValue)) { float num = _currentNoteStartTime - _earlyTimingAdjustValue; t = Mathf.Clamp(1f - (num - _trackTime) / (num - _lastNoteEndTime), 0f, 1f); return Mathf.Lerp(_lastNoteEndY, _currentNoteStartY, InOutQuad(t)); } t = ((_currentNoteStartY == _currentNoteEndY) ? Mathf.Clamp(1f - (_currentNoteEndTime - _trackTime) / (_currentNoteEndTime - (_currentNoteStartTime - _earlyTimingAdjustValue)), 0f, 1f) : Mathf.Clamp(1f - (_currentNoteEndTime - _trackTime - 0.005555f * TootTallyGlobalVariables.gameSpeedMultiplier) / (_currentNoteEndTime - _currentNoteStartTime), 0f, 1f)); return _currentNoteStartY + _gameController.easeInOutVal(Mathf.Abs(t), 0f, _currentNoteEndY - _currentNoteStartY, 1f); } public static float InQuad(float t) { return t * t; } public static float OutQuad(float t) { return 1f - InQuad(1f - t); } public static float InOutQuad(float t) { if ((double)t < 0.5) { return InQuad(t * 2f) / 2f; } return 1f - InQuad((1f - t) * 2f) / 2f; } public static float B2s(float time, float bpm) { return time / bpm * 60f; } } public class KeyboardMode : GameModifierBase { private readonly Dictionary _keycodeToPositionDict = new Dictionary { { (KeyCode)97, 0f }, { (KeyCode)115, 13.75f }, { (KeyCode)100, 41.25f }, { (KeyCode)102, 68.75f }, { (KeyCode)103, 96.25f }, { (KeyCode)104, 110f }, { (KeyCode)106, 137.5f }, { (KeyCode)107, 165f }, { (KeyCode)109, -13.75f }, { (KeyCode)110, -41.25f }, { (KeyCode)98, -68.75f }, { (KeyCode)118, -96.25f }, { (KeyCode)99, -110f }, { (KeyCode)120, -137.5f }, { (KeyCode)122, -165f } }; private Vector3 _pitchOffset; private Vector3 _lastPointerPosition; public override Metadata Metadata => KEYBOARD_MODE; public override void Initialize(GameController __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) __instance.controllermode = true; __instance.gameplay_settings.mouse_movementmode = 1; Cursor.lockState = (CursorLockMode)1; _lastPointerPosition = __instance.pointer.transform.localPosition; _pitchOffset = Vector3.zero; } public override void Update(GameController __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0042: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_008b: Unknown result type (might be due to invalid IL or missing references) KeyCode val = ((IEnumerable)_keycodeToPositionDict.Keys).FirstOrDefault((Func)Input.GetKeyDown); if ((int)val > 0) { _lastPointerPosition = __instance.pointer.transform.localPosition; float num = (Input.GetKey((KeyCode)304) ? 13.75f : 0f); float num2 = (Input.GetKey((KeyCode)306) ? (-13.75f) : 0f); _lastPointerPosition.y = _keycodeToPositionDict[val] + num + num2; _pitchOffset.y = 0f; } float num3 = Input.GetAxisRaw("Mouse Y") * 4f; if (num3 != 0f) { _pitchOffset.y += num3; if (Mathf.Abs(_lastPointerPosition.y + _pitchOffset.y) >= 180f) { _lastPointerPosition.y = 180f * Mathf.Sign(_lastPointerPosition.y + _pitchOffset.y); _pitchOffset.y = 0f; } } __instance.pointer.transform.localPosition = _lastPointerPosition + _pitchOffset; } } public readonly struct Metadata { public string Name { get; } public ModifierType ModifierType { get; } public string Description { get; } public bool ScoreSubmitEnabled { get; } public bool AllowedInMultiplayer { get; } public Metadata(string name, ModifierType modifierType, string description, bool scoreSubmitEnabled, bool allowedInMultiplayer) { Name = name; ModifierType = modifierType; Description = description; ScoreSubmitEnabled = scoreSubmitEnabled; AllowedInMultiplayer = allowedInMultiplayer; } } public enum ModifierType { Hidden, Flashlight, Brutal, InstaFail, EasyMode, StrictMode, HiddenCursor, NoBreathing, MirrorMode, ScoreV2, KeyboardMode, AutoPilot, RelaxMode } public enum ControlType { RegularX, InvertedX, RegularY, InvertedY, NotSet } public static Metadata HIDDEN = new Metadata("HD", ModifierType.Hidden, "Hidden: Notes will disappear as they\n approach the left", scoreSubmitEnabled: true, allowedInMultiplayer: true); public static Metadata FLASHLIGHT = new Metadata("FL", ModifierType.Flashlight, "Flashlight: Only a small circle around the\n cursor is visible", scoreSubmitEnabled: true, allowedInMultiplayer: true); public static Metadata BRUTAL = new Metadata("BT", ModifierType.Brutal, "Brutal: Game will speed up if you do good and\n slow down when you are bad (Unrated)", scoreSubmitEnabled: false, allowedInMultiplayer: false); public static Metadata INSTA_FAIL = new Metadata("IF", ModifierType.InstaFail, "Insta Fail: Restart the song as soon as you miss", scoreSubmitEnabled: true, allowedInMultiplayer: false); public static Metadata EASY_MODE = new Metadata("EZ", ModifierType.EasyMode, "Easy Mode: Lower the threshold for combo and champ break", scoreSubmitEnabled: true, allowedInMultiplayer: true); public static Metadata STRICT_MODE = new Metadata("ST", ModifierType.StrictMode, "Strict Mode: Note timing becomes significantly more strict (Unrated)", scoreSubmitEnabled: false, allowedInMultiplayer: true); public static Metadata HIDDEN_CURSOR = new Metadata("HC", ModifierType.HiddenCursor, "Hidden Cursor: Make the cursor invisible", scoreSubmitEnabled: true, allowedInMultiplayer: true); public static Metadata NO_BREATHING = new Metadata("NB", ModifierType.NoBreathing, "No Breathing: Disables the breathing mechanic (Unrated)", scoreSubmitEnabled: false, allowedInMultiplayer: true); public static Metadata MIRROR_MODE = new Metadata("MR", ModifierType.MirrorMode, "Mirror Mode: Inverts the Y axis.", scoreSubmitEnabled: true, allowedInMultiplayer: true); public static Metadata SCORE_V2 = new Metadata("V2", ModifierType.ScoreV2, "Score V2: Normalizes the score to 1 million points.", scoreSubmitEnabled: false, allowedInMultiplayer: true); public static Metadata AUTO_PILOT = new Metadata("AP", ModifierType.AutoPilot, "Auto Pilot: Automatically aim at the notes.", scoreSubmitEnabled: false, allowedInMultiplayer: true); public static Metadata RELAX_MODE = new Metadata("RX", ModifierType.RelaxMode, "Relax Mode: Automatically toot when hovering a note.", scoreSubmitEnabled: false, allowedInMultiplayer: true); public static Metadata KEYBOARD_MODE = new Metadata("KM", ModifierType.KeyboardMode, "Keyboard Mode: Play notes with your keyboard, adjust pitch with mouse", scoreSubmitEnabled: false, allowedInMultiplayer: false); } public class ModifierButton { public CustomButton button; public bool active; public GameModifiers.Metadata modifier; public bool onCooldown = false; private GameObject glow; private SecondDegreeDynamicsAnimation anim = new SecondDegreeDynamicsAnimation(2.5f, 1f, 2.5f); public ModifierButton(Transform transform, GameModifiers.Metadata modifier, bool active, Vector2 size, int bubbleBorder, int fontSize, bool useWorldPosition, Action onClick = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0067: 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_0088: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_010e: 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_014c: 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_0186: 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_01bc: 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) string text = modifier.ModifierType.ToString(); Sprite sprite = AssetManager.GetSprite(modifier.Name + ".png"); this.active = active; this.modifier = modifier; button = GameObjectFactory.CreateCustomButton(transform, Vector2.zero, size, sprite, text, onClick); GameObject gameObject = ((Component)button).gameObject; GameObject val = GameObjectFactory.CreateBubble(Vector2.zero, text + "Bubble", modifier.Description, new Vector2(1f, 0f), bubbleBorder, true, fontSize); gameObject.AddComponent().Initialize(transform, val, useWorldPosition); glow = new GameObject("glow", new Type[1] { typeof(Image) }); Image component = glow.GetComponent(); component.useSpriteMesh = true; ((Graphic)component).color = Theme.colors.replayButton.text; ((MaskableGraphic)component).maskable = true; component.sprite = AssetManager.GetSprite("glow.png"); glow.GetComponent().sizeDelta = new Vector2(size.x * 1.5f, size.y * 1.5f); glow.transform.SetParent(gameObject.transform); glow.transform.localScale = Vector3.one / 1.2f; if (active) { ToggleOn(); } else { ToggleOff(); } RectTransform component2 = gameObject.GetComponent(); component2.pivot = Vector2.one / 2f; } public void ToggleOn() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) active = true; TootTallyAnimationManager.AddNewEulerAngleAnimation(((Component)button).gameObject, new Vector3(0f, 0f, 8f), 0.15f, anim, (Action)delegate { onCooldown = false; }); glow.SetActive(true); } public void ToggleOff() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) active = false; TootTallyAnimationManager.AddNewEulerAngleAnimation(((Component)button).gameObject, Vector3.zero, 0.15f, anim, (Action)delegate { onCooldown = false; }); glow.SetActive(false); } } [BepInPlugin("TootTallyGameModifiers", "TootTallyGameModifiers", "1.2.12")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin, ITootTallyModule { public static Plugin Instance; private Harmony _harmony; public static TootTallySettingSlider StartFadeoutInput; public static TootTallySettingSlider EndFadeoutInput; public ConfigEntry ModuleConfigEnabled { get; set; } public bool IsConfigInitialized { get; set; } public string Name { get { return "TootTallyGameModifiers"; } set { Name = value; } } public static void LogInfo(string msg) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg); } public static void LogError(string msg) { ((BaseUnityPlugin)Instance).Logger.LogError((object)msg); } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { Instance = this; _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize); } } private void TryInitialize() { ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Modules", "GameModifiers", true, "Enable GameModifiers"); TootTallyModuleManager.AddModule((ITootTallyModule)(object)this); } public void LoadModule() { AssetBundleManager.LoadAssets(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "layoutassetbundle")); AssetManager.LoadAssets(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "Assets")); _harmony.PatchAll(typeof(GameModifierManager)); LogInfo("Module loaded!"); } public void UnloadModule() { _harmony.UnpatchSelf(); LogInfo("Module unloaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "TootTallyGameModifiers"; public const string PLUGIN_NAME = "TootTallyGameModifiers"; public const string PLUGIN_VERSION = "1.2.12"; } }