diff --git a/GameMode/FFAManager.cs b/GameMode/FFAManager.cs
index 111ca90ca..53b76e115 100644
--- a/GameMode/FFAManager.cs
+++ b/GameMode/FFAManager.cs
@@ -1,8 +1,8 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
diff --git a/GameMode/HotPotatoManager.cs b/GameMode/HotPotatoManager.cs
index 63e8cd674..b43c5ea2f 100644
--- a/GameMode/HotPotatoManager.cs
+++ b/GameMode/HotPotatoManager.cs
@@ -1,7 +1,7 @@
-using System;
+using HarmonyLib;
+using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
using UnityEngine;
namespace TOHE
diff --git a/GameMode/MoveAndStopManager.cs b/GameMode/MoveAndStopManager.cs
index 5ddef50b8..bd5fbd950 100644
--- a/GameMode/MoveAndStopManager.cs
+++ b/GameMode/MoveAndStopManager.cs
@@ -1,7 +1,7 @@
-using System;
+using HarmonyLib;
+using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
using TOHE.Roles.AddOns.Common;
using UnityEngine;
using static TOHE.Translator;
diff --git a/GameMode/SoloKombatManager.cs b/GameMode/SoloKombatManager.cs
index 07465028f..ba2dab5e5 100644
--- a/GameMode/SoloKombatManager.cs
+++ b/GameMode/SoloKombatManager.cs
@@ -1,8 +1,8 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Neutral;
using UnityEngine;
diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs
index 8a03dbc42..9407fc9c4 100644
--- a/Modules/AntiBlackout.cs
+++ b/Modules/AntiBlackout.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
+using Hazel;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
namespace TOHE;
@@ -118,33 +118,33 @@ public static class AntiBlackout
SendGameData();
}
-/*
- ///
- ///Run the code with IsDead temporarily restored to its original value
- ///Execution details
- ///
- public static void TempRestore(Action action)
- {
- Logger.Info("==Temp Restore==");
- //Whether TempRestore was executed with IsDead overwritten
- bool before_IsCached = IsCached;
- try
+ /*
+ ///
+ ///Run the code with IsDead temporarily restored to its original value
+ ///Execution details
+ ///
+ public static void TempRestore(Action action)
{
- if (before_IsCached) RestoreIsDead(doSend: false);
- action();
+ Logger.Info("==Temp Restore==");
+ //Whether TempRestore was executed with IsDead overwritten
+ bool before_IsCached = IsCached;
+ try
+ {
+ if (before_IsCached) RestoreIsDead(doSend: false);
+ action();
+ }
+ catch (Exception ex)
+ {
+ Logger.Warn("An exception occurred within AntiBlackout.TempRestore");
+ Logger.Exception(ex);
+ }
+ finally
+ {
+ if (before_IsCached) SetIsDead(doSend: false);
+ Logger.Info("==/Temp Restore==");
+ }
}
- catch (Exception ex)
- {
- Logger.Warn("An exception occurred within AntiBlackout.TempRestore");
- Logger.Exception(ex);
- }
- finally
- {
- if (before_IsCached) SetIsDead(doSend: false);
- Logger.Info("==/Temp Restore==");
- }
- }
-*/
+ */
public static void Reset()
{
diff --git a/Modules/BanManager.cs b/Modules/BanManager.cs
index c4399ca07..477c11b8c 100644
--- a/Modules/BanManager.cs
+++ b/Modules/BanManager.cs
@@ -1,3 +1,5 @@
+using HarmonyLib;
+using InnerNet;
using System;
using System.Collections.Generic;
using System.IO;
@@ -6,8 +8,6 @@ using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using InnerNet;
using static TOHE.Translator;
namespace TOHE;
diff --git a/Modules/Camouflague.cs b/Modules/Camouflague.cs
index 0d05e79fc..bd0ab2e6e 100644
--- a/Modules/Camouflague.cs
+++ b/Modules/Camouflague.cs
@@ -1,6 +1,5 @@
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.Data;
+using System.Collections.Generic;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
diff --git a/Modules/ClientOptionItem.cs b/Modules/ClientOptionItem.cs
index f747f993a..ea3ed40b8 100644
--- a/Modules/ClientOptionItem.cs
+++ b/Modules/ClientOptionItem.cs
@@ -1,5 +1,5 @@
-using System;
-using BepInEx.Configuration;
+using BepInEx.Configuration;
+using System;
using UnityEngine;
using Object = UnityEngine.Object;
diff --git a/Modules/Cloud.cs b/Modules/Cloud.cs
index cb4be4ef4..f0bcf53fe 100644
--- a/Modules/Cloud.cs
+++ b/Modules/Cloud.cs
@@ -1,9 +1,9 @@
-using System;
+using HarmonyLib;
+using System;
using System.IO;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
-using HarmonyLib;
namespace TOHE;
diff --git a/Modules/CustomRoleSelector.cs b/Modules/CustomRoleSelector.cs
index 5d9ba3c9d..2fec64ce6 100644
--- a/Modules/CustomRoleSelector.cs
+++ b/Modules/CustomRoleSelector.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Roles.Impostor;
namespace TOHE.Modules;
diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs
index 45307b14e..176332c12 100644
--- a/Modules/CustomRolesHelper.cs
+++ b/Modules/CustomRolesHelper.cs
@@ -1,8 +1,9 @@
-using System.Linq;
using AmongUs.GameOptions;
+using System.Linq;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
+using UnityEngine;
namespace TOHE;
@@ -1355,7 +1356,42 @@ internal static class CustomRolesHelper
_ => role.Is(Team.Impostor) ? CountTypes.Impostor : CountTypes.Crew
};
- public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Count > 0;
+ public static RoleOptionType GetRoleOptionType(this CustomRoles role)
+ {
+ if (role.IsImpostor()) return RoleOptionType.Impostor;
+ if (role.IsCrewmate()) return role.GetDYRole() == RoleTypes.Impostor ? RoleOptionType.Crewmate_ImpostorBased : RoleOptionType.Crewmate_Normal;
+ if (role.IsNeutral()) return role.IsNK() ? RoleOptionType.Neutral_Killing : RoleOptionType.Neutral_NonKilling;
+ return RoleOptionType.Crewmate_Normal;
+ }
+
+ public static Color GetRoleOptionTypeColor(this RoleOptionType type) => type switch
+ {
+ RoleOptionType.Impostor => Palette.ImpostorRed,
+ RoleOptionType.Crewmate_Normal => Palette.CrewmateBlue,
+ RoleOptionType.Crewmate_ImpostorBased => Utils.GetRoleColor(CustomRoles.Sheriff),
+ RoleOptionType.Neutral_NonKilling => Utils.GetRoleColor(CustomRoles.Sprayer),
+ RoleOptionType.Neutral_Killing => Utils.GetRoleColor(CustomRoles.Traitor),
+ _ => Utils.GetRoleColor(CustomRoles.SwordsMan)
+ };
+
+ public static TabGroup GetTabFromOptionType(this RoleOptionType type) => type switch
+ {
+ RoleOptionType.Impostor => TabGroup.ImpostorRoles,
+ RoleOptionType.Crewmate_Normal => TabGroup.CrewmateRoles,
+ RoleOptionType.Crewmate_ImpostorBased => TabGroup.CrewmateRoles,
+ RoleOptionType.Neutral_NonKilling => TabGroup.NeutralRoles,
+ RoleOptionType.Neutral_Killing => TabGroup.NeutralRoles,
+ _ => TabGroup.OtherRoles
+ };
+}
+
+public enum RoleOptionType
+{
+ Impostor,
+ Crewmate_Normal,
+ Crewmate_ImpostorBased,
+ Neutral_NonKilling,
+ Neutral_Killing
}
public enum CustomRoleTypes
diff --git a/Modules/CustomRpcSender.cs b/Modules/CustomRpcSender.cs
index bd365f295..d57f5c3ba 100644
--- a/Modules/CustomRpcSender.cs
+++ b/Modules/CustomRpcSender.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
using AmongUs.GameOptions;
using Hazel;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using InnerNet;
+using System;
+using System.Diagnostics.CodeAnalysis;
namespace TOHE;
diff --git a/Modules/CustomSounds.cs b/Modules/CustomSounds.cs
index a8f5794e4..7641396af 100644
--- a/Modules/CustomSounds.cs
+++ b/Modules/CustomSounds.cs
@@ -1,8 +1,8 @@
-using System;
+using Hazel;
+using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
-using Hazel;
namespace TOHE.Modules;
diff --git a/Modules/CustomWinnerHolder.cs b/Modules/CustomWinnerHolder.cs
index 81822326d..06229fa9a 100644
--- a/Modules/CustomWinnerHolder.cs
+++ b/Modules/CustomWinnerHolder.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using Hazel;
+using System.Collections.Generic;
namespace TOHE;
diff --git a/Modules/DisableDevice.cs b/Modules/DisableDevice.cs
index c724a4e15..6444bfe85 100644
--- a/Modules/DisableDevice.cs
+++ b/Modules/DisableDevice.cs
@@ -1,6 +1,6 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
-using HarmonyLib;
using UnityEngine;
using Object = UnityEngine.Object;
diff --git a/Modules/EAC.cs b/Modules/EAC.cs
index 57df892c4..34164c9bb 100644
--- a/Modules/EAC.cs
+++ b/Modules/EAC.cs
@@ -1,10 +1,10 @@
-using System;
+using AmongUs.GameOptions;
+using Hazel;
+using InnerNet;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using AmongUs.GameOptions;
-using Hazel;
-using InnerNet;
using TOHE.Modules;
using static TOHE.Translator;
diff --git a/Modules/ErrorText.cs b/Modules/ErrorText.cs
index fd49ee2c6..58535402e 100644
--- a/Modules/ErrorText.cs
+++ b/Modules/ErrorText.cs
@@ -79,11 +79,10 @@ public class ErrorText : MonoBehaviour
{
var error = new ErrorData(code);
if (0 < error.ErrorLevel)
- Logger.Error($"エラー発生: {error}: {error.Message}", "ErrorText");
+ Logger.Error($"Error: {error}: {error.Message}", "ErrorText");
- if (!AllErrors.Any(e => e.Code == code))
+ if (AllErrors.All(e => e.Code != code))
{
- //まだ出ていないエラー
AllErrors.Add(error);
}
diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs
index 4b53b51c3..f17a2fd20 100644
--- a/Modules/ExtendedPlayerControl.cs
+++ b/Modules/ExtendedPlayerControl.cs
@@ -1,12 +1,12 @@
+using AmongUs.GameOptions;
+using HarmonyLib;
+using Hazel;
+using InnerNet;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using HarmonyLib;
-using Hazel;
-using InnerNet;
using TOHE.Modules;
using TOHE.Patches;
using TOHE.Roles.AddOns.Crewmate;
@@ -661,6 +661,8 @@ static class ExtendedPlayerControl
}
public static bool IsShifted(this PlayerControl pc) => Main.CheckShapeshift.TryGetValue(pc.PlayerId, out var shifted) && shifted;
public static bool IsPlayerShifted(this byte id) => Main.CheckShapeshift.TryGetValue(id, out var shifted) && shifted;
+ public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Count > 0;
+
public static void ResetKillCooldown(this PlayerControl player)
{
Main.PlayerStates[player.PlayerId].Role.SetKillCooldown(player.PlayerId);
@@ -830,8 +832,8 @@ static class ExtendedPlayerControl
public static bool KnowDeathReason(this PlayerControl seer, PlayerControl target)
=> ((seer.Is(CustomRoles.Doctor) || seer.Is(CustomRoles.Autopsy)
- || (seer.Data.IsDead && Options.GhostCanSeeDeathReason.GetBool()))
- && target.Data.IsDead) || (target.Is(CustomRoles.Gravestone) && target.Data.IsDead);
+ || (seer.Data.IsDead && Options.GhostCanSeeDeathReason.GetBool()))
+ && target.Data.IsDead) || (target.Is(CustomRoles.Gravestone) && target.Data.IsDead);
public static string GetRoleInfo(this PlayerControl player, bool InfoLong = false)
{
diff --git a/Modules/GameOptionsSender/GameOptionsSender.cs b/Modules/GameOptionsSender/GameOptionsSender.cs
index 9cbb16a54..3d637bcc9 100644
--- a/Modules/GameOptionsSender/GameOptionsSender.cs
+++ b/Modules/GameOptionsSender/GameOptionsSender.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using InnerNet;
+using System;
+using System.Collections.Generic;
using Array = Il2CppSystem.Array;
using Buffer = Il2CppSystem.Buffer;
diff --git a/Modules/GameOptionsSender/NormalGameOptionsSender.cs b/Modules/GameOptionsSender/NormalGameOptionsSender.cs
index 8e7f1964d..e08388f55 100644
--- a/Modules/GameOptionsSender/NormalGameOptionsSender.cs
+++ b/Modules/GameOptionsSender/NormalGameOptionsSender.cs
@@ -1,5 +1,5 @@
-using System;
using AmongUs.GameOptions;
+using System;
namespace TOHE.Modules;
diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
index fba8b5711..b9edee0fa 100644
--- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
+++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using InnerNet;
+using System;
+using System.Linq;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
@@ -268,21 +268,14 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
Main.AllPlayerSpeed[player.PlayerId] = Options.MareSpeedDuringLightsOut.GetFloat();
break;
case CustomRoles.Torch:
-
if (!Utils.IsActive(SystemTypes.Electrical))
- {
opt.SetVision(true);
- opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat());
- opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat());
- }
-
- else if (!Options.TorchAffectedByLights.GetBool())
- {
+ opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat());
+ opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat());
+ if (Utils.IsActive(SystemTypes.Electrical) && !Options.TorchAffectedByLights.GetBool())
opt.SetVision(true);
- opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat() * 5);
- opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat() * 5);
- }
-
+ opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat() * 5);
+ opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat() * 5);
break;
case CustomRoles.Bewilder:
opt.SetVision(false);
@@ -318,14 +311,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
opt.SetFloat(FloatOptionNames.ImpostorLightMod, 0.01f);
}
- if (Changeling.ChangedRole.TryGetValue(player.PlayerId, out var changed) && changed && player.GetCustomRole().GetRoleTypes() != RoleTypes.Shapeshifter)
- {
- AURoleOptions.ShapeshifterCooldown = 300f;
- AURoleOptions.ShapeshifterDuration = 1f;
- }
-
- // ===================================================================================================================
-
+ // ������������ȴΪ0ʱ��������ʾͼ��
AURoleOptions.EngineerCooldown = Mathf.Max(0.01f, AURoleOptions.EngineerCooldown);
if (Main.AllPlayerKillCooldown.TryGetValue(player.PlayerId, out var killCooldown))
diff --git a/Modules/GameState.cs b/Modules/GameState.cs
index 9c3243e1e..b888b0084 100644
--- a/Modules/GameState.cs
+++ b/Modules/GameState.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
using InnerNet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.Crewmate;
@@ -46,6 +46,7 @@ public class PlayerState(byte playerId)
_ => CustomRoles.Crewmate,
};
}
+
public void SetMainRole(CustomRoles role)
{
countTypes = role switch
@@ -189,6 +190,7 @@ public class PlayerState(byte playerId)
break;
}
}
+
public void RemoveSubRole(CustomRoles role)
{
if (SubRoles.Contains(role))
@@ -203,6 +205,7 @@ public class PlayerState(byte playerId)
RPC.SendDeathReason(PlayerId, deathReason);
}
}
+
public bool IsSuicide => deathReason == DeathReason.Suicide;
public TaskState TaskState => taskState;
public void InitTask(PlayerControl player) => taskState.Init(player);
@@ -246,9 +249,11 @@ public class PlayerState(byte playerId)
etc = -1,
}
+
public byte GetRealKiller() => IsDead && RealKiller.TIMESTAMP != DateTime.MinValue ? RealKiller.ID : byte.MaxValue;
public int GetKillCount(bool ExcludeSelfKill = false) => Main.PlayerStates.Values.Where(state => !(ExcludeSelfKill && state.PlayerId == PlayerId) && state.GetRealKiller() == PlayerId).ToArray().Length;
}
+
public class TaskState
{
public static int InitialTotalTasks;
@@ -267,10 +272,12 @@ public class TaskState
AllTasksCount = 0;
return;
}
+
hasTasks = true;
AllTasksCount = player.Data.Tasks.Count;
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags().RemoveHtmlTags()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Init");
}
+
public void Update(PlayerControl player)
{
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags().RemoveHtmlTags()}: UpdateTask", "TaskState.Update");
@@ -375,22 +382,33 @@ public class TaskState
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}: TaskCounts = {CompletedTasksCount}/{AllTasksCount}", "TaskState.Update");
}
}
+
public class PlayerVersion(Version ver, string tag_str, string forkId)
{
public readonly Version version = ver;
public readonly string tag = tag_str;
public readonly string forkId = forkId;
#pragma warning disable CA1041 // Provide ObsoleteAttribute message
- [Obsolete] public PlayerVersion(string ver, string tag_str) : this(Version.Parse(ver), tag_str, string.Empty) { }
- [Obsolete] public PlayerVersion(Version ver, string tag_str) : this(ver, tag_str, string.Empty) { }
+ [Obsolete]
+ public PlayerVersion(string ver, string tag_str) : this(Version.Parse(ver), tag_str, string.Empty)
+ {
+ }
+
+ [Obsolete]
+ public PlayerVersion(Version ver, string tag_str) : this(ver, tag_str, string.Empty)
+ {
+ }
#pragma warning restore CA1041 // Provide ObsoleteAttribute message
- public PlayerVersion(string ver, string tag_str, string forkId) : this(Version.Parse(ver), tag_str, forkId) { }
+ public PlayerVersion(string ver, string tag_str, string forkId) : this(Version.Parse(ver), tag_str, forkId)
+ {
+ }
public bool IsEqual(PlayerVersion pv)
{
return pv.version == version && pv.tag == tag;
}
}
+
public static class GameStates
{
public static bool InGame;
@@ -406,12 +424,15 @@ public static class GameStates
public static bool IsInTask => InGame && !MeetingHud.Instance;
public static bool IsMeeting => InGame && MeetingHud.Instance;
public static bool IsVoting => IsMeeting && MeetingHud.Instance.state is MeetingHud.VoteStates.Voted or MeetingHud.VoteStates.NotVoted;
+
public static bool IsCountDown => GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown;
+
/**********TOP ZOOM.cs***********/
public static bool IsShip => ShipStatus.Instance != null;
public static bool IsCanMove => PlayerControl.LocalPlayer?.CanMove is true;
public static bool IsDead => PlayerControl.LocalPlayer?.Data?.IsDead is true;
}
+
public static class MeetingStates
{
public static DeadBody[] DeadBodies;
diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs
index b57f6b6d7..63ec36065 100644
--- a/Modules/GuessManager.cs
+++ b/Modules/GuessManager.cs
@@ -1,10 +1,10 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using Hazel;
using TMPro;
using TOHE.Modules;
using TOHE.Roles.AddOns.Common;
@@ -969,7 +969,7 @@ public static class GuessManager
{
CustomRoleTypes.Crewmate => new(140, 255, 255, byte.MaxValue),
CustomRoleTypes.Impostor => new(255, 25, 25, byte.MaxValue),
- CustomRoleTypes.Neutral => new(255, 171, 27, byte.MaxValue),
+ CustomRoleTypes.Neutral => new(127, 140, 141, byte.MaxValue),
// CustomRoleTypes.Madmate => new Color32(255, 25, 25, byte.MaxValue),
CustomRoleTypes.Addon => new Color32(255, 154, 206, byte.MaxValue),
_ => throw new NotImplementedException(),
diff --git a/Modules/LoadingScreen.cs b/Modules/LoadingScreen.cs
index 009fea6f3..7576f4bd0 100644
--- a/Modules/LoadingScreen.cs
+++ b/Modules/LoadingScreen.cs
@@ -1,5 +1,5 @@
-using System;
-using Rewired.Utils;
+using Rewired.Utils;
+using System;
using TOHE.Patches;
using UnityEngine;
using Object = UnityEngine.Object;
diff --git a/Modules/MeetingTimeManager.cs b/Modules/MeetingTimeManager.cs
index 65017f56e..ac967ce2c 100644
--- a/Modules/MeetingTimeManager.cs
+++ b/Modules/MeetingTimeManager.cs
@@ -1,5 +1,5 @@
+using AmongUs.GameOptions;
using System;
-using AmongUs.GameOptions;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
@@ -62,21 +62,19 @@ public class MeetingTimeManager
}
int TotalMeetingTime = DiscussionTime + VotingTime;
-
+ //時間の下限、上限で刈り込み
if (TimeManager.playerIdList.Count > 0) BonusMeetingTime = Math.Clamp(TotalMeetingTime + BonusMeetingTime, MeetingTimeMinTimeManager, MeetingTimeMax) - TotalMeetingTime;
if (TimeThief.playerIdList.Count > 0) BonusMeetingTime = Math.Clamp(TotalMeetingTime + BonusMeetingTime, MeetingTimeMinTimeThief, MeetingTimeMax) - TotalMeetingTime;
if (TimeManager.playerIdList.Count == 0 && TimeThief.playerIdList.Count == 0) BonusMeetingTime = Math.Clamp(TotalMeetingTime + BonusMeetingTime, MeetingTimeMinTimeThief, MeetingTimeMax) - TotalMeetingTime;
if (BonusMeetingTime >= 0)
- {
- VotingTime += BonusMeetingTime;
- }
+ VotingTime += BonusMeetingTime; //投票時間を延長
else
{
- DiscussionTime += BonusMeetingTime;
- if (DiscussionTime < 0)
+ DiscussionTime += BonusMeetingTime; //会議時間を優先的に短縮
+ if (DiscussionTime < 0) //会議時間だけでは賄えない場合
{
- VotingTime += DiscussionTime;
+ VotingTime += DiscussionTime; //足りない分投票時間を短縮
DiscussionTime = 0;
}
}
diff --git a/Modules/ModUpdater.cs b/Modules/ModUpdater.cs
index 0a1c6ae71..607d00b4a 100644
--- a/Modules/ModUpdater.cs
+++ b/Modules/ModUpdater.cs
@@ -1,11 +1,11 @@
-using System;
+using HarmonyLib;
+using Newtonsoft.Json.Linq;
+using System;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
-using HarmonyLib;
-using Newtonsoft.Json.Linq;
using Twitch;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Modules/NameNotifyManager.cs b/Modules/NameNotifyManager.cs
index 7dc5cc106..4248d296b 100644
--- a/Modules/NameNotifyManager.cs
+++ b/Modules/NameNotifyManager.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
diff --git a/Modules/OptionBackup/OptionBackupData.cs b/Modules/OptionBackup/OptionBackupData.cs
index 2555eb729..0acfbb6b2 100644
--- a/Modules/OptionBackup/OptionBackupData.cs
+++ b/Modules/OptionBackup/OptionBackupData.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
namespace TOHE;
diff --git a/Modules/OptionBackup/OptionBackupValue.cs b/Modules/OptionBackup/OptionBackupValue.cs
index 89fd94afc..d24b0a1cf 100644
--- a/Modules/OptionBackup/OptionBackupValue.cs
+++ b/Modules/OptionBackup/OptionBackupValue.cs
@@ -1,5 +1,5 @@
-using System;
using AmongUs.GameOptions;
+using System;
namespace TOHE;
diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs
index a3882f41f..d9747445e 100644
--- a/Modules/OptionHolder.cs
+++ b/Modules/OptionHolder.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using HarmonyLib;
using TOHE.Modules;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
@@ -1080,140 +1080,13 @@ public static class Options
NoLimitAddonsNumMax = IntegerOptionItem.Create(211, "NoLimitAddonsNumMax", new(1, 90, 1), 1, TabGroup.Addons, false)
.SetGameMode(CustomGameMode.Standard);
- //==================================================================================================================================//
-
-
- MainLoadingText = "Building role settings";
- RoleLoadingText = "Vanilla roles\nImpostor";
-
-
- // Impostor
-
- SetupRoleOptions(300, TabGroup.ImpostorRoles, CustomRoles.ImpostorTOHE);
- RoleLoadingText = "Vanilla roles\nShapeshifter";
- SetupRoleOptions(400, TabGroup.ImpostorRoles, CustomRoles.ShapeshifterTOHE);
- ShapeshiftCD = FloatOptionItem.Create(402, "ShapeshiftCooldown", new(1f, 180f, 1f), 30f, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.ShapeshifterTOHE])
- .SetValueFormat(OptionFormat.Seconds);
- ShapeshiftDur = FloatOptionItem.Create(403, "ShapeshiftDuration", new(1f, 60f, 1f), 10f, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.ShapeshifterTOHE])
- .SetValueFormat(OptionFormat.Seconds);
-
- RoleLoadingText = "Impostor roles\nEvil Guesser";
- SetupRoleOptions(1200, TabGroup.ImpostorRoles, CustomRoles.EvilGuesser);
- EGCanGuessTime = IntegerOptionItem.Create(1205, "GuesserCanGuessTimes", new(1, 15, 1), 15, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser])
- .SetValueFormat(OptionFormat.Times);
- EGCanGuessImp = BooleanOptionItem.Create(1206, "EGCanGuessImp", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
- EGCanGuessAdt = BooleanOptionItem.Create(1207, "EGCanGuessAdt", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
- EGCanGuessTaskDoneSnitch = BooleanOptionItem.Create(1208, "EGCanGuessTaskDoneSnitch", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
- EGTryHideMsg = BooleanOptionItem.Create(1209, "GuesserTryHideMsg", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser])
- .SetColor(Color.green);
-
- RoleLoadingText = "Impostor roles\nVindicator";
- SetupRoleOptions(3400, TabGroup.ImpostorRoles, CustomRoles.Vindicator);
- VindicatorAdditionalVote = IntegerOptionItem.Create(3410, "MayorAdditionalVote", new(1, 30, 1), 1, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Vindicator])
- .SetValueFormat(OptionFormat.Votes);
- VindicatorHideVote = BooleanOptionItem.Create(3411, "MayorHideVote", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Vindicator]);
- RoleLoadingText = "Impostor roles\nVisionary";
-
- SetupRoleOptions(16150, TabGroup.ImpostorRoles, CustomRoles.Visionary);
-
- RoleLoadingText = "Impostor roles\nTrickster";
- SetupRoleOptions(4300, TabGroup.ImpostorRoles, CustomRoles.Trickster);
-
-
- // Crewmates =====================================================================================================================
-
-
- RoleLoadingText = "Vanilla roles\nCrewmate";
-
- SetupRoleOptions(5050, TabGroup.CrewmateRoles, CustomRoles.CrewmateTOHE);
- RoleLoadingText = "Vanilla roles\nEngineer";
- SetupRoleOptions(5000, TabGroup.CrewmateRoles, CustomRoles.EngineerTOHE);
- RoleLoadingText = "Vanilla roles\nScientist";
- SetupRoleOptions(5100, TabGroup.CrewmateRoles, CustomRoles.ScientistTOHE);
- ScientistCD = FloatOptionItem.Create(5110, "VitalsCooldown", new(1f, 250f, 1f), 3f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.ScientistTOHE])
- .SetValueFormat(OptionFormat.Seconds);
- ScientistDur = FloatOptionItem.Create(5111, "VitalsDuration", new(1f, 250f, 1f), 15f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.ScientistTOHE])
- .SetValueFormat(OptionFormat.Seconds);
-
- RoleLoadingText = "Crewmate roles\nCelebrity";
-
- SetupRoleOptions(5300, TabGroup.CrewmateRoles, CustomRoles.CyberStar);
- ImpKnowCyberStarDead = BooleanOptionItem.Create(5400, "ImpKnowCyberStarDead", false, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.CyberStar]);
- NeutralKnowCyberStarDead = BooleanOptionItem.Create(5500, "NeutralKnowCyberStarDead", false, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.CyberStar]);
- RoleLoadingText = "Crewmate roles\nDemolitionist";
- SetupSingleRoleOptions(5550, TabGroup.CrewmateRoles, CustomRoles.Demolitionist, 1);
- DemolitionistVentTime = FloatOptionItem.Create(5552, "DemolitionistVentTime", new(0f, 90f, 1f), 5f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Demolitionist])
- .SetValueFormat(OptionFormat.Seconds);
- DemolitionistKillerDiesOnMeetingCall = BooleanOptionItem.Create(5553, "DemolitionistKillerDiesOnMeetingCall", false, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Demolitionist]);
- RoleLoadingText = "Crewmate roles\nShiftguard";
- SetupRoleOptions(5594, TabGroup.CrewmateRoles, CustomRoles.Shiftguard);
- RoleLoadingText = "Crewmate roles\nDetour";
- SetupRoleOptions(5590, TabGroup.CrewmateRoles, CustomRoles.Detour);
- RoleLoadingText = "Crewmate roles\nLazy Guy";
- SetupRoleOptions(5700, TabGroup.CrewmateRoles, CustomRoles.Needy);
-
- RoleLoadingText = "Crewmate roles\nDetective";
- SetupRoleOptions(6600, TabGroup.CrewmateRoles, CustomRoles.Detective);
- DetectiveCanknowKiller = BooleanOptionItem.Create(6610, "DetectiveCanknowKiller", true, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Detective]);
-
- RoleLoadingText = "Crewmate roles\nObserver";
- SetupRoleOptions(7500, TabGroup.CrewmateRoles, CustomRoles.Observer);
-
- RoleLoadingText = "Crewmate roles\nNice Guesser";
- SetupRoleOptions(8600, TabGroup.CrewmateRoles, CustomRoles.NiceGuesser);
- GGCanGuessTime = IntegerOptionItem.Create(8610, "GuesserCanGuessTimes", new(0, 15, 1), 15, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser])
- .SetValueFormat(OptionFormat.Times);
- GGCanGuessCrew = BooleanOptionItem.Create(8611, "GGCanGuessCrew", true, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser]);
- GGCanGuessAdt = BooleanOptionItem.Create(8612, "GGCanGuessAdt", false, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser]);
- GGTryHideMsg = BooleanOptionItem.Create(8613, "GuesserTryHideMsg", true, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser])
- .SetColor(Color.green);
-
- RoleLoadingText = "Crewmate roles\nDictator";
- SetupRoleOptions(9100, TabGroup.CrewmateRoles, CustomRoles.Dictator);
-
- RoleLoadingText = "Neutral roles\nPhantom";
- SetupRoleOptions(11400, TabGroup.NeutralRoles, CustomRoles.Phantom);
- PhantomCanVent = BooleanOptionItem.Create(11410, "CanVent", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
- PhantomSnatchesWin = BooleanOptionItem.Create(11411, "SnatchesWin", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
- PhantomCanGuess = BooleanOptionItem.Create(11412, "CanGuess", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
- PhantomTasks = OverrideTasksData.Create(11413, TabGroup.NeutralRoles, CustomRoles.Phantom);
- RoleLoadingText = "Neutral roles\nTerrorist";
- SetupRoleOptions(11500, TabGroup.NeutralRoles, CustomRoles.Terrorist);
- CanTerroristSuicideWin = BooleanOptionItem.Create(11510, "CanTerroristSuicideWin", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Terrorist]);
- TerroristCanGuess = BooleanOptionItem.Create(11511, "CanGuess", true, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Terrorist]);
- TerroristTasks = OverrideTasksData.Create(11512, TabGroup.NeutralRoles, CustomRoles.Terrorist);
-
- RoleLoadingText = "Add-ons\n.";
-
// Add-Ons =====================================================================================================================
+ RoleLoadingText = "Add-ons\n.";
+
+
AddBracketsToAddons = BooleanOptionItem.Create(13500, "BracketAddons", false, TabGroup.Addons, false)
.SetGameMode(CustomGameMode.Standard)
.SetHeader(true);
@@ -1657,17 +1530,41 @@ public static class Options
try
{
- var roleClassesDict = Utils.GetEnumerableOfType()
+ var roleClassesDict = Main.AllRoleClasses
.Where(x => x.GetType().Name != "VanillaRole")
- .GroupBy(x => ((CustomRoles)Enum.Parse(typeof(CustomRoles), ignoreCase: true, value: x.GetType().Name)).GetCustomRoleTypes())
+ .GroupBy(x => ((CustomRoles)Enum.Parse(typeof(CustomRoles), ignoreCase: true, value: x.GetType().Name)).GetRoleOptionType())
.ToDictionary(x => x.Key, x => x.ToArray());
+ int titleId = 100000;
+
foreach (var roleClasses in roleClassesDict)
{
MainLoadingText = $"Building Role Settings: {roleClasses.Key} Roles";
int allRoles = roleClasses.Value.Length;
int index = 0;
+ switch (roleClasses.Key)
+ {
+ case RoleOptionType.Impostor:
+ SetupBasicImpostorRoleSettings(ref titleId);
+ break;
+ case RoleOptionType.Crewmate_Normal:
+ SetupBasicNonKillingCrewmateRoleSettings(ref titleId);
+ break;
+ case RoleOptionType.Neutral_NonKilling:
+ SetupBasicNonKillingNeutralRoleSettings(ref titleId);
+ break;
+ case RoleOptionType.Neutral_Killing:
+ SetupBasicKillingNeutralRoleSettings(ref titleId);
+ break;
+ }
+
+ TextOptionItem.Create(titleId, $"ROT.{roleClasses.Key}", roleClasses.Key.GetTabFromOptionType())
+ .SetHeader(true)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(roleClasses.Key.GetRoleOptionTypeColor());
+ titleId += 10;
+
foreach (var roleClass in roleClasses.Value)
{
index++;
@@ -1681,44 +1578,6 @@ public static class Options
{
Logger.Exception(e, $"{MainLoadingText} - {RoleLoadingText}");
}
-
- if (roleClasses.Key != CustomRoleTypes.Impostor) continue;
-
- switch (roleClass)
- {
- case Assassin:
- Undertaker.SetupCustomOption();
- break;
- case Swooper:
- Chameleon.SetupCustomOption();
- Wraith.SetupCustomOption();
- break;
- case Wildling:
- BloodKnight.SetupCustomOption();
- break;
- case Witch:
- HexMaster.SetupCustomOption();
- break;
- case Greedier:
- Imitator.SetupCustomOption();
- break;
- case CursedWolf:
- Jinx.SetupCustomOption();
- break;
- case Sans:
- Juggernaut.SetupCustomOption();
- Reckless.SetupCustomOption();
- break;
- case Cleaner:
- Medusa.SetupCustomOption();
- break;
- case Vampire:
- Poisoner.SetupCustomOption();
- break;
- case EvilDiviner:
- Ritualist.SetupCustomOption();
- break;
- }
}
}
}
@@ -2675,6 +2534,89 @@ public static class Options
OptionSaver.Load();
IsLoaded = true;
+ return;
+
+ static void SetupBasicNonKillingCrewmateRoleSettings(ref int titleId)
+ {
+ TextOptionItem.Create(titleId, "ROT.Vanilla", TabGroup.CrewmateRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.white)
+ .SetHeader(true);
+ titleId += 10;
+
+ CrewmateVanillaRoles.SetupCustomOption();
+
+ TextOptionItem.Create(titleId, "ROT.Basic", TabGroup.CrewmateRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.gray)
+ .SetHeader(true);
+ titleId += 10;
+
+ CyberStar.SetupCustomOption(); // Celebrity
+ Chameleon.SetupCustomOption();
+ Demolitionist.SetupCustomOption();
+ Detective.SetupCustomOption();
+ SetupRoleOptions(5590, TabGroup.CrewmateRoles, CustomRoles.Detour);
+ SetupRoleOptions(9100, TabGroup.CrewmateRoles, CustomRoles.Dictator);
+ SetupRoleOptions(5700, TabGroup.CrewmateRoles, CustomRoles.Needy); // Lazy guy
+ SetupRoleOptions(7500, TabGroup.CrewmateRoles, CustomRoles.Observer);
+ NiceGuesser.SetupCustomOption();
+ SetupRoleOptions(5594, TabGroup.CrewmateRoles, CustomRoles.Shiftguard);
+ }
+
+ static void SetupBasicImpostorRoleSettings(ref int titleId)
+ {
+ TextOptionItem.Create(titleId, "ROT.Vanilla", TabGroup.ImpostorRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.white)
+ .SetHeader(true);
+ titleId += 10;
+
+ ImpostorVanillaRoles.SetupCustomOption();
+
+ TextOptionItem.Create(100030, "ROT.Basic", TabGroup.ImpostorRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.gray)
+ .SetHeader(true);
+ titleId += 10;
+
+ EvilGuesser.SetupCustomOption();
+ Vindicator.SetupCustomOption();
+ SetupRoleOptions(16150, TabGroup.ImpostorRoles, CustomRoles.Visionary);
+ SetupRoleOptions(4300, TabGroup.ImpostorRoles, CustomRoles.Trickster);
+ }
+
+ static void SetupBasicNonKillingNeutralRoleSettings(ref int titleId)
+ {
+ TextOptionItem.Create(100030, "ROT.BasicNNK", TabGroup.NeutralRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.gray)
+ .SetHeader(true);
+ titleId += 10;
+
+ Phantom.SetupCustomOption();
+ Terrorist.SetupCustomOption();
+ }
+
+ static void SetupBasicKillingNeutralRoleSettings(ref int titleId)
+ {
+ TextOptionItem.Create(100030, "ROT.BasicNK", TabGroup.NeutralRoles)
+ .SetGameMode(CustomGameMode.Standard)
+ .SetColor(Color.gray)
+ .SetHeader(true);
+ titleId += 10;
+
+ BloodKnight.SetupCustomOption();
+ HexMaster.SetupCustomOption();
+ Imitator.SetupCustomOption();
+ Jinx.SetupCustomOption();
+ Juggernaut.SetupCustomOption();
+ Medusa.SetupCustomOption();
+ Poisoner.SetupCustomOption();
+ Reckless.SetupCustomOption();
+ Ritualist.SetupCustomOption();
+ Wraith.SetupCustomOption();
+ }
}
public static void SetupRoleOptions(int id, TabGroup tab, CustomRoles role, CustomGameMode customGameMode = CustomGameMode.Standard, bool zeroOne = false)
diff --git a/Modules/OptionShower.cs b/Modules/OptionShower.cs
index 07be9119d..e8eabfee1 100644
--- a/Modules/OptionShower.cs
+++ b/Modules/OptionShower.cs
@@ -10,15 +10,17 @@ public static class OptionShower
{
public static int currentPage;
public static List pages = [];
+
static OptionShower()
{
-
}
+
public static string GetTextNoFresh()
{
if (pages.Count < 3) GetText();
return $"{pages[currentPage]}{GetString("PressTabToNextPage")}({currentPage + 1}/{pages.Count})";
}
+
public static string GetText()
{
//初期化
@@ -50,6 +52,7 @@ public static class OptionShower
pages.Add(sb + "\n\n");
sb.Clear();
}
+
//有効な役職と詳細設定一覧
pages.Add("");
sb.Append($"{Utils.GetRoleName(CustomRoles.GM)}: {(Main.GM.Value ? GetString("RoleRate") : GetString("RoleOff"))}\n\n");
@@ -71,21 +74,24 @@ public static class OptionShower
}
//1ページにつき35行までにする処理
- List tmp = [..sb.ToString().Split("\n\n")];
+ List tmp = [.. sb.ToString().Split("\n\n")];
foreach (var str in tmp)
{
if (pages[^1].Count(c => c == '\n') + 1 + str.Count(c => c == '\n') + 1 > 35)
pages.Add(str + "\n\n");
else pages[^1] += str + "\n\n";
}
+
if (currentPage >= pages.Count) currentPage = pages.Count - 1; //現在のページが最大ページ数を超えていれば最後のページに修正
return $"{pages[currentPage]}{GetString("PressTabToNextPage")}({currentPage + 1}/{pages.Count})";
}
+
public static void Next()
{
currentPage++;
if (currentPage >= pages.Count) currentPage = 0; //現在のページが最大ページを超えていれば最初のページに
}
+
private static void ShowChildren(OptionItem option, ref StringBuilder sb, Color color, int deep = 0)
{
foreach (var opt in option.Children.Select((v, i) => new { Value = v, Index = i + 1 }))
diff --git a/Modules/RPC.cs b/Modules/RPC.cs
index aa133fdc6..2d50e5f77 100644
--- a/Modules/RPC.cs
+++ b/Modules/RPC.cs
@@ -1,11 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
using InnerNet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
using TOHE.Roles.Crewmate;
diff --git a/Modules/ServerAddManager.cs b/Modules/ServerAddManager.cs
index c47085e02..b45c912a6 100644
--- a/Modules/ServerAddManager.cs
+++ b/Modules/ServerAddManager.cs
@@ -1,10 +1,10 @@
-using System;
+using HarmonyLib;
+using Il2CppInterop.Runtime.InteropTypes;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
-using HarmonyLib;
-using Il2CppInterop.Runtime.InteropTypes;
namespace TOHE;
diff --git a/Modules/TemplateManager.cs b/Modules/TemplateManager.cs
index 4c8868f15..20f6c322f 100644
--- a/Modules/TemplateManager.cs
+++ b/Modules/TemplateManager.cs
@@ -1,3 +1,6 @@
+using AmongUs.Data;
+using HarmonyLib;
+using InnerNet;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -6,9 +9,6 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
-using AmongUs.Data;
-using HarmonyLib;
-using InnerNet;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Modules/Translator.cs b/Modules/Translator.cs
index 6e27b4473..d888bb657 100644
--- a/Modules/Translator.cs
+++ b/Modules/Translator.cs
@@ -1,3 +1,5 @@
+using HarmonyLib;
+using Il2CppInterop.Runtime.InteropTypes.Arrays;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -7,8 +9,6 @@ using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Object = Il2CppSystem.Object;
namespace TOHE;
diff --git a/Modules/Utils.cs b/Modules/Utils.cs
index 9b9a37e9b..c2ab640ed 100644
--- a/Modules/Utils.cs
+++ b/Modules/Utils.cs
@@ -1,3 +1,8 @@
+using AmongUs.Data;
+using AmongUs.GameOptions;
+using Hazel;
+using Il2CppInterop.Runtime.InteropTypes;
+using InnerNet;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -7,11 +12,6 @@ using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using AmongUs.Data;
-using AmongUs.GameOptions;
-using Hazel;
-using Il2CppInterop.Runtime.InteropTypes;
-using InnerNet;
using TOHE.Modules;
using TOHE.Patches;
using TOHE.Roles.AddOns.Common;
@@ -265,6 +265,9 @@ public static class Utils
public static void TargetDies(PlayerControl killer, PlayerControl target)
{
if (!target.Data.IsDead || GameStates.IsMeeting) return;
+
+ var targetRole = target.GetCustomRole();
+
foreach (PlayerControl seer in Main.AllPlayerControls)
{
if (KillFlashCheck(killer, target, seer))
@@ -273,7 +276,7 @@ public static class Utils
continue;
}
- if (target.Is(CustomRoles.CyberStar))
+ if (targetRole == CustomRoles.CyberStar)
{
if (!Options.ImpKnowCyberStarDead.GetBool() && seer.GetCustomRole().IsImpostor()) continue;
if (!Options.NeutralKnowCyberStarDead.GetBool() && seer.GetCustomRole().IsNeutral()) continue;
@@ -282,29 +285,14 @@ public static class Utils
}
}
- if (target.Is(CustomRoles.CyberStar) && !Main.CyberStarDead.Contains(target.PlayerId)) Main.CyberStarDead.Add(target.PlayerId);
- if (target.Is(CustomRoles.Demolitionist) && !Main.DemolitionistDead.Contains(target.PlayerId)) Main.DemolitionistDead.Add(target.PlayerId);
- if (target.Is(CustomRoles.Demolitionist))
+ switch (targetRole)
{
- killer.Notify(ColorString(GetRoleColor(CustomRoles.Demolitionist), GetString("OnDemolitionistDead")));
- killer.KillFlash();
- _ = new LateTask(() =>
- {
- if (!killer.inVent && (killer.PlayerId != target.PlayerId))
- {
- if ((Options.DemolitionistKillerDiesOnMeetingCall.GetBool() || GameStates.IsInTask) && killer.IsAlive())
- {
- killer.Suicide(PlayerState.DeathReason.Demolished, target);
- RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
- }
- }
- else
- {
- if (killer.IsModClient()) RPC.PlaySoundRPC(killer.PlayerId, Sounds.TaskComplete);
- else killer.RpcGuardAndKill(killer);
- killer.SetKillCooldown(Main.AllPlayerKillCooldown[killer.PlayerId] - Options.DemolitionistVentTime.GetFloat());
- }
- }, Options.DemolitionistVentTime.GetFloat() + 0.5f);
+ case CustomRoles.CyberStar when !Main.CyberStarDead.Contains(target.PlayerId):
+ Main.CyberStarDead.Add(target.PlayerId);
+ break;
+ case CustomRoles.Demolitionist:
+ Demolitionist.OnDeath(killer, target);
+ break;
}
}
@@ -1128,7 +1116,7 @@ public static class Utils
sb.Append("<#ffffff>Role Summary:");
- List cloneRoles = [..Main.PlayerStates.Keys];
+ List cloneRoles = [.. Main.PlayerStates.Keys];
foreach (byte id in Main.winnerList.ToArray())
{
if (EndGamePatch.SummaryText[id].Contains("")) continue;
@@ -2342,7 +2330,7 @@ public static class Utils
CustomRoles.Druid => Druid.VentCooldown.GetInt(),
CustomRoles.Sniper => Options.DefaultShapeshiftCooldown.GetInt(),
CustomRoles.Assassin => Assassin.AssassinateCooldownOpt.GetInt(),
- CustomRoles.Undertaker => Undertaker.AssassinateCooldown.GetInt(),
+ CustomRoles.Undertaker => Assassin.UndertakerAssassinateCooldown.GetInt(),
CustomRoles.Bomber => Options.BombCooldown.GetInt(),
CustomRoles.Nuker => Options.NukeCooldown.GetInt(),
CustomRoles.Sapper => Sapper.ShapeshiftCooldown.GetInt(),
@@ -2848,27 +2836,6 @@ public static class Utils
return casted != null;
}
- public static IEnumerable GetEnumerableOfType(params object[] constructorArgs) where T : class, IComparable
- {
- List objects = [];
- try
- {
- var assembly = Assembly.GetAssembly(typeof(T));
- if (assembly == null) return objects;
- objects.AddRange(assembly
- .GetTypes()
- .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(T)))
- .Select(type => (T)Activator.CreateInstance(type, constructorArgs)));
- objects.Sort();
- }
- catch (Exception e)
- {
- ThrowException(e);
- }
-
- return objects;
- }
-
public static int AllPlayersCount => Main.PlayerStates.Values.Count(state => state.countTypes != CountTypes.OutOfGame);
public static int AllAlivePlayersCount => Main.AllAlivePlayerControls.Count(pc => !pc.Is(CountTypes.OutOfGame));
public static bool IsAllAlive => Main.PlayerStates.Values.All(state => state.countTypes == CountTypes.OutOfGame || !state.IsDead);
diff --git a/Modules/Zoom.cs b/Modules/Zoom.cs
index 64693e805..f82e3b96d 100644
--- a/Modules/Zoom.cs
+++ b/Modules/Zoom.cs
@@ -1,6 +1,6 @@
-using System;
+using HarmonyLib;
+using System;
using System.Collections.Generic;
-using HarmonyLib;
using UnityEngine;
namespace TOHE;
diff --git a/Patches/AirShipElectricalDoors.cs b/Patches/AirShipElectricalDoors.cs
index 7f8843815..3891ca091 100644
--- a/Patches/AirShipElectricalDoors.cs
+++ b/Patches/AirShipElectricalDoors.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using HarmonyLib;
+using System.Collections.Generic;
namespace TOHE;
diff --git a/Patches/AnnouncementPatch.cs b/Patches/AnnouncementPatch.cs
index 18ec79ab1..cd725d132 100644
--- a/Patches/AnnouncementPatch.cs
+++ b/Patches/AnnouncementPatch.cs
@@ -1,11 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.Data;
+using AmongUs.Data;
using AmongUs.Data.Player;
using Assets.InnerNet;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace TOHE;
diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs
index 337c67f58..02200cf37 100644
--- a/Patches/ChatCommandPatch.cs
+++ b/Patches/ChatCommandPatch.cs
@@ -597,7 +597,7 @@ internal class ChatCommands
case "/id":
canceled = true;
string msgText = GetString("PlayerIdList");
- msgText = Main.AllPlayerControls.Aggregate(msgText, (current, pc) => current + "\n" + pc.PlayerId + " → " + Main.AllPlayerNames[pc.PlayerId]);
+ msgText = Main.AllPlayerControls.Aggregate(msgText, (current, pc) => current + ("\n" + pc.PlayerId + " → " + Main.AllPlayerNames[pc.PlayerId]));
Utils.SendMessage(msgText, localPlayerId);
break;
@@ -1209,7 +1209,7 @@ internal class ChatCommands
// break;
case "/id":
string msgText = GetString("PlayerIdList");
- msgText = Main.AllPlayerControls.Aggregate(msgText, (current, pc) => current + "\n" + pc.PlayerId + " → " + Main.AllPlayerNames[pc.PlayerId]);
+ msgText = Main.AllPlayerControls.Aggregate(msgText, (current, pc) => current + ("\n" + pc.PlayerId + " → " + Main.AllPlayerNames[pc.PlayerId]));
Utils.SendMessage(msgText, player.PlayerId);
break;
diff --git a/Patches/ChatControlPatch.cs b/Patches/ChatControlPatch.cs
index a152fce27..79f437bda 100644
--- a/Patches/ChatControlPatch.cs
+++ b/Patches/ChatControlPatch.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.Data;
using HarmonyLib;
using InnerNet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Roles.Impostor;
using UnityEngine;
diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs
index 8204cf45c..dc0ce1cbb 100644
--- a/Patches/CheckGameEndPatch.cs
+++ b/Patches/CheckGameEndPatch.cs
@@ -1,11 +1,11 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Hazel;
using InnerNet;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
diff --git a/Patches/ControlPatch.cs b/Patches/ControlPatch.cs
index f5e9cc769..aec7232de 100644
--- a/Patches/ControlPatch.cs
+++ b/Patches/ControlPatch.cs
@@ -1,9 +1,9 @@
+using HarmonyLib;
+using Rewired;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using HarmonyLib;
-using Rewired;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Patches/CredentialsPatch.cs b/Patches/CredentialsPatch.cs
index eb3b6239f..adb1c189d 100644
--- a/Patches/CredentialsPatch.cs
+++ b/Patches/CredentialsPatch.cs
@@ -1,7 +1,7 @@
+using HarmonyLib;
using System;
using System.Linq;
using System.Text;
-using HarmonyLib;
using TMPro;
using TOHE.Modules;
using UnityEngine;
diff --git a/Patches/DiscordPatch.cs b/Patches/DiscordPatch.cs
index 29bc175b1..52b38035d 100644
--- a/Patches/DiscordPatch.cs
+++ b/Patches/DiscordPatch.cs
@@ -1,7 +1,7 @@
-using System;
using AmongUs.Data;
using Discord;
using HarmonyLib;
+using System;
namespace TOHE.Patches
{
@@ -14,8 +14,6 @@ namespace TOHE.Patches
public static void Prefix([HarmonyArgument(0)] Activity activity)
{
- if (activity == null) return;
-
var details = $"TOHE+ v{Main.PluginDisplayVersion}";
activity.Details = details;
@@ -64,4 +62,4 @@ namespace TOHE.Patches
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Patches/ExilePatch.cs b/Patches/ExilePatch.cs
index 0094efc8b..96109f63d 100644
--- a/Patches/ExilePatch.cs
+++ b/Patches/ExilePatch.cs
@@ -1,7 +1,7 @@
-using System.Linq;
using AmongUs.Data;
using AmongUs.GameOptions;
using HarmonyLib;
+using System.Linq;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
using TOHE.Roles.Crewmate;
diff --git a/Patches/GameOptionsMenuPatch.cs b/Patches/GameOptionsMenuPatch.cs
index 2b4d448dc..8b1394267 100644
--- a/Patches/GameOptionsMenuPatch.cs
+++ b/Patches/GameOptionsMenuPatch.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Collections;
-using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
+using System;
+using System.Collections;
+using System.Linq;
using TMPro;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Patches/GameStartManagerPatch.cs b/Patches/GameStartManagerPatch.cs
index 6e1ce4ab4..c2a15c377 100644
--- a/Patches/GameStartManagerPatch.cs
+++ b/Patches/GameStartManagerPatch.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.Data;
using AmongUs.GameOptions;
using HarmonyLib;
using InnerNet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TMPro;
using TOHE.Roles.Neutral;
using UnityEngine;
@@ -308,7 +308,7 @@ public class GameStartRandomMap
Main.LastShapeshifterCooldown.Value = AURoleOptions.ShapeshifterCooldown;
AURoleOptions.ShapeshifterCooldown = 0f;
- PlayerControl.LocalPlayer.RpcSyncSettings(GameOptionsManager.Instance.gameOptionsFactory.ToBytes(opt, AprilFoolsMode.IsAprilFoolsModeToggledOn));
+ PlayerControl.LocalPlayer.RpcSyncSettings(GameOptionsManager.Instance.gameOptionsFactory.ToBytes(opt));
__instance.ReallyBegin(false);
return false;
@@ -371,7 +371,7 @@ class ResetStartStatePatch
if (GameStates.IsCountDown)
{
Main.NormalOptions.KillCooldown = Options.DefaultKillCooldown;
- PlayerControl.LocalPlayer.RpcSyncSettings(GameOptionsManager.Instance.gameOptionsFactory.ToBytes(GameOptionsManager.Instance.CurrentGameOptions, AprilFoolsMode.IsAprilFoolsModeToggledOn));
+ PlayerControl.LocalPlayer.RpcSyncSettings(GameOptionsManager.Instance.gameOptionsFactory.ToBytes(GameOptionsManager.Instance.CurrentGameOptions));
}
}
}
@@ -384,4 +384,4 @@ class UnrestrictedNumImpostorsPatch
__result = Main.NormalOptions.NumImpostors;
return false;
}
-}
+}
\ No newline at end of file
diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs
index ea729f5ec..ea4b108e4 100644
--- a/Patches/HudPatch.cs
+++ b/Patches/HudPatch.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
+using Il2CppSystem.Text;
using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
-using Il2CppSystem.Text;
using TMPro;
using TOHE.Modules;
using TOHE.Roles.AddOns.Common;
@@ -93,7 +93,7 @@ class HudManagerPatch
{
var pc = Utils.GetPlayerById(item.Key);
string prefix = first ? string.Empty : "\n";
- string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - {GetString(item.Value.ToString())}";
+ string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - {GetString(item.Value.ToString())}";
resultText[item.Key] = text;
first = false;
}
@@ -106,13 +106,13 @@ class HudManagerPatch
var pc = Utils.GetPlayerById(item.Key);
if (resultText.ContainsKey(item.Key))
{
- string text = $" <#ffffff>({GetString(role.ToString())}<#ffffff>)";
+ string text = $" <#ffffff>({GetString(role.ToString())}<#ffffff>)";
resultText[item.Key] += text;
}
else
{
string prefix = first ? string.Empty : "\n";
- string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>({GetString(role.ToString())}<#ffffff>)";
+ string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>({GetString(role.ToString())}<#ffffff>)";
resultText[item.Key] = text;
first = false;
}
@@ -161,16 +161,11 @@ class HudManagerPatch
{
if (player.IsAlive() || Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato)
{
- bool usesPetInsteadOfKill = false;
if (player.GetCustomRole().UsesPetInsteadOfKill())
{
- __instance.PetButton?.OverrideText(GetString("KillButtonText"));
- usesPetInsteadOfKill = true;
+ __instance.PetButton?.OverrideText("KillButtonText");
}
- ActionButton usedButton = __instance.KillButton;
- if (usesPetInsteadOfKill) usedButton = __instance.PetButton;
-
Main.PlayerStates[player.PlayerId].Role.SetButtonTexts(__instance, player.PlayerId);
switch (player.GetCustomRole())
@@ -178,6 +173,9 @@ class HudManagerPatch
case CustomRoles.FireWorks:
__instance.AbilityButton?.OverrideText((Main.PlayerStates[player.PlayerId].Role as FireWorks).nowFireWorksCount == 0 ? GetString("FireWorksExplosionButtonText") : GetString("FireWorksInstallAtionButtonText"));
break;
+ //case CustomRoles.SerialKiller:
+ // SerialKiller.GetAbilityButtonText(__instance, player);
+ // break;
case CustomRoles.Pestilence:
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
break;
@@ -193,16 +191,25 @@ class HudManagerPatch
__instance.ImpostorVentButton.buttonLabelText.text = GetString("ArsonistVentButtonText");
break;
case CustomRoles.Farseer:
- usedButton?.OverrideText(GetString("FarseerKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("FarseerKillButtonText"));
break;
+ //case CustomRoles.NWitch:
+ // __instance.KillButton.OverrideText($"{GetString("WitchControlButtonText")}");
+ // break;
+ //case CustomRoles.BountyHunter:
+ // BountyHunter.SetAbilityButtonText(__instance);
+ // break;
case CustomRoles.Capitalism:
__instance.KillButton?.OverrideText(GetString("CapitalismButtonText"));
break;
case CustomRoles.Pelican:
__instance.KillButton?.OverrideText(GetString("PelicanButtonText"));
break;
+ //case CustomRoles.Counterfeiter:
+ // __instance.KillButton.OverrideText(GetString("CounterfeiterButtonText"));
+ // break;
case CustomRoles.Analyzer:
- usedButton?.OverrideText(GetString("AnalyzerKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("AnalyzerKillButtonText"));
break;
case CustomRoles.Pursuer:
__instance.KillButton?.OverrideText(GetString("PursuerButtonText"));
@@ -220,12 +227,12 @@ class HudManagerPatch
__instance.KillButton?.OverrideText(GetString("FFFButtonText"));
break;
case CustomRoles.Gaulois:
- usedButton?.OverrideText(GetString("GauloisKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("GauloisKillButtonText"));
break;
case CustomRoles.Aid:
case CustomRoles.DonutDelivery:
case CustomRoles.Medic:
- usedButton?.OverrideText(GetString("MedicalerButtonText"));
+ __instance.KillButton?.OverrideText(GetString("MedicalerButtonText"));
break;
case CustomRoles.Gamer:
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
@@ -291,10 +298,10 @@ class HudManagerPatch
break;
case CustomRoles.Sheriff:
- usedButton?.OverrideText(GetString("SheriffKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("SheriffKillButtonText"));
break;
case CustomRoles.Crusader:
- usedButton?.OverrideText(GetString("CrusaderKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("CrusaderKillButtonText"));
break;
case CustomRoles.Totocalcio:
__instance.KillButton?.OverrideText(GetString("TotocalcioKillButtonText"));
@@ -316,10 +323,10 @@ class HudManagerPatch
__instance.KillButton?.OverrideText(GetString("RememberButtonText"));
break;
case CustomRoles.Monarch:
- usedButton?.OverrideText(GetString("MonarchKillButtonText"));
+ __instance.KillButton?.OverrideText(GetString("MonarchKillButtonText"));
break;
case CustomRoles.Deputy:
- usedButton?.OverrideText(GetString("DeputyHandcuffText"));
+ __instance.KillButton?.OverrideText(GetString("DeputyHandcuffText"));
break;
case CustomRoles.Hangman:
if (shapeshifting) __instance.KillButton?.OverrideText(GetString("HangmanKillButtonTextDuringSS"));
@@ -388,7 +395,6 @@ class HudManagerPatch
CustomRoles.YinYanger => YinYanger.ModeText(player),
CustomRoles.WeaponMaster => WeaponMaster.GetHudAndProgressText(player.PlayerId),
CustomRoles.Postman => Postman.GetHudText(player),
- CustomRoles.Predator => Predator.GetSuffixAndHudText(player),
CustomRoles.SoulHunter => SoulHunter.HUDText(player.PlayerId),
CustomRoles.Chronomancer => Chronomancer.GetHudText(player.PlayerId),
CustomRoles.Mafioso => Mafioso.GetHUDText(player),
@@ -716,7 +722,7 @@ class TaskPanelBehaviourPatch
List<(int, byte)> list = [];
foreach (var id in Main.PlayerStates.Keys) list.Add((SoloKombatManager.GetRankOfScore(id), id));
list.Sort();
- AllText = list.Where(x => SummaryText.ContainsKey(x.Item2)).Aggregate(AllText, (current, id) => current + "\r\n" + SummaryText[id.Item2]);
+ AllText = list.Where(x => SummaryText.ContainsKey(x.Item2)).Aggregate(AllText, (current, id) => current + ("\r\n" + SummaryText[id.Item2]));
AllText = $"{AllText}";
@@ -736,7 +742,7 @@ class TaskPanelBehaviourPatch
List<(int, byte)> list2 = [];
foreach (var id in Main.PlayerStates.Keys) list2.Add((FFAManager.GetRankOfScore(id), id));
list2.Sort();
- AllText = list2.Where(x => SummaryText2.ContainsKey(x.Item2)).Aggregate(AllText, (current, id) => current + "\r\n" + SummaryText2[id.Item2]);
+ AllText = list2.Where(x => SummaryText2.ContainsKey(x.Item2)).Aggregate(AllText, (current, id) => current + ("\r\n" + SummaryText2[id.Item2]));
AllText = $"{AllText}";
@@ -773,7 +779,7 @@ class TaskPanelBehaviourPatch
List<(int, byte)> list3 = [];
foreach (var id in Main.PlayerStates.Keys) list3.Add((MoveAndStopManager.GetRankOfScore(id), id));
list3.Sort();
- list3 = [.. list3.OrderBy(x => Utils.GetPlayerById(x.Item2).IsAlive())];
+ list3 = [.. list3.OrderBy(x => (Utils.GetPlayerById(x.Item2).IsAlive()))];
foreach (var id in list3.Where(x => SummaryText3.ContainsKey(x.Item2)).ToArray())
{
bool alive = Utils.GetPlayerById(id.Item2).IsAlive();
diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs
index 83704699b..7edec42dd 100644
--- a/Patches/IntroPatch.cs
+++ b/Patches/IntroPatch.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
using AmongUs.GameOptions;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Patches/JoinGameButtonPatch.cs b/Patches/JoinGameButtonPatch.cs
index b5915ac29..a3896aace 100644
--- a/Patches/JoinGameButtonPatch.cs
+++ b/Patches/JoinGameButtonPatch.cs
@@ -1,5 +1,5 @@
-using System.Text.RegularExpressions;
using HarmonyLib;
+using System.Text.RegularExpressions;
using UnityEngine;
namespace TOHE;
diff --git a/Patches/LadderPatch.cs b/Patches/LadderPatch.cs
index e9dc5f05c..4734a806a 100644
--- a/Patches/LadderPatch.cs
+++ b/Patches/LadderPatch.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using HarmonyLib;
+using HarmonyLib;
using Hazel;
+using System.Collections.Generic;
using UnityEngine;
namespace TOHE;
diff --git a/Patches/LobbyListPatch.cs b/Patches/LobbyListPatch.cs
index d689fc92b..a5ce45588 100644
--- a/Patches/LobbyListPatch.cs
+++ b/Patches/LobbyListPatch.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using HarmonyLib;
+using HarmonyLib;
using InnerNet;
+using System;
+using System.Collections.Generic;
using UnityEngine;
namespace TOHE;
diff --git a/Patches/LogoAndStampPatch.cs b/Patches/LogoAndStampPatch.cs
index ca949dc87..ad81d1e96 100644
--- a/Patches/LogoAndStampPatch.cs
+++ b/Patches/LogoAndStampPatch.cs
@@ -1,6 +1,6 @@
-using System.Collections;
-using BepInEx.Unity.IL2CPP.Utils;
+using BepInEx.Unity.IL2CPP.Utils;
using HarmonyLib;
+using System.Collections;
using TMPro;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Patches/MainMenuManagerPatch.cs b/Patches/MainMenuManagerPatch.cs
index c9e4c4549..cffa546d5 100644
--- a/Patches/MainMenuManagerPatch.cs
+++ b/Patches/MainMenuManagerPatch.cs
@@ -1,5 +1,5 @@
-using System;
using HarmonyLib;
+using System;
using TMPro;
using TOHE.Modules;
using UnityEngine;
@@ -112,18 +112,29 @@ public class MainMenuManagerPatch
var bottomTemplate = GameObject.Find("InventoryButton");
if (bottomTemplate == null) return;
+
+ var HorseButton = Object.Instantiate(bottomTemplate, bottomTemplate.transform.parent);
+ var passiveHorseButton = HorseButton.GetComponent();
+ var spriteHorseButton = HorseButton.GetComponent();
+ if (HorseModePatch.isHorseMode) spriteHorseButton.transform.localScale *= -1;
+
+ spriteHorseButton.sprite = Utils.LoadSprite("TOHE.Resources.Images.HorseButton.png", 75f);
+ passiveHorseButton.OnClick = new();
+ passiveHorseButton.OnClick.AddListener((Action)(() =>
{
RunLoginPatch.ClickCount++;
if (RunLoginPatch.ClickCount == 10) PlayerControl.LocalPlayer.RPCPlayCustomSound("Gunload", true);
if (RunLoginPatch.ClickCount == 20) PlayerControl.LocalPlayer.RPCPlayCustomSound("AWP", true);
+ spriteHorseButton.transform.localScale *= -1;
+ HorseModePatch.isHorseMode = !HorseModePatch.isHorseMode;
var particles = Object.FindObjectOfType();
if (particles != null)
{
particles.pool.ReclaimAll();
particles.Start();
}
- }
+ }));
//var DleksButton = Object.Instantiate(bottomTemplate, bottomTemplate.transform.parent);
//var passiveDleksButton = DleksButton.GetComponent();
//var spriteDleksButton = DleksButton.GetComponent();
diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs
index 9577d4218..a45779ac2 100644
--- a/Patches/MeetingHudPatch.cs
+++ b/Patches/MeetingHudPatch.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using HarmonyLib;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
@@ -715,7 +715,6 @@ class MeetingHudStartPatch
}
Main.CyberStarDead.Clear();
- Main.DemolitionistDead.Clear();
Express.SpeedNormal.Clear();
Express.SpeedUp.Clear();
Main.DetectiveNotify.Clear();
diff --git a/Patches/OutroPatch.cs b/Patches/OutroPatch.cs
index c67b3c9fa..1bc159ae5 100644
--- a/Patches/OutroPatch.cs
+++ b/Patches/OutroPatch.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using HarmonyLib;
using TMPro;
using TOHE.Modules;
using TOHE.Roles.Neutral;
@@ -171,8 +171,8 @@ class SetEverythingUpPatch
{
byte id = Main.winnerList[i1];
if (Main.winnerNameList[i1].RemoveHtmlTags() != winningPlayerData2.PlayerName.RemoveHtmlTags()) continue;
-
var role = Main.PlayerStates[id].MainRole;
+
var color = Main.roleColors[role];
var rolename = Utils.GetRoleName(role);
@@ -261,6 +261,7 @@ class SetEverythingUpPatch
switch (CustomWinnerHolder.WinnerTeam)
{
+ //通常勝利
case CustomWinner.Crewmate:
CustomWinnerColor = Utils.GetRoleColorCode(CustomRoles.Engineer);
__instance.BackgroundBar.material.color = Utils.GetRoleColor(CustomRoles.Engineer);
@@ -277,12 +278,14 @@ class SetEverythingUpPatch
CustomWinnerColor = Utils.GetRoleColorCode(CustomRoles.Egoist);
__instance.BackgroundBar.material.color = Utils.GetRoleColor(CustomRoles.Egoist);
break;
+ //特殊勝利
case CustomWinner.Terrorist:
__instance.BackgroundBar.material.color = Utils.GetRoleColor(CustomRoles.Terrorist);
break;
case CustomWinner.Lovers:
__instance.BackgroundBar.material.color = Utils.GetRoleColor(CustomRoles.Lovers);
break;
+ //引き分け処理
case CustomWinner.Draw:
__instance.WinText.text = GetString("ForceEnd");
__instance.WinText.color = Color.white;
@@ -297,6 +300,7 @@ class SetEverythingUpPatch
WinnerText.text = GetString("NeutralsLeftText");
WinnerText.color = Utils.GetRoleColor(CustomRoles.Executioner);
break;
+ //全滅
case CustomWinner.None:
__instance.WinText.text = string.Empty;
__instance.WinText.color = Color.black;
@@ -341,7 +345,7 @@ class SetEverythingUpPatch
RoleSummaryObject.transform.localScale = new(1f, 1f, 1f);
StringBuilder sb = new($"{GetString("RoleSummaryText")}\n");
- List cloneRoles = [..Main.PlayerStates.Keys];
+ List cloneRoles = [.. Main.PlayerStates.Keys];
foreach (byte id in Main.winnerList.ToArray())
{
if (EndGamePatch.SummaryText[id].Contains("")) continue;
@@ -419,10 +423,12 @@ class SetEverythingUpPatch
return name;
}
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //Utils.ApplySuffix();
static string GetWinnerRoleName(CustomRoles role)
{
var name = GetString($"WinnerRoleText.{Enum.GetName(typeof(CustomRoles), role)}");
- if (name == string.Empty || name.StartsWith("*") || name.StartsWith(" { NotifyRoles(NoCache: true); }, 1.2f, "ShapeShiftNotify");
+ _ = new LateTask(() => { NotifyRoles(NoCache: true); },
+ 1.2f, "ShapeShiftNotify");
}
if ((!shapeshifting || !isSSneeded) && !Swapster.FirstSwapTarget.ContainsKey(shapeshifter.PlayerId))
@@ -1246,6 +1236,7 @@ class FixedUpdatePatch
if (target.AmOwner && GameStates.IsInTask)
{
+ //targetが自分自身
if (target.Is(CustomRoles.Arsonist) && target.IsDouseDone())
RealName = ColorString(GetRoleColor(CustomRoles.Arsonist), GetString("EnterVentToWin"));
else if (target.Is(CustomRoles.Revolutionist) && target.IsDrawDone())
@@ -1272,19 +1263,19 @@ class FixedUpdatePatch
// Name Color Manager
RealName = RealName.ApplyNameColorData(seer, target, false);
- if (seer.GetCustomRole().IsCrewmate() && seer.Is(CustomRoles.Madmate) && Marshall.MadmateCanFindMarshall)
+ if (seer.GetCustomRole().IsCrewmate() && seer.Is(CustomRoles.Madmate) && Marshall.MadmateCanFindMarshall) //seerがインポスター
{
- if (target.Is(CustomRoles.Marshall) && target.GetTaskState().IsTaskFinished)
- Mark.Append(ColorString(GetRoleColor(CustomRoles.Marshall), "★"));
+ if (target.Is(CustomRoles.Marshall) && target.GetTaskState().IsTaskFinished) //targetがタスクを終わらせたマッドスニッチ
+ Mark.Append(ColorString(GetRoleColor(CustomRoles.Marshall), "★")); //targetにマーク付与
}
- switch (target.GetCustomRole())
+ switch (target.GetCustomRole()) //seerがインポスター
{
case CustomRoles.Snitch when seer.GetCustomRole().IsImpostor() && target.Is(CustomRoles.Madmate) && target.GetTaskState().IsTaskFinished:
- Mark.Append(ColorString(GetRoleColor(CustomRoles.Impostor), "★"));
+ Mark.Append(ColorString(GetRoleColor(CustomRoles.Impostor), "★")); //targetにマーク付与
break;
case CustomRoles.Marshall when seer.GetCustomRole().IsCrewmate() && target.GetTaskState().IsTaskFinished:
- Mark.Append(ColorString(GetRoleColor(CustomRoles.Marshall), "★"));
+ Mark.Append(ColorString(GetRoleColor(CustomRoles.Marshall), "★")); //targetにマーク付与
break;
case CustomRoles.SuperStar when Options.EveryOneKnowSuperStar.GetBool():
Mark.Append(ColorString(GetRoleColor(CustomRoles.SuperStar), "★"));
@@ -1421,9 +1412,6 @@ class FixedUpdatePatch
case CustomRoles.Tiger when target.PlayerId == seer.PlayerId:
Suffix.Append(Tiger.GetSuffix(seer));
break;
- case CustomRoles.Predator when seer.PlayerId == target.PlayerId:
- Suffix.Append(Predator.GetSuffixAndHudText(seer));
- break;
}
Mark.Append(Totocalcio.TargetMark(seer, target));
@@ -1503,7 +1491,11 @@ class FixedUpdatePatch
if (Options.CurrentGameMode == CustomGameMode.SoloKombat)
Suffix.Append(SoloKombatManager.GetDisplayHealth(target));
- // Devourer
+ /*if(main.AmDebugger.Value && main.BlockKilling.TryGetValue(target.PlayerId, out var isBlocked)) {
+ Mark = isBlocked ? "(true)" : "(false)";
+ }*/
+
+ //Devourer
if (Devourer.HideNameOfConsumedPlayer.GetBool() && Devourer.playerIdList.Any(x => Main.PlayerStates[x].Role is Devourer { IsEnable: true } dv && dv.PlayerSkinsCosumed.Contains(seer.PlayerId)))
RealName = GetString("DevouredName");
@@ -1512,6 +1504,7 @@ class FixedUpdatePatch
RealName = $"{RealName} ";
string DeathReason = seer.Data.IsDead && seer.KnowDeathReason(target) ? $"\n({ColorString(GetRoleColor(CustomRoles.Doctor), GetVitalText(target.PlayerId))})" : string.Empty;
+ //Mark・Suffixの適用
var currentText = target.cosmetics.nameText.text;
var changeTo = $"{RealName}{DeathReason}{Mark}\r\n{Suffix}";
diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs
index 811daaa96..5076ced92 100644
--- a/Patches/PlayerJoinAndLeftPatch.cs
+++ b/Patches/PlayerJoinAndLeftPatch.cs
@@ -1,10 +1,10 @@
-using System;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
using AmongUs.Data;
using AmongUs.GameOptions;
using HarmonyLib;
using InnerNet;
+using System;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
@@ -143,27 +143,17 @@ class OnPlayerLeftPatch
Main.PlayerStates[lovers.PlayerId].RemoveSubRole(CustomRoles.Lovers);
}
}
-
- switch (data.Character.GetCustomRole())
- {
- case CustomRoles.Executioner when Executioner.Target.ContainsKey(data.Character.PlayerId):
- Executioner.ChangeRole(data.Character);
- break;
- case CustomRoles.Lawyer when Lawyer.Target.ContainsKey(data.Character.PlayerId):
- Lawyer.ChangeRole(data.Character);
- break;
- case CustomRoles.Pelican:
- Pelican.OnPelicanDied(data.Character.PlayerId);
- break;
- case CustomRoles.Markseeker:
- Markseeker.OnDeath(data.Character);
- break;
- }
-
+
+ if (data.Character.Is(CustomRoles.Executioner) && Executioner.Target.ContainsKey(data.Character.PlayerId))
+ Executioner.ChangeRole(data.Character);
if (Executioner.Target.ContainsValue(data.Character.PlayerId))
Executioner.ChangeRoleByTarget(data.Character);
+ if (data.Character.Is(CustomRoles.Lawyer) && Lawyer.Target.ContainsKey(data.Character.PlayerId))
+ Lawyer.ChangeRole(data.Character);
if (Lawyer.Target.ContainsValue(data.Character.PlayerId))
Lawyer.ChangeRoleByTarget(data.Character);
+ if (data.Character.Is(CustomRoles.Pelican))
+ Pelican.OnPelicanDied(data.Character.PlayerId);
if (Spiritualist.SpiritualistTarget == data.Character.PlayerId)
Spiritualist.RemoveTarget();
Postman.CheckAndResetTargets(data.Character);
diff --git a/Patches/RandomSpawnPatch.cs b/Patches/RandomSpawnPatch.cs
index d0387b3f9..2208e08eb 100644
--- a/Patches/RandomSpawnPatch.cs
+++ b/Patches/RandomSpawnPatch.cs
@@ -1,7 +1,7 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
using TOHE.Roles.Impostor;
using UnityEngine;
diff --git a/Patches/SabotageSystemPatch.cs b/Patches/SabotageSystemPatch.cs
index 9afa66b2b..8d1f3e99d 100644
--- a/Patches/SabotageSystemPatch.cs
+++ b/Patches/SabotageSystemPatch.cs
@@ -1,7 +1,6 @@
-using System.Linq;
using HarmonyLib;
using Hazel;
-using TOHE.Roles.Neutral;
+using System.Linq;
namespace TOHE;
@@ -249,29 +248,6 @@ public static class SabotageSystemTypeRepairDamagePatch
modifiedCooldownSec = Options.SabotageCooldown.GetFloat();
}
- public static bool Prefix([HarmonyArgument(0)] PlayerControl player)
- {
- if (Options.DisableSabotage.GetBool() || Options.CurrentGameMode is CustomGameMode.SoloKombat or CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato) return false;
- if (Main.BlockSabo.Count > 0) return false;
- if (Glitch.hackedIdList.ContainsKey(player.PlayerId))
- {
- player.Notify(string.Format(Translator.GetString("HackedByGlitch"), "Sabotage"));
- return false;
- }
-
- if (player.Is(CustomRoleTypes.Impostor) && !player.IsAlive() && Options.DeadImpCantSabotage.GetBool()) return false;
- if (player.Is(CustomRoleTypes.Impostor) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool()) && !player.Is(CustomRoles.Minimalism) && !player.Is(CustomRoles.Mafioso)) return true;
- return player.GetCustomRole() switch
- {
- CustomRoles.Jackal when Jackal.CanSabotage.GetBool() => true,
- CustomRoles.Sidekick when Jackal.CanSabotageSK.GetBool() => true,
- CustomRoles.Traitor when Traitor.CanSabotage.GetBool() => true,
- CustomRoles.Parasite when player.IsAlive() => true,
- CustomRoles.Refugee when player.IsAlive() => true,
- _ => Main.PlayerStates[player.PlayerId].Role.OnSabotage(player) && Main.PlayerStates[player.PlayerId].Role.CanUseSabotage(player)
- };
- }
-
public static void Postfix(SabotageSystemType __instance)
{
if (!isCooldownModificationEnabled || !AmongUsClient.Instance.AmHost)
diff --git a/Patches/ShipStatusPatch.cs b/Patches/ShipStatusPatch.cs
index 0ad693b79..dfeacdb85 100644
--- a/Patches/ShipStatusPatch.cs
+++ b/Patches/ShipStatusPatch.cs
@@ -1,8 +1,8 @@
-using System.Collections.Generic;
-using System.Linq;
using BepInEx;
using HarmonyLib;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Patches;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
@@ -134,7 +134,7 @@ class RepairSystemPatch
CustomRoles.Traitor when Traitor.CanSabotage.GetBool() => true,
CustomRoles.Parasite when player.IsAlive() => true,
CustomRoles.Refugee when player.IsAlive() => true,
- _ => Main.PlayerStates[player.PlayerId].Role.CanUseSabotage(player)
+ _ => Main.PlayerStates[player.PlayerId].Role.OnSabotage(player) && Main.PlayerStates[player.PlayerId].Role.CanUseSabotage(player)
};
case SystemTypes.Security when amount == 1:
var camerasDisabled = (MapNames)Main.NormalOptions.MapId switch
@@ -280,7 +280,7 @@ class BeginPatch
{
Logger.CurrentMethod();
- //Should I initialize the host role here? - no
+ //Should I initialize the host role here?
}
}
@@ -289,7 +289,7 @@ class CheckTaskCompletionPatch
{
public static bool Prefix(ref bool __result)
{
- if (Options.DisableTaskWin.GetBool() || Options.NoGameEnd.GetBool() || TaskState.InitialTotalTasks == 0 || (Options.DisableTaskWinIfAllCrewsAreDead.GetBool() && !Main.AllAlivePlayerControls.Any(x => x.Is(CustomRoleTypes.Crewmate))) || Options.CurrentGameMode is CustomGameMode.SoloKombat or CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato)
+ if (Options.DisableTaskWin.GetBool() || Options.NoGameEnd.GetBool() || TaskState.InitialTotalTasks == 0 || Options.CurrentGameMode is CustomGameMode.SoloKombat or CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato)
{
__result = false;
return false;
diff --git a/Patches/TaskAdderPatch.cs b/Patches/TaskAdderPatch.cs
index 11e57f276..61baec521 100644
--- a/Patches/TaskAdderPatch.cs
+++ b/Patches/TaskAdderPatch.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
+using HarmonyLib;
using System;
using System.Collections;
using System.Linq;
-using AmongUs.GameOptions;
-using HarmonyLib;
using UnityEngine;
using Object = UnityEngine.Object;
diff --git a/Patches/onGameStartedPatch.cs b/Patches/onGameStartedPatch.cs
index 64f8f3a8f..0d88d301a 100644
--- a/Patches/onGameStartedPatch.cs
+++ b/Patches/onGameStartedPatch.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.AddOns.Common;
using TOHE.Roles.AddOns.Crewmate;
@@ -74,7 +74,6 @@ internal class ChangeRoleSettings
Main.ForCrusade = [];
Main.KillGhoul = [];
Main.CyberStarDead = [];
- Main.DemolitionistDead = [];
Main.KilledDiseased = [];
Main.KilledAntidote = [];
Main.WorkaholicAlive = [];
diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json
index becd3372e..1840b2c00 100644
--- a/Resources/Lang/en_US.json
+++ b/Resources/Lang/en_US.json
@@ -63,6 +63,15 @@
"CrewOnlyAddonSettings": "Can guess Crewmate add-ons",
"NeutralAddonSettings": "Can guess Neutral add-ons",
"BasicAddonSettings": "Can guess global add-ons",
+ "ROT.Impostor": "★ Impostor Roles",
+ "ROT.Crewmate_Normal": "★ Non-Killing Crewmate Roles",
+ "ROT.Crewmate_ImpostorBased": "★ Killing Crewmate Roles",
+ "ROT.Neutral_NonKilling": "★ Non-Killing Neutral Roles",
+ "ROT.Neutral_Killing": "★ Killing Neutral Roles",
+ "ROT.Vanilla": "★ Vanilla Roles",
+ "ROT.Basic": "★ Basic Roles",
+ "ROT.BasicNK": "★ Basic Neutral Killing Roles",
+ "ROT.BasicNNK": "★ Basic Non-Killing Neutral Roles",
"GM": "Game Master",
"Sunnyboy": "Sunnyboy",
"Bard": "Bard",
diff --git a/Roles/AddOns/Crewmate/Stressed.cs b/Roles/AddOns/Crewmate/Stressed.cs
index 166cb9ca8..9462c7601 100644
--- a/Roles/AddOns/Crewmate/Stressed.cs
+++ b/Roles/AddOns/Crewmate/Stressed.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/AddOns/Impostor/Damocles.cs b/Roles/AddOns/Impostor/Damocles.cs
index 4697d6963..9a40c14ca 100644
--- a/Roles/AddOns/Impostor/Damocles.cs
+++ b/Roles/AddOns/Impostor/Damocles.cs
@@ -1,7 +1,7 @@
-using System;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Addict.cs b/Roles/Crewmate/Addict.cs
index 39033c666..015e92376 100644
--- a/Roles/Crewmate/Addict.cs
+++ b/Roles/Crewmate/Addict.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using UnityEngine;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/Aid.cs b/Roles/Crewmate/Aid.cs
index 32530d24f..ef27f44c2 100644
--- a/Roles/Crewmate/Aid.cs
+++ b/Roles/Crewmate/Aid.cs
@@ -1,6 +1,5 @@
-using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
+using System.Collections.Generic;
namespace TOHE.Roles.Crewmate
{
diff --git a/Roles/Crewmate/Alchemist.cs b/Roles/Crewmate/Alchemist.cs
index a647f411e..035b45b6c 100644
--- a/Roles/Crewmate/Alchemist.cs
+++ b/Roles/Crewmate/Alchemist.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
+using Hazel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Neutral;
@@ -340,12 +340,17 @@ namespace TOHE.Roles.Crewmate
if (am.FixNextSabo) str.Append($"\n{GetString("QuickFixPotionWaitForUse")}");
}
+ if (UsePets.GetBool() && Main.AbilityCD.TryGetValue(pc.PlayerId, out var CD))
+ {
+ str.Append($"\n{GetString("CD")}: {CD.TOTALCD - (Utils.TimeStamp - CD.START_TIMESTAMP) + 1}s");
+ }
+
return str.ToString();
}
public override string GetProgressText(byte playerId, bool comms)
{
- if (Utils.GetPlayerById(playerId) == null || !GameStates.IsInTask || Utils.GetPlayerById(playerId).IsModClient()) return string.Empty;
+ if (Utils.GetPlayerById(playerId) == null || !GameStates.IsInTask || !PlayerControl.LocalPlayer.IsAlive() || Utils.GetPlayerById(playerId).IsModClient()) return string.Empty;
var str = new StringBuilder();
switch (PotionID)
{
diff --git a/Roles/Crewmate/Analyzer.cs b/Roles/Crewmate/Analyzer.cs
index a4806dfa0..a2877c003 100644
--- a/Roles/Crewmate/Analyzer.cs
+++ b/Roles/Crewmate/Analyzer.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using UnityEngine;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Benefactor.cs b/Roles/Crewmate/Benefactor.cs
index 6858d56c6..f82607921 100644
--- a/Roles/Crewmate/Benefactor.cs
+++ b/Roles/Crewmate/Benefactor.cs
@@ -1,7 +1,7 @@
-using System;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using static TOHE.Translator;
@@ -62,6 +62,7 @@ namespace TOHE.Roles.Crewmate
if (!isShield) writer.Write(TaskMarkPerRound[benefactorId]);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte benefactorID = reader.ReadByte();
@@ -86,15 +87,18 @@ namespace TOHE.Roles.Crewmate
{
if (taskIndex.ContainsKey(benefactorID)) taskIndex[benefactorID].Remove(taskInd);
}
+
if (clearAll && taskIndex.ContainsKey(benefactorID)) taskIndex[benefactorID].Clear();
if (IsShield)
{
shieldedPlayers.TryAdd(shieldedId, Utils.TimeStamp);
}
+
if (shieldExpire)
{
shieldedPlayers.Remove(shieldedId);
}
+
if (clearAll && shieldedPlayers.Count > 0) shieldedPlayers.Clear();
}
@@ -143,6 +147,7 @@ namespace TOHE.Roles.Crewmate
Logger.Info($"Max task per round ({TaskMarkPerRound[playerId]}) reached for {player.GetNameWithRole()}", "Benefactor");
return;
}
+
TaskMarkPerRound[playerId]++;
if (!taskIndex.ContainsKey(playerId)) taskIndex[playerId] = [];
taskIndex[playerId].Add(task.Index);
@@ -167,4 +172,4 @@ namespace TOHE.Roles.Crewmate
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Crewmate/Bloodhound.cs b/Roles/Crewmate/Bloodhound.cs
index 0f73b660d..1a9101120 100644
--- a/Roles/Crewmate/Bloodhound.cs
+++ b/Roles/Crewmate/Bloodhound.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Crewmate/CameraMan.cs b/Roles/Crewmate/CameraMan.cs
index f664daeea..b3214a068 100644
--- a/Roles/Crewmate/CameraMan.cs
+++ b/Roles/Crewmate/CameraMan.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using UnityEngine;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/CandleLighter.cs b/Roles/Crewmate/CandleLighter.cs
index d20499a90..10cf6fcaf 100644
--- a/Roles/Crewmate/CandleLighter.cs
+++ b/Roles/Crewmate/CandleLighter.cs
@@ -1,6 +1,6 @@
-using System;
+using AmongUs.GameOptions;
+using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using UnityEngine;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/Cleanser.cs b/Roles/Crewmate/Cleanser.cs
index 172caf2b5..c2825384a 100644
--- a/Roles/Crewmate/Cleanser.cs
+++ b/Roles/Crewmate/Cleanser.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/CopyCat.cs b/Roles/Crewmate/CopyCat.cs
index 09e4f98a8..ee1d4bd26 100644
--- a/Roles/Crewmate/CopyCat.cs
+++ b/Roles/Crewmate/CopyCat.cs
@@ -50,11 +50,6 @@ public class CopyCat : RoleBase
public override bool IsEnable => playerIdList.Count > 0;
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Utils.GetPlayerById(id).IsAlive() ? CurrentKillCooldown : 0f;
- public override bool CanUseKillButton(PlayerControl pc)
- {
- return pc.IsAlive();
- }
-
public static void ResetRole()
{
foreach (var player in playerIdList)
diff --git a/Roles/Crewmate/CrewmateVanillaRoles.cs b/Roles/Crewmate/CrewmateVanillaRoles.cs
new file mode 100644
index 000000000..e554f9c33
--- /dev/null
+++ b/Roles/Crewmate/CrewmateVanillaRoles.cs
@@ -0,0 +1,20 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Crewmate
+{
+ internal static class CrewmateVanillaRoles
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(5050, TabGroup.CrewmateRoles, CustomRoles.CrewmateTOHE);
+ SetupRoleOptions(5000, TabGroup.CrewmateRoles, CustomRoles.EngineerTOHE);
+ SetupRoleOptions(5100, TabGroup.CrewmateRoles, CustomRoles.ScientistTOHE);
+ ScientistCD = FloatOptionItem.Create(5110, "VitalsCooldown", new(1f, 250f, 1f), 3f, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.ScientistTOHE])
+ .SetValueFormat(OptionFormat.Seconds);
+ ScientistDur = FloatOptionItem.Create(5111, "VitalsDuration", new(1f, 250f, 1f), 15f, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.ScientistTOHE])
+ .SetValueFormat(OptionFormat.Seconds);
+ }
+ }
+}
diff --git a/Roles/Crewmate/Crusader.cs b/Roles/Crewmate/Crusader.cs
index 80a8de680..1557a7a5a 100644
--- a/Roles/Crewmate/Crusader.cs
+++ b/Roles/Crewmate/Crusader.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
namespace TOHE.Roles.Crewmate;
diff --git a/Roles/Crewmate/CyberStar.cs b/Roles/Crewmate/CyberStar.cs
new file mode 100644
index 000000000..e0852375e
--- /dev/null
+++ b/Roles/Crewmate/CyberStar.cs
@@ -0,0 +1,20 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Crewmate
+{
+ internal static class CyberStar
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(5300, TabGroup.CrewmateRoles, CustomRoles.CyberStar);
+ ImpKnowCyberStarDead = BooleanOptionItem.Create(5400, "ImpKnowCyberStarDead", false, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.CyberStar]);
+ NeutralKnowCyberStarDead = BooleanOptionItem.Create(5500, "NeutralKnowCyberStarDead", false, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.CyberStar]);
+ }
+
+ public static void OnDeath(PlayerControl seer)
+ {
+ }
+ }
+}
diff --git a/Roles/Crewmate/Demolitionist.cs b/Roles/Crewmate/Demolitionist.cs
new file mode 100644
index 000000000..4571944ca
--- /dev/null
+++ b/Roles/Crewmate/Demolitionist.cs
@@ -0,0 +1,41 @@
+using TOHE.Modules;
+using static TOHE.Options;
+
+namespace TOHE.Roles.Crewmate
+{
+ internal static class Demolitionist
+ {
+ public static void SetupCustomOption()
+ {
+ SetupSingleRoleOptions(5550, TabGroup.CrewmateRoles, CustomRoles.Demolitionist, 1);
+ DemolitionistVentTime = FloatOptionItem.Create(5552, "DemolitionistVentTime", new(0f, 90f, 1f), 5f, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Demolitionist])
+ .SetValueFormat(OptionFormat.Seconds);
+ DemolitionistKillerDiesOnMeetingCall = BooleanOptionItem.Create(5553, "DemolitionistKillerDiesOnMeetingCall", false, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Demolitionist]);
+ }
+
+ public static void OnDeath(PlayerControl killer, PlayerControl target)
+ {
+ killer.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Demolitionist), Translator.GetString("OnDemolitionistDead")));
+ killer.KillFlash();
+ _ = new LateTask(() =>
+ {
+ if (!killer.inVent && (killer.PlayerId != target.PlayerId))
+ {
+ if ((DemolitionistKillerDiesOnMeetingCall.GetBool() || GameStates.IsInTask) && killer.IsAlive())
+ {
+ killer.Suicide(PlayerState.DeathReason.Demolished, target);
+ RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
+ }
+ }
+ else
+ {
+ if (killer.IsModClient()) RPC.PlaySoundRPC(killer.PlayerId, Sounds.TaskComplete);
+ else killer.RpcGuardAndKill(killer);
+ killer.SetKillCooldown(Main.AllPlayerKillCooldown[killer.PlayerId] - (DemolitionistVentTime.GetFloat() + 0.5f));
+ }
+ }, DemolitionistVentTime.GetFloat() + 0.5f);
+ }
+ }
+}
diff --git a/Roles/Crewmate/Deputy.cs b/Roles/Crewmate/Deputy.cs
index c2f55f886..ad9765a51 100644
--- a/Roles/Crewmate/Deputy.cs
+++ b/Roles/Crewmate/Deputy.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Detective.cs b/Roles/Crewmate/Detective.cs
index 2a31ff19d..fd8a4b446 100644
--- a/Roles/Crewmate/Detective.cs
+++ b/Roles/Crewmate/Detective.cs
@@ -2,6 +2,13 @@
{
internal static class Detective
{
+ public static void SetupCustomOption()
+ {
+ Options.SetupRoleOptions(6600, TabGroup.CrewmateRoles, CustomRoles.Detective);
+ Options.DetectiveCanknowKiller = BooleanOptionItem.Create(6610, "DetectiveCanknowKiller", true, TabGroup.CrewmateRoles, false)
+ .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Detective]);
+ }
+
public static void OnReportDeadBody(PlayerControl player, PlayerControl tpc)
{
string msg = string.Format(Translator.GetString("DetectiveNoticeVictim"), tpc.GetRealName(), tpc.GetDisplayRoleName());
diff --git a/Roles/Crewmate/DonutDelivery.cs b/Roles/Crewmate/DonutDelivery.cs
index 08cb9d1e6..b3f8fbd49 100644
--- a/Roles/Crewmate/DonutDelivery.cs
+++ b/Roles/Crewmate/DonutDelivery.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Doormaster.cs b/Roles/Crewmate/Doormaster.cs
index 2c701b555..5ed35a9b4 100644
--- a/Roles/Crewmate/Doormaster.cs
+++ b/Roles/Crewmate/Doormaster.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/DovesOfNeace.cs b/Roles/Crewmate/DovesOfNeace.cs
index 1a9f853d7..ccab7e9cd 100644
--- a/Roles/Crewmate/DovesOfNeace.cs
+++ b/Roles/Crewmate/DovesOfNeace.cs
@@ -1,9 +1,8 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Impostor;
-using static TOHE.Options;
namespace TOHE.Roles.Crewmate
{
@@ -12,27 +11,10 @@ namespace TOHE.Roles.Crewmate
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(7700, TabGroup.CrewmateRoles, CustomRoles.DovesOfNeace);
- DovesOfNeaceCooldown = FloatOptionItem.Create(7710, "DovesOfNeaceCooldown", new(0f, 180f, 1f), 7f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.DovesOfNeace])
- .SetValueFormat(OptionFormat.Seconds);
- DovesOfNeaceMaxOfUseage = IntegerOptionItem.Create(7711, "DovesOfNeaceMaxOfUseage", new(0, 180, 1), 0, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.DovesOfNeace])
- .SetValueFormat(OptionFormat.Times);
- DovesOfNeaceAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(7712, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.DovesOfNeace])
- .SetValueFormat(OptionFormat.Times);
- DovesOfNeaceAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(7713, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.DovesOfNeace])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void Add(byte playerId)
{
On = true;
- playerId.SetAbilityUseLimit(DovesOfNeaceMaxOfUseage.GetInt());
+ playerId.SetAbilityUseLimit(Options.DovesOfNeaceMaxOfUseage.GetInt());
}
public override void Init()
@@ -42,14 +24,14 @@ namespace TOHE.Roles.Crewmate
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
- AURoleOptions.EngineerCooldown = DovesOfNeaceCooldown.GetFloat();
+ if (Options.UsePets.GetBool()) return;
+ AURoleOptions.EngineerCooldown = Options.DovesOfNeaceCooldown.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 1f;
}
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("DovesOfNeaceVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("DovesOfNeaceVentButtonText");
diff --git a/Roles/Crewmate/Drainer.cs b/Roles/Crewmate/Drainer.cs
index 476cd425e..a98a7a950 100644
--- a/Roles/Crewmate/Drainer.cs
+++ b/Roles/Crewmate/Drainer.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
+using System.Collections.Generic;
+using System.Linq;
using static TOHE.Options;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/Druid.cs b/Roles/Crewmate/Druid.cs
index 2b62e654e..1d7c79283 100644
--- a/Roles/Crewmate/Druid.cs
+++ b/Roles/Crewmate/Druid.cs
@@ -1,8 +1,8 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/Escort.cs b/Roles/Crewmate/Escort.cs
index 34edd6f67..eeba511df 100644
--- a/Roles/Crewmate/Escort.cs
+++ b/Roles/Crewmate/Escort.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Roles.Neutral;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Farseer.cs b/Roles/Crewmate/Farseer.cs
index 690471c16..b3b617f0d 100644
--- a/Roles/Crewmate/Farseer.cs
+++ b/Roles/Crewmate/Farseer.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Modules;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
@@ -76,11 +76,6 @@ namespace TOHE.Roles.Crewmate
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = FarseerCooldown.GetFloat();
- public override bool CanUseKillButton(PlayerControl pc)
- {
- return pc.IsAlive();
- }
-
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
killer.SetKillCooldown(FarseerRevealTime.GetFloat());
diff --git a/Roles/Crewmate/Gaulois.cs b/Roles/Crewmate/Gaulois.cs
index b1264dd3e..ee937a54d 100644
--- a/Roles/Crewmate/Gaulois.cs
+++ b/Roles/Crewmate/Gaulois.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Crewmate
@@ -10,7 +10,7 @@ namespace TOHE.Roles.Crewmate
private static List playerIdList = [];
private static OptionItem CD;
- public static OptionItem AdditionalSpeed;
+ private static OptionItem AdditionalSpeed;
private static OptionItem UseLimitOpt;
public static OptionItem UsePet;
@@ -68,8 +68,6 @@ namespace TOHE.Roles.Crewmate
killer.RpcRemoveAbilityUse();
killer.SetKillCooldown();
- target.MarkDirtySettings();
-
return false;
}
}
diff --git a/Roles/Crewmate/Grenadier.cs b/Roles/Crewmate/Grenadier.cs
index 902c2e016..5561ce989 100644
--- a/Roles/Crewmate/Grenadier.cs
+++ b/Roles/Crewmate/Grenadier.cs
@@ -1,10 +1,9 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using HarmonyLib;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using HarmonyLib;
using TOHE.Modules;
-using static TOHE.Options;
namespace TOHE.Roles.Crewmate
{
@@ -16,35 +15,10 @@ namespace TOHE.Roles.Crewmate
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(6800, TabGroup.CrewmateRoles, CustomRoles.Grenadier);
- GrenadierSkillCooldown = FloatOptionItem.Create(6810, "GrenadierSkillCooldown", new(0f, 180f, 1f), 25f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Seconds);
- GrenadierSkillDuration = FloatOptionItem.Create(6811, "GrenadierSkillDuration", new(0f, 180f, 1f), 10f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Seconds);
- GrenadierCauseVision = FloatOptionItem.Create(6812, "GrenadierCauseVision", new(0f, 5f, 0.05f), 0.3f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Multiplier);
- GrenadierCanAffectNeutral = BooleanOptionItem.Create(6813, "GrenadierCanAffectNeutral", false, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier]);
- GrenadierSkillMaxOfUseage = IntegerOptionItem.Create(6814, "GrenadierSkillMaxOfUseage", new(0, 180, 1), 2, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Times);
- GrenadierAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(6815, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.5f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Times);
- GrenadierAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(6816, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Grenadier])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void Add(byte playerId)
{
On = true;
- playerId.SetAbilityUseLimit(GrenadierSkillMaxOfUseage.GetInt());
+ playerId.SetAbilityUseLimit(Options.GrenadierSkillMaxOfUseage.GetInt());
}
public override void Init()
@@ -54,8 +28,8 @@ namespace TOHE.Roles.Crewmate
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
- AURoleOptions.EngineerCooldown = GrenadierSkillCooldown.GetFloat();
+ if (Options.UsePets.GetBool()) return;
+ AURoleOptions.EngineerCooldown = Options.GrenadierSkillCooldown.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 1;
}
@@ -71,7 +45,7 @@ namespace TOHE.Roles.Crewmate
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("GrenadierVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("GrenadierVentButtonText");
@@ -94,7 +68,7 @@ namespace TOHE.Roles.Crewmate
var playerId = player.PlayerId;
var now = Utils.TimeStamp;
- if (GrenadierBlinding.TryGetValue(playerId, out var gtime) && gtime + GrenadierSkillDuration.GetInt() < now)
+ if (GrenadierBlinding.TryGetValue(playerId, out var gtime) && gtime + Options.GrenadierSkillDuration.GetInt() < now)
{
GrenadierBlinding.Remove(playerId);
player.RpcResetAbilityCooldown();
@@ -102,7 +76,7 @@ namespace TOHE.Roles.Crewmate
Utils.MarkEveryoneDirtySettingsV3();
}
- if (MadGrenadierBlinding.TryGetValue(playerId, out var mgtime) && mgtime + GrenadierSkillDuration.GetInt() < now)
+ if (MadGrenadierBlinding.TryGetValue(playerId, out var mgtime) && mgtime + Options.GrenadierSkillDuration.GetInt() < now)
{
MadGrenadierBlinding.Remove(playerId);
player.RpcResetAbilityCooldown();
@@ -126,11 +100,11 @@ namespace TOHE.Roles.Crewmate
{
GrenadierBlinding.Remove(pc.PlayerId);
GrenadierBlinding.Add(pc.PlayerId, Utils.TimeStamp);
- Main.AllPlayerControls.Where(x => x.IsModClient()).Where(x => x.GetCustomRole().IsImpostor() || (x.GetCustomRole().IsNeutral() && GrenadierCanAffectNeutral.GetBool())).Do(x => x.RPCPlayCustomSound("FlashBang"));
+ Main.AllPlayerControls.Where(x => x.IsModClient()).Where(x => x.GetCustomRole().IsImpostor() || (x.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool())).Do(x => x.RPCPlayCustomSound("FlashBang"));
}
pc.RPCPlayCustomSound("FlashBang");
- pc.Notify(Translator.GetString("GrenadierSkillInUse"), GrenadierSkillDuration.GetFloat());
+ pc.Notify(Translator.GetString("GrenadierSkillInUse"), Options.GrenadierSkillDuration.GetFloat());
pc.RpcRemoveAbilityUse();
Utils.MarkEveryoneDirtySettingsV3();
}
diff --git a/Roles/Crewmate/Jailer.cs b/Roles/Crewmate/Jailer.cs
index 91f0bfe15..f85e8dcaf 100644
--- a/Roles/Crewmate/Jailer.cs
+++ b/Roles/Crewmate/Jailer.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Judge.cs b/Roles/Crewmate/Judge.cs
index aa4e41cb6..86b4be15e 100644
--- a/Roles/Crewmate/Judge.cs
+++ b/Roles/Crewmate/Judge.cs
@@ -1,9 +1,9 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Lighter.cs b/Roles/Crewmate/Lighter.cs
index 4025b6e66..ad046a7f2 100644
--- a/Roles/Crewmate/Lighter.cs
+++ b/Roles/Crewmate/Lighter.cs
@@ -1,6 +1,5 @@
-using System.Text;
-using AmongUs.GameOptions;
-using static TOHE.Options;
+using AmongUs.GameOptions;
+using System.Text;
namespace TOHE.Roles.Crewmate
{
@@ -12,36 +11,10 @@ namespace TOHE.Roles.Crewmate
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupSingleRoleOptions(6850, TabGroup.CrewmateRoles, CustomRoles.Lighter, 1);
- LighterSkillCooldown = FloatOptionItem.Create(6852, "LighterSkillCooldown", new(0f, 180f, 1f), 25f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Seconds);
- LighterSkillDuration = FloatOptionItem.Create(6853, "LighterSkillDuration", new(0f, 180f, 1f), 10f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Seconds);
- LighterVisionNormal = FloatOptionItem.Create(6854, "LighterVisionNormal", new(0f, 5f, 0.05f), 0.9f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Multiplier);
- LighterVisionOnLightsOut = FloatOptionItem.Create(6855, "LighterVisionOnLightsOut", new(0f, 5f, 0.05f), 0.35f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Multiplier);
- LighterSkillMaxOfUseage = IntegerOptionItem.Create(6856, "AbilityUseLimit", new(0, 180, 1), 2, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Times);
- LighterAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(6857, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 1.5f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Times);
- LighterAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(6858, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Lighter])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void Add(byte playerId)
{
On = true;
- playerId.SetAbilityUseLimit(LighterSkillMaxOfUseage.GetInt());
+ playerId.SetAbilityUseLimit(Options.LighterSkillMaxOfUseage.GetInt());
IsAbilityActive = false;
ActivateTimeStamp = 0;
}
@@ -55,17 +28,17 @@ namespace TOHE.Roles.Crewmate
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (!UsePets.GetBool())
+ if (!Options.UsePets.GetBool())
{
AURoleOptions.EngineerInVentMaxTime = 1;
- AURoleOptions.EngineerCooldown = LighterSkillCooldown.GetFloat();
+ AURoleOptions.EngineerCooldown = Options.LighterSkillCooldown.GetFloat();
}
if (IsAbilityActive)
{
opt.SetVision(false);
- if (Utils.IsActive(SystemTypes.Electrical)) opt.SetFloat(FloatOptionNames.CrewLightMod, LighterVisionOnLightsOut.GetFloat() * 5);
- else opt.SetFloat(FloatOptionNames.CrewLightMod, LighterVisionNormal.GetFloat());
+ if (Utils.IsActive(SystemTypes.Electrical)) opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionOnLightsOut.GetFloat() * 5);
+ else opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionNormal.GetFloat());
}
}
@@ -81,7 +54,7 @@ namespace TOHE.Roles.Crewmate
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("LighterVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("LighterVentButtonText");
@@ -105,7 +78,7 @@ namespace TOHE.Roles.Crewmate
IsAbilityActive = true;
ActivateTimeStamp = Utils.TimeStamp;
- pc.Notify(Translator.GetString("LighterSkillInUse"), LighterSkillDuration.GetFloat());
+ pc.Notify(Translator.GetString("LighterSkillInUse"), Options.LighterSkillDuration.GetFloat());
pc.RpcRemoveAbilityUse();
pc.MarkDirtySettings();
}
@@ -126,7 +99,7 @@ namespace TOHE.Roles.Crewmate
{
if (!GameStates.IsInTask) return;
- if (IsAbilityActive && ActivateTimeStamp + LighterSkillDuration.GetInt() < Utils.TimeStamp)
+ if (IsAbilityActive && ActivateTimeStamp + Options.LighterSkillDuration.GetInt() < Utils.TimeStamp)
{
IsAbilityActive = false;
player.RpcResetAbilityCooldown();
diff --git a/Roles/Crewmate/Medic.cs b/Roles/Crewmate/Medic.cs
index 53e3271e5..a92567af3 100644
--- a/Roles/Crewmate/Medic.cs
+++ b/Roles/Crewmate/Medic.cs
@@ -1,8 +1,8 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate;
@@ -101,6 +101,7 @@ public class Medic : RoleBase
writer.Write(x);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPCForProtectList(MessageReader reader)
{
int count = reader.ReadInt32();
@@ -183,6 +184,7 @@ public class Medic : RoleBase
return true;
}
+
public static void OnCheckMark()
{
if (!ShieldDeactivatesWhenMedicDies.GetBool()) return;
@@ -199,6 +201,7 @@ public class Medic : RoleBase
}
}
}
+
public static void IsDead(PlayerControl target)
{
if (!target.Is(CustomRoles.Medic)) return;
@@ -210,6 +213,7 @@ public class Medic : RoleBase
{
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(pc), SpecifyTarget: target);
}
+
Utils.NotifyRoles(SpecifySeer: target);
ProtectList.Clear();
diff --git a/Roles/Crewmate/Mole.cs b/Roles/Crewmate/Mole.cs
index da416efc2..9138ad607 100644
--- a/Roles/Crewmate/Mole.cs
+++ b/Roles/Crewmate/Mole.cs
@@ -1,5 +1,4 @@
using AmongUs.GameOptions;
-using UnityEngine;
using static TOHE.Options;
namespace TOHE.Roles.Crewmate
@@ -33,4 +32,4 @@ namespace TOHE.Roles.Crewmate
_ = new LateTask(() => { pc.TPtoRndVent(); }, 0.5f, "Mole TP");
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Crewmate/Monarch.cs b/Roles/Crewmate/Monarch.cs
index 61eae9a7f..fd6b16455 100644
--- a/Roles/Crewmate/Monarch.cs
+++ b/Roles/Crewmate/Monarch.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/Mortician.cs b/Roles/Crewmate/Mortician.cs
index ba051efc7..db185e805 100644
--- a/Roles/Crewmate/Mortician.cs
+++ b/Roles/Crewmate/Mortician.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/NiceGuesser.cs b/Roles/Crewmate/NiceGuesser.cs
new file mode 100644
index 000000000..3ce9bdb00
--- /dev/null
+++ b/Roles/Crewmate/NiceGuesser.cs
@@ -0,0 +1,23 @@
+using UnityEngine;
+using static TOHE.Options;
+
+namespace TOHE.Roles.Crewmate
+{
+ internal static class NiceGuesser
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(8600, TabGroup.CrewmateRoles, CustomRoles.NiceGuesser);
+ GGCanGuessTime = IntegerOptionItem.Create(8610, "GuesserCanGuessTimes", new(0, 15, 1), 15, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser])
+ .SetValueFormat(OptionFormat.Times);
+ GGCanGuessCrew = BooleanOptionItem.Create(8611, "GGCanGuessCrew", true, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser]);
+ GGCanGuessAdt = BooleanOptionItem.Create(8612, "GGCanGuessAdt", false, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser]);
+ GGTryHideMsg = BooleanOptionItem.Create(8613, "GuesserTryHideMsg", true, TabGroup.CrewmateRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.NiceGuesser])
+ .SetColor(Color.green);
+ }
+ }
+}
diff --git a/Roles/Crewmate/NiceHacker.cs b/Roles/Crewmate/NiceHacker.cs
index 17761cd20..c18f008d3 100644
--- a/Roles/Crewmate/NiceHacker.cs
+++ b/Roles/Crewmate/NiceHacker.cs
@@ -1,8 +1,8 @@
-using System;
+using AmongUs.GameOptions;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Crewmate/NiceSwapper.cs b/Roles/Crewmate/NiceSwapper.cs
index 12ecc3f33..ad603a67c 100644
--- a/Roles/Crewmate/NiceSwapper.cs
+++ b/Roles/Crewmate/NiceSwapper.cs
@@ -1,8 +1,8 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Linq;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Roles/Crewmate/ParityCop.cs b/Roles/Crewmate/ParityCop.cs
index ec8f69d19..c2d69da80 100644
--- a/Roles/Crewmate/ParityCop.cs
+++ b/Roles/Crewmate/ParityCop.cs
@@ -1,7 +1,7 @@
+using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/Perceiver.cs b/Roles/Crewmate/Perceiver.cs
index 37d8ab573..e5906cf9a 100644
--- a/Roles/Crewmate/Perceiver.cs
+++ b/Roles/Crewmate/Perceiver.cs
@@ -1,5 +1,5 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Linq;
using UnityEngine;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/Psychic.cs b/Roles/Crewmate/Psychic.cs
index 19999defd..81ab4336b 100644
--- a/Roles/Crewmate/Psychic.cs
+++ b/Roles/Crewmate/Psychic.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Crewmate/Rabbit.cs b/Roles/Crewmate/Rabbit.cs
index 196a07b9d..8f5b87e07 100644
--- a/Roles/Crewmate/Rabbit.cs
+++ b/Roles/Crewmate/Rabbit.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate
@@ -19,10 +19,9 @@ namespace TOHE.Roles.Crewmate
if (!Player.IsAlive() || (MyTaskState.CompletedTasksCount < TaskTrigger && !MyTaskState.IsTaskFinished)) return;
var Impostors = Main.AllAlivePlayerControls.Where(pc => pc.Is(CustomRoleTypes.Impostor)).ToArray();
- if (Impostors.Length == 0) return;
var target = Impostors[IRandom.Instance.Next(Impostors.Length)];
- LocateArrow.Add(Player.PlayerId, target.Pos());
+ TargetArrow.Add(Player.PlayerId, target.PlayerId, update: false);
Arrow = (true, target.PlayerId);
SendRPC();
Utils.NotifyRoles(SpecifySeer: Player, SpecifyTarget: Player);
@@ -30,7 +29,7 @@ namespace TOHE.Roles.Crewmate
_ = new LateTask(() =>
{
- LocateArrow.Remove(Player.PlayerId, target.Pos());
+ TargetArrow.Remove(Player.PlayerId, target.PlayerId);
Arrow = (false, byte.MaxValue);
SendRPC();
Utils.NotifyRoles(SpecifySeer: Player, SpecifyTarget: Player);
@@ -54,7 +53,7 @@ namespace TOHE.Roles.Crewmate
public string Suffix => !GameStates.IsInTask || !Arrow.HasArrow
? string.Empty
- : Utils.ColorString(Utils.GetRoleColor(CustomRoles.Rabbit), LocateArrow.GetArrows(Player));
+ : Utils.ColorString(Utils.GetRoleColor(CustomRoles.Rabbit), TargetArrow.GetArrows(Player, Arrow.Target));
}
private static int Id => 643330;
diff --git a/Roles/Crewmate/Randomizer.cs b/Roles/Crewmate/Randomizer.cs
index 03229772a..e5350e314 100644
--- a/Roles/Crewmate/Randomizer.cs
+++ b/Roles/Crewmate/Randomizer.cs
@@ -1,7 +1,7 @@
-using System;
+using HarmonyLib;
+using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
using TOHE.Modules;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
diff --git a/Roles/Crewmate/Ricochet.cs b/Roles/Crewmate/Ricochet.cs
index e799cfdeb..c6cdbe9cf 100644
--- a/Roles/Crewmate/Ricochet.cs
+++ b/Roles/Crewmate/Ricochet.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate
@@ -58,6 +58,7 @@ namespace TOHE.Roles.Crewmate
writer.Write(targetId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPCSyncTarget(MessageReader reader)
{
byte id = reader.ReadByte();
@@ -79,6 +80,7 @@ namespace TOHE.Roles.Crewmate
return true;
}
+
public static bool OnVote(PlayerControl pc, PlayerControl target)
{
if (target == null || pc == null || pc.PlayerId == target.PlayerId || Main.PlayerStates[pc.PlayerId].Role is not Ricochet rc || Main.DontCancelVoteList.Contains(pc.PlayerId)) return false;
@@ -91,6 +93,7 @@ namespace TOHE.Roles.Crewmate
Main.DontCancelVoteList.Add(pc.PlayerId);
return true;
}
+
return false;
}
diff --git a/Roles/Crewmate/SabotageMaster.cs b/Roles/Crewmate/SabotageMaster.cs
index fc36c5c85..76fbb04f9 100644
--- a/Roles/Crewmate/SabotageMaster.cs
+++ b/Roles/Crewmate/SabotageMaster.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate;
diff --git a/Roles/Crewmate/SecurityGuard.cs b/Roles/Crewmate/SecurityGuard.cs
index 3b7f27c02..8dbaad597 100644
--- a/Roles/Crewmate/SecurityGuard.cs
+++ b/Roles/Crewmate/SecurityGuard.cs
@@ -1,6 +1,5 @@
-using System.Text;
-using AmongUs.GameOptions;
-using static TOHE.Options;
+using AmongUs.GameOptions;
+using System.Text;
namespace TOHE.Roles.Crewmate
{
@@ -9,30 +8,10 @@ namespace TOHE.Roles.Crewmate
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(6860, TabGroup.CrewmateRoles, CustomRoles.SecurityGuard);
- SecurityGuardSkillCooldown = FloatOptionItem.Create(6862, "SecurityGuardSkillCooldown", new(0f, 180f, 1f), 15f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.SecurityGuard])
- .SetValueFormat(OptionFormat.Seconds);
- SecurityGuardSkillDuration = FloatOptionItem.Create(6863, "SecurityGuardSkillDuration", new(0f, 180f, 1f), 10f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.SecurityGuard])
- .SetValueFormat(OptionFormat.Seconds);
- SecurityGuardSkillMaxOfUseage = IntegerOptionItem.Create(6866, "AbilityUseLimit", new(0, 180, 1), 1, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.SecurityGuard])
- .SetValueFormat(OptionFormat.Times);
- SecurityGuardAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(6867, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.4f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.SecurityGuard])
- .SetValueFormat(OptionFormat.Times);
- SecurityGuardAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(6868, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.SecurityGuard])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void Add(byte playerId)
{
On = true;
- playerId.SetAbilityUseLimit(SecurityGuardSkillMaxOfUseage.GetInt());
+ playerId.SetAbilityUseLimit(Options.SecurityGuardSkillMaxOfUseage.GetInt());
}
public override void Init()
@@ -42,9 +21,9 @@ namespace TOHE.Roles.Crewmate
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
+ if (Options.UsePets.GetBool()) return;
AURoleOptions.EngineerInVentMaxTime = 1;
- AURoleOptions.EngineerCooldown = SecurityGuardSkillCooldown.GetFloat();
+ AURoleOptions.EngineerCooldown = Options.SecurityGuardSkillCooldown.GetFloat();
}
public override string GetProgressText(byte playerId, bool comms)
@@ -59,7 +38,7 @@ namespace TOHE.Roles.Crewmate
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("SecurityGuardVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("SecurityGuardVentButtonText");
@@ -77,7 +56,7 @@ namespace TOHE.Roles.Crewmate
{
Main.BlockSabo.Remove(pc.PlayerId);
Main.BlockSabo.Add(pc.PlayerId, Utils.TimeStamp);
- pc.Notify(Translator.GetString("SecurityGuardSkillInUse"), SecurityGuardSkillDuration.GetFloat());
+ pc.Notify(Translator.GetString("SecurityGuardSkillInUse"), Options.SecurityGuardSkillDuration.GetFloat());
pc.RpcRemoveAbilityUse();
}
else
@@ -90,7 +69,7 @@ namespace TOHE.Roles.Crewmate
public override void OnFixedUpdate(PlayerControl player)
{
var playerId = player.PlayerId;
- if (Main.BlockSabo.TryGetValue(playerId, out var stime) && stime + SecurityGuardSkillDuration.GetInt() < Utils.TimeStamp)
+ if (Main.BlockSabo.TryGetValue(playerId, out var stime) && stime + Options.SecurityGuardSkillDuration.GetInt() < Utils.TimeStamp)
{
Main.BlockSabo.Remove(playerId);
player.RpcResetAbilityCooldown();
@@ -98,4 +77,4 @@ namespace TOHE.Roles.Crewmate
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Crewmate/Sentinel.cs b/Roles/Crewmate/Sentinel.cs
index 1e94618d3..90f1e3ed5 100644
--- a/Roles/Crewmate/Sentinel.cs
+++ b/Roles/Crewmate/Sentinel.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using UnityEngine;
using static TOHE.Options;
using static TOHE.Translator;
@@ -10,13 +10,47 @@ namespace TOHE.Roles.Crewmate
{
public class PatrollingState(byte sentinelId, int patrolDuration, float patrolRadius, PlayerControl sentinel = null, bool isPatrolling = false, Vector2? startingPosition = null, long patrolStartTimeStamp = 0)
{
- public byte SentinelId { get => sentinelId; set => sentinelId = value; }
- public PlayerControl Sentinel { get => sentinel; set => sentinel = value; }
- public bool IsPatrolling { get => isPatrolling; set => isPatrolling = value; }
- public Vector2 StartingPosition { get => startingPosition ?? Vector2.zero; set => startingPosition = value; }
- public long PatrolStartTimeStamp { get => patrolStartTimeStamp; set => patrolStartTimeStamp = value; }
- public int PatrolDuration { get => patrolDuration; set => patrolDuration = value; }
- public float PatrolRadius { get => patrolRadius; set => patrolRadius = value; }
+ public byte SentinelId
+ {
+ get => sentinelId;
+ set => sentinelId = value;
+ }
+
+ public PlayerControl Sentinel
+ {
+ get => sentinel;
+ set => sentinel = value;
+ }
+
+ public bool IsPatrolling
+ {
+ get => isPatrolling;
+ set => isPatrolling = value;
+ }
+
+ public Vector2 StartingPosition
+ {
+ get => startingPosition ?? Vector2.zero;
+ set => startingPosition = value;
+ }
+
+ public long PatrolStartTimeStamp
+ {
+ get => patrolStartTimeStamp;
+ set => patrolStartTimeStamp = value;
+ }
+
+ public int PatrolDuration
+ {
+ get => patrolDuration;
+ set => patrolDuration = value;
+ }
+
+ public float PatrolRadius
+ {
+ get => patrolRadius;
+ set => patrolRadius = value;
+ }
public PlayerControl[] NearbyKillers => GetPlayersInRadius(PatrolRadius, StartingPosition).Where(x => !x.Is(Team.Crewmate) && SentinelId != x.PlayerId).ToArray();
private readonly List LastNearbyKillers = [];
@@ -66,6 +100,7 @@ namespace TOHE.Roles.Crewmate
pc.Notify(GetString("KillerEscapedFromSentinel"));
LastNearbyKillers.Remove(pc.PlayerId);
}
+
if (nowInRange)
{
pc.Notify(string.Format(GetString("KillerNotifyPatrol"), PatrolDuration - (TimeStamp - PatrolStartTimeStamp)));
@@ -81,6 +116,7 @@ namespace TOHE.Roles.Crewmate
{
pc.Suicide(realKiller: Sentinel);
}
+
Sentinel.MarkDirtySettings();
}
}
@@ -141,6 +177,7 @@ namespace TOHE.Roles.Crewmate
return false;
}
}
+
return true;
}
@@ -183,4 +220,4 @@ namespace TOHE.Roles.Crewmate
}, 0.1f);
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Crewmate/Sheriff.cs b/Roles/Crewmate/Sheriff.cs
index 808d7f349..3c80d5e87 100644
--- a/Roles/Crewmate/Sheriff.cs
+++ b/Roles/Crewmate/Sheriff.cs
@@ -1,7 +1,7 @@
+using AmongUs.GameOptions;
using System;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
namespace TOHE.Roles.Crewmate;
diff --git a/Roles/Crewmate/Spy.cs b/Roles/Crewmate/Spy.cs
index d58a00adb..da57e9574 100644
--- a/Roles/Crewmate/Spy.cs
+++ b/Roles/Crewmate/Spy.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate
@@ -68,8 +68,10 @@ namespace TOHE.Roles.Crewmate
writer.Write(changeColor);
break;
}
+
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
int operate = reader.ReadInt32();
@@ -113,7 +115,10 @@ namespace TOHE.Roles.Crewmate
}
}
- if (change && GameStates.IsInTask) { NotifyRoles(SpecifySeer: pc); }
+ if (change && GameStates.IsInTask)
+ {
+ NotifyRoles(SpecifySeer: pc);
+ }
}
}
}
\ No newline at end of file
diff --git a/Roles/Crewmate/SwordsMan.cs b/Roles/Crewmate/SwordsMan.cs
index a38dd4d0c..bc78b05d5 100644
--- a/Roles/Crewmate/SwordsMan.cs
+++ b/Roles/Crewmate/SwordsMan.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Crewmate/Tether.cs b/Roles/Crewmate/Tether.cs
index f8c9800c0..6e1b4980b 100644
--- a/Roles/Crewmate/Tether.cs
+++ b/Roles/Crewmate/Tether.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Text;
using TOHE.Modules;
namespace TOHE.Roles.Crewmate
diff --git a/Roles/Crewmate/TimeMaster.cs b/Roles/Crewmate/TimeMaster.cs
index f3b4fca3f..6e0616042 100644
--- a/Roles/Crewmate/TimeMaster.cs
+++ b/Roles/Crewmate/TimeMaster.cs
@@ -1,6 +1,5 @@
-using System.Text;
-using AmongUs.GameOptions;
-using static TOHE.Options;
+using AmongUs.GameOptions;
+using System.Text;
namespace TOHE.Roles.Crewmate
{
@@ -9,31 +8,11 @@ namespace TOHE.Roles.Crewmate
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(8950, TabGroup.CrewmateRoles, CustomRoles.TimeMaster);
- TimeMasterSkillCooldown = FloatOptionItem.Create(8960, "TimeMasterSkillCooldown", new(0f, 180f, 1f), 20f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.TimeMaster])
- .SetValueFormat(OptionFormat.Seconds);
- TimeMasterSkillDuration = FloatOptionItem.Create(8961, "TimeMasterSkillDuration", new(0f, 180f, 1f), 10f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.TimeMaster])
- .SetValueFormat(OptionFormat.Seconds);
- TimeMasterMaxUses = IntegerOptionItem.Create(8962, "TimeMasterMaxUses", new(0, 180, 1), 1, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.TimeMaster])
- .SetValueFormat(OptionFormat.Times);
- TimeMasterAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(8963, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.4f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.TimeMaster])
- .SetValueFormat(OptionFormat.Times);
- TimeMasterAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(8964, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.TimeMaster])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void Add(byte playerId)
{
On = true;
Main.TimeMasterNum[playerId] = 0;
- playerId.SetAbilityUseLimit(TimeMasterMaxUses.GetInt());
+ playerId.SetAbilityUseLimit(Options.TimeMasterMaxUses.GetInt());
}
public override void Init()
@@ -43,8 +22,8 @@ namespace TOHE.Roles.Crewmate
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
- AURoleOptions.EngineerCooldown = TimeMasterSkillCooldown.GetFloat();
+ if (Options.UsePets.GetBool()) return;
+ AURoleOptions.EngineerCooldown = Options.TimeMasterSkillCooldown.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 1f;
}
@@ -60,7 +39,7 @@ namespace TOHE.Roles.Crewmate
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("TimeMasterVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("TimeMasterVentButtonText");
@@ -85,7 +64,7 @@ namespace TOHE.Roles.Crewmate
pc.RpcRemoveAbilityUse();
Main.TimeMasterInProtect.Remove(pc.PlayerId);
Main.TimeMasterInProtect.Add(pc.PlayerId, Utils.TimeStamp);
- pc.Notify(Translator.GetString("TimeMasterOnGuard"), TimeMasterSkillDuration.GetFloat());
+ pc.Notify(Translator.GetString("TimeMasterOnGuard"), Options.TimeMasterSkillDuration.GetFloat());
foreach (PlayerControl player in Main.AllPlayerControls)
{
if (Main.TimeMasterBackTrack.TryGetValue(player.PlayerId, out var position))
@@ -116,7 +95,7 @@ namespace TOHE.Roles.Crewmate
public override bool OnCheckMurderAsTarget(PlayerControl killer, PlayerControl target)
{
- if (killer.PlayerId != target.PlayerId && Main.TimeMasterInProtect.TryGetValue(target.PlayerId, out var ts) && ts + TimeMasterSkillDuration.GetInt() >= Utils.TimeStamp)
+ if (killer.PlayerId != target.PlayerId && Main.TimeMasterInProtect.TryGetValue(target.PlayerId, out var ts) && ts + Options.TimeMasterSkillDuration.GetInt() >= Utils.TimeStamp)
{
foreach (var player in Main.AllPlayerControls)
{
@@ -136,7 +115,7 @@ namespace TOHE.Roles.Crewmate
public override void OnFixedUpdate(PlayerControl player)
{
var playerId = player.PlayerId;
- if (Main.TimeMasterInProtect.TryGetValue(playerId, out var ttime) && ttime + TimeMasterSkillDuration.GetInt() < Utils.TimeStamp)
+ if (Main.TimeMasterInProtect.TryGetValue(playerId, out var ttime) && ttime + Options.TimeMasterSkillDuration.GetInt() < Utils.TimeStamp)
{
Main.TimeMasterInProtect.Remove(playerId);
player.RpcResetAbilityCooldown();
@@ -144,4 +123,4 @@ namespace TOHE.Roles.Crewmate
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Crewmate/Tornado.cs b/Roles/Crewmate/Tornado.cs
index 618842cce..a0fa3d282 100644
--- a/Roles/Crewmate/Tornado.cs
+++ b/Roles/Crewmate/Tornado.cs
@@ -1,7 +1,7 @@
-using System;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/Tracefinder.cs b/Roles/Crewmate/Tracefinder.cs
index 9afb29365..ade5bd67b 100644
--- a/Roles/Crewmate/Tracefinder.cs
+++ b/Roles/Crewmate/Tracefinder.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
@@ -17,8 +17,6 @@ public class Tracefinder : RoleBase
private static OptionItem ArrowDelayMin;
private static OptionItem ArrowDelayMax;
- public static bool On;
-
public static void SetupCustomOption()
{
SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Tracefinder);
@@ -39,13 +37,11 @@ public class Tracefinder : RoleBase
public override void Init()
{
playerIdList = [];
- On = false;
}
public override void Add(byte playerId)
{
playerIdList.Add(playerId);
- On = true;
}
public override bool IsEnable => playerIdList.Count > 0;
@@ -93,8 +89,6 @@ public class Tracefinder : RoleBase
public static void OnPlayerDead(PlayerControl target)
{
- if (!On || !GameStates.IsInTask || target == null) return;
-
var pos = target.Pos();
float minDis = float.MaxValue;
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
@@ -117,7 +111,7 @@ public class Tracefinder : RoleBase
{
if (GameStates.IsInTask)
{
- foreach (byte id in playerIdList)
+ foreach (byte id in playerIdList.ToArray())
{
PlayerControl pc = Utils.GetPlayerById(id);
if (pc == null || !pc.IsAlive())
diff --git a/Roles/Crewmate/Tracker.cs b/Roles/Crewmate/Tracker.cs
index aa3b49f7b..c765b032a 100644
--- a/Roles/Crewmate/Tracker.cs
+++ b/Roles/Crewmate/Tracker.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Crewmate/Veteran.cs b/Roles/Crewmate/Veteran.cs
index b666e2628..deb976aff 100644
--- a/Roles/Crewmate/Veteran.cs
+++ b/Roles/Crewmate/Veteran.cs
@@ -1,7 +1,6 @@
-using System.Text;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Text;
using TOHE.Modules;
-using static TOHE.Options;
namespace TOHE.Roles.Crewmate
{
@@ -13,7 +12,7 @@ namespace TOHE.Roles.Crewmate
public override void Add(byte playerId)
{
On = true;
- playerId.SetAbilityUseLimit(VeteranSkillMaxOfUseage.GetInt());
+ playerId.SetAbilityUseLimit(Options.VeteranSkillMaxOfUseage.GetInt());
}
public override void Init()
@@ -21,30 +20,10 @@ namespace TOHE.Roles.Crewmate
On = false;
}
- public static void SetupCustomOption()
- {
- SetupRoleOptions(8908, TabGroup.CrewmateRoles, CustomRoles.Veteran);
- VeteranSkillCooldown = FloatOptionItem.Create(8910, "VeteranSkillCooldown", new(0f, 180f, 1f), 20f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Veteran])
- .SetValueFormat(OptionFormat.Seconds);
- VeteranSkillDuration = FloatOptionItem.Create(8911, "VeteranSkillDuration", new(0f, 180f, 1f), 10f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Veteran])
- .SetValueFormat(OptionFormat.Seconds);
- VeteranSkillMaxOfUseage = IntegerOptionItem.Create(8912, "VeteranSkillMaxOfUseage", new(0, 180, 1), 1, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Veteran])
- .SetValueFormat(OptionFormat.Times);
- VeteranAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(8913, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.3f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Veteran])
- .SetValueFormat(OptionFormat.Times);
- VeteranAbilityChargesWhenFinishedTasks = FloatOptionItem.Create(8914, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.1f), 0.2f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Veteran])
- .SetValueFormat(OptionFormat.Times);
- }
-
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
- AURoleOptions.EngineerCooldown = VeteranSkillCooldown.GetFloat();
+ if (Options.UsePets.GetBool()) return;
+ AURoleOptions.EngineerCooldown = Options.VeteranSkillCooldown.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 1;
}
@@ -60,7 +39,7 @@ namespace TOHE.Roles.Crewmate
public override void SetButtonTexts(HudManager hud, byte id)
{
- if (UsePets.GetBool())
+ if (Options.UsePets.GetBool())
hud.PetButton.buttonLabelText.text = Translator.GetString("VeteranVentButtonText");
else
hud.AbilityButton.buttonLabelText.text = Translator.GetString("VeteranVentButtonText");
@@ -84,7 +63,7 @@ namespace TOHE.Roles.Crewmate
Main.VeteranInProtect[pc.PlayerId] = Utils.TimeStamp;
pc.RpcRemoveAbilityUse();
pc.RPCPlayCustomSound("Gunload");
- pc.Notify(Translator.GetString("VeteranOnGuard"), VeteranSkillDuration.GetFloat());
+ pc.Notify(Translator.GetString("VeteranOnGuard"), Options.VeteranSkillDuration.GetFloat());
pc.MarkDirtySettings();
}
else
@@ -97,7 +76,7 @@ namespace TOHE.Roles.Crewmate
{
if (Main.VeteranInProtect.ContainsKey(target.PlayerId)
&& killer.PlayerId != target.PlayerId
- && Main.VeteranInProtect[target.PlayerId] + VeteranSkillDuration.GetInt() >= Utils.TimeStamp)
+ && Main.VeteranInProtect[target.PlayerId] + Options.VeteranSkillDuration.GetInt() >= Utils.TimeStamp)
{
if (!killer.Is(CustomRoles.Pestilence))
{
@@ -119,7 +98,7 @@ namespace TOHE.Roles.Crewmate
public override void OnFixedUpdate(PlayerControl player)
{
var playerId = player.PlayerId;
- if (Main.VeteranInProtect.TryGetValue(playerId, out var vtime) && vtime + VeteranSkillDuration.GetInt() < Utils.TimeStamp)
+ if (Main.VeteranInProtect.TryGetValue(playerId, out var vtime) && vtime + Options.VeteranSkillDuration.GetInt() < Utils.TimeStamp)
{
Main.VeteranInProtect.Remove(playerId);
player.RpcResetAbilityCooldown();
diff --git a/Roles/Crewmate/Witness.cs b/Roles/Crewmate/Witness.cs
index 5eb67f478..41c9a3f8a 100644
--- a/Roles/Crewmate/Witness.cs
+++ b/Roles/Crewmate/Witness.cs
@@ -1,6 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
-using static TOHE.Options;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
namespace TOHE.Roles.Crewmate
{
@@ -21,21 +20,9 @@ namespace TOHE.Roles.Crewmate
On = false;
}
- public static void SetupCustomOption()
- {
- SetupSingleRoleOptions(8550, TabGroup.CrewmateRoles, CustomRoles.Witness, 1);
- WitnessCD = FloatOptionItem.Create(8552, "AbilityCD", new(0f, 60f, 2.5f), 15f, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Witness])
- .SetValueFormat(OptionFormat.Seconds);
- WitnessTime = IntegerOptionItem.Create(8553, "WitnessTime", new(0, 90, 1), 10, TabGroup.CrewmateRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Witness])
- .SetValueFormat(OptionFormat.Seconds);
- WitnessUsePet = CreatePetUseSetting(8554, CustomRoles.Witness);
- }
-
public override void SetKillCooldown(byte id)
{
- Main.AllPlayerKillCooldown[id] = WitnessCD.GetFloat();
+ Main.AllPlayerKillCooldown[id] = Options.WitnessCD.GetFloat();
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
diff --git a/Roles/Impostor/AntiAdminer.cs b/Roles/Impostor/AntiAdminer.cs
index a6e216db8..7b73442ac 100644
--- a/Roles/Impostor/AntiAdminer.cs
+++ b/Roles/Impostor/AntiAdminer.cs
@@ -1,6 +1,6 @@
-using System;
+using AmongUs.GameOptions;
+using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using UnityEngine;
@@ -58,7 +58,9 @@ internal class AntiAdminer : RoleBase
{
if (!IsEnable) return;
- Count--; if (Count > 0) return; Count = 5;
+ Count--;
+ if (Count > 0) return;
+ Count = 5;
bool Admin = false, Camera = false, DoorLog = false, Vital = false;
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
@@ -88,6 +90,7 @@ internal class AntiAdminer : RoleBase
Admin |= Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusLeftAdmin"]) <= DisableDevice.UsableDistance();
Admin |= Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusRightAdmin"]) <= DisableDevice.UsableDistance();
}
+
if (!Options.DisablePolusCamera.GetBool())
Camera |= Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusCamera"]) <= DisableDevice.UsableDistance();
if (!Options.DisablePolusVital.GetBool())
diff --git a/Roles/Impostor/Assassin.cs b/Roles/Impostor/Assassin.cs
index 7bd3a988b..d596ebe99 100644
--- a/Roles/Impostor/Assassin.cs
+++ b/Roles/Impostor/Assassin.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
@@ -17,6 +17,9 @@ internal class Assassin : RoleBase
private static OptionItem MarkCooldownOpt;
public static OptionItem AssassinateCooldownOpt;
private static OptionItem CanKillAfterAssassinateOpt;
+ public static OptionItem UndertakerMarkCooldown;
+ public static OptionItem UndertakerAssassinateCooldown;
+ public static OptionItem UndertakerCanKillAfterAssassinate;
private float MarkCooldown;
private float AssassinateCooldown;
@@ -28,11 +31,24 @@ internal class Assassin : RoleBase
public static void SetupCustomOption()
{
SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Assassin);
- MarkCooldownOpt = FloatOptionItem.Create(Id + 10, "AssassinMarkCooldown", new(0f, 180f, 0.5f), 1f, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Assassin])
+ MarkCooldownOpt = FloatOptionItem.Create(Id + 10, "AssassinMarkCooldown", new(0f, 180f, 0.5f), 1f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Assassin])
.SetValueFormat(OptionFormat.Seconds);
- AssassinateCooldownOpt = FloatOptionItem.Create(Id + 11, "AssassinAssassinateCooldown", new(0f, 180f, 0.5f), 18.5f, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Assassin])
+ AssassinateCooldownOpt = FloatOptionItem.Create(Id + 11, "AssassinAssassinateCooldown", new(0f, 180f, 0.5f), 18.5f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Assassin])
.SetValueFormat(OptionFormat.Seconds);
- CanKillAfterAssassinateOpt = BooleanOptionItem.Create(Id + 12, "AssassinCanKillAfterAssassinate", true, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Assassin]);
+ CanKillAfterAssassinateOpt = BooleanOptionItem.Create(Id + 12, "AssassinCanKillAfterAssassinate", true, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Assassin]);
+
+ SetupRoleOptions(Id + 20, TabGroup.ImpostorRoles, CustomRoles.Undertaker);
+ UndertakerMarkCooldown = FloatOptionItem.Create(Id + 30, "UndertakerMarkCooldown", new(0f, 180f, 0.5f), 1f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker])
+ .SetValueFormat(OptionFormat.Seconds);
+ UndertakerAssassinateCooldown = FloatOptionItem.Create(Id + 31, "UndertakerAssassinateCooldown", new(0f, 180f, 0.5f), 18.5f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker])
+ .SetValueFormat(OptionFormat.Seconds);
+ UndertakerCanKillAfterAssassinate = BooleanOptionItem.Create(Id + 32, "UndertakerCanKillAfterAssassinate", true, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker]);
}
public override void Init()
@@ -50,9 +66,9 @@ internal class Assassin : RoleBase
if (IsUndertaker)
{
- MarkCooldown = Undertaker.MarkCooldown.GetFloat();
- AssassinateCooldown = Undertaker.AssassinateCooldown.GetFloat();
- CanKillAfterAssassinate = Undertaker.CanKillAfterAssassinate.GetBool();
+ MarkCooldown = UndertakerMarkCooldown.GetFloat();
+ AssassinateCooldown = UndertakerAssassinateCooldown.GetFloat();
+ CanKillAfterAssassinate = UndertakerCanKillAfterAssassinate.GetBool();
}
else
{
diff --git a/Roles/Impostor/BallLightning.cs b/Roles/Impostor/BallLightning.cs
index db073dd09..0d2d6e029 100644
--- a/Roles/Impostor/BallLightning.cs
+++ b/Roles/Impostor/BallLightning.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using TOHE.Patches;
using TOHE.Roles.Crewmate;
diff --git a/Roles/Impostor/Blackmailer.cs b/Roles/Impostor/Blackmailer.cs
index d2117b615..b5ec4b84e 100644
--- a/Roles/Impostor/Blackmailer.cs
+++ b/Roles/Impostor/Blackmailer.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Impostor;
diff --git a/Roles/Impostor/BountyHunter.cs b/Roles/Impostor/BountyHunter.cs
index 23cfd6751..243c51b43 100644
--- a/Roles/Impostor/BountyHunter.cs
+++ b/Roles/Impostor/BountyHunter.cs
@@ -1,6 +1,6 @@
+using Hazel;
using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
diff --git a/Roles/Impostor/Chronomancer.cs b/Roles/Impostor/Chronomancer.cs
index b9dbe18e6..38ee4eb76 100644
--- a/Roles/Impostor/Chronomancer.cs
+++ b/Roles/Impostor/Chronomancer.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Impostor/Councillor.cs b/Roles/Impostor/Councillor.cs
index adbd62dd0..ec744d60d 100644
--- a/Roles/Impostor/Councillor.cs
+++ b/Roles/Impostor/Councillor.cs
@@ -1,9 +1,9 @@
-using System;
+using HarmonyLib;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using UnityEngine;
diff --git a/Roles/Impostor/Crewpostor.cs b/Roles/Impostor/Crewpostor.cs
index 5a6cb6ebb..d3e7b01b2 100644
--- a/Roles/Impostor/Crewpostor.cs
+++ b/Roles/Impostor/Crewpostor.cs
@@ -1,10 +1,9 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Impostor
{
@@ -15,22 +14,6 @@ namespace TOHE.Roles.Impostor
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(4800, TabGroup.ImpostorRoles, CustomRoles.Crewpostor);
- CrewpostorCanKillAllies = BooleanOptionItem.Create(4810, "CanKillAllies", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Crewpostor]);
- CrewpostorKnowsAllies = BooleanOptionItem.Create(4811, "CrewpostorKnowsAllies", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Crewpostor]);
- AlliesKnowCrewpostor = BooleanOptionItem.Create(4812, "AlliesKnowCrewpostor", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Crewpostor]);
- CrewpostorLungeKill = BooleanOptionItem.Create(4813, "CrewpostorLungeKill", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Crewpostor]);
- CrewpostorKillAfterTask = IntegerOptionItem.Create(4814, "CrewpostorKillAfterTask", new(1, 50, 1), 1, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Crewpostor]);
- CrewpostorTasks = OverrideTasksData.Create(4815, TabGroup.ImpostorRoles, CustomRoles.Crewpostor);
- }
-
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
AURoleOptions.EngineerCooldown = 0f;
@@ -43,14 +26,14 @@ namespace TOHE.Roles.Impostor
SendRPC(player.PlayerId, TasksDone[player.PlayerId]);
- PlayerControl[] list = Main.AllAlivePlayerControls.Where(x => x.PlayerId != player.PlayerId && (CrewpostorCanKillAllies.GetBool() || !x.GetCustomRole().IsImpostorTeam())).ToArray();
+ PlayerControl[] list = Main.AllAlivePlayerControls.Where(x => x.PlayerId != player.PlayerId && (Options.CrewpostorCanKillAllies.GetBool() || !x.GetCustomRole().IsImpostorTeam())).ToArray();
if (list.Length == 0)
{
Logger.Info("No target to kill", "Crewpostor");
}
- else if (TasksDone[player.PlayerId] % CrewpostorKillAfterTask.GetInt() != 0 && TasksDone[player.PlayerId] != 0)
+ else if (TasksDone[player.PlayerId] % Options.CrewpostorKillAfterTask.GetInt() != 0 && TasksDone[player.PlayerId] != 0)
{
- Logger.Info($"Crewpostor task done but kill skipped, {TasksDone[player.PlayerId]} tasks completed, but it kills after {CrewpostorKillAfterTask.GetInt()} tasks", "Crewpostor");
+ Logger.Info($"Crewpostor task done but kill skipped, {TasksDone[player.PlayerId]} tasks completed, but it kills after {Options.CrewpostorKillAfterTask.GetInt()} tasks", "Crewpostor");
}
else
{
@@ -58,7 +41,7 @@ namespace TOHE.Roles.Impostor
var target = list[0];
if (!target.Is(CustomRoles.Pestilence))
{
- if (!CrewpostorLungeKill.GetBool())
+ if (!Options.CrewpostorLungeKill.GetBool())
{
target.SetRealKiller(player);
if (player.RpcCheckAndMurder(target, true))
diff --git a/Roles/Impostor/Dazzler.cs b/Roles/Impostor/Dazzler.cs
index 1e83ce52d..a99de98e6 100644
--- a/Roles/Impostor/Dazzler.cs
+++ b/Roles/Impostor/Dazzler.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Roles.Neutral;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Impostor/Deathpact.cs b/Roles/Impostor/Deathpact.cs
index ad1d6c92e..406df3168 100644
--- a/Roles/Impostor/Deathpact.cs
+++ b/Roles/Impostor/Deathpact.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using UnityEngine;
@@ -251,7 +251,7 @@ namespace TOHE.Roles.Impostor
{
if (!ActiveDeathpacts.Contains(dp.DeathPactId) || dp.PlayersInDeathpact.All(b => b.PlayerId != player.PlayerId)) continue;
- string otherPlayerNames = dp.PlayersInDeathpact.Where(a => a.PlayerId != player.PlayerId).Aggregate(string.Empty, (current, otherPlayerInPact) => current + otherPlayerInPact.name.ToUpper() + ",");
+ string otherPlayerNames = dp.PlayersInDeathpact.Where(a => a.PlayerId != player.PlayerId).Aggregate(string.Empty, (current, otherPlayerInPact) => current + (otherPlayerInPact.name.ToUpper() + ","));
otherPlayerNames = otherPlayerNames.Remove(otherPlayerNames.Length - 1);
int countdown = (int)(dp.DeathpactTime - TimeStamp);
diff --git a/Roles/Impostor/Devourer.cs b/Roles/Impostor/Devourer.cs
index 0d9d08b4d..8545274b1 100644
--- a/Roles/Impostor/Devourer.cs
+++ b/Roles/Impostor/Devourer.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Roles.Neutral;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Impostor/Duellist.cs b/Roles/Impostor/Duellist.cs
index 546ca4b67..669f5abb2 100644
--- a/Roles/Impostor/Duellist.cs
+++ b/Roles/Impostor/Duellist.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using static TOHE.Options;
diff --git a/Roles/Impostor/EvilDiviner.cs b/Roles/Impostor/EvilDiviner.cs
index 4f79f3c7e..94eb0f83f 100644
--- a/Roles/Impostor/EvilDiviner.cs
+++ b/Roles/Impostor/EvilDiviner.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using TOHE.Roles.Neutral;
using static TOHE.Options;
@@ -119,6 +119,7 @@ namespace TOHE.Roles.Impostor
killer.SetKillCooldown();
}
}
+
public static bool IsShowTargetRole(PlayerControl seer, PlayerControl target)
{
return Main.PlayerStates[seer.PlayerId].Role is EvilDiviner ed && ed.DivinationTarget.Contains(target.PlayerId);
diff --git a/Roles/Impostor/EvilGuesser.cs b/Roles/Impostor/EvilGuesser.cs
new file mode 100644
index 000000000..033f1e5c7
--- /dev/null
+++ b/Roles/Impostor/EvilGuesser.cs
@@ -0,0 +1,25 @@
+using UnityEngine;
+using static TOHE.Options;
+
+namespace TOHE.Roles.Impostor
+{
+ internal static class EvilGuesser
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(1200, TabGroup.ImpostorRoles, CustomRoles.EvilGuesser);
+ EGCanGuessTime = IntegerOptionItem.Create(1205, "GuesserCanGuessTimes", new(1, 15, 1), 15, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser])
+ .SetValueFormat(OptionFormat.Times);
+ EGCanGuessImp = BooleanOptionItem.Create(1206, "EGCanGuessImp", true, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
+ EGCanGuessAdt = BooleanOptionItem.Create(1207, "EGCanGuessAdt", false, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
+ EGCanGuessTaskDoneSnitch = BooleanOptionItem.Create(1208, "EGCanGuessTaskDoneSnitch", true, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser]);
+ EGTryHideMsg = BooleanOptionItem.Create(1209, "GuesserTryHideMsg", true, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.EvilGuesser])
+ .SetColor(Color.green);
+ }
+ }
+}
diff --git a/Roles/Impostor/EvilTracker.cs b/Roles/Impostor/EvilTracker.cs
index 4ea42793a..cefcb1306 100644
--- a/Roles/Impostor/EvilTracker.cs
+++ b/Roles/Impostor/EvilTracker.cs
@@ -1,9 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using Hazel;
using Il2CppSystem.Text;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
@@ -68,23 +68,15 @@ public class EvilTracker : RoleBase
public override void Add(byte playerId)
{
- CanSeeKillFlash = OptionCanSeeKillFlash.GetBool();
- CurrentTargetMode = (TargetMode)OptionTargetMode.GetValue();
- RoleTypes = CurrentTargetMode == TargetMode.Never ? RoleTypes.Impostor : RoleTypes.Shapeshifter;
- CanSeeLastRoomInMeeting = OptionCanSeeLastRoomInMeeting.GetBool();
-
playerIdList.Add(playerId);
Target = byte.MaxValue;
CanSetTarget = CurrentTargetMode != TargetMode.Never;
EvilTrackerId = playerId;
- _ = new LateTask(() =>
- {
- foreach (var id in ImpostorsId)
- {
- TargetArrow.Add(playerId, id);
- }
- }, 3f, "Add Evil Tracker Arrows");
+ CanSeeKillFlash = OptionCanSeeKillFlash.GetBool();
+ CurrentTargetMode = (TargetMode)OptionTargetMode.GetValue();
+ RoleTypes = CurrentTargetMode == TargetMode.Never ? RoleTypes.Impostor : RoleTypes.Shapeshifter;
+ CanSeeLastRoomInMeeting = OptionCanSeeLastRoomInMeeting.GetBool();
}
public override bool IsEnable => playerIdList.Count > 0;
@@ -157,6 +149,11 @@ public class EvilTracker : RoleBase
}
}
+ ///
+ ///引数が両方空:再設定可能に,
+ ///trackerIdのみ:該当IDのターゲット削除,
+ ///trackerIdとtargetId両方あり:該当IDのプレイヤーをターゲットに設定
+ ///
public void SetTarget(byte trackerId = byte.MaxValue, byte targetId = byte.MaxValue)
{
if (trackerId == byte.MaxValue) CanSetTarget = true;
@@ -175,6 +172,7 @@ public class EvilTracker : RoleBase
writer.Write(targetId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte trackerId = reader.ReadByte();
@@ -212,8 +210,10 @@ public class EvilTracker : RoleBase
{
sb.Append(Utils.ColorString(Color.white, TargetArrow.GetArrows(target, targetId)));
}
+
return sb.ToString();
}
+
public static string GetArrowAndLastRoom(PlayerControl seer, PlayerControl target)
{
string text = Utils.ColorString(Palette.ImpostorRed, TargetArrow.GetArrows(seer, target.PlayerId));
diff --git a/Roles/Impostor/FireWorks.cs b/Roles/Impostor/FireWorks.cs
index 07b3213ef..7f4f7ce65 100644
--- a/Roles/Impostor/FireWorks.cs
+++ b/Roles/Impostor/FireWorks.cs
@@ -1,6 +1,6 @@
+using Hazel;
using System;
using System.Collections.Generic;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
diff --git a/Roles/Impostor/Gambler.cs b/Roles/Impostor/Gambler.cs
index 6abafabf8..ab5ebb971 100644
--- a/Roles/Impostor/Gambler.cs
+++ b/Roles/Impostor/Gambler.cs
@@ -1,7 +1,7 @@
-using System;
+using AmongUs.GameOptions;
+using System;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using static TOHE.Options;
diff --git a/Roles/Impostor/Greedier.cs b/Roles/Impostor/Greedier.cs
index 92ca1a1d5..4bc6631b1 100644
--- a/Roles/Impostor/Greedier.cs
+++ b/Roles/Impostor/Greedier.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Neutral;
diff --git a/Roles/Impostor/Hacker.cs b/Roles/Impostor/Hacker.cs
index 4c7989302..914d3f173 100644
--- a/Roles/Impostor/Hacker.cs
+++ b/Roles/Impostor/Hacker.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Impostor/Hangman.cs b/Roles/Impostor/Hangman.cs
index b62babe5b..04f50aacc 100644
--- a/Roles/Impostor/Hangman.cs
+++ b/Roles/Impostor/Hangman.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Roles.Crewmate;
using static TOHE.Options;
diff --git a/Roles/Impostor/Hitman.cs b/Roles/Impostor/Hitman.cs
index 66caee434..25cc90279 100644
--- a/Roles/Impostor/Hitman.cs
+++ b/Roles/Impostor/Hitman.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Utils;
@@ -124,4 +124,4 @@ namespace TOHE.Roles.Impostor
return id == byte.MaxValue ? string.Empty : $"Target: {GetPlayerById(id).GetRealName().RemoveHtmlTags()}";
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Impostor/ImpostorVanillaRoles.cs b/Roles/Impostor/ImpostorVanillaRoles.cs
new file mode 100644
index 000000000..55beed5dd
--- /dev/null
+++ b/Roles/Impostor/ImpostorVanillaRoles.cs
@@ -0,0 +1,19 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Impostor
+{
+ internal static class ImpostorVanillaRoles
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(300, TabGroup.ImpostorRoles, CustomRoles.ImpostorTOHE);
+ SetupRoleOptions(400, TabGroup.ImpostorRoles, CustomRoles.ShapeshifterTOHE);
+ ShapeshiftCD = FloatOptionItem.Create(402, "ShapeshiftCooldown", new(1f, 180f, 1f), 30f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.ShapeshifterTOHE])
+ .SetValueFormat(OptionFormat.Seconds);
+ ShapeshiftDur = FloatOptionItem.Create(403, "ShapeshiftDuration", new(1f, 60f, 1f), 10f, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.ShapeshifterTOHE])
+ .SetValueFormat(OptionFormat.Seconds);
+ }
+ }
+}
diff --git a/Roles/Impostor/Librarian.cs b/Roles/Impostor/Librarian.cs
index b0e57ae02..5d6fe48a2 100644
--- a/Roles/Impostor/Librarian.cs
+++ b/Roles/Impostor/Librarian.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Impostor/Mafia.cs b/Roles/Impostor/Mafia.cs
index 941312a43..6f6e29fea 100644
--- a/Roles/Impostor/Mafia.cs
+++ b/Roles/Impostor/Mafia.cs
@@ -5,7 +5,6 @@ using System;
using System.Linq;
using TOHE.Modules;
using UnityEngine;
-using static TOHE.Options;
using static TOHE.Translator;
using Object = UnityEngine.Object;
@@ -16,22 +15,6 @@ namespace TOHE.Roles.Impostor
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(3100, TabGroup.ImpostorRoles, CustomRoles.Mafia);
- MafiaCanKillNum = IntegerOptionItem.Create(3200, "MafiaCanKillNum", new(0, 15, 1), 1, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Mafia])
- .SetValueFormat(OptionFormat.Players);
- LegacyMafia = BooleanOptionItem.Create(3210, "LegacyMafia", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Mafia]);
- MafiaShapeshiftCD = FloatOptionItem.Create(3211, "ShapeshiftCooldown", new(1f, 180f, 1f), 15f, TabGroup.ImpostorRoles, false)
- .SetParent(LegacyMafia)
- .SetValueFormat(OptionFormat.Seconds);
- MafiaShapeshiftDur = FloatOptionItem.Create(3212, "ShapeshiftDuration", new(1f, 180f, 1f), 30f, TabGroup.ImpostorRoles, false)
- .SetParent(LegacyMafia)
- .SetValueFormat(OptionFormat.Seconds);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -49,8 +32,8 @@ namespace TOHE.Roles.Impostor
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- AURoleOptions.ShapeshifterCooldown = MafiaShapeshiftCD.GetFloat();
- AURoleOptions.ShapeshifterDuration = MafiaShapeshiftDur.GetFloat();
+ AURoleOptions.ShapeshifterCooldown = Options.MafiaShapeshiftCD.GetFloat();
+ AURoleOptions.ShapeshifterDuration = Options.MafiaShapeshiftDur.GetFloat();
}
public static bool MafiaMsgCheck(PlayerControl pc, string msg, bool isUI = false)
@@ -60,7 +43,7 @@ namespace TOHE.Roles.Impostor
if (!pc.Is(CustomRoles.Mafia)) return false;
msg = msg.Trim().ToLower();
if (msg.Length < 3 || msg[..3] != "/rv") return false;
- if (MafiaCanKillNum.GetInt() < 1)
+ if (Options.MafiaCanKillNum.GetInt() < 1)
{
if (!isUI) Utils.SendMessage(GetString("MafiaKillDisable"), pc.PlayerId);
else pc.ShowPopUp(GetString("MafiaKillDisable"));
@@ -76,7 +59,7 @@ namespace TOHE.Roles.Impostor
if (msg == "/rv")
{
string text = GetString("PlayerIdList");
- text = Main.AllAlivePlayerControls.Aggregate(text, (current, npc) => current + "\n" + npc.PlayerId + " → (" + npc.GetDisplayRoleName() + ") " + npc.GetRealName());
+ text = Main.AllAlivePlayerControls.Aggregate(text, (current, npc) => current + ("\n" + npc.PlayerId + " → (" + npc.GetDisplayRoleName() + ") " + npc.GetRealName()));
Utils.SendMessage(text, pc.PlayerId);
return true;
@@ -84,7 +67,7 @@ namespace TOHE.Roles.Impostor
if (!Main.MafiaRevenged.TryAdd(pc.PlayerId, 0))
{
- if (Main.MafiaRevenged[pc.PlayerId] >= MafiaCanKillNum.GetInt())
+ if (Main.MafiaRevenged[pc.PlayerId] >= Options.MafiaCanKillNum.GetInt())
{
if (!isUI) Utils.SendMessage(GetString("MafiaKillMax"), pc.PlayerId);
else pc.ShowPopUp(GetString("MafiaKillMax"));
diff --git a/Roles/Impostor/Mafioso.cs b/Roles/Impostor/Mafioso.cs
index 4d380b99f..6626b73d2 100644
--- a/Roles/Impostor/Mafioso.cs
+++ b/Roles/Impostor/Mafioso.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Impostor/Morphling.cs b/Roles/Impostor/Morphling.cs
index 13d9e58e2..96d4a091c 100644
--- a/Roles/Impostor/Morphling.cs
+++ b/Roles/Impostor/Morphling.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Impostor;
@@ -28,7 +28,6 @@ public class Morphling : RoleBase
public override void Init()
{
playerIdList = [];
-
}
public override void Add(byte playerId)
diff --git a/Roles/Impostor/OverKiller.cs b/Roles/Impostor/OverKiller.cs
index 2e0e4b8a4..3ac142777 100644
--- a/Roles/Impostor/OverKiller.cs
+++ b/Roles/Impostor/OverKiller.cs
@@ -1,6 +1,6 @@
-using System.Linq;
-using Hazel;
+using Hazel;
using InnerNet;
+using System.Linq;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using UnityEngine;
@@ -86,4 +86,4 @@ namespace TOHE.Roles.Impostor
return base.OnCheckMurder(killer, target);
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Impostor/Puppeteer.cs b/Roles/Impostor/Puppeteer.cs
index a0cca6980..e62f57cdd 100644
--- a/Roles/Impostor/Puppeteer.cs
+++ b/Roles/Impostor/Puppeteer.cs
@@ -1,12 +1,11 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Impostor
{
@@ -20,43 +19,6 @@ namespace TOHE.Roles.Impostor
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(3900, TabGroup.ImpostorRoles, CustomRoles.Puppeteer);
- PuppeteerCD = FloatOptionItem.Create(3911, "PuppeteerCD", new(2.5f, 60f, 2.5f), 22.5f, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer])
- .SetValueFormat(OptionFormat.Seconds);
- PuppeteerCanKillNormally = BooleanOptionItem.Create(3917, "PuppeteerCanKillNormally", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- PuppeteerKCD = FloatOptionItem.Create(3912, "PuppeteerKCD", new(2.5f, 60f, 2.5f), 25f, TabGroup.ImpostorRoles, false)
- .SetParent(PuppeteerCanKillNormally)
- .SetValueFormat(OptionFormat.Seconds);
- PuppeteerMinDelay = IntegerOptionItem.Create(3913, "PuppeteerMinDelay", new(0, 90, 1), 3, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer])
- .SetValueFormat(OptionFormat.Seconds);
- PuppeteerMaxDelay = IntegerOptionItem.Create(3914, "PuppeteerMaxDelay", new(0, 90, 1), 7, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer])
- .SetValueFormat(OptionFormat.Seconds);
- PuppeteerManipulationEndsAfterFixedTime = BooleanOptionItem.Create(3915, "PuppeteerManipulationEndsAfterFixedTime", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- PuppeteerManipulationEndsAfterTime = IntegerOptionItem.Create(3916, "PuppeteerManipulationEndsAfterTime", new(0, 90, 1), 30, TabGroup.ImpostorRoles, false)
- .SetParent(PuppeteerManipulationEndsAfterFixedTime)
- .SetValueFormat(OptionFormat.Seconds);
- PuppeteerManipulationBypassesLazy = BooleanOptionItem.Create(3918, "PuppeteerManipulationBypassesLazy", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- PuppeteerManipulationBypassesLazyGuy = BooleanOptionItem.Create(3922, "PuppeteerManipulationBypassesLazyGuy", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- PuppeteerPuppetCanKillImpostors = BooleanOptionItem.Create(3919, "PuppeteerPuppetCanKillImpostors", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- PuppeteerPuppetCanKillPuppeteer = BooleanOptionItem.Create(3920, "PuppeteerPuppetCanKillPuppeteer", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- Options.PuppeteerMaxPuppets = IntegerOptionItem.Create(3921, "PuppeteerMaxPuppets", new(0, 30, 1), 5, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer])
- .SetValueFormat(OptionFormat.Times);
- PuppeteerDiesAfterMaxPuppets = BooleanOptionItem.Create(3923, "PuppeteerDiesAfterMaxPuppets", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Puppeteer]);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -73,7 +35,7 @@ namespace TOHE.Roles.Impostor
public override void SetKillCooldown(byte id)
{
- Main.AllPlayerKillCooldown[id] = PuppeteerCanKillNormally.GetBool() ? PuppeteerKCD.GetFloat() : PuppeteerCD.GetFloat();
+ Main.AllPlayerKillCooldown[id] = Options.PuppeteerCanKillNormally.GetBool() ? Options.PuppeteerKCD.GetFloat() : Options.PuppeteerCD.GetFloat();
}
public override void SetButtonTexts(HudManager hud, byte id)
@@ -83,8 +45,8 @@ namespace TOHE.Roles.Impostor
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
- if (target.Is(CustomRoles.Needy) && PuppeteerManipulationBypassesLazyGuy.GetBool()) return false;
- if (target.Is(CustomRoles.Lazy) && PuppeteerManipulationBypassesLazy.GetBool()) return false;
+ if (target.Is(CustomRoles.Needy) && Options.PuppeteerManipulationBypassesLazyGuy.GetBool()) return false;
+ if (target.Is(CustomRoles.Lazy) && Options.PuppeteerManipulationBypassesLazy.GetBool()) return false;
if (Medic.ProtectList.Contains(target.PlayerId)) return false;
if (!PuppeteerMaxPuppets.TryGetValue(killer.PlayerId, out var usesLeft))
@@ -93,14 +55,14 @@ namespace TOHE.Roles.Impostor
PuppeteerMaxPuppets.Add(killer.PlayerId, usesLeft);
}
- if (PuppeteerCanKillNormally.GetBool())
+ if (Options.PuppeteerCanKillNormally.GetBool())
{
return killer.CheckDoubleTrigger(target, () =>
{
PuppeteerList[target.PlayerId] = killer.PlayerId;
PuppeteerDelayList[target.PlayerId] = Utils.TimeStamp;
- PuppeteerDelay[target.PlayerId] = IRandom.Instance.Next(PuppeteerMinDelay.GetInt(), PuppeteerMaxDelay.GetInt());
- killer.SetKillCooldown(time: PuppeteerCD.GetFloat());
+ PuppeteerDelay[target.PlayerId] = IRandom.Instance.Next(Options.PuppeteerMinDelay.GetInt(), Options.PuppeteerMaxDelay.GetInt());
+ killer.SetKillCooldown(time: Options.PuppeteerCD.GetFloat());
if (usesLeft <= 1)
{
_ = new LateTask(() => { killer.Suicide(); }, 1.5f, "Puppeteer Max Uses Reached => Suicide");
@@ -115,7 +77,7 @@ namespace TOHE.Roles.Impostor
PuppeteerList[target.PlayerId] = killer.PlayerId;
PuppeteerDelayList[target.PlayerId] = Utils.TimeStamp;
- PuppeteerDelay[target.PlayerId] = IRandom.Instance.Next(PuppeteerMinDelay.GetInt(), PuppeteerMaxDelay.GetInt());
+ PuppeteerDelay[target.PlayerId] = IRandom.Instance.Next(Options.PuppeteerMinDelay.GetInt(), Options.PuppeteerMaxDelay.GetInt());
killer.SetKillCooldown();
if (usesLeft <= 1)
{
@@ -144,7 +106,7 @@ namespace TOHE.Roles.Impostor
PuppeteerDelayList.Remove(playerId);
PuppeteerDelay.Remove(playerId);
}
- else if (PuppeteerDelayList[playerId] + PuppeteerManipulationEndsAfterTime.GetInt() < now && PuppeteerManipulationEndsAfterFixedTime.GetBool())
+ else if (PuppeteerDelayList[playerId] + Options.PuppeteerManipulationEndsAfterTime.GetInt() < now && Options.PuppeteerManipulationEndsAfterFixedTime.GetBool())
{
PuppeteerList.Remove(playerId);
PuppeteerDelayList.Remove(playerId);
@@ -158,8 +120,8 @@ namespace TOHE.Roles.Impostor
foreach (PlayerControl target in Main.AllAlivePlayerControls)
{
if (target.PlayerId == playerId || target.Is(CustomRoles.Pestilence)) continue;
- if (target.Is(CustomRoles.Puppeteer) && !PuppeteerPuppetCanKillPuppeteer.GetBool()) continue;
- if (target.Is(CustomRoleTypes.Impostor) && !PuppeteerPuppetCanKillImpostors.GetBool()) continue;
+ if (target.Is(CustomRoles.Puppeteer) && !Options.PuppeteerPuppetCanKillPuppeteer.GetBool()) continue;
+ if (target.Is(CustomRoleTypes.Impostor) && !Options.PuppeteerPuppetCanKillImpostors.GetBool()) continue;
float dis = Vector2.Distance(puppeteerPos, target.transform.position);
targetDistance.Add(target.PlayerId, dis);
diff --git a/Roles/Impostor/QuickShooter.cs b/Roles/Impostor/QuickShooter.cs
index cbe1ffe52..bce6d74e8 100644
--- a/Roles/Impostor/QuickShooter.cs
+++ b/Roles/Impostor/QuickShooter.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Impostor/RiftMaker.cs b/Roles/Impostor/RiftMaker.cs
index 973315fd0..e6f919759 100644
--- a/Roles/Impostor/RiftMaker.cs
+++ b/Roles/Impostor/RiftMaker.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Roles.Neutral;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Impostor/Sans.cs b/Roles/Impostor/Sans.cs
index e0105cdff..db0651de6 100644
--- a/Roles/Impostor/Sans.cs
+++ b/Roles/Impostor/Sans.cs
@@ -1,6 +1,6 @@
-using System;
+using AmongUs.GameOptions;
+using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using TOHE.Roles.Neutral;
using static TOHE.Options;
diff --git a/Roles/Impostor/Sapper.cs b/Roles/Impostor/Sapper.cs
index 6f5aa0304..fd783daa0 100644
--- a/Roles/Impostor/Sapper.cs
+++ b/Roles/Impostor/Sapper.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
using TOHE.Roles.Neutral;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Impostor/Sniper.cs b/Roles/Impostor/Sniper.cs
index 08535ffb4..066ec04ee 100644
--- a/Roles/Impostor/Sniper.cs
+++ b/Roles/Impostor/Sniper.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
diff --git a/Roles/Impostor/Stealth.cs b/Roles/Impostor/Stealth.cs
index 79b7158c0..0aafab345 100644
--- a/Roles/Impostor/Stealth.cs
+++ b/Roles/Impostor/Stealth.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Impostor/Swapster.cs b/Roles/Impostor/Swapster.cs
index 4ae3f3914..4c1daa781 100644
--- a/Roles/Impostor/Swapster.cs
+++ b/Roles/Impostor/Swapster.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
namespace TOHE.Roles.Impostor
{
@@ -52,4 +52,4 @@ namespace TOHE.Roles.Impostor
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Impostor/Swooper.cs b/Roles/Impostor/Swooper.cs
index f8ee01740..514065277 100644
--- a/Roles/Impostor/Swooper.cs
+++ b/Roles/Impostor/Swooper.cs
@@ -1,8 +1,8 @@
-using System;
+using AmongUs.GameOptions;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
diff --git a/Roles/Impostor/Twister.cs b/Roles/Impostor/Twister.cs
index 379a44ed7..7c4473329 100644
--- a/Roles/Impostor/Twister.cs
+++ b/Roles/Impostor/Twister.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Modules;
using TOHE.Roles.Neutral;
using static TOHE.Options;
diff --git a/Roles/Impostor/Undertaker.cs b/Roles/Impostor/Undertaker.cs
deleted file mode 100644
index b483e4822..000000000
--- a/Roles/Impostor/Undertaker.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using static TOHE.Options;
-
-namespace TOHE.Roles.Impostor;
-
-internal static class Undertaker
-{
- private const int Id = 750;
-
- public static OptionItem MarkCooldown;
- public static OptionItem AssassinateCooldown;
- public static OptionItem CanKillAfterAssassinate;
-
- public static void SetupCustomOption()
- {
- SetupRoleOptions(Id, TabGroup.ImpostorRoles, CustomRoles.Undertaker);
- MarkCooldown = FloatOptionItem.Create(Id + 10, "UndertakerMarkCooldown", new(0f, 180f, 0.5f), 1f, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker])
- .SetValueFormat(OptionFormat.Seconds);
- AssassinateCooldown = FloatOptionItem.Create(Id + 11, "UndertakerAssassinateCooldown", new(0f, 180f, 0.5f), 18.5f, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker])
- .SetValueFormat(OptionFormat.Seconds);
- CanKillAfterAssassinate = BooleanOptionItem.Create(Id + 12, "UndertakerCanKillAfterAssassinate", true, TabGroup.ImpostorRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Undertaker]);
- }
-}
\ No newline at end of file
diff --git a/Roles/Impostor/Vindicator.cs b/Roles/Impostor/Vindicator.cs
new file mode 100644
index 000000000..556b73765
--- /dev/null
+++ b/Roles/Impostor/Vindicator.cs
@@ -0,0 +1,17 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Impostor
+{
+ internal static class Vindicator
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(3400, TabGroup.ImpostorRoles, CustomRoles.Vindicator);
+ VindicatorAdditionalVote = IntegerOptionItem.Create(3410, "MayorAdditionalVote", new(1, 30, 1), 1, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Vindicator])
+ .SetValueFormat(OptionFormat.Votes);
+ VindicatorHideVote = BooleanOptionItem.Create(3411, "MayorHideVote", false, TabGroup.ImpostorRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Vindicator]);
+ }
+ }
+}
diff --git a/Roles/Impostor/Warlock.cs b/Roles/Impostor/Warlock.cs
index 38b9de983..be356b656 100644
--- a/Roles/Impostor/Warlock.cs
+++ b/Roles/Impostor/Warlock.cs
@@ -1,11 +1,10 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Neutral;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Impostor
{
@@ -14,18 +13,6 @@ namespace TOHE.Roles.Impostor
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(4600, TabGroup.ImpostorRoles, CustomRoles.Warlock);
- WarlockCanKillAllies = BooleanOptionItem.Create(4610, "CanKillAllies", true, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Warlock]);
- WarlockCanKillSelf = BooleanOptionItem.Create(4611, "CanKillSelf", false, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Warlock]);
- WarlockShiftDuration = FloatOptionItem.Create(4612, "ShapeshiftDuration", new(0, 180, 1), 1, TabGroup.ImpostorRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Warlock])
- .SetValueFormat(OptionFormat.Seconds);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -40,11 +27,11 @@ namespace TOHE.Roles.Impostor
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- if (UsePets.GetBool()) return;
+ if (Options.UsePets.GetBool()) return;
try
{
- AURoleOptions.ShapeshifterCooldown = Main.isCursed ? 1f : DefaultKillCooldown;
- AURoleOptions.ShapeshifterDuration = WarlockShiftDuration.GetFloat();
+ AURoleOptions.ShapeshifterCooldown = Main.isCursed ? 1f : Options.DefaultKillCooldown;
+ AURoleOptions.ShapeshifterDuration = Options.WarlockShiftDuration.GetFloat();
}
catch
{
@@ -111,8 +98,8 @@ namespace TOHE.Roles.Impostor
foreach (PlayerControl p in Main.AllAlivePlayerControls)
{
if (p.PlayerId == cp.PlayerId) continue;
- if (!WarlockCanKillSelf.GetBool() && p.PlayerId == pc.PlayerId) continue;
- if (!WarlockCanKillAllies.GetBool() && p.GetCustomRole().IsImpostor()) continue;
+ if (!Options.WarlockCanKillSelf.GetBool() && p.PlayerId == pc.PlayerId) continue;
+ if (!Options.WarlockCanKillAllies.GetBool() && p.GetCustomRole().IsImpostor()) continue;
if (p.Is(CustomRoles.Pestilence)) continue;
if (Pelican.IsEaten(p.PlayerId) || Medic.ProtectList.Contains(p.PlayerId)) continue;
float dis = Vector2.Distance(cppos, p.Pos());
diff --git a/Roles/Impostor/Wildling.cs b/Roles/Impostor/Wildling.cs
index 0ca0ecfb2..91fa78ec4 100644
--- a/Roles/Impostor/Wildling.cs
+++ b/Roles/Impostor/Wildling.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
+using Hazel;
using System;
using System.Collections.Generic;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Neutral;
using static TOHE.Options;
@@ -109,6 +109,7 @@ public class Wildling : RoleBase
writer.Write(TimeStamp.ToString());
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte PlayerId = reader.ReadByte();
@@ -149,6 +150,7 @@ public class Wildling : RoleBase
pc.Notify(Translator.GetString("BKProtectOut"));
}
}
+
public static string GetHudText(PlayerControl pc)
{
if (pc == null || !GameStates.IsInTask || !PlayerControl.LocalPlayer.IsAlive()) return string.Empty;
@@ -164,6 +166,7 @@ public class Wildling : RoleBase
{
str.Append(Translator.GetString("BKSkillNotice"));
}
+
return str.ToString();
}
}
\ No newline at end of file
diff --git a/Roles/Impostor/Witch.cs b/Roles/Impostor/Witch.cs
index 0a59f2936..80cccbe40 100644
--- a/Roles/Impostor/Witch.cs
+++ b/Roles/Impostor/Witch.cs
@@ -1,6 +1,6 @@
+using Hazel;
using System.Collections.Generic;
using System.Text;
-using Hazel;
using TOHE.Modules;
using TOHE.Patches;
using TOHE.Roles.Crewmate;
@@ -83,7 +83,6 @@ public class Witch : RoleBase
writer.Write(witchId);
writer.Write(spellMode);
AmongUsClient.Instance.FinishRpcImmediately(writer);
-
}
}
@@ -140,6 +139,7 @@ public class Witch : RoleBase
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target, ForceLoop: true);
}
}
+
public static void RemoveSpelledPlayer()
{
foreach (byte witch in playerIdList)
@@ -164,12 +164,14 @@ public class Witch : RoleBase
SwitchSpellMode(killer.PlayerId, true);
return true;
}
+
SetSpelled(killer, target);
SwitchSpellMode(killer.PlayerId, true);
return false;
}
+
public static void OnCheckForEndVoting(PlayerState.DeathReason deathReason, params byte[] exileIds)
{
if (deathReason != PlayerState.DeathReason.Vote) return;
@@ -181,6 +183,7 @@ public class Witch : RoleBase
wc.SpelledPlayer.Clear();
}
}
+
var spelledIdList = new List();
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
{
@@ -205,6 +208,7 @@ public class Witch : RoleBase
CheckForEndVotingPatch.TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.Spell, [.. spelledIdList]);
RemoveSpelledPlayer();
}
+
public static string GetSpelledMark(byte target, bool isMeeting)
{
if (!isMeeting) return string.Empty;
@@ -215,8 +219,10 @@ public class Witch : RoleBase
return Utils.ColorString(Palette.ImpostorRed, "†");
}
}
+
return string.Empty;
}
+
public static string GetSpellModeText(PlayerControl witch, bool hud, bool isMeeting = false)
{
if (witch == null || isMeeting) return string.Empty;
@@ -230,6 +236,7 @@ public class Witch : RoleBase
{
str.Append($"{GetString("Mode")}: ");
}
+
if (NowSwitchTrigger == SwitchTrigger.DoubleTrigger)
{
str.Append(GetString("WitchModeDouble"));
@@ -238,8 +245,10 @@ public class Witch : RoleBase
{
str.Append(IsSpellMode(witch.PlayerId) ? GetString("WitchModeSpell") : GetString("WitchModeKill"));
}
+
return str.ToString();
}
+
public static void GetAbilityButtonText(HudManager hud)
{
if (IsSpellMode(PlayerControl.LocalPlayer.PlayerId) && NowSwitchTrigger != SwitchTrigger.DoubleTrigger)
diff --git a/Roles/Impostor/YinYanger.cs b/Roles/Impostor/YinYanger.cs
index 4cabcd6c9..237c65946 100644
--- a/Roles/Impostor/YinYanger.cs
+++ b/Roles/Impostor/YinYanger.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Impostor/Zombie.cs b/Roles/Impostor/Zombie.cs
index bf47fd474..230662204 100644
--- a/Roles/Impostor/Zombie.cs
+++ b/Roles/Impostor/Zombie.cs
@@ -1,6 +1,5 @@
-using System;
-using AmongUs.GameOptions;
-using static TOHE.Options;
+using AmongUs.GameOptions;
+using System;
namespace TOHE.Roles.Impostor
{
@@ -9,17 +8,6 @@ namespace TOHE.Roles.Impostor
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(16400, TabGroup.OtherRoles, CustomRoles.Zombie);
- ZombieKillCooldown = FloatOptionItem.Create(16410, "KillCooldown", new(0f, 180f, 2.5f), 5f, TabGroup.OtherRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Zombie])
- .SetValueFormat(OptionFormat.Seconds);
- ZombieSpeedReduce = FloatOptionItem.Create(16411, "ZombieSpeedReduce", new(0.0f, 1.0f, 0.1f), 0.1f, TabGroup.OtherRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Zombie])
- .SetValueFormat(OptionFormat.Multiplier);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -32,8 +20,8 @@ namespace TOHE.Roles.Impostor
public override void SetKillCooldown(byte id)
{
- Main.AllPlayerKillCooldown[id] = ZombieKillCooldown.GetFloat();
- Main.AllPlayerSpeed[id] = Math.Clamp(Main.AllPlayerSpeed[id] - ZombieSpeedReduce.GetFloat(), 0.1f, 3f);
+ Main.AllPlayerKillCooldown[id] = Options.ZombieKillCooldown.GetFloat();
+ Main.AllPlayerSpeed[id] = Math.Clamp(Main.AllPlayerSpeed[id] - Options.ZombieSpeedReduce.GetFloat(), 0.1f, 3f);
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
diff --git a/Roles/Neutral/Agitater.cs b/Roles/Neutral/Agitater.cs
index 0d1f83cd1..9f0075efa 100644
--- a/Roles/Neutral/Agitater.cs
+++ b/Roles/Neutral/Agitater.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using UnityEngine;
diff --git a/Roles/Neutral/Amnesiac.cs b/Roles/Neutral/Amnesiac.cs
index 1fa99d0eb..405801116 100644
--- a/Roles/Neutral/Amnesiac.cs
+++ b/Roles/Neutral/Amnesiac.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Arsonist.cs b/Roles/Neutral/Arsonist.cs
index 8d67de39e..5bc11af7d 100644
--- a/Roles/Neutral/Arsonist.cs
+++ b/Roles/Neutral/Arsonist.cs
@@ -1,8 +1,7 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Neutral
{
@@ -11,25 +10,6 @@ namespace TOHE.Roles.Neutral
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(10400, TabGroup.NeutralRoles, CustomRoles.Arsonist);
- ArsonistDouseTime = FloatOptionItem.Create(10410, "ArsonistDouseTime", new(0f, 90f, 1f), 3f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Arsonist])
- .SetValueFormat(OptionFormat.Seconds);
- ArsonistCooldown = FloatOptionItem.Create(10411, "Cooldown", new(0f, 60f, 1f), 10f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Arsonist])
- .SetValueFormat(OptionFormat.Seconds);
- ArsonistCanIgniteAnytime = BooleanOptionItem.Create(10413, "ArsonistCanIgniteAnytime", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Arsonist]);
- ArsonistMinPlayersToIgnite = IntegerOptionItem.Create(10414, "ArsonistMinPlayersToIgnite", new(1, 14, 1), 1, TabGroup.NeutralRoles, false)
- .SetParent(ArsonistCanIgniteAnytime);
- ArsonistMaxPlayersToIgnite = IntegerOptionItem.Create(10415, "ArsonistMaxPlayersToIgnite", new(1, 14, 1), 3, TabGroup.NeutralRoles, false)
- .SetParent(ArsonistCanIgniteAnytime);
- ArsonistKeepsGameGoing = BooleanOptionItem.Create(10412, "ArsonistKeepsGameGoing", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Arsonist]);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -46,17 +26,17 @@ namespace TOHE.Roles.Neutral
public override bool CanUseKillButton(PlayerControl pc)
{
- return ArsonistCanIgniteAnytime.GetBool() ? Utils.GetDousedPlayerCount(pc.PlayerId).Item1 < ArsonistMaxPlayersToIgnite.GetInt() : !pc.IsDouseDone();
+ return Options.ArsonistCanIgniteAnytime.GetBool() ? Utils.GetDousedPlayerCount(pc.PlayerId).Item1 < Options.ArsonistMaxPlayersToIgnite.GetInt() : !pc.IsDouseDone();
}
public override bool CanUseImpostorVentButton(PlayerControl pc)
{
- return pc.IsDouseDone() || (ArsonistCanIgniteAnytime.GetBool() && (Utils.GetDousedPlayerCount(pc.PlayerId).Item1 >= ArsonistMinPlayersToIgnite.GetInt() || pc.inVent));
+ return pc.IsDouseDone() || (Options.ArsonistCanIgniteAnytime.GetBool() && (Utils.GetDousedPlayerCount(pc.PlayerId).Item1 >= Options.ArsonistMinPlayersToIgnite.GetInt() || pc.inVent));
}
public override void SetKillCooldown(byte id)
{
- Main.AllPlayerKillCooldown[id] = ArsonistCooldown.GetFloat();
+ Main.AllPlayerKillCooldown[id] = Options.ArsonistCooldown.GetFloat();
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
@@ -67,12 +47,12 @@ namespace TOHE.Roles.Neutral
public override string GetProgressText(byte playerId, bool comms)
{
var doused = Utils.GetDousedPlayerCount(playerId);
- return Utils.ColorString(Utils.GetRoleColor(CustomRoles.Arsonist).ShadeColor(0.25f), !ArsonistCanIgniteAnytime.GetBool() ? $"- {doused.Item1}/{doused.Item2}" : $"- {doused.Item1}/{ArsonistMaxPlayersToIgnite.GetInt()}");
+ return Utils.ColorString(Utils.GetRoleColor(CustomRoles.Arsonist).ShadeColor(0.25f), !Options.ArsonistCanIgniteAnytime.GetBool() ? $"- {doused.Item1}/{doused.Item2}" : $"- {doused.Item1}/{Options.ArsonistMaxPlayersToIgnite.GetInt()}");
}
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
- killer.SetKillCooldown(ArsonistDouseTime.GetFloat());
+ killer.SetKillCooldown(Options.ArsonistDouseTime.GetFloat());
if (!Main.isDoused[(killer.PlayerId, target.PlayerId)] && !Main.ArsonistTimer.ContainsKey(killer.PlayerId))
{
Main.ArsonistTimer.Add(killer.PlayerId, (target, 0f));
@@ -119,15 +99,16 @@ namespace TOHE.Roles.Neutral
return;
}
- if (ArsonistCanIgniteAnytime.GetBool())
+ if (Options.ArsonistCanIgniteAnytime.GetBool())
{
var douseCount = Utils.GetDousedPlayerCount(physics.myPlayer.PlayerId).Item1;
- if (douseCount >= ArsonistMinPlayersToIgnite.GetInt()) // Don't check for max, since the player would not be able to ignite at all if they somehow get more players doused than the max
+ if (douseCount >= Options.ArsonistMinPlayersToIgnite.GetInt()) // Don't check for max, since the player would not be able to ignite at all if they somehow get more players doused than the max
{
- if (douseCount > ArsonistMaxPlayersToIgnite.GetInt()) Logger.Warn("Arsonist Ignited with more players doused than the maximum amount in the settings", "Arsonist Ignite");
+ if (douseCount > Options.ArsonistMaxPlayersToIgnite.GetInt()) Logger.Warn("Arsonist Ignited with more players doused than the maximum amount in the settings", "Arsonist Ignite");
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
{
- if (!physics.myPlayer.IsDousedPlayer(pc)) continue;
+ if (!physics.myPlayer.IsDousedPlayer(pc))
+ continue;
pc.KillFlash();
pc.Suicide(PlayerState.DeathReason.Torched, physics.myPlayer);
}
@@ -139,14 +120,19 @@ namespace TOHE.Roles.Neutral
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Arsonist);
CustomWinnerHolder.WinnerIds.Add(physics.myPlayer.PlayerId);
break;
- default:
- if (Main.AllAlivePlayerControls.Where(x => x.PlayerId != physics.myPlayer.PlayerId).All(x => x.GetCountTypes() == CountTypes.Crew))
+ case 2:
+ {
+ foreach (var x in Main.AllAlivePlayerControls.Where(p => p.PlayerId != physics.myPlayer.PlayerId).ToArray())
{
- CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Arsonist);
- CustomWinnerHolder.WinnerIds.Add(physics.myPlayer.PlayerId);
+ if (!x.GetCustomRole().IsImpostor() && !x.GetCustomRole().IsNeutralKilling())
+ {
+ CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Arsonist);
+ CustomWinnerHolder.WinnerIds.Add(physics.myPlayer.PlayerId);
+ }
}
break;
+ }
}
}
}
@@ -172,7 +158,7 @@ namespace TOHE.Roles.Neutral
{
Main.ArsonistTimer.Remove(playerId);
}
- else if (ar_time >= ArsonistDouseTime.GetFloat())
+ else if (ar_time >= Options.ArsonistDouseTime.GetFloat())
{
player.SetKillCooldown();
Main.ArsonistTimer.Remove(playerId);
diff --git a/Roles/Neutral/Bandit.cs b/Roles/Neutral/Bandit.cs
index 97da77322..37b109e79 100644
--- a/Roles/Neutral/Bandit.cs
+++ b/Roles/Neutral/Bandit.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Neutral/Bubble.cs b/Roles/Neutral/Bubble.cs
index ec24ecfaa..6c934c90f 100644
--- a/Roles/Neutral/Bubble.cs
+++ b/Roles/Neutral/Bubble.cs
@@ -1,8 +1,8 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
@@ -26,7 +26,6 @@ namespace TOHE.Roles.Neutral
private static OptionItem ExplosionRadius;
public static readonly Dictionary EncasedPlayers = [];
- private static readonly Dictionary LastUpdates = [];
public static void SetupCustomOption()
{
@@ -55,7 +54,6 @@ namespace TOHE.Roles.Neutral
{
BubbleId = byte.MaxValue;
EncasedPlayers.Clear();
- LastUpdates.Clear();
}
public override void Add(byte playerId)
@@ -144,11 +142,7 @@ namespace TOHE.Roles.Neutral
if (ts + NotifyDelay.GetInt() < now)
{
- Main.AllAlivePlayerControls.Where(x => (!LastUpdates.TryGetValue(x.PlayerId, out var la) || la != now) && Vector2.Distance(x.Pos(), encasedPc.Pos()) < 5f).Do(x =>
- {
- NotifyRoles(SpecifySeer: x, SpecifyTarget: encasedPc);
- LastUpdates[x.PlayerId] = now;
- });
+ Main.AllAlivePlayerControls.Where(x => Vector2.Distance(x.Pos(), encasedPc.Pos()) < 5f).Do(x => NotifyRoles(SpecifySeer: x, SpecifyTarget: encasedPc));
}
}
diff --git a/Roles/Neutral/Collector.cs b/Roles/Neutral/Collector.cs
index 9e5884b7d..b152eb1fa 100644
--- a/Roles/Neutral/Collector.cs
+++ b/Roles/Neutral/Collector.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using TOHE.Patches;
diff --git a/Roles/Neutral/DarkHide.cs b/Roles/Neutral/DarkHide.cs
index 856339570..0d6f2833f 100644
--- a/Roles/Neutral/DarkHide.cs
+++ b/Roles/Neutral/DarkHide.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
using InnerNet;
+using System.Collections.Generic;
using TOHE.Modules;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/Doomsayer.cs b/Roles/Neutral/Doomsayer.cs
index 7b2fb3076..4c10d5f0d 100644
--- a/Roles/Neutral/Doomsayer.cs
+++ b/Roles/Neutral/Doomsayer.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using Hazel;
+using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
diff --git a/Roles/Neutral/Doppelganger.cs b/Roles/Neutral/Doppelganger.cs
index 4486e8482..5d3294449 100644
--- a/Roles/Neutral/Doppelganger.cs
+++ b/Roles/Neutral/Doppelganger.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using Hazel;
+using System.Collections.Generic;
using System.Linq;
-using Hazel;
using TOHE.Modules;
using TOHE.Roles.Impostor;
using UnityEngine;
@@ -35,12 +35,12 @@ public class Doppelganger : RoleBase
public static void SetupCustomOption()
{
- SetupSingleRoleOptions(Id, TabGroup.OtherRoles, CustomRoles.Doppelganger, 1, zeroOne: false);
- MaxSteals = IntegerOptionItem.Create(Id + 10, "DoppelMaxSteals", new(1, 14, 1), 9, TabGroup.OtherRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger]);
- KillCooldown = FloatOptionItem.Create(Id + 11, "KillCooldown", new(0f, 180f, 2.5f), 20f, TabGroup.OtherRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger])
+ SetupSingleRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Doppelganger, 1, zeroOne: false);
+ MaxSteals = IntegerOptionItem.Create(Id + 10, "DoppelMaxSteals", new(1, 14, 1), 9, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger]);
+ KillCooldown = FloatOptionItem.Create(Id + 11, "KillCooldown", new(0f, 180f, 2.5f), 20f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger])
.SetValueFormat(OptionFormat.Seconds);
- ResetMode = StringOptionItem.Create(Id + 12, "DGResetMode", ResetModes, 0, TabGroup.OtherRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger]);
- ResetTimer = FloatOptionItem.Create(Id + 13, "DGResetTimer", new(0f, 60f, 1f), 30f, TabGroup.OtherRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger])
+ ResetMode = StringOptionItem.Create(Id + 12, "DGResetMode", ResetModes, 0, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger]);
+ ResetTimer = FloatOptionItem.Create(Id + 13, "DGResetTimer", new(0f, 60f, 1f), 30f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Doppelganger])
.SetValueFormat(OptionFormat.Seconds);
}
@@ -106,15 +106,16 @@ public class Doppelganger : RoleBase
return instance;
}
- static void RpcChangeSkin(PlayerControl pc, GameData.PlayerOutfit newOutfit)
+ void RpcChangeSkin(PlayerControl pc, GameData.PlayerOutfit newOutfit)
{
+ if (!IsEnable) return;
var sender = CustomRpcSender.Create(name: $"Doppelganger.RpcChangeSkin({pc.Data.PlayerName})");
-
+ //if (pc.PlayerId == PlayerControl.LocalPlayer.PlayerId) Main.nickName = newOutfit.PlayerName;
pc.SetName(newOutfit.PlayerName);
sender.AutoStartRpc(pc.NetId, (byte)RpcCalls.SetName)
.Write(newOutfit.PlayerName)
.EndRpc();
-
+ //pc.RpcSetName(newOutfit.PlayerName);
Main.AllPlayerNames[pc.PlayerId] = newOutfit.PlayerName;
pc.SetColor(newOutfit.ColorId);
@@ -151,9 +152,9 @@ public class Doppelganger : RoleBase
DoppelPresentSkin[pc.PlayerId] = newOutfit;
}
- public static bool OnCheckMurderEnd(PlayerControl killer, PlayerControl target)
+ public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
- if (killer == null || target == null || Camouflage.IsCamouflage || Camouflager.IsActive || Main.PlayerStates[killer.PlayerId].Role is not Doppelganger { IsEnable: true } dg) return true;
+ if (killer == null || target == null || !IsEnable || Camouflage.IsCamouflage || Camouflager.IsActive) return true;
if (target.IsShifted())
{
Logger.Info("Target was shapeshifting", "Doppelganger");
@@ -168,7 +169,7 @@ public class Doppelganger : RoleBase
TotalSteals[killer.PlayerId]++;
- dg.StealTimeStamp = Utils.TimeStamp;
+ StealTimeStamp = Utils.TimeStamp;
string kname;
if (killer.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.nickName.Length != 0) kname = Main.nickName;
@@ -183,12 +184,13 @@ public class Doppelganger : RoleBase
DoppelVictim[target.PlayerId] = tname;
+
RpcChangeSkin(target, killerSkin);
Logger.Info("Changed target skin", "Doppelganger");
RpcChangeSkin(killer, targetSkin);
Logger.Info("Changed killer skin", "Doppelganger");
- dg.SendRPC(killer.PlayerId);
+ SendRPC(killer.PlayerId);
Utils.NotifyRoles();
killer.ResetKillCooldown();
killer.SetKillCooldown();
@@ -206,7 +208,6 @@ public class Doppelganger : RoleBase
{
RpcChangeSkin(currentTarget, DoppelPresentSkin[currentTarget.PlayerId]);
RpcChangeSkin(pc, DoppelDefaultSkin[pc.PlayerId]);
- DoppelVictim[pc.PlayerId] = string.Empty;
}
}
}
@@ -221,10 +222,11 @@ public class Doppelganger : RoleBase
RpcChangeSkin(currentTarget, DoppelPresentSkin[currentTarget.PlayerId]);
RpcChangeSkin(pc, DoppelDefaultSkin[pc.PlayerId]);
DoppelVictim[pc.PlayerId] = string.Empty;
- if (GameStates.IsInTask)
- {
- Utils.NotifyRoles();
- }
+ }
+
+ if (GameStates.IsInTask)
+ {
+ Utils.NotifyRoles();
}
}
}
diff --git a/Roles/Neutral/Eclipse.cs b/Roles/Neutral/Eclipse.cs
index b59bdaf03..16999cff0 100644
--- a/Roles/Neutral/Eclipse.cs
+++ b/Roles/Neutral/Eclipse.cs
@@ -1,6 +1,6 @@
+using AmongUs.GameOptions;
using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using static TOHE.Options;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/Executioner.cs b/Roles/Neutral/Executioner.cs
index 9d25ce0e5..3d598f9c0 100644
--- a/Roles/Neutral/Executioner.cs
+++ b/Roles/Neutral/Executioner.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
+using Hazel;
using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Neutral/FFF.cs b/Roles/Neutral/FFF.cs
index 8e8979254..94c7de084 100644
--- a/Roles/Neutral/FFF.cs
+++ b/Roles/Neutral/FFF.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using static TOHE.Options;
namespace TOHE.Roles.Neutral
diff --git a/Roles/Neutral/Gamer.cs b/Roles/Neutral/Gamer.cs
index a257d4389..be95da0fc 100644
--- a/Roles/Neutral/Gamer.cs
+++ b/Roles/Neutral/Gamer.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Neutral/Glitch.cs b/Roles/Neutral/Glitch.cs
index d393f5094..69021a6ac 100644
--- a/Roles/Neutral/Glitch.cs
+++ b/Roles/Neutral/Glitch.cs
@@ -1,9 +1,9 @@
+using AmongUs.GameOptions;
+using Hazel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Neutral/HeadHunter.cs b/Roles/Neutral/HeadHunter.cs
index 83d96cd5b..c109f74bd 100644
--- a/Roles/Neutral/HeadHunter.cs
+++ b/Roles/Neutral/HeadHunter.cs
@@ -1,8 +1,8 @@
+using AmongUs.GameOptions;
+using Hazel;
using System;
using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Neutral/Jackal.cs b/Roles/Neutral/Jackal.cs
index 7cabce8fa..3531f79f2 100644
--- a/Roles/Neutral/Jackal.cs
+++ b/Roles/Neutral/Jackal.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
+using System.Collections.Generic;
+using System.Linq;
using static TOHE.Options;
using static TOHE.Translator;
@@ -53,7 +53,7 @@ public class Jackal : RoleBase
CanRecruitSidekick = BooleanOptionItem.Create(Id + 17, "JackalCanRecruitSidekick", false, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
SidekickAssignMode = StringOptionItem.Create(Id + 29, "SidekickAssignMode", SidekickAssignModeStrings, 0, TabGroup.NeutralRoles, false).SetParent(CanRecruitSidekick);
SidekickRecruitLimitOpt = IntegerOptionItem.Create(Id + 18, "JackalSidekickRecruitLimit", new(0, 15, 1), 0, TabGroup.NeutralRoles, false).SetParent(CanRecruitSidekick)
- .SetValueFormat(OptionFormat.Times);
+ .SetValueFormat(OptionFormat.Times);
KillCooldownSK = FloatOptionItem.Create(Id + 20, "KillCooldown", new(0f, 180f, 2.5f), 20f, TabGroup.NeutralRoles, false).SetParent(CanRecruitSidekick)
.SetValueFormat(OptionFormat.Seconds);
CanVentSK = BooleanOptionItem.Create(Id + 21, "CanVent", true, TabGroup.NeutralRoles, false).SetParent(CanRecruitSidekick);
@@ -135,6 +135,7 @@ public class Jackal : RoleBase
return true;
}
}
+
if (SidekickAssignMode.GetValue() != 1)
{
if (!CanBeSidekick(target) && !target.Is(CustomRoles.Sidekick) && !target.Is(CustomRoles.Recruit) && !target.Is(CustomRoles.Loyal))
diff --git a/Roles/Neutral/Lawyer.cs b/Roles/Neutral/Lawyer.cs
index 007d0fbb1..791b65a29 100644
--- a/Roles/Neutral/Lawyer.cs
+++ b/Roles/Neutral/Lawyer.cs
@@ -1,8 +1,8 @@
+using HarmonyLib;
+using Hazel;
using System;
using System.Collections.Generic;
using System.Linq;
-using HarmonyLib;
-using Hazel;
using TOHE.Modules;
using static TOHE.Options;
diff --git a/Roles/Neutral/Magician.cs b/Roles/Neutral/Magician.cs
index 265885774..c75afa0ee 100644
--- a/Roles/Neutral/Magician.cs
+++ b/Roles/Neutral/Magician.cs
@@ -1,7 +1,7 @@
+using AmongUs.GameOptions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using UnityEngine;
diff --git a/Roles/Neutral/Mario.cs b/Roles/Neutral/Mario.cs
index 87e3c8d49..a5118dfb3 100644
--- a/Roles/Neutral/Mario.cs
+++ b/Roles/Neutral/Mario.cs
@@ -1,7 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Neutral
{
@@ -10,17 +9,6 @@ namespace TOHE.Roles.Neutral
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(18300, TabGroup.OtherRoles, CustomRoles.Mario);
- MarioVentNumWin = IntegerOptionItem.Create(18310, "MarioVentNumWin", new(0, 900, 5), 40, TabGroup.OtherRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Mario])
- .SetValueFormat(OptionFormat.Times);
- MarioVentCD = FloatOptionItem.Create(18311, "VentCooldown", new(0f, 180f, 1f), 15f, TabGroup.OtherRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Mario])
- .SetValueFormat(OptionFormat.Seconds);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -34,27 +22,27 @@ namespace TOHE.Roles.Neutral
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- AURoleOptions.EngineerCooldown = MarioVentCD.GetFloat();
+ AURoleOptions.EngineerCooldown = Options.MarioVentCD.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 1f;
}
public override string GetProgressText(byte playerId, bool comms)
{
- return Utils.ColorString(Color.white, $"- {Main.MarioVentCount.GetValueOrDefault(playerId, 0)}/{MarioVentNumWin.GetInt()}");
+ return Utils.ColorString(Color.white, $"- {Main.MarioVentCount.GetValueOrDefault(playerId, 0)}/{Options.MarioVentNumWin.GetInt()}");
}
public override void SetButtonTexts(HudManager hud, byte id)
{
hud.AbilityButton.buttonLabelText.text = Translator.GetString("MarioVentButtonText");
- hud.AbilityButton?.SetUsesRemaining(MarioVentNumWin.GetInt() - Main.MarioVentCount.GetValueOrDefault(id, 0));
+ hud.AbilityButton?.SetUsesRemaining(Options.MarioVentNumWin.GetInt() - (Main.MarioVentCount.GetValueOrDefault(id, 0)));
}
public override void OnFixedUpdate(PlayerControl pc)
{
var playerId = pc.PlayerId;
- if (Main.MarioVentCount[playerId] > MarioVentNumWin.GetInt() && GameStates.IsInTask)
+ if (Main.MarioVentCount[playerId] > Options.MarioVentNumWin.GetInt() && GameStates.IsInTask)
{
- Main.MarioVentCount[playerId] = MarioVentNumWin.GetInt();
+ Main.MarioVentCount[playerId] = Options.MarioVentNumWin.GetInt();
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Mario);
CustomWinnerHolder.WinnerIds.Add(playerId);
}
@@ -66,7 +54,7 @@ namespace TOHE.Roles.Neutral
Main.MarioVentCount[pc.PlayerId]++;
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
- if (AmongUsClient.Instance.AmHost && Main.MarioVentCount[pc.PlayerId] >= MarioVentNumWin.GetInt())
+ if (AmongUsClient.Instance.AmHost && Main.MarioVentCount[pc.PlayerId] >= Options.MarioVentNumWin.GetInt())
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Mario); //马里奥这个多动症赢了
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
diff --git a/Roles/Neutral/Mycologist.cs b/Roles/Neutral/Mycologist.cs
index 301dd0a67..c0e4621f1 100644
--- a/Roles/Neutral/Mycologist.cs
+++ b/Roles/Neutral/Mycologist.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/NSerialKiller.cs b/Roles/Neutral/NSerialKiller.cs
index 97e76fdba..074440370 100644
--- a/Roles/Neutral/NSerialKiller.cs
+++ b/Roles/Neutral/NSerialKiller.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/Necromancer.cs b/Roles/Neutral/Necromancer.cs
index 168c81115..8091d5716 100644
--- a/Roles/Neutral/Necromancer.cs
+++ b/Roles/Neutral/Necromancer.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
@@ -193,4 +193,4 @@ namespace TOHE.Roles.Neutral
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Neutral/Pelican.cs b/Roles/Neutral/Pelican.cs
index ea625a7ea..1cabd7bf5 100644
--- a/Roles/Neutral/Pelican.cs
+++ b/Roles/Neutral/Pelican.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System;
+using System.Collections.Generic;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using UnityEngine;
@@ -16,6 +16,7 @@ public class Pelican : RoleBase
private static readonly Dictionary OriginalSpeed = [];
public static OptionItem KillCooldown;
public static OptionItem CanVent;
+
public static void SetupCustomOption()
{
Options.SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Pelican);
@@ -48,12 +49,13 @@ public class Pelican : RoleBase
Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
}
- private static void SyncEatenList(/*byte playerId*/)
+ private static void SyncEatenList( /*byte playerId*/)
{
SendRPC(byte.MaxValue);
foreach (var el in eatenList)
SendRPC(el.Key);
}
+
private static void SendRPC(byte playerId)
{
if (!Utils.DoRPC) return;
@@ -67,8 +69,10 @@ public class Pelican : RoleBase
writer.Write(el);
}
}
+
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte playerId = reader.ReadByte();
@@ -86,7 +90,9 @@ public class Pelican : RoleBase
eatenList.Add(playerId, list);
}
}
+
public static bool IsEaten(PlayerControl pc, byte id) => eatenList.ContainsKey(pc.PlayerId) && eatenList[pc.PlayerId].Contains(id);
+
public static bool IsEaten(byte id)
{
foreach (var el in eatenList)
@@ -94,12 +100,14 @@ public class Pelican : RoleBase
return true;
return false;
}
+
public static bool CanEat(PlayerControl pc, byte id)
{
if (!pc.Is(CustomRoles.Pelican) || GameStates.IsMeeting) return false;
var target = Utils.GetPlayerById(id);
return target != null && target.IsAlive() && !target.inVent && !Medic.ProtectList.Contains(target.PlayerId) && !target.Is(CustomRoles.GM) && !IsEaten(pc, id) && !IsEaten(id);
}
+
public static Vector2 GetBlackRoomPS()
{
return Main.NormalOptions.MapId switch
@@ -123,13 +131,14 @@ public class Pelican : RoleBase
eatenNum = value.Count;
return Utils.ColorString(eatenNum < 1 ? Color.gray : Utils.GetRoleColor(CustomRoles.Pelican), $"({eatenNum})");
}
+
public static void EatPlayer(PlayerControl pc, PlayerControl target)
{
if (pc == null || target == null || !CanEat(pc, target.PlayerId)) return;
if (!eatenList.ContainsKey(pc.PlayerId)) eatenList.Add(pc.PlayerId, []);
eatenList[pc.PlayerId].Add(target.PlayerId);
- SyncEatenList(/*pc.PlayerId*/);
+ SyncEatenList( /*pc.PlayerId*/);
OriginalSpeed.Remove(target.PlayerId);
OriginalSpeed.Add(target.PlayerId, Main.AllPlayerSpeed[target.PlayerId]);
@@ -163,8 +172,9 @@ public class Pelican : RoleBase
Logger.Info($"{killer.GetRealName()} 消化了 {target.GetRealName()}", "Pelican");
}
}
+
eatenList.Clear();
- SyncEatenList(/*byte.MaxValue*/);
+ SyncEatenList( /*byte.MaxValue*/);
}
public static void OnPelicanDied(byte pc)
@@ -184,8 +194,9 @@ public class Pelican : RoleBase
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: player);
Logger.Info($"{Utils.GetPlayerById(pc).GetRealName()} 吐出了 {target.GetRealName()}", "Pelican");
}
+
eatenList.Remove(pc);
- SyncEatenList(/*pc*/);
+ SyncEatenList( /*pc*/);
}
private int Count;
@@ -197,8 +208,9 @@ public class Pelican : RoleBase
if (eatenList.Count > 0)
{
eatenList.Clear();
- SyncEatenList(/*byte.MaxValue*/);
+ SyncEatenList( /*byte.MaxValue*/);
}
+
return;
}
diff --git a/Roles/Neutral/Phantom.cs b/Roles/Neutral/Phantom.cs
new file mode 100644
index 000000000..863e00765
--- /dev/null
+++ b/Roles/Neutral/Phantom.cs
@@ -0,0 +1,19 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Neutral
+{
+ internal static class Phantom
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(11400, TabGroup.NeutralRoles, CustomRoles.Phantom);
+ PhantomCanVent = BooleanOptionItem.Create(11410, "CanVent", false, TabGroup.NeutralRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
+ PhantomSnatchesWin = BooleanOptionItem.Create(11411, "SnatchesWin", false, TabGroup.NeutralRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
+ PhantomCanGuess = BooleanOptionItem.Create(11412, "CanGuess", false, TabGroup.NeutralRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Phantom]);
+ PhantomTasks = OverrideTasksData.Create(11413, TabGroup.NeutralRoles, CustomRoles.Phantom);
+ }
+ }
+}
diff --git a/Roles/Neutral/Pickpocket.cs b/Roles/Neutral/Pickpocket.cs
index afad06f48..e357d5bfc 100644
--- a/Roles/Neutral/Pickpocket.cs
+++ b/Roles/Neutral/Pickpocket.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/PlagueBearer.cs b/Roles/Neutral/PlagueBearer.cs
index 478584461..976c1b927 100644
--- a/Roles/Neutral/PlagueBearer.cs
+++ b/Roles/Neutral/PlagueBearer.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
@@ -25,9 +25,9 @@ public class PlagueBearer : RoleBase
{
SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.PlagueBearer);
PlagueBearerCDOpt = FloatOptionItem.Create(Id + 10, "PlagueBearerCD", new(0f, 180f, 2.5f), 17.5f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.PlagueBearer])
- .SetValueFormat(OptionFormat.Seconds);
+ .SetValueFormat(OptionFormat.Seconds);
PestilenceCDOpt = FloatOptionItem.Create(Id + 11, "PestilenceCD", new(0f, 180f, 2.5f), 22.5f, TabGroup.NeutralRoles, false).SetParent(CustomRoleSpawnChances[CustomRoles.PlagueBearer])
- .SetValueFormat(OptionFormat.Seconds);
+ .SetValueFormat(OptionFormat.Seconds);
PestilenceCanVent = BooleanOptionItem.Create(Id + 12, "PestilenceCanVent", true, TabGroup.NeutralRoles, false)
.SetParent(CustomRoleSpawnChances[CustomRoles.PlagueBearer]);
PestilenceHasImpostorVision = BooleanOptionItem.Create(Id + 13, "PestilenceHasImpostorVision", true, TabGroup.NeutralRoles, false)
@@ -59,6 +59,7 @@ public class PlagueBearer : RoleBase
public override bool CanUseImpostorVentButton(PlayerControl pc) => false;
public static bool IsPlagued(byte pc, byte target) => PlaguedList.TryGetValue(pc, out var x) && x.Contains(target);
+
public static void SendRPC(PlayerControl player, PlayerControl target)
{
if (!Utils.DoRPC) return;
@@ -67,6 +68,7 @@ public class PlagueBearer : RoleBase
writer.Write(target.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte PlagueBearerId = reader.ReadByte();
@@ -85,6 +87,7 @@ public class PlagueBearer : RoleBase
if (IsPlagued(playerId, pc.PlayerId))
plagued++;
}
+
return (plagued, all);
}
@@ -102,6 +105,7 @@ public class PlagueBearer : RoleBase
killer.Notify(GetString("PlagueBearerAlreadyPlagued"));
return false;
}
+
PlaguedList[killer.PlayerId].Add(target.PlayerId);
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
killer.ResetKillCooldown();
diff --git a/Roles/Neutral/PlagueDoctor.cs b/Roles/Neutral/PlagueDoctor.cs
index 64f8ce004..039a34fb7 100644
--- a/Roles/Neutral/PlagueDoctor.cs
+++ b/Roles/Neutral/PlagueDoctor.cs
@@ -1,9 +1,9 @@
-using System;
+using AmongUs.GameOptions;
+using Hazel;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using AmongUs.GameOptions;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
@@ -311,4 +311,4 @@ namespace TOHE.Roles.Neutral
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Neutral/Postman.cs b/Roles/Neutral/Postman.cs
index ed548971f..a7b3d15d0 100644
--- a/Roles/Neutral/Postman.cs
+++ b/Roles/Neutral/Postman.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Text;
-using AmongUs.GameOptions;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Pyromaniac.cs b/Roles/Neutral/Pyromaniac.cs
index 91afe30e0..510025b22 100644
--- a/Roles/Neutral/Pyromaniac.cs
+++ b/Roles/Neutral/Pyromaniac.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/Revolutionist.cs b/Roles/Neutral/Revolutionist.cs
index 59c79edc0..62b91d7e6 100644
--- a/Roles/Neutral/Revolutionist.cs
+++ b/Roles/Neutral/Revolutionist.cs
@@ -1,8 +1,7 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
-using static TOHE.Options;
namespace TOHE.Roles.Neutral
{
@@ -11,26 +10,6 @@ namespace TOHE.Roles.Neutral
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(18400, TabGroup.NeutralRoles, CustomRoles.Revolutionist);
- RevolutionistDrawTime = FloatOptionItem.Create(18410, "RevolutionistDrawTime", new(0f, 90f, 1f), 3f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Revolutionist])
- .SetValueFormat(OptionFormat.Seconds);
- RevolutionistCooldown = FloatOptionItem.Create(18411, "RevolutionistCooldown", new(0f, 100f, 1f), 10f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Revolutionist])
- .SetValueFormat(OptionFormat.Seconds);
- RevolutionistDrawCount = IntegerOptionItem.Create(18412, "RevolutionistDrawCount", new(0, 14, 1), 6, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Revolutionist])
- .SetValueFormat(OptionFormat.Players);
- RevolutionistKillProbability = IntegerOptionItem.Create(18413, "RevolutionistKillProbability", new(0, 100, 5), 15, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Revolutionist])
- .SetValueFormat(OptionFormat.Percent);
- RevolutionistVentCountDown = FloatOptionItem.Create(18414, "RevolutionistVentCountDown", new(0f, 180f, 1f), 15f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Revolutionist])
- .SetValueFormat(OptionFormat.Seconds);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -62,7 +41,7 @@ namespace TOHE.Roles.Neutral
public override void SetKillCooldown(byte id)
{
- Main.AllPlayerKillCooldown[id] = RevolutionistCooldown.GetFloat();
+ Main.AllPlayerKillCooldown[id] = Options.RevolutionistCooldown.GetFloat();
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
@@ -88,7 +67,7 @@ namespace TOHE.Roles.Neutral
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
- killer.SetKillCooldown(RevolutionistDrawTime.GetFloat());
+ killer.SetKillCooldown(Options.RevolutionistDrawTime.GetFloat());
if (!Main.isDraw[(killer.PlayerId, target.PlayerId)] && !Main.RevolutionistTimer.ContainsKey(killer.PlayerId))
{
Main.RevolutionistTimer.TryAdd(killer.PlayerId, (target, 0f));
@@ -137,7 +116,7 @@ namespace TOHE.Roles.Neutral
{
Main.RevolutionistTimer.Remove(playerId);
}
- else if (rv_time >= RevolutionistDrawTime.GetFloat())
+ else if (rv_time >= Options.RevolutionistDrawTime.GetFloat())
{
player.SetKillCooldown();
Main.RevolutionistTimer.Remove(playerId);
@@ -145,7 +124,7 @@ namespace TOHE.Roles.Neutral
player.RpcSetDrawPlayer(rv_target, true);
Utils.NotifyRoles(SpecifySeer: player, SpecifyTarget: rv_target, ForceLoop: true);
RPC.ResetCurrentDrawTarget(playerId);
- if (IRandom.Instance.Next(1, 100) <= RevolutionistKillProbability.GetInt())
+ if (IRandom.Instance.Next(1, 100) <= Options.RevolutionistKillProbability.GetInt())
{
rv_target.SetRealKiller(player);
Main.PlayerStates[rv_target.PlayerId].deathReason = PlayerState.DeathReason.Sacrifice;
@@ -183,7 +162,7 @@ namespace TOHE.Roles.Neutral
long nowtime = Utils.TimeStamp;
Main.RevolutionistLastTime[playerId] = nowtime;
int time = (int)(Main.RevolutionistLastTime[playerId] - Main.RevolutionistStart[playerId]);
- int countdown = RevolutionistVentCountDown.GetInt() - time;
+ int countdown = Options.RevolutionistVentCountDown.GetInt() - time;
Main.RevolutionistCountdown.Clear();
if (countdown <= 0)
{
diff --git a/Roles/Neutral/Romantic.cs b/Roles/Neutral/Romantic.cs
index 69c0fe4ea..7a228aef9 100644
--- a/Roles/Neutral/Romantic.cs
+++ b/Roles/Neutral/Romantic.cs
@@ -1,6 +1,6 @@
+using Hazel;
using System;
using System.Collections.Generic;
-using Hazel;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Neutral/Sidekick.cs b/Roles/Neutral/Sidekick.cs
index d39aecadf..2ee354cde 100644
--- a/Roles/Neutral/Sidekick.cs
+++ b/Roles/Neutral/Sidekick.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/SoulHunter.cs b/Roles/Neutral/SoulHunter.cs
index c0aab914f..9c7e1e1f5 100644
--- a/Roles/Neutral/SoulHunter.cs
+++ b/Roles/Neutral/SoulHunter.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System;
+using System.Linq;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Spiritcaller.cs b/Roles/Neutral/Spiritcaller.cs
index fa254b88f..2723b2faf 100644
--- a/Roles/Neutral/Spiritcaller.cs
+++ b/Roles/Neutral/Spiritcaller.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using TOHE.Modules;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Sprayer.cs b/Roles/Neutral/Sprayer.cs
index 662ea14be..304df5c29 100644
--- a/Roles/Neutral/Sprayer.cs
+++ b/Roles/Neutral/Sprayer.cs
@@ -1,6 +1,6 @@
-using System;
+using AmongUs.GameOptions;
+using System;
using System.Collections.Generic;
-using AmongUs.GameOptions;
using UnityEngine;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Succubus.cs b/Roles/Neutral/Succubus.cs
index b4a3004a3..54508ded1 100644
--- a/Roles/Neutral/Succubus.cs
+++ b/Roles/Neutral/Succubus.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using AmongUs.GameOptions;
+using System.Collections.Generic;
using System.Linq;
-using AmongUs.GameOptions;
using UnityEngine;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Terrorist.cs b/Roles/Neutral/Terrorist.cs
new file mode 100644
index 000000000..7041483db
--- /dev/null
+++ b/Roles/Neutral/Terrorist.cs
@@ -0,0 +1,17 @@
+using static TOHE.Options;
+
+namespace TOHE.Roles.Neutral
+{
+ internal static class Terrorist
+ {
+ public static void SetupCustomOption()
+ {
+ SetupRoleOptions(11500, TabGroup.NeutralRoles, CustomRoles.Terrorist);
+ CanTerroristSuicideWin = BooleanOptionItem.Create(11510, "CanTerroristSuicideWin", false, TabGroup.NeutralRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Terrorist]);
+ TerroristCanGuess = BooleanOptionItem.Create(11511, "CanGuess", true, TabGroup.NeutralRoles, false)
+ .SetParent(CustomRoleSpawnChances[CustomRoles.Terrorist]);
+ TerroristTasks = OverrideTasksData.Create(11512, TabGroup.NeutralRoles, CustomRoles.Terrorist);
+ }
+ }
+}
diff --git a/Roles/Neutral/Totocalcio.cs b/Roles/Neutral/Totocalcio.cs
index 4988605d5..bb5ecb71e 100644
--- a/Roles/Neutral/Totocalcio.cs
+++ b/Roles/Neutral/Totocalcio.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
using Hazel;
using Il2CppSystem;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
@@ -68,6 +68,7 @@ public class Totocalcio : RoleBase
writer.Write(BetPlayer);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
byte PlayerId = reader.ReadByte();
@@ -89,11 +90,13 @@ public class Totocalcio : RoleBase
Main.AllPlayerKillCooldown[id] = 300f;
return;
}
+
float cd = BetCooldown.GetFloat();
cd += Main.AllPlayerControls.Count(x => !x.IsAlive()) * BetCooldownIncrese.GetFloat();
cd = Math.Min(cd, MaxBetCooldown.GetFloat());
Main.AllPlayerKillCooldown[id] = cd;
}
+
public static bool KnowRole(PlayerControl player, PlayerControl target)
{
if (!KnowTargetRole.GetBool()) return false;
@@ -128,6 +131,7 @@ public class Totocalcio : RoleBase
Logger.Info($"Target selected:{killer.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "Totocalcio");
return false;
}
+
public static string TargetMark(PlayerControl seer, PlayerControl target)
{
if (!seer.Is(CustomRoles.Totocalcio))
diff --git a/Roles/Neutral/Traitor.cs b/Roles/Neutral/Traitor.cs
index c53a629a5..8d60360ed 100644
--- a/Roles/Neutral/Traitor.cs
+++ b/Roles/Neutral/Traitor.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
namespace TOHE.Roles.Neutral;
diff --git a/Roles/Neutral/Vengeance.cs b/Roles/Neutral/Vengeance.cs
index 7e7573cdc..8600e22fe 100644
--- a/Roles/Neutral/Vengeance.cs
+++ b/Roles/Neutral/Vengeance.cs
@@ -1,5 +1,5 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
+using System.Collections.Generic;
using static TOHE.Options;
using static TOHE.Translator;
diff --git a/Roles/Neutral/Virus.cs b/Roles/Neutral/Virus.cs
index a06e4a922..99af7dc59 100644
--- a/Roles/Neutral/Virus.cs
+++ b/Roles/Neutral/Virus.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Linq;
using TOHE.Modules;
using TOHE.Patches;
using static TOHE.Options;
diff --git a/Roles/Neutral/Vulture.cs b/Roles/Neutral/Vulture.cs
index 0966cdc18..a97a847cd 100644
--- a/Roles/Neutral/Vulture.cs
+++ b/Roles/Neutral/Vulture.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
diff --git a/Roles/Neutral/WeaponMaster.cs b/Roles/Neutral/WeaponMaster.cs
index f95aece99..bb9bc1e2b 100644
--- a/Roles/Neutral/WeaponMaster.cs
+++ b/Roles/Neutral/WeaponMaster.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
using TOHE.Modules;
using UnityEngine;
using static TOHE.Options;
@@ -75,6 +75,7 @@ public class WeaponMaster : RoleBase
writer.Write(shieldUsed);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
+
public static void ReceiveRPC(MessageReader reader)
{
var id = reader.ReadByte();
@@ -156,6 +157,7 @@ public class WeaponMaster : RoleBase
player.Suicide(PlayerState.DeathReason.Kill, killer);
}
}
+
killer.SetKillCooldown(time: HighKCD.GetFloat());
}, 0.1f, "Weapon Master Axe Kill");
return true;
@@ -165,6 +167,7 @@ public class WeaponMaster : RoleBase
target.Suicide(PlayerState.DeathReason.Kill, killer);
killer.SetKillCooldown();
}
+
return false;
case 3:
return false;
@@ -203,6 +206,7 @@ public class WeaponMaster : RoleBase
{
return Main.PlayerStates[id].Role is not WeaponMaster { IsEnable: true } wm ? string.Empty : string.Format(GetString("WMMode"), ModeToText(wm.Mode));
}
+
public static string ModeToText(byte mode)
{
return mode switch
@@ -214,4 +218,4 @@ public class WeaponMaster : RoleBase
_ => string.Empty,
};
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Neutral/Werewolf.cs b/Roles/Neutral/Werewolf.cs
index 9e90841a7..5e1c2860c 100644
--- a/Roles/Neutral/Werewolf.cs
+++ b/Roles/Neutral/Werewolf.cs
@@ -1,7 +1,7 @@
-using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using Hazel;
+using System.Collections.Generic;
+using System.Text;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
using static TOHE.Options;
@@ -152,6 +152,7 @@ public class Werewolf : RoleBase
}
}, 0.5f, "Werewolf Vent");
}
+
public static string GetHudText(PlayerControl pc)
{
if (pc == null || !GameStates.IsInTask || !PlayerControl.LocalPlayer.IsAlive() || Main.PlayerStates[pc.PlayerId].Role is not Werewolf { IsEnable: true } ww) return string.Empty;
@@ -170,6 +171,7 @@ public class Werewolf : RoleBase
{
str.Append(GetString("WWCanRampage"));
}
+
return str.ToString();
}
@@ -177,4 +179,4 @@ public class Werewolf : RoleBase
{
return !Medic.ProtectList.Contains(target.PlayerId) && IsRampaging;
}
-}
+}
\ No newline at end of file
diff --git a/Roles/Neutral/Workaholic.cs b/Roles/Neutral/Workaholic.cs
index f9cbb32c1..6a16e4689 100644
--- a/Roles/Neutral/Workaholic.cs
+++ b/Roles/Neutral/Workaholic.cs
@@ -1,7 +1,6 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
+using System.Linq;
using TOHE.Modules;
-using static TOHE.Options;
namespace TOHE.Roles.Neutral
{
@@ -10,23 +9,6 @@ namespace TOHE.Roles.Neutral
public static bool On;
public override bool IsEnable => On;
- public static void SetupCustomOption()
- {
- SetupRoleOptions(11700, TabGroup.NeutralRoles, CustomRoles.Workaholic); //TOH_Y
- WorkaholicCannotWinAtDeath = BooleanOptionItem.Create(11710, "WorkaholicCannotWinAtDeath", true, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Workaholic]);
- WorkaholicVentCooldown = FloatOptionItem.Create(11711, "VentCooldown", new(0f, 180f, 2.5f), 30f, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Workaholic])
- .SetValueFormat(OptionFormat.Seconds);
- WorkaholicVisibleToEveryone = BooleanOptionItem.Create(11712, "WorkaholicVisibleToEveryone", false, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Workaholic]);
- WorkaholicGiveAdviceAlive = BooleanOptionItem.Create(11713, "WorkaholicGiveAdviceAlive", false, TabGroup.NeutralRoles, false)
- .SetParent(WorkaholicVisibleToEveryone);
- WorkaholicTasks = OverrideTasksData.Create(11714, TabGroup.NeutralRoles, CustomRoles.Workaholic);
- WorkaholicCanGuess = BooleanOptionItem.Create(11725, "CanGuess", true, TabGroup.NeutralRoles, false)
- .SetParent(CustomRoleSpawnChances[CustomRoles.Workaholic]);
- }
-
public override void Add(byte playerId)
{
On = true;
@@ -39,14 +21,14 @@ namespace TOHE.Roles.Neutral
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
- AURoleOptions.EngineerCooldown = WorkaholicVentCooldown.GetFloat();
+ AURoleOptions.EngineerCooldown = Options.WorkaholicVentCooldown.GetFloat();
AURoleOptions.EngineerInVentMaxTime = 0f;
}
public override void OnTaskComplete(PlayerControl player, int CompletedTasksCount, int AllTasksCount)
{
var alive = player.IsAlive();
- if ((CompletedTasksCount + 1) >= AllTasksCount && !(WorkaholicCannotWinAtDeath.GetBool() && !alive))
+ if ((CompletedTasksCount + 1) >= AllTasksCount && !(Options.WorkaholicCannotWinAtDeath.GetBool() && !alive))
{
Logger.Info("Workaholic Tasks Finished", "Workaholic");
RPC.PlaySoundRPC(player.PlayerId, Sounds.KillSound);
diff --git a/Roles/RoleBase.cs b/Roles/RoleBase.cs
index 5615eb7ab..cbb933f3e 100644
--- a/Roles/RoleBase.cs
+++ b/Roles/RoleBase.cs
@@ -1,30 +1,10 @@
-using System;
+using AmongUs.GameOptions;
using System.Text;
-using AmongUs.GameOptions;
namespace TOHE
{
- public abstract class RoleBase : IComparable
+ public abstract class RoleBase
{
- public int CompareTo(RoleBase other)
- {
- var thisName = GetType().Name;
- var translatedName = Translator.GetString(thisName);
- if (translatedName != string.Empty && !translatedName.StartsWith("*") && !translatedName.StartsWith("TOHE+
Gurge44
preview
- E:\Program Files\AmongUs
+ D:\Epic Games\AmongUs
true
True
$(MSBuildProjectName)+
diff --git a/main.cs b/main.cs
index 53e548ba4..f8382aba7 100644
--- a/main.cs
+++ b/main.cs
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
using AmongUs.GameOptions;
using BepInEx;
using BepInEx.Configuration;
@@ -9,6 +5,10 @@ using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
using TOHE;
using TOHE.Roles.Neutral;
using UnityEngine;
@@ -92,6 +92,7 @@ public class Main : BasePlugin
public static Dictionary> SetAddOns = [];
public static Dictionary AlwaysSpawnTogetherCombos = [];
public static Dictionary NeverSpawnTogetherCombos = [];
+ public static List AllRoleClasses;
public static bool IsFixedCooldown => CustomRoles.Vampire.IsEnable() || CustomRoles.Poisoner.IsEnable();
public static float RefixCooldownDelay;
public static bool ProcessShapeshifts = true;
@@ -125,7 +126,6 @@ public class Main : BasePlugin
//public static Dictionary FlashbangInProtect = new();
public static List CyberStarDead = [];
- public static List DemolitionistDead = [];
public static List BlockedVents = [];
public static List WorkaholicAlive = [];
public static List SpeedrunnerAlive = [];
@@ -197,12 +197,38 @@ public class Main : BasePlugin
public static Dictionary DevRole = [];
- public static PlayerControl[] AllPlayerControls => PlayerControl.AllPlayerControls.ToArray().Where(p => p != null).ToArray();
- public static PlayerControl[] AllAlivePlayerControls => PlayerControl.AllPlayerControls.ToArray().Where(p => p != null && p.IsAlive() && !p.Data.Disconnected && !Pelican.IsEaten(p.PlayerId)).ToArray();
+ public static PlayerControl[] AllPlayerControls
+ {
+ get
+ {
+ List result = [];
+ foreach (var pc in PlayerControl.AllPlayerControls)
+ {
+ if (pc == null) continue;
+ result.Add(pc);
+ }
+
+ return [.. result];
+ }
+ }
+
+ public static PlayerControl[] AllAlivePlayerControls
+ {
+ get
+ {
+ List result = [];
+ foreach (var pc in PlayerControl.AllPlayerControls)
+ {
+ if (pc == null || !pc.IsAlive() || pc.Data.Disconnected || Pelican.IsEaten(pc.PlayerId)) continue;
+ result.Add(pc);
+ }
+
+ return [.. result];
+ }
+ }
public static Main Instance;
- //一些很新的东东
public static string OverrideWelcomeMsg = string.Empty;
public static int HostClientId;
@@ -431,7 +457,6 @@ public class Main : BasePlugin
{ CustomRoles.Provocateur, "#74ba43" },
{ CustomRoles.Sunnyboy, "#ff9902" },
{ CustomRoles.Poisoner, "#e70052" },
- //{CustomRoles.NWitch, "#BF5FFF"},
{ CustomRoles.Totocalcio, "#ff9409" },
{ CustomRoles.Romantic, "#FF1493" },
{ CustomRoles.VengefulRomantic, "#8B0000" },
@@ -592,6 +617,20 @@ public class Main : BasePlugin
DevManager.Init();
Cloud.Init();
+ AllRoleClasses = [];
+ try
+ {
+ AllRoleClasses.AddRange(Assembly.GetAssembly(typeof(RoleBase))!
+ .GetTypes()
+ .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(RoleBase)))
+ .Select(type => (RoleBase)Activator.CreateInstance(type, null)));
+ AllRoleClasses.Sort();
+ }
+ catch (Exception e)
+ {
+ Utils.ThrowException(e);
+ }
+
IRandom.SetInstance(new NetRandomWrapper());
TOHE.Logger.Info($"{Application.version}", "AmongUs Version");
@@ -611,7 +650,7 @@ public class Main : BasePlugin
if (!DebugModeManager.AmDebugger) ConsoleManager.DetachConsole();
else ConsoleManager.CreateConsole();
- TOHE.Logger.Msg("========= TOHE loaded! =========", "Plugin Load");
+ TOHE.Logger.Msg("========= TOHE+ loaded! =========", "Plugin Load");
}
}