Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Jul 13, 2024
1 parent 684e135 commit b1fb805
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 70 deletions.
1 change: 0 additions & 1 deletion TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using TheOtherRoles.Utilities;
using UnityEngine;
using static TheOtherRoles.TheOtherRoles;
using static UnityEngine.GraphicsBuffer;

namespace TheOtherRoles
{
Expand Down
30 changes: 15 additions & 15 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using static TheOtherRoles.TheOtherRoles;
using static TheOtherRoles.CustomOption;
using static TheOtherRoles.TheOtherRoles;
using Types = TheOtherRoles.CustomOption.CustomOptionType;

namespace TheOtherRoles;
Expand Down Expand Up @@ -108,16 +108,16 @@ public class CustomOptionHolder
public static CustomOption swooperDuration;
public static CustomOption jackalCreateSidekickCooldown;
public static CustomOption jackalImpostorCanFindSidekick;
public static CustomOption jackalKillFakeImpostor;
public static CustomOption jackalCanUseVents;
public static CustomOption jackalCanUseSabo;
public static CustomOption jackalCanCreateSidekick;
public static CustomOption sidekickPromotesToJackal;
public static CustomOption sidekickCanKill;
public static CustomOption sidekickCanUseVents;
public static CustomOption jackalPromotedFromSidekickCanCreateSidekick;
public static CustomOption jackalCanCreateSidekickFromImpostor;
public static CustomOption jackalAndSidekickHaveImpostorVision;
public static CustomOption jackalCanCreateSidekickFromImpostor;
public static CustomOption jackalKillFakeImpostor;

public static CustomOption juggernautSpawnRate;
public static CustomOption juggernautCooldown;
Expand Down Expand Up @@ -262,7 +262,7 @@ public class CustomOptionHolder
public static CustomOption snitchSpawnRate;
public static CustomOption snitchLeftTasksForReveal;
public static CustomOption snitchSeeMeeting;
public static CustomOption snitchCanSeeRoles;
//public static CustomOption snitchCanSeeRoles;
public static CustomOption snitchIncludeNeutralTeam;
public static CustomOption snitchTeamNeutraUseDifferentArrowColor;

Expand Down Expand Up @@ -454,7 +454,6 @@ public class CustomOptionHolder

public static CustomOption modifierShifter;

//public static CustomOption preventTaskEnd;
public static CustomOption resteButtonCooldown;

public static CustomOption maxNumberOfMeetings;
Expand All @@ -476,6 +475,7 @@ public class CustomOptionHolder
public static CustomOption ShowVentsOnMeetingMap;
public static CustomOption allowModGuess;
public static CustomOption finishTasksBeforeHauntingOrZoomingOut;
public static CustomOption preventTaskEnd;
public static CustomOption camsNightVision;
public static CustomOption camsNoNightVisionIfImpVision;
public static CustomOption deadImpsBlockSabotage;
Expand Down Expand Up @@ -647,7 +647,7 @@ public static void Load()
disableMedbayWalk = Create(33, Types.General, "Disable MedBay Animations", false);
allowParallelMedBayScans = Create(34, Types.General, "Allow Parallel MedBay Scans", false);
finishTasksBeforeHauntingOrZoomingOut = Create(35, Types.General, "Finish Tasks Before Haunting Or Zooming Out", true);
//preventTaskEnd = CustomOption.Create(36, Types.General, "Prevent Task End Game", false);
preventTaskEnd = Create(36, Types.General, "Prevent Task End Game", false);

//Map options
randomGameStartPosition = Create(50, Types.General, "Random Spawn Location", false, null, true);
Expand Down Expand Up @@ -853,6 +853,13 @@ public static void Load()
juggernautCanVent = Create(20113, Types.Neutral, "Can Use Vents", true, juggernautSpawnRate);
juggernautReducedkillEach = Create(20114, Types.Neutral, "Reduced Kill Cooldown Per Kill", 5f, 1f, 15f, 0.5f, juggernautSpawnRate);

thiefSpawnRate = Create(20120, Types.Neutral, cs(Thief.color, "Thief"), rates, null, true);
thiefCooldown = Create(20121, Types.Neutral, "Thief Cooldown", 30f, 5f, 120f, 5f, thiefSpawnRate);
thiefCanKillSheriff = Create(20122, Types.Neutral, "Thief Can Kill Sheriff", true, thiefSpawnRate);
thiefHasImpVision = Create(20123, Types.Neutral, "Thief Has Impostor Vision", true, thiefSpawnRate);
thiefCanUseVents = Create(20124, Types.Neutral, "Thief Can Use Vents", true, thiefSpawnRate);
thiefCanStealWithGuess = Create(20125, Types.Neutral, "Thief Can Guess To Steal A Role (If Guesser)", false, thiefSpawnRate);

//-------------------------- Crewmate Options 30000-39999 -------------------------- //

guesserSpawnRate = Create(30000, Types.Crewmate, cs(Guesser.color, "Vigilante"), rates, null, true);
Expand Down Expand Up @@ -959,8 +966,8 @@ public static void Load()

snitchSpawnRate = Create(30170, Types.Crewmate, cs(Snitch.color, "Snitch"), rates, null, true);
snitchLeftTasksForReveal = Create(30171, Types.Crewmate, "Task Count Where The Snitch Will Be Revealed", 1f, 0f, 10f, 1f, snitchSpawnRate);
snitchSeeMeeting = Create(30172, Types.Crewmate, "Show Roles Color", true, snitchSpawnRate);
snitchCanSeeRoles = Create(30173, Types.Crewmate, "Can See Roles Info", false, snitchSeeMeeting);
snitchSeeMeeting = Create(30172, Types.Crewmate, "Show Roles Color In Meeting", true, snitchSpawnRate);
//snitchCanSeeRoles = Create(30173, Types.Crewmate, "Can See Roles Info", false, snitchSeeMeeting);
snitchIncludeNeutralTeam = Create(30174, Types.Crewmate, "Include Team Neutral", ["Off", "Killer", "Evil", "All"], snitchSpawnRate);
snitchTeamNeutraUseDifferentArrowColor = Create(30175, Types.Crewmate, "Use Different Color For Neutra Team", true, snitchIncludeNeutralTeam);

Expand Down Expand Up @@ -1004,13 +1011,6 @@ public static void Load()
bodyGuardResetTargetAfterMeeting = Create(30231, Types.Crewmate, "Reset Target After Meeting", true, bodyGuardSpawnRate);
bodyGuardFlash = Create(30232, Types.Crewmate, "Show Flash On Death", true, bodyGuardSpawnRate);

thiefSpawnRate = Create(30240, Types.Neutral, cs(Thief.color, "Thief"), rates, null, true);
thiefCooldown = Create(30241, Types.Neutral, "Thief Cooldown", 30f, 5f, 120f, 5f, thiefSpawnRate);
thiefCanKillSheriff = Create(30242, Types.Neutral, "Thief Can Kill Sheriff", true, thiefSpawnRate);
thiefHasImpVision = Create(30243, Types.Neutral, "Thief Has Impostor Vision", true, thiefSpawnRate);
thiefCanUseVents = Create(30244, Types.Neutral, "Thief Can Use Vents", true, thiefSpawnRate);
thiefCanStealWithGuess = Create(30245, Types.Neutral, "Thief Can Guess To Steal A Role (If Guesser)", false, thiefSpawnRate);

trapperSpawnRate = Create(30250, Types.Crewmate, cs(Trapper.color, "Trapper"), rates, null, true);
trapperCooldown = Create(30251, Types.Crewmate, "Trapper Cooldown", 30f, 5f, 120f, 5f, trapperSpawnRate);
trapperMaxCharges = Create(30252, Types.Crewmate, "Max Traps Charges", 5f, 1f, 15f, 1f, trapperSpawnRate);
Expand Down
1 change: 0 additions & 1 deletion TheOtherRoles/Helper/HandshakeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Hazel;
using TheOtherRoles.Patches;
Expand Down
3 changes: 1 addition & 2 deletions TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,8 +1303,7 @@ public static PlayerControl getChatPartnerSwitch(this PlayerControl player)
public static bool isNeutral(PlayerControl player)
{
var roleInfo = RoleInfo.getRoleInfoForPlayer(player, false).FirstOrDefault();
if (roleInfo != null)
return roleInfo.isNeutral;
if (roleInfo != null) return roleInfo.isNeutral;
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class TheOtherRolesPlugin : BasePlugin
public static ConfigEntry<bool> ShowRoleSummary { get; set; }
public static ConfigEntry<bool> ShowLighterDarker { get; set; }
public static ConfigEntry<bool> EnableSoundEffects { get; set; }
public static ConfigEntry<bool> ShowFPS { get; set; }
public static ConfigEntry<bool> EnableHorseMode { get; set; }
public static ConfigEntry<bool> ToggleCursor { get; set; }
public static ConfigEntry<string> Ip { get; set; }
Expand Down Expand Up @@ -103,6 +104,7 @@ public override void Load()
EnableSoundEffects = Config.Bind("Custom", "Enable Sound Effects", true);
EnableHorseMode = Config.Bind("Custom", "Enable Horse Mode", false);
ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0");
ShowFPS = Config.Bind("Custom", "Show FPS", true);

Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1");
Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023);
Expand Down
24 changes: 14 additions & 10 deletions TheOtherRoles/MapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static class TORMapOptions
public static bool hideOutOfSightNametags = false;
public static bool ShowVentsOnMap = false;
public static bool ShowVentsOnMeetingMap = true;
public static bool showFPS = true;
public static bool disableMedscanWalking = false;
public static int restrictDevices = 0;
// public static float restrictAdminTime = 600f;
Expand All @@ -39,6 +40,7 @@ static class TORMapOptions
public static bool disableCamsRoundOne = false;
public static bool isRoundOne = true;
public static bool camoComms = false;
public static bool preventTaskEnd = false;
public static bool randomGameStartPosition = false;
public static bool allowModGuess = false;
public static CustomGamemodes gameMode = CustomGamemodes.Classic;
Expand Down Expand Up @@ -78,6 +80,7 @@ public static void clearAndReloadMapOptions()
randomGameStartPosition = CustomOptionHolder.randomGameStartPosition.getBool();
ShowVentsOnMap = CustomOptionHolder.ShowVentsOnMap.getBool();
ShowVentsOnMeetingMap = CustomOptionHolder.ShowVentsOnMeetingMap.getBool();
preventTaskEnd = CustomOptionHolder.preventTaskEnd.getBool();
//allowModGuess = false;
allowModGuess = CustomOptionHolder.allowModGuess.getBool();
firstKillPlayer = null;
Expand All @@ -86,17 +89,18 @@ public static void clearAndReloadMapOptions()

public static void reloadPluginOptions()
{
ghostsSeeRoles = TheOtherRolesPlugin.GhostsSeeRoles.Value;
ghostsSeeModifier = TheOtherRolesPlugin.GhostsSeeModifier.Value;
ghostsSeeInformation = TheOtherRolesPlugin.GhostsSeeInformation.Value;
ghostsSeeVotes = TheOtherRolesPlugin.GhostsSeeVotes.Value;
showRoleSummary = TheOtherRolesPlugin.ShowRoleSummary.Value;
showLighterDarker = TheOtherRolesPlugin.ShowLighterDarker.Value;
toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value;
enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value;
enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
ghostsSeeRoles = Main.GhostsSeeRoles.Value;
ghostsSeeModifier = Main.GhostsSeeModifier.Value;
ghostsSeeInformation = Main.GhostsSeeInformation.Value;
ghostsSeeVotes = Main.GhostsSeeVotes.Value;
showRoleSummary = Main.ShowRoleSummary.Value;
showLighterDarker = Main.ShowLighterDarker.Value;
toggleCursor = Main.ToggleCursor.Value;
enableSoundEffects = Main.EnableSoundEffects.Value;
enableHorseMode = Main.EnableHorseMode.Value;
showFPS = Main.ShowFPS.Value;

//Patches.ShouldAlwaysHorseAround.isHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
//Patches.ShouldAlwaysHorseAround.isHorseMode = Main.EnableHorseMode.Value;
}
public static void resetDeviceTimes()
{
Expand Down
29 changes: 19 additions & 10 deletions TheOtherRoles/Patches/ClientOptionsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@ namespace TheOtherRoles.Patches
[HarmonyPatch]
public static class ClientOptionsPatch
{
private static readonly SelectionBehaviour[] AllOptions = {
new("Ghosts See Tasks & Other Info", () => TORMapOptions.ghostsSeeInformation = TheOtherRolesPlugin.GhostsSeeInformation.Value = !TheOtherRolesPlugin.GhostsSeeInformation.Value, TheOtherRolesPlugin.GhostsSeeInformation.Value),
new("Ghosts Can See Votes", () => TORMapOptions.ghostsSeeVotes = TheOtherRolesPlugin.GhostsSeeVotes.Value = !TheOtherRolesPlugin.GhostsSeeVotes.Value, TheOtherRolesPlugin.GhostsSeeVotes.Value),
new("Ghosts Can See Roles", () => TORMapOptions.ghostsSeeRoles = TheOtherRolesPlugin.GhostsSeeRoles.Value = !TheOtherRolesPlugin.GhostsSeeRoles.Value, TheOtherRolesPlugin.GhostsSeeRoles.Value),
new("Ghosts Can Additionally See Modifier", () => TORMapOptions.ghostsSeeModifier = TheOtherRolesPlugin.GhostsSeeModifier.Value = !TheOtherRolesPlugin.GhostsSeeModifier.Value, TheOtherRolesPlugin.GhostsSeeModifier.Value),
new("Show Role Summary", () => TORMapOptions.showRoleSummary = TheOtherRolesPlugin.ShowRoleSummary.Value = !TheOtherRolesPlugin.ShowRoleSummary.Value, TheOtherRolesPlugin.ShowRoleSummary.Value),
new("Show Lighter / Darker", () => TORMapOptions.showLighterDarker = TheOtherRolesPlugin.ShowLighterDarker.Value = !TheOtherRolesPlugin.ShowLighterDarker.Value, TheOtherRolesPlugin.ShowLighterDarker.Value),
new SelectionBehaviour("Better Cursor", () => TORMapOptions.toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value = !TheOtherRolesPlugin.ToggleCursor.Value, TheOtherRolesPlugin.ToggleCursor.Value),
new("Enable Sound Effects", () => TORMapOptions.enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value = !TheOtherRolesPlugin.EnableSoundEffects.Value, TheOtherRolesPlugin.EnableSoundEffects.Value)
};
private static readonly SelectionBehaviour[] AllOptions = [
new("Ghosts See Tasks & Other Info", () =>
TORMapOptions.ghostsSeeInformation = Main.GhostsSeeInformation.Value = !Main.GhostsSeeInformation.Value, Main.GhostsSeeInformation.Value),
new("Ghosts Can See Votes", () =>
TORMapOptions.ghostsSeeVotes = Main.GhostsSeeVotes.Value = !Main.GhostsSeeVotes.Value, Main.GhostsSeeVotes.Value),
new("Ghosts Can See Roles", () =>
TORMapOptions.ghostsSeeRoles = Main.GhostsSeeRoles.Value = !Main.GhostsSeeRoles.Value, Main.GhostsSeeRoles.Value),
new("Ghosts Can Additionally See Modifier", () =>
TORMapOptions.ghostsSeeModifier = Main.GhostsSeeModifier.Value = !Main.GhostsSeeModifier.Value, Main.GhostsSeeModifier.Value),
new("Show Role Summary", () =>
TORMapOptions.showRoleSummary = Main.ShowRoleSummary.Value = !Main.ShowRoleSummary.Value, Main.ShowRoleSummary.Value),
new("Show Lighter / Darker", () =>
TORMapOptions.showLighterDarker = Main.ShowLighterDarker.Value = !Main.ShowLighterDarker.Value, Main.ShowLighterDarker.Value),
new("Better Cursor", () =>
TORMapOptions.toggleCursor = Main.ToggleCursor.Value = !Main.ToggleCursor.Value, Main.ToggleCursor.Value),
new("Enable Sound Effects", () =>
TORMapOptions.enableSoundEffects = Main.EnableSoundEffects.Value = !Main.EnableSoundEffects.Value, Main.EnableSoundEffects.Value),
new("ShowFPS", () => TORMapOptions.showFPS = Main.ShowFPS.Value = !Main.ShowFPS.Value, Main.ShowFPS.Value),
];

private static GameObject popUp;
private static TextMeshPro titleText;
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Patches/CredentialsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void Postfix(PingTracker __instance)
{
DeltaTime += (Time.deltaTime - DeltaTime) * 0.1f;
var fps = Mathf.Ceil(1f / DeltaTime);
var PingText = $"<size=80%>Ping: {AmongUsClient.Instance.Ping}ms FPS: {fps}</size>";
var PingText = $"<size=80%>Ping: {AmongUsClient.Instance.Ping}ms {(TORMapOptions.showFPS ? $"FPS: {fps}" : "")}</size>";
var host = $"<size=80%>{"Host"}: {GameData.Instance?.GetHost()?.PlayerName}</size>";

__instance.text.alignment = TextAlignmentOptions.TopRight;
Expand Down
1 change: 1 addition & 0 deletions TheOtherRoles/Patches/EndGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ private static bool CheckAndEndGameForSabotageWin(ShipStatus __instance)

private static bool CheckAndEndGameForTaskWin(ShipStatus __instance)
{
if (TORMapOptions.preventTaskEnd) return false;
if ((HideNSeek.isHideNSeekGM && !HideNSeek.taskWinPossible) || PropHunt.isPropHuntGM) return false;
if (GameData.Instance.TotalTasks > 0
&& GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks
Expand Down
12 changes: 4 additions & 8 deletions TheOtherRoles/Patches/GameStartManagerPatch.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using HarmonyLib;
using UnityEngine;
using System.Reflection;
using System.Collections.Generic;
using Hazel;
using System;
using TheOtherRoles.Utilities;
using System.Collections.Generic;
using System.Linq;
using Hazel;
using Reactor.Utilities.Extensions;
using TheOtherRoles.Modules;
using TheOtherRoles.Utilities;
using UnityEngine;
using static TheOtherRoles.Helper.HandshakeHelper;
using System.Drawing;

namespace TheOtherRoles.Patches;

Expand Down
18 changes: 2 additions & 16 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static void vampireSetTarget()
static void jackalSetTarget()
{
if (Jackal.jackal == null || Jackal.jackal != CachedPlayer.LocalPlayer.PlayerControl) return;
var untargetablePlayers = new List<PlayerControl>();
var untargetablePlayers = new List<PlayerControl>();
if (Jackal.canCreateSidekickFromImpostor)
{
// Only exclude sidekick from beeing targeted if the jackal can create sidekicks from impostors
Expand Down Expand Up @@ -697,21 +697,7 @@ public static void updatePlayerInfo()
p.cosmetics.nameText.transform.parent
.SetLocalZ(-0.0001f); // This moves both the name AND the colorblindtext behind objects (if the player is behind the object), like the rock on polus

//Snitch See Roles
bool snitchFlag = false;
if (Snitch.snitch != null && Snitch.seeInMeeting && Snitch.canSeeRoles && !Snitch.snitch.Data.IsDead)
{
var (playerCompleted, playerTotal) = TasksHandler.taskInfo(Snitch.snitch.Data);
int numberOfTasks = playerTotal - playerCompleted;
bool completedSnitch = CachedPlayer.LocalPlayer.PlayerControl == Snitch.snitch && numberOfTasks == 0;
bool forImpTeam = p.Data.Role.IsImpostor;
bool forKillerTeam = Snitch.Team == Snitch.includeNeutralTeam.KillNeutral && isKiller(p);
bool forEvilTeam = Snitch.Team == Snitch.includeNeutralTeam.EvilNeutral && isEvil(p);
bool forNeutraTeam = Snitch.Team == Snitch.includeNeutralTeam.AllNeutral && isNeutral(p);
snitchFlag = completedSnitch && (forImpTeam || forKillerTeam || forEvilTeam || forNeutraTeam);
}

if (snitchFlag || (Lawyer.lawyerKnowsRole && CachedPlayer.LocalPlayer.PlayerControl == Lawyer.lawyer && p == Lawyer.target) ||
if ((Lawyer.lawyerKnowsRole && CachedPlayer.LocalPlayer.PlayerControl == Lawyer.lawyer && p == Lawyer.target) ||
p == CachedPlayer.LocalPlayer.PlayerControl ||
CachedPlayer.LocalPlayer.Data.IsDead ||
(CachedPlayer.LocalPlayer.PlayerControl == Slueth.slueth &&
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ public static void jackalCreatesSidekick(byte targetId)
erasePlayerRoles(player.PlayerId, true);
Sidekick.sidekick = player;
if (player.PlayerId == CachedPlayer.LocalPlayer.PlayerId) CachedPlayer.LocalPlayer.PlayerControl.moveable = true;
if ((wasSpy || wasImpostor) && Jackal.ImpostorCanFindSidekick) Sidekick.wasTeamRed = true;
if ((wasSpy || wasImpostor) && !Jackal.ImpostorCanFindSidekick) Sidekick.wasTeamRed = true;
Sidekick.wasSpy = wasSpy;
Sidekick.wasImpostor = wasImpostor;
if (player == CachedPlayer.LocalPlayer.PlayerControl) SoundEffectsManager.play("jackalSidekick");
Expand Down
Loading

0 comments on commit b1fb805

Please sign in to comment.