Skip to content

Commit

Permalink
Update the codebase to latest AU version
Browse files Browse the repository at this point in the history
  • Loading branch information
scp222thj committed Jun 18, 2024
1 parent 510a77b commit 21cdeb6
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/Cheats/MalumESP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public static void meetingNametags(MeetingHud meetingHud)
try{
foreach (PlayerVoteArea playerState in meetingHud.playerStates)
{
// Fetch the GameData.PlayerInfo of each playerState
GameData.PlayerInfo data = GameData.Instance.GetPlayerById(playerState.TargetPlayerId);
// Fetch the NetworkedPlayerInfo of each playerState
NetworkedPlayerInfo data = GameData.Instance.GetPlayerById(playerState.TargetPlayerId);

if (!data.IsNull() && !data.Disconnected && !data.Outfits[PlayerOutfitType.Default].IsNull())
{
Expand Down
20 changes: 10 additions & 10 deletions src/Cheats/MalumPPMCheats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void reportBodyPPM(){
CheatToggles.DisablePPMCheats("reportBody");
}

List<GameData.PlayerInfo> playerDataList = new List<GameData.PlayerInfo>();
List<NetworkedPlayerInfo> playerDataList = new List<NetworkedPlayerInfo>();

// All players are saved to playerList
foreach (var player in PlayerControl.AllPlayerControls){
Expand Down Expand Up @@ -67,7 +67,7 @@ public static void murderPlayerPPM()
CheatToggles.DisablePPMCheats("murderPlayer");
}

List<GameData.PlayerInfo> playerDataList = new List<GameData.PlayerInfo>();
List<NetworkedPlayerInfo> playerDataList = new List<NetworkedPlayerInfo>();

// All players are saved to playerList
foreach (var player in PlayerControl.AllPlayerControls)
Expand Down Expand Up @@ -108,7 +108,7 @@ public static void teleportPlayerPPM()
CheatToggles.DisablePPMCheats("teleportPlayer");
}

List<GameData.PlayerInfo> playerDataList = new List<GameData.PlayerInfo>();
List<NetworkedPlayerInfo> playerDataList = new List<NetworkedPlayerInfo>();

// All players are saved to playerList apart from LocalPlayer
foreach (var player in PlayerControl.AllPlayerControls)
Expand Down Expand Up @@ -150,13 +150,13 @@ public static void changeRolePPM()
CheatToggles.DisablePPMCheats("changeRole");
}

List<GameData.PlayerInfo> playerDataList = new List<GameData.PlayerInfo>();
List<NetworkedPlayerInfo> playerDataList = new List<NetworkedPlayerInfo>();

// Shapeshifter role can only be used if it was already assigned at the start of the game
// This is done to prevent the anticheat from kicking players
if (oldRole == RoleTypes.Shapeshifter){

GameData.PlayerOutfit shapeshifterOutfit = new GameData.PlayerOutfit
NetworkedPlayerInfo.PlayerOutfit shapeshifterOutfit = new NetworkedPlayerInfo.PlayerOutfit
{
ColorId = 0,
SkinId = "skin_screamghostface",
Expand All @@ -168,15 +168,15 @@ public static void changeRolePPM()

}

GameData.PlayerOutfit impostorOutfit = new GameData.PlayerOutfit
NetworkedPlayerInfo.PlayerOutfit impostorOutfit = new NetworkedPlayerInfo.PlayerOutfit
{
ColorId = 0
};

// Custom PPM choice for Impostor role
playerDataList.Add(PlayerPickMenu.customPPMChoice("Impostor", impostorOutfit, Utils.getBehaviourByRoleType(RoleTypes.Impostor)));

GameData.PlayerOutfit engineerOutfit = new GameData.PlayerOutfit
NetworkedPlayerInfo.PlayerOutfit engineerOutfit = new NetworkedPlayerInfo.PlayerOutfit
{
ColorId = 10,
SkinId = "skin_Mech",
Expand All @@ -186,7 +186,7 @@ public static void changeRolePPM()
// Custom PPM choice for Engineer role
playerDataList.Add(PlayerPickMenu.customPPMChoice("Engineer", engineerOutfit, Utils.getBehaviourByRoleType(RoleTypes.Engineer)));

GameData.PlayerOutfit scientistOutfit = new GameData.PlayerOutfit
NetworkedPlayerInfo.PlayerOutfit scientistOutfit = new NetworkedPlayerInfo.PlayerOutfit
{
ColorId = 10,
SkinId = "skin_Science",
Expand All @@ -196,7 +196,7 @@ public static void changeRolePPM()
// Custom PPM choice for Scientist role
playerDataList.Add(PlayerPickMenu.customPPMChoice("Scientist", scientistOutfit, Utils.getBehaviourByRoleType(RoleTypes.Scientist)));

GameData.PlayerOutfit crewmateOutfit = new GameData.PlayerOutfit
NetworkedPlayerInfo.PlayerOutfit crewmateOutfit = new NetworkedPlayerInfo.PlayerOutfit
{
ColorId = 10
};
Expand Down Expand Up @@ -254,7 +254,7 @@ public static void spectatePPM()
CheatToggles.DisablePPMCheats("spectate");
}

List<GameData.PlayerInfo> playerDataList = new List<GameData.PlayerInfo>();
List<NetworkedPlayerInfo> playerDataList = new List<NetworkedPlayerInfo>();

// All players are saved to playerList apart from LocalPlayer
foreach (var player in PlayerControl.AllPlayerControls){
Expand Down
6 changes: 3 additions & 3 deletions src/Cheats/MalumSabotageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void handleOxygen(ShipStatus shipStatus, byte mapId)

// Notify the player if they try to activate the cheat in a map without an oxygen system
if (CheatToggles.oxygenSab){
HudManager.Instance.Notifier.AddItem("Oxygen system not present on this map");
HudManager.Instance.Notifier.AddDisconnectMessage("Oxygen system not present on this map");
CheatToggles.oxygenSab = false;
}
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public static void handleElectrical(ShipStatus shipStatus, byte mapId)

// Notify the player if they try to activate the cheat in a map without an oxygen system
if (CheatToggles.elecSab || CheatToggles.unfixableLights){
HudManager.Instance.Notifier.AddItem("Eletrical system not present on this map");
HudManager.Instance.Notifier.AddDisconnectMessage("Eletrical system not present on this map");
CheatToggles.elecSab = CheatToggles.unfixableLights = false;
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public static void handleMushMix(ShipStatus shipStatus, byte mapId)

// Notify the player if they try to activate the cheat in a map without mushrooms

HudManager.Instance.Notifier.AddItem("Mushrooms not present on this map");
HudManager.Instance.Notifier.AddDisconnectMessage("Mushrooms not present on this map");
}

CheatToggles.mushSab = false; //Button behaviour
Expand Down
2 changes: 1 addition & 1 deletion src/Cheats/TracersHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void drawBodyTracer(DeadBody deadBody){
if (CheatToggles.colorBasedTracers){

// Fetch the dead body's PlayerInfo
GameData.PlayerInfo playerById = GameData.Instance.GetPlayerById(deadBody.ParentId);
NetworkedPlayerInfo playerById = GameData.Instance.GetPlayerById(deadBody.ParentId);

color = playerById.Color; // Color-Based Tracer

Expand Down
4 changes: 2 additions & 2 deletions src/MalumMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace MalumMenu;
public partial class MalumMenu : BasePlugin
{
public Harmony Harmony { get; } = new(Id);
public static string malumVersion = "2.3.0";
public static List<string> supportedAU = new List<string> { "2023.11.28", "2024.3.5", "2024.6.4" };
public static string malumVersion = "2.4.0";
public static List<string> supportedAU = new List<string> { "2024.6.18" };
public static MenuUI menuUI;
// public static ConsoleUI consoleUI;
public static ConfigEntry<string> menuKeybind;
Expand Down
4 changes: 2 additions & 2 deletions src/MalumMenu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<LangVersion>latest</LangVersion>
<DebugType>embedded</DebugType>

<VersionPrefix>2.3.0</VersionPrefix>
<VersionPrefix>2.4.0</VersionPrefix>
<Description>all play and no cheats makes among us a dull game</Description>
<Authors>scp222thj</Authors>
</PropertyGroup>
Expand All @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.662" Private="false" ExcludeAssets="runtime;native" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2024.6.4" PrivateAssets="all" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2024.6.18" PrivateAssets="all" />

<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.0.1" PrivateAssets="all" ExcludeAssets="runtime" />
Expand Down
4 changes: 2 additions & 2 deletions src/Patches/ChatControllerPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public static bool Prefix(PlayerControl sourcePlayer, string chatText, bool cens
return true;
}

GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
GameData.PlayerInfo data2 = sourcePlayer.Data;
NetworkedPlayerInfo data = PlayerControl.LocalPlayer.Data;
NetworkedPlayerInfo data2 = sourcePlayer.Data;

if (data2 == null || data == null) // Remove isDead check for LocalPlayer
{
Expand Down
4 changes: 2 additions & 2 deletions src/Patches/OtherPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void Postfix(PingTracker __instance)

// Position adjustments
var offset_x = 1.2f;
if (HudManager.InstanceExists && HudManager._instance.Chat.chatButton.active) offset_x += 0.8f;
if (HudManager.InstanceExists && HudManager._instance.Chat.chatButton.selected) offset_x += 0.8f;
if (FriendsListManager.InstanceExists && FriendsListManager._instance.FriendsListButton.Button.active) offset_x += 0.8f;
__instance.GetComponent<AspectPosition>().DistanceFromEdge = new Vector3(offset_x, 0f, 0f);

Expand Down Expand Up @@ -176,7 +176,7 @@ public static class Vent_CanUse
{
// Prefix patch of Vent.CanUse to allow venting for cheaters
// Basically does what the original method did with the required modifications
public static void Postfix(Vent __instance, GameData.PlayerInfo pc, ref bool canUse, ref bool couldUse, ref float __result)
public static void Postfix(Vent __instance, NetworkedPlayerInfo pc, ref bool canUse, ref bool couldUse, ref float __result)
{
if (!PlayerControl.LocalPlayer.Data.Role.CanVent && !PlayerControl.LocalPlayer.Data.IsDead){
if (CheatToggles.useVents){
Expand Down
2 changes: 1 addition & 1 deletion src/Patches/RoleBehaviourPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class ImpostorRole_IsValidTarget
{
// Prefix patch of ImpostorRole.IsValidTarget to allow forbidden kill targets for killAnyone cheat
// Allows killing ghosts (with seeGhosts), impostors, players in vents, etc...
public static bool Prefix(ImpostorRole __instance, GameData.PlayerInfo target, ref bool __result){
public static bool Prefix(ImpostorRole __instance, NetworkedPlayerInfo target, ref bool __result){

if (CheatToggles.killAnyone){
__result = target != null && !target.Disconnected && (!target.IsDead || CheatToggles.seeGhosts) && target.PlayerId != __instance.Player.PlayerId && !(target.Object == null);
Expand Down
6 changes: 3 additions & 3 deletions src/Patches/ShapeshifterMinigamePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public static bool Prefix(ShapeshifterMinigame __instance)
if (PlayerPickMenu.IsActive){ // Player Pick Menu logic

// Custom player list set by openPlayerPickMenu
List<GameData.PlayerInfo> list = PlayerPickMenu.customPlayerList;
List<NetworkedPlayerInfo> list = PlayerPickMenu.customPlayerList;

__instance.potentialVictims = new List<ShapeshifterPanel>();
List<UiElement> list2 = new List<UiElement>();

for (int i = 0; i < list.Count; i++)
{
GameData.PlayerInfo playerData = list[i];
NetworkedPlayerInfo playerData = list[i];
int num = i % 3;
int num2 = i / 3;
ShapeshifterPanel shapeshifterPanel = UnityEngine.Object.Instantiate<ShapeshifterPanel>(__instance.PanelPrefab, __instance.transform);
Expand Down Expand Up @@ -59,7 +59,7 @@ public static bool Prefix(ShapeshifterMinigame __instance)
public static class ShapeshifterPanel_SetPlayer
{
// Prefix patch of ShapeshifterPanel.SetPlayer to allow usage of PlayerPickMenu in lobbies
public static bool Prefix(ShapeshifterPanel __instance, int index, GameData.PlayerInfo playerInfo, Il2CppSystem.Action onShift)
public static bool Prefix(ShapeshifterPanel __instance, int index, NetworkedPlayerInfo playerInfo, Il2CppSystem.Action onShift)
{
if (PlayerPickMenu.IsActive){ // Player Pick Menu logic

Expand Down
12 changes: 6 additions & 6 deletions src/Utilities/PlayerPickMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ public static class PlayerPickMenu
{
public static ShapeshifterMinigame playerpickMenu;
public static bool IsActive;
public static GameData.PlayerInfo targetPlayerData;
public static NetworkedPlayerInfo targetPlayerData;
public static Il2CppSystem.Action customAction;
public static List<GameData.PlayerInfo> customPlayerList;
public static List<NetworkedPlayerInfo> customPlayerList;

// Get ShapeshifterMenu prefab to instantiate it
// Found here: https://github.com/AlchlcDvl/TownOfUsReworked/blob/9f3cede9d30bab2c11eb7c960007ab3979f09156/TownOfUsReworked/Custom/Menu.cs
Expand All @@ -20,7 +20,7 @@ public static ShapeshifterMinigame getShapeshifterMenu()
}

// Open a PlayerPickMenu to pick a specific player to target
public static void openPlayerPickMenu(List<GameData.PlayerInfo> playerList, Il2CppSystem.Action action)
public static void openPlayerPickMenu(List<NetworkedPlayerInfo> playerList, Il2CppSystem.Action action)
{
IsActive = true;
customPlayerList = playerList;
Expand All @@ -34,10 +34,10 @@ public static void openPlayerPickMenu(List<GameData.PlayerInfo> playerList, Il2C
playerpickMenu.Begin(null);
}

// Returns a custom GameData.PlayerInfo that can be used as a PPM choice
public static GameData.PlayerInfo customPPMChoice(string name, GameData.PlayerOutfit outfit, RoleBehaviour role = null)
// Returns a custom NetworkedPlayerInfo that can be used as a PPM choice
public static NetworkedPlayerInfo customPPMChoice(string name, NetworkedPlayerInfo.PlayerOutfit outfit, RoleBehaviour role = null)
{
GameData.PlayerInfo customChoice = new GameData.PlayerInfo(255);
NetworkedPlayerInfo customChoice = new NetworkedPlayerInfo((System.IntPtr)255);

outfit.PlayerName = name;

Expand Down
6 changes: 3 additions & 3 deletions src/Utilities/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static void murderPlayer(PlayerControl target, MurderResultFlags result)
}

// Report bodies using RPC calls
public static void reportDeadBody(GameData.PlayerInfo playerData)
public static void reportDeadBody(NetworkedPlayerInfo playerData)
{

if (isFreePlay){
Expand Down Expand Up @@ -229,7 +229,7 @@ public static System.Collections.Generic.List<PlayerControl> getPlayersSortedByD

outputList.Clear();

List<GameData.PlayerInfo> allPlayers = GameData.Instance.AllPlayers;
List<NetworkedPlayerInfo> allPlayers = GameData.Instance.AllPlayers;
for (int i = 0; i < allPlayers.Count; i++)
{
PlayerControl player = allPlayers[i].Object;
Expand Down Expand Up @@ -327,7 +327,7 @@ public static bool stringToPlatformType(string platformStr, out Platforms? platf

// Get the string name for a chosen player's role
// String are automatically translated
public static string getRoleName(GameData.PlayerInfo playerData)
public static string getRoleName(NetworkedPlayerInfo playerData)
{
var translatedRole = DestroyableSingleton<TranslationController>.Instance.GetString(playerData.Role.StringName, Il2CppSystem.Array.Empty<Il2CppSystem.Object>());
if (translatedRole == "STRMISS")
Expand Down

0 comments on commit 21cdeb6

Please sign in to comment.