Skip to content

Commit 99b6861

Browse files
committed
Update to 1.2.6
1 parent ff3fd81 commit 99b6861

Some content is hidden

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

54 files changed

+1964
-1291
lines changed

TheOtherRoles/Buttons.cs

Lines changed: 71 additions & 52 deletions
Large diffs are not rendered by default.

TheOtherRoles/CustomOptionHolder.cs

Lines changed: 419 additions & 420 deletions
Large diffs are not rendered by default.

TheOtherRoles/Helpers.cs

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Globalization;
45
using System.IO;
5-
using System.Reflection;
6-
using UnityEngine;
76
using System.Linq;
8-
using static TheOtherRolesEdited.TheOtherRolesEdited;
9-
using TheOtherRolesEdited.Modules;
7+
using System.Reflection;
8+
using System.Threading.Tasks;
9+
using AmongUs.GameOptions;
1010
using HarmonyLib;
1111
using Hazel;
12-
using TheOtherRolesEdited.Utilities;
13-
using System.Threading.Tasks;
14-
using TheOtherRolesEdited.CustomGameModes;
1512
using Reactor.Utilities.Extensions;
16-
using AmongUs.GameOptions;
17-
using TheOtherRolesEdited.Patches;
1813
using Rewired.Utils.Platforms.Windows;
19-
using TheOtherRolesEdited.Players;
20-
using System.Collections;
14+
using TheOtherRolesEdited.CustomGameModes;
15+
using TheOtherRolesEdited.Modules;
2116
using TheOtherRolesEdited.Objects;
17+
using TheOtherRolesEdited.Patches;
18+
using TheOtherRolesEdited.Players;
19+
using TheOtherRolesEdited.Utilities;
20+
using UnityEngine;
21+
using UnityEngine.Networking;
22+
using static TheOtherRolesEdited.TheOtherRolesEdited;
2223

2324
namespace TheOtherRolesEdited {
2425

@@ -143,7 +144,7 @@ public static IEnumerator BlackmailShhh()
143144
yield return HudManager.Instance.CoFadeFullScreen(new Color(0f, 0f, 0f, 0.98f), Color.clear);
144145
yield return null;
145146
}
146-
147+
147148
public static unsafe Texture2D loadTextureFromResources(string path) {
148149
try {
149150
Texture2D texture = new Texture2D(2, 2, TextureFormat.ARGB32, true);
@@ -339,12 +340,21 @@ public static void refreshRoleDescription(PlayerControl player) {
339340
player.myTasks.Insert(0, task);
340341
}
341342
}
343+
public static string camelString(this string input)
344+
{
345+
if (string.IsNullOrEmpty(input))
346+
return input;
347+
348+
string firstLetter = input[..1].ToUpper();
349+
string remainingLetters = input[1..].ToLower();
350+
return firstLetter + remainingLetters;
351+
}
342352

343353
public static void enableCursor(bool initalSetCursor)
344354
{
345355
if (initalSetCursor)
346356
{
347-
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRolesEdited.Resources.Cursor.png", 115f);
357+
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRolesEdited.Resources.MainPhoto.Cursor.png", 115f);
348358
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
349359
return;
350360
}
@@ -354,7 +364,7 @@ public static void enableCursor(bool initalSetCursor)
354364
}
355365
else
356366
{
357-
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRolesEdited.Resources.Cursor.png", 115f);
367+
Sprite sprite = Helpers.loadSpriteFromResources("TheOtherRolesEdited.Resources.MainPhoto.Cursor.png", 115f);
358368
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
359369
}
360370
}
@@ -862,5 +872,13 @@ public static object TryCast(this Il2CppObjectBase self, Type type)
862872
{
863873
return AccessTools.Method(self.GetType(), nameof(Il2CppObjectBase.TryCast)).MakeGenericMethod(type).Invoke(self, Array.Empty<object>());
864874
}
875+
876+
public static byte[] GetUnstrippedData(this DownloadHandler dh)
877+
{
878+
var nativeData = dh.GetNativeData();
879+
if (nativeData.IsCreated)
880+
return nativeData.ToArray();
881+
return null;
882+
}
865883
}
866884
}

TheOtherRoles/Main.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
using AmongUs.Data.Player;
2525
using AmongUs.GameOptions;
2626
using Rewired.Utils.Platforms.Windows;
27+
using Reactor.Patches;
28+
2729

2830
namespace TheOtherRolesEdited
2931
{
@@ -36,7 +38,7 @@ public class TheOtherRolesEditedPlugin : BasePlugin
3638
{
3739
public const string Id = "TheOtherRolesEdited";
3840
public const string Name = "TORE";
39-
public const string VersionString = "1.2.5.2";
41+
public const string VersionString = "1.2.6";
4042
public const string Dev = "farewell";
4143
public const string ModColor = "#FF0000";
4244
public const string Team = "XtremeWave ";
@@ -65,6 +67,7 @@ public class TheOtherRolesEditedPlugin : BasePlugin
6567
public static ConfigEntry<ushort> Port { get; set; }
6668
public static ConfigEntry<string> ShowPopUpVersion { get; set; }
6769
public static ConfigEntry<bool> ToggleCursor { get; set; }
70+
public static List<PlayerControl> JoinedPlayer = new();
6871
public static Sprite ModStamp;
6972
public static IRegionInfo[] defaultRegions;
7073
// This is part of the Mini.RegionInstaller, Licensed under GPLv3
@@ -73,10 +76,8 @@ public static void UpdateRegions() {
7376
ServerManager serverManager = FastDestroyableSingleton<ServerManager>.Instance;
7477
var regions = new IRegionInfo[]
7578
{
76-
new StaticHttpRegionInfo("<color=#76BAF6>Niko233(AS_CN2)</color>", StringNames.NoTranslation, "https://aucn2.niko233.me", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("Niko233(AS_CN)", "https://aucn2.niko233.me", 443, false) })).CastFast<IRegionInfo>(),
77-
new StaticHttpRegionInfo("<color=#D2A2EE>Niko233(NA_US2)</color>", StringNames.NoTranslation, "https://au-us2.niko233.me", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("Niko233(NA_US2)", "https://au-us2.niko233.me", 443, false) })).CastFast<IRegionInfo>(),
78-
new StaticHttpRegionInfo("<color=#49F0FC>方块服</color> <color=#8732FF>[宿迁]</color>", StringNames.NoTranslation, "https://newplayer.fangkuai.fun", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("<color=#49F0FC>方块服</color> <color=#8732FF>[宿迁]</color>", "http://sq.fangkuai.fun", 22020, false) })).CastFast<IRegionInfo>(),
79-
new StaticHttpRegionInfo("<color=#49F0FC>方块服</color> <color=#00bfff>[香港]</color>", StringNames.NoTranslation, "https://newauhk.fangkuai.fun", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("方块服 [宿迁]", "https://player.fangkuai.fun", 443, false) })).CastFast<IRegionInfo>(),
79+
new StaticHttpRegionInfo("<color=#49F0FC>方块服</color> <color=#8732FF>[宿迁]</color>", StringNames.NoTranslation, "https://player.fangkuai.fun", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("<color=#49F0FC>方块服</color> <color=#8732FF>[宿迁]</color>", "https://player.fangkuai.fun", 433, false) })).CastFast<IRegionInfo>(),
80+
new StaticHttpRegionInfo("<color=#49F0FC>方块服</color> <color=#00bfff>[香港]</color>", StringNames.NoTranslation, "https://auhk.fangkuai.fun", new Il2CppReferenceArray<ServerInfo>(new ServerInfo[1] { new ServerInfo("<color=#49F0FC>方块服</color> <color=#00bfff>[香港]</color>", "https://auhk.fangkuai.fun", 443, false) })).CastFast<IRegionInfo>(),
8081
};
8182
IRegionInfo currentRegion = serverManager.CurrentRegion;
8283
Logger.LogInfo($"Adding {regions.Length} regions");
@@ -100,6 +101,10 @@ public static void UpdateRegions() {
100101
public override void Load() {
101102
Logger = Log;
102103
Instance = this;
104+
ReactorVersionShower.TextUpdated += text =>
105+
{
106+
text.text = "";
107+
};
103108

104109
_ = Helpers.checkBeta(); // Exit if running an expired beta
105110
_ = Patches.CredentialsPatch.MOTD.loadMOTDs();

TheOtherRoles/Modules/BepInExUpdater.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
using System.Collections;
33
using System.Diagnostics;
44
using System.IO;
5-
using System.IO.Compression;
65
using System.Linq;
7-
using System.Net.Http;
86
using System.Reflection;
97
using System.Runtime.InteropServices;
108
using System.Threading.Tasks;
119
using BepInEx;
12-
using BepInEx.Unity.IL2CPP;
1310
using BepInEx.Unity.IL2CPP.Utils;
1411
using HarmonyLib;
1512
using UnityEngine;
@@ -19,8 +16,8 @@ namespace TheOtherRolesEdited.Modules;
1916

2017
public class BepInExUpdater : MonoBehaviour
2118
{
22-
public const string RequiredBepInExVersion = "6.0.0-be.697+53625800b86f6c68751445248260edf0b27a71c2";
23-
public const string BepInExDownloadURL = "https://builds.bepinex.dev/projects/bepinex_be/697/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.697%2B5362580.zip";
19+
public const string RequiredBepInExVersion = "6.0.0-be.735+5fef3570f212b2fb5fbe9c1d20487c13c2fa90cb";
20+
public const string BepInExDownloadURL = "https://builds.bepinex.dev/projects/bepinex_be/735/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.735%2B5fef357.zip";
2421
public static bool UpdateRequired => Paths.BepInExVersion.ToString() != RequiredBepInExVersion;
2522

2623
public void Awake()
@@ -34,7 +31,7 @@ public void Awake()
3431
[HideFromIl2Cpp]
3532
public IEnumerator CoUpdate()
3633
{
37-
Task.Run(() => MessageBox(GetForegroundWindow(), "Required BepInEx update is downloading, please wait...","The Other Roles", 0));
34+
Task.Run(() => MessageBox(GetForegroundWindow(), "Required BepInEx update is downloading, please wait...","The Other Roles Edited", 0));
3835
UnityWebRequest www = UnityWebRequest.Get(BepInExDownloadURL);
3936
yield return www.Send();
4037
if (www.isNetworkError || www.isHttpError)
@@ -44,7 +41,7 @@ public IEnumerator CoUpdate()
4441
}
4542

4643
var zipPath = Path.Combine(Paths.GameRootPath, ".bepinex_update");
47-
File.WriteAllBytes(zipPath, www.downloadHandler.data);
44+
File.WriteAllBytes(zipPath, www.downloadHandler.GetUnstrippedData());
4845

4946

5047
var tempPath = Path.Combine(Path.GetTempPath(), "TheOtherUpdater.exe");

TheOtherRoles/Modules/CustomHats/CustomHatManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ public static class CustomHatManager
1414
public const string ResourcesDirectory = "TheOtherHats";
1515
public const string InnerslothPackageName = "官方帽子";
1616
public const string DeveloperPackageName = "开发者帽子";
17-
17+
1818
internal static readonly Tuple<string, string> Repository = new("TheOtherRolesAU", "TheOtherHats");
1919
internal static string RepositoryUrl
2020
{
2121
get
2222
{
2323
var (owner, repository) = Repository;
24-
return $"https://dl.fungle.icu/ModFiles/TheOtherRoles/TheOtherHats";
24+
return $"https://ghproxy.fangkuai.fun/https://raw.githubusercontent.com/{owner}/{repository}/master";
2525
}
2626
}
2727

28+
2829
internal static readonly string ManifestFileName = "CustomHats.json";
2930

3031
internal static string CustomSkinsDirectory => Path.Combine(Path.GetDirectoryName(Application.dataPath)!, ResourcesDirectory);

TheOtherRoles/Modules/CustomHats/HatsLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private static IEnumerator CoDownloadHatAsset(string fileName)
8989

9090
var filePath = Path.Combine(HatsDirectory, fileName);
9191
filePath = filePath.Replace("%20", " ");
92-
var persistTask = File.WriteAllBytesAsync(filePath, www.downloadHandler.data);
92+
var persistTask = File.WriteAllBytesAsync(filePath, www.downloadHandler.GetUnstrippedData());
9393
while (!persistTask.IsCompleted)
9494
{
9595
if (persistTask.Exception != null)

0 commit comments

Comments
 (0)