mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
u
This commit is contained in:
1 parent
98d1e3826b
commit
5f45c0ef73
8 files changed
+44
-26
No files matched your search
+1
-1
@@ -49,7 +49,7 @@ internal static class Logger
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
if (FastDestroyableSingleton<HudManager>._instance)
|
||||
if (DestroyableSingleton<HudManager>._instance)
|
||||
{
|
||||
FastDestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage(text);
|
||||
Warn(text, "SendInGame");
|
||||
|
||||
+17
-12
@@ -1765,7 +1765,13 @@ public static class Utils
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || player == null) return;
|
||||
|
||||
if (!player.AmOwner && !player.FriendCode.GetDevUser().HasTag() && !ChatCommands.IsPlayerModerator(player.FriendCode) && !ChatCommands.IsPlayerVIP(player.FriendCode)) return;
|
||||
var devUser = player.FriendCode.GetDevUser();
|
||||
bool isMod = ChatCommands.IsPlayerModerator(player.FriendCode);
|
||||
bool isVIP = ChatCommands.IsPlayerVIP(player.FriendCode);
|
||||
bool hasTag = devUser.HasTag();
|
||||
bool hasPrivateTag = PrivateTagManager.Tags.TryGetValue(player.FriendCode, out var privateTag);
|
||||
|
||||
if (!player.AmOwner && !hasTag && !isMod && !isVIP && !hasPrivateTag) return;
|
||||
|
||||
string name = Main.AllPlayerNames.TryGetValue(player.PlayerId, out string n) ? n : string.Empty;
|
||||
if (Main.NickName != string.Empty && player.AmOwner) name = Main.NickName;
|
||||
@@ -1774,7 +1780,8 @@ public static class Utils
|
||||
|
||||
if (AmongUsClient.Instance.IsGameStarted)
|
||||
{
|
||||
if (Options.FormatNameMode.GetInt() == 1 && Main.NickName == string.Empty) name = Palette.GetColorName(player.Data.DefaultOutfit.ColorId);
|
||||
if (Options.FormatNameMode.GetInt() == 1 && Main.NickName == string.Empty)
|
||||
name = Palette.GetColorName(player.Data.DefaultOutfit.ColorId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1782,7 +1789,8 @@ public static class Utils
|
||||
|
||||
if (player.AmOwner)
|
||||
{
|
||||
if (GameStates.IsOnlineGame || GameStates.IsLocalGame) name = $"<color={GetString("HostColor")}>{GetString("HostText")}</color><color={GetString("IconColor")}>{GetString("Icon")}</color><color={GetString("NameColor")}>{name}</color>";
|
||||
if (GameStates.IsOnlineGame || GameStates.IsLocalGame)
|
||||
name = $"<color={GetString("HostColor")}>{GetString("HostText")}</color><color={GetString("IconColor")}>{GetString("Icon")}</color><color={GetString("NameColor")}>{name}</color>";
|
||||
|
||||
string modeText = GetString($"Mode{Options.CurrentGameMode}");
|
||||
|
||||
@@ -1802,13 +1810,9 @@ public static class Utils
|
||||
};
|
||||
}
|
||||
|
||||
var devUser = player.FriendCode.GetDevUser();
|
||||
bool isMod = ChatCommands.IsPlayerModerator(player.FriendCode);
|
||||
bool isVIP = ChatCommands.IsPlayerVIP(player.FriendCode);
|
||||
bool hasTag = devUser.HasTag();
|
||||
|
||||
if (hasTag || isMod || isVIP)
|
||||
if (hasTag || isMod || isVIP || hasPrivateTag)
|
||||
{
|
||||
var pTag = hasPrivateTag ? privateTag : string.Empty;
|
||||
string tag = hasTag ? devUser.GetTag() : string.Empty;
|
||||
if (tag == "null") tag = string.Empty;
|
||||
|
||||
@@ -1816,13 +1820,13 @@ public static class Utils
|
||||
{
|
||||
var modTagModded = $"<size=1.4>{GetString("ModeratorTag")}\r\n</size>";
|
||||
var vipTagModded = $"<size=1.4>{GetString("VIPTag")}\r\n</size>";
|
||||
name = $"{(hasTag ? tag : string.Empty)}{(isMod ? modTagModded : string.Empty)}{(isVIP ? vipTagModded : string.Empty)}{name}";
|
||||
name = $"{(hasTag ? tag : string.Empty)}{(isMod ? modTagModded : string.Empty)}{(isVIP ? vipTagModded : string.Empty)}{pTag}{name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
var modTagVanilla = $"<size=1.4>{GetString("ModeratorTag")} - </size>";
|
||||
var vipTagVanilla = $"<size=1.4>{GetString("VIPTag")} - </size>";
|
||||
name = $"{(hasTag ? tag.Replace("\r\n", " - ") : string.Empty)}{(isMod ? modTagVanilla : string.Empty)}{(isVIP ? vipTagVanilla : string.Empty)}{name}";
|
||||
name = $"{(hasTag ? tag.Replace("\r\n", " - ") : string.Empty)}{(isMod ? modTagVanilla : string.Empty)}{(isVIP ? vipTagVanilla : string.Empty)}{pTag}{name}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1843,7 +1847,8 @@ public static class Utils
|
||||
}
|
||||
}
|
||||
|
||||
if (name != player.name && player.CurrentOutfitType == PlayerOutfitType.Default) player.RpcSetName(name);
|
||||
if (name != player.name && player.CurrentOutfitType == PlayerOutfitType.Default)
|
||||
player.RpcSetName(name);
|
||||
}
|
||||
|
||||
public static Dictionary<string, int> GetAllPlayerLocationsCount()
|
||||
|
||||
@@ -192,7 +192,9 @@ internal static class ChatCommands
|
||||
new(["gm", "gml", "gamemodes", "gamemodelist", "режимы", "模式列表"], "", GetString("CommandDescription.GameModeList"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, GameModeListCommand, true, false),
|
||||
new(["gmp", "gmpoll", "pollgm", "gamemodepoll", "режимголосование", "模式投票"], "", GetString("CommandDescription.GameModePoll"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, GameModePollCommand, true, false),
|
||||
new(["8ball", "шар", "八球"], "{question}", GetString("CommandDescription.EightBall"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, EightBallCommand, false, false, [GetString("CommandArgs.EightBall.Question")]),
|
||||
|
||||
new(["addtag", "добавитьтег", "添加标签", "adicionartag"], "{id} {color} {tag}", GetString("CommandDescription.AddTag"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, AddTagCommand, true, false, [GetString("CommandArgs.AddTag.Id"), GetString("CommandArgs.AddTag.Color"), GetString("CommandArgs.AddTag.Tag")]),
|
||||
new(["deletetag", "удалитьтег", "删除标签"], "{id}", GetString("CommandDescription.DeleteTag"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, DeleteTagCommand, true, false, [GetString("CommandArgs.DeleteTag.Id")]),
|
||||
|
||||
// Commands with action handled elsewhere
|
||||
new(["shoot", "guess", "bet", "bt", "st", "угадать", "бт", "猜测", "赌", "adivinhar"], "{id} {role}", GetString("CommandDescription.Guess"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Guess.Id"), GetString("CommandArgs.Guess.Role")]),
|
||||
new(["tl", "sp", "jj", "trial", "суд", "засудить", "审判", "判", "julgar"], "{id}", GetString("CommandDescription.Trial"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Trial.Id")]),
|
||||
@@ -364,7 +366,7 @@ internal static class ChatCommands
|
||||
var pc = id.GetPlayer();
|
||||
if (pc == null) return;
|
||||
|
||||
var color = ColorUtility.TryParseHtmlString(args[2], out var c) ? c : Color.red;
|
||||
var color = ColorUtility.TryParseHtmlString($"#{args[2]}", out var c) ? c : Color.red;
|
||||
var tag = Utils.ColorString(color, string.Join(' ', args[3..]));
|
||||
PrivateTagManager.AddTag(pc.FriendCode, tag);
|
||||
|
||||
@@ -389,8 +391,8 @@ internal static class ChatCommands
|
||||
|
||||
private static void GameModePollCommand(PlayerControl player, string text, string[] args)
|
||||
{
|
||||
string gmNames = string.Join(' ', Enum.GetNames<CustomGameMode>().SkipLast(1).Select(x => GetString(x)));
|
||||
var msg = $"/poll {GetString("GameModePoll.Question")}? {GetString("GameModePoll.KeepCurrent")} {gmNames}";
|
||||
string gmNames = string.Join(' ', Enum.GetNames<CustomGameMode>().SkipLast(1).Select(x => GetString(x).Replace(' ', '_')));
|
||||
var msg = $"/poll {GetString("GameModePoll.Question").TrimEnd('?')}? {GetString("GameModePoll.KeepCurrent").Replace(' ', '_')} {gmNames}";
|
||||
PollCommand(player, msg, msg.Split(' '));
|
||||
}
|
||||
|
||||
@@ -987,12 +989,12 @@ internal static class ChatCommands
|
||||
int maxVotes = PollVotes.Values.Max();
|
||||
KeyValuePair<char, int>[] winners = PollVotes.Where(x => x.Value == maxVotes).ToArray();
|
||||
|
||||
string msg = winners.Length == 1
|
||||
string result = winners.Length == 1
|
||||
? string.Format(GetString("Poll.Winner"), winners[0].Key, PollAnswers[winners[0].Key], winners[0].Value) +
|
||||
PollVotes.Where(x => x.Key != winners[0].Key).Aggregate("", (s, t) => s + $"{t.Key} / {t.Value} {PollAnswers[t.Key]}\n")
|
||||
: string.Format(GetString("Poll.Tie"), string.Join(" & ", winners.Select(x => $"{x.Key}{PollAnswers[x.Key]}")), maxVotes);
|
||||
|
||||
Utils.SendMessage(msg, title: Utils.ColorString(new(0, 255, 165, 255), GetString("PollResultTitle")));
|
||||
Utils.SendMessage(result, title: Utils.ColorString(new(0, 255, 165, 255), GetString("PollResultTitle")));
|
||||
|
||||
PollVotes.Clear();
|
||||
PollAnswers.Clear();
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ internal static class Crowded
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
public static bool Prefix(CreateOptionsPicker __instance, int maxPlayers)
|
||||
{
|
||||
if (FastDestroyableSingleton<FindAGameManager>.InstanceExists || __instance.mode != SettingsMode.Host) { return true; }
|
||||
if (DestroyableSingleton<FindAGameManager>.InstanceExists || __instance.mode != SettingsMode.Host) { return true; }
|
||||
|
||||
IGameOptions targetOptions = __instance.GetTargetOptions();
|
||||
targetOptions.SetInt(Int32OptionNames.MaxPlayers, maxPlayers);
|
||||
|
||||
@@ -238,7 +238,7 @@ public static class GameStartManagerPatch
|
||||
ActionMapGlyphDisplay startButtonGlyph = instance.StartButtonGlyph;
|
||||
startButtonGlyph?.SetColor(instance.LastPlayerCount >= instance.MinPlayers ? Palette.EnabledColor : Palette.DisabledClear);
|
||||
|
||||
if (FastDestroyableSingleton<DiscordManager>.InstanceExists)
|
||||
if (DestroyableSingleton<DiscordManager>.InstanceExists)
|
||||
{
|
||||
if (AmongUsClient.Instance.AmHost && AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame)
|
||||
FastDestroyableSingleton<DiscordManager>.Instance.SetInLobbyHost(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
|
||||
@@ -56,15 +56,14 @@ internal static class ChangeRoleSettings
|
||||
var objectOfType2 = Object.FindObjectOfType<GameSettingMenu>();
|
||||
if (objectOfType2 != null) objectOfType2.Close();
|
||||
|
||||
if (FastDestroyableSingleton<GameStartManager>.InstanceExists)
|
||||
if (DestroyableSingleton<GameStartManager>.InstanceExists)
|
||||
{
|
||||
// amongUsClient.DisconnectHandlers.Remove((IDisconnectHandler) FastDestroyableSingleton<GameStartManager>.Instance);
|
||||
Object.Destroy(FastDestroyableSingleton<GameStartManager>.Instance.gameObject);
|
||||
}
|
||||
|
||||
if (FastDestroyableSingleton<LobbyInfoPane>.InstanceExists) Object.Destroy(FastDestroyableSingleton<LobbyInfoPane>.Instance.gameObject);
|
||||
|
||||
if (FastDestroyableSingleton<DiscordManager>.InstanceExists) FastDestroyableSingleton<DiscordManager>.Instance.SetPlayingGame();
|
||||
if (DestroyableSingleton<LobbyInfoPane>.InstanceExists) Object.Destroy(FastDestroyableSingleton<LobbyInfoPane>.Instance.gameObject);
|
||||
if (DestroyableSingleton<DiscordManager>.InstanceExists) FastDestroyableSingleton<DiscordManager>.Instance.SetPlayingGame();
|
||||
|
||||
if (!string.IsNullOrEmpty(DataManager.Player.Store.ActiveCosmicube))
|
||||
AmongUsClient.Instance.SetActivePodType(FastDestroyableSingleton<CosmicubeManager>.Instance.GetCubeDataByID(DataManager.Player.Store.ActiveCosmicube).podId);
|
||||
|
||||
@@ -208,6 +208,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
"{addon}" => !ChatCommands.GetRoleByName(arg, out CustomRoles role) || !role.IsAdditionRole(),
|
||||
"{letter}" => arg.Length != 1 || !char.IsLetter(arg[0]),
|
||||
"{chance}" => !int.TryParse(arg, out int chance) || chance < 0 || chance > 100 || chance % 5 != 0,
|
||||
"{color}" => arg.Length != 6 || !arg.All(x => char.IsDigit(x) || x is >= 'a' and <= 'f') || !ColorUtility.TryParseHtmlString($"#{arg}", out _),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
@@ -221,6 +222,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
"{role}" => ChatCommands.GetRoleByName(arg, out _),
|
||||
"{addon}" => ChatCommands.GetRoleByName(arg, out CustomRoles role) && role.IsAdditionRole(),
|
||||
"{chance}" => int.TryParse(arg, out int chance) && chance is >= 0 and <= 100 && chance % 5 == 0,
|
||||
"{color}" => arg.Length == 6 && arg.All(x => char.IsDigit(x) || x is >= 'a' and <= 'f') && ColorUtility.TryParseHtmlString($"#{arg}", out _),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
@@ -233,6 +235,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
{
|
||||
"{id}" or "{id1}" or "{id2}" => $" ({byte.Parse(arg).ColoredPlayerName()})",
|
||||
"{role}" or "{addon}" when ChatCommands.GetRoleByName(arg, out CustomRoles role) => $" ({role.ToColoredString()})",
|
||||
"{color}" when ColorUtility.TryParseHtmlString($"#{arg}", out var color) => $" ({Utils.ColorString(color, "COLOR")})",
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2382,7 +2382,10 @@
|
||||
"CommandDescription.RoleList": "View the limits of how many of each faction and subcategory of roles will spawn.",
|
||||
"CommandDescription.JailTalk": "Talk to the Jailor as a jailed player or vice versa.",
|
||||
"CommandDescription.GameModeList": "View the list of all game modes in the mod.",
|
||||
"CommandDescription.GameModePoll": "Start a poll to vote for the next game mode.",
|
||||
"CommandDescription.EightBall": "Ask the magic 8-ball a question.",
|
||||
"CommandDescription.AddTag": "Add a tag to a player (visible in YOUR lobbies only) (appears before, in-line with the name).",
|
||||
"CommandDescription.DeleteTag": "Delete a tag from a player.",
|
||||
"CommandArgs.ChangeSetting.Name": "The setting's name to change (leave blank to view all settings)",
|
||||
"CommandArgs.ChangeSetting.UnknownValue": "(leave blank to view what to put here)",
|
||||
"CommandArgs.Rename.Name": "Your new name",
|
||||
@@ -2454,9 +2457,13 @@
|
||||
"CommandArgs.Whisper.Message": "The message to whisper",
|
||||
"CommandArgs.JailTalk.Message": "The message to send to the Jailor/jailed player",
|
||||
"CommandArgs.EightBall.Question": "The question to ask",
|
||||
"CommandArgs.AddTag.Id": "The player's ID to add a tag to",
|
||||
"CommandArgs.AddTag.Color": "The color of the tag (format: hex, without the leading # (example: 00ffa5))",
|
||||
"CommandArgs.AddTag.Tag": "The tag to add (you can use HTML tags) (don't forget a separator at the end)",
|
||||
"CommandArgs.DeleteTag.Id": "The player's ID to delete the tag from",
|
||||
"Commands.ChangeSettingHelp": "<b><u>Arguments:</u></b><size=70%>\\n- map (theskeld/mirahq/polus/dlekseht/airship/thefungle/custom)\\n- impostors (number)\\n- players (number)\\n- recommended (on/off)\\n- confirmejects (on/off)\\n- emergencymeetings (number)\\n- anonymousvotes (on/off)\\n- emergencycooldown (number)\\n- discussiontime (number)\\n- votingtime (number)\\n- playerspeed (float)\\n- crewmatevision (float)\\n- impostorvision (float)\\n- killcooldown (float)\\n- killdistance (short/medium/long/custom)\\n- taskbarupdates (always/meetings/never)\\n- visualtasks (on/off)\\n- commontasks (number)\\n- longtasks (number)\\n- shorttasks (number)\\n- scientistcount (number)\\n- scientistchance (number)\\n- vitalsdisplaycooldown (float)\\n- batteryduration (float)\\n- engineercount (number)\\n- engineerchance (number)\\n- ventusecooldown (float)\\n- maxtimeinvents (float)\\n- guardianangelcount (number)\\n- guardianangelchance (number)\\n- protectcooldown (float)\\n- protectduration (float)\\n- protectvisibletoimpostors (on/off)\\n- shapeshiftercount (number)\\n- shapeshifterchance (number)\\n- shapeshiftduration (float)\\n- shapeshiftcooldown (float)\\n- leaveshapeshiftevidence (on/off)\\n- phantomcount (number)\\n- phantomchance (number)\\n- inviscooldown (float)\\n- invisduration (float)\\n- noisemakercount (number)\\n- noisemakerchance (number)\\n- noisemakerimpostoralert (on/off)\\n- noisemakeralertduration (number)\\n- trackercount (number)\\n- trackerchance (number)\\n- trackduration (float)\\n- trackcooldown (float)\\n- trackdelay (float)\\n- ghostdotasks (on/off)\\n\\n<u><b>Notes:</b></u>\\n1. Upper and lowercase matters\\n2. Where it says custom, you obviously put a number argument after it\\n3. A float is a single precision floating number, like 1.7\\n4. \"ghostdotasks\" causes issues if you set it\\n5. Example uses:\\n - \"/cs map polus\"\\n - \"/cs killdistance custom 4\"\\n - \"/cs trackdelay 1,7\"\\n - \"/cs confirmejects on\"",
|
||||
"AddTagSuccess": "<#00ffa5>✓</color> Suceessfully created the tag {0} for {1}. If you want to change it, just use this command again and it will override the current tag. To delete it, simply type <#00a5ff>/deletetag {2}</color>!",
|
||||
"DeleteTagSuccess": "<#00ffa5>✓</color> Successfully deleted {1}'s tag.",
|
||||
"DeleteTagSuccess": "<#00ffa5>✓</color> Successfully deleted {0}'s tag.",
|
||||
"8BallResponseTitle": "<#000000>➇ 8-BALL ➇</color>",
|
||||
"8BallResponse.0": "It is certain.",
|
||||
"8BallResponse.1": "It is decidedly so.",
|
||||
@@ -2478,6 +2485,8 @@
|
||||
"8BallResponse.17": "My sources say no.",
|
||||
"8BallResponse.18": "Outlook not so good.",
|
||||
"8BallResponse.19": "Very doubtful.",
|
||||
"GameModePoll.Question": "Which game mode should we play next?",
|
||||
"GameModePoll.KeepCurrent": "Keep the current game mode",
|
||||
"PollResultTitle": "Poll Results",
|
||||
"Poll.Title": "<#ff0000>➡ POLL ⬅</color>",
|
||||
"Poll.Winner": "Winner: <b>{0}. {1}</b> with {2} votes\\n",
|
||||
|
||||
Reference in new issue
Block a user