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.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Park_dingdong;
using RumbleModUI;
using RumbleModdingAPI;
using RumbleSoundsOnSceneChange;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class1), "Park_dingdong", "1.0.0", "Rabbit", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 49, 36, 1)]
[assembly: MelonAuthorColor(255, 49, 36, 1)]
[assembly: AssemblyTitle("Park_dingdong")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Park_dingdong")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8a963fb7-1e48-40b8-8a0c-a3a7d95dafd3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Park_dingdong;
public static class BuildInfo
{
public const string ModName = "QOL_improvements";
public const string ModVersion = "1.0.10";
public const string Description = "Quality of life improvements";
public const string Author = "Hasenparty";
public const string Company = "";
}
public class Validation : ValidationParameters
{
private int Length;
public Validation(int i)
{
Length = i;
}
public override bool DoValidation(string Input)
{
if (Input.Length == Length)
{
return true;
}
return false;
}
}
public class Class1 : MelonMod
{
public static string scenename;
private Mod Mod = new Mod();
private ModSetting<bool> Sound;
private ModSetting<bool> Name_tag;
public static List<Player> Players;
public static int newint = 1;
public static int oldint = 1;
public int health = 0;
public int prevhealth = 0;
public Stopwatch stopwatch = new Stopwatch();
public Stopwatch timer = new Stopwatch();
public static List<float> distance = new List<float>();
public static bool running = false;
public static Vector3 local_player_pos;
public static Vector3 opponent_player_pos;
public static float all;
public override void OnLateInitializeMelon()
{
UI.instance.UI_Initialized += OnUIInit;
}
public static List<float> ReadFile(string filePath)
{
List<float> list = new List<float>();
try
{
string[] source = File.ReadAllLines(filePath);
return source.Where((string line) => !string.IsNullOrWhiteSpace(line)).Select(delegate(string line)
{
if (!float.TryParse(line, out var result))
{
throw new FormatException("Unable to parse '" + line + "' as a Float.");
}
return result;
}).ToList();
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
MelonLogger.Msg("Please talk to the Developer. Something went wrong!");
return new List<float>();
}
}
public static float ReadAverage(string filePath)
{
List<float> list = ReadFile(filePath);
if (list.Count != 0)
{
all = 0f;
foreach (float item in list)
{
all += item;
}
all /= list.Count;
MelonLogger.Msg((object)all);
return all;
}
return 0f;
}
public void OnUIInit()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
Mod.ModName = "QOL_improvements";
Mod.ModVersion = "1.0.10";
Mod.SetFolder("QOL");
Mod.AddDescription("Description", "", "Quality of life improvements", new Tags
{
IsSummary = true
});
Sound = Mod.AddToList("Sound", true, 1, "Ring if player joins park and also give output if player leaves.", new Tags());
Name_tag = Mod.AddToList("Name Tag", true, 2, "Shows the nametag of the opponent in matches if the player got hit.", new Tags());
Mod.GetFromFile();
UI.instance.AddMod(Mod);
MelonLogger.Msg("Added Mod");
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
scenename = sceneName;
running = false;
stopwatch.Start();
ReadAverage("UserData\\QOL\\space.txt");
}
public override void OnFixedUpdate()
{
try
{
if (scenename == null || !Calls.IsInitialized() || !Calls.IsMapInitialized())
{
return;
}
if (scenename != "Loader" && scenename != "Gym" && scenename != "Park")
{
bool flag = false;
if (Players.GetEnemyPlayers().Count != 0 && (bool)((ModSetting)Name_tag).Value)
{
health = Players.GetEnemyPlayers()[0].Data.HealthPoints;
if (health != prevhealth)
{
stopwatch.Reset();
stopwatch.Start();
((Component)((Component)Players.GetEnemyPlayers()[0].Controller).gameObject.transform.GetChild(8)).GetComponent<PlayerNameTag>().FadePlayerNameTagOut(true);
}
if (stopwatch.Elapsed.TotalSeconds >= 2.0)
{
stopwatch.Stop();
stopwatch.Reset();
((Component)((Component)Players.GetEnemyPlayers()[0].Controller).gameObject.transform.GetChild(8)).GetComponent<PlayerNameTag>().FadePlayerNameTagOut(false);
}
prevhealth = health;
}
}
if (scenename == "Park" && Players.GetEnemyPlayers().Count != 0 && (bool)((ModSetting)Sound).Value)
{
Players = Managers.GetPlayerManager().AllPlayers;
newint = Players.Count;
if (newint > oldint)
{
AdditionalSounds.PlaySoundIfFileExists("\\QOL\\bell.mp3", 1);
oldint = newint;
}
if (newint < oldint)
{
AdditionalSounds.PlaySoundIfFileExists("\\QOL\\end.mp3", 1);
oldint = newint;
}
oldint = newint;
}
}
catch (Exception)
{
}
}
}