Skip to content

Commit

Permalink
TownOfHost-K v.519.24.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoran-Furan committed Dec 8, 2024
1 parent cb64c2e commit cce9e37
Show file tree
Hide file tree
Showing 44 changed files with 1,109 additions and 1,043 deletions.
33 changes: 21 additions & 12 deletions Helpers/CustomRolesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,29 @@ CustomRoles.PurpleLovers or
}
public static bool IsRiaju(this PlayerControl pc, bool checkonelover = true)
{
return pc.Is(CustomRoles.Lovers) || pc.Is(CustomRoles.RedLovers) || pc.Is(CustomRoles.YellowLovers) || pc.Is(CustomRoles.BlueLovers) || pc.Is(CustomRoles.GreenLovers) || pc.Is(CustomRoles.WhiteLovers) || pc.Is(CustomRoles.PurpleLovers) || pc.Is(CustomRoles.MadonnaLovers) || (pc.Is(CustomRoles.OneLove) && checkonelover);
return pc.Is(CustomRoles.Lovers) || pc.Is(CustomRoles.RedLovers) ||
pc.Is(CustomRoles.YellowLovers) || pc.Is(CustomRoles.BlueLovers) ||
pc.Is(CustomRoles.GreenLovers) || pc.Is(CustomRoles.WhiteLovers) ||
pc.Is(CustomRoles.PurpleLovers) || pc.Is(CustomRoles.MadonnaLovers) ||
(pc.Is(CustomRoles.OneLove) && checkonelover);
}
public static CustomRoles GetRiaju(this PlayerControl pc)
{
if (pc == null) return CustomRoles.NotAssigned;
if (pc.Is(CustomRoles.Lovers)) return CustomRoles.Lovers;
if (pc.Is(CustomRoles.RedLovers)) return CustomRoles.RedLovers;
if (pc.Is(CustomRoles.YellowLovers)) return CustomRoles.YellowLovers;
if (pc.Is(CustomRoles.BlueLovers)) return CustomRoles.BlueLovers;
if (pc.Is(CustomRoles.GreenLovers)) return CustomRoles.GreenLovers;
if (pc.Is(CustomRoles.WhiteLovers)) return CustomRoles.WhiteLovers;
if (pc.Is(CustomRoles.PurpleLovers)) return CustomRoles.PurpleLovers;
if (pc.Is(CustomRoles.MadonnaLovers)) return CustomRoles.MadonnaLovers;
if (pc.Is(CustomRoles.OneLove)) return CustomRoles.OneLove;
var state = PlayerState.GetByPlayerId(pc.PlayerId);
foreach (var sub in state.SubRoles)
switch (sub)
{
case CustomRoles.Lovers: return CustomRoles.Lovers;
case CustomRoles.RedLovers: return CustomRoles.RedLovers;
case CustomRoles.YellowLovers: return CustomRoles.YellowLovers;
case CustomRoles.BlueLovers: return CustomRoles.BlueLovers;
case CustomRoles.GreenLovers: return CustomRoles.GreenLovers;
case CustomRoles.WhiteLovers: return CustomRoles.WhiteLovers;
case CustomRoles.PurpleLovers: return CustomRoles.PurpleLovers;
case CustomRoles.OneLove: return CustomRoles.OneLove;
case CustomRoles.MadonnaLovers: return CustomRoles.MadonnaLovers;
}
return CustomRoles.NotAssigned;
}
public static bool IsWhiteCrew(this CustomRoles roles)
Expand Down Expand Up @@ -193,8 +202,8 @@ public static bool CheckGuesser()
if (RoleAddAddons.GetRoleAddon(role, out var op, subrole: CustomRoles.Guesser))
if (op.GiveGuesser.GetBool()) return true;
}
if (CustomRoles.LastImpostor.IsPresent() && LastNeutral.GiveGuesser.GetBool()) return true;
if (CustomRoles.LastNeutral.IsPresent() && LastImpostor.giveguesser) return true;
if (CustomRoles.LastImpostor.IsPresent() && LastImpostor.giveguesser) return true;
if (CustomRoles.LastNeutral.IsPresent() && LastNeutral.GiveGuesser.GetBool()) return true;

return false;
}
Expand Down
9 changes: 5 additions & 4 deletions Modules/Camouflague.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ public static void CheckCamouflage()
public static List<byte> ventplayr = new();
public static void RpcSetSkin(PlayerControl target, bool ForceRevert = false, bool RevertToDefault = false, bool? kyousei = false)
{
if (!AmongUsClient.Instance.AmHost && !(Options.CommsCamouflage.GetBool() || (kyousei is null or true))) return;
if (GameStates.IsLobby) return;
if (target == null) return;
if ((!AmongUsClient.Instance.AmHost && !(Options.CommsCamouflage.GetBool() || (kyousei is null or true)))
|| (GameStates.IsLobby)
|| (target == null)) return;

var id = target.PlayerId;

if (IsCamouflage && kyousei is true)
Expand All @@ -94,7 +95,7 @@ public static void RpcSetSkin(PlayerControl target, bool ForceRevert = false, bo
{
//コミュサボ解除または強制解除

if (Main.CheckShapeshift.TryGetValue(id, out var shapeshifting) && target.GetRoleClass() is not IUseTheShButton && shapeshifting && !RevertToDefault && kyousei is not null)
if (Main.CheckShapeshift.TryGetValue(id, out var shapeshifting) /*&& target.GetRoleClass() is not IUseTheShButton */ && shapeshifting && !RevertToDefault && kyousei is not null)
{
//シェイプシフターなら今の姿のidに変更
id = Main.ShapeshiftTarget[id];
Expand Down
68 changes: 32 additions & 36 deletions Modules/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,39 @@ public static void SendMessage(PlayerControl player, string message)
else if (CommandCheck(message)) operate = 1;
else if (message.RemoveHtmlTags() != message) operate = 5;//tagが含まれてるならシステムメッセ

if (operate == 1)
switch (operate)
{
message = msg;
cancel = true;
}
else if (operate == 2)
{
message = msg;
cancel = false;
}
else if (operate == 5)
{
message = msg;
cancel = false;
}
else if (operate == 4)//特定の人物が喋ったら消すなどに。
{
message = msg;
cancel = false;
SendPreviousMessagesToAll();
}
else if (operate == 6)
{
if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait();
}
else if (operate == 3)
{
if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait();
message = msg;
string chatEntry = $"{player.PlayerId}: {message}";
chatHistory.Add(chatEntry);

if (chatHistory.Count > maxHistorySize)
{
chatHistory.RemoveAt(0);
}
cancel = false;
case 1://その他コマンド
message = msg;
cancel = true;
break;
case 2://ゲッサーコマンド
message = msg;
cancel = false;
break;
case 3: //投票の記録、通常のチャット
if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait();
message = msg;
string chatEntry = $"{player.PlayerId}: {message}";
chatHistory.Add(chatEntry);
if (chatHistory.Count > maxHistorySize)
{
chatHistory.RemoveAt(0);
}
cancel = false;
break;
case 4: //特定の人物が喋ったら消す等
message = msg;
cancel = false;
SendPreviousMessagesToAll();
break;
case 5://システムメッセージ
message = msg;
cancel = false;
break;
case 6://ロビーの処理
if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait();
break;
}
}

Expand Down
75 changes: 25 additions & 50 deletions Modules/DisableDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DisableDevice
public static float optTimeLimitCamAndLog;
public static float optTarnTimeLimitCamAndLog;
public static float optTimeLimitAdmin;
public static float optTimeLimitVital;
public static bool DisableDevicesIgnoreImpostors;
public static bool DisableDevicesIgnoreMadmates;
public static bool DisableDevicesIgnoreNeutrals;
Expand All @@ -49,6 +50,7 @@ public static void Reset()
optTimeLimitDevices = Options.TimeLimitDevices.GetBool();
optTarnTimeLimitDevice = Options.TarnTimeLimitDevice.GetBool();
optTimeLimitAdmin = Options.TimeLimitAdmin.GetFloat();
optTimeLimitVital = Options.TimeLimitVital.GetFloat();
DisableDevicesIgnoreImpostors = Options.DisableDevicesIgnoreImpostors.GetBool();
DisableDevicesIgnoreMadmates = Options.DisableDevicesIgnoreMadmates.GetBool();
DisableDevicesIgnoreNeutrals = Options.DisableDevicesIgnoreNeutrals.GetBool();
Expand Down Expand Up @@ -79,27 +81,27 @@ public static void StartMeeting()
}
public static string GetAddminTimer()
{
if (optTimeLimitAdmin == 0) return "";
if ((MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return "";
if (optTimeLimitAdmin == 0
|| (MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return "";
var a = "<color=#00ff99>Ⓐ";
if (optTimeLimitAdmin <= GameAdminTimer) return a + "×";
else return a + ":" + Math.Round(optTimeLimitAdmin - GameAdminTimer) + "s";
}
public static string GetCamTimr()
{
if (optTimeLimitCamAndLog == 0) return "";
if ((MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return "";
if (optTimeLimitCamAndLog == 0
|| (MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return "";
var a = (MapNames)Main.NormalOptions.MapId is MapNames.Mira ? "<color=#cccccc>Ⓛ" : "<color=#cccccc>Ⓒ";
if (optTimeLimitCamAndLog <= GameLogAndCamTimer) return a + "×";
else return a + ":" + Math.Round(optTimeLimitCamAndLog - GameLogAndCamTimer) + "s";
}
public static string GetVitalTimer()
{
if (Options.TimeLimitVital.GetFloat() == 0) return "";
if ((MapNames)Main.NormalOptions.MapId is MapNames.Skeld or MapNames.Mira) return "";
if (optTimeLimitVital == 0
|| (MapNames)Main.NormalOptions.MapId is MapNames.Skeld or MapNames.Mira) return "";
var a = "<color=#33ccff>Ⓥ";
if (Options.TimeLimitVital.GetFloat() <= GameVitalTimer) return a + "×";
else return a + ":" + Math.Round(Options.TimeLimitVital.GetFloat() - GameVitalTimer) + "s";
if (optTimeLimitVital <= GameVitalTimer) return a + "×";
else return a + ":" + Math.Round(optTimeLimitVital - GameVitalTimer) + "s";
}
public static readonly Dictionary<string, Vector2> DevicePos = new()
{
Expand Down Expand Up @@ -162,9 +164,9 @@ public static bool VitealUsecheck(PlayerControl player, bool? i = null)

if (DemonicCrusher.DemUseAbility) return i == null;

if (Options.TimeLimitVital.GetFloat() > 0 && GameVitalTimer > Options.TimeLimitVital.GetFloat()) return i == null;
if (optTimeLimitVital > 0 && GameVitalTimer > optTimeLimitVital) return i == null;

if (Options.TarnTimeLimitVital.GetFloat() > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat()) return i == null;
if (optTimeLimitVital > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat()) return i == null;

if (player.Is(CustomRoles.InfoPoor) ||
(RoleAddAddons.GetRoleAddon(player.GetCustomRole(), out var data, player, subrole: CustomRoles.InfoPoor) &&
Expand Down Expand Up @@ -459,19 +461,12 @@ public static void Postfix(VitalsMinigame __instance)

if (PlayerControl.LocalPlayer.IsAlive())
{
var ch = true;
if (Options.TimeLimitVital.GetFloat() > 0 && GameVitalTimer > Options.TimeLimitVital.GetFloat())
if ((optTimeLimitVital > 0 && GameVitalTimer > optTimeLimitVital)
|| (optTimeLimitVital > 0 && TarnVitalTimer > optTimeLimitVital))
{
__instance.Close();
ch = false;
}

if (Options.TarnTimeLimitVital.GetFloat() > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat())
{
__instance.Close();
ch = false;
}
if (ch)
else
{
if (optTimeLimitDevices) GameVitalTimer += Time.fixedDeltaTime;
if (optTarnTimeLimitDevice) TarnVitalTimer += Time.fixedDeltaTime;
Expand All @@ -491,12 +486,8 @@ public static void Postfix(PlanetSurveillanceMinigame __instance)
if (PlayerControl.LocalPlayer.IsAlive() && DemonicCrusher.DemUseAbility) __instance.Close();
if (PlayerControl.LocalPlayer.IsAlive() && __instance)
{
if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
{
__instance.Close();
}

if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)
if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
|| (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog))
{
__instance.Close();
}
Expand All @@ -515,10 +506,8 @@ public static void Postfix(SurveillanceMinigame __instance)

if (PlayerControl.LocalPlayer.IsAlive() && __instance)
{
if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
__instance.Close();

if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)
if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
|| (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog))
__instance.Close();
}
}
Expand All @@ -536,19 +525,12 @@ public static void Postfix(SecurityLogGame __instance)

if (PlayerControl.LocalPlayer.IsAlive() && __instance)
{
var ch = true;
if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
{
__instance.Close();
ch = false;
}

if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)
if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog)
|| (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog))
{
__instance.Close();
ch = false;
}
if (ch)
else
{
if (optTimeLimitDevices) GameLogAndCamTimer += Time.fixedDeltaTime;
if (optTarnTimeLimitDevice) TarnLogAndCamTimer += Time.fixedDeltaTime;
Expand All @@ -574,19 +556,12 @@ public static void Prefix(MapCountOverlay __instance)
}
if (PlayerControl.LocalPlayer.IsAlive() && MapBehaviour.Instance && __instance)
{
var ch = true;
if (optTimeLimitAdmin > 0 && GameAdminTimer > optTimeLimitAdmin)
{
MapBehaviour.Instance.Close();
ch = false;
}

if (optTimeLimitAdmin > 0 && TarnAdminTimer > optTimeLimitAdmin)
if ((optTimeLimitAdmin > 0 && GameAdminTimer > optTimeLimitAdmin)
|| (optTimeLimitAdmin > 0 && TarnAdminTimer > optTimeLimitAdmin))
{
MapBehaviour.Instance.Close();
ch = false;
}
if (ch)
else
{
if (optTimeLimitDevices) GameAdminTimer += Time.fixedDeltaTime;
if (optTarnTimeLimitDevice) TarnAdminTimer += Time.fixedDeltaTime;
Expand Down
2 changes: 1 addition & 1 deletion Modules/GameOptionsSender/PlayerGameOptionsSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public override IGameOptions BuildGameOptions()
}

state.taskState.hasTasks = UtilsTask.HasTasks(player.Data, false);
if ((GhostCanSeeOtherVotes.GetBool() || !Options.GhostOptions.GetBool()) && player.Data.IsDead && !player.Is(CustomRoles.AsistingAngel) && (!player.IsGorstRole() || GRCanSeeOtherVotes.GetBool()))
if ((GhostCanSeeOtherVotes.GetBool() || !GhostOptions.GetBool()) && player.Data.IsDead && !player.Is(CustomRoles.AsistingAngel) && (!player.IsGorstRole() || GRCanSeeOtherVotes.GetBool()))
opt.SetBool(BoolOptionNames.AnonymousVotes, false);
if (AdditionalEmergencyCooldown.GetBool() && AdditionalEmergencyCooldownThreshold.GetInt() <= PlayerCatch.AllAlivePlayersCount)
{
Expand Down
Loading

0 comments on commit cce9e37

Please sign in to comment.