using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShortCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShortCompany")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9bc02e3a-7e92-4ade-8ba3-2a7d235d21b5")]
[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 ShortCompany;
[BepInPlugin("carthoris.ShortCompany", "ShortCompany", "1.0.0.0")]
public class ShortCompany : BaseUnityPlugin
{
public const string modGUID = "carthoris.ShortCompany";
public const string modName = "ShortCompany";
public const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("carthoris.ShortCompany");
private void Awake()
{
ManualLogSource val = Logger.CreateLogSource("carthoris.ShortCompany");
val.LogMessage((object)"carthoris.ShortCompany has loaded succesfully.");
harmony.PatchAll(typeof(ShortComp));
}
}
[HarmonyPatch(typeof(StartMatchLever))]
[HarmonyPatch("Update")]
public class ShortComp
{
[HarmonyPostfix]
public static void StartMatchLever_Update(StartMatchLever __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_00f0: 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)
ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "carthoris.ShortCompany.cfg"), true);
ConfigEntry<int> val2 = val.Bind<int>("General", "ShortProb", 33, "Probability of being short. 50 = 50%, 75 = 75%, etc.");
ConfigEntry<float> val3 = val.Bind<float>("General", "ShortHeight", 0.75f, "Percent of regular height when short. 0.75 = 75% of normal player height, 0.5 = 50%, etc. If set above 1, the model will become taller than usual. If 0 or below, it will probably break :/");
ConfigEntry<bool> val4 = val.Bind<bool>("General", "TotalScaling", true, "Whether height or overall scale is affected. If set to true, entire player model will be scaled, if false, only height will be changed.");
float num = ((!val4.Value) ? 1f : val3.Value);
if (!__instance.leverHasBeenPulled)
{
return;
}
GameObject[] source = GameObject.FindGameObjectsWithTag("Player");
int num2 = source.Count();
int i = 1;
GameObject val5 = GameObject.Find("Player");
int num3 = Random.Range(0, 100);
if ((num3 <= val2.Value) ? true : false)
{
val5.transform.localScale = new Vector3(num, val3.Value, num);
}
for (; i < num2; i++)
{
val5 = GameObject.Find("Player (" + i + ")");
num3 = Random.Range(0, 100);
if ((num3 <= val2.Value) ? true : false)
{
val5.transform.localScale = new Vector3(num, val3.Value, num);
}
}
}
}