Skip to content

Commit 38dd359

Browse files
committed
- Moved InstaKill to Combat window
- Added AirJump - Added OmegaJump - Fixed SpeedSlider glitching - Added that the plugin prints out the github repo
1 parent 9d2ce75 commit 38dd359

File tree

14 files changed

+203
-152
lines changed

14 files changed

+203
-152
lines changed

stikosekutilities2/Cheats/Player/InstaKill.cs renamed to stikosekutilities2/Cheats/Combat/InstaKill.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace stikosekutilities2.Cheats
66
[Cheat]
77
public class InstaKill : BaseCheat
88
{
9-
public InstaKill() : base("InstaKill", WindowID.Player)
9+
public InstaKill() : base("InstaKill", WindowID.Combat)
1010
{
1111
}
1212

stikosekutilities2/Cheats/Items.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using stikosekutilities2.UI;
2+
using UnityEngine;
3+
4+
namespace stikosekutilities2.Cheats
5+
{
6+
[Cheat]
7+
public class AirJump : BaseCheat
8+
{
9+
public AirJump() : base("AirJump", WindowID.Movement)
10+
{
11+
}
12+
13+
protected override void RenderElements()
14+
{
15+
Activated = Toggle(Name, Activated);
16+
}
17+
18+
19+
public override void Update()
20+
{
21+
if (InGame && Input.GetKeyDown(SaveManager.Instance.state.jump) && Activated)
22+
{
23+
var velocity = PlayerMovement.Instance.GetRb().velocity;
24+
25+
velocity.y = 20f;
26+
27+
PlayerMovement.Instance.GetRb().velocity = velocity;
28+
}
29+
}
30+
31+
}
32+
}

stikosekutilities2/Cheats/Movement/Fly.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ public override void Update()
1717

1818
if (Activated)
1919
{
20-
PlayerMovement.Instance.GetRb().velocity = new Vector3(0f, 0f, 0f);
21-
float speed = Input.GetKey(KeyCode.LeftControl) ? 0.5f : (Input.GetKey(InputManager.sprint) ? 1f : 0.5f);
22-
if (Input.GetKey(InputManager.jump))
23-
{
24-
PlayerStatus.Instance.transform.position = new Vector3(PlayerStatus.Instance.transform.position.x, PlayerStatus.Instance.transform.position.y + speed, PlayerStatus.Instance.transform.position.z);
25-
}
26-
Vector3 playerTransformPosVec = PlayerStatus.Instance.transform.position;
27-
if (Input.GetKey(InputManager.forward))
28-
{
29-
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x + Camera.main.transform.forward.x * Camera.main.transform.up.y * speed, playerTransformPosVec.y + Camera.main.transform.forward.y * speed, playerTransformPosVec.z + Camera.main.transform.forward.z * Camera.main.transform.up.y * speed);
30-
}
31-
if (Input.GetKey(InputManager.backwards))
32-
{
33-
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x - Camera.main.transform.forward.x * Camera.main.transform.up.y * speed, playerTransformPosVec.y - Camera.main.transform.forward.y * speed, playerTransformPosVec.z - Camera.main.transform.forward.z * Camera.main.transform.up.y * speed);
34-
}
35-
if (Input.GetKey(InputManager.right))
36-
{
37-
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x + Camera.main.transform.right.x * speed, playerTransformPosVec.y, playerTransformPosVec.z + Camera.main.transform.right.z * speed);
38-
}
39-
if (Input.GetKey(InputManager.left))
40-
{
41-
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x - Camera.main.transform.right.x * speed, playerTransformPosVec.y, playerTransformPosVec.z - Camera.main.transform.right.z * speed);
42-
}
43-
}
20+
PlayerMovement.Instance.GetRb().velocity = new Vector3(0f, 0f, 0f);
21+
float speed = Input.GetKey(KeyCode.LeftControl) ? 0.5f : (Input.GetKey(InputManager.sprint) ? 1f : 0.5f);
22+
if (Input.GetKey(InputManager.jump))
23+
{
24+
PlayerStatus.Instance.transform.position = new Vector3(PlayerStatus.Instance.transform.position.x, PlayerStatus.Instance.transform.position.y + speed, PlayerStatus.Instance.transform.position.z);
25+
}
26+
Vector3 playerTransformPosVec = PlayerStatus.Instance.transform.position;
27+
if (Input.GetKey(InputManager.forward))
28+
{
29+
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x + Camera.main.transform.forward.x * Camera.main.transform.up.y * speed, playerTransformPosVec.y + Camera.main.transform.forward.y * speed, playerTransformPosVec.z + Camera.main.transform.forward.z * Camera.main.transform.up.y * speed);
30+
}
31+
if (Input.GetKey(InputManager.backwards))
32+
{
33+
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x - Camera.main.transform.forward.x * Camera.main.transform.up.y * speed, playerTransformPosVec.y - Camera.main.transform.forward.y * speed, playerTransformPosVec.z - Camera.main.transform.forward.z * Camera.main.transform.up.y * speed);
34+
}
35+
if (Input.GetKey(InputManager.right))
36+
{
37+
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x + Camera.main.transform.right.x * speed, playerTransformPosVec.y, playerTransformPosVec.z + Camera.main.transform.right.z * speed);
38+
}
39+
if (Input.GetKey(InputManager.left))
40+
{
41+
PlayerStatus.Instance.transform.position = new Vector3(playerTransformPosVec.x - Camera.main.transform.right.x * speed, playerTransformPosVec.y, playerTransformPosVec.z - Camera.main.transform.right.z * speed);
42+
}
43+
}
4444

4545
}
4646

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using stikosekutilities2.UI;
2+
using stikosekutilities2.Utils;
3+
4+
namespace stikosekutilities2.Cheats
5+
{
6+
[Cheat]
7+
public class OmegaJump : BaseCheat
8+
{
9+
private static float origJumpForce = -69;
10+
11+
public OmegaJump() : base("OmegaJump", WindowID.Movement)
12+
{
13+
}
14+
15+
protected override void RenderElements()
16+
{
17+
Activated = Toggle(Name, Activated);
18+
}
19+
20+
public override void Update()
21+
{
22+
if (!InGame)
23+
return;
24+
25+
if (!Activated)
26+
return;
27+
28+
if (origJumpForce == -69)
29+
{
30+
origJumpForce = PlayerMovement.Instance.GetFieldValue<float>("jumpForce");
31+
}
32+
33+
PlayerMovement.Instance.SetFieldValue("jumpForce", origJumpForce * 2);
34+
}
35+
36+
}
37+
}

stikosekutilities2/Cheats/Other/Achievements.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override void RenderElements()
2525
SteamUserStats.ResetAll(true);
2626
SteamUserStats.StoreStats();
2727
}
28-
28+
2929
}
3030

3131
}

stikosekutilities2/Patches/PlayerStatusPatch.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

stikosekutilities2/Plugin.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BepInEx;
2+
using BepInEx.Logging;
23
using stikosekutilities2.Cheats;
34
using stikosekutilities2.UI;
45
using stikosekutilities2.Utils;
@@ -7,9 +8,10 @@
78
namespace stikosekutilities2
89
{
910
[BepInPlugin(PluginConstants.GUID, PluginConstants.Name, PluginConstants.Version)]
10-
public class Plugin : BaseUnityPlugin
11+
public class Plugin : MonoBehaviour
1112
{
1213
public static Plugin Instance { get; private set; }
14+
private static ManualLogSource Logger => Loader.Log;
1315

1416
private RainbowColor rainbow;
1517
private string waterMarkText;
@@ -18,21 +20,43 @@ private void Awake()
1820
{
1921
Instance = this;
2022

21-
waterMarkText = $"{PluginConstants.Name} {Loader.FormattedVersion} by JNNJ & stikosek";
23+
waterMarkText = $"{PluginConstants.Name} {Loader.FormattedVersion} by DevPacket";
2224

2325
// Add Windows
2426
GUIRenderer.AddWindow(WindowID.Player, "Player", new(70, 90, 320, 400));
2527
GUIRenderer.AddWindow(WindowID.Movement, "Movement", new(400, 90, 320, 400));
26-
GUIRenderer.AddWindow(WindowID.Items, "Items", new(730, 90, 400, 400));
27-
GUIRenderer.AddWindow(WindowID.Other, "Other", new(1140, 90, 320, 400));
28+
GUIRenderer.AddWindow(WindowID.Combat, "Combat", new(730, 90, 320, 400));
29+
GUIRenderer.AddWindow(WindowID.Other, "Other", new(1060, 90, 320, 400));
2830

2931
rainbow = new RainbowColor(.2f);
3032

3133
// Init rendering
3234
BaseCheat.ExecuteForAllModules(c => c.InitRender());
3335

34-
Logger.LogInfo($"Loaded {PluginConstants.Name} {Loader.FormattedVersion} by DevPacket! (H)");
36+
LogLoadedMessage();
37+
3538
}
39+
40+
private static void LogLoadedMessage()
41+
{
42+
string loaded = $"Loaded {PluginConstants.Name} {Loader.FormattedVersion} by DevPacket! (H)";
43+
string githubURL = $"GitHub URL: {PluginConstants.RepositoryURL}";
44+
45+
int lenght = (loaded.Length > githubURL.Length ? loaded.Length : githubURL.Length) + 1;
46+
47+
string placeHolder = "";
48+
49+
for (int i = 0; i < lenght; i++)
50+
placeHolder += '=';
51+
52+
Logger.LogError(placeHolder);
53+
54+
Logger.LogMessage(loaded);
55+
Logger.LogMessage(githubURL);
56+
57+
Logger.LogError(placeHolder);
58+
}
59+
3660
private void OnGUI()
3761
{
3862
// Draw ClickGUI

stikosekutilities2/UI/LayoutHelpers.cs

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using stikosekutilities2.Utils;
2-
using System.Collections.Generic;
32
using UnityEngine;
43

54
namespace stikosekutilities2.UI
@@ -10,8 +9,8 @@ public class LayoutHelpers
109
public static Color elec = Color.red;
1110

1211
private static GUIStyle
13-
horizontalSlider,
14-
horizontalSliderThumb;
12+
horizontalSlider = null,
13+
horizontalSliderThumb = null;
1514

1615
public static bool Toggle(string text, bool toggled)
1716
{
@@ -59,62 +58,48 @@ public static bool Button(string text)
5958
return clicked;
6059
}
6160

62-
public static bool ItemButton(Sprite sprite, Vector2 scrollPosition)
61+
public static float Slider(float minValue, float maxValue, float value)
6362
{
64-
Texture2D tex = sprite.texture;
65-
GUIContent content = new(tex);
63+
if (value < minValue)
64+
value = minValue;
6665

67-
Rect buttonRect = GUILayoutUtility.GetRect(content, GUI.skin.button, GUILayout.MaxHeight(69));
66+
if (value > maxValue)
67+
value = maxValue;
6868

69-
if(IsVisible(buttonRect, scrollPosition))
69+
if (horizontalSlider == null || horizontalSliderThumb == null)
7070
{
71-
DrawingUtil.DrawColor(elec, buttonRect);
71+
ResetSliderStyle();
72+
}
7273

73-
return GUI.Button(buttonRect, content);
74+
if (horizontalSlider.normal == null || horizontalSliderThumb.normal == null)
75+
{
76+
ResetSliderStyle();
7477
}
75-
76-
return false;
77-
}
7878

79-
private static bool IsVisible(Rect buttonRect, Vector2 scrollPosition)
80-
{
81-
WindowManager manager = GUIRenderer.GetWindow(WindowID.Items);
82-
if(buttonRect.yMax < manager.WindowRect.height + scrollPosition.y &&
83-
buttonRect.yMin > scrollPosition.y)
79+
if (horizontalSlider.normal.background == null || horizontalSliderThumb.normal.background == null)
8480
{
85-
return true;
81+
ResetSliderStyle();
8682
}
8783

88-
return false;
84+
return GUILayout.HorizontalSlider(value, minValue, maxValue, horizontalSlider, horizontalSliderThumb);
8985
}
9086

91-
public static float Slider(float minValue, float maxValue, float value)
87+
private static void ResetSliderStyle()
9288
{
93-
if (value < minValue)
94-
value = minValue;
95-
96-
if(value > maxValue)
97-
value = maxValue;
98-
99-
if (horizontalSlider == null || horizontalSliderThumb == null)
100-
{
101-
horizontalSlider = GUI.skin.horizontalSlider;
102-
horizontalSliderThumb = GUI.skin.horizontalSliderThumb;
89+
horizontalSlider = new(GUI.skin.horizontalSlider);
90+
horizontalSliderThumb = new(GUI.skin.horizontalSliderThumb);
10391

104-
ColorUtility.TryParseHtmlString(WindowManager.BorderHex, out Color sliderBackgroundColor);
105-
ColorUtility.TryParseHtmlString(ElementHex, out Color thumbBackgroundColor);
92+
ColorUtility.TryParseHtmlString(WindowManager.BorderHex, out Color sliderBackgroundColor);
93+
ColorUtility.TryParseHtmlString(ElementHex, out Color thumbBackgroundColor);
10694

107-
horizontalSlider.normal.background = DrawingUtil.ColoredTexture(sliderBackgroundColor);
95+
horizontalSlider.normal.background = DrawingUtil.ColoredTexture(sliderBackgroundColor);
10896

109-
Texture2D thumbTexture = DrawingUtil.ColoredTexture(thumbBackgroundColor);
97+
Texture2D thumbTexture = DrawingUtil.ColoredTexture(thumbBackgroundColor);
11098

111-
horizontalSliderThumb.normal.background = thumbTexture;
112-
horizontalSliderThumb.hover.background = thumbTexture;
113-
horizontalSliderThumb.active.background = thumbTexture;
114-
horizontalSliderThumb.focused.background = thumbTexture;
115-
}
116-
117-
return GUILayout.HorizontalSlider(value, minValue, maxValue, horizontalSlider, horizontalSliderThumb);
99+
horizontalSliderThumb.normal.background = thumbTexture;
100+
horizontalSliderThumb.hover.background = thumbTexture;
101+
horizontalSliderThumb.active.background = thumbTexture;
102+
horizontalSliderThumb.focused.background = thumbTexture;
118103
}
119104

120105
public static void Label(string text)

stikosekutilities2/UI/WindowID.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public enum WindowID
44
{
55
Player = 0,
66
Movement = 1,
7-
Items = 2,
7+
Combat = 2,
88
Other = 3
99
}
1010
}

0 commit comments

Comments
 (0)