Compare commits

...
4 Commits
14 changed files with 749 additions and 663 deletions

No files matched your search

+48 -44
View File
@@ -69,7 +69,6 @@ internal class EAC
break;
case RpcCalls.SendChat:
var text = sr.ReadString();
if (text.StartsWith("/")) return false;
if (
text.Contains('░') ||
text.Contains('▄') ||
@@ -85,7 +84,7 @@ internal class EAC
}
break;
case RpcCalls.StartMeeting:
//Client will never send StartMeeting rpc
// Non-Host Clients will never send StartMeeting RPC
WarnHost();
Report(pc, "Bad StartMeeting");
HandleCheat(pc, "Bad StartMeeting");
@@ -133,6 +132,13 @@ internal class EAC
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set the color and has been rejected", "EAC");
return true;
}
if (pc.AmOwner)
{
WarnHost();
Report(pc, "Illegal setting of host color");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set the host's color, which has been rejected", "EAC");
return true;
}
break;
case RpcCalls.CheckMurder:
if (GameStates.IsLobby)
@@ -145,28 +151,29 @@ internal class EAC
}
break;
case RpcCalls.MurderPlayer:
//If using version protocol, client should never directly send Murder player rpc
// Calls will only be sent by server / host
Report(pc, "Directly Murder Player");
HandleCheat(pc, "Directly Murder Player");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] killed directly, rejected", "EAC");
return true;
case RpcCalls.Shapeshift:
case RpcCalls.CheckShapeshift:
if (GameStates.IsLobby)
{
Report(pc, "ShapeShift in lobby");
HandleCheat(pc, "ShapeShift in lobby");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] lobby is deformed and has been rejected", "EAC");
return true;
}
var target = sr.ReadNetObject<PlayerControl>();
if (target == null)
{
Report(pc, "ShapeShift to null player!");
//HandleCheat(pc, "ShapeShift to null player!");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally transformed into an empty player and has been rejected", "EAC");
Report(pc, "Lobby CheckShapeshift");
HandleCheat(pc, "Lobby CheckShapeshift");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] directly shapeshifted and has been rejected", "EAC");
return true;
}
break;
case RpcCalls.Shapeshift:
Report(pc, "Directly Shapeshift");
var swriter = AmongUsClient.Instance.StartRpcImmediately(pc.NetId, (byte)RpcCalls.Shapeshift, SendOption.Reliable, -1);
swriter.WriteNetObject(pc);
swriter.Write(false);
AmongUsClient.Instance.FinishRpcImmediately(swriter);
HandleCheat(pc, "Directly Shapeshift");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] directly shapeshifted and has been rejected", "EAC");
return true;
}
switch (callId)
{
@@ -177,6 +184,7 @@ internal class EAC
HandleCheat(pc, GetString("EAC.CheatDetected.EAC"));
return true;
case 7:
case 8:
if (!GameStates.IsLobby)
{
WarnHost();
@@ -204,49 +212,45 @@ internal class EAC
return true;
}
break;
case 41:
case 38:
if (GameStates.IsInGame)
{
WarnHost();
Report(pc, "Illegal pet setting");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set a pet and has been rejected", "EAC");
Report(pc, "Set level in game");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] changed the level in the game and it has been rejected", "EAC");
return true;
}
break;
case 40:
if (GameStates.IsInGame)
if (sr.ReadPackedUInt32() > 0)
{
WarnHost();
Report(pc, "Illegal skin setting");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set the skin and has been rejected", "EAC");
return true;
}
break;
case 42:
if (GameStates.IsInGame)
{
WarnHost();
Report(pc, "Illegal facial decoration");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set facial decoration and has been rejected", "EAC");
return true;
uint ClientDataLevel = pc.GetClient() == null ? pc.GetClient().PlayerLevel : 0;
uint PlayerControlLevel = sr.ReadPackedUInt32();
if (ClientDataLevel != 0 && Math.Abs(PlayerControlLevel - ClientDataLevel) > 4)
{
WarnHost();
Report(pc, "Sus Level Change");
AmongUsClient.Instance.KickPlayer(pc.GetClientId(), false);
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] changed the level in the game and it has been rejected", "EAC");
return true;
}
}
break;
case 39:
case 40:
case 41:
case 42:
case 43:
if (GameStates.IsInGame)
{
WarnHost();
Report(pc, "Illegal hat setting");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set a hat and has been rejected", "EAC");
Report(pc, "Change skin in game");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] changed the skin in the game and it has been rejected", "EAC");
return true;
}
break;
case 43:
if (sr.BytesRemaining > 0 && sr.ReadBoolean()) return false;
if (GameStates.IsInGame)
if (pc.AmOwner)
{
WarnHost();
Report(pc, "Illegal setting of game name");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] illegally set the name and has been rejected", "EAC");
Report(pc, "Change Host skin");
Logger.Fatal($"Player [{pc.GetClientId()}:{pc.GetRealName()}] changed the owner's skin and it has been rejected", "EAC");
return true;
}
break;
@@ -280,7 +284,7 @@ internal class EAC
//Update system rpc can not get received by playercontrol.handlerpc
var Mapid = Main.NormalOptions.MapId;
Logger.Info("Check sabotage RPC" + ", PlayerName: " + player.GetNameWithRole() + ", SabotageType: " + systemType.ToString() + ", amount: " + amount.ToString(), "EAC");
if (player.AmOwner || !AmongUsClient.Instance.AmHost) return false;
if (!AmongUsClient.Instance.AmHost) return false;
switch (systemType) //Normal sabotage using buttons
{
case SystemTypes.Sabotage:
@@ -402,7 +406,7 @@ internal class EAC
string msg = $"{pc.GetClientId()}|{pc.FriendCode}|{pc.Data.PlayerName}|{pc.GetClient().GetHashedPuid()}|{reason}";
//Cloud.SendData(msg);
Logger.Fatal($"EAC report: {msg}", "EAC Cloud");
Logger.SendInGame(string.Format(GetString("Message.NoticeByEAC"), $"{pc?.Data?.PlayerName} | {pc.GetClient().GetHashedPuid()}", reason));
if (Options.CheatResponses.GetInt() != 5) Logger.SendInGame(string.Format(GetString("Message.NoticeByEAC"), $"{pc?.Data?.PlayerName} | {pc.GetClient().GetHashedPuid()}", reason));
}
public static bool ReceiveInvalidRpc(PlayerControl pc, byte callId)
{
+8 -1
View File
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using TOHE.Modules;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
@@ -1399,6 +1400,12 @@ static class ExtendedPlayerControl
if (Options.CurrentGameMode == CustomGameMode.SoloKombat) return;
if (target.GetTeam() is Team.Impostor or Team.Neutral) Stressed.OnNonCrewmateDead();
if (killer.Is(CustomRoles.Damocles)) Damocles.OnMurder();
else if (killer.Is(Team.Impostor)) Damocles.OnOtherImpostorMurder();
if (target.Is(Team.Impostor)) Damocles.OnImpostorDeath();
if (killer.PlayerId == target.PlayerId && killer.shapeshifting)
{
_ = new LateTask(() => { killer.RpcMurderPlayerV2(target); }, 1.5f, "Shapeshifting Suicide Delay");
@@ -1437,7 +1444,7 @@ static class ExtendedPlayerControl
}
target.Data.IsDead = true;
NotifyRoles(SpecifySeer: killer);
NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
NotifyRoles(SpecifySeer: target);
}
public static bool RpcCheckAndMurder(this PlayerControl killer, PlayerControl target, bool check = false) => CheckMurderPatch.RpcCheckAndMurder(killer, target, check);
+2 -1
View File
@@ -118,7 +118,8 @@ public static class Options
"Ban",
"Kick",
"NoticeMe",
"NoticeEveryone"
"NoticeEveryone",
"OnlyCancel"
];
public static readonly string[] ConfirmEjectionsMode =
[
+15 -1
View File
@@ -591,9 +591,18 @@ class HudManagerPatch
__instance.KillButton?.ToggleVisible(false);
}
bool CanUseVent = player.CanUseImpostorVentButton() && GameStates.IsInTask;
bool CanUseVent = (player.CanUseImpostorVentButton() || player.inVent || player.MyPhysics.Animations.IsPlayingEnterVentAnimation()) && GameStates.IsInTask;
__instance.ImpostorVentButton?.ToggleVisible(CanUseVent);
player.Data.Role.CanVent = CanUseVent;
if (player.PlayerId == 0 && player.inVent && GameStates.IsInTask)
{
__instance.ImpostorVentButton.canInteract = true;
__instance.ImpostorVentButton.enabled = true;
__instance.ImpostorVentButton.isCoolingDown = false;
__instance.ImpostorVentButton.SetEnabled();
__instance.ImpostorVentButton.currentTarget = TryMoveToVentPatch.HostVentTarget;
__instance.ImpostorVentButton.SetTarget(TryMoveToVentPatch.HostVentTarget);
}
}
else
{
@@ -773,6 +782,11 @@ class VentButtonDoClickPatch
{
var pc = PlayerControl.LocalPlayer;
{
if (pc.inVent)
{
pc.MyPhysics.RpcExitVent(TryMoveToVentPatch.HostVentTarget.Id);
return true;
}
if (!pc.Is(CustomRoles.Swooper) || !pc.Is(CustomRoles.Wraith) || !pc.Is(CustomRoles.Chameleon) || pc.inVent || __instance.currentTarget == null || !pc.CanMove || !__instance.isActiveAndEnabled) return true;
pc?.MyPhysics?.RpcEnterVent(__instance.currentTarget.Id);
return false;
+13 -12
View File
@@ -113,6 +113,7 @@ class SetEverythingUpPatch
try
{
// ---------- Code from TOR (The Other Roles)! ----------
if (Options.CurrentGameMode is not CustomGameMode.Standard) goto End;
int num = Mathf.CeilToInt(7.5f);
List<WinningPlayerData> winningPlayerDataList = TempData.winners.ToArray().ToList();
@@ -144,19 +145,20 @@ class SetEverythingUpPatch
poolablePlayer.cosmetics.nameText.color = Color.white;
poolablePlayer.cosmetics.nameText.transform.localScale = new Vector3(1f / vector.x, 1f / vector.y, 1f / vector.z);
poolablePlayer.cosmetics.nameText.transform.localPosition = new Vector3(poolablePlayer.cosmetics.nameText.transform.localPosition.x, !lowered ? poolablePlayer.cosmetics.nameText.transform.localPosition.y - 0.6f : poolablePlayer.cosmetics.nameText.transform.localPosition.y - 1.4f, -15f);
poolablePlayer.cosmetics.nameText.text = winningPlayerData2.PlayerName;
Vector3 defaultPos = poolablePlayer.cosmetics.nameText.transform.localPosition;
for (int i1 = 0; i1 < Main.winnerList.Count; i1++)
{
byte id = Main.winnerList[i1];
if (Main.winnerNameList[i1].RemoveHtmlTags() != winningPlayerData2?.PlayerName.RemoveHtmlTags()) continue;
var color = Main.roleColors[Main.winnerRolesList[i1]];
var rolename = Utils.GetRoleName(Main.PlayerStates[id].MainRole);
var role = Main.PlayerStates[id].MainRole;
var color = Main.roleColors[role];
var rolename = Utils.GetRoleName(role);
poolablePlayer.cosmetics.nameText.text += $"\n<color={color}>{rolename}</color>";
poolablePlayer.cosmetics.nameText.transform.localPosition = new Vector3(defaultPos.x, !lowered || role.IsImpostor() ? defaultPos.y - 0.6f : defaultPos.y - 1.4f, -15f);
}
poolablePlayer.cosmetics.nameText.text += $"<size=0>";
}
}
catch (Exception e)
@@ -316,21 +318,21 @@ class SetEverythingUpPatch
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//#######################################
// ==最終結果表示==
//#######################################
//########################################
// ==The final result indicates==
//########################################
var Pos = Camera.main.ViewportToWorldPoint(new Vector3(0f, 1f, Camera.main.nearClipPlane));
var RoleSummaryObject = UnityEngine.Object.Instantiate(__instance.WinText.gameObject);
RoleSummaryObject.transform.position = new Vector3(__instance.Navigation.ExitButton.transform.position.x + 0.1f, Pos.y - 0.1f, -15f);
RoleSummaryObject.transform.localScale = new Vector3(1f, 1f, 1f);
StringBuilder sb = new($"{GetString("RoleSummaryText")}\n");
StringBuilder sb = new($"{GetString("RoleSummaryText")}\n<b>");
List<byte> cloneRoles = new(Main.PlayerStates.Keys);
foreach (byte id in Main.winnerList.ToArray())
{
if (EndGamePatch.SummaryText[id].Contains("<INVALID:NotAssigned>")) continue;
sb.Append($"\n<b>").Append(EndGamePatch.SummaryText[id]);
sb.Append('\n').Append(EndGamePatch.SummaryText[id]);
cloneRoles.Remove(id);
}
switch (Options.CurrentGameMode)
@@ -379,8 +381,7 @@ class SetEverythingUpPatch
sb.Append($"</b>\n");
foreach (byte id in cloneRoles.ToArray())
{
if (EndGamePatch.SummaryText[id].Contains("<INVALID:NotAssigned>"))
continue;
if (EndGamePatch.SummaryText[id].Contains("<INVALID:NotAssigned>")) continue;
sb.Append('\n').Append(EndGamePatch.SummaryText[id]);
}
+25 -6
View File
@@ -1238,12 +1238,6 @@ class MurderPlayerPatch
break;
}
if (target.GetTeam() is Team.Impostor or Team.Neutral) Stressed.OnNonCrewmateDead();
if (killer.Is(CustomRoles.Damocles)) Damocles.OnMurder();
else if (killer.Is(Team.Impostor)) Damocles.OnOtherImpostorMurder();
if (target.Is(Team.Impostor)) Damocles.OnImpostorDeath();
if (killer.Is(CustomRoles.TicketsStealer) && killer.PlayerId != target.PlayerId)
killer.Notify(string.Format(GetString("TicketsStealerGetTicket"), ((Main.AllPlayerControls.Count(x => x.GetRealKiller()?.PlayerId == killer.PlayerId) + 1) * Options.TicketsPerKill.GetFloat()).ToString("0.0#####")));
@@ -3123,6 +3117,19 @@ class SetColorPatch
}
}
[HarmonyPatch(typeof(Vent), nameof(Vent.TryMoveToVent))]
class TryMoveToVentPatch
{
public static Vent HostVentTarget;
public static void Postfix(Vent __instance, [HarmonyArgument(0)] Vent otherVent, bool __result)
{
if (__result && AmongUsClient.Instance.AmHost && PlayerControl.LocalPlayer.PlayerId == 0 && PlayerControl.LocalPlayer.inVent && (HostVentTarget.Equals(__instance) || HostVentTarget == __instance))
{
Logger.Info($"{__instance.name} => {otherVent.name}", "HostVentTarget");
HostVentTarget = otherVent;
}
}
}
[HarmonyPatch(typeof(Vent), nameof(Vent.ExitVent))]
class ExitVentPatch
{
@@ -3130,6 +3137,12 @@ class ExitVentPatch
{
Logger.Info($" {pc.GetNameWithRole()}, Vent ID: {__instance.Id} ({__instance.name})", "ExitVent");
if (pc.PlayerId == 0)
{
Logger.Info(__instance.name, "HostVentTarget");
TryMoveToVentPatch.HostVentTarget = __instance;
}
Drainer.OnAnyoneExitVent(pc, __instance.Id);
}
}
@@ -3140,6 +3153,12 @@ class EnterVentPatch
{
Logger.Info($" {pc.GetNameWithRole()}, Vent ID: {__instance.Id} ({__instance.name})", "EnterVent");
if (pc.PlayerId == 0)
{
Logger.Info(__instance.name, "HostVentTarget");
TryMoveToVentPatch.HostVentTarget = __instance;
}
Drainer.OnAnyoneEnterVent(pc, __instance);
Analyzer.OnAnyoneEnterVent(pc);
+37 -28
View File
@@ -74,9 +74,11 @@ class RepairSystemPatch
{
case CustomRoles.SabotageMaster:
SabotageMaster.RepairSystem(__instance, systemType, amount);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
break;
case CustomRoles.Alchemist when Alchemist.FixNextSabo:
Alchemist.RepairSystem(systemType, amount);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
break;
}
@@ -160,37 +162,44 @@ class RepairSystemPatch
{
Camouflage.CheckCamouflage();
if (systemType == SystemTypes.Electrical && 0 <= amount && amount <= 4)
switch (systemType)
{
var SwitchSystem = ShipStatus.Instance?.Systems?[SystemTypes.Electrical]?.Cast<SwitchSystem>();
if (SwitchSystem != null && SwitchSystem.IsActive)
{
switch (player.GetCustomRole())
case SystemTypes.Electrical when 0 <= amount && amount <= 4:
{
case CustomRoles.SabotageMaster:
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "SwitchSystem");
SabotageMaster.SwitchSystemRepair(SwitchSystem, amount);
break;
case CustomRoles.Alchemist when Alchemist.FixNextSabo:
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "SwitchSystem");
SwitchSystem.ActualSwitches = 0;
SwitchSystem.ExpectedSwitches = 0;
Alchemist.FixNextSabo = false;
break;
}
}
}
var SwitchSystem = ShipStatus.Instance?.Systems?[SystemTypes.Electrical]?.Cast<SwitchSystem>();
if (SwitchSystem != null && SwitchSystem.IsActive)
{
switch (player.GetCustomRole())
{
case CustomRoles.SabotageMaster:
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "SwitchSystem");
SabotageMaster.SwitchSystemRepair(SwitchSystem, amount);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
break;
case CustomRoles.Alchemist when Alchemist.FixNextSabo:
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} instant-fix-lights", "SwitchSystem");
SwitchSystem.ActualSwitches = 0;
SwitchSystem.ExpectedSwitches = 0;
Alchemist.FixNextSabo = false;
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
break;
}
if (player.Is(CustomRoles.Damocles) && Damocles.countRepairSabotage) Damocles.OnRepairSabotage();
if (player.Is(CustomRoles.Stressed) && Stressed.countRepairSabotage) Stressed.OnRepairSabotage(player);
}
if (systemType is
SystemTypes.Reactor or
SystemTypes.LifeSupp or
SystemTypes.Comms or
SystemTypes.Laboratory or
SystemTypes.HeliSabotage or
SystemTypes.Electrical)
{
if (player.Is(CustomRoles.Damocles) && Damocles.countRepairSabotage) Damocles.OnRepairSabotage();
if (player.Is(CustomRoles.Stressed) && Stressed.countRepairSabotage) Stressed.OnRepairSabotage(player);
break;
}
case SystemTypes.Reactor:
case SystemTypes.LifeSupp:
case SystemTypes.Comms:
case SystemTypes.Laboratory:
case SystemTypes.HeliSabotage:
case SystemTypes.Electrical:
if (player.Is(CustomRoles.Damocles) && Damocles.countRepairSabotage) Damocles.OnRepairSabotage();
if (player.Is(CustomRoles.Stressed) && Stressed.countRepairSabotage) Stressed.OnRepairSabotage(player);
break;
}
}
public static void CheckAndOpenDoorsRange(ShipStatus __instance, int amount, int min, int max)
File diff suppressed because it is too large. Load diff
+1
View File
@@ -1198,6 +1198,7 @@
"Kick","踢出","Kick","Кикнуть","踢出","踢出"
"NoticeMe","通知我","Notify me","Уведомить меня","通知我","通知我"
"NoticeEveryone","通知所有人(除了它)","Notify everyone","Уведомить всех","通知所有人(除了他)","通知所有人(除了它)"
"OnlyCancel","","Cancel Action Only","","",""
"CheatResponses","检测到外挂时","When a cheating player is found","Когда обнаружен взлом","檢測到外掛時","检测到外挂时"
"NeutralRoleWinTogether","同种职业<color=#7f8c8d>中立</color>玩家共同胜利","<color=#7f8c8d>Neutrals</color> win together","<color=#7f8c8d>Нейтралы</color> побеждают вместе","同種職業的<color=#7f8c8d>中立</color>玩家共同獲勝","同种职业<color=#7f8c8d>中立</color>玩家共同胜利"
"NeutralWinTogether","全体<color=#7f8c8d>中立</color>阵营玩家共同胜利","All <color=#7f8c8d>Neutrals</color> win together","<color=#7f8c8d>Нейтралы</color> побеждают вместе","全體<color=#7f8c8d>中立</color>陣營玩家共同獲勝","全体<color=#7f8c8d>中立</color>阵营玩家共同胜利"
Can't render this file because it is too large.
+2
View File
@@ -85,12 +85,14 @@ namespace TOHE.Roles.Neutral
}
pc.Suicide(realKiller: Bubble_);
}
EncasedPlayers.Remove(id);
}
}
public static void OnReportDeadBody()
{
if (IsEnable) return;
foreach (var pc in EncasedPlayers.Keys.Select(x => GetPlayerById(x)).Where(x => x != null && x.IsAlive())) pc.Suicide(realKiller: Bubble_);
EncasedPlayers.Clear();
}
}
}
+29 -17
View File
@@ -72,27 +72,39 @@ public static class Executioner
playerIdList.Add(playerId);
//ターゲット割り当て
if (AmongUsClient.Instance.AmHost)
try
{
List<PlayerControl> targetList = [];
var rand = IRandom.Instance;
foreach (PlayerControl target in Main.AllPlayerControls)
if (AmongUsClient.Instance.AmHost)
{
if (playerId == target.PlayerId) continue;
else if (!CanTargetImpostor.GetBool() && target.Is(CustomRoleTypes.Impostor)) continue;
else if (!CanTargetNeutralKiller.GetBool() && target.IsNeutralKiller()) continue;
else if (!CanTargetNeutralBenign.GetBool() && target.IsNeutralBenign()) continue;
else if (!CanTargetNeutralEvil.GetBool() && target.IsNeutralEvil()) continue;
else if (!CanTargetNeutralChaos.GetBool() && target.IsNeutralChaos()) continue;
if (target.GetCustomRole() is CustomRoles.GM or CustomRoles.SuperStar) continue;
if (Utils.GetPlayerById(playerId).Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers)) continue;
List<PlayerControl> targetList = [];
var rand = IRandom.Instance;
foreach (PlayerControl target in Main.AllPlayerControls)
{
if (playerId == target.PlayerId) continue;
else if (!CanTargetImpostor.GetBool() && target.Is(CustomRoleTypes.Impostor)) continue;
else if (!CanTargetNeutralKiller.GetBool() && target.IsNeutralKiller()) continue;
else if (!CanTargetNeutralBenign.GetBool() && target.IsNeutralBenign()) continue;
else if (!CanTargetNeutralEvil.GetBool() && target.IsNeutralEvil()) continue;
else if (!CanTargetNeutralChaos.GetBool() && target.IsNeutralChaos()) continue;
if (target.GetCustomRole() is CustomRoles.GM or CustomRoles.SuperStar) continue;
if (Utils.GetPlayerById(playerId).Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers)) continue;
targetList.Add(target);
targetList.Add(target);
}
if (targetList.Count == 0)
{
ChangeRole(Utils.GetPlayerById(playerId));
return;
}
var SelectedTarget = targetList[rand.Next(targetList.Count)];
Target.Add(playerId, SelectedTarget.PlayerId);
SendRPC(playerId, SelectedTarget.PlayerId, "SetTarget");
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{SelectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Executioner");
}
var SelectedTarget = targetList[rand.Next(targetList.Count)];
Target.Add(playerId, SelectedTarget.PlayerId);
SendRPC(playerId, SelectedTarget.PlayerId, "SetTarget");
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{SelectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Executioner");
}
catch (System.Exception ex)
{
Logger.Error(ex.ToString(), "Executioner.Add");
}
}
public static bool IsEnable() => playerIdList.Count > 0;
+33 -28
View File
@@ -75,27 +75,39 @@ public static class Lawyer
playerIdList.Add(playerId);
//ターゲット割り当て
if (AmongUsClient.Instance.AmHost)
try
{
List<PlayerControl> targetList = [];
var rand = IRandom.Instance;
foreach (PlayerControl target in Main.AllPlayerControls)
if (AmongUsClient.Instance.AmHost)
{
if (playerId == target.PlayerId) continue;
else if (!CanTargetImpostor.GetBool() && target.Is(CustomRoleTypes.Impostor)) continue;
else if (!CanTargetNeutralKiller.GetBool() && target.IsNeutralKiller()) continue;
else if (!CanTargetCrewmate.GetBool() && target.Is(CustomRoleTypes.Crewmate)) continue;
else if (!CanTargetJester.GetBool() && target.Is(CustomRoles.Jester)) continue;
else if (target.Is(CustomRoleTypes.Neutral) && !target.IsNeutralKiller() && !target.Is(CustomRoles.Jester)) continue;
if (target.GetCustomRole() is CustomRoles.GM or CustomRoles.SuperStar) continue;
if (Utils.GetPlayerById(playerId).Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers)) continue;
List<PlayerControl> targetList = [];
var rand = IRandom.Instance;
foreach (PlayerControl target in Main.AllPlayerControls)
{
if (playerId == target.PlayerId) continue;
else if (!CanTargetImpostor.GetBool() && target.Is(CustomRoleTypes.Impostor)) continue;
else if (!CanTargetNeutralKiller.GetBool() && target.IsNeutralKiller()) continue;
else if (!CanTargetCrewmate.GetBool() && target.Is(CustomRoleTypes.Crewmate)) continue;
else if (!CanTargetJester.GetBool() && target.Is(CustomRoles.Jester)) continue;
else if (target.Is(CustomRoleTypes.Neutral) && !target.IsNeutralKiller() && !target.Is(CustomRoles.Jester)) continue;
if (target.GetCustomRole() is CustomRoles.GM or CustomRoles.SuperStar) continue;
if (Utils.GetPlayerById(playerId).Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers)) continue;
targetList.Add(target);
targetList.Add(target);
}
if (targetList.Count == 0)
{
ChangeRole(Utils.GetPlayerById(playerId));
return;
}
var SelectedTarget = targetList[rand.Next(targetList.Count)];
Target.Add(playerId, SelectedTarget.PlayerId);
SendRPC(playerId, SelectedTarget.PlayerId, "SetTarget");
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{SelectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Lawyer");
}
var SelectedTarget = targetList[rand.Next(targetList.Count)];
Target.Add(playerId, SelectedTarget.PlayerId);
SendRPC(playerId, SelectedTarget.PlayerId, "SetTarget");
Logger.Info($"{Utils.GetPlayerById(playerId)?.GetNameWithRole().RemoveHtmlTags()}:{SelectedTarget.GetNameWithRole().RemoveHtmlTags()}", "Lawyer");
}
catch (System.Exception ex)
{
Logger.Error(ex.ToString(), "Lawyer.Add");
}
}
public static bool IsEnable() => playerIdList.Count > 0;
@@ -139,11 +151,12 @@ public static class Lawyer
if (x.Value == target.PlayerId)
Lawyer = x.Key;
});
Utils.GetPlayerById(Lawyer).RpcSetCustomRole(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]);
PlayerControl lawyer = Utils.GetPlayerById(Lawyer);
lawyer.RpcSetCustomRole(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]);
Target.Remove(Lawyer);
SendRPC(Lawyer);
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Lawyer), SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: Utils.GetPlayerById(Lawyer));
Utils.NotifyRoles(SpecifySeer: lawyer, SpecifyTarget: target);
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: lawyer);
}
public static bool KnowRole(PlayerControl player, PlayerControl target)
{
@@ -161,7 +174,6 @@ public static class Lawyer
var GetValue = Target.TryGetValue(seer.PlayerId, out var targetId);
return GetValue && targetId == target.PlayerId ? Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lawyer), "§") : string.Empty;
}
public static void ChangeRole(PlayerControl lawyer)
{
lawyer.RpcSetCustomRole(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]);
@@ -171,13 +183,6 @@ public static class Lawyer
text = string.Format(text, Utils.ColorString(Utils.GetRoleColor(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()]), Translator.GetString(CRoleChangeRoles[ChangeRolesAfterTargetKilled.GetValue()].ToString())));
lawyer.Notify(text);
}
public static string TargetMark(PlayerControl seer, PlayerControl target)
{
if (!seer.Is(CustomRoles.Lawyer)) return string.Empty; //エクスキューショナー以外処理しない
var GetValue = Target.TryGetValue(seer.PlayerId, out var targetId);
return GetValue && targetId == target.PlayerId ? Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lawyer), "§") : string.Empty;
}
public static bool CheckExileTarget(GameData.PlayerInfo exiled/*, bool DecidedWinner, bool Check = false*/)
{
foreach (var kvp in Target.Where(x => x.Value == exiled.PlayerId))
+1 -1
View File
@@ -7,7 +7,7 @@
<Description>TOHE+</Description>
<Authors>Gurge44</Authors>
<langVersion>preview</langVersion>
<AmongUs>E:\Program Files\AmongUs</AmongUs>
<AmongUs>D:\Epic Games\AmongUs</AmongUs>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>True</Optimize>
<AssemblyName>$(MSBuildProjectName)+</AssemblyName>
+2 -2
View File
@@ -33,8 +33,8 @@ public class Main : BasePlugin
public static ConfigEntry<string> DebugKeyInput { get; private set; }
public static readonly string MainMenuText = " ";
public const string PluginGuid = "com.gurge44.toheplus";
public const string PluginVersion = "2.2.0";
public const string PluginDisplayVersion = "2.2.0";
public const string PluginVersion = "2.2.1";
public const string PluginDisplayVersion = "2.2.1";
public static readonly string SupportedAUVersion = "2023.10.24";
public const int PluginCreate = 3;
public const bool Canary = false;