This commit is contained in:
Gurge44 committed 2024-03-04 18:43:21 +01:00
1 parent 9240922441
commit 8bab77f1bd
23 files changed
+511 -588

No files matched your search

+31 -36
View File
@@ -104,7 +104,6 @@ internal static class CustomRolesHelper
CustomRoles.Convener => new Convener(),
CustomRoles.CopyCat => new CopyCat(),
CustomRoles.Bloodhound => new Bloodhound(),
CustomRoles.Bodyguard => new Bodyguard(),
CustomRoles.Crusader => new Crusader(),
CustomRoles.Deputy => new Deputy(),
CustomRoles.Doctor => new Doctor(),
@@ -561,34 +560,33 @@ internal static class CustomRolesHelper
public static bool IsAdditionRole(this CustomRoles role) => role > CustomRoles.NotAssigned;
public static bool IsNonNK(this CustomRoles role) // ROLE ASSIGNING, NOT NEUTRAL TYPE
=> role is
CustomRoles.Jester or
CustomRoles.Postman or
CustomRoles.SoulHunter or
CustomRoles.Terrorist or
CustomRoles.Opportunist or
CustomRoles.Executioner or
CustomRoles.Mario or
CustomRoles.Lawyer or
CustomRoles.God or
CustomRoles.Amnesiac or
CustomRoles.Innocent or
CustomRoles.Vulture or
CustomRoles.Pursuer or
CustomRoles.Revolutionist or
CustomRoles.Provocateur or
CustomRoles.FFF or
CustomRoles.Workaholic or
CustomRoles.Collector or
CustomRoles.Sunnyboy or
CustomRoles.Maverick or
CustomRoles.Phantom or
CustomRoles.Totocalcio or
CustomRoles.Romantic or
CustomRoles.VengefulRomantic or
CustomRoles.Doomsayer or
CustomRoles.Deathknight;
public static bool IsNonNK(this CustomRoles role) => role is
CustomRoles.Jester or
CustomRoles.Postman or
CustomRoles.SoulHunter or
CustomRoles.Terrorist or
CustomRoles.Opportunist or
CustomRoles.Executioner or
CustomRoles.Mario or
CustomRoles.Lawyer or
CustomRoles.God or
CustomRoles.Amnesiac or
CustomRoles.Innocent or
CustomRoles.Vulture or
CustomRoles.Pursuer or
CustomRoles.Revolutionist or
CustomRoles.Provocateur or
CustomRoles.FFF or
CustomRoles.Workaholic or
CustomRoles.Collector or
CustomRoles.Sunnyboy or
CustomRoles.Maverick or
CustomRoles.Phantom or
CustomRoles.Totocalcio or
CustomRoles.Romantic or
CustomRoles.VengefulRomantic or
CustomRoles.Doomsayer or
CustomRoles.Deathknight;
public static bool IsNK(this CustomRoles role) => role is
CustomRoles.Jackal or
@@ -781,11 +779,8 @@ internal static class CustomRolesHelper
public static bool IsNeutral(this CustomRoles role) => role.IsNK() || role.IsNonNK();
public static bool IsAbleToBeSidekicked(this CustomRoles role) => role.GetDYRole() == RoleTypes.Impostor && !role.IsImpostor() && role is not
CustomRoles.Succubus and not
CustomRoles.Necromancer and not
public static bool IsAbleToBeSidekicked(this CustomRoles role) => role.GetDYRole() == RoleTypes.Impostor && !role.IsImpostor() && !role.IsRecruitingRole() && role is not
CustomRoles.Deathknight and not
CustomRoles.Virus and not
CustomRoles.Gangster;
public static bool IsEvilAddons(this CustomRoles role) => role is
@@ -913,6 +908,7 @@ internal static class CustomRolesHelper
CustomRoles.Guardian or
CustomRoles.Merchant or
CustomRoles.Mayor or
CustomRoles.Insight or
CustomRoles.Transporter;
public static bool IsNotKnightable(this CustomRoles role) => role is
@@ -1187,8 +1183,7 @@ internal static class CustomRolesHelper
{
if (role.IsImpostorTeamV3()) return Team.Impostor;
if (role.IsNeutralTeamV2()) return Team.Neutral;
if (role.IsCrewmateTeamV2()) return Team.Crewmate;
return Team.None;
return role.IsCrewmateTeamV2() ? Team.Crewmate : Team.None;
}
public static bool Is(this CustomRoles role, Team team) => team switch
@@ -1261,7 +1256,7 @@ internal static class CustomRolesHelper
return type;
}
public static bool RoleExist(this CustomRoles role, bool countDead = false) => Main.AllPlayerControls.Any(x => x.Is(role) && (x.IsAlive() || countDead));
public static bool RoleExist(this CustomRoles role, bool countDead = false) => Main.AllPlayerControls.Any(x => x.Is(role) && (countDead || x.IsAlive()));
public static int GetCount(this CustomRoles role)
{
+1
View File
@@ -87,6 +87,7 @@ public static class DevManager
DevUserList.Add(new(code: "modestspan#7071", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Shark"));
DevUserList.Add(new(code: "divotbusy#0624", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "PreCeptorBR"));
DevUserList.Add(new(code: "pinsrustic#5496", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "FHgameplay"));
DevUserList.Add(new(code: "opaquedot#5610", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Deh_66"));
// Sponsor
DevUserList.Add(new(code: "recentduct#6068", color: "#FF00FF", tag: "高冷男模法师", isUp: false, isDev: false, colorCmd: false, deBug: true, upName: null));
+16 -104
View File
@@ -45,14 +45,14 @@ public static class Options
//}
// プリセット
private static readonly string[] presets =
[
Main.Preset1.Value,
Main.Preset2.Value,
Main.Preset3.Value,
Main.Preset4.Value,
Main.Preset5.Value
];
//private static readonly string[] presets =
//[
// Main.Preset1.Value,
// Main.Preset2.Value,
// Main.Preset3.Value,
// Main.Preset4.Value,
// Main.Preset5.Value
//];
// ゲームモード
public static OptionItem GameMode;
@@ -115,12 +115,12 @@ public static class Options
"RoleRate",
];
public static readonly string[] ratesToggle =
[
"RoleOff",
"RoleRate",
"RoleOn"
];
//public static readonly string[] ratesToggle =
//[
// "RoleOff",
// "RoleRate",
// "RoleOn"
//];
public static readonly string[] CheatResponsesName =
[
@@ -207,18 +207,10 @@ public static class Options
public static OptionItem DisableShapeshiftAnimations;
public static OptionItem DisableKillAnimationOnGuess;
public static OptionItem DisableVanillaRoles;
public static OptionItem DisableHiddenRoles;
public static OptionItem DisableSunnyboy;
public static OptionItem SabotageCooldownControl;
public static OptionItem SabotageCooldown;
public static OptionItem SunnyboyChance;
public static OptionItem DisableBard;
public static OptionItem BardChance;
public static OptionItem DisableSaboteur;
public static OptionItem CEMode;
public static OptionItem ConfirmEjectionsNK;
public static OptionItem ConfirmEjectionsNonNK;
public static OptionItem ConfirmEjectionsNeutralAsImp;
public static OptionItem ShowImpRemainOnEject;
public static OptionItem ShowNKRemainOnEject;
public static OptionItem ShowTeamNextToRoleNameOnEject;
@@ -227,14 +219,9 @@ public static class Options
public static OptionItem DeepLowLoad;
public static OptionItem DisableVoteBan;
// Dummy Settings
public static OptionItem SpawnSidekickAlone;
// Detailed Ejections //
public static OptionItem ExtendedEjections;
public static OptionItem ConfirmEgoistOnEject;
public static OptionItem ConfirmSidekickOnEject;
public static OptionItem ConfirmLoversOnEject;
@@ -260,10 +247,8 @@ public static class Options
public static OptionItem JackalCanKillSidekick;
public static OptionItem SidekickCanKillJackal;
public static OptionItem SidekickKnowOtherSidekick;
public static OptionItem SidekickKnowOtherSidekickRole;
public static OptionItem SidekickCanKillSidekick;
public static OptionItem ShapeMasterShapeshiftDuration;
public static OptionItem EGCanGuessImp;
public static OptionItem EGCanGuessAdt;
public static OptionItem EGCanGuessTaskDoneSnitch;
@@ -276,7 +261,6 @@ public static class Options
public static OptionItem ScavengerKillDuration;
public static OptionItem ZombieKillCooldown;
public static OptionItem ZombieSpeedReduce;
public static OptionItem EvilWatcherChance;
public static OptionItem GGCanGuessCrew;
public static OptionItem GGCanGuessAdt;
public static OptionItem GGCanGuessTime;
@@ -307,7 +291,6 @@ public static class Options
public static OptionItem DoctorTaskCompletedBatteryCharge;
public static OptionItem SpeedBoosterUpSpeed;
public static OptionItem SpeedBoosterTimes;
public static OptionItem GlitchCanVote;
public static OptionItem TrapperBlockMoveTime;
public static OptionItem DetectiveCanknowKiller;
public static OptionItem TransporterTeleportMax;
@@ -319,7 +302,6 @@ public static class Options
public static OptionItem WorkaholicGiveAdviceAlive;
public static OptionItem BaitNotification;
public static OptionItem DoctorVisibleToEveryone;
public static OptionItem JackalWinWithSidekick;
public static OptionItem ArsonistDouseTime;
public static OptionItem ArsonistCooldown;
public static OptionItem ArsonistKeepsGameGoing;
@@ -360,9 +342,6 @@ public static class Options
public static OptionItem EveryOneKnowSuperStar;
public static OptionItem MNKillCooldown;
public static OptionItem MafiaCanKillNum;
public static OptionItem RetributionistCanKillNum;
public static OptionItem MinimumPlayersAliveToRetri;
public static OptionItem CanOnlyRetributeWithTasksDone;
public static OptionItem BomberRadius;
public static OptionItem BomberCanKill;
public static OptionItem BomberKillCD;
@@ -386,7 +365,6 @@ public static class Options
// UNDERDOG
public static OptionItem UnderdogKillCooldown;
public static OptionItem UnderdogMaximumPlayersNeededToKill;
public static OptionItem UnderdogCanKillWithMorePlayersAlive;
public static OptionItem UnderdogKillCooldownWithMorePlayersAlive;
public static OptionItem GodfatherCancelVote;
@@ -399,7 +377,6 @@ public static class Options
public static OptionItem CleanerKillCooldown;
public static OptionItem KillCooldownAfterCleaning;
public static OptionItem GuardSpellTimes;
public static OptionItem FlashWhenTrapBoobyTrap;
public static OptionItem CapitalismSkillCooldown;
public static OptionItem CapitalismKillCooldown;
public static OptionItem GrenadierSkillCooldown;
@@ -474,9 +451,6 @@ public static class Options
public static OptionItem ImpCanBeInLove;
public static OptionItem CrewCanBeInLove;
public static OptionItem NeutralCanBeInLove;
public static OptionItem ImpCanBeReflective;
public static OptionItem CrewCanBeReflective;
public static OptionItem NeutralCanBeReflective;
public static OptionItem ImpCanBeUnreportable;
public static OptionItem CrewCanBeUnreportable;
public static OptionItem NeutralCanBeUnreportable;
@@ -525,12 +499,10 @@ public static class Options
public static OptionItem AutoPlayAgainCountdown;
public static OptionItem AutoStartTimer;
public static OptionItem ControlCooldown;
public static OptionItem InhibitorCD;
public static OptionItem InhibitorCDAfterMeetings;
public static OptionItem SaboteurCD;
public static OptionItem SaboteurCDAfterMeetings;
public static OptionItem JesterVision;
public static OptionItem PhantomCanVent;
public static OptionItem PhantomSnatchesWin;
@@ -683,26 +655,10 @@ public static class Options
public static OptionItem DisableLiftWeights;
public static OptionItem DisableCollectShells;
// Merchant Filters //
public static OptionItem BaitCanBeSold;
public static OptionItem WatcherCanBeSold;
public static OptionItem SeerCanBeSold;
public static OptionItem TrapperCanBeSold;
public static OptionItem TiebreakerCanBeSold;
public static OptionItem KnightedCanBeSold;
public static OptionItem NecroviewCanBeSold;
public static OptionItem SoullessCanBeSold;
public static OptionItem SchizoCanBeSold;
public static OptionItem OnboundCanBeSold;
public static OptionItem GuesserCanBeSold;
public static OptionItem UnreportableCanBeSold;
public static OptionItem LuckyCanBeSold;
public static OptionItem ObliviousCanBeSold;
public static OptionItem BewilderCanBeSold;
public static OptionItem BusyLongTasks;
public static OptionItem BusyShortTasks;
//デバイスブロック
// Disable Devices
public static OptionItem DisableDevices;
public static OptionItem DisableSkeldDevices;
public static OptionItem DisableSkeldAdmin;
@@ -739,11 +695,6 @@ public static class Options
// Maps
public static OptionItem RandomMapsMode;
public static OptionItem AddedTheSkeld;
public static OptionItem AddedMiraHQ;
public static OptionItem AddedPolus;
public static OptionItem AddedTheAirship;
public static OptionItem AddedDleks;
public static OptionItem RandomSpawn;
public static OptionItem AirshipAdditionalSpawn;
public static OptionItem AirshipVariableElectrical;
@@ -787,30 +738,6 @@ public static class Options
public static OptionItem ImpCanGuessImp;
public static OptionItem CrewCanGuessCrew;
// Guesser Mode - Addon Config //
public static OptionItem AddonSettingsCrew;
public static OptionItem ClaimAddonSettingsCrew;
public static OptionItem BetrayalAddonSettingsCrew;
public static OptionItem ImpOnlyAddonSettingsCrew;
public static OptionItem CrewOnlyAddonSettingsCrew;
public static OptionItem NeutralAddonSettingsCrew;
public static OptionItem BasicAddonSettingsCrew;
public static OptionItem AddonSettingsImp;
public static OptionItem ClaimAddonSettingsImp;
public static OptionItem BetrayalAddonSettingsImp;
public static OptionItem ImpOnlyAddonSettingsImp;
public static OptionItem CrewOnlyAddonSettingsImp;
public static OptionItem NeutralAddonSettingsImp;
public static OptionItem BasicAddonSettingsImp;
public static OptionItem AddonSettingsNeut;
public static OptionItem ClaimAddonSettingsNeut;
public static OptionItem BetrayalAddonSettingsNeut;
public static OptionItem ImpOnlyAddonSettingsNeut;
public static OptionItem CrewOnlyAddonSettingsNeut;
public static OptionItem NeutralAddonSettingsNeut;
public static OptionItem BasicAddonSettingsNeut;
public static OptionItem EveryoneCanVent;
public static OptionItem OverrideScientistBasedRoles;
public static OptionItem WhackAMole;
@@ -899,8 +826,6 @@ public static class Options
public static OverrideTasksData GuardianTasks;
public static OverrideTasksData OpportunistTasks;
public static OverrideTasksData MayorTasks;
public static OverrideTasksData RetributionistTasks;
public static OverrideTasksData TimeManagerTasks;
// その他
public static OptionItem FixFirstKillCooldown;
@@ -930,7 +855,6 @@ public static class Options
public static OptionItem SuffixMode;
public static OptionItem HideGameSettings;
public static OptionItem FormatNameMode;
public static OptionItem ColorNameMode;
public static OptionItem DisableEmojiName;
public static OptionItem ChangeNameToRoleInfo;
public static OptionItem SendRoleDescriptionFirstMeeting;
@@ -949,21 +873,13 @@ public static class Options
public static OptionItem AutoKickStopWordsAsBan;
public static OptionItem AutoKickStopWordsTimes;
public static OptionItem KickAndroidPlayer;
public static OptionItem KickXboxPlayer;
public static OptionItem KickPlayStationPlayer;
public static OptionItem KickNintendoPlayer;
public static OptionItem ApplyDenyNameList;
public static OptionItem KickPlayerFriendCodeNotExist;
public static OptionItem KickLowLevelPlayer;
public static OptionItem ApplyBanList;
public static OptionItem ApplyModeratorList;
public static OptionItem ApplyAllowList;
public static OptionItem AutoWarnStopWords;
public static OptionItem AllowSayCommand;
public static OptionItem ApplyReminderMsg;
public static OptionItem TimeForReminder;
public static OptionItem DIYGameSettings;
public static OptionItem PlayerCanSetColor;
@@ -990,7 +906,6 @@ public static class Options
public static OptionItem MadSnitchTasks;
public static OptionItem FlashmanSpeed;
public static OptionItem GiantSpeed;
public static OptionItem ButtonBarryButtons;
public static OptionItem LoverSpawnChances;
public static OptionItem LoverKnowRoles;
public static OptionItem LoverSuicide;
@@ -999,7 +914,6 @@ public static class Options
public static OptionItem ImpCanBeDualPersonality;
public static OptionItem CrewCanBeDualPersonality;
public static OptionItem DualVotes;
public static OptionItem HideDualVotes;
public static OptionItem ImpCanBeLoyal;
public static OptionItem CrewCanBeLoyal;
public static OptionItem MinWaitAutoStart;
@@ -1040,8 +954,6 @@ public static class Options
public static SuffixModes GetSuffixMode() => (SuffixModes)SuffixMode.GetValue();
public static int SnitchExposeTaskLeft = 1;
public static bool IsLoaded;
public static int LoadingPercentage;
@@ -1058,7 +970,7 @@ public static class Options
roleCounts = [];
roleSpawnChances = [];
foreach (var role in Enum.GetValues(typeof(CustomRoles)).Cast<CustomRoles>())
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
{
roleCounts.Add(role, 0);
roleSpawnChances.Add(role, 0);
+1 -1
View File
@@ -344,7 +344,7 @@ class GameEndChecker
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
{
if (!role.IsNK() || role.IsMadmate() || role is CustomRoles.Sidekick) continue;
if (!role.IsNK() || role.IsMadmate() || role is CustomRoles.Sidekick || (role == CustomRoles.Arsonist && !Options.ArsonistCanIgniteAnytime.GetBool())) continue;
CustomRoles? keyRole = role.IsRecruitingRole() ? null : role;
CustomWinner keyWinner = (CustomWinner)role;
+427 -412
View File
@@ -31,455 +31,470 @@ class HudManagerPatch
private static TextMeshPro OverriddenRolesText;
private static long LastNullError = 0;
//public static GameObject TempLowerInfoText;
public static void Postfix(HudManager __instance)
{
LoadingScreen.Update();
if (!GameStates.IsModHost) return;
var player = PlayerControl.LocalPlayer;
if (player == null) return;
if (Input.GetKeyDown(KeyCode.LeftControl))
try
{
if ((!AmongUsClient.Instance.IsGameStarted || !GameStates.IsOnlineGame) && player.CanMove)
{
player.Collider.offset = new(0f, 127f);
}
}
LoadingScreen.Update();
if (Math.Abs(player.Collider.offset.y - 127f) < 0.1f)
{
if (!Input.GetKey(KeyCode.LeftControl) || (AmongUsClient.Instance.IsGameStarted && GameStates.IsOnlineGame))
{
player.Collider.offset = new(0f, -0.3636f);
}
}
if (!GameStates.IsModHost) return;
var player = PlayerControl.LocalPlayer;
if (player == null) return;
if (GameStates.IsLobby)
{
var POM = GameObject.Find("PlayerOptionsMenu(Clone)");
__instance.GameSettings.text = POM != null ? string.Empty : OptionShower.GetTextNoFresh();
__instance.GameSettings.fontSizeMin =
__instance.GameSettings.fontSizeMax = 1f;
}
if (AmongUsClient.Instance.AmHost)
{
if (OverriddenRolesText == null)
if (Input.GetKeyDown(KeyCode.LeftControl))
{
OverriddenRolesText = Object.Instantiate(__instance.KillButton.cooldownTimerText);
OverriddenRolesText.alignment = TextAlignmentOptions.Right;
OverriddenRolesText.verticalAlignment = VerticalAlignmentOptions.Top;
OverriddenRolesText.transform.parent = __instance.transform;
OverriddenRolesText.transform.localPosition = new(4.9f, 0.8f, 0);
OverriddenRolesText.overflowMode = TextOverflowModes.Overflow;
OverriddenRolesText.enableWordWrapping = false;
OverriddenRolesText.color = Color.white;
OverriddenRolesText.fontSize = OverriddenRolesText.fontSizeMax = OverriddenRolesText.fontSizeMin = 2f;
}
if (Main.SetRoles.Count > 0 || Main.SetAddOns.Count > 0)
{
Dictionary<byte, string> resultText = [];
bool first = true;
foreach (var item in Main.SetRoles)
if ((!AmongUsClient.Instance.IsGameStarted || !GameStates.IsOnlineGame) && player.CanMove)
{
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()}")}")} - <color={(Main.roleColors.GetValueOrDefault(item.Value, "#ffffff"))}>{GetString(item.Value.ToString())}</color>";
resultText[item.Key] = text;
first = false;
player.Collider.offset = new(0f, 127f);
}
}
if (Math.Abs(player.Collider.offset.y - 127f) < 0.1f)
{
if (!Input.GetKey(KeyCode.LeftControl) || (AmongUsClient.Instance.IsGameStarted && GameStates.IsOnlineGame))
{
player.Collider.offset = new(0f, -0.3636f);
}
}
if (__instance == null) return;
if (GameStates.IsLobby)
{
var POM = GameObject.Find("PlayerOptionsMenu(Clone)");
__instance.GameSettings.text = POM != null ? string.Empty : OptionShower.GetTextNoFresh();
__instance.GameSettings.fontSizeMin =
__instance.GameSettings.fontSizeMax = 1f;
}
if (AmongUsClient.Instance.AmHost)
{
if (OverriddenRolesText == null)
{
OverriddenRolesText = Object.Instantiate(__instance.KillButton.cooldownTimerText);
OverriddenRolesText.alignment = TextAlignmentOptions.Right;
OverriddenRolesText.verticalAlignment = VerticalAlignmentOptions.Top;
OverriddenRolesText.transform.parent = __instance.transform;
OverriddenRolesText.transform.localPosition = new(4.9f, 0.8f, 0);
OverriddenRolesText.overflowMode = TextOverflowModes.Overflow;
OverriddenRolesText.enableWordWrapping = false;
OverriddenRolesText.color = Color.white;
OverriddenRolesText.fontSize = OverriddenRolesText.fontSizeMax = OverriddenRolesText.fontSizeMin = 2f;
}
if (Main.SetRoles.Count == 0) first = true;
foreach (var item in Main.SetAddOns)
if (Main.SetRoles.Count > 0 || Main.SetAddOns.Count > 0)
{
foreach (var role in item.Value)
Dictionary<byte, string> resultText = [];
bool first = true;
foreach (var item in Main.SetRoles)
{
var pc = Utils.GetPlayerById(item.Key);
if (resultText.ContainsKey(item.Key))
{
string text = $" <#ffffff>(</color><color={(Main.roleColors.GetValueOrDefault(role, "#ffffff"))}>{GetString(role.ToString())}</color><#ffffff>)</color>";
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>(</color><color={(Main.roleColors.GetValueOrDefault(role, "#ffffff"))}>{GetString(role.ToString())}</color><#ffffff>)</color>";
resultText[item.Key] = text;
first = false;
}
string prefix = first ? string.Empty : "\n";
string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <color={(Main.roleColors.GetValueOrDefault(item.Value, "#ffffff"))}>{GetString(item.Value.ToString())}</color>";
resultText[item.Key] = text;
first = false;
}
}
bool stop = false;
foreach (var roles in Main.SetRoles)
{
if (!Main.SetAddOns.ContainsKey(roles.Key)) continue;
foreach (var addons in Main.SetAddOns)
if (Main.SetRoles.Count == 0) first = true;
foreach (var item in Main.SetAddOns)
{
if (!Main.SetRoles.ContainsKey(addons.Key)) continue;
foreach (var addon in addons.Value)
foreach (var role in item.Value)
{
if (!CustomRolesHelper.CheckAddonConflictV2(addon, roles.Value))
var pc = Utils.GetPlayerById(item.Key);
if (resultText.ContainsKey(item.Key))
{
resultText[roles.Key] += " <#ff0000>(!)</color>";
stop = true;
break;
string text = $" <#ffffff>(</color><color={(Main.roleColors.GetValueOrDefault(role, "#ffffff"))}>{GetString(role.ToString())}</color><#ffffff>)</color>";
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>(</color><color={(Main.roleColors.GetValueOrDefault(role, "#ffffff"))}>{GetString(role.ToString())}</color><#ffffff>)</color>";
resultText[item.Key] = text;
first = false;
}
}
if (stop) break;
}
if (stop) break;
}
OverriddenRolesText.text = string.Join(string.Empty, resultText.Values);
}
else
{
OverriddenRolesText.text = string.Empty;
}
OverriddenRolesText.enabled = OverriddenRolesText.text != string.Empty;
}
// The following will not be executed unless the game is in progress
if (!AmongUsClient.Instance.IsGameStarted) return;
Utils.CountAlivePlayers();
bool shapeshifting = player.IsShifted();
if (SetHudActivePatch.IsActive)
{
if (player.IsAlive() || Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato)
{
if (player.GetCustomRole().UsesPetInsteadOfKill())
{
__instance.PetButton?.OverrideText("KillButtonText");
}
Main.PlayerStates[player.PlayerId].Role.SetButtonTexts(__instance, player.PlayerId);
switch (player.GetCustomRole())
{
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;
case CustomRoles.PlagueDoctor:
case CustomRoles.PlagueBearer:
__instance.KillButton?.OverrideText(GetString("InfectiousKillButtonText"));
break;
case CustomRoles.Witch:
Witch.GetAbilityButtonText(__instance);
break;
case CustomRoles.Arsonist:
__instance.KillButton?.OverrideText(GetString("ArsonistDouseButtonText"));
__instance.ImpostorVentButton.buttonLabelText.text = GetString("ArsonistVentButtonText");
break;
case CustomRoles.Farseer:
__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:
__instance.KillButton?.OverrideText(GetString("AnalyzerKillButtonText"));
break;
case CustomRoles.Pursuer:
__instance.KillButton?.OverrideText(GetString("PursuerButtonText"));
break;
case CustomRoles.Postman:
__instance.KillButton?.OverrideText(GetString("PostmanKillButtonText"));
break;
case CustomRoles.Escort:
__instance.KillButton?.OverrideText(GetString("EscortKillButtonText"));
break;
case CustomRoles.Glitch:
__instance.SabotageButton?.OverrideText(GetString("HackButtonText"));
break;
case CustomRoles.FFF:
__instance.KillButton?.OverrideText(GetString("FFFButtonText"));
break;
case CustomRoles.Gaulois:
__instance.KillButton?.OverrideText(GetString("GauloisKillButtonText"));
break;
case CustomRoles.Aid:
case CustomRoles.DonutDelivery:
case CustomRoles.Medic:
__instance.KillButton?.OverrideText(GetString("MedicalerButtonText"));
break;
case CustomRoles.Gamer:
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
break;
case CustomRoles.BallLightning:
__instance.KillButton?.OverrideText(GetString("BallLightningButtonText"));
break;
case CustomRoles.Sapper:
if (Options.UsePets.GetBool()) __instance.PetButton?.OverrideText(GetString("BomberShapeshiftText"));
else __instance.AbilityButton?.OverrideText(GetString("BomberShapeshiftText"));
break;
case CustomRoles.Twister:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("TwisterButtonText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("TwisterButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
}
break;
case CustomRoles.QuickShooter:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
__instance.AbilityButton?.SetUsesRemaining(QuickShooter.ShotLimit.GetValueOrDefault(PlayerControl.LocalPlayer.PlayerId, 0));
}
break;
case CustomRoles.Camouflager:
__instance.AbilityButton?.OverrideText(GetString("CamouflagerShapeshiftText"));
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
break;
case CustomRoles.OverKiller:
__instance.KillButton?.OverrideText(GetString("OverKillerButtonText"));
break;
case CustomRoles.KB_Normal:
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
break;
case CustomRoles.Medusa:
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
__instance.ReportButton?.OverrideText(GetString("MedusaReportButtonText"));
break;
case CustomRoles.Vulture:
__instance.ReportButton?.OverrideText(GetString("VultureEatButtonText"));
break;
case CustomRoles.Disperser:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("DisperserVentButtonText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("DisperserVentButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
}
break;
case CustomRoles.Sheriff:
__instance.KillButton?.OverrideText(GetString("SheriffKillButtonText"));
break;
case CustomRoles.Crusader:
__instance.KillButton?.OverrideText(GetString("CrusaderKillButtonText"));
break;
case CustomRoles.Totocalcio:
__instance.KillButton?.OverrideText(GetString("TotocalcioKillButtonText"));
break;
case CustomRoles.Romantic:
if (!Romantic.HasPickedPartner) __instance.KillButton?.OverrideText(GetString("RomanticKillButtonText"));
else __instance.KillButton?.OverrideText(GetString("MedicalerButtonText"));
break;
case CustomRoles.VengefulRomantic:
__instance.KillButton?.OverrideText(GetString("VengefulRomanticKillButtonText"));
break;
case CustomRoles.Succubus:
__instance.KillButton?.OverrideText(GetString("SuccubusKillButtonText"));
break;
//case CustomRoles.CursedSoul:
// __instance.KillButton?.OverrideText(GetString("CursedSoulKillButtonText"));
// break;
case CustomRoles.Amnesiac:
__instance.KillButton?.OverrideText(GetString("RememberButtonText"));
break;
case CustomRoles.Monarch:
__instance.KillButton?.OverrideText(GetString("MonarchKillButtonText"));
break;
case CustomRoles.Deputy:
__instance.KillButton?.OverrideText(GetString("DeputyHandcuffText"));
break;
case CustomRoles.Hangman:
if (shapeshifting) __instance.KillButton?.OverrideText(GetString("HangmanKillButtonTextDuringSS"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
break;
case CustomRoles.Sidekick:
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
__instance.ImpostorVentButton?.OverrideText(GetString("ReportButtonText"));
__instance.SabotageButton?.OverrideText(GetString("SabotageButtonText"));
break;
case CustomRoles.Addict:
__instance.AbilityButton?.OverrideText(GetString("AddictVentButtonText"));
break;
case CustomRoles.Alchemist:
if (Options.UsePets.GetBool())
__instance.PetButton?.OverrideText(GetString("AlchemistVentButtonText"));
else
__instance.AbilityButton?.OverrideText(GetString("AlchemistVentButtonText"));
break;
case CustomRoles.Dazzler:
__instance.AbilityButton?.OverrideText(GetString("DazzleButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
break;
case CustomRoles.Deathpact:
__instance.AbilityButton?.OverrideText(GetString("DeathpactButtonText"));
break;
case CustomRoles.Devourer:
__instance.AbilityButton?.OverrideText(GetString("DevourerButtonText"));
break;
}
if (LowerInfoText == null)
{
//TempLowerInfoText = new GameObject("CountdownText");
//TempLowerInfoText.transform.position = new Vector3(0f, -2f, 1f);
//LowerInfoText = TempLowerInfoText.AddComponent<TextMeshPro>();
//LowerInfoText.text = string.Format(GetString("CountdownText"));
LowerInfoText = Object.Instantiate(__instance.KillButton.cooldownTimerText);
LowerInfoText.alignment = TextAlignmentOptions.Center;
LowerInfoText.transform.parent = __instance.transform;
LowerInfoText.transform.localPosition = new(0, -2f, 0);
LowerInfoText.overflowMode = TextOverflowModes.Overflow;
LowerInfoText.enableWordWrapping = false;
LowerInfoText.color = Color.white;
LowerInfoText.fontSize = LowerInfoText.fontSizeMax = LowerInfoText.fontSizeMin = 2f;
}
LowerInfoText.text = Options.CurrentGameMode switch
{
CustomGameMode.SoloKombat => SoloKombatManager.GetHudText(),
CustomGameMode.FFA when player.PlayerId == 0 => FFAManager.GetHudText(),
CustomGameMode.MoveAndStop when player.PlayerId == 0 => MoveAndStopManager.HUDText,
CustomGameMode.HotPotato when player.PlayerId == 0 => HotPotatoManager.GetSuffixText(player.PlayerId),
CustomGameMode.Standard => player.GetCustomRole() switch
bool stop = false;
foreach (var roles in Main.SetRoles)
{
CustomRoles.BountyHunter => BountyHunter.GetTargetText(player, true),
CustomRoles.Witch or CustomRoles.HexMaster => Witch.GetSpellModeText(player, true),
CustomRoles.FireWorks => FireWorks.GetStateText(player),
CustomRoles.Swooper or CustomRoles.Wraith or CustomRoles.Chameleon => Swooper.GetHudText(player),
CustomRoles.HeadHunter => HeadHunter.GetHudText(player),
CustomRoles.Alchemist => Alchemist.GetHudText(player),
CustomRoles.Werewolf => Werewolf.GetHudText(player),
CustomRoles.Glitch => Glitch.GetHudText(player),
CustomRoles.NiceHacker => NiceHacker.GetHudText(player),
CustomRoles.Wildling or CustomRoles.BloodKnight => Wildling.GetHudText(player),
CustomRoles.YinYanger => YinYanger.ModeText(player),
CustomRoles.WeaponMaster => WeaponMaster.GetHudAndProgressText(player.PlayerId),
CustomRoles.Postman => Postman.GetHudText(player),
CustomRoles.SoulHunter => SoulHunter.HUDText(player.PlayerId),
CustomRoles.Chronomancer => Chronomancer.GetHudText(player.PlayerId),
CustomRoles.Mafioso => Mafioso.GetHUDText(player),
CustomRoles.Druid => Druid.GetHUDText(player),
CustomRoles.Rabbit => Rabbit.GetSuffix(player),
CustomRoles.Librarian => Librarian.GetSelfSuffixAndHudText(player.PlayerId),
CustomRoles.PlagueDoctor => PlagueDoctor.GetLowerTextOthers(player, isForHud: true),
CustomRoles.Stealth => Stealth.GetSuffix(player, isHUD: true),
CustomRoles.Hookshot => Hookshot.SuffixText(player.PlayerId),
CustomRoles.Tornado => Tornado.GetSuffixText(isHUD: true),
_ => player.Is(CustomRoles.Asthmatic) ? Asthmatic.GetSuffixText(player.PlayerId) : string.Empty,
},
_ => string.Empty,
};
if (GetCD_HUDText() != string.Empty) LowerInfoText.text = $"{GetCD_HUDText()}\n{LowerInfoText.text}";
if (!Main.SetAddOns.ContainsKey(roles.Key)) continue;
foreach (var addons in Main.SetAddOns)
{
if (!Main.SetRoles.ContainsKey(addons.Key)) continue;
foreach (var addon in addons.Value)
{
if (!CustomRolesHelper.CheckAddonConflictV2(addon, roles.Value))
{
resultText[roles.Key] += " <#ff0000>(!)</color>";
stop = true;
break;
}
}
string GetCD_HUDText() => !Options.UsePets.GetBool() || !Main.AbilityCD.TryGetValue(player.PlayerId, out var CD)
? string.Empty
: string.Format(GetString("CDPT"), CD.TOTALCD - (Utils.TimeStamp - CD.START_TIMESTAMP) + 1);
if (stop) break;
}
}
//LowerInfoText.text += "\n" + (int)System.Math.Round(Main.KillTimers[player.PlayerId]);
LowerInfoText.enabled = LowerInfoText.text != string.Empty;
if ((!AmongUsClient.Instance.IsGameStarted && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay) || GameStates.IsMeeting)
{
LowerInfoText.enabled = false;
}
if (player.CanUseKillButton() && !player.GetCustomRole().UsesPetInsteadOfKill())
{
__instance.KillButton?.ToggleVisible(player.IsAlive() && GameStates.IsInTask);
player.Data.Role.CanUseKillButton = true;
OverriddenRolesText.text = string.Join(string.Empty, resultText.Values);
}
else
{
__instance.KillButton?.SetDisabled();
__instance.KillButton?.ToggleVisible(false);
OverriddenRolesText.text = string.Empty;
}
bool CanUseVent = (player.CanUseImpostorVentButton() || player.inVent) && GameStates.IsInTask;
__instance.ImpostorVentButton?.ToggleVisible(CanUseVent);
player.Data.Role.CanVent = CanUseVent;
OverriddenRolesText.enabled = OverriddenRolesText.text != string.Empty;
}
else
// The following will not be executed unless the game is in progress
if (!AmongUsClient.Instance.IsGameStarted) return;
Utils.CountAlivePlayers();
bool shapeshifting = player.IsShifted();
if (SetHudActivePatch.IsActive)
{
__instance.ReportButton?.Hide();
__instance.ImpostorVentButton?.Hide();
__instance.KillButton?.Hide();
__instance.AbilityButton?.Show();
__instance.AbilityButton?.OverrideText(GetString(StringNames.HauntAbilityName));
if (player.IsAlive() || Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato)
{
if (player.GetCustomRole().UsesPetInsteadOfKill())
{
__instance.PetButton?.OverrideText("KillButtonText");
}
Main.PlayerStates[player.PlayerId].Role.SetButtonTexts(__instance, player.PlayerId);
switch (player.GetCustomRole())
{
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;
case CustomRoles.PlagueDoctor:
case CustomRoles.PlagueBearer:
__instance.KillButton?.OverrideText(GetString("InfectiousKillButtonText"));
break;
case CustomRoles.Witch:
Witch.GetAbilityButtonText(__instance);
break;
case CustomRoles.Arsonist:
__instance.KillButton?.OverrideText(GetString("ArsonistDouseButtonText"));
__instance.ImpostorVentButton.buttonLabelText.text = GetString("ArsonistVentButtonText");
break;
case CustomRoles.Farseer:
__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:
__instance.KillButton?.OverrideText(GetString("AnalyzerKillButtonText"));
break;
case CustomRoles.Pursuer:
__instance.KillButton?.OverrideText(GetString("PursuerButtonText"));
break;
case CustomRoles.Postman:
__instance.KillButton?.OverrideText(GetString("PostmanKillButtonText"));
break;
case CustomRoles.Escort:
__instance.KillButton?.OverrideText(GetString("EscortKillButtonText"));
break;
case CustomRoles.Glitch:
__instance.SabotageButton?.OverrideText(GetString("HackButtonText"));
break;
case CustomRoles.FFF:
__instance.KillButton?.OverrideText(GetString("FFFButtonText"));
break;
case CustomRoles.Gaulois:
__instance.KillButton?.OverrideText(GetString("GauloisKillButtonText"));
break;
case CustomRoles.Aid:
case CustomRoles.DonutDelivery:
case CustomRoles.Medic:
__instance.KillButton?.OverrideText(GetString("MedicalerButtonText"));
break;
case CustomRoles.Gamer:
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
break;
case CustomRoles.BallLightning:
__instance.KillButton?.OverrideText(GetString("BallLightningButtonText"));
break;
case CustomRoles.Sapper:
if (Options.UsePets.GetBool()) __instance.PetButton?.OverrideText(GetString("BomberShapeshiftText"));
else __instance.AbilityButton?.OverrideText(GetString("BomberShapeshiftText"));
break;
case CustomRoles.Twister:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("TwisterButtonText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("TwisterButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
}
break;
case CustomRoles.QuickShooter:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("QuickShooterShapeshiftText"));
__instance.AbilityButton?.SetUsesRemaining(QuickShooter.ShotLimit.GetValueOrDefault(PlayerControl.LocalPlayer.PlayerId, 0));
}
break;
case CustomRoles.Camouflager:
__instance.AbilityButton?.OverrideText(GetString("CamouflagerShapeshiftText"));
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
break;
case CustomRoles.OverKiller:
__instance.KillButton?.OverrideText(GetString("OverKillerButtonText"));
break;
case CustomRoles.KB_Normal:
__instance.KillButton?.OverrideText(GetString("GamerButtonText"));
break;
case CustomRoles.Medusa:
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
__instance.ReportButton?.OverrideText(GetString("MedusaReportButtonText"));
break;
case CustomRoles.Vulture:
__instance.ReportButton?.OverrideText(GetString("VultureEatButtonText"));
break;
case CustomRoles.Disperser:
if (Options.UsePets.GetBool())
{
__instance.PetButton?.OverrideText(GetString("DisperserVentButtonText"));
}
else
{
__instance.AbilityButton?.OverrideText(GetString("DisperserVentButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
}
break;
case CustomRoles.Sheriff:
__instance.KillButton?.OverrideText(GetString("SheriffKillButtonText"));
break;
case CustomRoles.Crusader:
__instance.KillButton?.OverrideText(GetString("CrusaderKillButtonText"));
break;
case CustomRoles.Totocalcio:
__instance.KillButton?.OverrideText(GetString("TotocalcioKillButtonText"));
break;
case CustomRoles.Romantic:
if (!Romantic.HasPickedPartner) __instance.KillButton?.OverrideText(GetString("RomanticKillButtonText"));
else __instance.KillButton?.OverrideText(GetString("MedicalerButtonText"));
break;
case CustomRoles.VengefulRomantic:
__instance.KillButton?.OverrideText(GetString("VengefulRomanticKillButtonText"));
break;
case CustomRoles.Succubus:
__instance.KillButton?.OverrideText(GetString("SuccubusKillButtonText"));
break;
//case CustomRoles.CursedSoul:
// __instance.KillButton?.OverrideText(GetString("CursedSoulKillButtonText"));
// break;
case CustomRoles.Amnesiac:
__instance.KillButton?.OverrideText(GetString("RememberButtonText"));
break;
case CustomRoles.Monarch:
__instance.KillButton?.OverrideText(GetString("MonarchKillButtonText"));
break;
case CustomRoles.Deputy:
__instance.KillButton?.OverrideText(GetString("DeputyHandcuffText"));
break;
case CustomRoles.Hangman:
if (shapeshifting) __instance.KillButton?.OverrideText(GetString("HangmanKillButtonTextDuringSS"));
__instance.AbilityButton?.SetUsesRemaining((int)player.GetAbilityUseLimit());
break;
case CustomRoles.Sidekick:
__instance.KillButton?.OverrideText(GetString("KillButtonText"));
__instance.ImpostorVentButton?.OverrideText(GetString("ReportButtonText"));
__instance.SabotageButton?.OverrideText(GetString("SabotageButtonText"));
break;
case CustomRoles.Addict:
__instance.AbilityButton?.OverrideText(GetString("AddictVentButtonText"));
break;
case CustomRoles.Alchemist:
if (Options.UsePets.GetBool())
__instance.PetButton?.OverrideText(GetString("AlchemistVentButtonText"));
else
__instance.AbilityButton?.OverrideText(GetString("AlchemistVentButtonText"));
break;
case CustomRoles.Dazzler:
__instance.AbilityButton?.OverrideText(GetString("DazzleButtonText"));
__instance.AbilityButton?.SetUsesRemaining((int)PlayerControl.LocalPlayer.GetAbilityUseLimit());
break;
case CustomRoles.Deathpact:
__instance.AbilityButton?.OverrideText(GetString("DeathpactButtonText"));
break;
case CustomRoles.Devourer:
__instance.AbilityButton?.OverrideText(GetString("DevourerButtonText"));
break;
}
if (LowerInfoText == null)
{
//TempLowerInfoText = new GameObject("CountdownText");
//TempLowerInfoText.transform.position = new Vector3(0f, -2f, 1f);
//LowerInfoText = TempLowerInfoText.AddComponent<TextMeshPro>();
//LowerInfoText.text = string.Format(GetString("CountdownText"));
LowerInfoText = Object.Instantiate(__instance.KillButton.cooldownTimerText);
LowerInfoText.alignment = TextAlignmentOptions.Center;
LowerInfoText.transform.parent = __instance.transform;
LowerInfoText.transform.localPosition = new(0, -2f, 0);
LowerInfoText.overflowMode = TextOverflowModes.Overflow;
LowerInfoText.enableWordWrapping = false;
LowerInfoText.color = Color.white;
LowerInfoText.fontSize = LowerInfoText.fontSizeMax = LowerInfoText.fontSizeMin = 2f;
}
LowerInfoText.text = Options.CurrentGameMode switch
{
CustomGameMode.SoloKombat => SoloKombatManager.GetHudText(),
CustomGameMode.FFA when player.PlayerId == 0 => FFAManager.GetHudText(),
CustomGameMode.MoveAndStop when player.PlayerId == 0 => MoveAndStopManager.HUDText,
CustomGameMode.HotPotato when player.PlayerId == 0 => HotPotatoManager.GetSuffixText(player.PlayerId),
CustomGameMode.Standard => player.GetCustomRole() switch
{
CustomRoles.BountyHunter => BountyHunter.GetTargetText(player, true),
CustomRoles.Witch or CustomRoles.HexMaster => Witch.GetSpellModeText(player, true),
CustomRoles.FireWorks => FireWorks.GetStateText(player),
CustomRoles.Swooper or CustomRoles.Wraith or CustomRoles.Chameleon => Swooper.GetHudText(player),
CustomRoles.HeadHunter => HeadHunter.GetHudText(player),
CustomRoles.Alchemist => Alchemist.GetHudText(player),
CustomRoles.Werewolf => Werewolf.GetHudText(player),
CustomRoles.Glitch => Glitch.GetHudText(player),
CustomRoles.NiceHacker => NiceHacker.GetHudText(player),
CustomRoles.Wildling or CustomRoles.BloodKnight => Wildling.GetHudText(player),
CustomRoles.YinYanger => YinYanger.ModeText(player),
CustomRoles.WeaponMaster => WeaponMaster.GetHudAndProgressText(player.PlayerId),
CustomRoles.Postman => Postman.GetHudText(player),
CustomRoles.SoulHunter => SoulHunter.HUDText(player.PlayerId),
CustomRoles.Chronomancer => Chronomancer.GetHudText(player.PlayerId),
CustomRoles.Mafioso => Mafioso.GetHUDText(player),
CustomRoles.Druid => Druid.GetHUDText(player),
CustomRoles.Rabbit => Rabbit.GetSuffix(player),
CustomRoles.Librarian => Librarian.GetSelfSuffixAndHudText(player.PlayerId),
CustomRoles.PlagueDoctor => PlagueDoctor.GetLowerTextOthers(player, isForHud: true),
CustomRoles.Stealth => Stealth.GetSuffix(player, isHUD: true),
CustomRoles.Hookshot => Hookshot.SuffixText(player.PlayerId),
CustomRoles.Tornado => Tornado.GetSuffixText(isHUD: true),
_ => player.Is(CustomRoles.Asthmatic) ? Asthmatic.GetSuffixText(player.PlayerId) : string.Empty,
},
_ => string.Empty,
};
if (GetCD_HUDText() != string.Empty) LowerInfoText.text = $"{GetCD_HUDText()}\n{LowerInfoText.text}";
string GetCD_HUDText() => !Options.UsePets.GetBool() || !Main.AbilityCD.TryGetValue(player.PlayerId, out var CD)
? string.Empty
: string.Format(GetString("CDPT"), CD.TOTALCD - (Utils.TimeStamp - CD.START_TIMESTAMP) + 1);
//LowerInfoText.text += "\n" + (int)System.Math.Round(Main.KillTimers[player.PlayerId]);
LowerInfoText.enabled = LowerInfoText.text != string.Empty;
if ((!AmongUsClient.Instance.IsGameStarted && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay) || GameStates.IsMeeting)
{
LowerInfoText.enabled = false;
}
if (player.CanUseKillButton() && !player.GetCustomRole().UsesPetInsteadOfKill())
{
__instance.KillButton?.ToggleVisible(player.IsAlive() && GameStates.IsInTask);
player.Data.Role.CanUseKillButton = true;
}
else
{
__instance.KillButton?.SetDisabled();
__instance.KillButton?.ToggleVisible(false);
}
bool CanUseVent = (player.CanUseImpostorVentButton() || player.inVent) && GameStates.IsInTask;
__instance.ImpostorVentButton?.ToggleVisible(CanUseVent);
player.Data.Role.CanVent = CanUseVent;
}
else
{
__instance.ReportButton?.Hide();
__instance.ImpostorVentButton?.Hide();
__instance.KillButton?.Hide();
__instance.AbilityButton?.Show();
__instance.AbilityButton?.OverrideText(GetString(StringNames.HauntAbilityName));
}
}
if (Input.GetKeyDown(KeyCode.Y) && AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay)
{
__instance.ToggleMapVisible(new()
{
Mode = MapOptions.Modes.Sabotage,
AllowMovementWhileMapOpen = true
});
if (player.AmOwner)
{
player.MyPhysics.inputHandler.enabled = true;
ConsoleJoystick.SetMode_Task();
}
}
if (AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame) RepairSender.enabled = false;
if (Input.GetKeyDown(KeyCode.RightShift) && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
{
RepairSender.enabled = !RepairSender.enabled;
RepairSender.Reset();
}
if (RepairSender.enabled && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
{
if (Input.GetKeyDown(KeyCode.Alpha0)) RepairSender.Input(0);
if (Input.GetKeyDown(KeyCode.Alpha1)) RepairSender.Input(1);
if (Input.GetKeyDown(KeyCode.Alpha2)) RepairSender.Input(2);
if (Input.GetKeyDown(KeyCode.Alpha3)) RepairSender.Input(3);
if (Input.GetKeyDown(KeyCode.Alpha4)) RepairSender.Input(4);
if (Input.GetKeyDown(KeyCode.Alpha5)) RepairSender.Input(5);
if (Input.GetKeyDown(KeyCode.Alpha6)) RepairSender.Input(6);
if (Input.GetKeyDown(KeyCode.Alpha7)) RepairSender.Input(7);
if (Input.GetKeyDown(KeyCode.Alpha8)) RepairSender.Input(8);
if (Input.GetKeyDown(KeyCode.Alpha9)) RepairSender.Input(9);
if (Input.GetKeyDown(KeyCode.Return)) RepairSender.InputEnter();
}
}
if (Input.GetKeyDown(KeyCode.Y) && AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay)
catch (NullReferenceException e)
{
__instance.ToggleMapVisible(new()
{
Mode = MapOptions.Modes.Sabotage,
AllowMovementWhileMapOpen = true
});
if (player.AmOwner)
{
player.MyPhysics.inputHandler.enabled = true;
ConsoleJoystick.SetMode_Task();
}
if (LastNullError >= Utils.TimeStamp) return;
LastNullError = Utils.TimeStamp + 2;
Utils.ThrowException(e);
}
if (AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame) RepairSender.enabled = false;
if (Input.GetKeyDown(KeyCode.RightShift) && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
catch (Exception e)
{
RepairSender.enabled = !RepairSender.enabled;
RepairSender.Reset();
}
if (RepairSender.enabled && AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
{
if (Input.GetKeyDown(KeyCode.Alpha0)) RepairSender.Input(0);
if (Input.GetKeyDown(KeyCode.Alpha1)) RepairSender.Input(1);
if (Input.GetKeyDown(KeyCode.Alpha2)) RepairSender.Input(2);
if (Input.GetKeyDown(KeyCode.Alpha3)) RepairSender.Input(3);
if (Input.GetKeyDown(KeyCode.Alpha4)) RepairSender.Input(4);
if (Input.GetKeyDown(KeyCode.Alpha5)) RepairSender.Input(5);
if (Input.GetKeyDown(KeyCode.Alpha6)) RepairSender.Input(6);
if (Input.GetKeyDown(KeyCode.Alpha7)) RepairSender.Input(7);
if (Input.GetKeyDown(KeyCode.Alpha8)) RepairSender.Input(8);
if (Input.GetKeyDown(KeyCode.Alpha9)) RepairSender.Input(9);
if (Input.GetKeyDown(KeyCode.Return)) RepairSender.InputEnter();
Utils.ThrowException(e);
}
}
}
+1 -1
View File
@@ -419,7 +419,7 @@ class SetEverythingUpPatch
static string GetAdditionalWinnerRoleName(CustomRoles role)
{
var name = GetString($"AdditionalWinnerRoleText.{Enum.GetName(typeof(CustomRoles), role)}");
if (name == string.Empty || name.StartsWith("*") || name.StartsWith("<INVALID")) name = Utils.GetRoleName(role);
if (name == string.Empty || name.StartsWith("*") || name.StartsWith("<INVALID")) name = string.Format(GetString("AdditionalWinnerRoleText.Default"), Utils.GetRoleName(role));
return name;
}
+5 -8
View File
@@ -1079,18 +1079,15 @@ class FixedUpdatePatch
}
}
if (!lowLoad)
foreach (var state in Main.PlayerStates.Values)
{
foreach (var state in Main.PlayerStates.Values)
if (state.Role.IsEnable)
{
if (state.Role.IsEnable)
{
state.Role.OnGlobalFixedUpdate(player);
}
state.Role.OnGlobalFixedUpdate(player, lowLoad);
}
Randomizer.OnFixedUpdateForPlayers(player);
}
if (!lowLoad) Randomizer.OnFixedUpdateForPlayers(player);
}
if (!lowLoad)
+2
View File
@@ -3676,6 +3676,8 @@
"AdditionalWinnerRoleText.Romantic": "The Romantic wins along",
"AdditionalWinnerRoleText.VengefulRomantic": "The Vengeful Romantic avenged their lover",
"AdditionalWinnerRoleText.Postman": "The Postman delivered mail to everyone",
"AdditionalWinnerRoleText.SoulHunter": "Soul Hunter wins along",
"AdditionalWinnerRoleText.Default": "{0} wins along",
"ErrorEndText": "An error occurred",
"ErrorEndTextDescription": "To avoid crashing, the game was forcibly ended.",
"ForceEnd": "Aborted",
+2 -2
View File
@@ -632,11 +632,11 @@ namespace TOHE.Roles.Crewmate
LastDeathEffect = Utils.TimeStamp;
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
try
{
if (!Exists || !GameStates.IsInTask || Bombs.Count == 0) return;
if (lowLoad || !Exists || !GameStates.IsInTask || Bombs.Count == 0) return;
var now = Utils.TimeStamp;
var randomizer = Utils.GetPlayerById(PlayerIdList.FirstOrDefault());
+2 -2
View File
@@ -66,9 +66,9 @@ namespace TOHE.Roles.Impostor
return false;
}
public override void OnGlobalFixedUpdate(PlayerControl pc)
public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
{
if (DuelPair.Count == 0) return;
if (lowLoad || DuelPair.Count == 0) return;
foreach (var pair in DuelPair)
{
+2 -2
View File
@@ -63,9 +63,9 @@ namespace TOHE.Roles.Impostor
});
}
public override void OnGlobalFixedUpdate(PlayerControl pc)
public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
{
if (!On) return;
if (lowLoad || !On) return;
foreach (var kkId in PlayerIdList)
{
+2 -1
View File
@@ -204,8 +204,9 @@ namespace TOHE.Roles.Impostor
if (AbductVictim != null)
{
Penguin_.MarkDirtySettings();
stopCount = false;
}
stopCount = false;
}
public override void OnFixedUpdate(PlayerControl pc)
+2 -2
View File
@@ -91,9 +91,9 @@ namespace TOHE.Roles.Impostor
return false;
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
if (player == null) return;
if (player == null || lowLoad) return;
byte playerId = player.PlayerId;
long now = Utils.TimeStamp;
+1 -1
View File
@@ -134,7 +134,7 @@ namespace TOHE.Roles.Impostor
}
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
byte playerId = player.PlayerId;
if (GameStates.IsInTask && Main.WarlockTimer.ContainsKey(playerId))
+1 -1
View File
@@ -108,7 +108,7 @@ namespace TOHE.Roles.Impostor
SendRPC(true);
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
if (!GameStates.IsInTask) return;
+2 -2
View File
@@ -133,11 +133,11 @@ public class Agitater : RoleBase
Logger.Info($"{killer.GetRealName()} bombed {target.GetRealName()} on report", "Agitater");
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
var playerId = player.PlayerId;
if (GameStates.IsInTask && IsEnable && AgitaterHasBombed && CurrentBombedPlayer == playerId)
if (!lowLoad && GameStates.IsInTask && IsEnable && AgitaterHasBombed && CurrentBombedPlayer == playerId)
{
if (!player.IsAlive())
{
+1 -1
View File
@@ -138,7 +138,7 @@ namespace TOHE.Roles.Neutral
}
}
public override void OnGlobalFixedUpdate(PlayerControl player)
public override void OnGlobalFixedUpdate(PlayerControl player, bool lowLoad)
{
var playerId = player.PlayerId;
if (GameStates.IsInTask && Main.ArsonistTimer.ContainsKey(playerId))
+2 -2
View File
@@ -99,9 +99,9 @@ namespace TOHE.Roles.Neutral
return false;
}
public override void OnGlobalFixedUpdate(PlayerControl encasedPc)
public override void OnGlobalFixedUpdate(PlayerControl encasedPc, bool lowLoad)
{
if (!IsEnable || !GameStates.IsInTask || !EncasedPlayers.TryGetValue(encasedPc.PlayerId, out var ts)) return;
if (lowLoad || !IsEnable || !GameStates.IsInTask || !EncasedPlayers.TryGetValue(encasedPc.PlayerId, out var ts)) return;
long now = TimeStamp;
var id = encasedPc.PlayerId;
+5
View File
@@ -40,6 +40,11 @@ namespace TOHE.Roles.Neutral
hud.ImpostorVentButton?.ToggleVisible(false);
}
public override bool CanUseKillButton(PlayerControl pc)
{
return pc.IsAlive();
}
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
target.Kill(killer);
+3 -1
View File
@@ -74,6 +74,8 @@ namespace TOHE.Roles.Neutral
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = WaitingTimeAfterMeeting.GetFloat() + 1.5f;
public override void ApplyGameOptions(IGameOptions opt, byte id) => opt.SetVision(HasImpostorVision.GetBool());
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
public override bool CanUseKillButton(PlayerControl pc) => pc.IsAlive();
public static bool IsSoulHunterTarget(byte id) => Main.PlayerStates.Any(x => x.Value.Role is SoulHunter { IsEnable: true, IsTargetBlocked: true } sh && sh.CurrentTarget.ID == id);
public static SoulHunter GetSoulHunter(byte targetId) => Main.PlayerStates.FirstOrDefault(x => x.Value.Role is SoulHunter { IsEnable: true, IsTargetBlocked: true } sh && sh.CurrentTarget.ID == targetId).Value.Role as SoulHunter;
@@ -151,7 +153,7 @@ namespace TOHE.Roles.Neutral
PlayerControl target = GetPlayerById(CurrentTarget.ID);
int waitingTime = WaitingTimeAfterMeeting.GetInt();
SoulHunter_.Notify(string.Format(GetString("SoulHunterNotifyFreeze"), target.GetRealName(), waitingTime + 1));
if (!SoulHunter_.IsModClient()) SoulHunter_.Notify(string.Format(GetString("SoulHunterNotifyFreeze"), target.GetRealName(), waitingTime + 1));
target.Notify(string.Format(GetString("SoulHunterTargetNotify"), SoulHunter_.GetRealName()), 300f);
LastUpdate = now;
+1 -1
View File
@@ -44,7 +44,7 @@ namespace TOHE
{
}
public virtual void OnGlobalFixedUpdate(PlayerControl pc)
public virtual void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
{
}
+1 -1
View File
@@ -7,7 +7,7 @@
<Description>TOHE+</Description>
<Authors>Gurge44</Authors>
<langVersion>preview</langVersion>
<AmongUs>E:\Program Files\AmongUs</AmongUs>
<AmongUs>D:\Epic Games\AmongUs</AmongUs>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>True</Optimize>
<AssemblyName>$(MSBuildProjectName)+</AssemblyName>
-7
View File
@@ -1062,25 +1062,18 @@ public enum AdditionalWinners
None = -1,
Lovers = CustomRoles.Lovers,
Opportunist = CustomRoles.Opportunist,
Executioner = CustomRoles.Executioner,
Lawyer = CustomRoles.Lawyer,
FFF = CustomRoles.FFF,
Provocateur = CustomRoles.Provocateur,
Sunnyboy = CustomRoles.Sunnyboy,
//Witch = CustomRoles.NWitch,
Totocalcio = CustomRoles.Totocalcio,
Romantic = CustomRoles.Romantic,
VengefulRomantic = CustomRoles.VengefulRomantic,
RuthlessRomantic = CustomRoles.RuthlessRomantic,
Jackal = CustomRoles.Jackal,
Sidekick = CustomRoles.Sidekick,
Pursuer = CustomRoles.Pursuer,
Phantom = CustomRoles.Phantom,
Maverick = CustomRoles.Maverick,
Postman = CustomRoles.Postman,
SoulHunter = CustomRoles.SoulHunter,
// Baker = CustomRoles.Baker,
}
public enum SuffixModes