mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Role Color In Intro
This commit is contained in:
1 parent
5af7667c82
commit
7d8cf80dc8
5 files changed
+75
-14
No files matched your search
@@ -332,12 +332,6 @@ class AntiCheat
|
||||
// Check game states when sabotaging
|
||||
public static bool RpcUpdateSystemCheck(PlayerControl player, SystemTypes systemType, byte amount)
|
||||
{
|
||||
if (!GameStates.IsHost || PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.BetterData().IsBetterHost || !IsEnabled || !Main.AntiCheat.Value
|
||||
|| GameStates.IsBetterHostLobby && !GameStates.IsHost) return true;
|
||||
|
||||
// Needs fixing!
|
||||
return true;
|
||||
|
||||
byte hostNum = 128; // Only host should ever send this number
|
||||
byte singleFixNum = 0;
|
||||
byte minLightNum = 0;
|
||||
@@ -368,8 +362,7 @@ class AntiCheat
|
||||
}
|
||||
}
|
||||
|
||||
if (!GameStates.IsHost || PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer
|
||||
|| player.BetterData().IsBetterHost || !IsEnabled || !Main.AntiCheat.Value
|
||||
if (!GameStates.IsHost || PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.BetterData().IsBetterHost || !IsEnabled || !Main.AntiCheat.Value
|
||||
|| GameStates.IsBetterHostLobby && !GameStates.IsHost) return true;
|
||||
|
||||
// Single Fix: 0
|
||||
|
||||
+16
-1
@@ -22,7 +22,7 @@ enum CustomRPC : int
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.HandleRpc))]
|
||||
internal class RPCHandlerPatch
|
||||
internal class PlayerControlRPCHandlerPatch
|
||||
{
|
||||
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
|
||||
{
|
||||
@@ -58,6 +58,21 @@ internal class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.HandleRpc))]
|
||||
internal class PlayerPhysicsRPCHandlerPatch
|
||||
{
|
||||
public static void Prefix(PlayerPhysics __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
|
||||
{
|
||||
if (AntiCheat.CheckCancelRPC(__instance.myPlayer, callId, reader) != true)
|
||||
{
|
||||
Logger.LogCheat($"RPC canceled by Anti-Cheat: {Enum.GetName((RpcCalls)callId)}{Enum.GetName((CustomRPC)callId)} - {callId}");
|
||||
}
|
||||
|
||||
AntiCheat.CheckRPC(__instance.myPlayer, callId, reader);
|
||||
RPC.HandleRPC(__instance.myPlayer, callId, reader);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.UpdateSystem), typeof(SystemTypes), typeof(PlayerControl), typeof(MessageReader))]
|
||||
public static class MessageReaderUpdateSystemPatch
|
||||
{
|
||||
|
||||
@@ -132,6 +132,8 @@ public static class Utils
|
||||
|
||||
// Get name for role
|
||||
public static string GetRoleName(RoleTypes role) => Main.GetRoleName[(int)role];
|
||||
// Get color for role
|
||||
public static string GetRoleColor(RoleTypes role) => Main.GetRoleColor[(int)role];
|
||||
// Get hex color for team
|
||||
public static string GetTeamHexColor(RoleTeamTypes team)
|
||||
{
|
||||
|
||||
@@ -61,6 +61,42 @@ class GamePlayManager
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(IntroCutscene))]
|
||||
public class IntroCutscenePatch
|
||||
{
|
||||
[HarmonyPatch(nameof(IntroCutscene.ShowRole))]
|
||||
[HarmonyPostfix]
|
||||
private static void ShowRole_Postfix(IntroCutscene __instance)
|
||||
{
|
||||
static Color HexToColor(string hex)
|
||||
{
|
||||
if (hex.StartsWith("#"))
|
||||
{
|
||||
hex = hex.Substring(1);
|
||||
}
|
||||
|
||||
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
return new Color32(r, g, b, 255);
|
||||
}
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
Color RoleColor = HexToColor(Utils.GetRoleColor(PlayerControl.LocalPlayer.Data.RoleType));
|
||||
|
||||
__instance.ImpostorText.gameObject.SetActive(false);
|
||||
__instance.TeamTitle.gameObject.SetActive(false);
|
||||
__instance.FrontMost.gameObject.SetActive(false);
|
||||
__instance.BackgroundBar.material.color = RoleColor;
|
||||
__instance.YouAreText.color = RoleColor;
|
||||
__instance.RoleText.color = RoleColor;
|
||||
__instance.RoleBlurbText.color = RoleColor;
|
||||
}, 0.0025f, shoudLog: false);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameManager))]
|
||||
public class GameManagerPatch
|
||||
{
|
||||
|
||||
@@ -24,11 +24,11 @@ public class Main : BasePlugin
|
||||
{
|
||||
public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
public const string CanaryNum = "0";
|
||||
public const string HotfixNum = "2";
|
||||
public const bool IsHotFix = true;
|
||||
public const string HotfixNum = "0";
|
||||
public const bool IsHotFix = false;
|
||||
public const string PluginGuid = "com.d1gq.betteramongus";
|
||||
public const string PluginVersion = "1.0.4";
|
||||
public const string ReleaseDate = "08.20.2024"; // mm/dd/yyyy
|
||||
public const string PluginVersion = "1.0.5";
|
||||
public const string ReleaseDate = "08.21.2024"; // mm/dd/yyyy
|
||||
public const string Github = "https://github.com/D1GQ/BetterAmongUs-Public";
|
||||
public const string Discord = "https://discord.gg/vjYrXpzNAn";
|
||||
|
||||
@@ -99,7 +99,7 @@ public class Main : BasePlugin
|
||||
|
||||
public static PlayerControl[] AllAlivePlayerControls => AllPlayerControls.ToArray().Where(pc => pc.IsAlive()).ToArray();
|
||||
|
||||
public static Dictionary<int, string> GetRoleName = new Dictionary<int, string>
|
||||
public static Dictionary<int, string> GetRoleName => new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "Crewmate" },
|
||||
{ 1, "Impostor" },
|
||||
@@ -114,6 +114,21 @@ public class Main : BasePlugin
|
||||
{ 10, "Tracker" }
|
||||
};
|
||||
|
||||
public static Dictionary<int, string> GetRoleColor => new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "#8cffff" },
|
||||
{ 1, "#f00202" },
|
||||
{ 2, "#00d9d9" },
|
||||
{ 3, "#8f8f8f" },
|
||||
{ 4, "#8cffff" },
|
||||
{ 5, "#f06102" },
|
||||
{ 6, "#8cffff" },
|
||||
{ 7, "#f00202" },
|
||||
{ 8, "#fc7c7c" },
|
||||
{ 9, "#d100b9" },
|
||||
{ 10, "#59f002" }
|
||||
};
|
||||
|
||||
public static ManualLogSource Logger;
|
||||
public static DebugMenu debugmenu { get; set; } = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user