This commit is contained in:
Gurge44 committed 2024-12-12 15:30:02 +01:00
1 parent da9a0855c9
commit 1f4a7b586c
6 files changed
+69 -73

No files matched your search

+4
View File
@@ -1,9 +1,12 @@
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AFTER_MULTILINE_STATEMENTS/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_BLOCK_STATEMENTS/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_MULTILINE_STATEMENTS/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:Boolean
x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_BRACES_INSIDE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_BLOCK_ON_SAME_LINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AFK/@EntryIndexedValue">AFK</s:String>
@@ -14,6 +17,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CK/@EntryIndexedValue">CK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CNO/@EntryIndexedValue">CNO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CRLF/@EntryIndexedValue">CRLF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CTA/@EntryIndexedValue">CTA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CTF/@EntryIndexedValue">CTF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DLL/@EntryIndexedValue">DLL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DY/@EntryIndexedValue">DY</s:String>
+10 -29
View File
@@ -22,10 +22,7 @@ internal static class CustomTeamManager
CustomTeams = File.ReadAllLines("./EHR_DATA/CTA_Data.txt").Select(x => new CustomTeam(x)).ToHashSet();
RefreshCustomOptions();
}
catch (Exception e)
{
Utils.ThrowException(e);
}
catch (Exception e) { Utils.ThrowException(e); }
}
private static void RefreshCustomOptions()
@@ -85,7 +82,6 @@ internal static class CustomTeamManager
foreach (byte target in players)
{
if (player == target) continue;
TargetArrow.Add(player, target);
}
}
@@ -95,7 +91,6 @@ internal static class CustomTeamManager
public static string GetSuffix(PlayerControl seer)
{
if (seer == null || EnabledCustomTeams.Count == 0 || Main.HasJustStarted || !IsSettingEnabledForPlayerTeam(seer.PlayerId, CTAOption.Arrows)) return string.Empty;
return CustomTeamPlayerIds[GetCustomTeam(seer.PlayerId)].Aggregate(string.Empty, (s, id) => s + Utils.ColorString(Main.PlayerColors.GetValueOrDefault(id, Color.white), TargetArrow.GetArrows(seer, id)));
}
@@ -117,10 +112,10 @@ internal static class CustomTeamManager
CustomTeam team = aliveTeamPlayers.Keys.First();
if (aliveTeamPlayers.Count == 1 && Main.AllAlivePlayerControls.All(x =>
{
CustomTeam customTeam = GetCustomTeam(x.PlayerId);
return customTeam != null && customTeam.Equals(team);
}))
{
CustomTeam customTeam = GetCustomTeam(x.PlayerId);
return customTeam != null && customTeam.Equals(team);
}))
{
WinnerTeam = team;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.CustomTeam);
@@ -128,10 +123,7 @@ internal static class CustomTeamManager
return true;
}
}
catch
{
return false;
}
catch { return false; }
return false;
}
@@ -190,14 +182,8 @@ internal static class CustomTeamManager
TeamMembers = parts[4].Split(',').Select(x => Enum.Parse<CustomRoles>(x, true)).ToList();
}
catch (Exception e)
{
Utils.ThrowException(e);
}
finally
{
CustomTeams.Add(this);
}
catch (Exception e) { Utils.ThrowException(e); }
finally { CustomTeams.Add(this); }
}
public List<CustomRoles> TeamMembers { get; } = [];
@@ -218,14 +204,9 @@ internal static class CustomTeamManager
internal class CustomTeamOptionGroup(CustomTeam team, BooleanOptionItem enabled, BooleanOptionItem knowRoles, BooleanOptionItem winWithOriginalTeam, BooleanOptionItem killEachOther, BooleanOptionItem guessEachOther, BooleanOptionItem arrows)
{
public readonly List<BooleanOptionItem> AllOptions = [enabled, knowRoles, winWithOriginalTeam, killEachOther, guessEachOther, arrows];
public CustomTeam Team { get; set; } = team;
public CustomTeam Team { get; } = team;
public BooleanOptionItem Enabled { get; set; } = enabled;
public BooleanOptionItem KnowRoles { get; set; } = knowRoles;
public BooleanOptionItem WinWithOriginalTeam { get; set; } = winWithOriginalTeam;
public BooleanOptionItem KillEachOther { get; set; } = killEachOther;
public BooleanOptionItem GuessEachOther { get; set; } = guessEachOther;
public BooleanOptionItem Arrows { get; set; } = arrows;
public BooleanOptionItem Enabled { get; } = enabled;
}
}
+5 -1
View File
@@ -180,6 +180,7 @@ public static class Options
public static OptionItem DisableSabotage;
public static OptionItem DisableWhisperCommand;
public static OptionItem DisableSpectateCommand;
public static OptionItem DisableReactorOnSkeldAndMira;
public static OptionItem DisableReactorOnPolus;
@@ -1822,6 +1823,9 @@ public static class Options
DisableWhisperCommand = new BooleanOptionItem(22811, "DisableWhisperCommand", false, TabGroup.GameSettings)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableSpectateCommand = new BooleanOptionItem(22812, "DisableSpectateCommand", false, TabGroup.GameSettings)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
LoadingPercentage = 75;
DisableDevices = new BooleanOptionItem(22900, "DisableDevices", false, TabGroup.GameSettings)
@@ -2642,4 +2646,4 @@ public static class Options
public static OptionItem VeteranAbilityChargesWhenFinishedTasks;
// ReSharper restore NotAccessedField.Global
}
}
+27 -29
View File
@@ -47,20 +47,33 @@ internal static class PingTrackerUpdatePatch
_ => "#ff4500"
};
var FPSGame = 1.0f / Time.deltaTime;
Color fpscolor = Color.green;
AppendSeparator();
Sb.Append($"<color={color}>{ping} {GetString("PingText")}</color>");
AppendSeparator();
Sb.Append(string.Format(GetString("Server"), Utils.GetRegionName()));
if (Main.ShowFps.Value)
if (Main.ShowFps.Value)
{
var FPSGame = 1.0f / Time.deltaTime;
Color fpscolor = Color.green;
var fps = 1.0f / Time.deltaTime;
if (FPSGame < 20f) fpscolor = Color.red;
else if (FPSGame < 40f) fpscolor = Color.yellow;
Color fpscolor = fps switch
{
< 10f => Color.red,
< 30f => Color.yellow,
_ => Color.green
};
Sb.Append($"\r\n{Utils.ColorString(fpscolor, Utils.ColorString(Color.cyan, GetString("FPSGame")) + ((int)FPSGame).ToString())}");
AppendSeparator();
Sb.Append($"{Utils.ColorString(fpscolor, Utils.ColorString(Color.cyan, GetString("FPSGame")) + ((int)fps))}");
}
if (GameStates.InGame) Sb.Append("\r\n.");
return;
void AppendSeparator() => Sb.Append(GameStates.InGame ? " - " : "\r\n");
}
}
[HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))]
internal static class VersionShowerStartPatch
{
@@ -135,10 +148,7 @@ static class FriendsListUIOpenPatch
{
try
{
if (__instance.gameObject.activeSelf || __instance.currentSceneName == "")
{
__instance.Close();
}
if (__instance.gameObject.activeSelf || __instance.currentSceneName == "") { __instance.Close(); }
else
{
FriendsListBar[] componentsInChildren = __instance.GetComponentsInChildren<FriendsListBar>(true);
@@ -230,10 +240,7 @@ static class FriendsListUIOpenPatch
ControllerManager.Instance.OpenOverlayMenu(__instance.name, __instance.BackButton, __instance.DefaultButtonSelected, __instance.ControllerSelectable);
}
}
catch (Exception e)
{
Utils.ThrowException(e);
}
catch (Exception e) { Utils.ThrowException(e); }
return false;
}
@@ -268,14 +275,8 @@ internal static class TitleLogoPatch
if (Ambience != null)
{
try
{
__instance.playButton.transform.gameObject.SetActive(true);
}
catch (Exception ex)
{
Logger.Warn(ex.ToString(), "MainMenuLoader");
}
try { __instance.playButton.transform.gameObject.SetActive(true); }
catch (Exception ex) { Logger.Warn(ex.ToString(), "MainMenuLoader"); }
}
if (!(LeftPanel = GameObject.Find("LeftPanel"))) return;
@@ -298,10 +299,7 @@ internal static class TitleLogoPatch
foreach (KeyValuePair<List<PassiveButton>, (Sprite, Color, Color, Color, Color)> kvp in mainButtons)
kvp.Key.Do(button => FormatButtonColor(button, kvp.Value.Item2, kvp.Value.Item3, kvp.Value.Item4, kvp.Value.Item5));
try
{
mainButtons.Keys.Flatten().DoIf(x => x != null, x => x.buttonText.color = Color.white);
}
try { mainButtons.Keys.Flatten().DoIf(x => x != null, x => x.buttonText.color = Color.white); }
catch { }
GameObject.Find("Divider")?.SetActive(false);
@@ -442,4 +440,4 @@ internal static class OptionsMenuBehaviourOpenPatch
return false;
}
}
}
+22 -14
View File
@@ -132,7 +132,7 @@ internal static class SetUpRoleTextPatch
foreach (CustomRoles subRole in Main.PlayerStates[lp.PlayerId].SubRoles)
{
if (role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor && subRole == CustomRoles.Lovers) continue;
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"));
}
@@ -147,7 +147,7 @@ internal static class SetUpRoleTextPatch
{
LateTask.New(() =>
{
if (AmongUsClient.Instance.IsGameOver || GameStates.IsLobby || lp == null) return;
if (AmongUsClient.Instance.IsGameOver || GameStates.IsLobby || (lp == null)) return;
lp.SetName(Main.AllPlayerNames[lp.PlayerId]);
}, 1f, "Reset Name For Modded Client");
@@ -198,8 +198,10 @@ internal static class CoBeginPatch
sb.Append("------------Modded Settings------------\n");
foreach (OptionItem o in OptionItem.AllOptions)
{
if (!o.IsCurrentlyHidden() && (o.Parent?.GetBool() ?? !o.GetString().Equals("0%")))
sb.Append($"{(o.Parent == null ? o.GetName(true, true).RemoveHtmlTags().PadRightV2(40) : $"┗ {o.GetName(true, true).RemoveHtmlTags()}".PadRightV2(41))}:{o.GetString().RemoveHtmlTags()}\n");
}
sb.Append("-------------Other Information-------------\n");
sb.Append($"Number of players: {Main.AllPlayerControls.Length}\n");
@@ -244,7 +246,7 @@ internal static class CoBeginPatch
for (int i = charsInOneLine; i < longInfo.Length; i += charsInOneLine)
{
if (tooLong && i > 296) break;
if (tooLong && (i > 296)) break;
int index = longInfo.LastIndexOf(' ', i);
if (index != -1) longInfo = longInfo.Insert(index + 1, "\n");
@@ -296,7 +298,7 @@ internal static class BeginCrewmatePatch
return false;
}
if (role == CustomRoles.LovingCrewmate || PlayerControl.LocalPlayer.Is(CustomRoles.Lovers))
if ((role == CustomRoles.LovingCrewmate) || PlayerControl.LocalPlayer.Is(CustomRoles.Lovers))
{
teamToDisplay = new();
teamToDisplay.Add(PlayerControl.LocalPlayer);
@@ -313,8 +315,10 @@ internal static class BeginCrewmatePatch
teamToDisplay = new();
foreach (PlayerControl pc in Main.AllPlayerControls)
{
if (CustomTeamManager.AreInSameCustomTeam(pc.PlayerId, PlayerControl.LocalPlayer.PlayerId))
teamToDisplay.Add(pc);
}
}
}
@@ -323,8 +327,10 @@ internal static class BeginCrewmatePatch
teamToDisplay = new();
foreach (PlayerControl pc in Main.AllPlayerControls)
if (FFAManager.PlayerTeams.TryGetValue(pc.PlayerId, out int team) && team == ffaTeam)
{
if (FFAManager.PlayerTeams.TryGetValue(pc.PlayerId, out int team) && (team == ffaTeam))
teamToDisplay.Add(pc);
}
}
return true;
@@ -392,7 +398,7 @@ internal static class BeginCrewmatePatch
break;
}
if (Main.LoversPlayers.Count == 2 && Main.LoversPlayers.Exists(x => x.IsLocalPlayer()))
if ((Main.LoversPlayers.Count == 2) && Main.LoversPlayers.Exists(x => x.IsLocalPlayer()))
{
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = Utils.GetRoleColor(CustomRoles.Lovers);
byte otherLoverId = Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId).PlayerId;
@@ -489,7 +495,7 @@ internal static class BeginCrewmatePatch
CustomRoles.Engineer or
CustomRoles.EngineerEHR
=> GetIntroSound(RoleTypes.Engineer),
CustomRoles.Scientist or
CustomRoles.ScientistEHR or
CustomRoles.Doctor or
@@ -583,14 +589,16 @@ internal static class BeginCrewmatePatch
{
if (team.RoleRevealScreenTitle != "*") __instance.TeamTitle.text = team.RoleRevealScreenTitle;
if (team.RoleRevealScreenBackgroundColor != "*" && ColorUtility.TryParseHtmlString(team.RoleRevealScreenBackgroundColor, out Color bgColor)) __instance.TeamTitle.color = __instance.BackgroundBar.material.color = bgColor;
if ((team.RoleRevealScreenBackgroundColor != "*") && ColorUtility.TryParseHtmlString(team.RoleRevealScreenBackgroundColor, out Color bgColor)) __instance.TeamTitle.color = __instance.BackgroundBar.material.color = bgColor;
__instance.ImpostorText.gameObject.SetActive(team.RoleRevealScreenSubtitle != "*");
__instance.ImpostorText.text = team.RoleRevealScreenSubtitle;
foreach (PlayerControl pc in Main.AllPlayerControls)
{
if (CustomTeamManager.AreInSameCustomTeam(pc.PlayerId, PlayerControl.LocalPlayer.PlayerId))
teamToDisplay.Add(pc);
}
}
}
@@ -711,16 +719,14 @@ internal static class BeginCrewmatePatch
return;
AudioClip GetAudioClipFromCustomRoleType()
{
return PlayerControl.LocalPlayer.GetCustomRoleTypes() switch
AudioClip GetAudioClipFromCustomRoleType() =>
PlayerControl.LocalPlayer.GetCustomRoleTypes() switch
{
CustomRoleTypes.Impostor => GetIntroSound(RoleTypes.Impostor),
CustomRoleTypes.Crewmate => GetIntroSound(RoleTypes.Crewmate),
CustomRoleTypes.Neutral => GetIntroSound(RoleTypes.Shapeshifter),
_ => GetIntroSound(RoleTypes.Crewmate)
};
}
}
private static AudioClip GetIntroSound(RoleTypes roleType)
@@ -950,7 +956,7 @@ internal static class IntroCutsceneDestroyPatch
_ => null
};
if (map != null && AmongUsClient.Instance.AmHost) aapc.Do(map.RandomTeleport);
if ((map != null) && AmongUsClient.Instance.AmHost) aapc.Do(map.RandomTeleport);
}
if (lp.HasDesyncRole())
@@ -975,9 +981,11 @@ internal static class IntroCutsceneDestroyPatch
LateTask.New(() => Main.Instance.StartCoroutine(Utils.NotifyEveryoneAsync()), 3f, log: false);
}
else
{
foreach (PlayerControl player in Main.AllPlayerControls)
Main.PlayerStates[player.PlayerId].InitTask(player);
}
Logger.Info("OnDestroy", "IntroCutscene");
}
}
}
+1
View File
@@ -2419,6 +2419,7 @@
"MuteMessage": "<#ff0000>You're muted and cannot send messages. The mute will expire in <#ffff00>{0}</color> seconds.</color>",
"WhisperTitle": "{0} <#ffffff>(ID <#00ffa5>{1}</color>) whispers to you:</color>",
"DisableWhisperCommand": "Disable /whisper command",
"DisableSpectateCommand": "Disable /spectate command",
"WhisperDisabled": "<#ff0000>X</color> The /whisper command is disabled in this lobby.",
"ThankYouForUsingEHR": "Thank you for using EHR!",
"GMRoles": "<color=#ff5b70>【 ★ Roles ★ 】</color>",