Skip to content

Commit d916ca8

Browse files
authored
Merge pull request #3 from linmeideli/TEST
添加了没必要的东西
2 parents 3a5b156 + 9331646 commit d916ca8

16 files changed

Lines changed: 4927 additions & 70 deletions

TheOtherRoles/CustomOptionHolder.cs

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using UnityEngine;
33
using static TheOtherRoles.TheOtherRoles;
44
using Types = TheOtherRoles.CustomOption.CustomOptionType;
5+
using TheOtherRoles.Modules;
56

67
namespace TheOtherRoles {
78
public class CustomOptionHolder {
@@ -81,6 +82,7 @@ public class CustomOptionHolder {
8182
public static CustomOption bountyHunterPunishmentTime;
8283
public static CustomOption bountyHunterShowArrow;
8384
public static CustomOption bountyHunterArrowUpdateIntervall;
85+
public static CustomOption bountyHunterShowCooldownForGhosts;
8486

8587
public static CustomOption witchSpawnRate;
8688
public static CustomOption witchCooldown;
@@ -409,6 +411,15 @@ public class CustomOptionHolder {
409411
public static CustomOption propHuntFindCooldown;
410412
public static CustomOption propHuntFindDuration;
411413

414+
//Add Settings
415+
public static CustomOption AddVents;
416+
public static CustomOption addPolusVents;
417+
public static CustomOption addAirShipVents;
418+
public static CustomOption enableAirShipModify;
419+
public static CustomOption enableBetterPolus;
420+
421+
422+
412423
internal static Dictionary<byte, byte[]> blockedRolePairings = new Dictionary<byte, byte[]>();
413424

414425
public static string cs(Color c, string s) {
@@ -435,8 +446,8 @@ public static void Load() {
435446
if (Utilities.EventUtility.canBeEnabled) enableEventMode = CustomOption.Create(10423, Types.General, cs(Color.green, "Enable 特别模式"), true, null, true);
436447

437448
// Using new id's for the options to not break compatibilty with older versions
438-
crewmateRolesCountMin = CustomOption.Create(300, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最少船员数量"), 15f, 0f, 15f, 1f, null, true, heading: "Min/Max Roles");
439-
crewmateRolesCountMax = CustomOption.Create(301, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最大 船员数量"), 15f, 0f, 15f, 1f);
449+
crewmateRolesCountMin = CustomOption.Create(300, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最小船员数量"), 15f, 0f, 15f, 1f, null, true, heading: "Min/Max Roles");
450+
crewmateRolesCountMax = CustomOption.Create(301, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最大船员数量"), 15f, 0f, 15f, 1f);
440451
neutralRolesCountMin = CustomOption.Create(302, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最少中立数量"), 15f, 0f, 15f, 1f);
441452
neutralRolesCountMax = CustomOption.Create(303, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最大中立数量"), 15f, 0f, 15f, 1f);
442453
impostorRolesCountMin = CustomOption.Create(304, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "最少伪装者数量"), 15f, 0f, 15f, 1f);
@@ -482,9 +493,10 @@ public static void Load() {
482493
bountyHunterReducedCooldown = CustomOption.Create(322, Types.Impostor, "正确击杀后冷却时间", 2.5f, 0f, 30f, 2.5f, bountyHunterSpawnRate);
483494
bountyHunterPunishmentTime = CustomOption.Create(323, Types.Impostor, "错误击杀后冷却时间", 20f, 0f, 60f, 2.5f, bountyHunterSpawnRate);
484495
bountyHunterShowArrow = CustomOption.Create(324, Types.Impostor, "显示箭头→赏金目标", true, bountyHunterSpawnRate);
485-
bountyHunterArrowUpdateIntervall = CustomOption.Create(325, Types.Impostor, "剪头更新频率", 15f, 2.5f, 60f, 2.5f, bountyHunterShowArrow);
496+
bountyHunterArrowUpdateIntervall = CustomOption.Create(325, Types.Impostor, "箭头更新频率", 15f, 2.5f, 60f, 2.5f, bountyHunterShowArrow);
497+
bountyHunterShowCooldownForGhosts = CustomOption.Create(4399, Types.Impostor, "向鬼魂展示赏金猎人冷却时间", true, bountyHunterSpawnRate);
486498

487-
witchSpawnRate = CustomOption.Create(370, Types.Impostor, cs(Witch.color, "女巫"), rates, null, true);
499+
witchSpawnRate = CustomOption.Create(370, Types.Impostor, cs(Witch.color, "女巫"), rates, null, true);
488500
witchCooldown = CustomOption.Create(371, Types.Impostor, "下咒冷却时间", 30f, 10f, 120f, 5f, witchSpawnRate);
489501
witchAdditionalCooldown = CustomOption.Create(372, Types.Impostor, "女巫额外冷却时间", 10f, 0f, 60f, 5f, witchSpawnRate);
490502
witchCanSpellAnyone = CustomOption.Create(373, Types.Impostor, "可以下咒给所有人", false, witchSpawnRate);
@@ -537,7 +549,7 @@ public static void Load() {
537549
jackalSpawnRate = CustomOption.Create(220, Types.Neutral, cs(Jackal.color, "豺狼"), rates, null, true);
538550
jackalKillCooldown = CustomOption.Create(221, Types.Neutral, "击杀冷却时间", 30f, 10f, 60f, 2.5f, jackalSpawnRate);
539551
jackalCreateSidekickCooldown = CustomOption.Create(222, Types.Neutral, "招募冷却时间", 30f, 10f, 60f, 2.5f, jackalSpawnRate);
540-
jackalCanUseVents = CustomOption.Create(223, Types.Neutral, "豺狼可以使用通风管道", true, jackalSpawnRate);
552+
jackalCanUseVents = CustomOption.Create(223, Types.Neutral, "豺狼可使用通风管道", true, jackalSpawnRate);
541553
jackalCanSabotageLights = CustomOption.Create(431, Types.Neutral, "豺狼拥有伪装者视野", true, jackalSpawnRate);
542554
jackalCanCreateSidekick = CustomOption.Create(224, Types.Neutral, "豺狼可以招募跟班", false, jackalSpawnRate);
543555
sidekickPromotesToJackal = CustomOption.Create(225, Types.Neutral, "豺狼死后跟班继位", false, jackalCanCreateSidekick);
@@ -614,7 +626,7 @@ public static void Load() {
614626
swapperCanCallEmergency = CustomOption.Create(151, Types.Crewmate, "可以开启紧急会议", false, swapperSpawnRate);
615627
swapperCanOnlySwapOthers = CustomOption.Create(152, Types.Crewmate, "只能交换非换票师的玩家", false, swapperSpawnRate);
616628

617-
swapperSwapsNumber = CustomOption.Create(153, Types.Crewmate, "单词补充次数", 1f, 0f, 5f, 1f, swapperSpawnRate);
629+
swapperSwapsNumber = CustomOption.Create(153, Types.Crewmate, "单次补充次数", 1f, 0f, 5f, 1f, swapperSpawnRate);
618630
swapperRechargeTasksNumber = CustomOption.Create(154, Types.Crewmate, "充值所需任务数", 2f, 1f, 10f, 1f, swapperSpawnRate);
619631

620632

@@ -673,6 +685,8 @@ public static void Load() {
673685
mediumOneTimeUse = CustomOption.Create(363, Types.Crewmate, "每个灵魂只能提问一次", false, mediumSpawnRate);
674686
mediumChanceAdditionalInfo = CustomOption.Create(364, Types.Crewmate, "答案包含附加信息的可能性", rates, mediumSpawnRate);
675687

688+
//Investigator Settings...
689+
676690
thiefSpawnRate = CustomOption.Create(400, Types.Neutral, cs(Thief.color, "身份窃贼"), rates, null, true);
677691
thiefCooldown = CustomOption.Create(401, Types.Neutral, "偷窃冷却时间", 30f, 5f, 120f, 5f, thiefSpawnRate);
678692
thiefCanKillSheriff = CustomOption.Create(402, Types.Neutral, "可以击杀警长", true, thiefSpawnRate);
@@ -716,9 +730,9 @@ public static void Load() {
716730
modifierSunglassesQuantity = CustomOption.Create(1051, Types.Modifier, cs(Color.yellow, "失明者数量"), ratesModifier, modifierSunglasses);
717731
modifierSunglassesVision = CustomOption.Create(1052, Types.Modifier, "减少视野数", new string[] { "-10%", "-20%", "-30%", "-40%", "-50%" }, modifierSunglasses);
718732

719-
modifierLighterln = CustomOption.Create(5000, Types.Modifier, cs(Color.yellow, "火炬"), rates, null, true);
720-
modifierLighterlnQuantity = CustomOption.Create(5001, Types.Modifier, cs(Color.yellow, "火炬数量"), ratesModifier, modifierLighterln);
721-
modifierLighterlnVision = CustomOption.Create(5002, Types.Modifier, "增加视野数", new string[] { "+10%", "+20%", "+30%", "+40%", "+50%" }, modifierLighterln);
733+
modifierLighterln = CustomOption.Create(40180, Types.Modifier, cs(Color.yellow, "Torch"), rates, null, true);
734+
modifierLighterlnQuantity = CustomOption.Create(40181, Types.Modifier, cs(Color.yellow, "modifierTorchQuantity"), ratesModifier , modifierLighterln);
735+
modifierLighterlnVision = CustomOption.Create(40182, Types.Modifier, "modifierTorchVision", 1.5f, 1f, 3f, 0.125f, modifierLighterln);
722736

723737
modifierMini = CustomOption.Create(1061, Types.Modifier, cs(Color.yellow, "迷你船员"), rates, null, true);
724738
modifierMiniGrowingUpDuration = CustomOption.Create(1062, Types.Modifier, "迷你船员成长时间", 400f, 100f, 1500f, 100f, modifierMini);
@@ -782,7 +796,7 @@ public static void Load() {
782796
hunterArrowDuration = CustomOption.Create(3013, Types.HideNSeekRoles, cs(Color.red, "猎人导航箭头持续时间"), 5f, 0f, 60f, 1f);
783797
hunterArrowPunish = CustomOption.Create(3014, Types.HideNSeekRoles, cs(Color.red, "猎人在分钟内导航键头惩罚"), 5f, 0f, 30f, 1f);
784798

785-
huntedShieldCooldown = CustomOption.Create(3015, Types.HideNSeekRoles, cs(Color.gray, "躲藏者护盾冷却时间"), 30f, 5f, 60f, 1f, null, true, heading: "躲藏者护盾设置");
799+
huntedShieldCooldown = CustomOption.Create(3015, Types.HideNSeekRoles, cs(Color.gray, "躲藏者护盾冷却时间"), 30f, 5f, 60f, 1f, null, true, heading: "躲藏者护盾设置");
786800
huntedShieldDuration = CustomOption.Create(3016, Types.HideNSeekRoles, cs(Color.gray, "躲藏者护盾持续时间"), 5f, 1f, 60f, 1f);
787801
huntedShieldRewindTime = CustomOption.Create(3018, Types.HideNSeekRoles, cs(Color.gray, "躲藏者回溯时间"), 3f, 1f, 10f, 1f);
788802
huntedShieldNumber = CustomOption.Create(3026, Types.HideNSeekRoles, cs(Color.gray, "躲藏者护盾数量"), 3f, 1f, 15f, 1f);
@@ -828,7 +842,7 @@ public static void Load() {
828842
finishTasksBeforeHauntingOrZoomingOut = CustomOption.Create(9, Types.General, "在出现困扰或缩小之前完成任务", true);
829843
deadImpsBlockSabotage = CustomOption.Create(13, Types.General, "禁止破坏胜利", false, null, false);
830844
camsNightVision = CustomOption.Create(11, Types.General, "如果灯光关闭,摄像机将切换到夜视功能", false, null, true, heading: "Night Vision Cams");
831-
camsNoNightVisionIfImpVision = CustomOption.Create(12, Types.General, "伪装者视野忽略夜视摄像头", false, camsNightVision, false);
845+
832846

833847

834848

@@ -839,7 +853,17 @@ public static void Load() {
839853
dynamicMapEnableAirShip = CustomOption.Create(504, Types.General, "Airship", rates, dynamicMap, false);
840854
dynamicMapEnableFungle = CustomOption.Create(506, Types.General, "Fungle", rates, dynamicMap, false);
841855
dynamicMapEnableSubmerged = CustomOption.Create(505, Types.General, "Submerged", rates, dynamicMap, false);
842-
dynamicMapSeparateSettings = CustomOption.Create(509, Types.General, "使用随机地图设置预设", false, dynamicMap, false);
856+
dynamicMapSeparateSettings = CustomOption.Create(509, Types.General, "使用随机地图设置预设", false, dynamicMap, true);
857+
camsNoNightVisionIfImpVision = CustomOption.Create(12, Types.General, "伪装者视野忽略夜视摄像头", false, camsNightVision, false);
858+
859+
AddVents = CustomOption.Create(114513, Types.General, "添加通风管道", false, null, true, heading: "添加通风管道");
860+
addPolusVents = CustomOption.Create(114514, Types.General, "在Polus增加额外的通风管道", false, enableBetterPolus);
861+
addAirShipVents = CustomOption.Create(114515, Types.General, "在AriShip增加额外的通风管道", false, enableAirShipModify);
862+
enableAirShipModify = CustomOption.Create(114516, Types.General, cs(Color.yellow, "AirShip"), false, null);
863+
enableBetterPolus = CustomOption.Create(114517, Types.General, "启用Polus追加", false, null);
864+
865+
866+
843867

844868
blockedRolePairings.Add((byte)RoleId.Vampire, new [] { (byte)RoleId.Warlock});
845869
blockedRolePairings.Add((byte)RoleId.Warlock, new [] { (byte)RoleId.Vampire});

TheOtherRoles/Helpers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ public static bool hasImpVision(NetworkedPlayerInfo player) {
665665
|| (Sidekick.sidekick != null && Sidekick.sidekick.PlayerId == player.PlayerId && Sidekick.hasImpostorVision)
666666
|| (Spy.spy != null && Spy.spy.PlayerId == player.PlayerId && Spy.hasImpostorVision)
667667
|| (Jester.jester != null && Jester.jester.PlayerId == player.PlayerId && Jester.hasImpostorVision)
668-
|| (Thief.thief != null && Thief.thief.PlayerId == player.PlayerId && Thief.hasImpostorVision);
668+
|| (Thief.thief != null && Thief.thief.PlayerId == player.PlayerId && Thief.hasImpostorVision)
669+
;
669670
}
670671

671672
public static object TryCast(this Il2CppObjectBase self, Type type)

TheOtherRoles/LogHelper.cs

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
using System;
2+
using System.Text;
3+
using BepInEx;
4+
using BepInEx.Logging;
5+
6+
namespace TheOtherRoles.Helper;
7+
8+
internal static class LogHelper
9+
{
10+
private static ManualLogSource logSource { get; set; }
11+
12+
internal static void SetLogSource(ManualLogSource Source)
13+
{
14+
if (ConsoleManager.ConsoleEnabled) System.Console.OutputEncoding = Encoding.UTF8;
15+
logSource = Source;
16+
}
17+
18+
public static void Info(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Info);
19+
public static void Message(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Message);
20+
public static void Warn(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Warning);
21+
public static void Error(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Error);
22+
public static void Debug(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Debug);
23+
public static void Fatal(object text, string Tag = "") => SendLog(text.ToString(), Tag, LogLevel.Fatal);
24+
25+
public static void SendLog(string text, string tag = "", LogLevel logLevel = LogLevel.Info)
26+
{
27+
string time = DateTime.Now.ToString("HH:mm:ss");
28+
if (!string.IsNullOrWhiteSpace(tag)) text = $"[{time}][{tag}] {text}";
29+
else text = $"[{time}] {text}";
30+
31+
switch (logLevel)
32+
{
33+
case LogLevel.Message:
34+
logSource.LogMessage(text);
35+
break;
36+
case LogLevel.Error:
37+
logSource.LogError(text);
38+
break;
39+
case LogLevel.Warning:
40+
logSource.LogWarning(text);
41+
break;
42+
case LogLevel.Fatal:
43+
logSource.LogFatal(text);
44+
break;
45+
case LogLevel.Info:
46+
logSource.LogInfo(text);
47+
break;
48+
case LogLevel.Debug:
49+
logSource.LogDebug(text);
50+
break;
51+
default:
52+
logSource.LogInfo(text);
53+
break;
54+
}
55+
}
56+
57+
public static void FastLog(LogLevel errorLevel, object @object)
58+
{
59+
var Logger = logSource;
60+
var Message = @object as string;
61+
switch (errorLevel)
62+
{
63+
case LogLevel.Message:
64+
Logger.LogMessage(Message);
65+
break;
66+
case LogLevel.Error:
67+
Logger.LogError(Message);
68+
break;
69+
case LogLevel.Warning:
70+
Logger.LogWarning(Message);
71+
break;
72+
case LogLevel.Fatal:
73+
Logger.LogFatal(Message);
74+
break;
75+
case LogLevel.Info:
76+
Logger.LogInfo(Message);
77+
break;
78+
case LogLevel.Debug:
79+
Logger.LogDebug(Message);
80+
break;
81+
default:
82+
throw new ArgumentOutOfRangeException(nameof(errorLevel), errorLevel, null);
83+
}
84+
}
85+
86+
public static void LogObject(object @object)
87+
{
88+
FastLog(LogLevel.Error, @object);
89+
}
90+
}
91+
/*
92+
[HarmonyPatch]
93+
internal static class LogListener
94+
{
95+
[HarmonyTargetMethods]
96+
private static IEnumerable<MethodBase> taregetMethodBases()
97+
{
98+
return typeof(AmongUsClient).Assembly.GetTypes()
99+
.Where(n => n.IsSubclassOf(typeof(InnerNetObject)))
100+
.Select(x => x.GetMethod(nameof(InnerNetObject.HandleRpc), AccessTools.allDeclared))
101+
.Where(m => m != null);
102+
}
103+
104+
[HarmonyPostfix]
105+
internal static void OnRpc(InnerNetObject __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] Hazel.MessageReader reader)
106+
{
107+
// Debug
108+
if (ModOption.DebugMode) Info($"OnRpc: {__instance.name} {callId} {reader.Length} {reader.Tag}");
109+
}
110+
}
111+
*/

TheOtherRoles/Main.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
namespace TheOtherRoles
2727
{
28-
[BepInPlugin(Id, "The Other Roles", VersionString)]
28+
[BepInPlugin(Id, "The Other Roles", TORRVersionString)]
2929
[BepInDependency(SubmergedCompatibility.SUBMERGED_GUID, BepInDependency.DependencyFlags.SoftDependency)]
3030
[BepInProcess("Among Us.exe")]
3131
[ReactorModFlags(Reactor.Networking.ModFlags.RequireOnAllClients)]
@@ -34,10 +34,10 @@ public class TheOtherRolesPlugin : BasePlugin
3434
{
3535
public const string Id = "me.eisbison.theotherroles";
3636
public const string VersionString = "4.6.0";
37-
public const string TORRVersionString = "1.0.1-BETA3";
37+
public const string TORRVersionString = "1.0.2";
3838
public static uint betaDays = 0; // amount of days for the build to be usable (0 for infinite!)
3939

40-
public static Version Version = Version.Parse(VersionString);
40+
public static Version Version = Version.Parse(TORRVersionString);
4141
internal static BepInEx.Logging.ManualLogSource Logger;
4242

4343
public Harmony Harmony { get; } = new Harmony(Id);

TheOtherRoles/Modules/AddServer.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using HarmonyLib;
7+
8+
namespace TheOtherRoles.Modules
9+
{
10+
public static class ServerPatch
11+
{
12+
[HarmonyPatch(typeof(ServerManager), nameof(ServerManager.LoadServers))]
13+
[HarmonyPostfix]
14+
private static void AddServer(ServerManager __instance)
15+
{
16+
IRegionInfo[] regionInfos =
17+
{
18+
CreateRegionInfo("au-sh.pafyx.top", "梦服上海(新)", 22000),
19+
CreateRegionInfo("au-as.duikbo.at", "Modded Asia (MAS)", 443, true),
20+
CreateRegionInfo("www.aumods.xyz", "Modded NA (MNA)", 443, true),
21+
CreateRegionInfo("au-eu.duikbo.at", "Modded EU (MEU)", 443, true)
22+
};
23+
24+
regionInfos.Do(__instance.AddOrUpdateRegion);
25+
}
26+
27+
private static IRegionInfo CreateRegionInfo(string name, string ip, ushort port, bool isHttps = false)
28+
{
29+
var serverIp = isHttps ? "https://" : "http://" + ip;
30+
var serverInfo = new ServerInfo(name, serverIp, port, false);
31+
return new StaticHttpRegionInfo(name, StringNames.NoTranslation, ip, new[] { serverInfo }).Cast<IRegionInfo>();
32+
}
33+
}
34+
}

TheOtherRoles/Modules/BepInExUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void Awake()
3434
[HideFromIl2Cpp]
3535
public IEnumerator CoUpdate()
3636
{
37-
Task.Run(() => MessageBox(GetForegroundWindow(), "Required BepInEx update is downloading, please wait...","The Other Roles", 0));
37+
Task.Run(() => MessageBox(GetForegroundWindow(), "Required BepInEx update is downloading, please wait...","The Other Roles Rework", 0));
3838
UnityWebRequest www = UnityWebRequest.Get(BepInExDownloadURL);
3939
yield return www.Send();
4040
if (www.isNetworkError || www.isHttpError)

TheOtherRoles/Modules/CustomHats/CustomHatManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal static string RepositoryUrl
2121
get
2222
{
2323
var (owner, repository) = Repository;
24-
return $"https://raw.githubusercontent.com/{owner}/{repository}/master";
24+
return $"http://api.fangkuai.fun:2222/ModFiles/TheOtherHats";
2525
}
2626
}
2727

0 commit comments

Comments
 (0)