mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-19 15:51:59 +00:00
Dump command, fixes, reset start countdown
This commit is contained in:
1 parent
2b844e31a9
commit
b422d65b47
9 files changed
+151
-38
No files matched your search
+1
-11
@@ -24,11 +24,6 @@ public partial class Main : BasePlugin
|
||||
public static ConfigEntry<string> Preset3 { get; private set; }
|
||||
public static ConfigEntry<string> Preset4 { get; private set; }
|
||||
public static ConfigEntry<string> Preset5 { get; private set; }
|
||||
public static ConfigEntry<string> Preset6 { get; private set; }
|
||||
public static ConfigEntry<string> Preset7 { get; private set; }
|
||||
public static ConfigEntry<string> Preset8 { get; private set; }
|
||||
public static ConfigEntry<string> Preset9 { get; private set; }
|
||||
public static ConfigEntry<string> Preset10 { get; private set; }
|
||||
|
||||
public static ConfigEntry<bool> GM { get; private set; }
|
||||
public static ConfigEntry<bool> UnlockFps { get; private set; }
|
||||
@@ -40,7 +35,7 @@ public partial class Main : BasePlugin
|
||||
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
|
||||
public static bool HasArgumentException;
|
||||
public static string CredentialsText;
|
||||
public const string ModVersion = "v1.3.1";
|
||||
public const string ModVersion = "v1.3.2";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
@@ -78,11 +73,6 @@ public partial class Main : BasePlugin
|
||||
Preset3 = Config.Bind("Preset Name Options", "Preset3", "Preset 3");
|
||||
Preset4 = Config.Bind("Preset Name Options", "Preset4", "Preset 4");
|
||||
Preset5 = Config.Bind("Preset Name Options", "Preset5", "Preset 5");
|
||||
Preset6 = Config.Bind("Preset Name Options", "Preset6", "Preset 6");
|
||||
Preset7 = Config.Bind("Preset Name Options", "Preset7", "Preset 7");
|
||||
Preset8 = Config.Bind("Preset Name Options", "Preset8", "Preset 8");
|
||||
Preset9 = Config.Bind("Preset Name Options", "Preset9", "Preset 9");
|
||||
Preset10 = Config.Bind("Preset Name Options", "Preset10", "Preset 10");
|
||||
|
||||
AutoStart = Config.Bind("Client Options", "Auto Start", false);
|
||||
GM = Config.Bind("Client Options", "Game Master", false);
|
||||
|
||||
@@ -26,9 +26,7 @@ namespace AmongUsRevamped
|
||||
private static readonly string[] presets =
|
||||
{
|
||||
Main.Preset1.Value, Main.Preset2.Value, Main.Preset3.Value,
|
||||
Main.Preset4.Value, Main.Preset5.Value, Main.Preset6.Value,
|
||||
Main.Preset7.Value, Main.Preset8.Value, Main.Preset9.Value,
|
||||
Main.Preset10.Value
|
||||
Main.Preset4.Value, Main.Preset5.Value
|
||||
};
|
||||
|
||||
public static readonly string[] gameModes =
|
||||
|
||||
@@ -41,5 +41,12 @@ internal class Hotkeys
|
||||
{
|
||||
PlayerControl.LocalPlayer.Collider.enabled = !Input.GetKey(KeyCode.LeftControl);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C) && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening && Utils.IsLobby)
|
||||
{
|
||||
Logger.Info("Resetted start countdown", "KeyCommand");
|
||||
GameStartManager.Instance.ResetStartState();
|
||||
Logger.SendInGame("Starting countdown canceled");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static void SwitchPreset(int newPreset)
|
||||
{
|
||||
CurrentPreset = Math.Clamp(newPreset, 0, 9);
|
||||
CurrentPreset = Math.Clamp(newPreset, 0, 4);
|
||||
|
||||
foreach (var op in AllOptions)
|
||||
op.Refresh();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace AmongUsRevamped
|
||||
public PresetOptionItem(int defaultValue, TabGroup tab)
|
||||
: base(0, "Preset", defaultValue, tab, true)
|
||||
{
|
||||
Rule = (0, 9, 1);
|
||||
Rule = (0, 4, 1);
|
||||
}
|
||||
public static PresetOptionItem Create(int defaultValue, TabGroup tab)
|
||||
{
|
||||
@@ -27,11 +27,6 @@ namespace AmongUsRevamped
|
||||
2 => Main.Preset3.Value == (string)Main.Preset3.DefaultValue ? "Preset 3" : Main.Preset3.Value,
|
||||
3 => Main.Preset4.Value == (string)Main.Preset4.DefaultValue ? "Preset 4" : Main.Preset4.Value,
|
||||
4 => Main.Preset5.Value == (string)Main.Preset5.DefaultValue ? "Preset 5" : Main.Preset5.Value,
|
||||
5 => Main.Preset6.Value == (string)Main.Preset6.DefaultValue ? "Preset 6" : Main.Preset6.Value,
|
||||
6 => Main.Preset7.Value == (string)Main.Preset7.DefaultValue ? "Preset 7" : Main.Preset7.Value,
|
||||
7 => Main.Preset8.Value == (string)Main.Preset8.DefaultValue ? "Preset 8" : Main.Preset8.Value,
|
||||
8 => Main.Preset9.Value == (string)Main.Preset9.DefaultValue ? "Preset 9" : Main.Preset9.Value,
|
||||
9 => Main.Preset10.Value == (string)Main.Preset10.DefaultValue ? "Preset 10" : Main.Preset10.Value,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -388,4 +388,21 @@ public static class Utils
|
||||
HandlingGameEnd = false;
|
||||
Logger.Info(" -------- GAME ENDED --------", "ManualEndGame");
|
||||
}
|
||||
|
||||
public static void DumpLog()
|
||||
{
|
||||
string f = $"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}/AUR-logs/";
|
||||
string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");
|
||||
string filename = $"{f}AUR-{Main.ModVersion}-{t}.log";
|
||||
if (!Directory.Exists(f)) Directory.CreateDirectory(f);
|
||||
FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log");
|
||||
file.CopyTo(@filename);
|
||||
|
||||
if (PlayerControl.LocalPlayer != null)
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"/Dump command activated\n\nFile: AUR-{Main.ModVersion}-{t}");
|
||||
ProcessStartInfo psi = new("Explorer.exe") { Arguments = "/e,/select," + @filename.Replace("/", "\\") };
|
||||
Process.Start(psi);
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
-15
@@ -2,6 +2,8 @@
|
||||
using InnerNet;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
|
||||
namespace AmongUsRevamped;
|
||||
@@ -15,11 +17,38 @@ internal static class ChatControllerUpdatePatch
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.freeChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
|
||||
__instance.freeChatField.textArea.compoText.Color(Color.white);
|
||||
__instance.freeChatField.textArea.outputText.color = Color.white;
|
||||
|
||||
__instance.quickChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
|
||||
__instance.quickChatField.text.color = Color.white;
|
||||
}
|
||||
else __instance.freeChatField.textArea.outputText.color = Color.black;
|
||||
else
|
||||
{
|
||||
__instance.freeChatField.background.color = Color.white;
|
||||
__instance.freeChatField.textArea.compoText.Color(Color.black);
|
||||
__instance.freeChatField.textArea.outputText.color = Color.black;
|
||||
|
||||
__instance.quickChatField.background.color = Color.white;
|
||||
__instance.quickChatField.text.color = Color.black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ChatBubble), nameof(ChatBubble.SetName))]
|
||||
internal static class ChatBubbleSetNamePatch
|
||||
{
|
||||
public static void Postfix(ChatBubble __instance, [HarmonyArgument(2)] bool voted)
|
||||
{
|
||||
PlayerControl seer = PlayerControl.LocalPlayer;
|
||||
PlayerControl target = __instance.playerInfo.Object;
|
||||
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.Background.color = new(0.1f, 0.1f, 0.1f, 1f);
|
||||
__instance.TextArea.color = Color.white;
|
||||
if (__instance.playerInfo.Object.Data.IsDead && Utils.InGame) __instance.Background.color = new(0.1f, 0.1f, 0.1f, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +70,14 @@ internal static class SendChatPatch
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (text == "/dump")
|
||||
{
|
||||
Utils.DumpLog();
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{allCommandsFull}");
|
||||
@@ -102,23 +139,28 @@ internal static class SendChatPatch
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
else
|
||||
if (col1 || col2 || col3)
|
||||
{
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
string argCol = text.Substring(col1 ? 5 : col2 ? 7 : col3 ? 8 : 0).Trim();
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId))
|
||||
if (Utils.TryGetColorId(argCol, out byte colId) && (col1 || col2 || col3))
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetColor(colId);
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
bool isKick = text.StartsWith("/kick ");
|
||||
bool isBan = text.StartsWith("/ban ");
|
||||
|
||||
@@ -254,14 +296,12 @@ public static class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
if ((col1 || col2 || col3) && !Utils.InGame)
|
||||
{
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
string argCol = text.Substring(col1 ? 5 : col2 ? 7 : col3 ? 8 : 0).Trim();
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId))
|
||||
@@ -272,6 +312,9 @@ public static class RPCHandlerPatch
|
||||
__instance.RpcSetColor(colId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode)) return;
|
||||
// Banning works by name and color. Commands are seperated incase someone has a color as their name
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace AmongUsRevamped
|
||||
baseGameSetting = new StringGameSetting
|
||||
{
|
||||
Type = OptionTypes.String,
|
||||
Values = new StringNames[10],
|
||||
Values = new StringNames[5],
|
||||
Index = presetItem.GetInt(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
@@ -35,4 +37,65 @@ public static class GameStartManagerUpdatePatch
|
||||
CustomTimerApplied = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
string warningMessage = "";
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (warningMessage == "")
|
||||
{
|
||||
GameStartManagerStartPatch.warningText.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameStartManagerStartPatch.warningText.text = warningMessage;
|
||||
GameStartManagerStartPatch.warningText.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
__instance.GameStartText.transform.localPosition = new Vector3(__instance.GameStartText.transform.localPosition.x, 2f, __instance.GameStartText.transform.localPosition.z);
|
||||
GameStartManagerStartPatch.cancelButton.gameObject.SetActive(__instance.startState == GameStartManager.StartingStates.Countdown);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Start))]
|
||||
public class GameStartManagerStartPatch
|
||||
{
|
||||
public static TextMeshPro warningText;
|
||||
private static Vector3 GameStartTextlocalPosition;
|
||||
public static PassiveButton cancelButton;
|
||||
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
warningText = UnityEngine.Object.Instantiate(__instance.GameStartText, __instance.transform.parent);
|
||||
warningText.name = "WarningText";
|
||||
warningText.transform.localPosition = new(0f, __instance.transform.localPosition.y + 3f, -1f);
|
||||
warningText.gameObject.SetActive(false);
|
||||
|
||||
cancelButton = UnityEngine.Object.Instantiate(__instance.StartButton, __instance.transform);
|
||||
cancelButton.name = "CancelButton";
|
||||
var cancelLabel = cancelButton.buttonText;
|
||||
cancelLabel.DestroyTranslator();
|
||||
cancelLabel.text = "Cancel";
|
||||
//cancelButton.transform.localScale = new(0.5f, 0.5f, 1f);
|
||||
var cancelButtonInactiveRenderer = cancelButton.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonInactiveRenderer.color = new(0.8f, 0f, 0f, 1f);
|
||||
var cancelButtonActiveRenderer = cancelButton.activeSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonActiveRenderer.color = Color.red;
|
||||
var cancelButtonInactiveShine = cancelButton.inactiveSprites.transform.Find("Shine");
|
||||
if (cancelButtonInactiveShine)
|
||||
{
|
||||
cancelButtonInactiveShine.gameObject.SetActive(false);
|
||||
}
|
||||
cancelButton.activeTextColor = cancelButton.inactiveTextColor = Color.white;
|
||||
//cancelButton.transform.localPosition = new(2f, 0.13f, 0f);
|
||||
GameStartTextlocalPosition = __instance.GameStartText.transform.localPosition;
|
||||
cancelButton.OnClick = new();
|
||||
cancelButton.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
|
||||
{
|
||||
__instance.ResetStartState();
|
||||
}));
|
||||
cancelButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user