mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
remove rpc & fix kill log
This commit is contained in:
1 parent
0bfe0c5b65
commit
7a596e70ac
3 files changed
+45
-57
No files matched your search
+4
-16
@@ -50,7 +50,6 @@ public enum CustomRPC
|
||||
SyncAbilityCD,
|
||||
SyncGeneralOptions,
|
||||
SyncRoleData,
|
||||
RequestSendMessage,
|
||||
NotificationPopper,
|
||||
RequestCommandProcessing,
|
||||
|
||||
@@ -72,10 +71,10 @@ public enum CustomRPC
|
||||
SetDrawPlayer,
|
||||
SyncHeadHunter,
|
||||
SyncRabbit,
|
||||
SyncSoulHunter,
|
||||
|
||||
BAU = 150,
|
||||
|
||||
SyncSoulHunter,
|
||||
SyncMycologist,
|
||||
SyncBubble,
|
||||
AddTornado,
|
||||
@@ -88,10 +87,10 @@ public enum CustomRPC
|
||||
SyncMafiosoData,
|
||||
SyncMafiosoPistolCD,
|
||||
SyncDamoclesTimer,
|
||||
SyncChronomancer,
|
||||
|
||||
Sicko = 164,
|
||||
|
||||
SyncChronomancer,
|
||||
PenguinSync,
|
||||
SyncInfection,
|
||||
SetAlchemistPotion,
|
||||
@@ -135,6 +134,7 @@ public enum CustomRPC
|
||||
SyncVengefulRomanticTarget,
|
||||
SetRevealedPlayer,
|
||||
SetCurrentRevealTarget,
|
||||
RpcPassBomb,
|
||||
SetDoomsayerProgress = 209,
|
||||
|
||||
/*
|
||||
@@ -147,7 +147,6 @@ public enum CustomRPC
|
||||
*/
|
||||
|
||||
SetTrackerTarget = 215,
|
||||
RpcPassBomb,
|
||||
SetAlchemistTimer,
|
||||
SyncPostman,
|
||||
SyncChangeling,
|
||||
@@ -255,7 +254,7 @@ internal static class RPCHandlerPatch
|
||||
{
|
||||
if (id == 115) return true;
|
||||
if (SubmergedCompatibility.IsSubmerged() && id is >= 120 and <= 124) return true;
|
||||
return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestSendMessage or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand or CustomRPC.ImitatorClick or CustomRPC.RetributionistClick or CustomRPC.StarspawnClick or CustomRPC.VentriloquistClick;
|
||||
return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand or CustomRPC.ImitatorClick or CustomRPC.RetributionistClick or CustomRPC.StarspawnClick or CustomRPC.VentriloquistClick;
|
||||
}
|
||||
|
||||
private static bool CheckRateLimit(PlayerControl __instance, RpcCalls rpcType)
|
||||
@@ -631,17 +630,6 @@ internal static class RPCHandlerPatch
|
||||
Main.AllPlayerSpeed[id] = speed;
|
||||
break;
|
||||
}
|
||||
case CustomRPC.RequestSendMessage:
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) break;
|
||||
|
||||
string text = reader.ReadString();
|
||||
byte sendTo = reader.ReadByte();
|
||||
string title = reader.ReadString();
|
||||
bool noSplit = reader.ReadBoolean();
|
||||
Utils.SendMessage(text, sendTo, title, noSplit);
|
||||
break;
|
||||
}
|
||||
case CustomRPC.NotificationPopper:
|
||||
{
|
||||
byte typeId = reader.ReadByte();
|
||||
|
||||
+39
-40
@@ -1820,14 +1820,7 @@ public static class Utils
|
||||
if (!AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
if (sendTo == PlayerControl.LocalPlayer.PlayerId && !multiple)
|
||||
{
|
||||
MessageWriter w = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.RequestSendMessage, SendOption.Reliable, AmongUsClient.Instance.HostId);
|
||||
w.Write(text);
|
||||
w.Write(sendTo);
|
||||
w.Write(title);
|
||||
w.Write(noSplit);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(w);
|
||||
}
|
||||
SendLocally(PlayerControl.LocalPlayer);
|
||||
|
||||
return writer;
|
||||
}
|
||||
@@ -1849,21 +1842,7 @@ public static class Utils
|
||||
|
||||
if (sendTo != byte.MaxValue && receiver.AmOwner)
|
||||
{
|
||||
if (HudManager.InstanceExists)
|
||||
{
|
||||
string name = sender.Data.PlayerName;
|
||||
sender.SetName(title);
|
||||
HudManager.Instance.Chat.AddChat(sender, text);
|
||||
sender.SetName(name);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string pureText = text.RemoveHtmlTags();
|
||||
string pureTitle = title.RemoveHtmlTags();
|
||||
Logger.Info($" Message: {pureText[..(pureText.Length <= 300 ? pureText.Length : 300)]} - To: {GetPlayerById(sendTo)?.GetRealName()} - Title: {pureTitle[..(pureTitle.Length <= 300 ? pureTitle.Length : 300)]}", "SendMessage");
|
||||
}
|
||||
catch { Logger.Info(" Message sent", "SendMessage"); }
|
||||
SendLocally(sender);
|
||||
|
||||
if (addToHistory) ChatUpdatePatch.LastMessages.Add((text, sendTo, title, TimeStamp));
|
||||
return writer;
|
||||
@@ -2174,30 +2153,31 @@ public static class Utils
|
||||
|
||||
foreach (char c in text)
|
||||
{
|
||||
if (char.IsDigit(c))
|
||||
if (char.IsDigit(c) && digitCount == 5)
|
||||
{
|
||||
digitCount++;
|
||||
int lastNewline = sb.ToString().LastIndexOf('\n');
|
||||
|
||||
if (digitCount > 5)
|
||||
if (lastNewline >= 0)
|
||||
{
|
||||
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;
|
||||
result.Add(sb.ToString(0, lastNewline + 1));
|
||||
sb.Remove(0, lastNewline + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(sb.ToString());
|
||||
sb.Clear();
|
||||
}
|
||||
|
||||
digitCount = 0;
|
||||
foreach (char r in sb.ToString())
|
||||
if (char.IsDigit(r))
|
||||
digitCount++;
|
||||
}
|
||||
|
||||
sb.Append(c);
|
||||
|
||||
if (char.IsDigit(c))
|
||||
digitCount++;
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
@@ -2205,6 +2185,25 @@ public static class Utils
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void SendLocally(PlayerControl sender)
|
||||
{
|
||||
if (HudManager.InstanceExists)
|
||||
{
|
||||
string name = sender.Data.PlayerName;
|
||||
sender.SetName(title);
|
||||
HudManager.Instance.Chat.AddChat(sender, text);
|
||||
sender.SetName(name);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string pureText = text.RemoveHtmlTags();
|
||||
string pureTitle = title.RemoveHtmlTags();
|
||||
Logger.Info($" Message: {pureText[..(pureText.Length <= 300 ? pureText.Length : 300)]} - To: {PlayerControl.LocalPlayer.GetRealName()} - Title: {pureTitle[..(pureTitle.Length <= 300 ? pureTitle.Length : 300)]}", "SendMessage");
|
||||
}
|
||||
catch { Logger.Info(" Message sent", "SendMessage"); }
|
||||
}
|
||||
}
|
||||
|
||||
public static HashSet<byte> DirtyName = [];
|
||||
|
||||
@@ -63,10 +63,11 @@ internal static class EndGamePatch
|
||||
DateTime date = value.RealKiller.TimeStamp;
|
||||
if (date == DateTime.MinValue) continue;
|
||||
|
||||
long secondsIn = new DateTimeOffset(date.ToUniversalTime()).ToUnixTimeSeconds() - IntroCutsceneDestroyPatch.IntroDestroyTS;
|
||||
byte killerId = value.GetRealKiller();
|
||||
bool gmIsFm = Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.StopAndGo;
|
||||
bool gmIsFmhh = gmIsFm || Options.CurrentGameMode is CustomGameMode.HotPotato or CustomGameMode.HideAndSeek or CustomGameMode.Speedrun or CustomGameMode.CaptureTheFlag or CustomGameMode.NaturalDisasters or CustomGameMode.RoomRush or CustomGameMode.KingOfTheZones or CustomGameMode.Quiz or CustomGameMode.TheMindGame or CustomGameMode.BedWars or CustomGameMode.Deathrace or CustomGameMode.Mingle or CustomGameMode.Snowdown;
|
||||
sb.Append($"\n{date:T} {Main.AllPlayerNames[key]} ({(gmIsFmhh ? string.Empty : Utils.GetDisplayRoleName(key, true))}{(gmIsFm ? string.Empty : Utils.GetSubRolesText(key, summary: true))}) [{Utils.GetVitalText(key)}]");
|
||||
sb.Append($"\n{secondsIn / 60:00}:{secondsIn % 60:00} {Main.AllPlayerNames[key]} ({(gmIsFmhh ? string.Empty : Utils.GetDisplayRoleName(key, true))}{(gmIsFm ? string.Empty : Utils.GetSubRolesText(key, summary: true))}) [{Utils.GetVitalText(key)}]");
|
||||
if (killerId != byte.MaxValue && killerId != key) sb.Append($"\n\t⇐ {Main.AllPlayerNames[killerId]} ({(gmIsFmhh ? string.Empty : Utils.GetDisplayRoleName(killerId, true))}{(gmIsFm ? string.Empty : Utils.GetSubRolesText(killerId, summary: true))})");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user