mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
GetRoleHexColor
This commit is contained in:
1 parent
6095bdd860
commit
d4bb277bc0
5 files changed
+26
-6
No files matched your search
@@ -62,8 +62,7 @@ class BetterHostManager
|
||||
}
|
||||
else if (GameStates.IsInGame && !GameStates.IsLobby)
|
||||
{
|
||||
string RoleHexColor = player.IsImpostorTeam() ? "#ff1919" : "#8cffff";
|
||||
string Role = $"<color={RoleHexColor}>{player.GetRoleName()}</color>";
|
||||
string Role = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
|
||||
if (!player.IsImpostorTeam() && !target.IsImpostorTeam())
|
||||
{
|
||||
if (target.IsAlive() && player != target)
|
||||
|
||||
@@ -20,6 +20,15 @@ class EventLogManager
|
||||
else
|
||||
Logger.LogPrivate($"{__instance.Data.PlayerName} Has Un-Shapeshifted, did animate: {animate}", "EventLog");
|
||||
}
|
||||
[HarmonyPatch(nameof(PlayerControl.SetRoleInvisibility))]
|
||||
[HarmonyPostfix]
|
||||
public static void SetRoleInvisibility_Postfix(PlayerControl __instance, [HarmonyArgument(0)] bool isActive, [HarmonyArgument(1)] bool animate)
|
||||
{
|
||||
if (isActive)
|
||||
Logger.LogPrivate($"{__instance.Data.PlayerName} Has Vanished as Phantom, did animate: {animate}", "EventLog");
|
||||
else
|
||||
Logger.LogPrivate($"{__instance.Data.PlayerName} Has Appeared as Phantom, did animate: {animate}", "EventLog");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerPhysics))]
|
||||
|
||||
@@ -136,6 +136,20 @@ static class ExtendedPlayerControl
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Get hex color for team
|
||||
public static string GetTeamHexColor(this PlayerControl player)
|
||||
{
|
||||
if (player == null) return "#ffffff";
|
||||
|
||||
if (player.IsImpostorTeam())
|
||||
{
|
||||
return "#f00202";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#8cffff";
|
||||
}
|
||||
}
|
||||
// Check if player is on imposter team
|
||||
public static bool IsImpostorTeam(this PlayerControl player) => player?.Data != null && (player.Data.RoleType is RoleTypes.Impostor or RoleTypes.ImpostorGhost or RoleTypes.Shapeshifter or RoleTypes.Phantom);
|
||||
// Check if player is a imposter teammate
|
||||
|
||||
@@ -114,8 +114,7 @@ class ChatPatch
|
||||
string hashPuid = Utils.GetHashPuid(sourcePlayer);
|
||||
string friendCode = sourcePlayer.Data.FriendCode;
|
||||
string playerName = sourcePlayer.Data.PlayerName;
|
||||
string RoleHexColor = sourcePlayer.IsImpostorTeam() ? "#ff1919" : "#8cffff";
|
||||
string Role = $"<size=75%><color={RoleHexColor}>{sourcePlayer.GetRoleName()}</color></size>+++";
|
||||
string Role = $"<size=75%><color={sourcePlayer.GetTeamHexColor()}>{sourcePlayer.GetRoleName()}</color></size>+++";
|
||||
|
||||
if (GameStates.IsLobby && !GameStates.IsFreePlay)
|
||||
{
|
||||
|
||||
@@ -199,8 +199,7 @@ class PlayerControlPatch
|
||||
}
|
||||
else
|
||||
{
|
||||
string RoleHexColor = player.IsImpostorTeam() ? "#ff1919" : "#8cffff";
|
||||
string Role = $"<color={RoleHexColor}>{player.GetRoleName()}</color>";
|
||||
string Role = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
|
||||
if (!player.IsImpostorTeammate())
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.IsAlive() && player != PlayerControl.LocalPlayer)
|
||||
|
||||
Reference in new issue
Block a user