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 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 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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTallyGameModifiers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Gameplay modifiers for global leaderboards and for fun")]
[assembly: AssemblyFileVersion("1.1.6.0")]
[assembly: AssemblyInformationalVersion("1.1.6")]
[assembly: AssemblyProduct("TootTallyGameModifiers")]
[assembly: AssemblyTitle("TootTallyGameModifiers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.6.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 TootTallyGameModifiers
{
public abstract class GameModifierBase
{
public abstract string Name { get; }
public abstract GameModifiers.ModifierType ModifierType { get; }
public abstract void Initialize(GameController __instance);
public abstract void Update(GameController __instance);
public virtual void SpecialUpdate(GameController __instance)
{
}
public virtual void Remove()
{
GameModifierManager.Remove(ModifierType);
}
}
public static class GameModifierManager
{
private static bool _isInitialized;
private static Dictionary<GameModifiers.ModifierType, GameModifierBase> _gameModifierDict;
private static List<GameModifierBase> _modifierTypesToRemove;
private static Dictionary<string, GameModifiers.ModifierType> _stringModifierDict;
private static string _modifiersBackup;
private static GameObject _modifierPanel;
private static GameObject _modifierPanelContainer;
private static GameObject _showModifierPanelButton;
private static GameObject _hideModifierPanelButton;
private static Dictionary<GameModifiers.ModifierType, GameObject> _modifierButtonDict;
private static TootTallyAnimation _openAnimation;
private static TootTallyAnimation _closeAnimation;
private static bool _canClickButtons;
[HarmonyPatch(typeof(HomeController), "Start")]
[HarmonyPostfix]
public static void OnHomeControllerStartInitialize()
{
if (!_isInitialized)
{
Initialize();
}
}
[HarmonyPatch(typeof(LevelSelectController), "Start")]
[HarmonyPostfix]
private static void OnLevelSelectControllerStartPostfix(LevelSelectController __instance)
{
//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_0075: 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_009e: 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_010e: 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_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: 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_0257: 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_029b: 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_02b1: 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_02e7: Expected O, but got Unknown
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
_modifierButtonDict.Clear();
_showModifierPanelButton = GameObjectFactory.CreateModifierButton(((Component)__instance.fullpanel).transform, AssetManager.GetSprite("ModifierButton.png"), "OpenModifierPanelButton", "", false, (Action)ShowModifierPanel);
_showModifierPanelButton.transform.localScale = Vector2.op_Implicit(Vector2.one);
_showModifierPanelButton.GetComponent<RectTransform>().pivot = Vector2.one / 2f;
_showModifierPanelButton.GetComponent<RectTransform>().anchoredPosition = new Vector2(365f, -160f);
GameObject gameObject = GameObject.Find("Camera-Popups").gameObject;
GameObject gameObject2 = ((Component)gameObject.transform.Find("LeaderboardCanvas/PanelBody")).gameObject;
((Graphic)gameObject2.GetComponent<Image>()).color = Theme.colors.leaderboard.panelBody;
((Graphic)((Component)gameObject2.transform.Find("scoresbody")).gameObject.GetComponent<Image>()).color = Theme.colors.leaderboard.scoresBody;
_modifierPanel = Object.Instantiate<GameObject>(gameObject2, ((Component)__instance.fullpanel).transform);
GameObjectFactory.DestroyFromParent(_modifierPanel, "CloseButton");
GameObjectFactory.DestroyFromParent(_modifierPanel, "txt_legal");
GameObjectFactory.DestroyFromParent(_modifierPanel, "txt_leaderboards");
GameObjectFactory.DestroyFromParent(_modifierPanel, "txt_songname");
GameObjectFactory.DestroyFromParent(_modifierPanel, "rule");
GameObjectFactory.DestroyFromParent(_modifierPanel, "HelpBtn");
GameObjectFactory.DestroyFromParent(_modifierPanel, "loadingspinner_parent");
GameObjectFactory.DestroyFromParent(_modifierPanel, "scoreboard");
GameObjectFactory.DestroyFromParent(_modifierPanel, "tabs");
GameObjectFactory.DestroyFromParent(_modifierPanel, "errors");
GameObjectFactory.DestroyFromParent(_modifierPanel, "PanelFront");
((Object)_modifierPanel).name = "ModifierPanel";
RectTransform component = _modifierPanel.GetComponent<RectTransform>();
component.anchoredPosition = new Vector2(-35f, 60f);
component.sizeDelta = new Vector2(300f, 200f);
((Transform)component).localScale = Vector2.op_Implicit(Vector2.one * 0.5f);
_modifierPanel.SetActive(false);
_modifierPanel.transform.localScale = Vector2.op_Implicit(Vector2.zero);
_modifierPanelContainer = ((Component)_modifierPanel.transform.Find("scoresbody")).gameObject;
RectTransform component2 = _modifierPanelContainer.GetComponent<RectTransform>();
component2.anchoredPosition = new Vector2(0f, -10f);
component2.sizeDelta = Vector2.one * -20f;
_modifierPanelContainer.AddComponent<Mask>();
GridLayoutGroup val = _modifierPanelContainer.AddComponent<GridLayoutGroup>();
((LayoutGroup)val).padding = new RectOffset(30, 30, 30, 30);
val.spacing = new Vector2(5f, 5f);
val.cellSize = new Vector2(64f, 64f);
((LayoutGroup)val).childAlignment = (TextAnchor)0;
_hideModifierPanelButton = ((Component)GameObjectFactory.CreateCustomButton(_modifierPanelContainer.transform, Vector2.zero, new Vector2(32f, 32f), AssetManager.GetSprite("Close64.png"), "CloseModifierPanelButton", (Action)HideModifierPanel)).gameObject;
LayoutElement val2 = _hideModifierPanelButton.AddComponent<LayoutElement>();
val2.ignoreLayout = true;
_modifierButtonDict.Add(GameModifiers.ModifierType.Hidden, GameObjectFactory.CreateModifierButton(_modifierPanelContainer.transform, AssetManager.GetSprite("HD.png"), "HiddenButton", "Hidden: Notes will disappear as they\n approach the left", _gameModifierDict.ContainsKey(GameModifiers.ModifierType.Hidden), (Action)delegate
{
Toggle(GameModifiers.ModifierType.Hidden);
}));
_modifierButtonDict.Add(GameModifiers.ModifierType.Flashlight, GameObjectFactory.CreateModifierButton(_modifierPanelContainer.transform, AssetManager.GetSprite("FL.png"), "FlashlightButton", "Flashlight: Only a small circle around the\n cursor is visible", _gameModifierDict.ContainsKey(GameModifiers.ModifierType.Flashlight), (Action)delegate
{
Toggle(GameModifiers.ModifierType.Flashlight);
}));
_modifierButtonDict.Add(GameModifiers.ModifierType.Brutal, GameObjectFactory.CreateModifierButton(_modifierPanelContainer.transform, AssetManager.GetSprite("BT.png"), "BrutalButton", "Brutal: Game will speed up if you do good and\n slow down when you are bad", _gameModifierDict.ContainsKey(GameModifiers.ModifierType.Brutal), (Action)delegate
{
Toggle(GameModifiers.ModifierType.Brutal);
}));
_modifierButtonDict.Add(GameModifiers.ModifierType.InstaFail, GameObjectFactory.CreateModifierButton(_modifierPanelContainer.transform, AssetManager.GetSprite("IF.png"), "InstaFailButton", "Insta Fail: Restart the song as soon as you miss.", _gameModifierDict.ContainsKey(GameModifiers.ModifierType.InstaFail), (Action)delegate
{
Toggle(GameModifiers.ModifierType.InstaFail);
}));
__instance.sortdrop.transform.SetAsLastSibling();
}
public static void Initialize()
{
_gameModifierDict = new Dictionary<GameModifiers.ModifierType, GameModifierBase>();
_modifierButtonDict = new Dictionary<GameModifiers.ModifierType, GameObject>();
_stringModifierDict = new Dictionary<string, GameModifiers.ModifierType>
{
{
"HD",
GameModifiers.ModifierType.Hidden
},
{
"FL",
GameModifiers.ModifierType.Flashlight
},
{
"BT",
GameModifiers.ModifierType.Brutal
},
{
"IF",
GameModifiers.ModifierType.InstaFail
}
};
_modifierTypesToRemove = new List<GameModifierBase>();
_modifiersBackup = "None";
_isInitialized = true;
}
private static void ShowModifierPanel()
{
//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_0075: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00ad: 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_00ef: Expected O, but got Unknown
if ((Object)(object)_modifierPanel == (Object)null)
{
return;
}
if (_modifierPanel.activeSelf)
{
TootTallyNotifManager.DisplayNotif("Stop trying to breaking my stuff... -_-", 6f);
}
_canClickButtons = false;
_modifierPanel.SetActive(true);
TootTallyAnimation closeAnimation = _closeAnimation;
if (closeAnimation != null)
{
closeAnimation.Dispose();
}
_showModifierPanelButton.transform.localScale = Vector2.op_Implicit(Vector2.zero);
_openAnimation = TootTallyAnimationManager.AddNewScaleAnimation(_modifierPanel, Vector2.one / 2f, 0.75f, new SecondDegreeDynamicsAnimation(2.5f, 1f, 0f), (Action<GameObject>)null);
TootTallyAnimationManager.AddNewScaleAnimation(_modifierPanel, Vector2.one, 0.1f, new SecondDegreeDynamicsAnimation(0f, 0f, 0f), (Action<GameObject>)delegate
{
_canClickButtons = true;
CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)_modifierButtonDict.Values, (Action<GameObject>)delegate(GameObject b)
{
//IL_0001: 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: Expected O, but got Unknown
TootTallyAnimationManager.AddNewScaleAnimation(b, Vector2.one, 0.75f, new SecondDegreeDynamicsAnimation(2.5f, 1f, 0f), (Action<GameObject>)null);
});
});
}
private static void HideModifierPanel()
{
//IL_0031: 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: Expected O, but got Unknown
//IL_005b: 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_009d: Expected O, but got Unknown
if ((Object)(object)_modifierPanel == (Object)null)
{
return;
}
TootTallyAnimation openAnimation = _openAnimation;
if (openAnimation != null)
{
openAnimation.Dispose();
}
_canClickButtons = false;
TootTallyAnimationManager.AddNewScaleAnimation(_showModifierPanelButton, Vector2.one, 0.5f, new SecondDegreeDynamicsAnimation(3.5f, 1f, 0f), (Action<GameObject>)null);
_closeAnimation = TootTallyAnimationManager.AddNewScaleAnimation(_modifierPanel, Vector2.zero, 0.35f, new SecondDegreeDynamicsAnimation(2.5f, 1f, 0f), (Action<GameObject>)delegate
{
_modifierPanel.SetActive(false);
CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)_modifierButtonDict.Values, (Action<GameObject>)delegate(GameObject b)
{
//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)
b.transform.localScale = Vector2.op_Implicit(Vector2.zero);
});
});
}
private static void Toggle(GameModifiers.ModifierType modifierType)
{
//IL_00e3: 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_0048: 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_0125: Expected O, but got Unknown
//IL_008a: Expected O, but got Unknown
if (!_canClickButtons)
{
return;
}
_canClickButtons = false;
if (!_gameModifierDict.ContainsKey(modifierType))
{
TootTallyAnimationManager.AddNewEulerAngleAnimation(_modifierButtonDict[modifierType], new Vector3(0f, 0f, 8f), 0.15f, new SecondDegreeDynamicsAnimation(2.5f, 1f, 2.5f), (Action<GameObject>)delegate
{
_canClickButtons = true;
});
((Component)_modifierButtonDict[modifierType].transform.Find("glow")).gameObject.SetActive(true);
TootTallyNotifManager.DisplayNotif($"{modifierType} mod enabled.", 6f);
Add(modifierType);
}
else
{
TootTallyAnimationManager.AddNewEulerAngleAnimation(_modifierButtonDict[modifierType], Vector3.zero, 0.15f, new SecondDegreeDynamicsAnimation(2.5f, 1f, 2.5f), (Action<GameObject>)delegate
{
_canClickButtons = true;
});
((Component)_modifierButtonDict[modifierType].transform.Find("glow")).gameObject.SetActive(false);
TootTallyNotifManager.DisplayNotif($"{modifierType} mod disabled.", 6f);
Remove(modifierType);
}
}
[HarmonyPatch(typeof(GameController), "Start")]
[HarmonyPostfix]
public static void InitializeModifers(GameController __instance)
{
if (!_isInitialized)
{
return;
}
Plugin.LogInfo("Active modifiers: " + GetModifiersString());
foreach (GameModifierBase value in _gameModifierDict.Values)
{
value.Initialize(__instance);
}
if (!_gameModifierDict.ContainsKey(GameModifiers.ModifierType.Flashlight))
{
((PostProcessingModel)__instance.gameplayppp.vignette).enabled = false;
}
}
[HarmonyPatch(typeof(GameController), "Update")]
[HarmonyPostfix]
public static void UpdateModifiers(GameController __instance)
{
if (!_isInitialized)
{
return;
}
foreach (GameModifierBase value in _gameModifierDict.Values)
{
value.Update(__instance);
}
}
[HarmonyPatch(typeof(GameController), "doScoreText")]
[HarmonyPostfix]
public static void UpdateBurtalMode(GameController __instance, int whichtext)
{
if (_isInitialized)
{
_gameModifierDict.TryGetValue(GameModifiers.ModifierType.Brutal, out var value);
value?.SpecialUpdate(__instance);
if (whichtext <= 2)
{
_gameModifierDict.TryGetValue(GameModifiers.ModifierType.InstaFail, out var value2);
value2?.SpecialUpdate(__instance);
}
}
}
public static void Remove(GameModifiers.ModifierType modifierType)
{
_gameModifierDict.Remove(modifierType);
}
public static void ClearAllModifiers()
{
_modifierTypesToRemove.AddRange(_gameModifierDict.Values.ToArray());
CollectionExtensions.Do<GameModifierBase>((IEnumerable<GameModifierBase>)_modifierTypesToRemove, (Action<GameModifierBase>)delegate(GameModifierBase mod)
{
mod.Remove();
});
_modifierTypesToRemove.Clear();
}
public static string GetModifiersString()
{
return (_gameModifierDict.Count > 0) ? GeneralExtensions.Join<GameModifierBase>((IEnumerable<GameModifierBase>)_gameModifierDict.Values, (Func<GameModifierBase, string>)((GameModifierBase mod) => mod.Name), ",") : "None";
}
public static void Add(GameModifiers.ModifierType modifierType)
{
if (_gameModifierDict.ContainsKey(modifierType))
{
Plugin.LogInfo($"Modifier of type {modifierType} is already in the modifier list.");
return;
}
switch (modifierType)
{
case GameModifiers.ModifierType.Hidden:
_gameModifierDict.Add(GameModifiers.ModifierType.Hidden, new GameModifiers.Hidden());
break;
case GameModifiers.ModifierType.Flashlight:
_gameModifierDict.Add(GameModifiers.ModifierType.Flashlight, new GameModifiers.Flashlight());
break;
case GameModifiers.ModifierType.Brutal:
_gameModifierDict.Add(GameModifiers.ModifierType.Brutal, new GameModifiers.Brutal());
break;
case GameModifiers.ModifierType.InstaFail:
_gameModifierDict.Add(GameModifiers.ModifierType.InstaFail, new GameModifiers.InstaFails());
break;
}
}
public static void LoadModifiersFromString(string replayModifierString)
{
_modifiersBackup = GetModifiersString();
ClearAllModifiers();
if (replayModifierString == null)
{
return;
}
string[] array = replayModifierString.Split(new char[1] { ',' });
if (array.Length == 0)
{
Plugin.LogInfo("No modifiers detected.");
return;
}
Plugin.LogInfo("Loading " + replayModifierString + " modifiers.");
string[] array2 = replayModifierString.Split(new char[1] { ',' });
foreach (string key in array2)
{
if (_stringModifierDict.ContainsKey(key))
{
Add(_stringModifierDict[key]);
}
}
}
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 static Queue<FullNoteComponents> _activeNotesComponents;
public static Color _headOutColor;
public static Color _headInColor;
public static Color _tailOutColor;
public static Color _tailInColor;
public static Color _bodyOutStartColor;
public static Color _bodyOutEndColor;
public static Color _bodyInStartColor;
public static Color _bodyInEndColor;
public static readonly float START_FADEOUT_POSX = 3.5f;
public static readonly float END_FADEOUT_POSX = -1.6f;
public static int _counter;
public override string Name => "HD";
public override ModifierType ModifierType => ModifierType.Hidden;
public override void Initialize(GameController __instance)
{
//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)
//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_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_008f: 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_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_00cd: 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_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_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_015f: Unknown result type (might be due to invalid IL or missing references)
_counter = 1;
_activeNotesComponents = new Queue<FullNoteComponents>();
GameObject val = __instance.allnotes.First();
_headOutColor = ((Graphic)((Component)val.transform.Find("StartPoint")).GetComponent<Image>()).color;
_headInColor = ((Graphic)((Component)val.transform.Find("StartPoint/StartPointColor")).GetComponent<Image>()).color;
_tailOutColor = ((Graphic)((Component)val.transform.Find("EndPoint")).GetComponent<Image>()).color;
_tailInColor = ((Graphic)((Component)val.transform.Find("EndPoint/EndPointColor")).GetComponent<Image>()).color;
_bodyOutStartColor = ((Component)val.transform.Find("OutlineLine")).GetComponent<LineRenderer>().startColor;
_bodyOutEndColor = ((Component)val.transform.Find("OutlineLine")).GetComponent<LineRenderer>().endColor;
_bodyInStartColor = ((Component)val.transform.Find("Line")).GetComponent<LineRenderer>().startColor;
_bodyInEndColor = ((Component)val.transform.Find("Line")).GetComponent<LineRenderer>().endColor;
foreach (GameObject item2 in from n in __instance.allnotes.Skip(1)
where n.transform.position.x <= START_FADEOUT_POSX * 2.7f
select n)
{
if (item2.transform.position.x <= START_FADEOUT_POSX * 2.7f)
{
FullNoteComponents item = new FullNoteComponents
{
startPoint = ((Component)item2.transform.Find("StartPoint")).GetComponent<Image>(),
startPointColor = ((Component)item2.transform.Find("StartPoint/StartPointColor")).GetComponent<Image>(),
endPoint = ((Component)item2.transform.Find("EndPoint")).GetComponent<Image>(),
endPointColor = ((Component)item2.transform.Find("EndPoint/EndPointColor")).GetComponent<Image>(),
outlineLine = ((Component)item2.transform.Find("OutlineLine")).GetComponent<LineRenderer>(),
line = ((Component)item2.transform.Find("Line")).GetComponent<LineRenderer>()
};
_activeNotesComponents.Enqueue(item);
}
}
}
public override void Update(GameController __instance)
{
//IL_004f: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: 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_0234: 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_024b: Unknown result type (might be due to invalid IL or missing references)
//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_0269: 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_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: 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_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: 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)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: 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_0344: 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 * 2.7f)
{
break;
}
FullNoteComponents item = new FullNoteComponents
{
startPoint = ((Component)currentNote.transform.GetChild(0)).GetComponent<Image>(),
startPointColor = ((Component)currentNote.transform.GetChild(0).GetChild(0)).GetComponent<Image>(),
endPoint = ((Component)currentNote.transform.GetChild(1)).GetComponent<Image>(),
endPointColor = ((Component)currentNote.transform.GetChild(1).GetChild(0)).GetComponent<Image>(),
outlineLine = ((Component)currentNote.transform.GetChild(2)).GetComponent<LineRenderer>(),
line = ((Component)currentNote.transform.GetChild(3)).GetComponent<LineRenderer>()
};
_counter++;
_activeNotesComponents.Enqueue(item);
}
}
for (int j = 0; j < _activeNotesComponents.Count; j++)
{
FullNoteComponents fullNoteComponents = _activeNotesComponents.ElementAt(j);
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;
public override string Name => "FL";
public override ModifierType ModifierType => ModifierType.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
};
}
public override void Update(GameController __instance)
{
//IL_00a3: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if (__instance.totalscore != 0)
{
_settings.intensity = 180f / Mathf.Min((float)__instance.defaultnotelength, 180f) + __instance.breathcounter;
if (__instance.notebuttonpressed && !__instance.outofbreath)
{
_color.r = (_color.g = (_color.b = 0f));
_color.a = 1f;
}
}
_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 string Name => "BT";
public override ModifierType ModifierType => ModifierType.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 InstaFails : GameModifierBase
{
public override string Name => "IF";
public override ModifierType ModifierType => ModifierType.InstaFail;
public override void Initialize(GameController __instance)
{
}
public override void Update(GameController __instance)
{
}
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 enum ModifierType
{
Hidden,
Flashlight,
Brutal,
InstaFail
}
}
[BepInPlugin("TootTallyGameModifiers", "TootTallyGameModifiers", "1.1.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin, ITootTallyModule
{
public static Plugin Instance;
private Harmony _harmony;
public ConfigEntry<bool> 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<bool>("Modules", "GameModifiers", true, "Enable GameModifiers");
TootTallyModuleManager.AddModule((ITootTallyModule)(object)this);
}
public void LoadModule()
{
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.1.6";
}
}