From 0e966b77ea855875c223fe3e2ae715cb86f53407 Mon Sep 17 00:00:00 2001 From: Scrim <105956702+scrim-dev@users.noreply.github.com> Date: Sat, 7 Dec 2024 02:15:51 -0400 Subject: [PATCH] Update more features and fixes --- CatalyssMod/CatalyssMonoMod.cs | 19 ++++++++---- CatalyssMod/Entry.cs | 11 ++++--- CatalyssMod/ExtraGUIs.cs | 41 ++++++++++++++++++++----- CatalyssMod/Utils.cs | 55 ++++++++++++++++++++++------------ 4 files changed, 88 insertions(+), 38 deletions(-) diff --git a/CatalyssMod/CatalyssMonoMod.cs b/CatalyssMod/CatalyssMonoMod.cs index caa97ad..20df60f 100644 --- a/CatalyssMod/CatalyssMonoMod.cs +++ b/CatalyssMod/CatalyssMonoMod.cs @@ -1,8 +1,4 @@ -using System.Diagnostics; -using System.Runtime.InteropServices; -using UnityEngine; -using UnityEngine.Networking.Types; -using UnityEngine.SceneManagement; +using UnityEngine; namespace CatalyssMod { @@ -19,6 +15,7 @@ private void Update() private void OnGUI() { GUI.Label(new Rect(15f, 25f, 360f, 90f), $"Catalyss is Loaded!"); + if (HandleItemDropMenu) { return; } if (Entry.GuiTog) { Entry.GuiRect = GUI.Window(0, Entry.GuiRect, ModGUI, $"Catalyss v{Entry.ModVersion}"); @@ -70,9 +67,11 @@ private void OnGUI() private int ExpPointAmount { get; set; } = 10; public static bool InfManaTog { get; set; } = false; + public static bool HandleItemDropMenu { get; set; } = false; public string InfManaText = "OFF"; public static int MenuPage = 1; + void ModGUI(int WindowId) { switch (MenuPage) @@ -499,6 +498,16 @@ void ModGUI(int WindowId) } } + if (GUI.Button(new Rect(20, 190, 300, 30), "Item Drop Menu")) + { + HandleItemDropMenu = !HandleItemDropMenu; + } + + if (GUI.Button(new Rect(20, 230, 300, 30), "Glam")) + { + Utils.SendFX(3); //Idk lol + } + break; } diff --git a/CatalyssMod/Entry.cs b/CatalyssMod/Entry.cs index 96b3c26..1de1562 100644 --- a/CatalyssMod/Entry.cs +++ b/CatalyssMod/Entry.cs @@ -5,21 +5,20 @@ namespace CatalyssMod public class Entry { public static GameObject? ModObj; - public const string ModVersion = "1.2"; + public const string ModVersion = "1.4"; public static Rect GuiRect = new(15, 15, 700, 600); public static bool GuiTog { get; set; } = false; + public static bool DebuggerGUI { get; set; } = false; public static void Load() { ModObj = new GameObject(); ModObj.AddComponent(); - ModObj.AddComponent(); + ModObj.AddComponent(); + ModObj.AddComponent(); UnityEngine.Object.DontDestroyOnLoad(ModObj); } - public static void Unload() - { - UnityEngine.Object.Destroy(ModObj); - } + public static void Unload() { UnityEngine.Object.Destroy(ModObj); } } } diff --git a/CatalyssMod/ExtraGUIs.cs b/CatalyssMod/ExtraGUIs.cs index 3962164..008b5b8 100644 --- a/CatalyssMod/ExtraGUIs.cs +++ b/CatalyssMod/ExtraGUIs.cs @@ -1,17 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; +using UnityEngine; namespace CatalyssMod { internal class ExtraGUIs : MonoBehaviour { + private string inputText; + private readonly float Offset = 2f; + public static float S_SliderValue = 1f; + public void OnGUI() { - //To do + if (CatalyssMonoMod.HandleItemDropMenu) + { + GUI.backgroundColor = Color.gray; + GUI.contentColor = Color.magenta; + GUI.color = Color.magenta; + + GUI.Box(new Rect(10, 25 * Offset, 350, 350), "Items Menu"); + + GUI.Label(new Rect(20, 40 * Offset, 100, 80), "Item to drop:\n(Increase slider for amount)"); + inputText = GUI.TextField(new Rect(120, 40 * Offset, 200, 20), inputText); + S_SliderValue = GUI.HorizontalSlider(new Rect(125, 55 * Offset, 140, 30), S_SliderValue, 0f, 200f); + + if (GUI.Button(new Rect(20, 67 * Offset, 100, 30), "Submit")) + { + Utils.DropNewItem(inputText, (int)S_SliderValue); + } + + if (GUI.Button(new Rect(20, 85 * Offset, 100, 30), "Go Back")) + { + CatalyssMonoMod.HandleItemDropMenu = false; + } + } + + if (Entry.DebuggerGUI) + { + //For testing I usually remove code in here. + } } } -} +} \ No newline at end of file diff --git a/CatalyssMod/Utils.cs b/CatalyssMod/Utils.cs index 6da72d7..b6d49b8 100644 --- a/CatalyssMod/Utils.cs +++ b/CatalyssMod/Utils.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using UnityEngine.PlayerLoop; -using UnityEngine.UIElements; +using UnityEngine; namespace CatalyssMod { @@ -15,10 +7,7 @@ internal class Utils : MonoBehaviour //Helper class for other game stuff public static Player GetPlayer() { return Player._mainPlayer; } - private void Awake() - { - //To do - } + private void Awake() { Application.targetFrameRate = 999; } private void Start() { @@ -87,16 +76,44 @@ public static void Spin(float speed_val) } } - public static void JoinPlyrByID() + public static void SendFX(int opt) { - try - { - string s = File.ReadAllText($"{Directory.GetCurrentDirectory}\\PlayerSteamID.txt"); - if (s.Length > 0) + if (GetPlayer() != null) + { + switch(opt) { - //To do + case 0: + GetPlayer().GetComponentInChildren().Rpc_VanitySparkleEffect(); + break; + case 1: + GetPlayer().GetComponentInChildren().Rpc_PoofSmokeEffect(); + break; + case 2: + GetPlayer().GetComponentInChildren().Rpc_PlayTeleportEffect(); + break; + default: + GetPlayer().GetComponentInChildren().Rpc_VanitySparkleEffect(); + GetPlayer().GetComponentInChildren().Rpc_PoofSmokeEffect(); + GetPlayer().GetComponentInChildren().Rpc_PlayTeleportEffect(); + break; } } + } + + public static void DropNewItem(string itemname, int amount) + { + try + { + var item = new ItemData() + { + _slotNumber = 0, + _itemName = itemname, + _isEquipped = false, + _maxQuantity = amount + }; + GetPlayer().GetComponentInChildren().Add_Item(item); + GetPlayer().GetComponentInChildren().Cmd_DropItem(item, amount); + } catch { return; } }