mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-19 15:51:59 +00:00
GM, Force/End Meeting, Fixes, Kick In Game
This commit is contained in:
1 parent
5eee7e98eb
commit
8d29a2ad84
8 files changed
+76
-17
No files matched your search
+2
-2
@@ -30,7 +30,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 = "v0.2.0";
|
||||
public const string ModVersion = "v0.4.0";
|
||||
|
||||
public static PlayerControl[] AllPlayerControls
|
||||
{
|
||||
@@ -68,7 +68,7 @@ public partial class Main : BasePlugin
|
||||
AutoStart = Config.Bind("Client Options", "Auto Start", false);
|
||||
DarkTheme = Config.Bind("Client Options", "Dark Theme", true);
|
||||
LobbyMusic = Config.Bind("Client Options", "Lobby Music", false);
|
||||
NoKcdMode = Config.Bind("Client Options", "0Kcd Mode", false);
|
||||
NoKcdMode = Config.Bind("Client Options", "0 Kill Cooldown", false);
|
||||
|
||||
BanManager.Init();
|
||||
|
||||
|
||||
@@ -158,4 +158,10 @@ public static class Utils
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ClientData GetClientById(int id)
|
||||
{
|
||||
try { return AmongUsClient.Instance.allClients.ToArray().FirstOrDefault(cd => cd.Id == id); }
|
||||
catch { return null; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using InnerNet;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -20,4 +21,35 @@ internal static class ChatControllerUpdatePatch
|
||||
}
|
||||
else __instance.freeChatField.textArea.outputText.color = Color.black;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(VoteBanSystem), nameof(VoteBanSystem.AddVote))]
|
||||
internal static class AddVotePatch
|
||||
{
|
||||
public static bool Prefix(VoteBanSystem __instance, [HarmonyArgument(0)] int srcClient, [HarmonyArgument(1)] int clientId)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
PlayerControl pc = Utils.GetClientById(srcClient)?.Character;
|
||||
PlayerControl target = Utils.GetClientById(clientId)?.Character;
|
||||
|
||||
if (AmongUsClient.Instance.ClientId == srcClient)
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, false);
|
||||
|
||||
Logger.Info($" Kicked {target.Data.PlayerName}, {target.Data.FriendCode}", "VoteKick");
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(VoteBanSystem), nameof(VoteBanSystem.CmdAddVote))]
|
||||
internal static class CmdAddVotePatch
|
||||
{
|
||||
public static bool Prefix([HarmonyArgument(0)] int clientId)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace HNSRevamped
|
||||
static void GMButtonToggle()
|
||||
{
|
||||
if (Main.GM.Value)
|
||||
HudManager.Instance.ShowPopUp("Hi there! GM hasn't been implemented yet. Sorry for the inconvenience! -MV");
|
||||
HudManager.Instance.ShowPopUp("You will now spectate games until GM is turned off.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace HNSRevamped
|
||||
LobbyMusic = ClientOptionItem.Create("Lobby Music", Main.LobbyMusic, __instance);
|
||||
|
||||
if (NoKcdMode == null || NoKcdMode.ToggleButton == null)
|
||||
NoKcdMode = ClientOptionItem.Create("0Kcd Mode", Main.NoKcdMode, __instance);
|
||||
NoKcdMode = ClientOptionItem.Create("0 Kill Cooldown", Main.NoKcdMode, __instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,5 +48,15 @@ internal class ControllerManagerUpdatePatch
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.M) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Return) && Utils.InGame)
|
||||
{
|
||||
if (Utils.IsMeeting)
|
||||
{
|
||||
MeetingHud.Instance.RpcClose();
|
||||
}
|
||||
else
|
||||
PlayerControl.LocalPlayer.ReportDeadBody(PlayerControl.LocalPlayer.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,6 @@ internal class KickPlayerPatch
|
||||
public static bool Prefix(InnerNetClient __instance, int clientId, bool ban)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
var HashedPuid = AmongUsClient.Instance.GetClient(clientId).GetHashedPuid();
|
||||
if (!AttemptedKickPlayerList.ContainsKey(HashedPuid))
|
||||
AttemptedKickPlayerList.Add(HashedPuid, 0);
|
||||
else if (AttemptedKickPlayerList[HashedPuid] < 10)
|
||||
{
|
||||
Logger.Fatal($"Kick player Request was too fast and has been canceled.", "KickPlayerPatch");
|
||||
return false;
|
||||
}
|
||||
if (ban) BanManager.AddBanPlayer(AmongUsClient.Instance.GetRecentClient(clientId));
|
||||
|
||||
return true;
|
||||
|
||||
@@ -50,7 +50,7 @@ public static class NumberOption_Initialize
|
||||
|
||||
if (Main.NoKcdMode.Value && !Utils.isHideNSeek)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0f;
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
Main.NormalOptions.DiscussionTime = 0;
|
||||
@@ -59,5 +59,10 @@ public static class NumberOption_Initialize
|
||||
Main.NormalOptions.NumShortTasks = 1;
|
||||
Main.NormalOptions.NumLongTasks = 0;
|
||||
}
|
||||
|
||||
if (!Main.NoKcdMode.Value && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,22 @@ internal class ApplyCustomImpostorCount
|
||||
{
|
||||
public static void Postfix(AmongUsClient __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || !Utils.isHideNSeek) return;
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
// Normal game = Impostor to prevent blocking task win. HNS = Crewmate to prevent Seeker detection range bugging.
|
||||
if (Main.GM.Value)
|
||||
{
|
||||
if (!Utils.isHideNSeek)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.ImpostorGhost, false);
|
||||
}
|
||||
if (Utils.isHideNSeek)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Utils.isHideNSeek) return;
|
||||
|
||||
int seekersCount = Options.NumSeekers.GetInt();
|
||||
|
||||
@@ -18,7 +33,7 @@ internal class ApplyCustomImpostorCount
|
||||
var candidates = new List<PlayerControl>();
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data.Role.TeamType != RoleTeamTypes.Impostor)
|
||||
if (p.Data.Role.TeamType != RoleTeamTypes.Impostor && !p.Data.IsDead)
|
||||
candidates.Add(p);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user