mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
some fixes
This commit is contained in:
1 parent
5148f8370d
commit
7446fa7b3f
11 files changed
+237
-224
No files matched your search
@@ -715,7 +715,7 @@ public static class CaptureTheFlag
|
||||
|
||||
switch (timeLeft)
|
||||
{
|
||||
case <= 1 when TeamData[CTFTeam.Blue].RoundsWon != TeamData[CTFTeam.Yellow].RoundsWon:
|
||||
case <= 1 when TeamData.Count == 2 && TeamData[CTFTeam.Blue].RoundsWon != TeamData[CTFTeam.Yellow].RoundsWon:
|
||||
{
|
||||
CTFTeamData winner = TeamData.Values.MaxBy(x => x.RoundsWon);
|
||||
winner.SetAsWinner();
|
||||
|
||||
+38
-17
@@ -142,13 +142,13 @@ public static class Deathrace
|
||||
.SetGameMode(gameMode)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
PowerUpEffectDurationOption = new IntegerOptionItem(id++, "Deathrace.PowerUpEffectDurationOption", new(1, 60, 1), 3, tab)
|
||||
PowerUpEffectDurationOption = new IntegerOptionItem(id++, "Deathrace.PowerUpEffectDurationOption", new(1, 60, 1), 5, tab)
|
||||
.SetParent(SpawnPowerUpsOption)
|
||||
.SetColor(color)
|
||||
.SetGameMode(gameMode)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
PowerUpEffectRangeOption = new FloatOptionItem(id++, "Deathrace.PowerUpEffectRangeOption", new(0.25f, 10f, 0.25f), 4f, tab)
|
||||
PowerUpEffectRangeOption = new FloatOptionItem(id++, "Deathrace.PowerUpEffectRangeOption", new(0.25f, 10f, 0.25f), 5f, tab)
|
||||
.SetParent(SpawnPowerUpsOption)
|
||||
.SetColor(color)
|
||||
.SetGameMode(gameMode)
|
||||
@@ -166,7 +166,7 @@ public static class Deathrace
|
||||
.SetGameMode(gameMode)
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
|
||||
PowerUpPickupRangeOption = new FloatOptionItem(id, "Deathrace.PowerUpPickupRangeOption", new(0.1f, 5f, 0.1f), 0.8f, tab)
|
||||
PowerUpPickupRangeOption = new FloatOptionItem(id, "Deathrace.PowerUpPickupRangeOption", new(0.1f, 5f, 0.1f), 1f, tab)
|
||||
.SetParent(SpawnPowerUpsOption)
|
||||
.SetColor(color)
|
||||
.SetGameMode(gameMode)
|
||||
@@ -239,6 +239,9 @@ public static class Deathrace
|
||||
yield return new WaitForSeconds(4f);
|
||||
NameNotifyManager.Reset();
|
||||
}
|
||||
|
||||
if (Main.CurrentMap == MapNames.Airship)
|
||||
players.MassTP(new RandomSpawn.AirshipSpawnMap().Positions[Clockwise ? Track[^1] : Track[0]]);
|
||||
}
|
||||
else if (Main.CurrentMap == MapNames.Airship)
|
||||
{
|
||||
@@ -393,9 +396,13 @@ public static class Deathrace
|
||||
{
|
||||
case PowerUp.Smoke:
|
||||
{
|
||||
playersInRange = playersInRange.Where(x => !Mathf.Approximately(Main.AllPlayerSpeed[x.PlayerId], Main.MinSpeed)).ToArray();
|
||||
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
Main.AllPlayerSpeed[player.PlayerId] -= SmokeSpeedReduction;
|
||||
if (Main.AllPlayerSpeed[player.PlayerId] < 0f) Main.AllPlayerSpeed[player.PlayerId] += SmokeSpeedReduction;
|
||||
else Main.AllPlayerSpeed[player.PlayerId] -= SmokeSpeedReduction;
|
||||
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -404,7 +411,10 @@ public static class Deathrace
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
if (player == null) continue;
|
||||
Main.AllPlayerSpeed[player.PlayerId] += SmokeSpeedReduction;
|
||||
|
||||
if (Main.AllPlayerSpeed[player.PlayerId] < 0f) Main.AllPlayerSpeed[player.PlayerId] -= SmokeSpeedReduction;
|
||||
else Main.AllPlayerSpeed[player.PlayerId] += SmokeSpeedReduction;
|
||||
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
}, PowerUpEffectDuration, $"Smoke Revert ({Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, $"ID {pc.PlayerId}")})");
|
||||
@@ -412,13 +422,15 @@ public static class Deathrace
|
||||
}
|
||||
case PowerUp.EnergyDrink:
|
||||
{
|
||||
Main.AllPlayerSpeed[pc.PlayerId] += EnergyDrinkSpeedIncreasement;
|
||||
if (Main.AllPlayerSpeed[pc.PlayerId] < 0f) Main.AllPlayerSpeed[pc.PlayerId] -= EnergyDrinkSpeedIncreasement;
|
||||
else Main.AllPlayerSpeed[pc.PlayerId] += EnergyDrinkSpeedIncreasement;
|
||||
pc.MarkDirtySettings();
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (pc == null || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod))) return;
|
||||
Main.AllPlayerSpeed[pc.PlayerId] -= EnergyDrinkSpeedIncreasement;
|
||||
if (pc == null || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod)) || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.MinSpeed)) return;
|
||||
if (Main.AllPlayerSpeed[pc.PlayerId] < 0f) Main.AllPlayerSpeed[pc.PlayerId] += EnergyDrinkSpeedIncreasement;
|
||||
else Main.AllPlayerSpeed[pc.PlayerId] -= EnergyDrinkSpeedIncreasement;
|
||||
pc.MarkDirtySettings();
|
||||
}, PowerUpEffectDuration, $"Energy Drink Revert ({Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, $"ID {pc.PlayerId}")})");
|
||||
break;
|
||||
@@ -455,7 +467,7 @@ public static class Deathrace
|
||||
{
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
if (player == null || Main.AllPlayerSpeed[player.PlayerId] > 0f) continue;
|
||||
if (player == null || Main.AllPlayerSpeed[player.PlayerId] >= 0f) continue;
|
||||
Main.AllPlayerSpeed[player.PlayerId] *= -1;
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
@@ -504,7 +516,11 @@ public static class Deathrace
|
||||
bool coordinateCheck = CoordinateChecks.TryGetValue((int)data.NextRoom, out var coordinates);
|
||||
if (room != null && room.RoomId is SystemTypes.Hallway or SystemTypes.Outside or SystemTypes.Decontamination2 or SystemTypes.Decontamination3) room = null;
|
||||
|
||||
if ((room == null && !coordinateCheck) || (room != null && room.RoomId == data.LastRoom)) continue;
|
||||
if ((room == null && !coordinateCheck) || (room != null && room.RoomId == data.LastRoom))
|
||||
{
|
||||
CheckAndNotify(data);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (coordinateCheck ? Vector2.Distance(coordinates, data.Player.Pos()) < 2f : room.RoomId == data.NextRoom)
|
||||
{
|
||||
@@ -555,17 +571,22 @@ public static class Deathrace
|
||||
|
||||
if (data.Player.AmOwner) continue;
|
||||
|
||||
string suffix = GetSuffix(data.Player, data.Player, false);
|
||||
|
||||
if (data.LastSuffix != suffix)
|
||||
{
|
||||
Utils.NotifyRoles(SpecifySeer: data.Player, SpecifyTarget: data.Player);
|
||||
data.LastSuffix = suffix;
|
||||
}
|
||||
CheckAndNotify(data);
|
||||
}
|
||||
|
||||
Data.Remove(removeId);
|
||||
}
|
||||
|
||||
private static void CheckAndNotify(PlayerData data)
|
||||
{
|
||||
string suffix = GetSuffix(data.Player, data.Player, false);
|
||||
|
||||
if (data.LastSuffix != suffix)
|
||||
{
|
||||
Utils.NotifyRoles(SpecifySeer: data.Player, SpecifyTarget: data.Player);
|
||||
data.LastSuffix = suffix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Racer : RoleBase
|
||||
|
||||
@@ -134,7 +134,7 @@ internal static class ExtendedPlayerControl
|
||||
public static void RevertFreeze(this PlayerControl pc, Vector2 realPosition)
|
||||
{
|
||||
pc.NetTransform.SnapTo(realPosition, (ushort)(pc.NetTransform.lastSequenceId + 128));
|
||||
CustomRpcSender sender = CustomRpcSender.Create("Explosivist Revert", SendOption.Reliable);
|
||||
CustomRpcSender sender = CustomRpcSender.Create($"Revert SnapTo Freeze ({pc.GetNameWithRole()})", SendOption.Reliable);
|
||||
sender.StartMessage();
|
||||
sender.StartRpc(pc.NetTransform.NetId, (byte)RpcCalls.SnapTo)
|
||||
.WriteVector2(pc.transform.position)
|
||||
@@ -159,7 +159,7 @@ internal static class ExtendedPlayerControl
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (pc == player || pc.AmOwner) continue;
|
||||
CustomRpcSender sender = CustomRpcSender.Create("Explosivist", SendOption.Reliable);
|
||||
CustomRpcSender sender = CustomRpcSender.Create($"SnapTo Freeze ({player.GetNameWithRole()})", SendOption.Reliable);
|
||||
sender.StartMessage(pc.GetClientId());
|
||||
sender.StartRpc(player.NetTransform.NetId, (byte)RpcCalls.SnapTo)
|
||||
.WriteVector2(player.transform.position)
|
||||
@@ -191,6 +191,14 @@ internal static class ExtendedPlayerControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.IsModdedClient())
|
||||
{
|
||||
var msg = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetChatVisible, SendOption.Reliable, player.OwnerId);
|
||||
msg.Write(visible);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
bool dead = player.Data.IsDead;
|
||||
MessageWriter writer = MessageWriter.Get(SendOption.Reliable);
|
||||
writer.StartMessage(6);
|
||||
@@ -297,25 +305,6 @@ internal static class ExtendedPlayerControl
|
||||
return state.countTypes;
|
||||
}
|
||||
|
||||
// By TommyXL
|
||||
public static void RpcSetPetDesync(this PlayerControl player, string petId, PlayerControl seer)
|
||||
{
|
||||
int clientId = seer.OwnerId;
|
||||
if (clientId == -1) return;
|
||||
|
||||
if (AmongUsClient.Instance.ClientId == clientId)
|
||||
{
|
||||
player.SetPet(petId);
|
||||
return;
|
||||
}
|
||||
|
||||
player.Data.DefaultOutfit.PetSequenceId += 10;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SetPetStr, SendOption.Reliable, clientId);
|
||||
writer.Write(petId);
|
||||
writer.Write(player.GetNextRpcSequenceId(RpcCalls.SetPetStr));
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public static void RpcResetTasks(this PlayerControl player, bool init = true)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || !GameStates.IsInGame || player == null) return;
|
||||
|
||||
+11
-2
@@ -163,6 +163,7 @@ public enum CustomRPC
|
||||
ImitatorClick,
|
||||
Invisibility,
|
||||
ResetAbilityCooldown,
|
||||
SetChatVisible,
|
||||
|
||||
// Game Modes
|
||||
RoomRushDataSync,
|
||||
@@ -248,17 +249,19 @@ internal static class RPCHandlerPatch
|
||||
|
||||
private static bool CheckRateLimit(PlayerControl __instance, RpcCalls rpcType)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || __instance.AmOwner || (__instance.IsModdedClient() && rpcType == RpcCalls.SendChat)) return true;
|
||||
|
||||
if (NumRPCsThisSecond.TryAdd(__instance.PlayerId, [])) LateTask.New(() => NumRPCsThisSecond.Remove(__instance.PlayerId), 1f, log: false);
|
||||
Dictionary<RpcCalls, int> calls = NumRPCsThisSecond[__instance.PlayerId];
|
||||
if (!calls.TryAdd(rpcType, 1)) calls[rpcType]++;
|
||||
|
||||
if (AmongUsClient.Instance.AmHost && !__instance.IsHost() && !(__instance.IsModdedClient() && rpcType == RpcCalls.SendChat) && (!RateLimitWhiteList.TryGetValue(__instance.PlayerId, out long expireTS) || expireTS < Utils.TimeStamp) && RpcRateLimit.TryGetValue(rpcType, out int limit) && calls[rpcType] > limit)
|
||||
if ((!RateLimitWhiteList.TryGetValue(__instance.PlayerId, out long expireTS) || expireTS < Utils.TimeStamp) && RpcRateLimit.TryGetValue(rpcType, out int limit) && calls[rpcType] > limit)
|
||||
{
|
||||
bool kick = Options.EnableEHRRateLimit.GetBool();
|
||||
if (kick) AmongUsClient.Instance.KickPlayer(__instance.OwnerId, false);
|
||||
Logger.SendInGame(string.Format(GetString("Warning.TooManyRPCs"), kick ? __instance.Data?.PlayerName : "Someone"), Color.yellow);
|
||||
Logger.Warn($"Sent {calls[rpcType]} RPCs of type {rpcType} ({(byte)rpcType}), which exceeds the limit of {limit}. Kicking player.", "Kick");
|
||||
return false;
|
||||
return !kick;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1340,6 +1343,12 @@ internal static class RPCHandlerPatch
|
||||
PlayerControl.LocalPlayer.Data.Role.SetCooldown();
|
||||
break;
|
||||
}
|
||||
case CustomRPC.SetChatVisible:
|
||||
{
|
||||
HudManager.Instance.Chat.SetVisible(reader.ReadBoolean());
|
||||
HudManager.Instance.Chat.HideBanButton();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
|
||||
+1
-1
@@ -1599,7 +1599,7 @@ public static class Utils
|
||||
|
||||
foreach ((byte id, PlayerState state) in Main.PlayerStates)
|
||||
{
|
||||
if (state.RoleHistory.Count > 1)
|
||||
if (state.RoleHistory.Count > 0)
|
||||
{
|
||||
string join = string.Join(" > ", state.RoleHistory.ConvertAll(x => x.ToColoredString()));
|
||||
sb.AppendLine($"{id.ColoredPlayerName()}: {join} > {state.MainRole.ToColoredString()}");
|
||||
|
||||
@@ -39,8 +39,7 @@ public class DiscordRPC
|
||||
activity.Details = details;
|
||||
}
|
||||
}
|
||||
|
||||
catch (ArgumentException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("Error in updating discord rpc", "DiscordPatch");
|
||||
Logger.Exception(ex, "DiscordPatch");
|
||||
|
||||
@@ -19,8 +19,9 @@ internal static class ExileControllerWrapUpPatch
|
||||
|
||||
public static void WrapUpPostfix(NetworkedPlayerInfo exiled)
|
||||
{
|
||||
var decidedWinner = false;
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var decidedWinner = false;
|
||||
|
||||
if (!Collector.CollectorWin(false) && exiled != null)
|
||||
{
|
||||
@@ -69,8 +70,6 @@ internal static class ExileControllerWrapUpPatch
|
||||
|
||||
if (Executioner.CheckExileTarget(exiled)) decidedWinner = true;
|
||||
|
||||
if (Lawyer.CheckExileTarget(exiled /*, DecidedWinner*/)) decidedWinner = false;
|
||||
|
||||
if (CustomWinnerHolder.WinnerTeam != CustomWinner.Terrorist)
|
||||
Main.PlayerStates[exiled.PlayerId].SetDead();
|
||||
}
|
||||
@@ -102,6 +101,8 @@ internal static class ExileControllerWrapUpPatch
|
||||
|
||||
FallFromLadder.Reset();
|
||||
Utils.CountAlivePlayers(true);
|
||||
|
||||
if (decidedWinner) GameEndChecker.CheckCustomEndCriteria();
|
||||
|
||||
if (exiled == null) return;
|
||||
byte id = exiled.PlayerId;
|
||||
@@ -226,7 +227,7 @@ internal static class ExileControllerWrapUpPatch
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PbExileController), nameof(PbExileController.PlayerSpin))]
|
||||
internal class PolusExileHatFixPatch
|
||||
internal static class PolusExileHatFixPatch
|
||||
{
|
||||
public static void Prefix(PbExileController __instance)
|
||||
{
|
||||
|
||||
+167
-170
@@ -17,7 +17,7 @@ namespace EHR;
|
||||
// Patch for non-host modded clients to ensure that the intro cutscene is shown correctly
|
||||
// and GameStates.InGame is set to true
|
||||
#if ANDROID
|
||||
[HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene))]
|
||||
[HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.ShowRole))]
|
||||
static class ShowRoleMoveNextPatchAndroid
|
||||
{
|
||||
public static void Postfix(IntroCutscene __instance)
|
||||
@@ -156,178 +156,175 @@ internal static class SetUpRoleTextPatch
|
||||
|
||||
PlayerControl lp = PlayerControl.LocalPlayer;
|
||||
|
||||
LateTask.New(() =>
|
||||
Main.Instance.StartCoroutine(LogGameInfo());
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
{
|
||||
Main.Instance.StartCoroutine(LogGameInfo());
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
case CustomGameMode.SoloKombat:
|
||||
{
|
||||
case CustomGameMode.SoloKombat:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#f55252", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("SoloKombat");
|
||||
__instance.RoleText.color = Utils.GetRoleColor(lp.GetCustomRole());
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = lp.GetRoleInfo();
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.FFA:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#00ffff", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Killer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("KillerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.MoveAndStop:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#00ffa5", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("MoveAndStop");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("TaskerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.HotPotato:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#e8cd46", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("HotPotato");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("PotatoInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Speedrun:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.Speedrunner);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Runner");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RunnerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.CaptureTheFlag:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#1313c2", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("CTFPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("CTFPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.NaturalDisasters:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#03fc4a", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("NDPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("NDPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.RoomRush:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#ffab1b", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("RRPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RRPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.KingOfTheZones:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#ff0000", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("KOTZPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("KOTZPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Quiz:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.QuizMaster);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("QuizPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("QuizPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.TheMindGame:
|
||||
{
|
||||
Color color = Color.yellow;
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("TMGPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("TMGPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.BedWars:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.BedWarsPlayer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("BedWarsPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("BedWarsPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Deathrace:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.Racer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Racer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RacerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Mingle:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.MinglePlayer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("MinglePlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("MinglePlayerInfo");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CustomRoles role = lp.GetCustomRole();
|
||||
|
||||
var s = Main.PlayerStates[lp.PlayerId].SubRoles;
|
||||
|
||||
if (!role.IsVanilla())
|
||||
{
|
||||
__instance.YouAreText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleText.text = Utils.GetRoleName(role);
|
||||
__instance.RoleText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleBlurbText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleBlurbText.text = (s.Count > 0 ? "<size=50%>" : string.Empty) + lp.GetRoleInfo() + (s.Count > 0 ? "</size>" : string.Empty);
|
||||
}
|
||||
|
||||
foreach (CustomRoles subRole in s)
|
||||
{
|
||||
if (role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor && subRole == CustomRoles.Lovers) continue;
|
||||
__instance.RoleBlurbText.text += "\n<size=30%>" + Utils.ColorString(Utils.GetRoleColor(subRole), GetString($"{subRole}Info"));
|
||||
}
|
||||
|
||||
__instance.RoleText.text += Utils.GetSubRolesText(lp.PlayerId, false, true);
|
||||
break;
|
||||
}
|
||||
Color color = ColorUtility.TryParseHtmlString("#f55252", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("SoloKombat");
|
||||
__instance.RoleText.color = Utils.GetRoleColor(lp.GetCustomRole());
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = lp.GetRoleInfo();
|
||||
break;
|
||||
}
|
||||
}, 0f, "Override Role Text");
|
||||
case CustomGameMode.FFA:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#00ffff", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Killer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("KillerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.MoveAndStop:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#00ffa5", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("MoveAndStop");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("TaskerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.HotPotato:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#e8cd46", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("HotPotato");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("PotatoInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Speedrun:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.Speedrunner);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Runner");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RunnerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.CaptureTheFlag:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#1313c2", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("CTFPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("CTFPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.NaturalDisasters:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#03fc4a", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("NDPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("NDPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.RoomRush:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#ffab1b", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("RRPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RRPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.KingOfTheZones:
|
||||
{
|
||||
Color color = ColorUtility.TryParseHtmlString("#ff0000", out Color c) ? c : new(255, 255, 255, 255);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("KOTZPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("KOTZPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Quiz:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.QuizMaster);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("QuizPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("QuizPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.TheMindGame:
|
||||
{
|
||||
Color color = Color.yellow;
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("TMGPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("TMGPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.BedWars:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.BedWarsPlayer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("BedWarsPlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("BedWarsPlayerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Deathrace:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.Racer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("Racer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("RacerInfo");
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.Mingle:
|
||||
{
|
||||
Color color = Utils.GetRoleColor(CustomRoles.MinglePlayer);
|
||||
__instance.YouAreText.transform.gameObject.SetActive(false);
|
||||
__instance.RoleText.text = GetString("MinglePlayer");
|
||||
__instance.RoleText.color = color;
|
||||
__instance.RoleBlurbText.color = color;
|
||||
__instance.RoleBlurbText.text = GetString("MinglePlayerInfo");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CustomRoles role = lp.GetCustomRole();
|
||||
|
||||
var s = Main.PlayerStates[lp.PlayerId].SubRoles;
|
||||
|
||||
if (!role.IsVanilla())
|
||||
{
|
||||
__instance.YouAreText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleText.text = Utils.GetRoleName(role);
|
||||
__instance.RoleText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleBlurbText.color = Utils.GetRoleColor(role);
|
||||
__instance.RoleBlurbText.text = (s.Count > 0 ? "<size=50%>" : string.Empty) + lp.GetRoleInfo() + (s.Count > 0 ? "</size>" : string.Empty);
|
||||
}
|
||||
|
||||
foreach (CustomRoles subRole in s)
|
||||
{
|
||||
if (role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor && subRole == CustomRoles.Lovers) continue;
|
||||
__instance.RoleBlurbText.text += "\n<size=30%>" + Utils.ColorString(Utils.GetRoleColor(subRole), GetString($"{subRole}Info"));
|
||||
}
|
||||
|
||||
__instance.RoleText.text += Utils.GetSubRolesText(lp.PlayerId, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
|
||||
@@ -9428,7 +9428,7 @@
|
||||
"Ambusher.InvisTimeLeft": "Invisibility expires in {0}s",
|
||||
"Psychopath": "Psychopath",
|
||||
"PsychopathInfo": "You're Forced to Kill Off Cooldown",
|
||||
"PsychopathInfoLong": "(Impostors):\\nAs the Psychopath, as soon as your kill cooldown is up, you'll kill instantly if someone is inside your kill-range.",
|
||||
"PsychopathInfoLong": "(Impostors):\\nAs the Psychopath, as soon as your kill cooldown is up, you'll kill instantly if someone is inside your kill-range. There's also a chance you accidentally stab multiple people in range at once!",
|
||||
"DoubleAgent": "Double Agent",
|
||||
"DoubleAgentInfo": "An Impostor Among Impostors",
|
||||
"DoubleAgentInfoLong": "(Crewmates):\\nAs the Double Agent, you are an impostor among impostors. The real impostors see you as their partner, but you don't know who they are. Trick them into thinking you're one of their partners to expose them!",
|
||||
|
||||
@@ -245,6 +245,8 @@ public class Amnesiac : RoleBase
|
||||
LateTask.New(() => amnesiac.SetKillCooldown(3f), 0.2f, log: false);
|
||||
if (role.IsRecruitingRole()) amnesiac.SetAbilityUseLimit(0);
|
||||
|
||||
if (Utils.HasTasks(amnesiac.Data, false)) amnesiac.GetTaskState().HasTasks = true;
|
||||
|
||||
if (!amnesiac.IsLocalPlayer()) return;
|
||||
|
||||
switch (role)
|
||||
|
||||
@@ -180,11 +180,6 @@ public class Lawyer : RoleBase
|
||||
lawyer.Notify(Translator.GetString("LawyerChangeRole"));
|
||||
}
|
||||
|
||||
public static bool CheckExileTarget(NetworkedPlayerInfo exiled /*, bool DecidedWinner, bool Check = false*/)
|
||||
{
|
||||
return Target.Where(x => x.Value == exiled.PlayerId).Select(kvp => Utils.GetPlayerById(kvp.Key)).Any(lawyer => lawyer != null && !lawyer.Data.Disconnected);
|
||||
}
|
||||
|
||||
public override void OnReportDeadBody()
|
||||
{
|
||||
if (MeetingStates.FirstMeeting && TargetKnowsLawyer.GetBool() && Target.TryGetValue(LawyerId, out byte target))
|
||||
|
||||
Reference in new issue
Block a user