Skip to content

Commit

Permalink
Update more features and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scrim-dev committed Dec 7, 2024
1 parent 47bec8d commit 0e966b7
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 38 deletions.
19 changes: 14 additions & 5 deletions CatalyssMod/CatalyssMonoMod.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Networking.Types;
using UnityEngine.SceneManagement;
using UnityEngine;

namespace CatalyssMod
{
Expand All @@ -19,6 +15,7 @@ private void Update()
private void OnGUI()
{
GUI.Label(new Rect(15f, 25f, 360f, 90f), $"<size=15><color=magenta>Catalyss is Loaded!</color></size>");
if (HandleItemDropMenu) { return; }
if (Entry.GuiTog)
{
Entry.GuiRect = GUI.Window(0, Entry.GuiRect, ModGUI, $"<color=magenta>Catalyss</color> <color=white>v{Entry.ModVersion}</color>");
Expand Down Expand Up @@ -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 = "<color=red>OFF</color>";

public static int MenuPage = 1;

void ModGUI(int WindowId)
{
switch (MenuPage)
Expand Down Expand Up @@ -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;
}

Expand Down
11 changes: 5 additions & 6 deletions CatalyssMod/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Utils>();
ModObj.AddComponent<CatalyssMonoMod>();
ModObj.AddComponent<CatalyssMonoMod>();
ModObj.AddComponent<ExtraGUIs>();
UnityEngine.Object.DontDestroyOnLoad(ModObj);
}

public static void Unload()
{
UnityEngine.Object.Destroy(ModObj);
}
public static void Unload() { UnityEngine.Object.Destroy(ModObj); }
}
}
41 changes: 33 additions & 8 deletions CatalyssMod/ExtraGUIs.cs
Original file line number Diff line number Diff line change
@@ -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.
}
}
}
}
}
55 changes: 36 additions & 19 deletions CatalyssMod/Utils.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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()
{
Expand Down Expand Up @@ -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<PlayerVisual>().Rpc_VanitySparkleEffect();
break;
case 1:
GetPlayer().GetComponentInChildren<PlayerVisual>().Rpc_PoofSmokeEffect();
break;
case 2:
GetPlayer().GetComponentInChildren<PlayerVisual>().Rpc_PlayTeleportEffect();
break;
default:
GetPlayer().GetComponentInChildren<PlayerVisual>().Rpc_VanitySparkleEffect();
GetPlayer().GetComponentInChildren<PlayerVisual>().Rpc_PoofSmokeEffect();
GetPlayer().GetComponentInChildren<PlayerVisual>().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<PlayerInventory>().Add_Item(item);
GetPlayer().GetComponentInChildren<PlayerInventory>().Cmd_DropItem(item, amount);
}
catch { return; }
}

Expand Down

0 comments on commit 0e966b7

Please sign in to comment.