using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Combat;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.Warehouse;
using LabFusion.Data;
using LabFusion.Entities;
using LabFusion.Marrow.Extenders;
using LabFusion.Marrow.Pool;
using LabFusion.Network;
using LabFusion.Network.Serialization;
using LabFusion.Player;
using LabFusion.RPC;
using LabFusion.SDK.Gamemodes;
using LabFusion.SDK.Modules;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using SukunaKit;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(SukunaKitMod), "Cursed Techniques", "1.0.0", "Logan", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonOptionalDependencies(new string[] { "LabFusion" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SukunaKit")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SukunaKit")]
[assembly: AssemblyTitle("SukunaKit")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 SukunaKit
{
public static class Combat
{
public const float Lethal = 10000f;
public static bool KillNpcs = true;
public static bool HurtPlayers = true;
public static bool GodModeKills = true;
public static Instance Log;
private static bool _warnedFriendlyFire;
private static readonly List<(PuppetMaster pm, AIBrain brain, float until)> _pendingKills = new List<(PuppetMaster, AIBrain, float)>();
private static readonly List<(GameObject go, ushort id, float at)> _effects = new List<(GameObject, ushort, float)>();
private static readonly List<(float at, Action act)> _scheduled = new List<(float, Action)>();
private static TriggerRefProxy _proxy;
private static IntPtr _proxyRig;
public static string Hit(string move, Func<Vector3, bool> inside, Func<Vector3, Vector3> push, float throwSpeed, float damage = 10000f)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
int num2 = 0;
int num3 = 0;
_ = Player.RigManager;
if (KillNpcs)
{
foreach (AIBrain item2 in Object.FindObjectsOfType<AIBrain>())
{
if (Alive(item2))
{
Vector3 arg = BodyCenter(item2);
if (inside(arg))
{
KillNpc(item2);
num++;
}
}
}
}
if (Net.InLobby && HurtPlayers && !_warnedFriendlyFire && !Net.PlayersCanBeHurt())
{
_warnedFriendlyFire = true;
Instance log = Log;
if (log != null)
{
log.Warning("This lobby has Friendly Fire OFF, so Fusion won't let anyone damage players (guns included). The host can turn it on in the lobby settings.");
}
}
if (Net.InLobby && (HurtPlayers || GodModeKills))
{
foreach (var item3 in Net.OtherPlayers())
{
byte item = item3.id;
PlayerDamageReceiver best;
Vector3? val = Chest(item3.rig, out best);
if (val.HasValue && inside(val.Value))
{
if (HurtPlayers && (Object)(object)best != (Object)null)
{
DamagePlayer(best, damage, val.Value, push(val.Value));
}
if (GodModeKills && damage >= 10000f)
{
Net.SendGodModeKill(item, move);
}
num2++;
}
}
}
if (throwSpeed > 0f)
{
HashSet<int> hashSet = new HashSet<int>();
foreach (Rigidbody item4 in Object.FindObjectsOfType<Rigidbody>())
{
if (!((Object)(object)item4 == (Object)null) && !item4.isKinematic && hashSet.Add(((Object)item4).GetInstanceID()))
{
Vector3 worldCenterOfMass = item4.worldCenterOfMass;
if (inside(worldCenterOfMass) && !((Object)(object)((Component)item4).GetComponentInParent<RigManager>() != (Object)null))
{
Vector3 val2 = push(worldCenterOfMass);
item4.AddForce(((Vector3)(ref val2)).normalized * throwSpeed, (ForceMode)2);
num3++;
}
}
}
}
return $"{move}: {num} NPC(s), {num2} player(s), {num3} object(s)";
}
private static Vector3? Chest(RigManager rig, out PlayerDamageReceiver best)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
best = null;
if ((Object)(object)rig == (Object)null)
{
return null;
}
PlayerDamageReceiver val = null;
foreach (PlayerDamageReceiver componentsInChild in ((Component)rig).GetComponentsInChildren<PlayerDamageReceiver>())
{
if (!((Object)(object)componentsInChild == (Object)null))
{
if (val == null)
{
val = componentsInChild;
}
string text = ((object)componentsInChild.bodyPart/*cast due to .constrained prefix*/).ToString();
if (text.Contains("Chest") || text.Contains("Spine"))
{
best = componentsInChild;
break;
}
}
}
if (best == null)
{
best = val;
}
if ((Object)(object)best != (Object)null)
{
return ((Component)best).transform.position;
}
return ((Component)rig).transform.position + Vector3.up * 1.2f;
}
private static void DamagePlayer(PlayerDamageReceiver receiver, float damage, Vector3 at, Vector3 dir)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0016: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
try
{
Attack val = new Attack();
val.damage = damage;
val.attackType = (AttackType)16;
val.origin = at;
val.direction = ((((Vector3)(ref dir)).sqrMagnitude > 0f) ? ((Vector3)(ref dir)).normalized : Vector3.forward);
val.normal = -val.direction;
val.collider = ((Component)receiver).GetComponent<Collider>();
val.proxy = MyProxy();
if ((Object)(object)val.proxy == (Object)null)
{
Instance log = Log;
if (log != null)
{
log.Warning("Couldn't find your rig's attack proxy; Fusion will ignore the hit.");
}
}
receiver.ReceiveAttack(val);
}
catch (Exception ex)
{
Instance log2 = Log;
if (log2 != null)
{
log2.Warning("Player hit failed: " + ex.Message);
}
}
}
private static TriggerRefProxy MyProxy()
{
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager == (Object)null)
{
return null;
}
if ((Object)(object)_proxy != (Object)null && _proxyRig == ((Il2CppObjectBase)rigManager).Pointer)
{
return _proxy;
}
_proxy = null;
_proxyRig = ((Il2CppObjectBase)rigManager).Pointer;
TriggerRefProxy val = null;
foreach (TriggerRefProxy componentsInChild in ((Component)rigManager).GetComponentsInChildren<TriggerRefProxy>(true))
{
if (!((Object)(object)componentsInChild == (Object)null) && !((Object)(object)componentsInChild.root == (Object)null))
{
if (val == null)
{
val = componentsInChild;
}
if (((Il2CppObjectBase)componentsInChild.root).Pointer == ((Il2CppObjectBase)((Component)rigManager).gameObject).Pointer)
{
_proxy = componentsInChild;
break;
}
}
}
if (_proxy == null)
{
_proxy = val;
}
return _proxy;
}
private static bool Alive(AIBrain b)
{
if ((Object)(object)b != (Object)null && ((Component)b).gameObject.activeInHierarchy && !b.isDead && (Object)(object)b.puppetMaster != (Object)null)
{
return !b.puppetMaster.isDead;
}
return false;
}
private static Vector3 BodyCenter(AIBrain brain)
{
//IL_001d: 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)
Rigidbody componentInChildren = ((Component)brain).GetComponentInChildren<Rigidbody>();
if (!((Object)(object)componentInChildren != (Object)null))
{
return ((Component)brain).transform.position;
}
return componentInChildren.worldCenterOfMass;
}
public static bool IsNpc(Collider col, out AIBrain brain)
{
brain = (((Object)(object)col == (Object)null) ? null : ((Component)col).GetComponentInParent<AIBrain>());
if ((Object)(object)brain != (Object)null)
{
return Alive(brain);
}
return false;
}
public static void KillNpc(AIBrain brain)
{
PuppetMaster puppetMaster = brain.puppetMaster;
if (!((Object)(object)puppetMaster == (Object)null))
{
if (Net.InLobby && Net.NpcOwnership(puppetMaster, out var isOwner) && !isOwner)
{
Net.TakeNpcOwnership(puppetMaster);
_pendingKills.Add((puppetMaster, brain, Time.realtimeSinceStartup + 3f));
}
else
{
KillNpcNow(puppetMaster, brain);
}
}
}
private static void KillNpcNow(PuppetMaster pm, AIBrain brain)
{
if ((Object)(object)pm == (Object)null || pm.isDead)
{
return;
}
try
{
if (brain != null)
{
BehaviourBaseNav behaviour = brain.behaviour;
if (behaviour != null)
{
SubBehaviourHealth health = behaviour.health;
if (health != null)
{
health.Kill();
}
}
}
}
catch
{
}
if (!pm.isDead)
{
pm.Kill();
}
}
public static void SpawnEffect(string barcode, Vector3 pos, Quaternion rot, float lifetime)
{
//IL_0015: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (Net.InLobby)
{
try
{
Net.Spawn(barcode, pos, rot, delegate(GameObject go, ushort id)
{
_effects.Add((go, id, Time.unscaledTime + lifetime));
});
return;
}
catch (Exception ex)
{
Instance log = Log;
if (log != null)
{
log.Warning($"Fusion couldn't spawn {barcode} ({ex.Message}); showing it only to you.");
}
}
}
try
{
HelperMethods.SpawnCrate(barcode, pos, rot, Vector3.one, true, (Action<GameObject>)delegate(GameObject go)
{
if ((Object)(object)go != (Object)null)
{
_effects.Add((go, 0, Time.unscaledTime + lifetime));
}
}, (Action<GameObject>)null);
}
catch (Exception ex2)
{
Instance log2 = Log;
if (log2 != null)
{
log2.Warning("Couldn't spawn " + barcode + ": " + ex2.Message);
}
}
}
public static void After(float seconds, Action act)
{
_scheduled.Add((Time.unscaledTime + seconds, act));
}
public static bool IsMine(Collider col)
{
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager != (Object)null && (Object)(object)col != (Object)null)
{
return ((Component)col).transform.IsChildOf(((Component)rigManager).transform);
}
return false;
}
public static RaycastHit? Raycast(Vector3 from, Vector3 dir, float max)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
RaycastHit? result = null;
foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(from, dir, max, -1, (QueryTriggerInteraction)1))
{
RaycastHit current = item;
if (IsMine(((RaycastHit)(ref current)).collider))
{
continue;
}
if (result.HasValue)
{
float distance = ((RaycastHit)(ref current)).distance;
RaycastHit value = result.Value;
if (!(distance < ((RaycastHit)(ref value)).distance))
{
continue;
}
}
result = current;
}
return result;
}
public static Vector3? GroundBelow(Vector3 from, float maxDown)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
RaycastHit? val = Raycast(from, Vector3.down, maxDown);
if (!val.HasValue)
{
return null;
}
RaycastHit valueOrDefault = val.GetValueOrDefault();
return ((RaycastHit)(ref valueOrDefault)).point;
}
public static float SegmentDistance(Vector3 p, Vector3 a, Vector3 b, out float along)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_000b: 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_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = b - a;
along = Mathf.Clamp01(Vector3.Dot(p - a, val) / Mathf.Max(((Vector3)(ref val)).sqrMagnitude, 1E-06f));
return Vector3.Distance(p, a + val * along);
}
public static void Update()
{
float unscaledTime = Time.unscaledTime;
for (int num = _scheduled.Count - 1; num >= 0; num--)
{
if (!(unscaledTime < _scheduled[num].at))
{
Action item = _scheduled[num].act;
_scheduled.RemoveAt(num);
try
{
item();
}
catch (Exception ex)
{
Instance log = Log;
if (log != null)
{
log.Warning("Move failed: " + ex.Message);
}
}
}
}
float realtimeSinceStartup = Time.realtimeSinceStartup;
bool isOwner = default(bool);
for (int num2 = _pendingKills.Count - 1; num2 >= 0; num2--)
{
var (val, brain, num3) = _pendingKills[num2];
int num4;
int num5;
if (!((Object)(object)val == (Object)null))
{
num4 = (val.isDead ? 1 : 0);
if (num4 == 0)
{
num5 = ((!Net.InLobby || !Net.NpcOwnership(val, out isOwner) || isOwner) ? 1 : 0);
goto IL_00e8;
}
}
else
{
num4 = 1;
}
num5 = 0;
goto IL_00e8;
IL_00e8:
bool flag = (byte)num5 != 0;
if (flag)
{
KillNpcNow(val, brain);
}
if (((uint)num4 | (flag ? 1u : 0u)) != 0 || realtimeSinceStartup > num3)
{
_pendingKills.RemoveAt(num2);
}
}
for (int num6 = _effects.Count - 1; num6 >= 0; num6--)
{
var (val2, num7, num8) = _effects[num6];
if (!(unscaledTime < num8))
{
_effects.RemoveAt(num6);
try
{
if (num7 != 0 && Net.InLobby)
{
Net.Despawn(num7);
}
else if ((Object)(object)val2 != (Object)null && val2.activeInHierarchy)
{
Poolee component = val2.GetComponent<Poolee>();
if ((Object)(object)component != (Object)null)
{
component.Despawn();
}
else
{
Object.Destroy((Object)(object)val2);
}
}
}
catch
{
}
}
}
}
public static void OnLevelChanged()
{
_pendingKills.Clear();
_effects.Clear();
_scheduled.Clear();
}
}
public enum Btn
{
None,
RightTrigger,
RightGrip,
A,
B,
RightStickClick,
LeftTrigger,
LeftGrip,
X,
Y,
LeftStickClick
}
public static class Controls
{
private static readonly Dictionary<Btn, bool> _prev = new Dictionary<Btn, bool>();
private static readonly Dictionary<Btn, bool> _now = new Dictionary<Btn, bool>();
private static bool Read(Btn b)
{
BaseController leftController = Player.LeftController;
BaseController rightController = Player.RightController;
try
{
return b switch
{
Btn.RightTrigger => (Object)(object)rightController != (Object)null && rightController.GetPrimaryInteractionButtonAxis() > 0.75f,
Btn.RightGrip => (Object)(object)rightController != (Object)null && rightController.GetGripForce() > 0.75f,
Btn.A => (Object)(object)rightController != (Object)null && rightController.GetAButton(),
Btn.B => (Object)(object)rightController != (Object)null && rightController.GetBButton(),
Btn.RightStickClick => (Object)(object)rightController != (Object)null && rightController.GetThumbStick(),
Btn.LeftTrigger => (Object)(object)leftController != (Object)null && leftController.GetPrimaryInteractionButtonAxis() > 0.75f,
Btn.LeftGrip => (Object)(object)leftController != (Object)null && leftController.GetGripForce() > 0.75f,
Btn.X => (Object)(object)leftController != (Object)null && leftController.GetAButton(),
Btn.Y => (Object)(object)leftController != (Object)null && leftController.GetBButton(),
Btn.LeftStickClick => (Object)(object)leftController != (Object)null && leftController.GetThumbStick(),
_ => false,
};
}
catch
{
return false;
}
}
public static void Poll()
{
foreach (Btn value2 in Enum.GetValues(typeof(Btn)))
{
if (value2 != Btn.None)
{
_prev[value2] = _now.TryGetValue(value2, out var value) && value;
_now[value2] = Read(value2);
}
}
}
public static bool Held(Btn b)
{
bool value = default(bool);
return b != Btn.None && _now.TryGetValue(b, out value) && value;
}
public static bool Pressed(Btn b)
{
bool value;
if (Held(b))
{
return !(_prev.TryGetValue(b, out value) && value);
}
return false;
}
public static string Label(Btn b)
{
return b switch
{
Btn.RightTrigger => "R Trigger",
Btn.RightGrip => "R Grip",
Btn.RightStickClick => "R Stick Click",
Btn.LeftTrigger => "L Trigger",
Btn.LeftGrip => "L Grip",
Btn.LeftStickClick => "L Stick Click",
_ => b.ToString(),
};
}
}
public static class Net
{
private static bool? _loaded;
public static bool IsLoaded
{
get
{
bool valueOrDefault = _loaded == true;
if (!_loaded.HasValue)
{
valueOrDefault = AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.GetName().Name == "LabFusion");
_loaded = valueOrDefault;
return valueOrDefault;
}
return valueOrDefault;
}
}
public static bool InLobby
{
get
{
if (IsLoaded)
{
return InLobbyImpl();
}
return false;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool InLobbyImpl()
{
return NetworkInfo.HasServer;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Register()
{
ModuleMessageManager.RegisterHandler<CursedKillMessage>();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Spawn(string barcode, Vector3 pos, Quaternion rot, Action<GameObject, ushort> onSpawned)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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)
Spawnable val = LocalAssetSpawner.CreateSpawnable(barcode);
LocalAssetSpawner.Register(val);
NetworkAssetSpawner.Spawn(new SpawnRequestInfo
{
Spawnable = val,
Position = pos,
Rotation = rot,
SpawnEffect = false,
SpawnCallback = delegate(SpawnCallbackInfo info)
{
//IL_000b: 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)
Action<GameObject, ushort> action = onSpawned;
if (action != null)
{
GameObject spawned = info.Spawned;
NetworkEntity entity = info.Entity;
action(spawned, (ushort)((entity != null) ? entity.ID : 0));
}
}
});
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Despawn(ushort entityId)
{
//IL_0002: 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)
NetworkAssetSpawner.Despawn(new DespawnRequestInfo
{
EntityID = entityId,
DespawnEffect = false
});
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static List<(byte id, RigManager rig)> OtherPlayers()
{
List<(byte, RigManager)> list = new List<(byte, RigManager)>();
NetworkPlayer val = default(NetworkPlayer);
foreach (PlayerID item in PlayerIDManager.PlayerIDs.ToList())
{
if (item != null && !item.IsMe && NetworkPlayerManager.TryGetPlayer(item.SmallID, ref val) && val != null && val.HasRig && (Object)(object)val.RigRefs.RigManager != (Object)null)
{
list.Add((item.SmallID, val.RigRefs.RigManager));
}
}
return list;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static string PlayerName(byte smallId)
{
PlayerID playerID = PlayerIDManager.GetPlayerID(smallId);
string text = default(string);
if (playerID == null || !MetadataHelper.TryGetDisplayName(playerID, ref text) || string.IsNullOrWhiteSpace(text))
{
return $"Player {smallId}";
}
return text;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void SendGodModeKill(byte target, string move)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
MessageRelay.RelayModule<CursedKillMessage, CursedKillData>(new CursedKillData
{
Target = target,
Move = (move ?? "")
}, CommonMessageRoutes.ReliableToOtherClients);
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static byte LocalId()
{
return PlayerIDManager.LocalSmallID;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static bool PlayersCanBeHurt()
{
try
{
if (GamemodeManager.IsGamemodeStarted)
{
return true;
}
LobbyInfo lobbyInfo = LobbyInfoManager.LobbyInfo;
return lobbyInfo == null || lobbyInfo.FriendlyFire;
}
catch
{
return true;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static bool NpcOwnership(PuppetMaster pm, out bool isOwner)
{
isOwner = false;
NetworkEntity val = default(NetworkEntity);
if ((Object)(object)pm == (Object)null || !PuppetMasterExtender.Cache.TryGet(pm, ref val) || val == null)
{
return false;
}
isOwner = val.IsOwner;
return true;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void TakeNpcOwnership(PuppetMaster pm)
{
NetworkEntity val = default(NetworkEntity);
if (PuppetMasterExtender.Cache.TryGet(pm, ref val) && val != null && !val.IsOwner)
{
NetworkEntityManager.TakeOwnership(val);
}
}
}
public class CursedKillData : INetSerializable
{
public byte Target;
public string Move;
public int? GetSize()
{
return null;
}
public void Serialize(INetSerializer serializer)
{
serializer.SerializeValue(ref Target);
serializer.SerializeValue(ref Move);
}
}
public class CursedKillMessage : ModuleMessageHandler
{
protected override void OnHandleMessage(ReceivedMessage received)
{
CursedKillData cursedKillData = ((ReceivedMessage)(ref received)).ReadData<CursedKillData>();
if (cursedKillData.Target == Net.LocalId())
{
byte? sender = ((ReceivedMessage)(ref received)).Sender;
object who;
if (sender.HasValue)
{
byte valueOrDefault = sender.GetValueOrDefault();
who = Net.PlayerName(valueOrDefault);
}
else
{
who = "someone";
}
SukunaKitMod.QueueGodModeKill((string)who, cursedKillData.Move);
}
}
}
public class SukunaKitMod : MelonMod
{
private const string Pallet = "ItzVortex.CursedKit.Spawnable.";
private const float DismantleSpeed = 45f;
private const float DismantleLife = 0.6f;
private const float WorldSlashSpeed = 70f;
private const float WorldSlashLife = 1.2f;
private const float ArrowSpeed = 35f;
private const float ArrowLife = 3f;
private const float DomainRadius = 12f;
private const float DomainSeconds = 6f;
private MelonPreferences_Category _prefs;
private MelonPreferences_Entry<bool> _enabled;
private MelonPreferences_Entry<bool> _killNpcs;
private MelonPreferences_Entry<bool> _hurtPlayers;
private MelonPreferences_Entry<bool> _godKills;
private MelonPreferences_Entry<bool> _canBeKilled;
private readonly Dictionary<string, float> _ready = new Dictionary<string, float>();
private bool _blackFlashOn;
private BoolElement _blackFlashToggle;
private float _nextFlashL;
private float _nextFlashR;
private Vector3 _lastL;
private Vector3 _lastR;
private MelonPreferences_Entry<string> _hold;
private readonly List<(string key, string label, Btn def, Action fire)> _moves = new List<(string, string, Btn, Action)>();
private readonly Dictionary<string, MelonPreferences_Entry<string>> _binds = new Dictionary<string, MelonPreferences_Entry<string>>();
private bool _warnedMissing;
private static readonly Queue<(string who, string move)> _godKills2 = new Queue<(string, string)>();
private static readonly object _lock = new object();
private HealthMode? _restoreMode;
private float _restoreAt;
public static SukunaKitMod Instance { get; private set; }
public override void OnInitializeMelon()
{
Instance = this;
Combat.Log = ((MelonBase)this).LoggerInstance;
_prefs = MelonPreferences.CreateCategory("SukunaKit", "Cursed Techniques");
_enabled = _prefs.CreateEntry<bool>("Enabled", true, "Mod enabled", (string)null, false, false, (ValueValidator)null, (string)null);
_killNpcs = _prefs.CreateEntry<bool>("KillNpcs", true, "Moves kill NPCs", (string)null, false, false, (ValueValidator)null, (string)null);
_hurtPlayers = _prefs.CreateEntry<bool>("HurtPlayers", true, "Moves damage other players in Fusion (normal damage: god mode and host settings still apply)", (string)null, false, false, (ValueValidator)null, (string)null);
_godKills = _prefs.CreateEntry<bool>("KillModdedPlayers", true, "Moves kill players who also run this mod and allow it, even in god mode", (string)null, false, false, (ValueValidator)null, (string)null);
_canBeKilled = _prefs.CreateEntry<bool>("CanBeKilled", true, "Other players' moves can kill ME even in god mode (only matters if they run this mod)", (string)null, false, false, (ValueValidator)null, (string)null);
_moves.Add(("Dismantle", "Dismantle", Btn.RightTrigger, delegate
{
Use("Dismantle", 0.35f, Dismantle);
}));
_moves.Add(("Cleave", "Cleave", Btn.RightGrip, delegate
{
Use("Cleave", 0.35f, Cleave);
}));
_moves.Add(("WorldSlash", "World-Cutting Slash", Btn.A, delegate
{
Use("World Slash", 3f, WorldSlash);
}));
_moves.Add(("FlameArrow", "Flame Arrow", Btn.B, delegate
{
Use("Flame Arrow", 1.5f, FlameArrow);
}));
_moves.Add(("Domain", "Domain Expansion", Btn.LeftTrigger, delegate
{
Use("Domain", 10f, Domain);
}));
_moves.Add(("Heal", "Reverse Cursed Technique", Btn.LeftGrip, delegate
{
Use("Heal", 2f, Heal);
}));
_moves.Add(("BlackFlash", "Black Flash on/off", Btn.X, delegate
{
SetBlackFlash(!_blackFlashOn);
}));
_hold = _prefs.CreateEntry<string>("HoldButton", Btn.LeftStickClick.ToString(), "Hold this button while pressing a move's button (None = buttons fire moves directly)", (string)null, false, false, (ValueValidator)null, (string)null);
foreach (var move in _moves)
{
Dictionary<string, MelonPreferences_Entry<string>> binds = _binds;
string item = move.key;
MelonPreferences_Category prefs = _prefs;
string text = "Button_" + move.key;
Btn item2 = move.def;
binds[item] = prefs.CreateEntry<string>(text, item2.ToString(), "Controller button for " + move.label, (string)null, false, false, (ValueValidator)null, (string)null);
}
if (Net.IsLoaded)
{
try
{
Net.Register();
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Warning("Couldn't register the Fusion message: " + ex.Message);
}
}
BuildMenu();
((MelonBase)this).LoggerInstance.Msg("Cursed Techniques ready: BoneMenu > Cursed Techniques");
}
private void Save()
{
_prefs.SaveToFile(false);
}
private void BuildMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: 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_0279: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("Cursed Techniques", Color.red, 0, true);
val.CreateFunction("Dismantle", Color.white, (Action)delegate
{
Use("Dismantle", 0.35f, Dismantle);
});
val.CreateFunction("Cleave", Color.white, (Action)delegate
{
Use("Cleave", 0.35f, Cleave);
});
val.CreateFunction("World-Cutting Slash", Color.red, (Action)delegate
{
Use("World Slash", 3f, WorldSlash);
});
val.CreateFunction("Flame Arrow", new Color(1f, 0.5f, 0.1f), (Action)delegate
{
Use("Flame Arrow", 1.5f, FlameArrow);
});
val.CreateFunction("Domain Expansion", Color.red, (Action)delegate
{
Use("Domain", 10f, Domain);
});
val.CreateFunction("Reverse Cursed Technique (Heal)", Color.cyan, (Action)delegate
{
Use("Heal", 2f, Heal);
});
_blackFlashToggle = val.CreateBool("Black Flash (every punch)", Color.red, _blackFlashOn, (Action<bool>)delegate(bool v)
{
SetBlackFlash(v, fromMenu: true);
});
Page val2 = val.CreatePage("Controls", Color.yellow, 0, true);
val2.CreateEnum("Hold Button", Color.yellow, (Enum)Bind(_hold), (Action<Enum>)delegate(Enum v)
{
_hold.Value = v.ToString();
Save();
});
foreach (var move in _moves)
{
MelonPreferences_Entry<string> entry = _binds[move.key];
val2.CreateEnum(move.label, Color.white, (Enum)Bind(entry), (Action<Enum>)delegate(Enum v)
{
entry.Value = v.ToString();
Save();
});
}
Page obj = val.CreatePage("Settings", Color.gray, 0, true);
obj.CreateBool("Kill NPCs", Color.yellow, _killNpcs.Value, (Action<bool>)delegate(bool v)
{
_killNpcs.Value = v;
Save();
});
obj.CreateBool("Hurt Players", Color.yellow, _hurtPlayers.Value, (Action<bool>)delegate(bool v)
{
_hurtPlayers.Value = v;
Save();
});
obj.CreateBool("God-Mode Kill Modded Players", Color.red, _godKills.Value, (Action<bool>)delegate(bool v)
{
_godKills.Value = v;
Save();
});
obj.CreateBool("Others Can God-Mode Kill Me", Color.red, _canBeKilled.Value, (Action<bool>)delegate(bool v)
{
_canBeKilled.Value = v;
Save();
});
obj.CreateBool("Enabled", Color.white, _enabled.Value, (Action<bool>)delegate(bool v)
{
_enabled.Value = v;
Save();
});
}
private void Use(string move, float cooldown, Action act)
{
if (!_enabled.Value || (Object)(object)Player.RigManager == (Object)null)
{
return;
}
float unscaledTime = Time.unscaledTime;
if (_ready.TryGetValue(move, out var value) && unscaledTime < value)
{
return;
}
_ready[move] = unscaledTime + cooldown;
Combat.KillNpcs = _killNpcs.Value;
Combat.HurtPlayers = _hurtPlayers.Value;
Combat.GodModeKills = _godKills.Value;
try
{
act();
}
catch (Exception value2)
{
((MelonBase)this).LoggerInstance.Warning($"{move} failed: {value2}");
}
}
private static Vector3 AimDir()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Player.Head != (Object)null))
{
return Vector3.forward;
}
return Player.Head.forward;
}
private static Vector3 HandPos()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.RightHand != (Object)null)
{
return ((Component)Player.RightHand).transform.position;
}
if (!((Object)(object)Player.Head != (Object)null))
{
return Vector3.zero;
}
return Player.Head.position - Vector3.up * 0.3f;
}
private static Vector3 Chest()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0039: 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)
if (!((Object)(object)Player.Chest != (Object)null))
{
if (!((Object)(object)Player.Head != (Object)null))
{
return Vector3.zero;
}
return Player.Head.position - Vector3.up * 0.4f;
}
return Player.Chest.position;
}
private static Vector3 Feet()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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)
return (Vector3)(((??)Combat.GroundBelow(Chest(), 3f)) ?? (Chest() - Vector3.up * 1.25f));
}
private void Effect(string name, Vector3 pos, Quaternion rot, float lifetime)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
string text = "ItzVortex.CursedKit.Spawnable." + name.Replace(" ", "");
bool flag = false;
try
{
flag = AssetWarehouse.Instance != null && AssetWarehouse.Instance.HasCrate(new Barcode(text));
}
catch
{
}
if (!flag)
{
if (!_warnedMissing)
{
((MelonBase)this).LoggerInstance.Warning("The CursedKit effects pack isn't installed (" + text + "); moves still work but show no visuals.");
}
_warnedMissing = true;
}
else
{
Combat.SpawnEffect(text, pos, rot, lifetime);
}
}
private void Sweep(string move, Vector3 origin, Vector3 dir, float length, float radius, float speed, float throwSpeed, int chunks = 4)
{
//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)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
//IL_005f: 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_006c: 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_0086: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < chunks; i++)
{
Vector3 a = origin + dir * (length * (float)i / (float)chunks);
Vector3 b = origin + dir * (length * (float)(i + 1) / (float)chunks);
Combat.After(length * ((float)i + 0.5f) / (float)chunks / speed, delegate
{
float along;
string text = Combat.Hit(move, (Vector3 p) => Combat.SegmentDistance(p, a, b, out along) <= radius, (Vector3 p) => dir + Vector3.up * 0.15f, throwSpeed);
if (!text.Contains(" 0 NPC(s), 0 player(s), 0 object"))
{
((MelonBase)this).LoggerInstance.Msg(text);
}
});
}
}
private void Dismantle()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//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)
//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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0039: 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)
Vector3 val = AimDir();
Vector3 val2 = HandPos() + val * 0.3f;
Effect("Dismantle", val2, Quaternion.LookRotation(val), 1.6f);
Sweep("Dismantle", val2, val, 27.000002f, 1.6f, 45f, 6f);
}
private void Cleave()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
Vector3 dir = AimDir();
Vector3 position = Player.Head.position;
RaycastHit? val = Combat.Raycast(position, dir, 8f);
Vector3 target = position + dir * 1.6f;
if (val.HasValue)
{
RaycastHit value = val.Value;
target = ((RaycastHit)(ref value)).point;
value = val.Value;
Rigidbody attachedRigidbody = ((RaycastHit)(ref value)).collider.attachedRigidbody;
if ((Object)(object)attachedRigidbody != (Object)null)
{
target = attachedRigidbody.worldCenterOfMass;
}
}
Effect("Cleave", target, Quaternion.LookRotation(dir), 1.5f);
Combat.After(0.1f, delegate
{
((MelonBase)this).LoggerInstance.Msg(Combat.Hit("Cleave", (Vector3 p) => Vector3.Distance(p, target) <= 1.8f, (Vector3 p) => dir + Vector3.up * 0.3f, 8f));
});
}
private void WorldSlash()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//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)
//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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0039: 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)
Vector3 val = AimDir();
Vector3 val2 = HandPos() + val * 0.5f;
Effect("World Slash", val2, Quaternion.LookRotation(val), 3.2f);
Sweep("World-Cutting Slash", val2, val, 84f, 6f, 70f, 25f, 6);
}
private void FlameArrow()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//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: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_002f: 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)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_0074: 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)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = AimDir();
Vector3 val2 = HandPos() + val * 0.4f;
Effect("Flame Arrow", val2, Quaternion.LookRotation(val), 3.5f);
float num = 105f;
RaycastHit? val3 = Combat.Raycast(val2, val, num);
Vector3 val4;
if (!val3.HasValue)
{
val4 = val2 + val * num;
}
else
{
RaycastHit valueOrDefault = val3.GetValueOrDefault();
val4 = ((RaycastHit)(ref valueOrDefault)).point;
}
Vector3 impact = val4;
Combat.After(Vector3.Distance(val2, impact) / 35f, delegate
{
//IL_000c: 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)
Effect("Flame Blast", impact, Quaternion.identity, 5f);
((MelonBase)this).LoggerInstance.Msg(Combat.Hit("Flame Arrow", (Vector3 p) => Vector3.Distance(p, impact) <= 7f, delegate(Vector3 p)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
Vector3 val5 = p - impact;
return ((Vector3)(ref val5)).normalized + Vector3.up * 0.5f;
}, 20f));
});
}
private void Domain()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Feet();
Vector3 centre = val + Vector3.up;
Effect("Domain", val, Quaternion.identity, 7f);
for (float num = 0.5f; num < 5.6f; num += 0.3f)
{
bool first = num < 0.6f;
Combat.After(num, delegate
{
string text = Combat.Hit("Domain Expansion", (Vector3 p) => Vector3.Distance(p, centre) <= 12f, (Vector3 p) => Random.onUnitSphere + Vector3.up * 0.3f, 5f);
if (first)
{
((MelonBase)this).LoggerInstance.Msg(text);
}
});
}
}
private void Heal()
{
//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)
Effect("Heal", Feet(), Quaternion.identity, 2.5f);
RigManager rigManager = Player.RigManager;
Health val = ((rigManager != null) ? rigManager.health : null);
if (!((Object)(object)val == (Object)null))
{
try
{
val.SetFullHealth();
}
catch
{
val.curr_Health = val.max_Health;
}
((MelonBase)this).LoggerInstance.Msg("Reverse cursed technique: healed.");
}
}
private static Btn Bind(MelonPreferences_Entry<string> e)
{
if (!Enum.TryParse<Btn>(e.Value, out var result))
{
return Btn.None;
}
return result;
}
private void SetBlackFlash(bool on, bool fromMenu = false)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0064: Unknown result type (might be due to invalid IL or missing references)
if (!_enabled.Value)
{
on = false;
}
_blackFlashOn = on;
_lastL = (((Object)(object)Player.LeftHand != (Object)null) ? ((Component)Player.LeftHand).transform.position : Vector3.zero);
_lastR = (((Object)(object)Player.RightHand != (Object)null) ? ((Component)Player.RightHand).transform.position : Vector3.zero);
if (!fromMenu && _blackFlashToggle != null)
{
try
{
_blackFlashToggle.Value = on;
}
catch
{
}
}
((MelonBase)this).LoggerInstance.Msg(on ? "Black Flash ON: every hard punch is a Black Flash." : "Black Flash OFF.");
}
private void UpdateBlackFlash()
{
if (_blackFlashOn)
{
float dt = Mathf.Max(Time.deltaTime, 0.0001f);
Hand leftHand = Player.LeftHand;
CheckPunch((leftHand != null) ? ((Component)leftHand).transform : null, ref _lastL, ref _nextFlashL, dt);
Hand rightHand = Player.RightHand;
CheckPunch((rightHand != null) ? ((Component)rightHand).transform : null, ref _lastR, ref _nextFlashR, dt);
}
}
private void CheckPunch(Transform hand, ref Vector3 last, ref float nextAllowed, float dt)
{
//IL_0012: 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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)hand == (Object)null)
{
return;
}
Vector3 pos = hand.position;
Vector3 val = (pos - last) / dt;
last = pos;
if (((Vector3)(ref val)).magnitude < 3.5f || Time.unscaledTime < nextAllowed)
{
return;
}
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(pos, 0.22f, -1, (QueryTriggerInteraction)1))
{
if (!((Object)(object)item == (Object)null) && !Combat.IsMine(item))
{
nextAllowed = Time.unscaledTime + 0.6f;
Combat.KillNpcs = _killNpcs.Value;
Combat.HurtPlayers = _hurtPlayers.Value;
Combat.GodModeKills = _godKills.Value;
Vector3 dir = ((Vector3)(ref val)).normalized;
Effect("Black Flash", pos, Quaternion.LookRotation(dir), 2.5f);
((MelonBase)this).LoggerInstance.Msg(Combat.Hit("Black Flash", (Vector3 p) => Vector3.Distance(p, pos) <= 1.6f, (Vector3 p) => dir + Vector3.up * 0.2f, 35f));
break;
}
}
}
private void UpdateButtons()
{
if (!_enabled.Value || (Object)(object)Player.RigManager == (Object)null)
{
return;
}
Controls.Poll();
Btn btn = Bind(_hold);
if (btn != Btn.None && !Controls.Held(btn))
{
return;
}
foreach (var move in _moves)
{
Btn btn2 = Bind(_binds[move.key]);
if (btn2 != Btn.None && btn2 != btn && Controls.Pressed(btn2))
{
try
{
move.fire();
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Warning(move.label + " failed: " + ex.Message);
}
}
}
}
public static void QueueGodModeKill(string who, string move)
{
if (Instance == null || !Instance._enabled.Value || !Instance._canBeKilled.Value)
{
return;
}
lock (_lock)
{
_godKills2.Enqueue((who, move));
}
}
private void KillMe()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
RigManager rigManager = Player.RigManager;
Health val = ((rigManager != null) ? rigManager.health : null);
if ((Object)(object)val == (Object)null || val.curr_Health <= 0f)
{
return;
}
if ((int)val.healthMode != 1 && !_restoreMode.HasValue)
{
_restoreMode = val.healthMode;
_restoreAt = Time.unscaledTime + 6f;
}
val.healthMode = (HealthMode)1;
Player_Health val2 = ((Il2CppObjectBase)val).TryCast<Player_Health>();
try
{
if (val2 != null)
{
val2.ApplyKillDamage();
}
}
catch
{
}
if (val.curr_Health > 0f)
{
try
{
val.TAKEDAMAGE(val.max_Health * 100f);
}
catch
{
}
}
if (!(val.curr_Health > 0f))
{
return;
}
try
{
val.Death();
}
catch
{
}
}
public override void OnUpdate()
{
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Invalid comparison between Unknown and I4
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
while (true)
{
(string, string) tuple;
lock (_lock)
{
if (_godKills2.Count == 0)
{
break;
}
tuple = _godKills2.Dequeue();
goto IL_0035;
}
IL_0035:
((MelonBase)this).LoggerInstance.Msg(tuple.Item1 + " hit you with " + tuple.Item2 + ".");
try
{
KillMe();
}
catch (Exception ex)
{
((MelonBase)this).LoggerInstance.Warning("Couldn't apply the hit: " + ex.Message);
}
}
if (_restoreMode.HasValue && Time.unscaledTime >= _restoreAt)
{
RigManager rigManager = Player.RigManager;
Health val = ((rigManager != null) ? rigManager.health : null);
if ((Object)(object)val != (Object)null && val.curr_Health > 0f)
{
if ((int)val.healthMode == 1)
{
val.healthMode = _restoreMode.Value;
}
_restoreMode = null;
}
}
UpdateButtons();
UpdateBlackFlash();
Combat.Update();
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
Combat.OnLevelChanged();
}
}
}