mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
v2.0.0
This commit is contained in:
1 parent
f9c9e1a2b6
commit
2e66fb54f9
21 files changed
+617
-148
No files matched your search
@@ -29,7 +29,6 @@ public static class BanManager
|
||||
private static string TemplatePath = $"{DataPath}/AUR-DATA/Templates.txt";
|
||||
private static string StartWordsPath = $"{DataPath}/AUR-DATA/Startwords.txt";
|
||||
public static Dictionary<string, string> Templates = new();
|
||||
public static List<string> TempBanWhiteList = [];
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
@@ -81,7 +80,7 @@ public static class BanManager
|
||||
public static void AddBanPlayer(ClientData player)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || player == null) return;
|
||||
if (!CheckBanList(player?.FriendCode, player?.GetHashedPuid()) && !TempBanWhiteList.Contains(player?.GetHashedPuid()))
|
||||
if (!CheckBanList(player?.FriendCode, player?.GetHashedPuid()))
|
||||
{
|
||||
if (player?.GetHashedPuid() != "" && player?.GetHashedPuid() != null && player?.GetHashedPuid() != "e3b0cb855")
|
||||
{
|
||||
@@ -106,13 +105,6 @@ public static class BanManager
|
||||
Logger.Info($"{player.PlayerName} was in the BanList and has been banned", "BanListBan");
|
||||
return;
|
||||
}
|
||||
if (TempBanWhiteList.Contains(player?.GetHashedPuid()))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(player.Id, true);
|
||||
//This should not happen
|
||||
Logger.Info($"{player.PlayerName} was in the Temporary BanList", "TempBan");
|
||||
return;
|
||||
}
|
||||
}
|
||||
public static bool CheckBanList(string code, string hashedpuid = "")
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ internal static class CommandHelper
|
||||
|
||||
new Cmd { Name = new[] { "/sns" }, Prompt = "/sns", Description = Translator.Get("snsDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/shiftandseek" }, Prompt = "/shiftandseek", Description = Translator.Get("snsDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/sns2" }, Prompt = "/sns2", Description = Translator.Get("snsTwoDesc"), HasVariable = false },
|
||||
|
||||
new Cmd { Name = new[] { "/0kc" }, Prompt = "/0kc", Description = Translator.Get("0kcDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/0killcooldown" }, Prompt = "/0killcooldown", Description = Translator.Get("0kcDesc"), HasVariable = false },
|
||||
@@ -82,7 +83,8 @@ internal static class CommandHelper
|
||||
new Cmd { Name = new[] { "/clearseeker" }, Prompt = "/clearseeker", Description = Translator.Get("clearSeekerDesc"), HasVariable = false },
|
||||
|
||||
new Cmd { Name = new[] { "/mapvote" }, Prompt = "/mapvote", Description = Translator.Get("mapVoteDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/allmapvote" }, Prompt = "/allmapvote", Description = Translator.Get("allMapVoteDesc"), HasVariable = false }
|
||||
new Cmd { Name = new[] { "/allmapvote" }, Prompt = "/allmapvote", Description = Translator.Get("allMapVoteDesc"), HasVariable = false },
|
||||
new Cmd { Name = new[] { "/gmvote" }, Prompt = "/gmvote", Description = Translator.Get("modeVoteDesc"), HasVariable = false }
|
||||
};
|
||||
|
||||
[HarmonyPostfix]
|
||||
|
||||
@@ -104,6 +104,8 @@ namespace AmongUsRevamped
|
||||
public static OptionItem TimeBeforeMapPoll;
|
||||
public static OptionItem AutomaticAllMapPoll;
|
||||
public static OptionItem TimeBeforeAllMapPoll;
|
||||
public static OptionItem AutomaticModePoll;
|
||||
public static OptionItem TimeBeforeModePoll;
|
||||
|
||||
public static OptionItem TabGroupAutostart;
|
||||
public static OptionItem AutoStartTimer;
|
||||
@@ -121,6 +123,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static OptionItem TabGroupMisc;
|
||||
public static OptionItem MapVoteDuration;
|
||||
public static OptionItem ModeVoteDuration;
|
||||
public static OptionItem StartCountdown;
|
||||
public static OptionItem ColorCommandLevel;
|
||||
public static OptionItem AllowFortegreen;
|
||||
@@ -149,8 +152,9 @@ namespace AmongUsRevamped
|
||||
public static OptionItem DisableCloseDoor;
|
||||
|
||||
public static OptionItem TabGroupGameplayGeneral;
|
||||
public static OptionItem ShieldFirstDeath;
|
||||
public static OptionItem ShieldFirstDeathDuration;
|
||||
public static OptionItem DisableAnnoyingMeetingCalls;
|
||||
|
||||
public static OptionItem ChangeDecontaminationTime;
|
||||
public static OptionItem DecontaminationTimeOnMiraHQ;
|
||||
public static OptionItem DecontaminationDoorOpenTimeOnMiraHQ;
|
||||
@@ -294,6 +298,8 @@ namespace AmongUsRevamped
|
||||
public static OptionItem TabGroupSNS;
|
||||
public static OptionItem SNSChatInGame;
|
||||
public static OptionItem SNSChatInGameExtend;
|
||||
public static OptionItem SNSChatInGameExtend2;
|
||||
public static OptionItem SNSChatInGameFast;
|
||||
public static OptionItem CrewAutoWinsGameAfter;
|
||||
public static OptionItem MisfiresToSuicide;
|
||||
public static OptionItem SNSDisableSabotage;
|
||||
@@ -313,6 +319,7 @@ namespace AmongUsRevamped
|
||||
public static OptionItem TabGroupPNS;
|
||||
public static OptionItem PNSChatInGame;
|
||||
public static OptionItem PNSChatInGameExtend;
|
||||
public static OptionItem PNSChatInGameFast;
|
||||
public static OptionItem PNSCrewAutoWinsGameAfter;
|
||||
public static OptionItem BadMoveTimeToSuicide;
|
||||
public static OptionItem PNSDisableSabotage;
|
||||
@@ -410,6 +417,10 @@ namespace AmongUsRevamped
|
||||
TimeBeforeAllMapPoll = IntegerOptionItem.Create(60157, Translator.Get("timeBeforeMapPoll"), new(10, 300, 5), 10, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetParent(AutomaticAllMapPoll);
|
||||
AutomaticModePoll = BooleanOptionItem.Create(60158, Translator.Get("automaticModePoll"), false, TabGroup.SystemSettings, false);
|
||||
TimeBeforeModePoll = IntegerOptionItem.Create(60159, Translator.Get("timeBeforeMapPoll"), new(10, 300, 5), 20, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetParent(AutomaticModePoll);
|
||||
|
||||
TabGroupAutostart = TextOptionItem.Create(64425, Translator.Get("tabGroupAutostart"), TabGroup.SystemSettings)
|
||||
.SetColor(Color.yellow);
|
||||
@@ -438,7 +449,10 @@ namespace AmongUsRevamped
|
||||
MapVoteDuration = IntegerOptionItem.Create(60379, Translator.Get("mapVoteDuration"), new(5, 60, 5), 20, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(Color.red);
|
||||
StartCountdown = IntegerOptionItem.Create(60380, Translator.Get("startCountdown"), new(1, 5, 1), 5, TabGroup.SystemSettings, false)
|
||||
ModeVoteDuration = IntegerOptionItem.Create(60380, Translator.Get("modeVoteDuration"), new(5, 60, 5), 20, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(Color.red);
|
||||
StartCountdown = IntegerOptionItem.Create(60381, Translator.Get("startCountdown"), new(1, 5, 1), 5, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(Color.red);
|
||||
AllowFortegreen = BooleanOptionItem.Create(60382, Translator.Get("allowFortegreen"), false, TabGroup.SystemSettings, false)
|
||||
@@ -456,36 +470,40 @@ namespace AmongUsRevamped
|
||||
TabGroupSNS = TextOptionItem.Create(70050, Translator.Get("tabGroupSNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
SNSChatInGame = BooleanOptionItem.Create(70051, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
SNSChatInGameExtend = BooleanOptionItem.Create(70052, Translator.Get("snsChatInGameExtend"), false, TabGroup.GamemodeSettings, false)
|
||||
SNSChatInGameExtend = BooleanOptionItem.Create(70052, Translator.Get("snsChatInGameExtend"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSChatInGame);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70053, Translator.Get("misfiresToSuicide"), new(1, 10, 1), 1, TabGroup.GamemodeSettings, false);
|
||||
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, Translator.Get("crewAutoWinsGameAfter"), new(60, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
SNSChatInGameExtend2 = BooleanOptionItem.Create(70053, Translator.Get("snsChatInGameExtendTwo"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSChatInGame);
|
||||
SNSChatInGameFast = BooleanOptionItem.Create(70054, Translator.Get("snsChatInGameFast"), false, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSChatInGame);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70055, Translator.Get("misfiresToSuicide"), new(1, 10, 1), 1, TabGroup.GamemodeSettings, false);
|
||||
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70056, Translator.Get("crewAutoWinsGameAfter"), new(60, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
SNSDisableSabotage = BooleanOptionItem.Create(70055, Translator.Get("snsDisableSabotage"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableSabotage = BooleanOptionItem.Create(70057, Translator.Get("snsDisableSabotage"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
SNSDisableReactor = BooleanOptionItem.Create(70056, Translator.Get("snsDisableReactor"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableReactor = BooleanOptionItem.Create(70058, Translator.Get("snsDisableReactor"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableOxygen = BooleanOptionItem.Create(70057, Translator.Get("snsDisableOxygen"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableOxygen = BooleanOptionItem.Create(70059, Translator.Get("snsDisableOxygen"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableLights = BooleanOptionItem.Create(70058, Translator.Get("snsDisableLights"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableLights = BooleanOptionItem.Create(70060, Translator.Get("snsDisableLights"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableComms = BooleanOptionItem.Create(70059, Translator.Get("snsDisableComms"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableComms = BooleanOptionItem.Create(70061, Translator.Get("snsDisableComms"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableHeli = BooleanOptionItem.Create(70060, Translator.Get("snsDisableHeli"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableHeli = BooleanOptionItem.Create(70062, Translator.Get("snsDisableHeli"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableMushroomMixup = BooleanOptionItem.Create(70061, Translator.Get("snsDisableMushroomMixup"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableMushroomMixup = BooleanOptionItem.Create(70063, Translator.Get("snsDisableMushroomMixup"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(SNSDisableSabotage)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
SNSDisableCloseDoor = BooleanOptionItem.Create(70062, Translator.Get("snsDisableCloseDoor"), true, TabGroup.GamemodeSettings, false)
|
||||
SNSDisableCloseDoor = BooleanOptionItem.Create(70064, Translator.Get("snsDisableCloseDoor"), true, TabGroup.GamemodeSettings, false)
|
||||
.SetColor(Color.red);
|
||||
SNSImpostorsCanVent = BooleanOptionItem.Create(70063, Translator.Get("snsImpostorCanVent"), true, TabGroup.GamemodeSettings, false);
|
||||
SNSImpostorsCanVent = BooleanOptionItem.Create(70065, Translator.Get("snsImpostorCanVent"), true, TabGroup.GamemodeSettings, false);
|
||||
|
||||
TabGroupSpeedrun = TextOptionItem.Create(70075, Translator.Get("tabGroupSpeedrun"), TabGroup.GamemodeSettings)
|
||||
TabGroupSpeedrun = TextOptionItem.Create(70076, Translator.Get("tabGroupSpeedrun"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
GameAutoEndsAfter = IntegerOptionItem.Create(70077, Translator.Get("gameAutoEndsAfter"), new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
@@ -493,8 +511,10 @@ namespace AmongUsRevamped
|
||||
|
||||
TabGroupPNS = TextOptionItem.Create(70100, Translator.Get("tabGroupPNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
PNSChatInGame = BooleanOptionItem.Create(70102, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
PNSChatInGameExtend = BooleanOptionItem.Create(70103, Translator.Get("snsChatInGameExtend"), false, TabGroup.GamemodeSettings, false)
|
||||
PNSChatInGame = BooleanOptionItem.Create(70101, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
PNSChatInGameExtend = BooleanOptionItem.Create(70102, Translator.Get("snsChatInGameExtend"), false, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSChatInGame);
|
||||
PNSChatInGameFast = BooleanOptionItem.Create(70103, Translator.Get("snsChatInGameFast"), false, TabGroup.GamemodeSettings, false)
|
||||
.SetParent(PNSChatInGame);
|
||||
BadMoveTimeToSuicide = IntegerOptionItem.Create(70104, Translator.Get("badMoveTimeToSuicide"), new(1, 30, 1), 3, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
@@ -554,7 +574,11 @@ namespace AmongUsRevamped
|
||||
|
||||
TabGroupGameplayGeneral = TextOptionItem.Create(60564, Translator.Get("tabGroupGameplayGeneral"), TabGroup.ModSettings)
|
||||
.SetColor(Color.blue);
|
||||
DisableAnnoyingMeetingCalls = BooleanOptionItem.Create(60565, Translator.Get("disableAnnoyingMeetingCalls"), false, TabGroup.ModSettings, false);
|
||||
ShieldFirstDeath = BooleanOptionItem.Create(60565, Translator.Get("shieldFirstDeath"), false, TabGroup.ModSettings, false);
|
||||
ShieldFirstDeathDuration = IntegerOptionItem.Create(60566, Translator.Get("shieldFirstDeathDuration"), new(10, 120, 5), 30, TabGroup.ModSettings, false)
|
||||
.SetParent(ShieldFirstDeath)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
DisableAnnoyingMeetingCalls = BooleanOptionItem.Create(60567, Translator.Get("disableAnnoyingMeetingCalls"), false, TabGroup.ModSettings, false);
|
||||
|
||||
ChangeDecontaminationTime = BooleanOptionItem.Create(60550, Translator.Get("changeDecontaminationTime"), false, TabGroup.ModSettings, false);
|
||||
DecontaminationTimeOnMiraHQ = FloatOptionItem.Create(60551, Translator.Get("decontaminationTimeOnMiraHQ"), new(0.5f, 10f, 0.25f), 3f, TabGroup.ModSettings, false)
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ internal class EACR
|
||||
goto YesCheat;
|
||||
}
|
||||
|
||||
if (Utils.IsMeeting && MeetingHud.Instance.state != MeetingHud.VoteStates.Animating)
|
||||
if (Utils.IsMeeting && MeetingHud.Instance.state != MeetingHud.MeetingStates.Animating)
|
||||
{
|
||||
Logger.SendInGame($"{player.Data.PlayerName} might have called an invalid sabotage (cheating)");
|
||||
Logger.Info($" {player.Data.PlayerName} might have called an invalid sabotage (cheating)", "EACR");
|
||||
|
||||
+17
-42
@@ -119,54 +119,17 @@ public static class FixedUpdate
|
||||
}
|
||||
}
|
||||
|
||||
// We check if any SnS Shapshifter is currently nearby their correct target.
|
||||
// If so, the global Kill Cooldown is set to 1 and all killing actions may proceed.
|
||||
// If not, the global Kill Cooldown is set to 0.
|
||||
// While this value is 0, the game stops the kill cooldown from decreasing.
|
||||
// If the Kill Cooldown value is 0 by default (which it will be at the start of a match), Among Us does not allow kills at all.
|
||||
// This means most of the time, we can successfully prevent invalid kills.
|
||||
// The only problem is that if one Shapeshifter is nearby their correct target, while another is not, the second Shapeshifter can kill too.
|
||||
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && !Utils.IsLobby)
|
||||
{
|
||||
bool shapeshifterNearTarget = false;
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data == null || p.Data.IsDead || p.shapeshiftTargetPlayerId == byte.MaxValue) continue;
|
||||
if (p.Data == null || p.Data.IsDead || p.Data.RoleType == RoleTypes.Shapeshifter) continue;
|
||||
|
||||
PlayerControl shapeshiftTarget = null;
|
||||
|
||||
foreach (var t in PlayerControl.AllPlayerControls)
|
||||
if (p.protectedByGuardianId == -1)
|
||||
{
|
||||
if (t.Data == null || t.Data.IsDead) continue;
|
||||
|
||||
if (t.Data.PlayerId == p.shapeshiftTargetPlayerId)
|
||||
{
|
||||
shapeshiftTarget = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shapeshiftTarget == null) continue;
|
||||
|
||||
float distance = Vector2.Distance(p.GetTruePosition(), shapeshiftTarget.GetTruePosition());
|
||||
|
||||
if (distance <= 3f)
|
||||
{
|
||||
shapeshifterNearTarget = true;
|
||||
break;
|
||||
p.RpcProtectPlayer(p, p.cosmetics.ColorId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float newCooldown = shapeshifterNearTarget ? 1f : 0f;
|
||||
|
||||
if (Main.NormalOptions.KillCooldown != newCooldown)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = newCooldown;
|
||||
OptionManager.SyncGameOptions();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +209,13 @@ class FixedUpdateInGamePatch
|
||||
|
||||
case 1: // SnS
|
||||
if (Utils.InGame) return;
|
||||
if (Main.NormalOptions.KillCooldown != 1f) Main.NormalOptions.KillCooldown = 1f;
|
||||
if (Main.NormalOptions.KillCooldown != 2.5f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Shapeshifter, 3, 100);
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Phantom, 0, 0);
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Viper, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // Speedrun
|
||||
@@ -254,7 +223,13 @@ class FixedUpdateInGamePatch
|
||||
|
||||
case 3: // PnS
|
||||
if (Utils.InGame) return;
|
||||
if (Main.NormalOptions.KillCooldown != 1f) Main.NormalOptions.KillCooldown = 1f;
|
||||
if (Main.NormalOptions.KillCooldown != 1f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 1f;
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Shapeshifter, 0, 0);
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Phantom, 3, 100);
|
||||
Main.NormalOptions.roleOptions.SetRoleRate(RoleTypes.Viper, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace AmongUsRevamped
|
||||
{
|
||||
Logger.Info($" Disconnected due to {reason}/{stringReason}, ping:{__instance.Ping})", "DisconnectManager");
|
||||
|
||||
if (!EOSManager.Instance.loginFlowFinished || EOSManager.Instance.authExpiredCallbackTriggered)
|
||||
{
|
||||
Logger.Info("Attempted to log in using EOS", "DisconnectManager");
|
||||
EOSManager.Instance.AdultPermissionsFlow();
|
||||
}
|
||||
|
||||
if (!Options.Rehost.GetBool() || reason == DisconnectReasons.NewConnection || reason == DisconnectReasons.ConnectionLimit || reason == DisconnectReasons.ExitGame) return;
|
||||
|
||||
_ = new LateTask(() =>
|
||||
|
||||
+85
-1
@@ -42,6 +42,7 @@ public static class Utils
|
||||
public static bool HandlingGameEnd;
|
||||
public static byte CustomGameOverReason;
|
||||
public static bool CanCallMeetings;
|
||||
public static bool HasMurdered;
|
||||
|
||||
public static string ColorString(Color32 color, string str) => $"<#{color.r:x2}{color.g:x2}{color.b:x2}{color.a:x2}>{str}</color>";
|
||||
public static string ColorToHex(Color32 color) => $"#{color.r:x2}{color.g:x2}{color.b:x2}{color.a:x2}";
|
||||
@@ -206,9 +207,11 @@ public static class Utils
|
||||
Main.GameTimer = 0f;
|
||||
Main.AfkTimer = 0f;
|
||||
FixedUpdate.Position.Clear();
|
||||
|
||||
NormalGameEndChecker.canUpdateWinnerText = true;
|
||||
MurderPlayerPatch.misfireCount.Clear();
|
||||
MurderPlayerPatch.killCount.Clear();
|
||||
HasMurdered = false;
|
||||
|
||||
LateTask.Tasks.RemoveAll(x => x.name != "RehostManager");
|
||||
NormalGameEndChecker.ImpCheckComplete = false;
|
||||
@@ -240,6 +243,13 @@ public static class Utils
|
||||
dleksVotes = 0;
|
||||
HasVoted.Clear();
|
||||
MapVoteActive = false;
|
||||
|
||||
standardVotes = 0;
|
||||
noKillCooldownVotes = 0;
|
||||
speedrunVotes = 0;
|
||||
shiftAndSeekVotes = 0;
|
||||
poofAndSeekVotes = 0;
|
||||
ModeVoteActive = false;
|
||||
}
|
||||
|
||||
public static PlayerControl[] AllAlivePlayerControls
|
||||
@@ -598,7 +608,7 @@ public static class Utils
|
||||
public static readonly List<byte> HasVoted = [];
|
||||
public static void MapVote(bool dleks, bool moderator)
|
||||
{
|
||||
if (MapVoteActive) return;
|
||||
if (MapVoteActive || ModeVoteActive) return;
|
||||
|
||||
DleksEnabled = dleks;
|
||||
MapVoteActive = true;
|
||||
@@ -676,4 +686,78 @@ public static class Utils
|
||||
MapVoteActive = false;
|
||||
}, Options.MapVoteDuration.GetInt(), "MapPoll");
|
||||
}
|
||||
|
||||
public static int standardVotes;
|
||||
public static int noKillCooldownVotes;
|
||||
public static int speedrunVotes;
|
||||
public static int shiftAndSeekVotes;
|
||||
public static int poofAndSeekVotes;
|
||||
public static bool ModeVoteActive;
|
||||
public static readonly List<byte> HasModeVoted = [];
|
||||
public static void ModeVote(bool moderator)
|
||||
{
|
||||
if (ModeVoteActive || MapVoteActive) return;
|
||||
|
||||
ModeVoteActive = true;
|
||||
|
||||
if (moderator) Utils.ModeratorChatCommand("A Gamemode vote is active!\n\nA: None\nB: No Kill Cooldown\nC: Speedrun\nD: SnS\nE: PnS\n\nType /vote 'letter' to vote.", "", false);
|
||||
else Utils.ChatCommand(DestroyableSingleton<HudManager>.Instance.Chat, "A Gamemode vote is active!\n\nA: None\nB: No Kill Cooldown\nC: Speedrun\nD: SnS\nE: PnS\n\nType /vote 'letter' to vote.", "", false);
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
int highest = standardVotes;
|
||||
string winner = "None";
|
||||
byte modeId = 0;
|
||||
bool tie = false;
|
||||
|
||||
void Check(int votes, string name, byte id)
|
||||
{
|
||||
if (votes > highest)
|
||||
{
|
||||
highest = votes;
|
||||
winner = name;
|
||||
modeId = id;
|
||||
tie = false;
|
||||
}
|
||||
else if (votes == highest)
|
||||
{
|
||||
tie = true;
|
||||
}
|
||||
}
|
||||
|
||||
Check(noKillCooldownVotes, "0 Kill Cooldown", 0);
|
||||
Check(speedrunVotes, "Speedrun", 2);
|
||||
Check(shiftAndSeekVotes, "Shift and Seek", 1);
|
||||
Check(poofAndSeekVotes, "Poof and Seek", 3);
|
||||
|
||||
string voteResults = $"Standard: {standardVotes}\n" + $"No Kill Cooldown: {noKillCooldownVotes}\n" + $"Speedrun: {speedrunVotes}\n" + $"Shift and Seek: {shiftAndSeekVotes}\n" + $"Poof and Seek: {poofAndSeekVotes}";
|
||||
if (highest == 0)
|
||||
{
|
||||
ModeratorChatCommand("We have a winner! Just kidding. No one voted.", "", false);
|
||||
}
|
||||
else if (tie)
|
||||
{
|
||||
ModeratorChatCommand($"Gamemode vote tied. No new mode selected.\n\n{voteResults}", "", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModeratorChatCommand(SendChatPatch.ConvertNum($"Winner: {winner} ({highest})\n\n{voteResults}"), "", false);
|
||||
Options.Gamemode.SetValue(modeId);
|
||||
|
||||
if (winner == "0 Kill Cooldown")
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
}
|
||||
|
||||
}
|
||||
standardVotes = 0;
|
||||
noKillCooldownVotes = 0;
|
||||
speedrunVotes = 0;
|
||||
shiftAndSeekVotes = 0;
|
||||
poofAndSeekVotes = 0;
|
||||
HasVoted.Clear();
|
||||
|
||||
ModeVoteActive = false;
|
||||
}, Options.ModeVoteDuration.GetInt(), "ModePoll");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user