mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Fix bugs
This commit is contained in:
1 parent
800a631739
commit
f0feccb0c6
10 files changed
+43
-33
No files matched your search
@@ -98,7 +98,7 @@ internal static class FFAManager
|
||||
KBScore.TryAdd(pc.PlayerId, 0);
|
||||
}
|
||||
|
||||
_ = new LateTask(Utils.SetChatVisible, 4f, "Set Chat Visible for Everyone");
|
||||
_ = new LateTask(Utils.SetChatVisible, 7f, "Set Chat Visible for Everyone");
|
||||
}
|
||||
private static void SendRPCSyncFFAPlayer(byte playerId)
|
||||
{
|
||||
|
||||
@@ -549,6 +549,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Ritualist or
|
||||
CustomRoles.Arsonist or
|
||||
CustomRoles.Pickpocket or
|
||||
CustomRoles.PlagueDoctor or
|
||||
CustomRoles.Traitor or
|
||||
CustomRoles.Virus or
|
||||
CustomRoles.BloodKnight or
|
||||
@@ -682,6 +683,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Bandit or
|
||||
CustomRoles.BloodKnight or
|
||||
CustomRoles.Infectious or
|
||||
CustomRoles.PlagueDoctor or
|
||||
CustomRoles.Virus or
|
||||
CustomRoles.Succubus or
|
||||
CustomRoles.Spiritcaller or
|
||||
|
||||
@@ -56,9 +56,9 @@ class DisableDevice
|
||||
bool doComms = false;
|
||||
Vector2 PlayerPos = pc.GetTruePosition();
|
||||
bool ignore = (Options.DisableDevicesIgnoreImpostors.GetBool() && pc.Is(CustomRoleTypes.Impostor)) ||
|
||||
(Options.DisableDevicesIgnoreNeutrals.GetBool() && pc.Is(CustomRoleTypes.Neutral)) ||
|
||||
(Options.DisableDevicesIgnoreCrewmates.GetBool() && pc.Is(CustomRoleTypes.Crewmate)) ||
|
||||
(Options.DisableDevicesIgnoreAfterAnyoneDied.GetBool() && GameStates.AlreadyDied);
|
||||
(Options.DisableDevicesIgnoreNeutrals.GetBool() && pc.Is(CustomRoleTypes.Neutral)) ||
|
||||
(Options.DisableDevicesIgnoreCrewmates.GetBool() && pc.Is(CustomRoleTypes.Crewmate)) ||
|
||||
(Options.DisableDevicesIgnoreAfterAnyoneDied.GetBool() && GameStates.AlreadyDied);
|
||||
|
||||
if (pc.IsAlive() && !Utils.IsActive(SystemTypes.Comms))
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ public static class TemplateManager
|
||||
CreateIfNotExists();
|
||||
using StreamReader sr = new(TEMPLATE_FILE_PATH, Encoding.GetEncoding("UTF-8"));
|
||||
string text;
|
||||
string[] tmp = Array.Empty<string>();
|
||||
string[] tmp = [];
|
||||
List<string> sendList = [];
|
||||
HashSet<string> tags = [];
|
||||
while ((text = sr.ReadLine()) != null)
|
||||
|
||||
@@ -140,7 +140,7 @@ public static class Translator
|
||||
Logger.Info($"加载自定义翻译文件:{filename}", "LoadCustomTranslation");
|
||||
using StreamReader sr = new(path, Encoding.GetEncoding("UTF-8"));
|
||||
string text;
|
||||
string[] tmp = Array.Empty<string>();
|
||||
string[] tmp = [];
|
||||
while ((text = sr.ReadLine()) != null)
|
||||
{
|
||||
tmp = text.Split(":");
|
||||
|
||||
@@ -872,7 +872,7 @@ internal class ChatCommands
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append(GetString(role.ToString()) + Utils.GetRoleMode(role) + player.GetRoleInfo(true));
|
||||
if (Options.CustomRoleSpawnChances.TryGetValue(role, out _))
|
||||
if (Options.CustomRoleSpawnChances.ContainsKey(role))
|
||||
Utils.ShowChildrenSettings(Options.CustomRoleSpawnChances[role], ref sb, command: true);
|
||||
var txt = sb.ToString();
|
||||
_ = sb.Clear().Append(txt.RemoveHtmlTags());
|
||||
@@ -882,7 +882,9 @@ internal class ChatCommands
|
||||
}
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
ChatManager.DontBlock = true;
|
||||
Utils.SendMessage(sb.ToString(), player.PlayerId);
|
||||
_ = new LateTask(() => ChatManager.DontBlock = false, 0.5f, log: false);
|
||||
}, 1f, log: false);
|
||||
}
|
||||
else
|
||||
|
||||
+20
-19
@@ -107,18 +107,18 @@ public class ChatManager
|
||||
|
||||
if (!player.IsAlive() || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (!GameStates.IsInGame) operate = 3;
|
||||
else if (CheckCommand(ref message, "id|guesslist|gl编号|玩家编号|玩家id|id列表|玩家列表|列表|所有id|全部id|shoot|guess|bet|st|gs|bt|猜|赌|sp|jj|tl|trial|审判|判|审|xp|效颦|效|颦|sw|换票|换|swap", false) || CheckName(ref playername, "系统消息", false)) operate = 1;
|
||||
else if (CheckCommand(ref message, "up", false)) operate = 2;
|
||||
else if (CheckCommand(ref message, "r|role|m|myrole|n|now")) operate = 4;
|
||||
else operate = 3;
|
||||
|
||||
if (Blackmailer.ForBlackmailer.Contains(player.PlayerId) && player.IsAlive())
|
||||
{
|
||||
cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GameStates.IsInGame) operate = 3;
|
||||
else if (CheckCommand(ref message, "id|guesslist|gl编号|玩家编号|玩家id|id列表|玩家列表|列表|所有id|全部id|shoot|guess|bet|st|gs|bt|猜|赌|sp|jj|tl|trial|审判|判|审|xp|效颦|效|颦|sw|换票|换|swap", false) || CheckName(ref playername, "系统消息", false)) operate = 1;
|
||||
else if (CheckCommand(ref message, "up", false)) operate = 2;
|
||||
else if (CheckCommand(ref message, "r|role|m|myrole|n|now")) operate = 4;
|
||||
else operate = 3;
|
||||
|
||||
switch (operate)
|
||||
{
|
||||
case 1 when player.IsAlive():
|
||||
@@ -129,24 +129,25 @@ public class ChatManager
|
||||
Logger.Info($"Command: {message}", "ChatManager");
|
||||
cancel = false;
|
||||
break;
|
||||
case 3:
|
||||
string chatEntry = $"{player.PlayerId}: {message}";
|
||||
chatHistory.Add(chatEntry);
|
||||
|
||||
if (chatHistory.Count > maxHistorySize)
|
||||
{
|
||||
chatHistory.RemoveAt(0);
|
||||
}
|
||||
cancel = false;
|
||||
break;
|
||||
case 4:
|
||||
Logger.Info($"Command: {message}", "ChatManager");
|
||||
SendPreviousMessagesToAll(realMessagesOnly: true);
|
||||
//if (!DontBlock) SendPreviousMessagesToAll(realMessagesOnly: true);
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
string chatEntry = $"{player.PlayerId}: {message}";
|
||||
chatHistory.Add(chatEntry);
|
||||
|
||||
if (chatHistory.Count > maxHistorySize)
|
||||
{
|
||||
chatHistory.RemoveAt(0);
|
||||
}
|
||||
cancel = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DontBlock = false;
|
||||
|
||||
public static void SendPreviousMessagesToAll(bool realMessagesOnly = false)
|
||||
{
|
||||
ChatUpdatePatch.DoBlockChat = true;
|
||||
|
||||
@@ -550,7 +550,7 @@ class CheckForEndVotingPatch
|
||||
{
|
||||
pc?.Notify(text, r.Next(7, 13));
|
||||
}
|
||||
}, 12f, log: false);
|
||||
}, 13f, log: false);
|
||||
}
|
||||
public static bool CheckRole(byte id, CustomRoles role)
|
||||
{
|
||||
|
||||
@@ -1345,10 +1345,8 @@ class ShapeshiftPatch
|
||||
isSSneeded = false;
|
||||
break;
|
||||
case CustomRoles.Librarian:
|
||||
if (shapeshifting)
|
||||
{
|
||||
isSSneeded = Librarian.OnShapeshift(shapeshifter);
|
||||
}
|
||||
if (shapeshifting) isSSneeded = Librarian.OnShapeshift(shapeshifter);
|
||||
break;
|
||||
case CustomRoles.Warlock:
|
||||
if (Main.CursedPlayers[shapeshifter.PlayerId] != null)//呪われた人がいるか確認
|
||||
{
|
||||
|
||||
@@ -153,7 +153,7 @@ class RepairSystemPatch
|
||||
|
||||
if (systemType == SystemTypes.Electrical && 0 <= amount && amount <= 4)
|
||||
{
|
||||
var SwitchSystem = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast<SwitchSystem>();
|
||||
var SwitchSystem = ShipStatus.Instance?.Systems?[SystemTypes.Electrical]?.Cast<SwitchSystem>();
|
||||
if (SwitchSystem != null && SwitchSystem.IsActive)
|
||||
{
|
||||
switch (player.GetCustomRole())
|
||||
@@ -172,7 +172,14 @@ class RepairSystemPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (player.Is(CustomRoles.Damocles) && Damocles.countRepairSabotage && 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 &&
|
||||
systemType is
|
||||
SystemTypes.Reactor or
|
||||
SystemTypes.LifeSupp or
|
||||
SystemTypes.Comms or
|
||||
SystemTypes.Laboratory or
|
||||
SystemTypes.HeliSabotage or
|
||||
SystemTypes.Electrical)
|
||||
{
|
||||
Damocles.OnRepairSabotage();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user