using System;
using System.Collections;
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 DM;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using UnityEngine;
using UnityEngine.Events;
[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 TraversalJump;
public enum iliketomoveitkind
{
launch,
pull,
freeze
}
public class abilitydef
{
public string name;
public int localid;
public iliketomoveitkind kind;
public float howmuchforward;
public float howmuchup;
public float howlongfreeze;
public float cooldown;
public float range;
}
public class thegenerics : Move
{
public iliketomoveitkind kind;
public float howmuchforward = 25f;
public float howmuchup = 12f;
public float howlongfreeze = 2f;
public float range = 8f;
public float cooldown = 3f;
private float nextfiretimee;
private DataHandler dadada;
private void Awake()
{
dadada = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
}
public override void DoMove(Rigidbody weapondeenemy, Rigidbody torsoofenemy, DataHandler dataofenemy)
{
if ((Object)(object)dadada == (Object)null)
{
dadada = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
}
if ((Object)(object)dadada == (Object)null || (Object)(object)dadada.torso == (Object)null)
{
return;
}
Rigidbody component = ((Component)dadada.torso).GetComponent<Rigidbody>();
if (!((Object)(object)component == (Object)null))
{
if (kind == iliketomoveitkind.launch)
{
launchh(component, torsoofenemy);
}
else if (kind == iliketomoveitkind.pull)
{
dopull(component, torsoofenemy);
}
else if (kind == iliketomoveitkind.freeze)
{
((MonoBehaviour)this).StartCoroutine(dofreeze(component));
}
}
}
public void TriggerFromEvent()
{
if (Time.time < nextfiretimee)
{
return;
}
Rigidbody val = null;
if (kind == iliketomoveitkind.launch || kind == iliketomoveitkind.pull)
{
val = nearestotorso(range);
if ((Object)(object)val == (Object)null)
{
return;
}
}
nextfiretimee = Time.time + cooldown;
((Move)this).DoMove((Rigidbody)null, val, (DataHandler)null);
}
private Rigidbody nearestotorso(float searchradius)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)dadada == (Object)null || (Object)(object)dadada.torso == (Object)null)
{
return null;
}
Vector3 position = dadada.torso.position;
Collider[] array = Physics.OverlapSphere(position, searchradius);
Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
Rigidbody result = null;
float num = float.MaxValue;
Collider[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
Unit componentInParent = ((Component)array2[i]).GetComponentInParent<Unit>();
if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)component)
{
continue;
}
DataHandler componentInChildren = ((Component)componentInParent).GetComponentInChildren<DataHandler>();
if (!((Object)(object)componentInChildren == (Object)null) && !((Object)(object)componentInChildren.torso == (Object)null))
{
float num2 = Vector3.Distance(position, componentInChildren.torso.position);
if (num2 < num)
{
num = num2;
result = ((Component)componentInChildren.torso).GetComponent<Rigidbody>();
}
}
}
return result;
}
private void launchh(Rigidbody elrig, Rigidbody torsoofenemy)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_0028: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = (((Object)(object)torsoofenemy != (Object)null) ? torsoofenemy.position : (elrig.position + ((Component)elrig).transform.forward)) - elrig.position;
val.y = 0f;
if (((Vector3)(ref val)).sqrMagnitude > 0.001f)
{
((Component)elrig).transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized);
}
Vector3 wantvel = ((Component)elrig).transform.forward * howmuchforward + Vector3.up * howmuchup;
((MonoBehaviour)this).StartCoroutine(velstay(elrig, wantvel, 0.2f));
}
private IEnumerator velstay(Rigidbody therig, Vector3 wantvel, float duration)
{
//IL_000e: 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)
for (float elapsed = 0f; elapsed < duration; elapsed += Time.fixedDeltaTime)
{
if ((Object)(object)therig == (Object)null)
{
break;
}
therig.velocity = wantvel;
yield return (object)new WaitForFixedUpdate();
}
}
private void dopull(Rigidbody elrig, Rigidbody torsoofenemy)
{
if (!((Object)(object)torsoofenemy == (Object)null))
{
((MonoBehaviour)this).StartCoroutine(pulltowardsgood(torsoofenemy, elrig, howmuchforward, 0.5f, 1.5f));
}
}
private IEnumerator pulltowardsgood(Rigidbody target, Rigidbody anchor, float speed, float duration, float stopdist)
{
for (float elapsed = 0f; elapsed < duration; elapsed += Time.fixedDeltaTime)
{
if ((Object)(object)target == (Object)null)
{
break;
}
if ((Object)(object)anchor == (Object)null)
{
break;
}
Vector3 val = anchor.position - target.position;
if (((Vector3)(ref val)).magnitude <= stopdist)
{
target.velocity = Vector3.zero;
break;
}
target.velocity = ((Vector3)(ref val)).normalized * speed;
yield return (object)new WaitForFixedUpdate();
}
}
private IEnumerator dofreeze(Rigidbody elrig)
{
float startdrag = elrig.drag;
float startangular = elrig.angularDrag;
bool waskinematic = elrig.isKinematic;
elrig.velocity = Vector3.zero;
elrig.angularVelocity = Vector3.zero;
elrig.drag = 50f;
elrig.angularDrag = 50f;
elrig.isKinematic = true;
yield return (object)new WaitForSeconds(howlongfreeze);
if ((Object)(object)elrig != (Object)null)
{
elrig.isKinematic = waskinematic;
elrig.drag = startdrag;
elrig.angularDrag = startangular;
}
}
}
public class onlyifequip : MonoBehaviour
{
private void Awake()
{
Recheck();
}
private void OnEnable()
{
Recheck();
}
private void Recheck()
{
bool enabled = (Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>() != (Object)null;
thegenerics component = ((Component)this).GetComponent<thegenerics>();
ConditionalEvent component2 = ((Component)this).GetComponent<ConditionalEvent>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = enabled;
}
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = enabled;
}
}
}
[BepInPlugin("bayturtleking.traversaljump", "Mobility Abilities", "1.0.2")]
public class thejumpmod : BaseUnityPlugin
{
private List<abilitydef> abilitydefs = new List<abilitydef>
{
new abilitydef
{
name = "Long Jump",
localid = 738201455,
kind = iliketomoveitkind.launch,
howmuchforward = 60f,
howmuchup = 30f,
cooldown = 3f,
range = 6f
},
new abilitydef
{
name = "Small Dash",
localid = 738201456,
kind = iliketomoveitkind.launch,
howmuchforward = 40f,
howmuchup = 5f,
cooldown = 2f,
range = 5f
},
new abilitydef
{
name = "Backstep",
localid = 738201457,
kind = iliketomoveitkind.launch,
howmuchforward = -40f,
howmuchup = 8f,
cooldown = 3f,
range = 5f
},
new abilitydef
{
name = "Updraft",
localid = 738201458,
kind = iliketomoveitkind.launch,
howmuchforward = 0f,
howmuchup = 45f,
cooldown = 4f,
range = 4f
},
new abilitydef
{
name = "Grapple Pull",
localid = 738201459,
kind = iliketomoveitkind.pull,
howmuchforward = 40f,
cooldown = 4f,
range = 8f
},
new abilitydef
{
name = "Shove!!!!",
localid = 738201460,
kind = iliketomoveitkind.pull,
howmuchforward = -40f,
cooldown = 3f,
range = 3f
},
new abilitydef
{
name = "Anchor",
localid = 738201461,
kind = iliketomoveitkind.freeze,
howlongfreeze = 2f,
cooldown = 6f,
range = 3f
}
};
private void Awake()
{
((MonoBehaviour)this).StartCoroutine(registerwhenready());
}
private IEnumerator registerwhenready()
{
while (ContentDatabase.Instance() == null)
{
yield return null;
}
foreach (abilitydef abilitydef in abilitydefs)
{
addability(abilitydef);
}
}
private void addability(abilitydef def)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0028: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Expected O, but got Unknown
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(def.name);
val.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)val);
((Object)val).hideFlags = (HideFlags)61;
SpecialAbility obj = val.AddComponent<SpecialAbility>();
DatabaseEntity val2 = new DatabaseEntity((WorkshopContentType)5)
{
GUID = new DatabaseID(738201400, def.localid),
Name = def.name
};
doprivstuff(obj, "m_entity", val2);
thegenerics thegenerics2 = val.AddComponent<thegenerics>();
thegenerics2.kind = def.kind;
thegenerics2.howmuchforward = def.howmuchforward;
thegenerics2.howmuchup = def.howmuchup;
thegenerics2.howlongfreeze = def.howlongfreeze;
thegenerics2.range = def.range;
thegenerics2.cooldown = def.cooldown;
((Behaviour)thegenerics2).enabled = false;
ConditionalEvent val3 = val.AddComponent<ConditionalEvent>();
((Behaviour)val3).enabled = false;
ConditionalEventInstance val4 = new ConditionalEventInstance();
val4.delay = 0f;
val4.turnOnEvent = new UnityEvent();
val4.turnOffEvent = new UnityEvent();
val4.continuousEvent = new UnityEvent();
val4.conditions = (EventCondition[])(object)new EventCondition[2]
{
new EventCondition
{
conditionType = (ConditionType)0,
startOnCD = true,
alwaysResetCounter = true,
value = def.cooldown,
counter = def.cooldown
},
new EventCondition
{
conditionType = (ConditionType)1,
whichRange = (WhichRange)0,
valueType = (ValueType)1,
value = def.range,
startOnCD = true
}
};
ConditionalEventInstance val5 = val4;
val5.turnOnEvent.AddListener(new UnityAction(thegenerics2.TriggerFromEvent));
val3.events = (ConditionalEventInstance[])(object)new ConditionalEventInstance[1] { val5 };
val.AddComponent<onlyifequip>();
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
Dictionary<DatabaseID, Object> dictionary = getprivatefield<Dictionary<DatabaseID, Object>>(ContentDatabase.Instance().AssetLoader, "m_nonStreamableAssets");
Dictionary<DatabaseID, GameObject> dictionary2 = getprivatefield<Dictionary<DatabaseID, GameObject>>(landfallContentDatabase, "m_combatMoves");
dictionary[val2.GUID] = (Object)(object)val;
dictionary2[val2.GUID] = val;
val.SetActive(true);
((BaseUnityPlugin)this).Logger.LogInfo((object)(def.name + " is now an ability cuz of turtle's abilities mod"));
}
private static void doprivstuff(object obj, string fieldname, object value)
{
getanyfieldd(obj.GetType(), fieldname)?.SetValue(obj, value);
}
private static T getprivatefield<T>(object obj, string fieldname)
{
FieldInfo fieldInfo = getanyfieldd(obj.GetType(), fieldname);
if (!(fieldInfo != null))
{
return default(T);
}
return (T)fieldInfo.GetValue(obj);
}
private static FieldInfo getanyfieldd(Type t, string fieldname)
{
while (t != null)
{
FieldInfo field = t.GetField(fieldname, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
return field;
}
t = t.BaseType;
}
return null;
}
}