Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Apr 27, 2024
1 parent 54f51ce commit cb8d12b
Show file tree
Hide file tree
Showing 41 changed files with 216 additions and 205 deletions.
4 changes: 3 additions & 1 deletion README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ Even more roles are coming soon.
- #### 新增内容:

- 对所有按钮增加默认冷却为2.5s(给一部分无冷却技能增加提醒)
- 新增 “ 调整紧急破坏持续时间 ” 的选项(使用了SuperNewRoles的部分代码)
- 将模组设置中“在地图上显示管道”选项移动到游戏内预设中,并新增仅在会议中显示管道信息选项
- 新增 “ 调整紧急破坏持续时间 ” 的选项(使用了[SuperNewRoles](https://github.com/SuperNewRoles/SuperNewRoles)的部分代码)
- 优化随机出生,现在分散不会有延迟了
- 为中国玩家在连接GitHub时自动替换链接为国内镜像源
- 法医:延长被保护的玩家被击杀时的闪光提醒时间(从0.5s增加到1.5s)
- 魅魔:将真爱的任务从船员中移除
Expand Down
Binary file modified Strings.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions TheOtherRoles/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2761,8 +2761,8 @@ public static void createButtonsPostfix(HudManager __instance)
arsonistButton.Timer = Arsonist.dousedEveryoneAlive() ? 0 : arsonistButton.MaxTimer;

foreach (var p in Arsonist.dousedPlayers)
if (TORMapOptions.playerIcons.ContainsKey(p.PlayerId))
TORMapOptions.playerIcons[p.PlayerId].setSemiTransparent(false);
if (MapOptions.playerIcons.ContainsKey(p.PlayerId))
MapOptions.playerIcons[p.PlayerId].setSemiTransparent(false);

// Ghost Info
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/CustomGameModes/HideNSeekGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static bool isHunted()

public static void clearAndReload()
{
isHideNSeekGM = TORMapOptions.gameMode == CustomGamemodes.HideNSeek;
isHideNSeekGM = MapOptions.gameMode == CustomGamemodes.HideNSeek;
if (timerText != null) Object.Destroy(timerText);
timerText = null;
if (polusVent != null) Object.Destroy(polusVent);
Expand Down
18 changes: 9 additions & 9 deletions TheOtherRoles/CustomGameModes/PropHunt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal class PropHunt
public static void clearAndReload()
{
remainingShots.Clear();
isPropHuntGM = TORMapOptions.gameMode == CustomGamemodes.PropHunt;
isPropHuntGM = MapOptions.gameMode == CustomGamemodes.PropHunt;
numberOfHunters = CustomOptionHolder.propHuntNumberOfHunters.getQuantity();
initialBlackoutTime = CustomOptionHolder.hunterInitialBlackoutTime.getFloat();
//maxMissesBeforeDeath = CustomOptionHolder.hunterMaxMissesBeforeDeath.getQuantity();
Expand Down Expand Up @@ -202,8 +202,8 @@ public static void poolablePlayerUpdate()

foreach (var pc in PlayerControl.AllPlayerControls)
{
if (!TORMapOptions.playerIcons.ContainsKey(pc.PlayerId)) continue;
var poolablePlayer = TORMapOptions.playerIcons[pc.PlayerId];
if (!MapOptions.playerIcons.ContainsKey(pc.PlayerId)) continue;
var poolablePlayer = MapOptions.playerIcons[pc.PlayerId];
if (pc.Data.IsDead)
{
poolablePlayer.setSemiTransparent(true);
Expand Down Expand Up @@ -620,14 +620,14 @@ public static void MakePropImpostorPatch(PlayerControl __instance)
public static void MapSetPostfix()
{
// Make sure the map in the settings is in sync with the map from li
if ((TORMapOptions.gameMode != CustomGamemodes.PropHunt &&
TORMapOptions.gameMode != CustomGamemodes.HideNSeek) || AmongUsClient.Instance.IsGameStarted) return;
if ((MapOptions.gameMode != CustomGamemodes.PropHunt &&
MapOptions.gameMode != CustomGamemodes.HideNSeek) || AmongUsClient.Instance.IsGameStarted) return;
int map = GameOptionsManager.Instance.currentGameOptions.MapId;
if (map > 3) map--;
if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek)
if (MapOptions.gameMode == CustomGamemodes.HideNSeek)
if (CustomOptionHolder.hideNSeekMap.selection != map)
CustomOptionHolder.hideNSeekMap.updateSelection(map);
if (TORMapOptions.gameMode == CustomGamemodes.PropHunt)
if (MapOptions.gameMode == CustomGamemodes.PropHunt)
if (CustomOptionHolder.propHuntMap.selection != map)
CustomOptionHolder.propHuntMap.updateSelection(map);
}
Expand Down Expand Up @@ -721,10 +721,10 @@ public static bool KillButtonClickPatch(KillButton __instance)

[HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.Show))]
[HarmonyPrefix]
public static void MapBehaviourShowPatch(MapBehaviour __instance, ref MapOptions opts)
public static void MapBehaviourShowPatch(MapBehaviour __instance, ref global::MapOptions opts)
{
if (!isPropHuntGM) return;
if (opts.Mode == MapOptions.Modes.Sabotage) opts.Mode = MapOptions.Modes.Normal;
if (opts.Mode == global::MapOptions.Modes.Sabotage) opts.Mode = global::MapOptions.Modes.Normal;
}


Expand Down
3 changes: 3 additions & 0 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ public class CustomOptionHolder
public static CustomOption impostorSeeRoles;
public static CustomOption transparentTasks;

public static CustomOption ShowVentsOnMap;
public static CustomOption enableMapOptions;
public static CustomOption randomGameStartPosition;
public static CustomOption randomGameStartToVents;
Expand Down Expand Up @@ -715,6 +716,8 @@ public static void Load()
randomGameStartPosition = CustomOption.Create(50, Types.General, "随机出生点", false, enableMapOptions, true);
randomGameStartToVents = CustomOption.Create(51, Types.General, "随机出生在通风口上", false, randomGameStartPosition);

ShowVentsOnMap = CustomOption.Create(211, Types.General, getString("ShowVentsOnMapText"), false, enableMapOptions, true);

enableMiraModify = CustomOption.Create(70, Types.General, cs(new Color(200f / 200f, 200f / 200f, 0, 1f), "Mira"), false, enableMapOptions, true);
miraVitals = CustomOption.Create(71, Types.General, "添加生命检测装置", false, enableMiraModify);

Expand Down
5 changes: 5 additions & 0 deletions TheOtherRoles/GameHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public enum CustomDeathReason
LoveStolen,
Loneliness,
Arson,
SheriffKill,
SheriffMisfire,
SheriffMisadventure,
Suicide,
BombVictim,
}

public CustomDeathReason deathReason;
Expand Down
34 changes: 29 additions & 5 deletions TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static bool isCommsActive()

public static bool isCamoComms()
{
return isCommsActive() && TORMapOptions.camoComms;
return isCommsActive() && MapOptions.camoComms;
}

public static bool isActiveCamoComms()
Expand Down Expand Up @@ -606,7 +606,7 @@ public static bool canBeErased(this PlayerControl player)
public static bool shouldShowGhostInfo()
{
return (CachedPlayer.LocalPlayer.PlayerControl != null && CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead &&
TORMapOptions.ghostsSeeInformation) ||
MapOptions.ghostsSeeInformation) ||
AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Ended;
}

Expand Down Expand Up @@ -660,6 +660,30 @@ public static bool isFungle()
return GameOptionsManager.Instance.CurrentGameOptions.MapId == 5;
}


public static bool IsCN()
{
return (int)AmongUs.Data.DataManager.Settings.Language.CurrentLanguage == 13;
}

public static string GithubUrl(this string url)
{
if (IsCN() && !url.Contains("github.moeyy.xyz"))
{
if (url.Contains("github.com"))
{
return url.Replace("https://github.com", "https://github.moeyy.xyz/https://github.com");
}

if (url.Contains("raw.githubusercontent.com"))
{
return url.Replace("https://raw.githubusercontent.com", "https://github.moeyy.xyz/https://raw.githubusercontent.com");
}
}
Info("Rewrite URL" + url);
return url;
}

public static bool MushroomSabotageActive()
{
return CachedPlayer.LocalPlayer.PlayerControl.myTasks.ToArray()
Expand Down Expand Up @@ -723,7 +747,7 @@ public static bool hidePlayerName(PlayerControl source, PlayerControl target)
if (SurveillanceMinigamePatch.nightVisionIsActive) return true;
if (Ninja.isInvisble && Ninja.ninja == target) return true;
if (Swooper.isInvisable && Swooper.swooper == target) return true;
if (TORMapOptions.hideOutOfSightNametags && gameStarted && !source.Data.IsDead && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 5 &&
if (MapOptions.hideOutOfSightNametags && gameStarted && !source.Data.IsDead && GameOptionsManager.Instance.currentNormalGameOptions.MapId != 5 &&
PhysicsHelpers.AnythingBetween(localPlayer.GetTruePosition(), target.GetTruePosition(),
Constants.ShadowMask, false)) return true;
/*
Expand All @@ -736,7 +760,7 @@ public static bool hidePlayerName(PlayerControl source, PlayerControl target)
}
}
*/
if (!TORMapOptions.hidePlayerNames) return false; // All names are visible
if (!MapOptions.hidePlayerNames) return false; // All names are visible
if (source == null || target == null) return true;
if (source == target) return false; // Player sees his own name
if (source.Data.Role.IsImpostor && (target.Data.Role.IsImpostor || target == Spy.spy ||
Expand Down Expand Up @@ -953,7 +977,7 @@ public static MurderAttemptResult checkMuderAttempt(PlayerControl killer, Player
return MurderAttemptResult.PerformKill;

// Handle first kill attempt
if (TORMapOptions.shieldFirstKill && TORMapOptions.firstKillPlayer == target)
if (MapOptions.shieldFirstKill && MapOptions.firstKillPlayer == target)
return MurderAttemptResult.SuppressKill;

// Handle blank shot
Expand Down
2 changes: 0 additions & 2 deletions TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class TheOtherRolesPlugin : BasePlugin
public static ConfigEntry<bool> EnableSoundEffects { get; set; }
public static ConfigEntry<bool> EnableHorseMode { get; set; }
public static ConfigEntry<bool> ToggleCursor { get; set; }
public static ConfigEntry<bool> ShowVentsOnMap { get; set; }
public static ConfigEntry<bool> enableDebugLogMode { get; set; }
public static ConfigEntry<string> Ip { get; set; }
public static ConfigEntry<ushort> Port { get; set; }
Expand Down Expand Up @@ -107,7 +106,6 @@ 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");
ShowVentsOnMap = Config.Bind("Custom", "Show vent positions on minimap", true);
enableDebugLogMode = Config.Bind("Custom", "Debug Log Mode", false);

Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1");
Expand Down
10 changes: 5 additions & 5 deletions TheOtherRoles/MapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace TheOtherRoles;

internal static class TORMapOptions
internal static class MapOptions
{
// Set values
public static int maxNumberOfMeetings = 10;
Expand All @@ -26,8 +26,8 @@ internal static class TORMapOptions
public static bool impostorSeeRoles;
public static bool transparentTasks;
public static bool hideOutOfSightNametags;
public static bool ShowVentsOnMap = true;
public static bool enableDebugLogMode = false;
public static bool ShowVentsOnMap;
public static bool enableDebugLogMode;
public static bool disableMedscanWalking;

public static int restrictDevices;
Expand Down Expand Up @@ -116,8 +116,8 @@ public static void reloadPluginOptions()
toggleCursor = TheOtherRolesPlugin.ToggleCursor.Value;
enableSoundEffects = TheOtherRolesPlugin.EnableSoundEffects.Value;
enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
ShowVentsOnMap = TheOtherRolesPlugin.ShowVentsOnMap.Value;
ShowVentsOnMap = TheOtherRolesPlugin.enableDebugLogMode.Value;
ShowVentsOnMap = CustomOptionHolder.ShowVentsOnMap.getBool();
enableDebugLogMode = TheOtherRolesPlugin.enableDebugLogMode.Value;

//Patches.ShouldAlwaysHorseAround.isHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
}
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Modules/ChatCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void Postfix(HudManager __instance)
__instance.Chat.SetVisible(true);

if (Multitasker.multitasker.FindAll(x => x.PlayerId == CachedPlayer.LocalPlayer.PlayerId).Count > 0 ||
TORMapOptions.transparentTasks)
MapOptions.transparentTasks)
{
if (PlayerControl.LocalPlayer.Data.IsDead || PlayerControl.LocalPlayer.Data.Disconnected) return;
if (!Minigame.Instance) return;
Expand Down
9 changes: 1 addition & 8 deletions TheOtherRoles/Modules/CustomHats/CustomHatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@ public static class CustomHatManager
public const string InnerslothPackageName = "Innersloth Hats";
public const string DeveloperPackageName = "Developer Hats";

internal static string RepositoryUrl
{
get
{
var Url = $"https://raw.githubusercontent.com/TheOtherRolesAU/TheOtherHats/master".GithubUrl();
return Url;
}
}
internal static string RepositoryUrl => $"https://raw.githubusercontent.com/TheOtherRolesAU/TheOtherHats/master".GithubUrl();

internal static readonly string ManifestFileName = "CustomHats.json";

Expand Down
20 changes: 10 additions & 10 deletions TheOtherRoles/Modules/CustomOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ internal class GameOptionsMenuStartPatch
{
public static void Postfix(GameOptionsMenu __instance)
{
switch (TORMapOptions.gameMode)
switch (MapOptions.gameMode)
{
case CustomGamemodes.Classic:
createClassicTabs(__instance);
Expand Down Expand Up @@ -1143,24 +1143,24 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly)
{
var sb = new StringBuilder("\n");
var options = CustomOption.options.Where(o => o.type == type);
if (TORMapOptions.gameMode == CustomGamemodes.Guesser)
if (MapOptions.gameMode == CustomGamemodes.Guesser)
{
if (type == CustomOptionType.General)
options = CustomOption.options.Where(o => o.type == type || o.type == CustomOptionType.Guesser);
var remove = new List<int> { 308, 310, 311, 312, 313, 314, 315, 316, 317, 318 };
options = options.Where(x => !remove.Contains(x.id));
}
else if (TORMapOptions.gameMode == CustomGamemodes.Classic)
else if (MapOptions.gameMode == CustomGamemodes.Classic)
{
options = options.Where(x =>
!(x.type == CustomOptionType.Guesser || x == CustomOptionHolder.crewmateRolesFill));
}
else if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek)
else if (MapOptions.gameMode == CustomGamemodes.HideNSeek)
{
options = options.Where(x =>
x.type == CustomOptionType.HideNSeekMain || x.type == CustomOptionType.HideNSeekRoles);
}
else if (TORMapOptions.gameMode == CustomGamemodes.PropHunt)
else if (MapOptions.gameMode == CustomGamemodes.PropHunt)
{
options = options.Where(x => x.type == CustomOptionType.PropHunt);
}
Expand All @@ -1177,7 +1177,7 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly)
if (option.id == 30170) //Deputy
sb.AppendLine(
$"- {Helpers.cs(Deputy.color, "捕快")}: {option.selections[option.selection].ToString()}");
else if (option.id == 20136) //Sidekick
else if (option.id == 20135) //Sidekick
sb.AppendLine(
$"- {Helpers.cs(Sidekick.color, "跟班")}: {option.selections[option.selection].ToString()}");
else if (option.id == 20181) //Prosecutor
Expand All @@ -1190,9 +1190,9 @@ private static string buildOptionsOfType(CustomOptionType type, bool headerOnly)

foreach (var option in options)
{
if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek && option.type != CustomOptionType.HideNSeekMain &&
if (MapOptions.gameMode == CustomGamemodes.HideNSeek && option.type != CustomOptionType.HideNSeekMain &&
option.type != CustomOptionType.HideNSeekRoles) continue;
if (TORMapOptions.gameMode == CustomGamemodes.PropHunt &&
if (MapOptions.gameMode == CustomGamemodes.PropHunt &&
option.type != CustomOptionType.PropHunt) continue;
if (option.parent != null)
{
Expand Down Expand Up @@ -1284,7 +1284,7 @@ public static string buildAllOptions(string vanillaSettings = "", bool hideExtra
? Helpers.cs(DateTime.Now.Second % 2 == 0 ? Color.white : Color.red, "(如有必要,请使用滚轮)\n\n")
: "";

if (TORMapOptions.gameMode == CustomGamemodes.HideNSeek)
if (MapOptions.gameMode == CustomGamemodes.HideNSeek)
{
if (TheOtherRolesPlugin.optionsPage > 1) TheOtherRolesPlugin.optionsPage = 0;
maxPage = 2;
Expand All @@ -1298,7 +1298,7 @@ public static string buildAllOptions(string vanillaSettings = "", bool hideExtra
break;
}
}
else if (TORMapOptions.gameMode == CustomGamemodes.PropHunt)
else if (MapOptions.gameMode == CustomGamemodes.PropHunt)
{
maxPage = 1;
switch (counter)
Expand Down
17 changes: 10 additions & 7 deletions TheOtherRoles/Objects/Bomb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,21 @@ public static Sprite getDefuseSprite()

public static void explode(Bomb b)
{
var local = CachedPlayer.LocalPlayer.PlayerControl;
if (b == null) return;
if (Terrorist.terrorist != null)
{
var position = b.bomb.transform.position;
var distance =
Vector2.Distance(position,
CachedPlayer.LocalPlayer.transform
.position); // every player only checks that for their own client (desynct with positions sucks)
if (distance < Terrorist.destructionRange && !CachedPlayer.LocalPlayer.Data.IsDead
|| (Terrorist.selfExplosion && local != Terrorist.terrorist))
// every player only checks that for their own client (desynct with positions sucks)
var distance = Vector2.Distance(position, CachedPlayer.LocalPlayer.transform.position);

if (distance <= Terrorist.destructionRange && !CachedPlayer.LocalPlayer.Data.IsDead)
{
if (Terrorist.selfExplosion && CachedPlayer.LocalPlayer.PlayerControl == Terrorist.terrorist)
{
Terrorist.clearBomb();
return;
};

Helpers.checkMurderAttemptAndKill(Terrorist.terrorist, CachedPlayer.LocalPlayer.PlayerControl, false, false,
true, true);

Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Objects/CustomButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CustomButton(Action OnClick, Func<bool> HasButton, Func<bool> CouldUse, A
button.OnClick.AddListener((UnityAction)onClickEvent);

//开局按钮cd
Timer = CustomOptionHolder.resteButtonCooldown.getFloat() + 8.5f;
Timer = ResetButtonCooldown.killCooldown + 8.5f;

setActive(false);
}
Expand Down
Loading

0 comments on commit cb8d12b

Please sign in to comment.