Minor fixes

This commit is contained in:
Gurge44 committed 2024-05-19 16:43:31 +02:00
1 parent 351ed43200
commit 7737c39527
4 files changed
+49 -47

No files matched your search

+35 -35
View File
@@ -115,41 +115,6 @@ public static class GuessManager
Logger.Msg(msg, "Msg Guesser");
Logger.Msg($"{operate}", "Operate");
if (!pc.IsAlive())
{
if (!isUI) Utils.SendMessage(GetString("GuessDead"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessDead"));
return true;
}
if (!pc.Is(CustomRoles.NiceGuesser) && pc.IsCrewmate() && !Options.CrewmatesCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Judge) && !pc.Is(CustomRoles.NiceSwapper))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (!pc.Is(CustomRoles.EvilGuesser) && pc.GetCustomRole().IsImpostor() && !Options.ImpostorsCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Councillor))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (pc.IsNeutralKiller() && !Options.NeutralKillersCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (pc.GetCustomRole().IsNonNK() && !Options.PassiveNeutralsCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Doomsayer))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
switch (operate)
{
case 1:
@@ -157,6 +122,41 @@ public static class GuessManager
return true;
case 2:
{
if (!pc.IsAlive())
{
if (!isUI) Utils.SendMessage(GetString("GuessDead"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessDead"));
return true;
}
if (!pc.Is(CustomRoles.NiceGuesser) && pc.IsCrewmate() && !Options.CrewmatesCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Judge) && !pc.Is(CustomRoles.NiceSwapper))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (!pc.Is(CustomRoles.EvilGuesser) && pc.GetCustomRole().IsImpostor() && !Options.ImpostorsCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Councillor))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (pc.IsNeutralKiller() && !Options.NeutralKillersCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if (pc.GetCustomRole().IsNonNK() && !Options.PassiveNeutralsCanGuess.GetBool() && !pc.Is(CustomRoles.Guesser) && !pc.Is(CustomRoles.Doomsayer))
{
if (!isUI) Utils.SendMessage(GetString("GuessNotAllowed"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessNotAllowed"));
return true;
}
if ((pc.Is(CustomRoles.NiceGuesser) && Options.GGTryHideMsg.GetBool()) ||
(pc.Is(CustomRoles.EvilGuesser) && Options.EGTryHideMsg.GetBool()) ||
(pc.Is(CustomRoles.Doomsayer) && Doomsayer.DoomsayerTryHideMsg.GetBool()) ||
+2 -1
View File
@@ -17,7 +17,8 @@ public static class OptionShower
public static string GetTextNoFresh()
{
if (Pages.Count < 3) GetText();
if (CurrentPage == 0) return $"{GameOptionsManager.Instance.CurrentGameOptions.ToHudString(GameData.Instance ? GameData.Instance.PlayerCount : 10)}\n\n{GetString("PressTabToNextPage")}({CurrentPage + 1}/{Pages.Count})";
if (Pages.Count < 3) return GetText();
return $"{Pages[CurrentPage]}{GetString("PressTabToNextPage")}({CurrentPage + 1}/{Pages.Count})";
}
+8 -7
View File
@@ -108,12 +108,6 @@ class GameEndChecker
{
foreach (PlayerControl pc in Main.AllPlayerControls)
{
if (GhostRolesManager.AssignedGhostRoles.TryGetValue(pc.PlayerId, out var ghostRole) && ghostRole is { Role: CustomRoles.Specter, Instance: Specter { IsWon: true } })
{
WinnerIds.Add(pc.PlayerId);
AdditionalWinnerTeams.Add(AdditionalWinners.Specter);
}
switch (pc.GetCustomRole())
{
case CustomRoles.DarkHide when !pc.Data.IsDead && ((WinnerTeam == CustomWinner.Impostor && !reason.Equals(GameOverReason.ImpostorBySabotage)) || WinnerTeam == CustomWinner.DarkHide || (WinnerTeam == CustomWinner.Crewmate && !reason.Equals(GameOverReason.HumansByTask) && Main.PlayerStates[pc.PlayerId].Role is DarkHide { IsWinKill: true } && DarkHide.SnatchesWin.GetBool())):
@@ -220,6 +214,13 @@ class GameEndChecker
}
}
var winningSpecters = GhostRolesManager.AssignedGhostRoles.Where(x => x.Value.Instance is Specter { IsWon: true }).Select(x => x.Key).ToArray();
if (winningSpecters.Length > 0)
{
AdditionalWinnerTeams.Add(AdditionalWinners.Specter);
WinnerIds.UnionWith(winningSpecters);
}
if (CustomRoles.God.RoleExist())
{
ResetAndSetWinner(CustomWinner.God);
@@ -228,7 +229,7 @@ class GameEndChecker
.Do(p => WinnerIds.Add(p.PlayerId));
}
if (WinnerTeam != CustomWinner.CustomTeam)
if (WinnerTeam != CustomWinner.CustomTeam && CustomTeamManager.EnabledCustomTeams.Count > 0)
{
Main.AllPlayerControls
.Select(x => new { Team = CustomTeamManager.GetCustomTeam(x.PlayerId), Player = x })
+4 -4
View File
@@ -103,14 +103,14 @@ internal class ControllerManagerUpdatePatch
if (GetKeysDown(KeyCode.F5, KeyCode.X))
{
Logger.Info("导出自定义翻译文件", "KeyCommand");
Logger.Info("Exported Custom Translation File", "KeyCommand");
ExportCustomTranslation();
Logger.SendInGame("Exported Custom Translation File");
}
if (GetKeysDown(KeyCode.F1, KeyCode.LeftControl))
{
Logger.Info("输出日志", "KeyCommand");
Logger.Info("Log dumped", "KeyCommand");
Utils.DumpLog();
}
@@ -211,7 +211,7 @@ internal class ControllerManagerUpdatePatch
if (GetKeysDown(KeyCode.Return, KeyCode.K, KeyCode.LeftShift) && GameStates.IsInGame)
{
PlayerControl.LocalPlayer.Data.Object.SetKillTimer(0f);
PlayerControl.LocalPlayer.SetKillTimer(0f);
PlayerControl.LocalPlayer.SetKillCooldown(0f);
}
@@ -241,7 +241,7 @@ internal class ControllerManagerUpdatePatch
if (Input.GetKeyDown(KeyCode.I))
{
Logger.Info(PlayerControl.LocalPlayer.Pos().ToString(), "GetLocalPlayerPos");
Logger.SendInGame(PlayerControl.LocalPlayer.Pos().ToString());
}
if (Input.GetKeyDown(KeyCode.C))