Skip to content

Commit ff3fd81

Browse files
committed
Update to 1.2.5.2 || Fix the RoleDarft
1 parent 3ad523b commit ff3fd81

27 files changed

+258
-135
lines changed

TheOtherRoles/CustomOptionHolder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class CustomOptionHolder {
2929
public static CustomOption CanUseSwitchShipCostumeButton;
3030
public static CustomOption debugMode;
3131
public static CustomOption disableGameEnd;
32+
public static CustomOption modifierShifterShiftsMedicShield;
3233

3334
public static CustomOption mafiaSpawnRate;
3435
public static CustomOption janitorCooldown;
@@ -777,7 +778,7 @@ public static void Load()
777778

778779

779780
modifierShifter = CustomOption.Create(1100, Types.Modifier, cs(Shifter.color, "交换师"), rates, null, true);
780-
781+
modifierShifterShiftsMedicShield = CustomOption.Create(1102, Types.Modifier, "可以交换医生的护盾", false, modifierShifter);
781782

782783
modifierArmored = CustomOption.Create(1101, Types.Modifier, cs(Armored.color, "装甲兵"), rates, null, true);
783784

TheOtherRoles/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class TheOtherRolesEditedPlugin : BasePlugin
3636
{
3737
public const string Id = "TheOtherRolesEdited";
3838
public const string Name = "TORE";
39-
public const string VersionString = "1.2.5.1";
39+
public const string VersionString = "1.2.5.2";
4040
public const string Dev = "farewell";
4141
public const string ModColor = "#FF0000";
4242
public const string Team = "XtremeWave ";

TheOtherRoles/Modules/CustomOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public enum CustomOptionType
6161
// Option creation
6262

6363
public CustomOption(int id, CustomOptionType type, string name, System.Object[] selections, System.Object defaultValue, CustomOption parent, bool isHeader, Action onChange = null, string heading = "", bool invertedParent = false)
64-
{
64+
{
6565
this.id = id;
6666
this.name = parent == null ? name : "- " + name;
6767
this.selections = selections;

TheOtherRoles/Objects/CustomButton.cs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Il2CppSystem.Runtime.ExceptionServices;
2+
using Rewired;
23
using System;
34
using System.Collections.Generic;
45
using TheOtherRolesEdited.Modules;
@@ -9,6 +10,8 @@
910

1011
namespace TheOtherRolesEdited.Objects {
1112
public class CustomButton {
13+
public static KeyCode Action2Keycode = KeyCode.G; //TheOtherRolesPlugin.Instance.Config.Bind("Buttons", "Action2Keycode", KeyCode.G, "Second Ability Button Key").Value;
14+
public static KeyCode Action3Keycode = KeyCode.H; // TheOtherRolesPlugin.Instance.Config.Bind("Buttons", "Action3Keycode", KeyCode.H, "Third Ability Button Key").Value;
1215
public static List<CustomButton> buttons = new List<CustomButton>();
1316
public ActionButton actionButton;
1417
public GameObject actionButtonGameObject;
@@ -33,10 +36,10 @@ public class CustomButton {
3336
public HudManager hudManager;
3437
public bool mirror;
3538
public KeyCode? hotkey;
39+
public KeyCode? originalHotkey;
3640
public string buttonText;
3741
public bool isHandcuffed = false;
3842
private static readonly int Desat = Shader.PropertyToID("_Desat");
39-
4043
public static class ButtonPositions {
4144
public static readonly Vector3 lowerRowRight = new Vector3(-2f, -0.06f, 0); // Not usable for imps beacuse of new button positions!
4245
public static readonly Vector3 lowerRowCenter = new Vector3(-3f, -0.06f, 0);
@@ -64,6 +67,7 @@ public CustomButton(Action OnClick, Func<bool> HasButton, Func<bool> CouldUse, A
6467
this.mirror = mirror;
6568
this.hotkey = hotkey;
6669
this.buttonText = buttonText;
70+
originalHotkey = hotkey;
6771
Timer = 16.2f;
6872
buttons.Add(this);
6973
actionButton = UnityEngine.Object.Instantiate(hudManager.KillButton, hudManager.KillButton.transform.parent);
@@ -149,7 +153,37 @@ public static void ResetAllCooldowns() {
149153
}
150154
}
151155
}
156+
// Reload the rebound hotkeys from the among us settings.Add commentMore actions
157+
public static void ReloadHotkeys()
158+
{
159+
foreach (var button in buttons)
160+
{
161+
// Q button is used only for killing! This rebinds every button that would use Q to use the currently set killing button in among us.
162+
if (button.originalHotkey == KeyCode.Q)
163+
{
164+
Player player = Rewired.ReInput.players.GetPlayer(0);
165+
string keycode = player.controllers.maps.GetFirstButtonMapWithAction(8, true).elementIdentifierName;
166+
button.hotkey = (KeyCode)Enum.Parse(typeof(KeyCode), keycode);
167+
}
168+
// F is the default ability button. All buttons that would use F now use the ability button.
169+
if (button.originalHotkey == KeyCode.F)
170+
{
171+
Player player = Rewired.ReInput.players.GetPlayer(0);
172+
string keycode = player.controllers.maps.GetFirstButtonMapWithAction(49, true).elementIdentifierName;
173+
button.hotkey = (KeyCode)Enum.Parse(typeof(KeyCode), keycode);
174+
}
152175

176+
if (button.originalHotkey == KeyCode.G)
177+
{
178+
button.hotkey = Action2Keycode;
179+
}
180+
if (button.originalHotkey == KeyCode.H)
181+
{
182+
button.hotkey = Action3Keycode;
183+
}
184+
}
185+
186+
}
153187
public void setActive(bool isActive) {
154188
if (isActive) {
155189
actionButtonGameObject.SetActive(true);

TheOtherRoles/Objects/Trap.cs

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public static Sprite getTrapSprite() {
2727
return trapSprite;
2828
}
2929

30-
public Trap(Vector2 p) {
30+
public Trap(Vector2 p)
31+
{
3132
trap = new GameObject("Trap") { layer = 11 };
3233
trap.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
3334
Vector3 position = new Vector3(p.x, p.y, p.y / 1000 + 0.001f); // just behind player
@@ -44,68 +45,77 @@ public Trap(Vector2 p) {
4445
arrow.Update(position);
4546
arrow.arrow.SetActive(false);
4647
FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(5, new Action<float>((x) => {
47-
if (x == 1f) {
48+
if (x == 1f)
49+
{
4850
this.triggerable = true;
4951
trapRenderer.color = Color.white;
5052
}
5153
})));
5254
}
5355

54-
public static void clearTraps() {
55-
foreach (Trap t in traps) {
56+
public static void clearTraps()
57+
{
58+
foreach (Trap t in traps)
59+
{
5660
UnityEngine.Object.Destroy(t.arrow.arrow);
57-
UnityEngine.Object.Destroy(t.trap);
61+
UnityEngine.Object.Destroy(t.trap);
5862
}
5963
traps = new List<Trap>();
6064
trapPlayerIdMap = new Dictionary<byte, Trap>();
6165
instanceCounter = 0;
6266
}
6367

64-
public static void clearRevealedTraps() {
68+
public static void clearRevealedTraps()
69+
{
6570
var trapsToClear = traps.FindAll(x => x.revealed);
6671

67-
foreach (Trap t in trapsToClear) {
72+
foreach (Trap t in trapsToClear)
73+
{
6874
traps.Remove(t);
6975
UnityEngine.Object.Destroy(t.trap);
7076
}
7177
}
7278

73-
public static void triggerTrap(byte playerId, byte trapId) {
79+
public static void triggerTrap(byte playerId, byte trapId)
80+
{
7481
Trap t = traps.FirstOrDefault(x => x.instanceId == (int)trapId);
7582
PlayerControl player = Helpers.playerById(playerId);
7683
if (Trapper.trapper == null || t == null || player == null) return;
7784
bool localIsTrapper = PlayerControl.LocalPlayer.PlayerId == Trapper.trapper.PlayerId;
7885
if (!trapPlayerIdMap.ContainsKey(playerId)) trapPlayerIdMap.Add(playerId, t);
79-
t.usedCount ++;
86+
t.usedCount++;
8087
t.triggerable = false;
81-
if (playerId == PlayerControl.LocalPlayer.PlayerId || playerId == Trapper.trapper.PlayerId) {
88+
if (playerId == PlayerControl.LocalPlayer.PlayerId || playerId == Trapper.trapper.PlayerId)
89+
{
8290
t.trap.SetActive(true);
8391
SoundEffectsManager.play("trapperTrap");
8492
}
8593
player.moveable = false;
8694
player.NetTransform.Halt();
87-
Trapper.playersOnMap.Add(player);
95+
Trapper.playersOnMap.Add(player.PlayerId);
8896
if (localIsTrapper) t.arrow.arrow.SetActive(true);
8997

90-
FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(Trapper.trapDuration, new Action<float>((p) => {
91-
if (p == 1f) {
98+
FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(Trapper.trapDuration, new Action<float>((p) => {
99+
if (p == 1f)
100+
{
92101
player.moveable = true;
93-
Trapper.playersOnMap.RemoveAll(x => x == player);
102+
Trapper.playersOnMap.RemoveAll(x => x == player.PlayerId);
94103
if (trapPlayerIdMap.ContainsKey(playerId)) trapPlayerIdMap.Remove(playerId);
95104
t.arrow.arrow.SetActive(false);
96105
}
97106
})));
98107

99-
if (t.usedCount == t.neededCount) {
108+
if (t.usedCount == t.neededCount)
109+
{
100110
t.revealed = true;
101111
}
102112

103-
t.trappedPlayer.Add(player);
113+
t.trappedPlayer.Add((PlayerControl)player.PlayerId);
104114
t.triggerable = true;
105-
106115
}
107116

108-
public static void Update() {
117+
public static void Update()
118+
{
109119
if (Trapper.trapper == null) return;
110120
var player = PlayerControl.LocalPlayer;
111121
Vent vent = MapUtilities.CachedShipStatus.AllVents[0];
@@ -114,27 +124,31 @@ public static void Update() {
114124
if (vent == null || player == null) return;
115125
float ud = vent.UsableDistance / 2;
116126
Trap target = null;
117-
foreach (Trap trap in traps) {
127+
foreach (Trap trap in traps)
128+
{
118129
if (trap.arrow.arrow.active) trap.arrow.Update();
119-
if (trap.revealed || !trap.triggerable || trap.trappedPlayer.Contains(player)) continue;
130+
if (trap.revealed || !trap.triggerable || trap.trappedPlayer.Contains((PlayerControl)player.PlayerId)) continue;
120131
if (player.inVent || !player.CanMove) continue;
121132
float distance = Vector2.Distance(trap.trap.transform.position, player.GetTruePosition());
122-
if (distance <= ud && distance < closestDistance) {
133+
if (distance <= ud && distance < closestDistance)
134+
{
123135
closestDistance = distance;
124136
target = trap;
125137
}
126138
}
127-
if (target != null && player.PlayerId != Trapper.trapper.PlayerId && !player.Data.IsDead) {
139+
if (target != null && player.PlayerId != Trapper.trapper.PlayerId && !player.Data.IsDead)
140+
{
128141
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.TriggerTrap, Hazel.SendOption.Reliable, -1);
129142
writer.Write(player.PlayerId);
130143
writer.Write(target.instanceId);
131144
AmongUsClient.Instance.FinishRpcImmediately(writer);
132-
RPCProcedure.triggerTrap(player.PlayerId,(byte)target.instanceId);
145+
RPCProcedure.triggerTrap(player.PlayerId, (byte)target.instanceId);
133146
}
134147

135148

136149
if (!player.Data.IsDead || player.PlayerId == Trapper.trapper.PlayerId) return;
137-
foreach (Trap trap in traps) {
150+
foreach (Trap trap in traps)
151+
{
138152
if (!trap.trap.active) trap.trap.SetActive(true);
139153
}
140154
}

TheOtherRoles/Patches/AnnouncementPatch.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ public static void Init()
4444
{
4545
// 创建新公告时,不能删除旧公告
4646
{
47+
{
48+
// TORE v1.2.5.2
49+
var news = new ModNews
50+
{
51+
Number = 100006,
52+
Title = $"TheOtherRolesEdited v1.2.5.2",
53+
SubTitle = "每日更新:)",
54+
ShortTitle = $"★TORE",
55+
Text = "<size=100%>欢迎来到 TORE v1.2.5.2.适配Among us v2025.3.31s</size>\n"
56+
+ "\n<b>声明</b>\n·本模组不隶属于 Among Us 或 Innersloth LLC 其中包含的内容未得到 Innersloth LLC 的认可或以其他方式赞助 此处包含的部分材料是 Innersloth LLC的财产 ©Innersloth"
57+
+ "\n<b>对应官方版本</b>\n · TOR v.4.8.0\r"
58+
+ "\n<b>新增</b>\n · <s>我更新了版本号</s>\n · 修复轮抽选职(真的)\n · 更进到 TOR v4.8.0的代码",
59+
Date = "2025-6-15T00:00:00Z"
60+
};
61+
AllModNews.Add(news);
62+
}
4763
{
4864
// TORE v1.2.5
4965
var news = new ModNews

TheOtherRoles/Patches/ChatBubblePatch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public static void SetTextPrefix(ChatBubble __instance, ref string chatText)
106106
chatText.Contains("尼玛死了") ||
107107
chatText.Contains("你妈死了") ||
108108
chatText.Contains("有马") ||
109+
chatText.Contains("你爸") ||
110+
chatText.Contains("你爹") ||
109111
chatText.Contains("sb"))
110112
{
111113
chatText = $"{Helpers.GradientColorText("FFFF00", "FF0000", $"【违规消息】")}";

TheOtherRoles/Patches/ClientOptionsPatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private static void SetUpOptions()
203203
button.Background.color = button.onState ? Color.green : Palette.ImpostorRed;
204204
}));
205205

206-
passiveButton.OnMouseOver.AddListener((Action)(() => button.Background.color = new Color32(34, 139, 34, byte.MaxValue)));
206+
passiveButton.OnMouseOver.AddListener((Action)(() => button.Background.color = button.onState ? new Color32(34, 139, 34, byte.MaxValue) : new Color32(139, 34, 34, byte.MaxValue)));
207207
passiveButton.OnMouseOut.AddListener((Action)(() => button.Background.color = button.onState ? Color.green : Palette.ImpostorRed));
208208

209209
foreach (var spr in button.gameObject.GetComponentsInChildren<SpriteRenderer>())

TheOtherRoles/Patches/CredentialsPatch.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public static class CredentialsPatch
2525
public static string fullCredentials =
2626
$@"<size=75%>{Helpers.GradientColorText("FFD700", "FF0000", $"TOR")}模组作者:<color=#FCCE03FF>Eisbison</color>, <color=#FCCE03FF>EndOfFile</color>
2727
<color=#FCCE03FF>Thunderstorm584</color>, <color=#FCCE03FF>Mallöris</color> & <color=#FCCE03FF>Gendelo</color>
28-
美术:<color=#FCCE03FF>Bavari</color>
28+
美工:<color=#FCCE03FF>Bavari</color>
2929
{Helpers.GradientColorText("00BFFF", "0000FF", $"{TheOtherRolesEditedPlugin.Name}")}模组作者:<color=#FCCE03FF>{TheOtherRolesEditedPlugin.Dev}</color>
30-
美术:<color=#FCCE03FF>{TheOtherRolesEditedPlugin.Dev}</color>, <color=#FCCE03FF>尤路丽丝</color> & <color=#FCCE03FF>JMS</color>
30+
美工:<color=#FCCE03FF>{TheOtherRolesEditedPlugin.Dev}</color>, <color=#FCCE03FF>尤路丽丝</color> & <color=#FCCE03FF>JMS</color>
3131
中文翻译:<color=#FCCE03FF>{TheOtherRolesEditedPlugin.Dev}</color> & <color=#FCCE03FF>FangKuaiYa</color>";
3232

3333
[HarmonyPatch(typeof(PingTracker), nameof(PingTracker.Update))]
@@ -76,7 +76,7 @@ static void Postfix(PingTracker __instance)
7676
if (gameModeText != "") gameModeText = Helpers.cs(Color.yellow, gameModeText) + "\n";
7777
if (ModOption.DebugMode) gameModeText += "<color=#FF0000>(Debug Mode)</color>\n";
7878
__instance.text.alignment = TextAlignmentOptions.TopRight;
79-
__instance.text.text = $"<size=130%>{Helpers.GradientColorText("00FFFF", "0000FF", $"TheOtherRolesEdited")}</size> v{TheOtherRolesEditedPlugin.Version.ToString() + (TheOtherRolesEditedPlugin.betaDays > 0 ? "-BETA" : "")}\n<size=100%>By:<color=#cdfffd>{TheOtherRolesEditedPlugin.Team}</color>\n{PingTextColor}{AmongUsClient.Instance.Ping}<size=40%>ping</size></color> <color=#01A4F4>{fps}<size=40%>fps</size></color>\n{gameModeText}";
79+
__instance.text.text = $"<size=130%>{Helpers.GradientColorText("00FFFF", "0000FF", $"TheOtherRolesEdited")}</size> v{TheOtherRolesEditedPlugin.Version.ToString() + (TheOtherRolesEditedPlugin.betaDays > 0 ? "-BETA" : "")}\n<size=100%>Modded by:<color=#cdfffd>{TheOtherRolesEditedPlugin.Team}</color>\n{PingTextColor}{AmongUsClient.Instance.Ping}<size=40%>ping</size></color> <color=#01A4F4>{fps}<size=40%>fps</size></color>\n{gameModeText}";
8080
__instance.text.outlineColor = Color.black;
8181
__instance.text.outlineWidth = 0.25f;
8282
position.DistanceFromEdge = new Vector3(2.7f, 0.11f, 0);
@@ -202,7 +202,7 @@ public static async Task loadMOTDs()
202202
{
203203
MOTD.motds.Add(line);
204204
}
205-
205+
//感谢方块服务器的支持!
206206
}
207207
}
208208
}

TheOtherRoles/Patches/ExileControllerPatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace TheOtherRolesEdited.Patches
1414
{
15-
[HarmonyPatch(typeof(ExileController), nameof(ExileController.Begin))]
15+
[HarmonyPatch(typeof(ExileController), nameof(ExileController.BeginForGameplay))]
1616
[HarmonyPriority(Priority.First)]
1717
class ExileControllerBeginPatch
1818
{

0 commit comments

Comments
 (0)