using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Landfall.TABC;
using Landfall.TABS.AI.Systems;
using Unity.Jobs;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Tabs Poof Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tabs Poof Mod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8aad4f38-2ad4-4206-bf0b-7d28fb6d5c2e")]
[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 myfpsmodd;
[BepInPlugin("bayturtleking.morefps", "More FPS", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
modconfiggg.bindddd(((BaseUnityPlugin)this).Config);
new Harmony("bayturtleking.morefps").PatchAll();
}
}
internal static class modconfiggg
{
public static ConfigEntry<bool> feetgorayzzz;
public static ConfigEntry<bool> barsgobrrr;
public static ConfigEntry<bool> brainzzznap;
public static ConfigEntry<bool> musclebatchhh;
public static ConfigEntry<bool> eyesrestzzz;
public static ConfigEntry<bool> targetsnooze;
public static void bindddd(ConfigFile config)
{
feetgorayzzz = config.Bind<bool>("Performance", "Foot IK Throttle", true, "Far away units' feet update less often. Increases FPS in large battles.");
barsgobrrr = config.Bind<bool>("Performance", "Healthbar Throttle", true, "Far away healthbars update less often. Increases FPS in large battles.");
brainzzznap = config.Bind<bool>("Performance", "Pathfinding Throttle", true, "Units pathfind less often. Increases FPS in large battles but may make the AI worse.");
musclebatchhh = config.Bind<bool>("Performance", "Force Batching", true, "Forces limb and torque updates into one loop instead of individual calls. Increases FPS in large battles.");
eyesrestzzz = config.Bind<bool>("Performance", "Vision Check Throttle", true, "Units check line of sight to target less often. Increases FPS in large battles.");
targetsnooze = config.Bind<bool>("Performance", "Target Search Throttle", true, "Units attempt to search for new targets less often. Increases FPS in large battles but may make target switching slightly slower.");
}
}
internal static class cameraaaaaa
{
private static Camera itiscached;
private static int cachedcamframezzz = -1;
public static Camera getmaincammm()
{
if (Time.frameCount != cachedcamframezzz)
{
itiscached = Camera.main;
cachedcamframezzz = Time.frameCount;
}
return itiscached;
}
}
[HarmonyPatch(typeof(IkLeg), "DoRayCast")]
public static class throttleyourfeett
{
private sealed class excusecounter
{
public int lazyframe;
}
private const float closerangeeee = 15f;
private const float midrangeeee = 35f;
private const int midskipzzz = 1;
private const int farskipzzz = 3;
private static readonly ConditionalWeakTable<IkLeg, excusecounter> whosloggingthisss = new ConditionalWeakTable<IkLeg, excusecounter>();
private static bool Prefix(IkLeg __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.feetgorayzzz.Value)
{
return true;
}
Camera val = cameraaaaaa.getmaincammm();
if ((Object)(object)val == (Object)null)
{
return true;
}
float num = Vector3.Distance(((Component)val).transform.position, ((Component)__instance).transform.position);
int num2 = 0;
if (num > 35f)
{
num2 = 3;
}
else if (num > 15f)
{
num2 = 1;
}
if (num2 == 0)
{
return true;
}
excusecounter orCreateValue = whosloggingthisss.GetOrCreateValue(__instance);
orCreateValue.lazyframe++;
if (orCreateValue.lazyframe <= num2)
{
return false;
}
orCreateValue.lazyframe = 0;
return true;
}
}
[HarmonyPatch(typeof(TABCUnitUI), "LateUpdate")]
public static class healthbarrrelax
{
private sealed class excusecounter
{
public int lazyframe;
}
private const float closerangeeee = 20f;
private const float midrangeeee = 50f;
private const int midskipzzz = 1;
private const int farskipzzz = 4;
private static readonly ConditionalWeakTable<TABCUnitUI, excusecounter> whosloggingthisss = new ConditionalWeakTable<TABCUnitUI, excusecounter>();
private static bool Prefix(TABCUnitUI __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.barsgobrrr.Value)
{
return true;
}
Camera val = cameraaaaaa.getmaincammm();
if ((Object)(object)val == (Object)null)
{
return true;
}
float num = Vector3.Distance(((Component)val).transform.position, ((Component)__instance).transform.position);
int num2 = 0;
if (num > 50f)
{
num2 = 4;
}
else if (num > 20f)
{
num2 = 1;
}
if (num2 == 0)
{
return true;
}
excusecounter orCreateValue = whosloggingthisss.GetOrCreateValue(__instance);
orCreateValue.lazyframe++;
if (orCreateValue.lazyframe <= num2)
{
return false;
}
orCreateValue.lazyframe = 0;
return true;
}
}
[HarmonyPatch(typeof(CalculateNavPathSystem), "OnUpdate")]
public static class pathpathpath
{
private const int skipeveryyyy = 1;
private static int ticktockzzz;
private static bool Prefix()
{
if (!modconfiggg.brainzzznap.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 1)
{
return false;
}
ticktockzzz = 0;
return true;
}
}
[HarmonyPatch(typeof(CanSeeSystem), "OnUpdate", new Type[] { typeof(JobHandle) })]
public static class chillonthevision
{
private const int skipeveryyyy = 1;
private static int ticktockzzz;
private static bool Prefix(ref JobHandle __result, JobHandle inputDeps)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.eyesrestzzz.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 1)
{
__result = inputDeps;
return false;
}
ticktockzzz = 0;
return true;
}
}
[HarmonyPatch(typeof(FindEnemyTargetSystem), "OnUpdate", new Type[] { typeof(JobHandle) })]
public static class enemysnoozeee
{
private const int skipeveryyyy = 2;
private static int ticktockzzz;
private static bool Prefix(ref JobHandle __result, JobHandle inputDeps)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.targetsnooze.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 2)
{
__result = inputDeps;
return false;
}
ticktockzzz = 0;
return true;
}
}
[HarmonyPatch(typeof(FindFriendlyTargetSystem), "OnUpdate", new Type[] { typeof(JobHandle) })]
public static class friendsnoozeee
{
private const int skipeveryyyy = 2;
private static int ticktockzzz;
private static bool Prefix(ref JobHandle __result, JobHandle inputDeps)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.targetsnooze.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 2)
{
__result = inputDeps;
return false;
}
ticktockzzz = 0;
return true;
}
}
[HarmonyPatch(typeof(FindNearestFriendTargetSystem), "OnUpdate", new Type[] { typeof(JobHandle) })]
public static class nearestfriendsnoozeee
{
private const int skipeveryyyy = 2;
private static int ticktockzzz;
private static bool Prefix(ref JobHandle __result, JobHandle inputDeps)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.targetsnooze.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 2)
{
__result = inputDeps;
return false;
}
ticktockzzz = 0;
return true;
}
}
[HarmonyPatch(typeof(FindFriendlyHighestPriceTargetSystem), "OnUpdate", new Type[] { typeof(JobHandle) })]
public static class highestpricesnoozeee
{
private const int skipeveryyyy = 2;
private static int ticktockzzz;
private static bool Prefix(ref JobHandle __result, JobHandle inputDeps)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (!modconfiggg.targetsnooze.Value)
{
return true;
}
ticktockzzz++;
if (ticktockzzz <= 2)
{
__result = inputDeps;
return false;
}
ticktockzzz = 0;
return true;
}
}
internal sealed class animberunnin : MonoBehaviour
{
public static animberunnin onlyoneee;
private void FixedUpdate()
{
animationbatchh.runbatch();
}
}
internal static class animationbatchh
{
private static readonly List<AnimationForce> listofforce = new List<AnimationForce>();
private static readonly List<AnimationTorque> listoftorque = new List<AnimationTorque>();
private static readonly Action<AnimationForce> callforceup = AccessTools.MethodDelegate<Action<AnimationForce>>(AccessTools.Method(typeof(AnimationForce), "FixedUpdate", (Type[])null, (Type[])null), (object)null, true);
private static readonly Action<AnimationTorque> calltorquedog = AccessTools.MethodDelegate<Action<AnimationTorque>>(AccessTools.Method(typeof(AnimationTorque), "FixedUpdate", (Type[])null, (Type[])null), (object)null, true);
public static void betterrun()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
if (!((Object)(object)animberunnin.onlyoneee != (Object)null))
{
GameObject val = new GameObject("animberunnin");
Object.DontDestroyOnLoad((Object)val);
animberunnin.onlyoneee = val.AddComponent<animberunnin>();
}
}
public static void forcer(AnimationForce whoisit)
{
betterrun();
listofforce.Add(whoisit);
}
public static void torquer(AnimationTorque whoisit)
{
betterrun();
listoftorque.Add(whoisit);
}
public static void runbatch()
{
if (!modconfiggg.musclebatchhh.Value)
{
return;
}
for (int num = listofforce.Count - 1; num >= 0; num--)
{
if ((Object)(object)listofforce[num] == (Object)null)
{
listofforce.RemoveAt(num);
}
else
{
callforceup(listofforce[num]);
}
}
for (int num2 = listoftorque.Count - 1; num2 >= 0; num2--)
{
if ((Object)(object)listoftorque[num2] == (Object)null)
{
listoftorque.RemoveAt(num2);
}
else
{
calltorquedog(listoftorque[num2]);
}
}
}
}
[HarmonyPatch(typeof(AnimationForce), "Start")]
internal static class forcething
{
private static void Postfix(AnimationForce __instance)
{
animationbatchh.forcer(__instance);
}
}
[HarmonyPatch(typeof(AnimationForce), "FixedUpdate")]
internal static class skipitt
{
private static bool Prefix()
{
return !modconfiggg.musclebatchhh.Value;
}
}
[HarmonyPatch(typeof(AnimationTorque), "Start")]
internal static class torquestuff
{
private static void Postfix(AnimationTorque __instance)
{
animationbatchh.torquer(__instance);
}
}
[HarmonyPatch(typeof(AnimationTorque), "FixedUpdate")]
internal static class dontdotorquestuff
{
private static bool Prefix()
{
return !modconfiggg.musclebatchhh.Value;
}
}