Initial Commit
This commit is contained in:
commit
d2176afff9
23 changed files with 778 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
bin
|
||||||
|
obj
|
||||||
|
libs
|
13
CruelMan.csproj
Normal file
13
CruelMan.csproj
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<!-- <ImplicitUsings>enable</ImplicitUsings> -->
|
||||||
|
<!-- <Nullable>enable</Nullable> -->
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="libs/*.dll" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
20
CruelMan/CruelMan.cs
Normal file
20
CruelMan/CruelMan.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using CruelMan.Modules;
|
||||||
|
using CruelMan.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan {
|
||||||
|
public class CM : MonoBehaviour {
|
||||||
|
public static GameObject go;
|
||||||
|
public static CMLoader loader;
|
||||||
|
|
||||||
|
public static void Init(CMLoader loader) {
|
||||||
|
CM.loader = loader;
|
||||||
|
|
||||||
|
CM.go = new GameObject("CruelMan");
|
||||||
|
Object.DontDestroyOnLoad(CM.go);
|
||||||
|
|
||||||
|
go.AddComponent<MainUI>();
|
||||||
|
go.AddComponent<ModuleManager>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
CruelMan/CruelManLoader.cs
Normal file
39
CruelMan/CruelManLoader.cs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
using BepInEx;
|
||||||
|
using CruelMan.Modules;
|
||||||
|
using CruelMan.Utils;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace CruelMan {
|
||||||
|
|
||||||
|
[BepInPlugin("top.davidon.valheim.cruelman", "CruelMan", "1.0.0")]
|
||||||
|
public class CMLoader : BaseUnityPlugin {
|
||||||
|
public readonly Harmony harmony = new Harmony("top.davidon.valheim.cruelman");
|
||||||
|
|
||||||
|
public void Awake() {
|
||||||
|
Log.Info("Awake CruelMan");
|
||||||
|
harmony.PatchAll();
|
||||||
|
UnityEngine.Object.DontDestroyOnLoad(this);
|
||||||
|
|
||||||
|
CM.Init(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(Player), "OnDeath")]
|
||||||
|
class DeathPatch {
|
||||||
|
static bool Prefix() {
|
||||||
|
return !ModuleManager.instance.GetModule<NoDeath>().Enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(Player), nameof(Player.InAttack))]
|
||||||
|
class AttackPathh {
|
||||||
|
static bool Prefix() {
|
||||||
|
return !ModuleManager.instance.GetModule<NotInAttack>().Enabled;
|
||||||
|
}
|
||||||
|
static void Postfix(ref bool __result) {
|
||||||
|
if (ModuleManager.instance.GetModule<NotInAttack>().Enabled) {
|
||||||
|
__result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
92
CruelMan/Modules/Module.cs
Normal file
92
CruelMan/Modules/Module.cs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
using CruelMan.Utils;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public enum ModuleType {
|
||||||
|
Movement = 0,
|
||||||
|
Stats = 1,
|
||||||
|
Combat = 2,
|
||||||
|
Misc = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class Module {
|
||||||
|
public abstract string Name { get; }
|
||||||
|
public abstract string Command { get; }
|
||||||
|
public abstract string Description { get; }
|
||||||
|
public abstract ModuleType Type { get; }
|
||||||
|
public bool Enabled { get; set; } = false;
|
||||||
|
public KeyCode bind { get; set; } = KeyCode.None;
|
||||||
|
public List<Setting> Settings = new List<Setting>();
|
||||||
|
|
||||||
|
public void Register() {
|
||||||
|
ModuleManager.instance.modules.Add(this);
|
||||||
|
new Terminal.ConsoleCommand($"cm{Command}", Description, delegate (Terminal.ConsoleEventArgs args) {
|
||||||
|
Toggle();
|
||||||
|
args.Context.AddString($"Toggled {Name}");
|
||||||
|
});
|
||||||
|
Init();
|
||||||
|
Log.Info($"Registered module {Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Toggle() {
|
||||||
|
if (Enabled) {
|
||||||
|
Disable();
|
||||||
|
} else {
|
||||||
|
Enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Enable() {
|
||||||
|
Enabled = true;
|
||||||
|
Log.Info($"{Name} enabled");
|
||||||
|
OnEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Disable() {
|
||||||
|
Enabled = false;
|
||||||
|
Log.Info($"{Name} disabled");
|
||||||
|
OnDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() {
|
||||||
|
if (Input.GetKeyDown(bind)) {
|
||||||
|
Toggle();
|
||||||
|
}
|
||||||
|
foreach (Setting s in Settings) {
|
||||||
|
if (s is ActionSetting) {
|
||||||
|
ActionSetting a = (ActionSetting)s;
|
||||||
|
if (Input.GetKeyDown(a.bind)) {
|
||||||
|
a.Run(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Enabled) {
|
||||||
|
OnUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void Init();
|
||||||
|
|
||||||
|
protected abstract void OnEnable();
|
||||||
|
protected abstract void OnDisable();
|
||||||
|
|
||||||
|
protected abstract void OnUpdate();
|
||||||
|
public virtual void Refresh() {}
|
||||||
|
|
||||||
|
protected void AddSetting<T>() where T : Setting, new() {
|
||||||
|
T setting = new T();
|
||||||
|
Settings.Add(setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetSetting<T>() where T : Setting, new() {
|
||||||
|
foreach (Setting s in Settings) {
|
||||||
|
if (s is T) {
|
||||||
|
return (T)s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new System.Exception("Setting not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
46
CruelMan/Modules/ModuleManager.cs
Normal file
46
CruelMan/Modules/ModuleManager.cs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class ModuleManager : MonoBehaviour {
|
||||||
|
public static ModuleManager instance;
|
||||||
|
public List<Module> modules = new List<Module>();
|
||||||
|
|
||||||
|
public void Awake() {
|
||||||
|
instance = this;
|
||||||
|
AddModules();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() {
|
||||||
|
foreach (Module module in modules) {
|
||||||
|
module.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddModules() {
|
||||||
|
AddModule<NoDeath>();
|
||||||
|
AddModule<Menu>();
|
||||||
|
AddModule<AddStamina>();
|
||||||
|
AddModule<InfCarry>();
|
||||||
|
AddModule<GuardianPowers>();
|
||||||
|
AddModule<NotInAttack>();
|
||||||
|
AddModule<Speed>();
|
||||||
|
AddModule<JumpHeight>();
|
||||||
|
AddModule<InstantDmg>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddModule<T>() where T : Module, new() {
|
||||||
|
T module = new T();
|
||||||
|
module.Register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetModule<T>() where T : Module, new() {
|
||||||
|
foreach (Module module in modules) {
|
||||||
|
if (module is T) {
|
||||||
|
return (T)module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new System.Exception("Module not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
CruelMan/Modules/Modules/AddStamina.cs
Normal file
48
CruelMan/Modules/Modules/AddStamina.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class AddStamina : Module {
|
||||||
|
public override string Name => "Add Stamina";
|
||||||
|
public override string Command => "addstamina";
|
||||||
|
public override string Description => "Adds stamina to the player";
|
||||||
|
public override ModuleType Type => ModuleType.Stats;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
AddSetting<NoChange>();
|
||||||
|
AddSetting<Stamina>();
|
||||||
|
AddSetting<SetStamina>();
|
||||||
|
}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
if (GetSetting<NoChange>().Value) {
|
||||||
|
FieldInfo fi = typeof(Player).GetField("m_stamina", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
fi.SetValue(Player.m_localPlayer, GetSetting<Stamina>().Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NoChange : BooleanSetting {
|
||||||
|
public override string Name => "No Change";
|
||||||
|
public override string Description => "Prevents stamina from changing";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stamina : NumberSetting {
|
||||||
|
public override string Name => "Stamina";
|
||||||
|
public override string Description => "The amount of stamina to add";
|
||||||
|
public override float Min {get;set;} = 0;
|
||||||
|
public override float Max {get;set;} = 300;
|
||||||
|
public override float Value {get;set;} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetStamina : ActionSetting {
|
||||||
|
public override string Name => "Set Stamina";
|
||||||
|
public override string Description => "Sets the stamina to the value";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
FieldInfo fi = typeof(Player).GetField("m_stamina", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
fi.SetValue(Player.m_localPlayer, module.GetSetting<Stamina>().Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
129
CruelMan/Modules/Modules/GuardianPowers.cs
Normal file
129
CruelMan/Modules/Modules/GuardianPowers.cs
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class GuardianPowers : Module {
|
||||||
|
public override string Name => "Guardian Powers";
|
||||||
|
public override string Command => "guardian";
|
||||||
|
public override string Description => "Enable guardian power";
|
||||||
|
public override ModuleType Type => ModuleType.Misc;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
AddSetting<NoCooldown>();
|
||||||
|
AddSetting<Activate>();
|
||||||
|
AddSetting<SetEikthyr>();
|
||||||
|
AddSetting<SetTheElder>();
|
||||||
|
AddSetting<SetBonemass>();
|
||||||
|
AddSetting<SetModer>();
|
||||||
|
AddSetting<SetYagluth>();
|
||||||
|
AddSetting<SetQueen>();
|
||||||
|
AddSetting<SetAshlands>();
|
||||||
|
AddSetting<SetDeepNorth>();
|
||||||
|
}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
if (GetSetting<NoCooldown>().Value) {
|
||||||
|
Player.m_localPlayer.m_guardianPowerCooldown = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetGP(string name) {
|
||||||
|
FieldInfo fi = typeof(Player).GetField("m_guardianPower", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
fi.SetValue(Player.m_localPlayer, name);
|
||||||
|
|
||||||
|
int hash = ((!string.IsNullOrEmpty(name)) ? StringExtensionMethods.GetStableHashCode(name) : 0);
|
||||||
|
FieldInfo fi2 = typeof(Player).GetField("m_guardianPowerHash", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
fi2.SetValue(Player.m_localPlayer, hash);
|
||||||
|
|
||||||
|
FieldInfo fi3 = typeof(Player).GetField("m_guardianSE", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
fi3.SetValue(Player.m_localPlayer, ObjectDB.instance.GetStatusEffect(hash));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NoCooldown : BooleanSetting {
|
||||||
|
public override string Name => "No Cooldown";
|
||||||
|
public override string Description => "Enable no cooldown";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Activate : ActionSetting {
|
||||||
|
public override string Name => "Activate";
|
||||||
|
public override string Description => "Activate guardian power";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
Player.m_localPlayer.ActivateGuardianPower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetEikthyr : ActionSetting {
|
||||||
|
public override string Name => "Set Eikthyr";
|
||||||
|
public override string Description => "Set guardian power to Eikthyr";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Eikthyr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetTheElder : ActionSetting {
|
||||||
|
public override string Name => "Set The Elder";
|
||||||
|
public override string Description => "Set guardian power to The Elder";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_TheElder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetBonemass : ActionSetting {
|
||||||
|
public override string Name => "Set Bonemass";
|
||||||
|
public override string Description => "Set guardian power to Bonemass";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Bonemass");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetModer : ActionSetting {
|
||||||
|
public override string Name => "Set Moder";
|
||||||
|
public override string Description => "Set guardian power to Moder";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Moder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetYagluth : ActionSetting {
|
||||||
|
public override string Name => "Set Yagluth";
|
||||||
|
public override string Description => "Set guardian power to Yagluth";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Yagluth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetQueen : ActionSetting {
|
||||||
|
public override string Name => "Set Queen";
|
||||||
|
public override string Description => "Set guardian power to Queen";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Queen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetAshlands : ActionSetting {
|
||||||
|
public override string Name => "Set Ashlands";
|
||||||
|
public override string Description => "Set guardian power to Ashlands";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_Ashlands");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetDeepNorth : ActionSetting {
|
||||||
|
public override string Name => "Set Deep North";
|
||||||
|
public override string Description => "Set guardian power to Deep North";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
((GuardianPowers)module).SetGP("GP_DeepNorth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
CruelMan/Modules/Modules/InfCarry.cs
Normal file
15
CruelMan/Modules/Modules/InfCarry.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class InfCarry : Module {
|
||||||
|
public override string Name => "InfCarry";
|
||||||
|
public override string Command => "infcarry";
|
||||||
|
public override string Description => "Allows you to carry infinite weight";
|
||||||
|
public override ModuleType Type => ModuleType.Movement;
|
||||||
|
|
||||||
|
protected override void Init() {}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
Player.m_localPlayer.m_maxCarryWeight = 1000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
CruelMan/Modules/Modules/InstantDmg.cs
Normal file
57
CruelMan/Modules/Modules/InstantDmg.cs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class InstantDmg : Module {
|
||||||
|
public override string Name { get; } = "InstantDmg";
|
||||||
|
public override string Command { get; } = "instantdmg";
|
||||||
|
public override string Description { get; } = "Instantly kills the target";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Combat;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
AddSetting<InstantDmgDo>();
|
||||||
|
AddSetting<Damage>();
|
||||||
|
GetSetting<InstantDmgDo>().bind = KeyCode.Delete;
|
||||||
|
}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InstantDmgDo : ActionSetting {
|
||||||
|
public override string Name { get; } = "InstantDmg";
|
||||||
|
public override string Description { get; } = "Instantly kills the target";
|
||||||
|
|
||||||
|
public override void Run(Module module) {
|
||||||
|
HitData hd = new HitData();
|
||||||
|
hd.m_damage.m_damage = module.GetSetting<Damage>().Value;
|
||||||
|
hd.m_dodgeable = false;
|
||||||
|
hd.m_blockable = false;
|
||||||
|
hd.m_ignorePVP = true;
|
||||||
|
hd.m_pushForce = 0;
|
||||||
|
hd.m_point = Player.m_localPlayer.transform.position;
|
||||||
|
hd.m_dir = Player.m_localPlayer.transform.forward;
|
||||||
|
hd.m_hitType = HitData.HitType.PlayerHit;
|
||||||
|
hd.SetAttacker(Player.m_localPlayer);
|
||||||
|
|
||||||
|
FieldInfo fi = typeof(Player).GetField("m_hoveringCreature", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
Character target = (Character)fi.GetValue(Player.m_localPlayer);
|
||||||
|
if (target == Player.m_localPlayer) {
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
if (target == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target.Damage(hd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Damage : NumberSetting {
|
||||||
|
public override string Name { get; } = "Damage";
|
||||||
|
public override string Description { get; } = "The amount of damage to deal";
|
||||||
|
public override float Min { get; set; } = 0;
|
||||||
|
public override float Max { get; set; } = 1000;
|
||||||
|
public override float Value { get; set; } = 0;
|
||||||
|
}
|
||||||
|
}
|
38
CruelMan/Modules/Modules/JumpHeight.cs
Normal file
38
CruelMan/Modules/Modules/JumpHeight.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class JumpHeight : Module {
|
||||||
|
public override string Name { get; } = "JumpHeight";
|
||||||
|
public override string Command { get; } = "jumpheight";
|
||||||
|
public override string Description { get; } = "Changes your jump height";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Movement;
|
||||||
|
public float oldJumpHeight = 0f;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
AddSetting<JumpHeightVal>();
|
||||||
|
}
|
||||||
|
protected override void OnEnable() {
|
||||||
|
oldJumpHeight = Player.m_localPlayer.m_jumpForce;
|
||||||
|
}
|
||||||
|
protected override void OnDisable() {
|
||||||
|
Player.m_localPlayer.m_jumpForce = oldJumpHeight;
|
||||||
|
}
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
if (Input.GetKey(KeyCode.LeftShift)) {
|
||||||
|
Player.m_localPlayer.m_jumpForce = GetSetting<JumpHeightVal>().Value;
|
||||||
|
} else {
|
||||||
|
Player.m_localPlayer.m_jumpForce = oldJumpHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JumpHeightVal : NumberSetting {
|
||||||
|
public override string Name => "Value";
|
||||||
|
public override string Description => "Jump Height value";
|
||||||
|
|
||||||
|
public override float Value { get; set; } = 10f;
|
||||||
|
public override float Min { get; set; } = 0f;
|
||||||
|
public override float Max { get; set; } = 100f;
|
||||||
|
}
|
||||||
|
}
|
25
CruelMan/Modules/Modules/Menu.cs
Normal file
25
CruelMan/Modules/Modules/Menu.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using CruelMan.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class Menu : Module {
|
||||||
|
public override string Name { get; } = "Menu";
|
||||||
|
public override string Command { get; } = "menu";
|
||||||
|
public override string Description { get; } = "Opens the main mod menu";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Misc;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
bind = KeyCode.End;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnEnable() {
|
||||||
|
CM.go.GetComponent<MainUI>().menuOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDisable() {
|
||||||
|
CM.go.GetComponent<MainUI>().menuOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUpdate() {}
|
||||||
|
}
|
||||||
|
}
|
13
CruelMan/Modules/Modules/NoDeath.cs
Normal file
13
CruelMan/Modules/Modules/NoDeath.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class NoDeath : Module {
|
||||||
|
public override string Name { get; } = "NoDeath";
|
||||||
|
public override string Command { get; } = "nodeath";
|
||||||
|
public override string Description { get; } = "Prevents you from dying";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Combat;
|
||||||
|
|
||||||
|
protected override void Init() {}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {}
|
||||||
|
}
|
||||||
|
}
|
13
CruelMan/Modules/Modules/NotInAttack.cs
Normal file
13
CruelMan/Modules/Modules/NotInAttack.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class NotInAttack : Module {
|
||||||
|
public override string Name { get; } = "NoAttackCooldown";
|
||||||
|
public override string Command { get; } = "nodattack";
|
||||||
|
public override string Description { get; } = "Always sets that your not in an attack";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Combat;
|
||||||
|
|
||||||
|
protected override void Init() {}
|
||||||
|
protected override void OnDisable() {}
|
||||||
|
protected override void OnEnable() {}
|
||||||
|
protected override void OnUpdate() {}
|
||||||
|
}
|
||||||
|
}
|
34
CruelMan/Modules/Modules/Speed.cs
Normal file
34
CruelMan/Modules/Modules/Speed.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules {
|
||||||
|
public class Speed : Module {
|
||||||
|
public override string Name { get; } = "Speed";
|
||||||
|
public override string Command { get; } = "speed";
|
||||||
|
public override string Description { get; } = "Fast as fuck boiii";
|
||||||
|
public override ModuleType Type { get; } = ModuleType.Movement;
|
||||||
|
public float oldSpeed = 0f;
|
||||||
|
|
||||||
|
protected override void Init() {
|
||||||
|
AddSetting<SpeedVal>();
|
||||||
|
}
|
||||||
|
protected override void OnEnable() {
|
||||||
|
oldSpeed = Player.m_localPlayer.m_runSpeed;
|
||||||
|
}
|
||||||
|
protected override void OnDisable() {
|
||||||
|
Player.m_localPlayer.m_runSpeed = oldSpeed;
|
||||||
|
}
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
Player.m_localPlayer.m_runSpeed = GetSetting<SpeedVal>().Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SpeedVal : NumberSetting
|
||||||
|
{
|
||||||
|
public override string Name => "Value";
|
||||||
|
public override string Description => "Run Speed value";
|
||||||
|
|
||||||
|
public override float Value { get; set; } = 20f;
|
||||||
|
public override float Min { get; set; } = 0f;
|
||||||
|
public override float Max { get; set; } = 500f;
|
||||||
|
}
|
||||||
|
}
|
9
CruelMan/Modules/Settings/ActionSetting.cs
Normal file
9
CruelMan/Modules/Settings/ActionSetting.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.Modules.Settings {
|
||||||
|
public abstract class ActionSetting : Setting {
|
||||||
|
public KeyCode bind { get; set; } = KeyCode.None;
|
||||||
|
|
||||||
|
public abstract void Run(Module module);
|
||||||
|
}
|
||||||
|
}
|
9
CruelMan/Modules/Settings/BooleanSetting.cs
Normal file
9
CruelMan/Modules/Settings/BooleanSetting.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
namespace CruelMan.Modules.Settings {
|
||||||
|
public abstract class BooleanSetting : Setting {
|
||||||
|
public bool Value = false;
|
||||||
|
|
||||||
|
public void Toggle() {
|
||||||
|
Value = !Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
CruelMan/Modules/Settings/NumberSetting.cs
Normal file
7
CruelMan/Modules/Settings/NumberSetting.cs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
namespace CruelMan.Modules.Settings {
|
||||||
|
public abstract class NumberSetting : Setting {
|
||||||
|
public abstract float Value { get; set; }
|
||||||
|
public abstract float Min {get; set; }
|
||||||
|
public abstract float Max {get;set;}
|
||||||
|
}
|
||||||
|
}
|
8
CruelMan/Modules/Settings/Setting.cs
Normal file
8
CruelMan/Modules/Settings/Setting.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace CruelMan.Modules.Settings {
|
||||||
|
public abstract class Setting {
|
||||||
|
public abstract string Name { get; }
|
||||||
|
public abstract string Description { get; }
|
||||||
|
|
||||||
|
public Setting() {}
|
||||||
|
}
|
||||||
|
}
|
5
CruelMan/Modules/Settings/TextSetting.cs
Normal file
5
CruelMan/Modules/Settings/TextSetting.cs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
namespace CruelMan.Modules.Settings {
|
||||||
|
public abstract class TextSetting : Setting {
|
||||||
|
public virtual string value { get; set; } = "";
|
||||||
|
}
|
||||||
|
}
|
109
CruelMan/UI/MainUI.cs
Normal file
109
CruelMan/UI/MainUI.cs
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using CruelMan.Modules;
|
||||||
|
using CruelMan.Modules.Settings;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CruelMan.UI {
|
||||||
|
public class MainUI : MonoBehaviour {
|
||||||
|
public bool menuOpen = false;
|
||||||
|
|
||||||
|
public List<Setting> openSettings = null;
|
||||||
|
public Module openSettingsModule = null;
|
||||||
|
public Rect settingsWindow = new Rect(140, 10, 220, 600);
|
||||||
|
|
||||||
|
public Rect ModuleMovementWindow = new Rect(10, 10, 200, 500);
|
||||||
|
public Rect ModuleStatsWindow = new Rect(220, 10, 200, 500);
|
||||||
|
public Rect ModuleCombatWindow = new Rect(440, 10, 200, 500);
|
||||||
|
public Rect ModuleMiscWindow = new Rect(660, 10, 200, 500);
|
||||||
|
|
||||||
|
public void OnGUI() {
|
||||||
|
if (!menuOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// windowRect = GUI.Window(0, windowRect, MainWindow, "CruelMan");
|
||||||
|
ModuleMovementWindow = GUI.Window(0, ModuleMovementWindow, MainWindow, "Movement");
|
||||||
|
ModuleStatsWindow = GUI.Window(1, ModuleStatsWindow, MainWindow, "Stats");
|
||||||
|
ModuleCombatWindow = GUI.Window(2, ModuleCombatWindow, MainWindow, "Combat");
|
||||||
|
ModuleMiscWindow = GUI.Window(3, ModuleMiscWindow, MainWindow, "Misc");
|
||||||
|
|
||||||
|
if (openSettings != null) {
|
||||||
|
settingsWindow = GUI.Window(99, settingsWindow, SettingsWindow, openSettingsModule.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MainWindow(int windowID) {
|
||||||
|
ModuleType mt = (ModuleType)windowID;
|
||||||
|
|
||||||
|
int lastY = 20;
|
||||||
|
|
||||||
|
foreach (Module module in ModuleManager.instance.modules) {
|
||||||
|
if (module.Type == mt) {
|
||||||
|
if (module.Enabled) {
|
||||||
|
GUI.color = Color.green;
|
||||||
|
} else {
|
||||||
|
GUI.color = Color.red;
|
||||||
|
}
|
||||||
|
if (GUI.Button(new Rect(10, lastY, 150, 20), module.Name)) {
|
||||||
|
module.Toggle();
|
||||||
|
}
|
||||||
|
if (GUI.Button(new Rect(160, lastY, 20, 20), "S")) {
|
||||||
|
if (openSettingsModule == module) {
|
||||||
|
openSettingsModule.Refresh();
|
||||||
|
openSettingsModule = null;
|
||||||
|
openSettings = null;
|
||||||
|
} else {
|
||||||
|
openSettingsModule = module;
|
||||||
|
openSettings = module.Settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUI.color = Color.white;
|
||||||
|
lastY += 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.DragWindow(new Rect(0, 0, 10000, 10000));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SettingsWindow(int windowID) {
|
||||||
|
if (GUI.Button(new Rect(10, 20, 95, 20), "Apply")) {
|
||||||
|
openSettingsModule.Refresh();
|
||||||
|
openSettingsModule = null;
|
||||||
|
openSettings = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
openSettingsModule.bind = (KeyCode)Enum.Parse(typeof(KeyCode), GUI.TextField(new Rect(105, 20, 95, 20), openSettingsModule.bind.ToString()));
|
||||||
|
|
||||||
|
int lastY = 70;
|
||||||
|
|
||||||
|
foreach (Setting setting in openSettings) {
|
||||||
|
if (setting is BooleanSetting) {
|
||||||
|
BooleanSetting bs = (BooleanSetting)setting;
|
||||||
|
bs.Value = GUI.Toggle(new Rect(10, lastY, 100, 20), bs.Value, bs.Name);
|
||||||
|
lastY += 20;
|
||||||
|
} else if (setting is NumberSetting) {
|
||||||
|
NumberSetting ns = (NumberSetting)setting;
|
||||||
|
ns.Value = GUI.HorizontalSlider(new Rect(10, lastY, 100, 20), ns.Value, ns.Min, ns.Max);
|
||||||
|
lastY += 20;
|
||||||
|
} else if (setting is TextSetting) {
|
||||||
|
TextSetting ts = (TextSetting)setting;
|
||||||
|
ts.value = GUI.TextField(new Rect(10, lastY, 100, 20), ts.value);
|
||||||
|
lastY += 20;
|
||||||
|
} else if (setting is ActionSetting) {
|
||||||
|
ActionSetting as_ = (ActionSetting)setting;
|
||||||
|
if (GUI.Button(new Rect(10, lastY, 100, 20), as_.Name)) {
|
||||||
|
as_.Run(openSettingsModule);
|
||||||
|
}
|
||||||
|
lastY += 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.DragWindow(new Rect(0, 0, 10000, 10000));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToggleMenu() {
|
||||||
|
menuOpen = !menuOpen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
CruelMan/Utils/Log.cs
Normal file
21
CruelMan/Utils/Log.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
namespace CruelMan.Utils {
|
||||||
|
public static class Log {
|
||||||
|
public static void Info(string message) {
|
||||||
|
#if DEBUG
|
||||||
|
UnityEngine.Debug.Log($"[CruelMan] {message}");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Warn(string message) {
|
||||||
|
#if DEBUG
|
||||||
|
UnityEngine.Debug.LogWarning($"[CruelMan] {message}");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Error(string message) {
|
||||||
|
#if DEBUG
|
||||||
|
UnityEngine.Debug.LogError($"[CruelMan] {message}");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
README.md
Normal file
25
README.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
## required dlls in the libs folder
|
||||||
|
- 0Harmony
|
||||||
|
- assembly_utils
|
||||||
|
- assembly_valheim
|
||||||
|
- BepInEx
|
||||||
|
- UnityEngine
|
||||||
|
### Unity dlls
|
||||||
|
- InputSystem
|
||||||
|
- InputSystem.ForUI
|
||||||
|
- CoreModule
|
||||||
|
- IMGUIModule
|
||||||
|
- InputLegacyModule
|
||||||
|
- InputModule
|
||||||
|
- JSONSerializeModule
|
||||||
|
- ParticleSystemModule
|
||||||
|
- Physics2DModule
|
||||||
|
- PhysicsModule
|
||||||
|
- TextRenderingModule
|
||||||
|
- UI
|
||||||
|
- UIElementsModule
|
||||||
|
- UIElementsNativeModule
|
||||||
|
- UIModule
|
||||||
|
- UnityCurlModule
|
||||||
|
- XR.LegacyInputHelpers
|
||||||
|
- XRModule
|
Loading…
Reference in a new issue