Compare commits

...
7 Commits
Author SHA1 Message Date
Crowdin Bot e9f3e02248 chore: update translations for release 7.1.6 2026-01-17 11:54:41 +00:00
Gurge44 120a3acd70 cl 2026-01-17 12:53:11 +01:00
Gurge44 9493b533d3 only on vanilla servers 2026-01-17 12:49:57 +01:00
Gurge44 a738c1e4d7 ver 2026-01-17 12:48:57 +01:00
Gurge44 568c09b90d extend ginormous method (now 400+ lines to just send a message.... bruh) 2026-01-17 12:40:41 +01:00
Gurge44 4ec1e7367d Merge remote-tracking branch 'origin/main' 2026-01-16 12:50:07 +01:00
Gurge44 837ee1311d delay 2026-01-16 12:49:58 +01:00
6 changed files with 62 additions and 12 deletions

No files matched your search

+1 -3
View File
@@ -1,8 +1,6 @@
# Thank you so much for finding and using EHR!
- Chat spam is now dumber but doesn't kick the host (on vanilla servers)
- More LevelImpostor compatibility
- Host is now invisible after death (on vanilla servers)
- Fixed numbers appearing as * in messages on vanilla servers
(you better not complain about the frequency of updates)
+2 -2
View File
@@ -42,8 +42,8 @@ public class Main : BasePlugin
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
private const string DebugKeySalt = "59687b";
private const string PluginGuid = "com.gurge44.endlesshostroles";
public const string PluginVersion = "7.1.5";
public const string PluginDisplayVersion = "7.1.5";
public const string PluginVersion = "7.1.6";
public const string PluginDisplayVersion = "7.1.6";
public const bool TestBuild = false;
public const string NeutralColor = "#ffab1b";
+1 -1
View File
@@ -31,7 +31,7 @@ internal static class LateTask
if (name is not "" and not "No Name Task" && log)
Logger.Info($"\"{name}\" is finished", "LateTask");
}
catch (Exception ex) { Logger.Error($"{ex.GetType()}: {ex.Message}\n in \"{name}\"\n (created at {path.Split('\\')[^1]}, by member {member}, at line {line})\n {ex.StackTrace}".Replace("\r\n", "\n"), "LateTask.Error", false, multiLine: true); }
catch (Exception ex) { Logger.Error($"{ex.GetType()}: {ex.Message}\n in \"{name}\"\n (created at {path.Split('\\')[^1].Split('/')[^1]}, by member {member}, at line {line})\n {ex.StackTrace}".Replace("\r\n", "\n"), "LateTask.Error", false, multiLine: true); }
}
}
}
+56 -4
View File
@@ -718,7 +718,7 @@ public static class Utils
StackFrame firstFrame = stFrames.FirstOrDefault();
StringBuilder sb = new();
sb.Append($" {ex.GetType().Name}: {ex.Message}\n thrown by {ex.Source}\n at {ex.TargetSite}\n in {fileName.Split('\\')[^1]}\n at line {lineNumber}\n in method \"{callerMemberName}\"\n------ Method Stack Trace ------");
sb.Append($" {ex.GetType().Name}: {ex.Message}\n thrown by {ex.Source}\n at {ex.TargetSite}\n in {fileName.Split('\\')[^1].Split('/')[^1]}\n at line {lineNumber}\n in method \"{callerMemberName}\"\n------ Method Stack Trace ------");
var skip = true;
@@ -1805,11 +1805,11 @@ public static class Utils
messages.Do(x => SendMessage(x.Text, x.SendTo, x.Title, sendOption: sendOption));
}
public static CustomRpcSender SendMessage(string text, byte sendTo = byte.MaxValue, string title = "", bool noSplit = false, CustomRpcSender writer = null, bool final = false, bool multiple = false, SendOption sendOption = SendOption.Reliable, bool addToHistory = true, bool force = false, [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = 0)
public static CustomRpcSender SendMessage(string text, byte sendTo = byte.MaxValue, string title = "", bool noSplit = false, CustomRpcSender writer = null, bool final = false, bool multiple = false, SendOption sendOption = SendOption.Reliable, bool addToHistory = true, bool force = false, bool noNumberSplit = false, bool numberSplitFinal = false, [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = 0)
{
try
{
Logger.Info($"SendMessage called from {callerFilePath.Split('\\')[^1]} at line {callerLineNumber}", "SendMessage");
Logger.Info($"SendMessage called from {callerFilePath.Split('\\')[^1].Split('/')[^1]} at line {callerLineNumber}", "SendMessage");
if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla)
text = text.RemoveHtmlTags();
@@ -1928,6 +1928,17 @@ public static class Utils
TempReviveHostRunning = false;
}
}
if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla && !noSplit && !noNumberSplit)
{
var parts = SplitByNumberLimit();
if (parts.Count > 1)
{
writer = parts.Take(parts.Count - 1).Aggregate(writer, (current, part) => SendMessage(part, sendTo, title, writer: current, final: false, multiple: true, sendOption: sendOption, addToHistory: addToHistory, noNumberSplit: true));
return SendMessage(parts[^1], sendTo, title, false, writer, final, multiple, sendOption, addToHistory, noNumberSplit: true, numberSplitFinal: true);
}
}
int targetClientId = sendTo == byte.MaxValue ? -1 : receiver.OwnerId;
@@ -2127,7 +2138,7 @@ public static class Utils
sender.SetName(name);
}
if ((noSplit && final) || !noSplit)
if ((noSplit && final) || (!noSplit && (!noNumberSplit || numberSplitFinal)))
{
writer.AutoStartRpc(sender.NetId, RpcCalls.SetName, targetClientId)
.Write(sender.Data.NetId)
@@ -2153,6 +2164,47 @@ public static class Utils
writer = CustomRpcSender.Create("Utils.SendMessage", sendOption);
}
}
List<string> SplitByNumberLimit()
{
List<string> result = [];
StringBuilder sb = new();
int digitCount = 0;
foreach (char c in text)
{
if (char.IsDigit(c))
{
digitCount++;
if (digitCount > 5)
{
int lastNewline = sb.ToString().LastIndexOf('\n');
if (lastNewline >= 0)
{
result.Add(sb.ToString(0, lastNewline + 1));
sb.Remove(0, lastNewline + 1);
}
else
{
result.Add(sb.ToString());
sb.Clear();
}
digitCount = 1;
}
}
sb.Append(c);
}
if (sb.Length > 0)
result.Add(sb.ToString());
return result;
}
}
public static HashSet<byte> DirtyName = [];
+1 -1
View File
@@ -1201,7 +1201,7 @@ internal static class ReportDeadBodyPatch
try { Main.AllAlivePlayerControls.DoIf(x => x.Is(CustomRoles.Lazy), x => Lazy.BeforeMeetingPositions[x.PlayerId] = x.Pos()); }
catch (Exception e) { ThrowException(e); }
try { if (Lovers.PrivateChat.GetBool()) ChatManager.ClearChat(Main.AllAlivePlayerControls.ExceptBy(Main.LoversPlayers.ConvertAll(x => x.PlayerId), x => x.PlayerId).ToArray()); }
try { if (Lovers.PrivateChat.GetBool() && Main.LoversPlayers.Exists(x => x != null && x.IsAlive())) LateTask.New(() => ChatManager.ClearChat(Main.AllAlivePlayerControls.ExceptBy(Main.LoversPlayers.ConvertAll(x => x.PlayerId), x => x.PlayerId).ToArray()), GameStates.CurrentServerType == GameStates.ServerType.Vanilla && !PlayerControl.LocalPlayer.IsAlive() ? 3f : 0f); }
catch (Exception e) { ThrowException(e); }
CustomSabotage.Reset();
+1 -1
View File
@@ -10180,7 +10180,7 @@
"WinnerRoleText.Bubble": "Bubble Wins!",
"WinnerRoleText.Hookshot": "Hookshot Wins!",
"WinnerRoleText.Sprayer": "Sprayer Wins!",
"WinnerRoleText.SoulHunter": "Soul Hunter Wins!",
"WinnerRoleText.SoulHunter": "صائد الروح يفوز!",
"WinnerRoleText.Tiger": "Tiger Wins!",
"WinnerRoleText.Beehive": "فوز خلية النحل!",
"WinnerRoleText.Phantasm": "Phantasm Wins!",