mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-27 23:44:48 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f3e02248 | ||
|
|
120a3acd70 | ||
|
|
9493b533d3 | ||
|
|
a738c1e4d7 | ||
|
|
568c09b90d | ||
|
|
4ec1e7367d | ||
|
|
837ee1311d |
No files matched your search
+1
-3
@@ -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)
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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 = [];
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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!",
|
||||
|
||||
Reference in new issue
Block a user