Skip to content

Commit 001ba22

Browse files
committed
Update to v16.0.0
计划:伪装者职业“厉鬼” 附加职业“绝境者” ModInput 主界面背景图片随机(不知道为什么没作用)
1 parent a782940 commit 001ba22

54 files changed

Lines changed: 1000 additions & 794 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,11 @@
11
# The-Other-Roles-Rework
2+
An add roles and options mod for Among Us
3+
Reworked from The Other Roles
24

3-
An add roles and options mod for Among Us\n
4-
Reworked from The Other Roles:https://github.com/TheOtherRolesAU/TheOtherRoles\n
5-
6-
Update to Among Us v11.26s,BepInEx6.0.0-729,Reactor 2.3.1 Base onTheOtherRoles-v4.6.0\n
7-
8-
## Features
9-
Add the ability to press Shift to enter the lobby\n
10-
Add a language system to ensure that people from other countries can play our mods as usual\n
11-
Reduced the size of the dll file thanks to Fangkuai, the author of TheOtherRolesCE\n
12-
Change The Main Menu\n
13-
Add QQ & Github button On Main Menu\n
14-
15-
## Fix
16-
Fixed Prophet prophecy button error, torch vision error, button text, button cascading\n
17-
18-
## Role
19-
Fraudster: Can suicide\n
20-
Torch: The Vision High Than The Other Crewmates\n
21-
Prophet: Can Check The Team Type\n
22-
23-
## Option
24-
Add Mod Option: ShowFPS\n
25-
Add Setting Option: Show Who Was Bait For\n
26-
Add vents on Polus and Airship(Options)\n
27-
Ghosts and Bounty Hunters can see T/F cooldowns\n
28-
29-
# The-Other-Roles-Rework
30-
31-
为 Among Us 添加职业和选项的Mod\n
32-
重制自 The Other Roles (超多职业):https://github.com/TheOtherRolesAU/TheOtherRoles\n
33-
34-
更新到我们中间 v11.26s,BepInEx6.0.0-729,反应堆 2.3.1 基于 TheOtherRoles-v4.6.0\n
35-
36-
## 功能
37-
添加按 Shift 键进入大厅的功能\n
38-
添加语言系统以确保其他国家/地区的人可以像往常一样玩我们的 Mod\n
39-
感谢 TheOtherRolesCE 的作者 Fangkuai 减小了 dll 文件的大小\n
40-
更改主菜单\n
41-
在主菜单上添加QQ和Github按钮\n
42-
43-
## 修复
44-
修复了先知预言按钮错误、火把视觉错误、按钮文本、按钮级联\n
45-
46-
## 角色
47-
伪证师:可以自杀\n
48-
火炬:有比其他船员更高的视野\n
49-
预言家: 可以检查其他玩家的阵营\n
50-
51-
## 选项
52-
添加 Mod 选项:显示帧率\n
53-
添加设置选项:显示诱饵\n
54-
在 Polus 和 Airship 上添加通风口\n
55-
鬼魂和赏金猎人可以看到正确与失败击杀冷却时间\n
56-
57-
5+
Add Role———Lighter(火炬)
6+
Add Option———Show BH True and False Kill Cooldown
587

8+
TOR:https://github.com/TheOtherRolesAU/TheOtherRoles
599

6010

6111

TheOtherRoles/Buttons.cs

Lines changed: 8 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using static TheOtherRoles.Objects.CustomButton;
1414
using TMPro;
1515
using TheOtherRoles.Modules;
16+
using static TheOtherRoles.Modules.ModInputManager;
1617

1718
namespace TheOtherRoles
1819
{
@@ -41,8 +42,6 @@ static class HudManagerStartPatch
4142
public static CustomButton vampireKillButton;
4243
public static CustomButton garlicButton;
4344
public static CustomButton prophetButton;
44-
public static CustomButton markerButton1;
45-
public static CustomButton markerButton2;
4645
public static CustomButton jackalKillButton;
4746
public static CustomButton sidekickKillButton;
4847
private static CustomButton jackalSidekickButton;
@@ -80,6 +79,7 @@ static class HudManagerStartPatch
8079
private static CustomButton propHuntSpeedboostButton;
8180
public static CustomButton propHuntAdminButton;
8281
public static CustomButton propHuntFindButton;
82+
public static CustomButton roleSummaryButton;
8383

8484
public static Dictionary<byte, List<CustomButton>> deputyHandcuffedButtons = null;
8585
public static PoolablePlayer targetDisplay;
@@ -94,11 +94,10 @@ static class HudManagerStartPatch
9494
public static TMPro.TMP_Text hackerVitalsChargesText;
9595
public static TMPro.TMP_Text trapperChargesText;
9696
public static TMPro.TMP_Text prophetButtonText;
97-
public static TMPro.TMP_Text markButtonText;
9897
public static TMPro.TMP_Text portalmakerButtonText1;
9998
public static TMPro.TMP_Text portalmakerButtonText2;
10099
public static TMPro.TMP_Text huntedShieldCountText;
101-
100+
public static TMPro.TMP_Text FraudsterButtonText;
102101

103102
public static void setCustomButtonCooldowns() {
104103
if (!initialized) {
@@ -153,7 +152,6 @@ public static void setCustomButtonCooldowns() {
153152
yoyoAdminTableButton.MaxTimer = Yoyo.adminCooldown;
154153
prophetButton.MaxTimer = Prophet.cooldown;
155154
fraudsterButton.MaxTimer = Fraudster.cooldown;
156-
markerButton1.MaxTimer = Marker.cooldown;
157155
yoyoAdminTableButton.EffectDuration = 10f;
158156
hunterLighterButton.MaxTimer = Hunter.lightCooldown;
159157
hunterAdminTableButton.MaxTimer = Hunter.AdminCooldown;
@@ -952,80 +950,12 @@ public static void createButtonsPostfix(HudManager __instance) {
952950

953951
);
954952
//prophetButtonText = UnityEngine.Object.Instantiate(prophetButton.actionButton.cooldownTimerText, prophetButton.actionButton.cooldownTimerText.transform.parent);
955-
// prophetButtonText.text = "";
953+
// prophetButtonText.text = "";
956954
//prophetButtonText.enableWordWrapping = false;
957955
//prophetButtonText.transform.localScale = Vector3.one * 0.5f;
958956
//prophetButtonText.transform.localPosition += new Vector3(-0.05f, 0.55f, -1f);
959-
markerButton1 = new CustomButton(
960-
961-
() =>
962-
{
963-
if (Marker.currentTarget != null)
964-
{
957+
965958

966-
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.MarkerMark, Hazel.SendOption.Reliable, -1);
967-
writer.Write(Marker.currentTarget.PlayerId);
968-
AmongUsClient.Instance.FinishRpcImmediately(writer);
969-
RPCProcedure.MarkerMark(Marker.currentTarget.PlayerId);
970-
971-
markerButton1.Timer = markerButton1.MaxTimer;
972-
}
973-
},
974-
() => { return Marker.marker != null && CachedPlayer.LocalPlayer.PlayerControl == Marker.marker && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Marker.markLeft > 0; },
975-
() =>
976-
{
977-
if (markButtonText != null)
978-
{
979-
if (Marker.markLeft > 0)
980-
markButtonText.text = $"{Marker.markLeft}";
981-
else
982-
markButtonText.text = "";
983-
}
984-
return Marker.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove;
985-
},
986-
() => { markerButton1.Timer = markerButton1.MaxTimer; },
987-
Marker.getButtonSprite(),
988-
CustomButton.ButtonPositions.lowerRowRight,
989-
__instance,
990-
KeyCode.F,
991-
buttonText: ModTranslation.GetString("MarkText")
992-
993-
);
994-
markerButton2 = new CustomButton(
995-
996-
() =>
997-
{
998-
if (Marker.currentTarget2 != null)
999-
{
1000-
1001-
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.MarkerMark2, Hazel.SendOption.Reliable, -1);
1002-
writer.Write(Marker.currentTarget2.PlayerId);
1003-
AmongUsClient.Instance.FinishRpcImmediately(writer);
1004-
RPCProcedure.MarkerMark(Marker.currentTarget2.PlayerId);
1005-
1006-
markerButton2.Timer = markerButton2.MaxTimer;
1007-
}
1008-
},
1009-
() => { return Marker.marker != null && CachedPlayer.LocalPlayer.PlayerControl == Marker.marker && !CachedPlayer.LocalPlayer.PlayerControl.Data.IsDead && Marker.markLeft > 0; },
1010-
() =>
1011-
{
1012-
if (markButtonText != null)
1013-
{
1014-
if (Marker.markLeft > 0)
1015-
markButtonText.text = $"{Marker.markLeft2}";
1016-
else
1017-
markButtonText.text = "";
1018-
}
1019-
return Marker.currentTarget2 != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove;
1020-
},
1021-
() => { markerButton1.Timer = markerButton1.MaxTimer; },
1022-
Marker.getButtonSprite(),
1023-
CustomButton.ButtonPositions.lowerRowCenter,
1024-
__instance,
1025-
KeyCode.G,
1026-
buttonText: ModTranslation.GetString("ButtonMark")
1027-
1028-
);
1029959
portalmakerPlacePortalButton = new CustomButton(
1030960
() => {
1031961
portalmakerPlacePortalButton.Timer = portalmakerPlacePortalButton.MaxTimer;
@@ -1196,7 +1126,7 @@ public static void createButtonsPostfix(HudManager __instance) {
11961126
() => { return Jackal.canCreateSidekick && Jackal.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; },
11971127
() => { jackalSidekickButton.Timer = jackalSidekickButton.MaxTimer;},
11981128
Jackal.getSidekickButtonSprite(),
1199-
CustomButton.ButtonPositions.lowerRowCenter,
1129+
CustomButton.ButtonPositions.upperRowFarRight,
12001130
__instance,
12011131
KeyCode.H,
12021132
buttonText: ModTranslation.GetString("ButtonjackalSidekick")
@@ -1214,7 +1144,7 @@ public static void createButtonsPostfix(HudManager __instance) {
12141144
() => { return Jackal.currentTarget && CachedPlayer.LocalPlayer.PlayerControl.CanMove; },
12151145
() => { jackalKillButton.Timer = jackalKillButton.MaxTimer;},
12161146
__instance.KillButton.graphic.sprite,
1217-
CustomButton.ButtonPositions.upperRowFarRight,
1147+
CustomButton.ButtonPositions.upperRowRight,
12181148
__instance,
12191149
KeyCode.Q
12201150
);
@@ -2230,7 +2160,7 @@ public static void createButtonsPostfix(HudManager __instance) {
22302160
buttonText: ModTranslation.GetString("ButtonAdmin")
22312161

22322162
);
2233-
2163+
22342164

22352165
zoomOutButton = new CustomButton(
22362166
() => { Helpers.toggleZoom();

TheOtherRoles/CustomGameModes/GameModePatches.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,24 @@
1111
using static UnityEngine.UI.Button;
1212
using UnityEngine.Events;
1313
using Hazel;
14+
using TheOtherRoles.Players;
1415

15-
namespace TheOtherRoles.CustomGameModes
16-
{
16+
namespace TheOtherRoles.CustomGameModes {
1717
[HarmonyPatch]
18-
class GameModePatches
19-
{
18+
class GameModePatches {
2019
/*
2120
Creates a button in the info pane in the lobby to cycle through the game modes of TOR.
2221
*/
2322
[HarmonyPatch(typeof(LobbyInfoPane), nameof(LobbyInfoPane.Update))]
24-
class LobbyInfoPanePatch
25-
{
23+
class LobbyInfoPanePatch {
2624

2725
private static GameObject gameModeButton = null;
28-
public static void Postfix(LobbyInfoPane __instance)
29-
{
30-
if (gameModeButton != null || !AmongUsClient.Instance.AmHost) { return; }
26+
public static void Postfix(LobbyInfoPane __instance) {
27+
if (gameModeButton != null|| !AmongUsClient.Instance.AmHost) { return; }
3128

3229
var template = GameObject.Find("PRIVATE BUTTON");
3330
var GameModeText = GameObject.Find("GameModeText");
34-
if (template == null || GameModeText == null) { return; }
31+
if (template == null || GameModeText== null) { return; }
3532
gameModeButton = GameObject.Instantiate(template, template.transform.parent); //, GameModeText.transform);
3633
gameModeButton.transform.localPosition = template.transform.localPosition + new Vector3(0f, 0.65f, -2f);
3734
gameModeButton.name = "TOR GameModeButton";
@@ -45,9 +42,9 @@ public static void Postfix(LobbyInfoPane __instance)
4542
gameModeButton.transform.GetChild(2).GetComponent<SpriteRenderer>().color = new Color(0f, 0f, 0f);
4643
pButton.OnClick.AddListener((Action)(() =>
4744
{
48-
TORMapOptions.gameMode = (CustomGamemodes)((int)(TORMapOptions.gameMode + 1) % Enum.GetNames(typeof(CustomGamemodes)).Length);
45+
TORMapOptions.gameMode = (CustomGamemodes)((int)(TORMapOptions.gameMode + 1) % Enum.GetNames(typeof(CustomGamemodes)).Length);
4946
__instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>(p => { pButton.buttonText.text = Helpers.cs(Color.yellow, GameModeText.GetComponent<TextMeshPro>().text); })));
50-
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShareGamemode, Hazel.SendOption.Reliable, -1);
47+
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareGamemode, Hazel.SendOption.Reliable, -1);
5148
writer.Write((byte)TORMapOptions.gameMode);
5249
AmongUsClient.Instance.FinishRpcImmediately(writer);
5350
RPCProcedure.shareGamemode((byte)TORMapOptions.gameMode);
@@ -66,4 +63,4 @@ public static void Postfix(LobbyInfoPane __instance)
6663
}
6764
}
6865
}
69-
}
66+
}

TheOtherRoles/CustomGameModes/HideNSeekGM.cs

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using System;
22
using System.Collections.Generic;
33
using TheOtherRoles.Objects;
4+
using TheOtherRoles.Players;
45
using UnityEngine;
56

6-
namespace TheOtherRoles.CustomGameModes
7-
{
8-
public static class HideNSeek
9-
{ // HideNSeek Gamemode
7+
namespace TheOtherRoles.CustomGameModes {
8+
public static class HideNSeek { // HideNSeek Gamemode
109
public static bool isHideNSeekGM = false;
1110
public static TMPro.TMP_Text timerText = null;
1211
public static Vent polusVent = null;
@@ -22,25 +21,21 @@ public static class HideNSeek
2221
public static bool canSabotage = false;
2322
public static float killCooldown = 10f;
2423
public static float hunterWaitingTime = 15f;
25-
public static bool isHunter()
26-
{
27-
return isHideNSeekGM && PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer.Data.Role.IsImpostor;
24+
public static bool isHunter() {
25+
return isHideNSeekGM && CachedPlayer.LocalPlayer != null && CachedPlayer.LocalPlayer.Data.Role.IsImpostor;
2826
}
2927

30-
public static List<PlayerControl> getHunters()
31-
{
32-
List<PlayerControl> hunters = new List<PlayerControl>(PlayerControl.AllPlayerControls.ToArray());
28+
public static List<CachedPlayer> getHunters() {
29+
List<CachedPlayer> hunters = new List<CachedPlayer>(CachedPlayer.AllPlayers);
3330
hunters.RemoveAll(x => !x.Data.Role.IsImpostor);
3431
return hunters;
3532
}
3633

37-
public static bool isHunted()
38-
{
39-
return isHideNSeekGM && PlayerControl.LocalPlayer != null && !PlayerControl.LocalPlayer.Data.Role.IsImpostor;
34+
public static bool isHunted() {
35+
return isHideNSeekGM && CachedPlayer.LocalPlayer != null && !CachedPlayer.LocalPlayer.Data.Role.IsImpostor;
4036
}
4137

42-
public static void clearAndReload()
43-
{
38+
public static void clearAndReload() {
4439
isHideNSeekGM = TORMapOptions.gameMode == CustomGamemodes.HideNSeek;
4540
if (timerText != null) UnityEngine.Object.Destroy(timerText);
4641
timerText = null;
@@ -64,8 +59,7 @@ public static void clearAndReload()
6459
}
6560
}
6661

67-
public static class Hunter
68-
{
62+
public static class Hunter {
6963
public static List<Arrow> localArrows = new List<Arrow>();
7064
public static List<byte> lightActive = new List<byte>();
7165
public static bool arrowActive = false;
@@ -84,29 +78,24 @@ public static class Hunter
8478
private static Sprite buttonSpriteLight;
8579
private static Sprite buttonSpriteArrow;
8680

87-
public static bool isLightActive(byte playerId)
88-
{
81+
public static bool isLightActive (byte playerId) {
8982
return lightActive.Contains(playerId);
9083
}
9184

92-
public static Sprite getArrowSprite()
93-
{
85+
public static Sprite getArrowSprite() {
9486
if (buttonSpriteArrow) return buttonSpriteArrow;
9587
buttonSpriteArrow = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HideNSeekArrowButton.png", 115f);
9688
return buttonSpriteArrow;
9789
}
9890

99-
public static Sprite getLightSprite()
100-
{
91+
public static Sprite getLightSprite() {
10192
if (buttonSpriteLight) return buttonSpriteLight;
10293
buttonSpriteLight = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.LighterButton.png", 115f);
10394
return buttonSpriteLight;
10495
}
10596

106-
public static void clearAndReload()
107-
{
108-
if (localArrows != null)
109-
{
97+
public static void clearAndReload() {
98+
if (localArrows != null) {
11099
foreach (Arrow arrow in localArrows)
111100
if (arrow?.arrow != null)
112101
UnityEngine.Object.Destroy(arrow.arrow);
@@ -128,17 +117,15 @@ public static void clearAndReload()
128117
}
129118
}
130119

131-
public static class Hunted
132-
{
120+
public static class Hunted {
133121
public static List<byte> timeshieldActive = new List<byte>();
134122
public static int shieldCount = 3;
135123

136124
public static float shieldCooldown = 30f;
137125
public static float shieldDuration = 5f;
138126
public static float shieldRewindTime = 3f;
139127
public static bool taskPunish = false;
140-
public static void clearAndReload()
141-
{
128+
public static void clearAndReload() {
142129
timeshieldActive = new List<byte>();
143130
taskPunish = false;
144131

0 commit comments

Comments
 (0)