mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-19 15:51:58 +00:00
still fixes
This commit is contained in:
1 parent
3504219b2a
commit
33a32cc521
50 files changed
+206
-208
No files matched your search
@@ -1017,7 +1017,7 @@ public static class NaturalDisasters
|
||||
const int id = 69_216_600;
|
||||
Color color = Utils.GetRoleColor(CustomRoles.NDPlayer);
|
||||
|
||||
MovingSpeed = new FloatOptionItem(id, "ND_Tsunami.MovingSpeed", new(0.25f, 10f, 0.25f), 2f, TabGroup.GameSettings)
|
||||
MovingSpeed = new FloatOptionItem(id, "ND_Tsunami.MovingSpeed", new(0.25f, 10f, 0.25f), 2.5f, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.NaturalDisasters)
|
||||
.SetColor(color)
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
|
||||
@@ -944,8 +944,9 @@ public class Main : BasePlugin
|
||||
|
||||
if (!OperatingSystem.IsAndroid())
|
||||
{
|
||||
// there are some issues with TextBoxPatch on Android
|
||||
// there are some issues with TextBoxPatch and DiscordRPC on Android
|
||||
Harmony.PatchAll(typeof(TextBoxPatch));
|
||||
Harmony.PatchAll(typeof(DiscordRPC));
|
||||
}
|
||||
|
||||
if (!DebugModeManager.AmDebugger)
|
||||
|
||||
@@ -820,12 +820,12 @@ public static class CustomRpcSenderExtensions
|
||||
|
||||
if (alreadyContainsKey)
|
||||
{
|
||||
if (log) Logger.Info($"Extended name notify for {pc.GetNameWithRole().RemoveHtmlTags()}: {text} ({time}s)", "Name Notify");
|
||||
if (log) Logger.Info($"Extended name notify for {pc.GetNameWithRole()}: {text} ({time}s)", "Name Notify");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
if (setName) returnValue |= Utils.WriteSetNameRpcsToSender(ref sender, false, false, false, false, false, false, pc, [pc], [], out bool senderWasCleared) && !senderWasCleared;
|
||||
if (log) Logger.Info($"New name notify for {pc.GetNameWithRole().RemoveHtmlTags()}: {text} ({time}s)", "Name Notify");
|
||||
if (log) Logger.Info($"New name notify for {pc.GetNameWithRole()}: {text} ({time}s)", "Name Notify");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
@@ -842,13 +842,13 @@ public static class CustomRpcSenderExtensions
|
||||
|
||||
if (pc.inVent || pc.inMovingPlat || pc.onLadder || !pc.IsAlive() || pc.MyPhysics.Animations.IsPlayingAnyLadderAnimation() || pc.MyPhysics.Animations.IsPlayingEnterVentAnimation())
|
||||
{
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole().RemoveHtmlTags()}) is in an un-teleportable state - Teleporting canceled", "TP");
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole()}) is in an un-teleportable state - Teleporting canceled", "TP");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FastVector2.DistanceWithinRange(pc.Pos(), location, 0.5f))
|
||||
{
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole().RemoveHtmlTags()}) is too close to the destination - Teleporting canceled", "TP");
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole()}) is too close to the destination - Teleporting canceled", "TP");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -864,7 +864,7 @@ public static class CustomRpcSenderExtensions
|
||||
sender.Write(newSid);
|
||||
sender.EndRpc();
|
||||
|
||||
if (log) Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} => {location}", "TP");
|
||||
if (log) Logger.Info($"{pc.GetNameWithRole()} => {location}", "TP");
|
||||
|
||||
CheckInvalidMovementPatch.LastPosition[pc.PlayerId] = location;
|
||||
CheckInvalidMovementPatch.ExemptedPlayers.Add(pc.PlayerId);
|
||||
|
||||
@@ -2466,28 +2466,28 @@ internal static class ExtendedPlayerControl
|
||||
}
|
||||
}
|
||||
|
||||
extension(NetworkedPlayerInfo player)
|
||||
extension(NetworkedPlayerInfo playerInfo)
|
||||
{
|
||||
public CustomRoles GetCustomRole()
|
||||
{
|
||||
return (!player || !player.Object) ? CustomRoles.Crewmate : player.Object.GetCustomRole();
|
||||
return (!playerInfo || !playerInfo.Object) ? CustomRoles.Crewmate : playerInfo.Object.GetCustomRole();
|
||||
}
|
||||
|
||||
public DataFlagRateLimiter.QueuedAction SendGameData()
|
||||
public DataFlagRateLimiter.QueuedAction SendGameData(SendOption sendOption = SendOption.Reliable)
|
||||
{
|
||||
return DataFlagRateLimiter.Enqueue(() =>
|
||||
{
|
||||
MessageWriter writer = MessageWriter.Get(SendOption.Reliable);
|
||||
MessageWriter writer = MessageWriter.Get(sendOption);
|
||||
writer.StartMessage(5);
|
||||
writer.Write(AmongUsClient.Instance.GameId);
|
||||
writer.StartMessage(1);
|
||||
writer.WritePacked(player.NetId);
|
||||
player.Serialize(writer, false);
|
||||
writer.WritePacked(playerInfo.NetId);
|
||||
playerInfo.Serialize(writer, false);
|
||||
writer.EndMessage();
|
||||
writer.EndMessage();
|
||||
AmongUsClient.Instance.SendOrDisconnect(writer);
|
||||
writer.Recycle();
|
||||
});
|
||||
}, channel: sendOption);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ public class TaskState
|
||||
|
||||
public void Init(PlayerControl player)
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: InitTask", "TaskState.Init");
|
||||
Logger.Info($"{player.GetNameWithRole()}: InitTask", "TaskState.Init");
|
||||
if (!player || player.Data?.Tasks == null) return;
|
||||
|
||||
if (!Utils.HasTasks(player.Data, false))
|
||||
@@ -449,14 +449,14 @@ public class TaskState
|
||||
HasTasks = true;
|
||||
CompletedTasksCount = 0;
|
||||
AllTasksCount = player.Data.Tasks.Count;
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Init");
|
||||
Logger.Info($"{player.GetNameWithRole()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Init");
|
||||
}
|
||||
|
||||
public void Update(PlayerControl player)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: UpdateTask", "TaskState.Update");
|
||||
Logger.Info($"{player.GetNameWithRole()}: UpdateTask", "TaskState.Update");
|
||||
GameData.Instance.RecomputeTaskCounts();
|
||||
Logger.Info($"TotalTaskCounts = {GameData.Instance.CompletedTasks}/{GameData.Instance.TotalTasks}", "TaskState.Update");
|
||||
|
||||
@@ -534,7 +534,7 @@ public class TaskState
|
||||
CompletedTasksCount++;
|
||||
|
||||
CompletedTasksCount = Math.Min(AllTasksCount, CompletedTasksCount);
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Update");
|
||||
Logger.Info($"{player.GetNameWithRole()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Update");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ public static class GuessManager
|
||||
if (!isUI) Utils.SendMessage(GetString("CantGuessJailed"), pc.PlayerId, CustomRoles.Jailor.ColoredTextByRole(GetString("JailorTitle")));
|
||||
else pc.ShowPopUp($"{CustomRoles.Jailor.ColoredTextByRole(GetString("JailorTitle"))}\n{GetString("CantGuessJailed")}");
|
||||
|
||||
Logger.Info($"Player {pc.GetNameWithRole().RemoveHtmlTags()} tried to guess jailed player {target.GetNameWithRole().RemoveHtmlTags()}", "Guesser");
|
||||
Logger.Info($"Player {pc.GetNameWithRole()} tried to guess jailed player {target.GetNameWithRole()}", "Guesser");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public static class GuessManager
|
||||
if (!isUI) Utils.SendMessage(GetString("JailedCanOnlyGuessJailor"), pc.PlayerId, CustomRoles.Jailor.ColoredTextByRole(GetString("JailorTitle")));
|
||||
else pc.ShowPopUp($"{CustomRoles.Jailor.ColoredTextByRole(GetString("JailorTitle"))}\n{GetString("JailedCanOnlyGuessJailor")}");
|
||||
|
||||
Logger.Info($"Player {pc.GetNameWithRole().RemoveHtmlTags()} tried to guess {target.GetNameWithRole().RemoveHtmlTags()} while jailed", "Guesser");
|
||||
Logger.Info($"Player {pc.GetNameWithRole()} tried to guess {target.GetNameWithRole()} while jailed", "Guesser");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ public static class GuessManager
|
||||
// -----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} guessed {target.GetNameWithRole().RemoveHtmlTags()}", "Guesser");
|
||||
Logger.Info($"{pc.GetNameWithRole()} guessed {target.GetNameWithRole()}", "Guesser");
|
||||
PlayerControl dp = guesserSuicide ? pc : target;
|
||||
target = dp;
|
||||
|
||||
|
||||
@@ -43,12 +43,12 @@ public static class NameNotifyManager
|
||||
|
||||
if (alreadyContainsKey)
|
||||
{
|
||||
if (log) Logger.Info($"Extended name notify for {pc.GetNameWithRole().RemoveHtmlTags()}: {text} ({time}s)", "Name Notify");
|
||||
if (log) Logger.Info($"Extended name notify for {pc.GetNameWithRole()}: {text} ({time}s)", "Name Notify");
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc, SendOption: sendOption);
|
||||
if (log) Logger.Info($"New name notify for {pc.GetNameWithRole().RemoveHtmlTags()}: {text} ({time}s)", "Name Notify");
|
||||
if (log) Logger.Info($"New name notify for {pc.GetNameWithRole()}: {text} ({time}s)", "Name Notify");
|
||||
}
|
||||
|
||||
public static void OnFixedUpdate()
|
||||
|
||||
+17
-4
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using AmongUs.QuickChat;
|
||||
using EHR.Gamemodes;
|
||||
using EHR.Patches;
|
||||
using EHR.Roles;
|
||||
@@ -311,7 +312,7 @@ internal static class RPCHandlerPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
Logger.Info($"RPC Set Name For Player: {__instance.GetNameWithRole().RemoveHtmlTags()} => {name}", "SetName");
|
||||
Logger.Info($"RPC Set Name For Player: {__instance.GetNameWithRole()} => {name}", "SetName");
|
||||
break;
|
||||
case RpcCalls.SetRole:
|
||||
var role = (RoleTypes)subReader.ReadUInt16();
|
||||
@@ -320,7 +321,7 @@ internal static class RPCHandlerPatch
|
||||
break;
|
||||
case RpcCalls.SendChat:
|
||||
string text = subReader.ReadString();
|
||||
Logger.Info($"({__instance.FriendCode}|{__instance.GetClient()?.GetHashedPuid()}) {__instance.GetNameWithRole().RemoveHtmlTags()}: {text}", "ReceiveChat");
|
||||
Logger.Info($"({__instance.FriendCode}|{__instance.GetClient()?.GetHashedPuid()}) {__instance.GetNameWithRole()}: {text}", "ReceiveChat");
|
||||
ChatCommands.OnReceiveChat(__instance, text, out bool canceled);
|
||||
|
||||
if (canceled)
|
||||
@@ -329,13 +330,25 @@ internal static class RPCHandlerPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
case RpcCalls.SendQuickChat:
|
||||
string quickText = QuickChatNetData.Deserialize(subReader).ToChatText();
|
||||
Logger.Info($"({__instance.FriendCode}|{__instance.GetClient()?.GetHashedPuid()}) {__instance.GetNameWithRole()}: {quickText}", "ReceiveQuickChat");
|
||||
ChatCommands.OnReceiveChat(__instance, quickText, out bool quickCanceled);
|
||||
|
||||
if (quickCanceled)
|
||||
{
|
||||
subReader.Recycle();
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
case RpcCalls.StartMeeting:
|
||||
PlayerControl p = Utils.GetPlayerById(subReader.ReadByte());
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()} => {p?.GetNameWithRole() ?? "null"}", "StartMeeting");
|
||||
Logger.Info($"{__instance.GetNameWithRole()} => {p?.GetNameWithRole() ?? "null"}", "StartMeeting");
|
||||
break;
|
||||
case RpcCalls.Pet:
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()} petted their pet", "RpcHandlerPatch");
|
||||
Logger.Info($"{__instance.GetNameWithRole()} petted their pet", "RpcHandlerPatch");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+71
-90
@@ -180,7 +180,7 @@ public static class Utils
|
||||
|
||||
if (pc.inVent || pc.inMovingPlat || pc.onLadder || !pc.IsAlive() || pc.MyPhysics.Animations.IsPlayingAnyLadderAnimation() || pc.MyPhysics.Animations.IsPlayingEnterVentAnimation() || (submerged && pc.AmOwner && SubmergedCompatibility.GetInTransition()))
|
||||
{
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole().RemoveHtmlTags()}) is in an un-teleportable state - Teleporting canceled", "TP");
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole()}) is in an un-teleportable state - Teleporting canceled", "TP");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -188,12 +188,12 @@ public static class Utils
|
||||
{
|
||||
case < 0.3f:
|
||||
{
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole().RemoveHtmlTags()}) is too close to the destination - Teleporting canceled", "TP");
|
||||
if (log) Logger.Warn($"Target ({pc.GetNameWithRole()}) is too close to the destination - Teleporting canceled", "TP");
|
||||
return false;
|
||||
}
|
||||
case < 1.5f when !GameStates.IsLobby:
|
||||
{
|
||||
if (log) Logger.Msg($"Target ({pc.GetNameWithRole().RemoveHtmlTags()}) is too close to the destination - Changed to SendOption.None", "TP");
|
||||
if (log) Logger.Msg($"Target ({pc.GetNameWithRole()}) is too close to the destination - Changed to SendOption.None", "TP");
|
||||
sendOption = SendOption.None;
|
||||
break;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public static class Utils
|
||||
messageWriter.Write(newSid);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
|
||||
|
||||
if (log) Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} => {location}", "TP");
|
||||
if (log) Logger.Info($"{pc.GetNameWithRole()} => {location}", "TP");
|
||||
|
||||
if (submerged)
|
||||
{
|
||||
@@ -246,7 +246,7 @@ public static class Utils
|
||||
Il2CppReferenceArray<Vent> vents = ShipStatus.Instance.AllVents;
|
||||
Vent vent = vents.RandomElement();
|
||||
|
||||
Logger.Info($"{nt.myPlayer.GetNameWithRole().RemoveHtmlTags()} => {vent.transform.position} (vent)", "TP");
|
||||
Logger.Info($"{nt.myPlayer.GetNameWithRole()} => {vent.transform.position} (vent)", "TP");
|
||||
|
||||
return TP(nt, new(vent.transform.position.x, vent.transform.position.y + 0.3636f), log);
|
||||
}
|
||||
@@ -1117,7 +1117,7 @@ public static class Utils
|
||||
PlayerControl pc = GetPlayerById(playerId);
|
||||
|
||||
try { state.Role.GetProgressText(playerId, comms, ProgressText); }
|
||||
catch (Exception ex) { Logger.Error($"For {pc.GetNameWithRole().RemoveHtmlTags()}, failed to get progress text: " + ex, "Utils.GetProgressText"); }
|
||||
catch (Exception ex) { Logger.Error($"For {pc.GetNameWithRole()}, failed to get progress text: " + ex, "Utils.GetProgressText"); }
|
||||
|
||||
if (pc.Is(CustomRoles.Damocles)) Damocles.GetProgressText(playerId, ProgressText);
|
||||
if (pc.Is(CustomRoles.Stressed)) Stressed.GetProgressText(playerId, ProgressText);
|
||||
@@ -3867,67 +3867,40 @@ public static class Utils
|
||||
|
||||
public static IEnumerator SendGameDataContinuously()
|
||||
{
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
float waitTime = GameData.Instance.AllPlayers.Count switch
|
||||
{
|
||||
<= 15 => 1f,
|
||||
<= 20 => 0.8f,
|
||||
_ => 0.5f
|
||||
};
|
||||
|
||||
while (GameStates.InGame && !GameStates.IsEnded && ShipStatus.Instance)
|
||||
{
|
||||
if (ReportDeadBodyPatch.MeetingStarted || GameStates.IsMeeting || ExileController.Instance || AntiBlackout.SkipTasks)
|
||||
{
|
||||
stopwatch.Reset();
|
||||
yield return new WaitForSecondsRealtime(10f);
|
||||
stopwatch.Start();
|
||||
continue;
|
||||
}
|
||||
|
||||
int messages = 0;
|
||||
|
||||
MessageWriter writer = MessageWriter.Get();
|
||||
writer.StartMessage(5);
|
||||
writer.Write(AmongUsClient.Instance.GameId);
|
||||
|
||||
for (var index = 0; index < GameData.Instance.AllPlayers.Count; index++)
|
||||
{
|
||||
NetworkedPlayerInfo playerinfo = GameData.Instance.AllPlayers[index];
|
||||
NetworkedPlayerInfo playerInfo = GameData.Instance.AllPlayers[index];
|
||||
|
||||
if (!playerInfo || (Astral.On && Main.PlayerStates.TryGetValue(playerInfo.PlayerId, out PlayerState state) && state.Role is Astral { Timer: not null }) || (SoulCollector.On && Main.PlayerStates.Values.Any(x => x.Role is SoulCollector sc && sc.ToExile.Contains(playerInfo.PlayerId)))) continue;
|
||||
|
||||
if (writer.Length > 500 || messages >= AmongUsClient.Instance.GetMaxMessagePackingLimit())
|
||||
playerInfo.IsDead = !playerInfo.Object.IsAlive();
|
||||
|
||||
var qa = playerInfo.SendGameData(SendOption.None);
|
||||
yield return qa.Wait();
|
||||
|
||||
if (qa.Dropped || !GameStates.InGame || GameStates.IsEnded || !ShipStatus.Instance)
|
||||
{
|
||||
messages = 0;
|
||||
writer.EndMessage();
|
||||
var qa = DataFlagRateLimiter.Enqueue(() => AmongUsClient.Instance.SendOrDisconnect(writer), channel: SendOption.None);
|
||||
yield return qa.Wait();
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
|
||||
if (qa.Dropped || !GameStates.InGame || GameStates.IsEnded || !ShipStatus.Instance)
|
||||
{
|
||||
writer.Recycle();
|
||||
Logger.Msg("Coroutine finished", nameof(SendGameDataContinuously));
|
||||
yield break;
|
||||
}
|
||||
|
||||
writer.Clear(SendOption.None);
|
||||
writer.StartMessage(5);
|
||||
writer.Write(AmongUsClient.Instance.GameId);
|
||||
Logger.Msg("Coroutine finished", nameof(SendGameDataContinuously));
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (!playerinfo || (SoulCollector.On && Main.PlayerStates.Values.Any(x => x.Role is SoulCollector sc && sc.ToExile.Contains(playerinfo.PlayerId)))) continue;
|
||||
|
||||
playerinfo.IsDead = !playerinfo.Object.IsAlive();
|
||||
|
||||
writer.StartMessage(1);
|
||||
writer.WritePacked(playerinfo.NetId);
|
||||
playerinfo.Serialize(writer, false);
|
||||
writer.EndMessage();
|
||||
|
||||
messages++;
|
||||
yield return new WaitForSecondsRealtime(waitTime);
|
||||
}
|
||||
|
||||
writer.EndMessage();
|
||||
if (messages > 0) yield return DataFlagRateLimiter.Enqueue(() => AmongUsClient.Instance.SendOrDisconnect(writer), channel: SendOption.None).Wait();
|
||||
writer.Recycle();
|
||||
|
||||
stopwatch.Reset();
|
||||
yield return new WaitForSecondsRealtime(5f);
|
||||
stopwatch.Start();
|
||||
}
|
||||
|
||||
Logger.Msg("Coroutine finished", nameof(SendGameDataContinuously));
|
||||
@@ -3942,7 +3915,7 @@ public static class Utils
|
||||
writer.Write(AmongUsClient.Instance.GameId);
|
||||
writer.WritePacked(targetClientId);
|
||||
|
||||
foreach (NetworkedPlayerInfo playerinfo in GameData.Instance.AllPlayers)
|
||||
foreach (NetworkedPlayerInfo playerInfo in GameData.Instance.AllPlayers)
|
||||
{
|
||||
if (writer.Length > 500 || messages >= AmongUsClient.Instance.GetMaxMessagePackingLimit())
|
||||
{
|
||||
@@ -3964,8 +3937,8 @@ public static class Utils
|
||||
}
|
||||
|
||||
writer.StartMessage(1);
|
||||
writer.WritePacked(playerinfo.NetId);
|
||||
playerinfo.Serialize(writer, false);
|
||||
writer.WritePacked(playerInfo.NetId);
|
||||
playerInfo.Serialize(writer, false);
|
||||
writer.EndMessage();
|
||||
|
||||
messages++;
|
||||
@@ -4532,7 +4505,7 @@ public static class Utils
|
||||
|
||||
return num switch
|
||||
{
|
||||
< 128 when player => player.GetNameWithRole().RemoveHtmlTags(),
|
||||
< 128 when player => player.GetNameWithRole(),
|
||||
253 => "Skip",
|
||||
254 => "None",
|
||||
255 => "Dead",
|
||||
@@ -5071,49 +5044,57 @@ public static class Utils
|
||||
|
||||
public static string GetRegionName(IRegionInfo region = null, bool ignoreNetworkMode = false)
|
||||
{
|
||||
region ??= ServerManager.Instance.CurrentRegion;
|
||||
|
||||
string name = region.Name;
|
||||
|
||||
if (!ignoreNetworkMode && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
|
||||
try
|
||||
{
|
||||
name = "Local Game";
|
||||
return name;
|
||||
}
|
||||
region ??= ServerManager.Instance.CurrentRegion;
|
||||
|
||||
if (region.PingServer.EndsWith("among.us", StringComparison.Ordinal))
|
||||
{
|
||||
// Official server
|
||||
name = name switch
|
||||
string name = region.Name;
|
||||
|
||||
if (!ignoreNetworkMode && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
|
||||
{
|
||||
"North America" => "NA",
|
||||
"Europe" => "EU",
|
||||
"Asia" => "AS",
|
||||
_ => name
|
||||
};
|
||||
name = "Local Game";
|
||||
return name;
|
||||
}
|
||||
|
||||
if (region.PingServer.EndsWith("among.us", StringComparison.Ordinal))
|
||||
{
|
||||
// Official server
|
||||
name = name switch
|
||||
{
|
||||
"North America" => "NA",
|
||||
"Europe" => "EU",
|
||||
"Asia" => "AS",
|
||||
_ => name
|
||||
};
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
string ip = region.Servers.FirstOrDefault()?.Ip ?? string.Empty;
|
||||
|
||||
if (ip.Contains("aumods.org", StringComparison.Ordinal) || ip.Contains("duikbo.at", StringComparison.Ordinal))
|
||||
{
|
||||
// Official Modded Server
|
||||
if (ip.Contains("au-eu"))
|
||||
name = "MEU";
|
||||
else if (ip.Contains("au-as"))
|
||||
name = "MAS";
|
||||
else
|
||||
name = "MNA";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
if (name.Contains("Niko", StringComparison.OrdinalIgnoreCase))
|
||||
name = name.Replace("233(", "-").Replace("233 (", "-").TrimEnd(')');
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
string ip = region.Servers.FirstOrDefault()?.Ip ?? string.Empty;
|
||||
|
||||
if (ip.Contains("aumods.org", StringComparison.Ordinal) || ip.Contains("duikbo.at", StringComparison.Ordinal))
|
||||
catch
|
||||
{
|
||||
// Official Modded Server
|
||||
if (ip.Contains("au-eu"))
|
||||
name = "MEU";
|
||||
else if (ip.Contains("au-as"))
|
||||
name = "MAS";
|
||||
else
|
||||
name = "MNA";
|
||||
|
||||
return name;
|
||||
try { return (region ?? ServerManager.Instance.CurrentRegion).Name; }
|
||||
catch { return string.Empty; }
|
||||
}
|
||||
|
||||
if (name.Contains("Niko", StringComparison.OrdinalIgnoreCase))
|
||||
name = name.Replace("233(", "-").Replace("233 (", "-").TrimEnd(')');
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private static (int AddonsProgress, int RolesProgress) QuickSetupProgress;
|
||||
|
||||
@@ -430,12 +430,12 @@ internal static class GameEndChecker
|
||||
|
||||
if (toGhostImpostor)
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()}: changed to ImpostorGhost", "ResetRoleAndEndGame");
|
||||
Logger.Info($"{pc.GetNameWithRole()}: changed to ImpostorGhost", "ResetRoleAndEndGame");
|
||||
pc.RpcSetRole(RoleTypes.ImpostorGhost);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()}: changed to CrewmateGhost", "ResetRoleAndEndGame");
|
||||
Logger.Info($"{pc.GetNameWithRole()}: changed to CrewmateGhost", "ResetRoleAndEndGame");
|
||||
pc.RpcSetRole(RoleTypes.CrewmateGhost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using EHR.Modules;
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using static EHR.Translator;
|
||||
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ using HarmonyLib;
|
||||
namespace EHR.Patches;
|
||||
|
||||
// Originally from "Town of Us Rewritten", by Det
|
||||
[HarmonyPatch(typeof(ActivityManager), nameof(ActivityManager.UpdateActivity))]
|
||||
public static class DiscordRPC
|
||||
{
|
||||
private static string Lobbycode = "";
|
||||
private static string Region = "";
|
||||
|
||||
[HarmonyPatch(typeof(ActivityManager), nameof(ActivityManager.UpdateActivity))]
|
||||
public static void Prefix([HarmonyArgument(0)] Activity activity)
|
||||
{
|
||||
if (activity == null) return;
|
||||
|
||||
@@ -600,7 +600,7 @@ public static class NumberOptionPatch
|
||||
case StringNames.GameShortTasks:
|
||||
case StringNames.GameLongTasks:
|
||||
case StringNames.GameCommonTasks:
|
||||
__instance.ValidRange = new(0, 90);
|
||||
__instance.ValidRange = new(0, 85);
|
||||
__instance.Value = (float)Math.Round(__instance.Value, 2);
|
||||
break;
|
||||
case StringNames.GameKillCooldown:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AmongUs.Data;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Gamemodes;
|
||||
@@ -127,6 +128,12 @@ public static class GameStartManagerPatch
|
||||
private static int MinPlayer;
|
||||
private static SpriteRenderer LobbyTimerBg;
|
||||
public static bool Warned;
|
||||
|
||||
private static readonly Type DiscordManagerType = AccessTools.TypeByName("DiscordManager");
|
||||
private static readonly PropertyInfo InstanceExistsProperty = DiscordManagerType?.GetProperty("InstanceExists");
|
||||
private static readonly PropertyInfo InstanceProperty = DiscordManagerType?.GetProperty("Instance");
|
||||
private static readonly MethodInfo SetInLobbyHostMethod = DiscordManagerType?.GetMethod("SetInLobbyHost");
|
||||
private static readonly MethodInfo SetInLobbyClientMethod = DiscordManagerType?.GetMethod("SetInLobbyClient");
|
||||
|
||||
public static bool Prefix(GameStartManager __instance)
|
||||
{
|
||||
@@ -156,7 +163,7 @@ public static class GameStartManagerPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (!AmongUsClient.Instance || !GameData.Instance) return true;
|
||||
if (!GameData.Instance) return true;
|
||||
|
||||
CheckAutoStart(__instance);
|
||||
}
|
||||
@@ -284,12 +291,10 @@ public static class GameStartManagerPatch
|
||||
ActionMapGlyphDisplay startButtonGlyph = instance.StartButtonGlyph;
|
||||
startButtonGlyph?.SetColor(instance.LastPlayerCount >= instance.MinPlayers ? Palette.EnabledColor : Palette.DisabledClear);
|
||||
|
||||
if (DiscordManager.InstanceExists)
|
||||
if (DiscordManagerType != null && ((bool?)InstanceExistsProperty?.GetValue(null) ?? false))
|
||||
{
|
||||
if (AmongUsClient.Instance.AmHost && AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame)
|
||||
DiscordManager.Instance.SetInLobbyHost(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
else
|
||||
DiscordManager.Instance.SetInLobbyClient(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
MethodInfo method = AmongUsClient.Instance.AmHost && AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame ? SetInLobbyHostMethod : SetInLobbyClientMethod;
|
||||
method?.Invoke(InstanceProperty?.GetValue(null), [instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ internal static class CheckForEndVotingPatch
|
||||
|
||||
Statistics.OnVotingComplete(States.ToArray(), voteTarget.Data, false, true);
|
||||
|
||||
Logger.Info($"{voteTarget.GetNameWithRole().RemoveHtmlTags()} expelled by dictator", "Dictator");
|
||||
Logger.Info($"{voteTarget.GetNameWithRole()} expelled by dictator", "Dictator");
|
||||
CheckForDeathOnExile(PlayerState.DeathReason.Vote, pva.VotedFor);
|
||||
Logger.Info("Dictatorship vote, forced end of meeting", "Special Phase");
|
||||
|
||||
@@ -140,11 +140,11 @@ internal static class CheckForEndVotingPatch
|
||||
{
|
||||
case VoteMode.Suicide:
|
||||
TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.SkippedVote, ps.TargetPlayerId);
|
||||
voteLog.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} Commit suicide for skipping voting");
|
||||
voteLog.Info($"{voter.GetNameWithRole()} Commit suicide for skipping voting");
|
||||
break;
|
||||
case VoteMode.SelfVote:
|
||||
ps.VotedFor = ps.TargetPlayerId;
|
||||
voteLog.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} Self-voting due to skipping voting");
|
||||
voteLog.Info($"{voter.GetNameWithRole()} Self-voting due to skipping voting");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -155,15 +155,15 @@ internal static class CheckForEndVotingPatch
|
||||
{
|
||||
case VoteMode.Suicide:
|
||||
TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.DidntVote, ps.TargetPlayerId);
|
||||
voteLog.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} Committed suicide for not voting");
|
||||
voteLog.Info($"{voter.GetNameWithRole()} Committed suicide for not voting");
|
||||
break;
|
||||
case VoteMode.SelfVote:
|
||||
ps.VotedFor = ps.TargetPlayerId;
|
||||
voteLog.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} Self-voting due to not voting");
|
||||
voteLog.Info($"{voter.GetNameWithRole()} Self-voting due to not voting");
|
||||
break;
|
||||
case VoteMode.Skip:
|
||||
ps.VotedFor = 253;
|
||||
voteLog.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} Skip for not voting");
|
||||
voteLog.Info($"{voter.GetNameWithRole()} Skip for not voting");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -548,7 +548,7 @@ internal static class CheckForEndVotingPatch
|
||||
{
|
||||
if (playerIds.Length == 0) return;
|
||||
Logger.Info($"{playerIds.Join(x => Main.AllPlayerNames[x])} - died with the reason: {deathReason}", "TryAddAfterMeetingDeathPlayers");
|
||||
byte[] addedIdList = playerIds.Where(playerId => Main.AfterMeetingDeathPlayers.TryAdd(playerId, deathReason)).ToArray();
|
||||
byte[] addedIdList = playerIds.Where(id => (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || state.MainRole != CustomRoles.Pestilence) && Main.AfterMeetingDeathPlayers.TryAdd(id, deathReason)).ToArray();
|
||||
CheckForDeathOnExile(deathReason, addedIdList);
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ internal static class CheckForEndVotingPatch
|
||||
|
||||
TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.Revenge, target.PlayerId);
|
||||
target.SetRealKiller(player);
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} revenged: {target.GetNameWithRole().RemoveHtmlTags()}", "RevengeOnExile");
|
||||
Logger.Info($"{player.GetNameWithRole()} revenged: {target.GetNameWithRole()}", "RevengeOnExile");
|
||||
}
|
||||
|
||||
private static PlayerControl PickRevengeTarget(PlayerControl exiledplayer /*, PlayerState.DeathReason deathReason*/)
|
||||
@@ -1251,7 +1251,7 @@ internal static class MeetingHudUpdatePatch
|
||||
Main.PlayerStates[player.PlayerId].SetDead();
|
||||
Utils.AfterPlayerDeathTasks(player, true);
|
||||
Utils.SendMessage(string.Format(GetString("Message.Executed"), player.Data.PlayerName));
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} was executed by the host", "Execution");
|
||||
Logger.Info($"{player.GetNameWithRole()} was executed by the host", "Execution");
|
||||
__instance.CheckForEndVoting();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -92,9 +92,9 @@ internal static class ExternalRpcPetPatch
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info($"Player {pc.GetNameWithRole().RemoveHtmlTags()} petted their pet", "PetActionTrigger");
|
||||
Logger.Info($"Player {pc.GetNameWithRole()} petted their pet", "PetActionTrigger");
|
||||
|
||||
LateTask.New(() => OnPetUse(pc), 0.2f, $"OnPetUse: {pc.GetNameWithRole().RemoveHtmlTags()}", false);
|
||||
LateTask.New(() => OnPetUse(pc), 0.2f, $"OnPetUse: {pc.GetNameWithRole()}", false);
|
||||
}
|
||||
|
||||
private static void OnPetUse(PlayerControl pc)
|
||||
|
||||
@@ -23,7 +23,7 @@ internal static class CheckProtectPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || target.Data.IsDead || !target.IsAlive()) return false;
|
||||
|
||||
Logger.Info($"CheckProtect: {__instance.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "CheckProtect");
|
||||
Logger.Info($"CheckProtect: {__instance.GetNameWithRole()} => {target.GetNameWithRole()}", "CheckProtect");
|
||||
|
||||
if (__instance.HasAbilityCD())
|
||||
{
|
||||
@@ -105,11 +105,11 @@ internal static class CheckMurderPatch
|
||||
|
||||
AFKDetector.SetNotAFK(killer.PlayerId);
|
||||
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "CheckMurder");
|
||||
Logger.Info($"{killer.GetNameWithRole()} => {target.GetNameWithRole()}", "CheckMurder");
|
||||
|
||||
if (killer.Data.IsDead)
|
||||
{
|
||||
Logger.Info($"Killer {killer.GetNameWithRole().RemoveHtmlTags()} is dead, kill canceled", "CheckMurder");
|
||||
Logger.Info($"Killer {killer.GetNameWithRole()} is dead, kill canceled", "CheckMurder");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ internal static class CheckMurderPatch
|
||||
|
||||
if (killer.PlayerId != target.PlayerId && !killer.CanUseKillButton())
|
||||
{
|
||||
Logger.Info(killer.GetNameWithRole().RemoveHtmlTags() + " cannot use their kill button, the kill was blocked", "CheckMurder");
|
||||
Logger.Info(killer.GetNameWithRole() + " cannot use their kill button, the kill was blocked", "CheckMurder");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ internal static class CheckMurderPatch
|
||||
if (Penguin.IsVictim(killer)) return false;
|
||||
|
||||
Sniper.TryGetSniper(target.PlayerId, ref killer);
|
||||
if (killer != __instance) Logger.Info($"Real Killer: {killer.GetNameWithRole().RemoveHtmlTags()}", "CheckMurder");
|
||||
if (killer != __instance) Logger.Info($"Real Killer: {killer.GetNameWithRole()}", "CheckMurder");
|
||||
|
||||
if (Pelican.IsEaten(target.PlayerId)) return false;
|
||||
|
||||
@@ -672,7 +672,7 @@ internal static class MurderPlayerPatch
|
||||
}
|
||||
catch (Exception e) { ThrowException(e); }
|
||||
|
||||
if (killer != __instance) Logger.Info($"Real Killer = {killer.GetNameWithRole().RemoveHtmlTags()}", "MurderPlayer");
|
||||
if (killer != __instance) Logger.Info($"Real Killer = {killer.GetNameWithRole()}", "MurderPlayer");
|
||||
|
||||
if (Main.PlayerStates[target.PlayerId].deathReason == PlayerState.DeathReason.etc)
|
||||
{
|
||||
@@ -776,7 +776,7 @@ internal static class MurderPlayerPatch
|
||||
delay = Math.Max(delay, 0.15f);
|
||||
if (delay > 0.15f && Options.BaitDelayNotify.GetBool()) killer.Notify(CustomRoles.Bait.ColoredTextByRole(string.Format(GetString("KillBaitNotify"), (int)delay)), delay);
|
||||
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} killed Bait => {target.GetNameWithRole().RemoveHtmlTags()}", "MurderPlayer");
|
||||
Logger.Info($"{killer.GetNameWithRole()} killed Bait => {target.GetNameWithRole()}", "MurderPlayer");
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
@@ -1029,11 +1029,11 @@ internal static class ReportDeadBodyPatch
|
||||
if (AmongUsClient.Instance.AmHost && (!CanReport[__instance.PlayerId] || __instance.IsRoleBlocked()))
|
||||
{
|
||||
WaitReport[__instance.PlayerId].Add(target);
|
||||
Logger.Warn($"{__instance.GetNameWithRole().RemoveHtmlTags()}: Reporting is currently prohibited, so we will wait until it becomes possible.", "ReportDeadBody");
|
||||
Logger.Warn($"{__instance.GetNameWithRole()}: Reporting is currently prohibited, so we will wait until it becomes possible.", "ReportDeadBody");
|
||||
return false;
|
||||
}
|
||||
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()} => {target?.Object?.GetNameWithRole() ?? "null"}", "ReportDeadBody");
|
||||
Logger.Info($"{__instance.GetNameWithRole()} => {target?.Object?.GetNameWithRole() ?? "null"}", "ReportDeadBody");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1423,7 +1423,7 @@ internal static class ReportDeadBodyPatch
|
||||
// Fix name when LateTask "Shapeshift Patch - Force Name" was not revert name back before meeting started
|
||||
if (pc.IsShifted() && Main.ShapeshiftIsAnimated.GetValueOrDefault(pc.PlayerId))
|
||||
{
|
||||
Logger.Info($"Revert name back for shifted player: {player.GetNameWithRole().RemoveHtmlTags()}", "ReportDeadBody");
|
||||
Logger.Info($"Revert name back for shifted player: {player.GetNameWithRole()}", "ReportDeadBody");
|
||||
pc.RpcSetName(Main.AllPlayerNames[pc.PlayerId]);
|
||||
}
|
||||
|
||||
@@ -1571,7 +1571,7 @@ internal static class FixedUpdatePatch
|
||||
{
|
||||
NetworkedPlayerInfo info = ReportDeadBodyPatch.WaitReport[id][0];
|
||||
ReportDeadBodyPatch.WaitReport[id].Clear();
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()}: Now that it is possible to report, we will process the report.", "ReportDeadBody");
|
||||
Logger.Info($"{__instance.GetNameWithRole()}: Now that it is possible to report, we will process the report.", "ReportDeadBody");
|
||||
__instance.ReportDeadBody(info);
|
||||
}
|
||||
|
||||
@@ -2410,7 +2410,7 @@ internal static class GameDataCompleteTaskPatch
|
||||
Benefactor.OnTaskComplete(pc, task);
|
||||
}
|
||||
|
||||
Logger.Info($"TaskComplete: {pc.GetNameWithRole().RemoveHtmlTags()}", "CompleteTask");
|
||||
Logger.Info($"TaskComplete: {pc.GetNameWithRole()}", "CompleteTask");
|
||||
}
|
||||
catch (Exception e) { ThrowException(e); }
|
||||
|
||||
@@ -2540,7 +2540,7 @@ internal static class PlayerControlProtectPlayerPatch
|
||||
{
|
||||
public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target)
|
||||
{
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "ProtectPlayer");
|
||||
Logger.Info($"{__instance.GetNameWithRole()} => {target.GetNameWithRole()}", "ProtectPlayer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2549,7 +2549,7 @@ internal static class PlayerControlRemoveProtectionPatch
|
||||
{
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()}", "RemoveProtection");
|
||||
Logger.Info($"{__instance.GetNameWithRole()}", "RemoveProtection");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,10 +91,10 @@ internal static class UpdateSystemPatch
|
||||
[HarmonyArgument(1)] PlayerControl player,
|
||||
[HarmonyArgument(2)] byte amount)
|
||||
{
|
||||
Logger.Msg($"SystemType: {systemType}, PlayerName: {player.GetNameWithRole().RemoveHtmlTags()}, amount: {amount}", "UpdateSystem");
|
||||
Logger.Msg($"SystemType: {systemType}, PlayerName: {player.GetNameWithRole()}, amount: {amount}", "UpdateSystem");
|
||||
#if DEBUG
|
||||
if (RepairSender.Enabled && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
|
||||
Logger.SendInGame($"SystemType: {systemType}, PlayerName: {player.GetNameWithRole().RemoveHtmlTags()}, amount: {amount}");
|
||||
Logger.SendInGame($"SystemType: {systemType}, PlayerName: {player.GetNameWithRole()}, amount: {amount}");
|
||||
#endif
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return true; // Execute the following only on the host
|
||||
@@ -143,14 +143,14 @@ internal static class UpdateSystemPatch
|
||||
{
|
||||
case Mechanic:
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "Mechanic");
|
||||
Logger.Info($"{player.GetNameWithRole()} instant-fix-lights", "Mechanic");
|
||||
Mechanic.SwitchSystemRepair(player.PlayerId, switchSystem, amount);
|
||||
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
break;
|
||||
}
|
||||
case Alchemist { FixNextSabo: true } am:
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "Alchemist");
|
||||
Logger.Info($"{player.GetNameWithRole()} instant-fix-lights", "Alchemist");
|
||||
if (amount.HasBit(SwitchSystem.DamageSystem)) break;
|
||||
|
||||
switchSystem.ActualSwitches = (byte)(switchSystem.ExpectedSwitches ^ (1 << amount));
|
||||
@@ -160,7 +160,7 @@ internal static class UpdateSystemPatch
|
||||
}
|
||||
case Adventurer av:
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "Adventurer");
|
||||
Logger.Info($"{player.GetNameWithRole()} instant-fix-lights", "Adventurer");
|
||||
if (amount.HasBit(SwitchSystem.DamageSystem)) break;
|
||||
|
||||
switchSystem.ActualSwitches = (byte)(switchSystem.ExpectedSwitches ^ (1 << amount));
|
||||
@@ -170,7 +170,7 @@ internal static class UpdateSystemPatch
|
||||
}
|
||||
case Technician:
|
||||
{
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "Technician");
|
||||
Logger.Info($"{player.GetNameWithRole()} instant-fix-lights", "Technician");
|
||||
Technician.SwitchSystemRepair(player.PlayerId, switchSystem, amount);
|
||||
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
break;
|
||||
|
||||
@@ -156,7 +156,7 @@ public class Wyrd : CovenBase
|
||||
if (instance.MarkedPlayers.Remove(target.PlayerId))
|
||||
{
|
||||
var wyrd = instance.WyrdID.GetPlayer();
|
||||
if (wyrd != null) Utils.NotifyRoles(SpecifySeer: wyrd, SpecifyTarget: target);
|
||||
if (wyrd) Utils.NotifyRoles(SpecifySeer: wyrd, SpecifyTarget: target);
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, instance.WyrdID, 2, target.PlayerId);
|
||||
}
|
||||
}
|
||||
@@ -211,8 +211,7 @@ public class Wyrd : CovenBase
|
||||
|
||||
if (!seerIsWyrd)
|
||||
{
|
||||
var suicideActions = AllAction.Where(x => ActionSuicideSettings[x]).ToList();
|
||||
var join = string.Join(", ", suicideActions.ConvertAll(x => Translator.GetString($"Wyrd.Suffix.SuicideWarningOnAction.{x}")));
|
||||
var join = string.Join(", ", AllAction.Where(x => ActionSuicideSettings[x]).Select(x => Translator.GetString($"Wyrd.Suffix.SuicideWarningOnAction.{x}")));
|
||||
Suffix.AppendFormat(Translator.GetString("Wyrd.Suffix.SuicideWarnings"), join);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class Inspector : RoleBase
|
||||
|
||||
if (target1 != null && target2 != null)
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} checked {target1.GetNameWithRole().RemoveHtmlTags()} and {target2.GetNameWithRole().RemoveHtmlTags()}", "Inspector");
|
||||
Logger.Info($"{pc.GetNameWithRole()} checked {target1.GetNameWithRole()} and {target2.GetNameWithRole()}", "Inspector");
|
||||
|
||||
bool outOfUses = pc.GetAbilityUseLimit() < 1;
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class Investigator : RoleBase
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: target);
|
||||
RPC.ResetCurrentRevealTarget(player.PlayerId);
|
||||
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole().RemoveHtmlTags()}", "Investigator");
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole()}", "Investigator");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Medium : RoleBase
|
||||
|
||||
pc.RpcRemoveAbilityUse();
|
||||
ContactPlayer.TryAdd(target.PlayerId, pc.PlayerId);
|
||||
Logger.Info($"Medium Connection: {pc.GetNameWithRole().RemoveHtmlTags()} => {target.PlayerName}", "Medium");
|
||||
Logger.Info($"Medium Connection: {pc.GetNameWithRole()} => {target.PlayerName}", "Medium");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class Judge : RoleBase
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} trialed {target.GetNameWithRole().RemoveHtmlTags()}", "Judge");
|
||||
Logger.Info($"{pc.GetNameWithRole()} trialed {target.GetNameWithRole()}", "Judge");
|
||||
bool judgeSuicide;
|
||||
|
||||
if (pc.GetAbilityUseLimit() < 1 || MeetingUseLimit[pc.PlayerId] < 1 || TotalUseLimit[pc.PlayerId] < 1)
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Sheriff : RoleBase
|
||||
PlayerIdList.Add(playerId);
|
||||
playerId.SetAbilityUseLimit(ShotLimitOpt.GetFloat());
|
||||
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()} : Shot Limit - {playerId.GetAbilityUseLimit()}", "Sheriff");
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole()} : Shot Limit - {playerId.GetAbilityUseLimit()}", "Sheriff");
|
||||
}
|
||||
|
||||
public override void Remove(byte playerId)
|
||||
@@ -138,7 +138,7 @@ public class Sheriff : RoleBase
|
||||
public override void OnMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
killer.RpcRemoveAbilityUse();
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} : Number of kills left: {killer.GetAbilityUseLimit()}", "Sheriff");
|
||||
Logger.Info($"{killer.GetNameWithRole()} : Number of kills left: {killer.GetAbilityUseLimit()}", "Sheriff");
|
||||
Main.PlayerStates[target.PlayerId].deathReason = PlayerState.DeathReason.Shot;
|
||||
|
||||
if (killer.AmOwner && Utils.TimeStamp - IntroCutsceneDestroyPatch.IntroDestroyTS < 25)
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Astral : RoleBase
|
||||
void BecomeAliveAgain(PlayerControl pc, bool onMeeting = false)
|
||||
{
|
||||
Timer = null;
|
||||
if (!pc.IsAlive()) return;
|
||||
if (!pc || !pc.IsAlive()) return;
|
||||
|
||||
GhostRolesManager.RemoveGhostRole(pc.PlayerId);
|
||||
ReportDeadBodyPatch.AlreadyReportedBodies.Remove(pc.PlayerId);
|
||||
@@ -115,7 +115,6 @@ public class Astral : RoleBase
|
||||
if (Timer != null)
|
||||
{
|
||||
Timer.Dispose();
|
||||
Timer = null;
|
||||
BecomeAliveAgain(astralPc, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ internal class NiceEraser : RoleBase
|
||||
player.RpcSetCustomRole(erasedRole);
|
||||
player.RpcChangeRoleBasis(erasedRole);
|
||||
player.Notify(GetString("LostRoleByNiceEraser"));
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} lost their role", "NiceEraser");
|
||||
Logger.Info($"{player.GetNameWithRole()} lost their role", "NiceEraser");
|
||||
ErasedPlayers.Add(pc);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class Swapper : RoleBase
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("Swap1"), pc.PlayerId, importance: MessageImportance.High);
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} chose to swap {target.GetNameWithRole()} (first target)", "Swapper");
|
||||
Logger.Info($"{pc.GetNameWithRole()} chose to swap {target.GetNameWithRole()} (first target)", "Swapper");
|
||||
}
|
||||
|
||||
else if (vote2Available && selfCheck) // Take the second slot
|
||||
@@ -134,7 +134,7 @@ public class Swapper : RoleBase
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("Swap2"), pc.PlayerId, importance: MessageImportance.High);
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} chose to swap {target.GetNameWithRole()} (second target)", "Swapper");
|
||||
Logger.Info($"{pc.GetNameWithRole()} chose to swap {target.GetNameWithRole()} (second target)", "Swapper");
|
||||
}
|
||||
|
||||
else if (target.PlayerId == SwapTargets.Item1) // If this player is already chosen to be swapped in the first slot, cancel it
|
||||
@@ -143,7 +143,7 @@ public class Swapper : RoleBase
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("CancelSwap1"), pc.PlayerId, importance: MessageImportance.High);
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} canceled swapping on {target.GetNameWithRole()} (first target)", "Swapper");
|
||||
Logger.Info($"{pc.GetNameWithRole()} canceled swapping on {target.GetNameWithRole()} (first target)", "Swapper");
|
||||
}
|
||||
|
||||
else if (target.PlayerId == SwapTargets.Item2) // If this player is already chosen to be swapped in the second slot, cancel it
|
||||
@@ -152,7 +152,7 @@ public class Swapper : RoleBase
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("CancelSwap2"), pc.PlayerId, importance: MessageImportance.High);
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} canceled swapping on {target.GetNameWithRole()} (second target)", "Swapper");
|
||||
Logger.Info($"{pc.GetNameWithRole()} canceled swapping on {target.GetNameWithRole()} (second target)", "Swapper");
|
||||
}
|
||||
|
||||
else if (!selfCheck) // When the Swapper tries to swap themselves, but they aren't allowed to
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Cleanser : RoleBase
|
||||
|
||||
voter.RpcRemoveAbilityUse();
|
||||
CleanserTarget = target.PlayerId;
|
||||
Logger.Info($"{voter.GetNameWithRole().RemoveHtmlTags()} cleansed {target.GetNameWithRole().RemoveHtmlTags()}", "Cleansed");
|
||||
Logger.Info($"{voter.GetNameWithRole()} cleansed {target.GetNameWithRole()}", "Cleansed");
|
||||
Utils.SendMessage(string.Format(GetString("CleanserRemovedRole"), target.GetRealName()), voter.PlayerId, CustomRoles.Cleanser.ColoredTextByRole(GetString("CleanserTitle")), importance: MessageImportance.Low);
|
||||
SendRPC(voter.PlayerId);
|
||||
|
||||
@@ -130,7 +130,7 @@ public class Cleanser : RoleBase
|
||||
if (targetPc == null) return;
|
||||
|
||||
targetPc.RpcSetCustomRole(CustomRoles.Cleansed);
|
||||
Logger.Info($"Removed all the add ons of {targetPc.GetNameWithRole().RemoveHtmlTags()}", "Cleanser");
|
||||
Logger.Info($"Removed all the add ons of {targetPc.GetNameWithRole()}", "Cleanser");
|
||||
CleanserTarget = byte.MaxValue;
|
||||
targetPc.MarkDirtySettings();
|
||||
targetPc.Notify(string.Format(GetString("LostAddonByCleanser"), CustomRoles.Cleanser.ToColoredString()));
|
||||
|
||||
@@ -316,7 +316,7 @@ public class Medic : RoleBase
|
||||
|
||||
ProtectList.Clear();
|
||||
SendRPCForProtectList();
|
||||
Logger.Info($"{target.GetNameWithRole().RemoveHtmlTags()} : Medic is dead", "Medic");
|
||||
Logger.Info($"{target.GetNameWithRole()} : Medic is dead", "Medic");
|
||||
|
||||
if ((Visible)ShieldDeactivationIsVisible.GetInt() == Visible.Immediately)
|
||||
{
|
||||
|
||||
@@ -103,6 +103,7 @@ public class Lightning : RoleBase
|
||||
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (target.Is(CustomRoles.Pestilence)) return false;
|
||||
return !CheckLightningMurder(killer, target);
|
||||
}
|
||||
|
||||
@@ -135,7 +136,7 @@ public class Lightning : RoleBase
|
||||
|
||||
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
|
||||
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
|
||||
Logger.Info($"{target.GetNameWithRole().RemoveHtmlTags()} is now converted to a 'non-spherical lightning' XD", "Lightning");
|
||||
Logger.Info($"{target.GetNameWithRole()} is now converted to a 'non-spherical lightning' XD", "Lightning");
|
||||
}
|
||||
}, ConvertTime.GetFloat(), "Lightning Convert Player To Ghost");
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ internal class Warlock : RoleBase
|
||||
ResetCooldowns(true, true, true, pc);
|
||||
|
||||
targetw.SetRealKiller(pc);
|
||||
Logger.Info($"{targetw.GetNameWithRole().RemoveHtmlTags()} was killed", "Warlock");
|
||||
Logger.Info($"{targetw.GetNameWithRole()} was killed", "Warlock");
|
||||
cp.Kill(targetw);
|
||||
pc.Notify(Translator.GetString("WarlockControlKill"));
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.KillSound);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class BountyHunter : RoleBase
|
||||
}, onCanceled: () => Timer = null);
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, playerId, true);
|
||||
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: Reset Target", "BountyHunter");
|
||||
Logger.Info($"{player.GetNameWithRole()}: Reset Target", "BountyHunter");
|
||||
|
||||
List<PlayerControl> cTargets = new(Main.EnumerateAlivePlayerControls().Where(pc => !pc.Is(CustomRoleTypes.Impostor)));
|
||||
|
||||
@@ -166,7 +166,7 @@ public class BountyHunter : RoleBase
|
||||
Target = targetId;
|
||||
if (ShowTargetArrow) TargetArrow.Add(playerId, targetId);
|
||||
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}'s New Target Is {target.GetNameWithRole().RemoveHtmlTags()}", "BountyHunter");
|
||||
Logger.Info($"{player.GetNameWithRole()}'s New Target Is {target.GetNameWithRole()}", "BountyHunter");
|
||||
|
||||
SendRPC();
|
||||
return targetId;
|
||||
|
||||
@@ -126,7 +126,7 @@ public class Councillor : RoleBase
|
||||
|
||||
if (target)
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} murdered {target.GetNameWithRole().RemoveHtmlTags()}", "Councillor");
|
||||
Logger.Info($"{pc.GetNameWithRole()} murdered {target.GetNameWithRole()}", "Councillor");
|
||||
var councillorSuicide = true;
|
||||
|
||||
if (pc.GetAbilityUseLimit() < 1)
|
||||
|
||||
@@ -144,7 +144,7 @@ internal class Nemesis : RoleBase
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} revenged {target.GetNameWithRole().RemoveHtmlTags()}", "Nemesis");
|
||||
Logger.Info($"{pc.GetNameWithRole()} revenged {target.GetNameWithRole()}", "Nemesis");
|
||||
|
||||
string name = target.GetRealName();
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ internal class QuickShooter : RoleBase
|
||||
pc.ResetKillCooldown();
|
||||
pc.SetKillCooldown();
|
||||
pc.Notify(Translator.GetString("QuickShooterStoraging"));
|
||||
Logger.Info($"{Utils.GetPlayerById(pc.PlayerId)?.GetNameWithRole().RemoveHtmlTags()} : Remaining: {ShotLimit[pc.PlayerId]} bullets", "QuickShooter");
|
||||
Logger.Info($"{Utils.GetPlayerById(pc.PlayerId)?.GetNameWithRole()} : Remaining: {ShotLimit[pc.PlayerId]} bullets", "QuickShooter");
|
||||
}
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
|
||||
@@ -85,7 +85,7 @@ internal class Crewpostor : RoleBase
|
||||
if (target.AmOwner)
|
||||
Achievements.Type.YoureTooLate.Complete();
|
||||
|
||||
Logger.Info($"Crewpostor tried to kill Pestilence: {target.GetNameWithRole()} => {player.GetNameWithRole().RemoveHtmlTags()}", "Pestilence Reflect");
|
||||
Logger.Info($"Crewpostor tried to kill Pestilence: {target.GetNameWithRole()} => {player.GetNameWithRole()}", "Pestilence Reflect");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class Consigliere : RoleBase
|
||||
{
|
||||
killer.RpcRemoveAbilityUse();
|
||||
RevealTarget.Add(target.PlayerId);
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()}: Reveal target → {target.GetNameWithRole().RemoveHtmlTags()} || Remaining: {killer.GetAbilityUseLimit()} uses", "Consigliere");
|
||||
Logger.Info($"{killer.GetNameWithRole()}: Reveal target → {target.GetNameWithRole()} || Remaining: {killer.GetAbilityUseLimit()} uses", "Consigliere");
|
||||
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
|
||||
|
||||
SendRPC(killer.PlayerId, target.PlayerId);
|
||||
|
||||
@@ -79,7 +79,7 @@ internal class CursedWolf : RoleBase
|
||||
|
||||
killer.RpcGuardAndKill(target);
|
||||
target.RpcRemoveAbilityUse();
|
||||
Logger.Info($"{target.GetNameWithRole().RemoveHtmlTags()} : {target.GetAbilityUseLimit()} curses remain", "CursedWolf");
|
||||
Logger.Info($"{target.GetNameWithRole()} : {target.GetAbilityUseLimit()} curses remain", "CursedWolf");
|
||||
|
||||
if (KillAttacker)
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ public class EvilTracker : RoleBase
|
||||
if (target == null || target.Is(CustomRoleTypes.Impostor)) return false;
|
||||
|
||||
SetTarget(shapeshifter.PlayerId, target.PlayerId);
|
||||
Logger.Info($"{shapeshifter.GetNameWithRole().RemoveHtmlTags()}'s target is now {target.GetNameWithRole().RemoveHtmlTags()}", "EvilTrackerTarget");
|
||||
Logger.Info($"{shapeshifter.GetNameWithRole()}'s target is now {target.GetNameWithRole()}", "EvilTrackerTarget");
|
||||
shapeshifter.MarkDirtySettings();
|
||||
Utils.NotifyRoles(SpecifySeer: shapeshifter, SpecifyTarget: target);
|
||||
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: shapeshifter);
|
||||
|
||||
@@ -194,7 +194,7 @@ public class Chainbinder : RoleBase
|
||||
binder.Notify(string.Format(GetString("Chainbinder.PairBound"), FirstTarget.ColoredPlayerName(), SecondTarget.ColoredPlayerName()));
|
||||
Utils.NotifyRoles(SpecifySeer: binder, SpecifyTarget: binder);
|
||||
|
||||
Logger.Info($"{binder.GetNameWithRole().RemoveHtmlTags()} chained {first.GetNameWithRole().RemoveHtmlTags()} to {second.GetNameWithRole().RemoveHtmlTags()}", "Chainbinder");
|
||||
Logger.Info($"{binder.GetNameWithRole()} chained {first.GetNameWithRole()} to {second.GetNameWithRole()}", "Chainbinder");
|
||||
}
|
||||
|
||||
private bool TryGetTargets(PlayerControl binder, PlayerControl requestedTarget, out PlayerControl first, out PlayerControl second)
|
||||
|
||||
@@ -154,7 +154,7 @@ internal class EvilEraser : RoleBase
|
||||
pc.RpcSetCustomRole(erasedRole);
|
||||
pc.RpcChangeRoleBasis(erasedRole);
|
||||
pc.Notify(GetString("LostRoleByEvilEraser"));
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} lost their role", "Eraser");
|
||||
Logger.Info($"{pc.GetNameWithRole()} lost their role", "Eraser");
|
||||
ErasedPlayers.Add(id);
|
||||
});
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class Follower : RoleBase
|
||||
killer.Notify(GetString("FollowerBetPlayer"));
|
||||
if (BetTargetKnowFollower.GetBool()) target.Notify(CustomRoles.Follower.ColoredTextByRole(GetString("FollowerBetOnYou")));
|
||||
|
||||
Logger.Info($"Target selected: {killer.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "Follower");
|
||||
Logger.Info($"Target selected: {killer.GetNameWithRole()} => {target.GetNameWithRole()}", "Follower");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Lawyer : RoleBase
|
||||
PlayerControl selectedTarget = targetList.RandomElement();
|
||||
Target[playerId] = selectedTarget.PlayerId;
|
||||
SendRPC(playerId, selectedTarget.PlayerId, "SetTarget");
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{selectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Lawyer");
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole()}:{selectedTarget.GetNameWithRole()}", "Lawyer");
|
||||
|
||||
if (!TargetKnowsLawyer.GetBool()) return;
|
||||
LateTask.New(() => selectedTarget.Notify(string.Format(Translator.GetString("YourLawyerIsNotify"), LawyerId.ColoredPlayerName())), 18f, log: false);
|
||||
|
||||
@@ -184,7 +184,7 @@ internal class Revolutionist : RoleBase
|
||||
Main.PlayerStates[rvTarget.PlayerId].deathReason = PlayerState.DeathReason.Sacrifice;
|
||||
player.Kill(rvTarget);
|
||||
Main.PlayerStates[rvTarget.PlayerId].SetDead();
|
||||
Logger.Info($"Revolutionist: {player.GetNameWithRole().RemoveHtmlTags()} killed {rvTarget.GetNameWithRole().RemoveHtmlTags()}", "Revolutionist");
|
||||
Logger.Info($"Revolutionist: {player.GetNameWithRole()} killed {rvTarget.GetNameWithRole()}", "Revolutionist");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -199,7 +199,7 @@ internal class Revolutionist : RoleBase
|
||||
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: rvTarget);
|
||||
RPC.ResetCurrentDrawTarget(playerId);
|
||||
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole().RemoveHtmlTags()}", "Revolutionist");
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole()}", "Revolutionist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public class Romantic : RoleBase
|
||||
if (PartnerHasArrows.GetBool() && BetTargetKnowRomantic.GetBool()) TargetArrow.Add(PartnerId, RomanticId);
|
||||
}
|
||||
|
||||
Logger.Info($"Partner picked: {RomanticPC.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "Romantic");
|
||||
Logger.Info($"Partner picked: {RomanticPC.GetNameWithRole()} => {target.GetNameWithRole()}", "Romantic");
|
||||
}
|
||||
else if (!IsPartnerProtected)
|
||||
{
|
||||
@@ -287,7 +287,7 @@ public class Romantic : RoleBase
|
||||
|
||||
if ((partnerRole.IsNonNK() && partnerRole is not CustomRoles.Romantic and not CustomRoles.VengefulRomantic and not CustomRoles.RuthlessRomantic) || killer == null || !killer.IsAlive() || Main.PlayerStates[PartnerId].IsSuicide) // If Partner is NNK or died by themselves, Romantic becomes Ruthless Romantic
|
||||
{
|
||||
Logger.Info($"NNK Romantic Partner Died ({partnerRole.IsNonNK()}) / Partner killer is null ({killer == null}) / Partner killer is dead ({!killer.IsAlive()}) / Partner commited Suicide ({Main.PlayerStates[PartnerId].IsSuicide}) => Changing {RomanticPC.GetNameWithRole().RemoveHtmlTags()} to Ruthless Romantic", "Romantic");
|
||||
Logger.Info($"NNK Romantic Partner Died ({partnerRole.IsNonNK()}) / Partner killer is null ({killer == null}) / Partner killer is dead ({!killer.IsAlive()}) / Partner commited Suicide ({Main.PlayerStates[PartnerId].IsSuicide}) => Changing {RomanticPC.GetNameWithRole()} to Ruthless Romantic", "Romantic");
|
||||
RomanticPC.RpcSetCustomRole(CustomRoles.RuthlessRomantic);
|
||||
}
|
||||
else if (ConvertingRolesAndAddons.TryGetValue(partnerRole, out CustomRoles convertedRole))
|
||||
|
||||
@@ -250,7 +250,7 @@ internal class Arsonist : RoleBase
|
||||
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: arTarget, ForceLoop: true);
|
||||
RPC.ResetCurrentDousingTarget(playerId);
|
||||
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole().RemoveHtmlTags()}", "Arsonist");
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole()}", "Arsonist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Executioner : RoleBase
|
||||
PlayerControl selectedTarget = targetList.RandomElement();
|
||||
Target[playerId] = selectedTarget.PlayerId;
|
||||
SendRPC(playerId, selectedTarget.PlayerId, "SetTarget");
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}'s target: {selectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Executioner");
|
||||
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole()}'s target: {selectedTarget.GetNameWithRole()}", "Executioner");
|
||||
}
|
||||
catch (Exception ex) { Logger.Error(ex.ToString(), "Executioner.Add"); }
|
||||
}, 0.5f, log: false);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class Agitator : RoleBase
|
||||
if (pc && pc.IsAlive() && killer)
|
||||
{
|
||||
pc.Suicide(PlayerState.DeathReason.Bombed, killer);
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} bombed {pc.GetNameWithRole().RemoveHtmlTags()}, bomb cd complete", "Agitator");
|
||||
Logger.Info($"{killer.GetNameWithRole()} bombed {pc.GetNameWithRole()}, bomb cd complete", "Agitator");
|
||||
ResetBomb();
|
||||
|
||||
if (pc.AmOwner)
|
||||
@@ -210,7 +210,7 @@ public class Agitator : RoleBase
|
||||
target.Notify(GetString("AgitatorTargetNotify"));
|
||||
|
||||
SendRPC(CurrentBombedPlayer, LastBombedPlayer);
|
||||
Logger.Msg($"{player.GetNameWithRole().RemoveHtmlTags()} passed bomb to {target.GetNameWithRole().RemoveHtmlTags()}", "Agitator Pass");
|
||||
Logger.Msg($"{player.GetNameWithRole()} passed bomb to {target.GetNameWithRole()}", "Agitator Pass");
|
||||
}
|
||||
|
||||
private void SendRPC(byte newbomb, byte oldbomb)
|
||||
|
||||
@@ -170,14 +170,14 @@ public class Bandit : RoleBase
|
||||
if (StealMode.GetValue() == 1)
|
||||
{
|
||||
Main.PlayerStates[target.PlayerId].RemoveSubRole((CustomRoles)SelectedAddOn);
|
||||
Logger.Info($"Successfully removed {SelectedAddOn} addon from {target.GetNameWithRole().RemoveHtmlTags()}", "Bandit");
|
||||
Logger.Info($"Successfully removed {SelectedAddOn} addon from {target.GetNameWithRole()}", "Bandit");
|
||||
killer.RpcSetCustomRole((CustomRoles)SelectedAddOn);
|
||||
Logger.Info($"Successfully Added {SelectedAddOn} addon to {killer.GetNameWithRole().RemoveHtmlTags()}", "Bandit");
|
||||
Logger.Info($"Successfully Added {SelectedAddOn} addon to {killer.GetNameWithRole()}", "Bandit");
|
||||
}
|
||||
else
|
||||
{
|
||||
Targets[killer.PlayerId][target.PlayerId] = (CustomRoles)SelectedAddOn;
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} will steal {SelectedAddOn} addon from {target.GetNameWithRole().RemoveHtmlTags()} after meeting starts", "Bandit");
|
||||
Logger.Info($"{killer.GetNameWithRole()} will steal {SelectedAddOn} addon from {target.GetNameWithRole()} after meeting starts", "Bandit");
|
||||
}
|
||||
|
||||
TotalSteals[killer.PlayerId]++;
|
||||
@@ -210,9 +210,9 @@ public class Bandit : RoleBase
|
||||
if (target == null) continue;
|
||||
|
||||
Main.PlayerStates[targetId].RemoveSubRole(role);
|
||||
Logger.Info($"Successfully removed {role} addon from {target.GetNameWithRole().RemoveHtmlTags()}", "Bandit");
|
||||
Logger.Info($"Successfully removed {role} addon from {target.GetNameWithRole()}", "Bandit");
|
||||
banditpc.RpcSetCustomRole(role);
|
||||
Logger.Info($"Successfully Added {role} addon to {banditpc.GetNameWithRole().RemoveHtmlTags()}", "Bandit");
|
||||
Logger.Info($"Successfully Added {role} addon to {banditpc.GetNameWithRole()}", "Bandit");
|
||||
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: banditpc);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ public class Demon : RoleBase
|
||||
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
|
||||
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
|
||||
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} attacked {target.GetNameWithRole().RemoveHtmlTags()}, did {Damage.GetInt()} damage", "Demon");
|
||||
Logger.Info($"{killer.GetNameWithRole()} attacked {target.GetNameWithRole()}, did {Damage.GetInt()} damage", "Demon");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class Demon : RoleBase
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound);
|
||||
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: killer);
|
||||
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} attacked {target.GetNameWithRole().RemoveHtmlTags()}, did {SelfDamage.GetInt()} damage", "Demon");
|
||||
Logger.Info($"{killer.GetNameWithRole()} attacked {target.GetNameWithRole()}, did {SelfDamage.GetInt()} damage", "Demon");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user