Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

tor 4.1.5 #91

Open
wants to merge 62 commits into
base: 1.2.0-tor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7d30ebd
Version 3.4.5
dwd0tcom Apr 9, 2022
70139e3
Merge pull request #333 from Eisbison/v-3-4-5
dwd0tcom Apr 9, 2022
b75ad7b
Version 4.0.0
dwd0tcom Apr 29, 2022
a5de718
Merge pull request #338 from Eisbison/v-4-0-0
dwd0tcom Apr 29, 2022
32f2e08
version 4.1.0
May 1, 2022
6ccba0f
Update README.md
Mallaris May 1, 2022
322de56
Merge pull request #342 from Eisbison/Version_4.1.0
Mallaris May 1, 2022
93121a9
Update to version 4.1.1
May 2, 2022
3d06deb
Update README.md
Mallaris May 2, 2022
c623255
Merge pull request #344 from Eisbison/4.1.1
Mallaris May 2, 2022
0b47cc8
Version 4.1.2
dwd0tcom May 17, 2022
a8b6a74
Merge pull request #351 from Eisbison/v-4-1-2
dwd0tcom May 17, 2022
c8eda67
Update to v4.1.3
May 18, 2022
18114eb
Update README.md
Mallaris May 18, 2022
1f8c2f3
update
May 24, 2022
a40b895
Merge pull request #356 from Eisbison/update
Mallaris May 24, 2022
5b89ee0
update
Jun 23, 2022
598aa73
Update README.md
Mallaris Jun 23, 2022
f87e7b8
Merge pull request #376 from Eisbison/v4.1.5
Mallaris Jun 23, 2022
5829cb3
Update 4.1.6
Jul 11, 2022
d6c5c2f
Update FUNDING.yml
dwd0tcom Aug 1, 2022
af4b339
List 7.12 as compatible in the readme
miniduikboot Aug 8, 2022
639cca8
Merge pull request #395 from miniduikboot/fix/7.12
Mallaris Aug 8, 2022
1814a69
Update v4.1.7
Aug 25, 2022
8243ded
Update to v4.2.0
Oct 26, 2022
625d192
Update README.md
Mallaris Oct 26, 2022
2fc4d59
Update README.md
Mallaris Oct 26, 2022
aa8f436
update to v4.2.1
Jan 8, 2023
a57e132
Update v4.2.1 (with fixed merge issues)
gendelo3 Jan 9, 2023
fe30e14
Update 4.3.0
Mallaris Mar 3, 2023
373cee9
Fix merge issues. v4.3.0
gendelo3 Mar 4, 2023
cf99a88
Update build.yml
gendelo3 Mar 4, 2023
d693bbc
Fix typos and errors in Readme
gendelo3 Mar 11, 2023
af353e8
Update 4.3.1
gendelo3 Mar 31, 2023
7f76a00
Update v4.3.2
gendelo3 May 20, 2023
d253174
Update v4.3.2
gendelo3 May 20, 2023
6206f94
Update v4.3.2
gendelo3 May 20, 2023
a77e6bd
.
Mallaris May 21, 2023
607b4c3
Update v4.3.3
gendelo3 Jul 16, 2023
6f1489b
update
Mallaris Jul 16, 2023
cdb5ed5
Update nuget.config / fix build for 4.3.3
gendelo3 Jul 16, 2023
2bd94e2
Update to v4.3.4
gendelo3 Aug 19, 2023
f6cfa07
Update to v4.4.0
gendelo3 Sep 20, 2023
4565333
Update to v4.4.1
gendelo3 Sep 21, 2023
39c3e3d
Update to v4.4.2
gendelo3 Sep 29, 2023
b0fef3b
Update v4.5.0
gendelo3 Dec 15, 2023
9d65875
Update v4.5.1
gendelo3 Dec 17, 2023
8c55511
Preparation for update v4.5.2
gendelo3 Mar 11, 2024
9c36355
Preparation vor Update v4.5.3
gendelo3 May 15, 2024
834b891
Update build.yml
gendelo3 Aug 1, 2024
8e63bff
Update v4.6.0
gendelo3 Aug 1, 2024
d811d0b
Update README.md
K3ndoo Jan 16, 2025
4fdae9b
files for Update V4.7.0
gendelo3 Jan 18, 2025
21f54f9
Merge branch 'main' of github.com:TheOtherRolesAU/TheOtherRoles
gendelo3 Jan 18, 2025
ce449e0
Deleting unused files from resources
gendelo3 Jan 18, 2025
ac00d01
Update README.md
K3ndoo Jan 21, 2025
1b0868f
Update README.md
K3ndoo Jan 21, 2025
a5126c5
Update README.md
K3ndoo Jan 21, 2025
5443351
Update README.md
K3ndoo Feb 18, 2025
61a70ef
Update to v4.8.0
gendelo3 Feb 23, 2025
bc45a3a
Update README.md
gendelo3 Mar 5, 2025
b782da4
Update README.md
gendelo3 Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
# Releases
| Among Us - Version| Mod Version | Link |
|----------|-------------|-----------------|
| 2022.3.29 & 2022.4.19e| v4.1.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.3/TheOtherRoles.zip)
| 2022.3.29| v4.1.4| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.4/TheOtherRoles.zip)
| 2022.3.29| v4.1.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.3/TheOtherRoles.zip)
| 2022.3.29| v4.1.2| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.2/TheOtherRoles.zip)
| 2022.3.29| v4.1.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.1/TheOtherRoles.zip)
| 2022.3.29| v4.1.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.0/TheOtherRoles.zip)
Expand Down Expand Up @@ -104,6 +105,17 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
# Changelog
<details>
<summary>Click to show the Changelog</summary>

**Version 4.1.4**
- Added auto updating for BepInEx
- Fixed hat testing in freeplay for meetings / exile etc.
- Fixed players not being able to move
- Fixed getting stuck on the polus laboratory vent
- Fixed Sherrif suicide with bloody modifier having a trail as a ghost
- Fixed being able to kill the first killed protected player when a meeting was starting
- Fixed some cases of the Reliable Packet Not Ack'ed disconnections
- Fixed the double mod stamp being shown in game
- Further improvements towards rubberbanding

**Version 4.1.3**
- Fixed morphling's being morphed during meetings
Expand Down
327 changes: 164 additions & 163 deletions TheOtherRoles/Buttons.cs

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions TheOtherRoles/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using TheOtherRoles.Modules;
using HarmonyLib;
using Hazel;
using TheOtherRoles.Players;
using TheOtherRoles.Utilities;

namespace TheOtherRoles {
Expand Down Expand Up @@ -68,7 +69,7 @@ public static Texture2D loadTextureFromDisk(string path) {

public static PlayerControl playerById(byte id)
{
foreach (PlayerControl player in PlayerControl.AllPlayerControls.GetFastEnumerator())
foreach (PlayerControl player in CachedPlayer.AllPlayers)
if (player.PlayerId == id)
return player;
return null;
Expand All @@ -77,15 +78,15 @@ public static PlayerControl playerById(byte id)
public static Dictionary<byte, PlayerControl> allPlayersById()
{
Dictionary<byte, PlayerControl> res = new Dictionary<byte, PlayerControl>();
foreach (PlayerControl player in PlayerControl.AllPlayerControls.GetFastEnumerator())
foreach (PlayerControl player in CachedPlayer.AllPlayers)
res.Add(player.PlayerId, player);
return res;
}

public static void handleVampireBiteOnBodyReport() {
// Murder the bitten player and reset bitten (regardless whether the kill was successful or not)
Helpers.checkMuderAttemptAndKill(Vampire.vampire, Vampire.bitten, true, false);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireSetBitten, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.VampireSetBitten, Hazel.SendOption.Reliable, -1);
writer.Write(byte.MaxValue);
writer.Write(byte.MaxValue);
AmongUsClient.Instance.FinishRpcImmediately(writer);
Expand Down Expand Up @@ -234,7 +235,7 @@ public static void setLook(this PlayerControl target, String playerName, int col
target.RawSetColor(colorId);
target.RawSetVisor(visorId);
target.RawSetHat(hatId, colorId);
target.RawSetName(hidePlayerName(PlayerControl.LocalPlayer, target) ? "" : playerName);
target.RawSetName(hidePlayerName(CachedPlayer.LocalPlayer.PlayerControl, target) ? "" : playerName);

SkinViewData nextSkin = FastDestroyableSingleton<HatManager>.Instance.GetSkinById(skinId).viewData.viewData;
PlayerPhysics playerPhysics = target.MyPhysics;
Expand Down Expand Up @@ -294,9 +295,9 @@ public static bool roleCanUseVents(this PlayerControl player) {
else if (Vulture.canUseVents && Vulture.vulture != null && Vulture.vulture == player)
roleCouldUse = true;
else if (player.Data?.Role != null && player.Data.Role.CanVent) {
if (Janitor.janitor != null && Janitor.janitor == PlayerControl.LocalPlayer)
if (Janitor.janitor != null && Janitor.janitor == CachedPlayer.LocalPlayer.PlayerControl)
roleCouldUse = false;
else if (Mafioso.mafioso != null && Mafioso.mafioso == PlayerControl.LocalPlayer && Godfather.godfather != null && !Godfather.godfather.Data.IsDead)
else if (Mafioso.mafioso != null && Mafioso.mafioso == CachedPlayer.LocalPlayer.PlayerControl && Godfather.godfather != null && !Godfather.godfather.Data.IsDead)
roleCouldUse = false;
else
roleCouldUse = true;
Expand All @@ -315,7 +316,7 @@ public static MurderAttemptResult checkMuderAttempt(PlayerControl killer, Player

// Handle blank shot
if (Pursuer.blankedList.Any(x => x.PlayerId == killer.PlayerId)) {
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBlanked, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.SetBlanked, Hazel.SendOption.Reliable, -1);
writer.Write(killer.PlayerId);
writer.Write((byte)0);
AmongUsClient.Instance.FinishRpcImmediately(writer);
Expand Down Expand Up @@ -355,7 +356,7 @@ public static MurderAttemptResult checkMuderAttemptAndKill(PlayerControl killer,

MurderAttemptResult murder = checkMuderAttempt(killer, target, isMeetingStart);
if (murder == MurderAttemptResult.PerformKill) {
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.UncheckedMurderPlayer, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.UncheckedMurderPlayer, Hazel.SendOption.Reliable, -1);
writer.Write(killer.PlayerId);
writer.Write(target.PlayerId);
writer.Write(showAnimation ? Byte.MaxValue : 0);
Expand All @@ -366,7 +367,7 @@ public static MurderAttemptResult checkMuderAttemptAndKill(PlayerControl killer,
}

public static void shareGameVersion() {
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VersionHandshake, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.VersionHandshake, Hazel.SendOption.Reliable, -1);
writer.Write((byte)TheOtherRolesPlugin.Version.Major);
writer.Write((byte)TheOtherRolesPlugin.Version.Minor);
writer.Write((byte)TheOtherRolesPlugin.Version.Build);
Expand All @@ -379,7 +380,7 @@ public static void shareGameVersion() {

public static List<PlayerControl> getKillerTeamMembers(PlayerControl player) {
List<PlayerControl> team = new List<PlayerControl>();
foreach(PlayerControl p in PlayerControl.AllPlayerControls.GetFastEnumerator()) {
foreach(PlayerControl p in CachedPlayer.AllPlayers) {
if (player.Data.Role.IsImpostor && p.Data.Role.IsImpostor && player.PlayerId != p.PlayerId && team.All(x => x.PlayerId != p.PlayerId)) team.Add(p);
else if (player == Jackal.jackal && p == Sidekick.sidekick) team.Add(p);
else if (player == Sidekick.sidekick && p == Jackal.jackal) team.Add(p);
Expand Down
20 changes: 15 additions & 5 deletions TheOtherRoles/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System;
using UnityEngine;
using TheOtherRoles.Modules;
using TheOtherRoles.Players;
using TheOtherRoles.Utilities;

namespace TheOtherRoles
Expand All @@ -22,7 +23,7 @@ namespace TheOtherRoles
public class TheOtherRolesPlugin : BasePlugin
{
public const string Id = "me.eisbison.theotherroles";
public const string VersionString = "4.1.3";
public const string VersionString = "4.1.4";

public static Version Version = Version.Parse(VersionString);
internal static BepInEx.Logging.ManualLogSource Logger;
Expand Down Expand Up @@ -62,6 +63,8 @@ public static void UpdateRegions() {

public override void Load() {
Logger = Log;
Instance = this;

DebugMode = Config.Bind("Custom", "Enable Debug Mode", false);
StreamerMode = Config.Bind("Custom", "Enable Streamer Mode", false);
GhostsSeeTasks = Config.Bind("Custom", "Ghosts See Remaining Tasks", true);
Expand All @@ -86,11 +89,18 @@ public override void Load() {
GameOptionsData.MinPlayers = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4

DebugMode = Config.Bind("Custom", "Enable Debug Mode", false);
Instance = this;
Harmony.PatchAll();

CustomOptionHolder.Load();
CustomColors.Load();
Patches.FreeNamePatch.Initialize();
Harmony.PatchAll();

if (BepInExUpdater.UpdateRequired)
{
AddComponent<BepInExUpdater>();
return;
}

SubmergedCompatibility.Initialize();
AddComponent<ModUpdateBehaviour>();
}
Expand Down Expand Up @@ -139,7 +149,7 @@ public static void Postfix(KeyboardJoystick __instance)
GameData.Instance.AddPlayer(playerControl);
AmongUsClient.Instance.Spawn(playerControl, -2, InnerNet.SpawnFlags.None);

playerControl.transform.position = PlayerControl.LocalPlayer.transform.position;
playerControl.transform.position = CachedPlayer.LocalPlayer.transform.position;
playerControl.GetComponent<DummyBehaviour>().enabled = true;
playerControl.NetTransform.enabled = false;
playerControl.SetName(RandomString(10));
Expand All @@ -149,7 +159,7 @@ public static void Postfix(KeyboardJoystick __instance)

// Terminate round
if(Input.GetKeyDown(KeyCode.L)) {
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.Reliable, -1);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCProcedure.forceEnd();
}
Expand Down
77 changes: 77 additions & 0 deletions TheOtherRoles/Modules/BepInExUpdater.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.Utils;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;

namespace TheOtherRoles.Modules;

public class BepInExUpdater : MonoBehaviour
{
public const string MinimumBepInExVersion = "6.0.0.559";
public const string BepInExDownloadURL = "https://builds.bepinex.dev/projects/bepinex_be/559/BepInEx_UnityIL2CPP_x86_fba4461_6.0.0-be.559.zip";
public static bool UpdateRequired => typeof(IL2CPPChainloader).Assembly.GetName().Version < Version.Parse(MinimumBepInExVersion);

public void Awake()
{
TheOtherRolesPlugin.Logger.LogMessage("BepInEx Update Required...");
this.StartCoroutine(CoUpdate());
}

[HideFromIl2Cpp]
public IEnumerator CoUpdate()
{
Task.Run(() => MessageBox(IntPtr.Zero, "Required BepInEx update is downloading, please wait...","The Other Roles", 0));
UnityWebRequest www = UnityWebRequest.Get(BepInExDownloadURL);
yield return www.Send();
if (www.isNetworkError || www.isHttpError)
{
TheOtherRolesPlugin.Logger.LogError(www.error);
yield break;
}

var zipPath = Path.Combine(Paths.GameRootPath, ".bepinex_update");
File.WriteAllBytes(zipPath, www.downloadHandler.data);


var tempPath = Path.Combine(Path.GetTempPath(), "TheOtherUpdater.exe");
var asm = Assembly.GetExecutingAssembly();
var exeName = asm.GetManifestResourceNames().FirstOrDefault(n => n.EndsWith("TheOtherUpdater.exe"));

using(var resource = asm.GetManifestResourceStream(exeName))
{
using(var file = new FileStream(tempPath, FileMode.OpenOrCreate, FileAccess.Write))
{
resource!.CopyTo(file);
}
}

var startInfo = new ProcessStartInfo(tempPath, $"--game-path \"{Paths.GameRootPath}\" --zip \"{zipPath}\"");
startInfo.UseShellExecute = false;
Process.Start(startInfo);
Application.Quit();
}

[DllImport("user32.dll")]
public static extern int MessageBox(IntPtr hWnd, String text, String caption, int options);
}

[HarmonyPatch(typeof(SplashManager), nameof(SplashManager.Update))]
public static class StopLoadingMainMenu
{
public static bool Prefix()
{
return !BepInExUpdater.UpdateRequired;
}
}
Loading