Skip to content

Commit

Permalink
Add: Spoofing cheats
Browse files Browse the repository at this point in the history
  • Loading branch information
scp222thj committed Jan 3, 2024
1 parent bb87d7e commit 2c2ae82
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/ESP/HudPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void Postfix(HudManager __instance){
}

//Close player pick menu when it is not being used
if (Utils_PlayerPickMenu.playerpickMenu != null && !CheatSettings.shapeshiftAll && !CheatSettings.callMeeting && !CheatSettings.teleportPlayer && !CheatSettings.copyOutfit && !CheatSettings.murderPlayer && !CheatSettings.kickPlayer && !CheatSettings.spectate){
if (Utils_PlayerPickMenu.playerpickMenu != null && !CheatSettings.shapeshiftAll && !CheatSettings.saveSpoofData && !CheatSettings.callMeeting && !CheatSettings.teleportPlayer && !CheatSettings.copyOutfit && !CheatSettings.murderPlayer && !CheatSettings.kickPlayer && !CheatSettings.spectate){
Utils_PlayerPickMenu.playerpickMenu.Close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ESP/SpectatePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.teleportPlayer = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.kickPlayer = CheatSettings.murderPlayer = false;
CheatSettings.teleportPlayer = CheatSettings.saveSpoofData = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.kickPlayer = CheatSettings.murderPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
25 changes: 13 additions & 12 deletions src/MalumMenuPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,28 @@ public partial class MalumPlugin : BasePlugin
public static List<string> supportedAU = new List<string> { "2023.11.28" };
private static MenuUI menuUI;
public static ConfigEntry<string> menuKeybind;
public static ConfigEntry<string> customFriendCode;
public static ConfigEntry<string> customPuid;
public static ConfigEntry<string> spoofFriendCode;
public static ConfigEntry<string> spoofPuid;

public override void Load()
{

menuKeybind = Config.Bind("MalumMenu", // The section under which the option is shown
"GUIKeybind", // The key of the configuration option in the configuration file
"Delete", // The default value
"The keyboard key used to toggle the GUI on and off"); // Description of the option to show in the config file
menuKeybind = Config.Bind("MalumMenu",
"GUIKeybind",
"Delete",
"The keyboard key used to toggle the GUI on and off");

customFriendCode = Config.Bind("MalumMenu.Cheats",
"CustomFriendCode",
spoofFriendCode = Config.Bind("MalumMenu.SpoofedUserData",
"SpoofedFriendCode",
"",
"Your custom friend code that will be used in online games");
"Your spoofed friend code that will be used in online games. IMPORTANT: When using a spoofed friend code, players won't be able to send you friend requests");

customPuid = Config.Bind("MalumMenu.Cheats",
"CustomPuid",
spoofPuid = Config.Bind("MalumMenu.SpoofedUserData",
"SpoofedPuid",
"",
"Your custom PUID that will be used in online games. IMPORTANT: Only valid PUIDs will work");
"Your spoofed PUID that will be used in online games. IMPORTANT: Only valid, active PUIDs will let you connect to lobbies");


Harmony.PatchAll();
menuUI = AddComponent<MenuUI>();

Expand Down
2 changes: 1 addition & 1 deletion src/Meetings/CallMeetingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.murderPlayer = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
CheatSettings.spectate = CheatSettings.murderPlayer = CheatSettings.shapeshiftAll = CheatSettings.saveSpoofData = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
2 changes: 1 addition & 1 deletion src/Murder/MurderPlayerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.saveSpoofData = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.murderPlayer = false;
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.saveSpoofData = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.murderPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
64 changes: 64 additions & 0 deletions src/Other/SaveSpoofDataPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using System;
using BepInEx;
using System.IO;
using BepInEx.Configuration;

namespace MalumMenu;

[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.LateUpdate))]
public static class RPC_SaveSpoofDataPostfix
{
//Postfix patch of PlayerPhysics.LateUpdate to open player pick menu to kick any player
public static bool isActive;
public static ConfigFile userSpoofSaveFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "MM_SavedSpoofData.cfg"), true);
public static void Postfix(PlayerPhysics __instance){
if (CheatSettings.saveSpoofData){

if (!isActive){

//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.kickPlayer = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.murderPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();

//All players are saved to playerList apart from LocalPlayer
foreach (var player in PlayerControl.AllPlayerControls){
if (!player.AmOwner){
playerList.Add(player);
}
}

//New player pick menu made for kicking players
Utils_PlayerPickMenu.openPlayerPickMenu(playerList, (Action) (() =>
{
var friendCode = userSpoofSaveFile.Bind($"SpoofData.{Utils_PlayerPickMenu.targetPlayer.Data.PlayerName}",
"FriendCode",
"");
friendCode.Value = AmongUsClient.Instance.GetClientFromCharacter(Utils_PlayerPickMenu.targetPlayer).FriendCode;

var puid = userSpoofSaveFile.Bind($"SpoofData.{Utils_PlayerPickMenu.targetPlayer.Data.PlayerName}",
"ProductUserID",
"");
puid.Value = AmongUsClient.Instance.GetClientFromCharacter(Utils_PlayerPickMenu.targetPlayer).ProductUserId;
}));

isActive = true;
}

//Deactivate cheat if menu is closed
if (Utils_PlayerPickMenu.playerpickMenu == null){
CheatSettings.saveSpoofData = false;
}

}else{
if (isActive){
isActive = false;
}
}
}
}
36 changes: 36 additions & 0 deletions src/Other/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,42 @@ public static void RandomizeOutfit(PlayerControl sender, PlayerControl recipient
AmongUsClient.Instance.FinishRpcImmediately(skinWriter);
}

public static void CopyOutfit(PlayerControl source, PlayerControl target)
{
var HostData = AmongUsClient.Instance.GetHost();
if (HostData != null && !HostData.Character.Data.Disconnected){

//Shapeshift into any player by sending a fake Shapeshift RPC call to all clients
foreach (var item in PlayerControl.AllPlayerControls)
{
MessageWriter colorWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetColor, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
colorWriter.Write(target.Data.DefaultOutfit.ColorId);
AmongUsClient.Instance.FinishRpcImmediately(colorWriter);

MessageWriter nameWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetName, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
nameWriter.Write(target.Data.DefaultOutfit.PlayerName);
AmongUsClient.Instance.FinishRpcImmediately(nameWriter);

MessageWriter hatWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetHatStr, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
hatWriter.Write(target.Data.DefaultOutfit.HatId);
AmongUsClient.Instance.FinishRpcImmediately(hatWriter);

MessageWriter petWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetPetStr, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
petWriter.Write(target.Data.DefaultOutfit.PetId);
AmongUsClient.Instance.FinishRpcImmediately(petWriter);

MessageWriter visorWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetVisorStr, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
visorWriter.Write(target.Data.DefaultOutfit.VisorId);
AmongUsClient.Instance.FinishRpcImmediately(visorWriter);

MessageWriter skinWriter = AmongUsClient.Instance.StartRpcImmediately(source.NetId, (byte)RpcCalls.SetSkinStr, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(item));
skinWriter.Write(target.Data.DefaultOutfit.SkinId);
AmongUsClient.Instance.FinishRpcImmediately(skinWriter);
}
}

}

//Gets current map ID
public static byte getCurrentMapID()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Outfits/CopyOutfitCheatPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.murderPlayer = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
CheatSettings.spectate = CheatSettings.saveSpoofData = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.murderPlayer = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
30 changes: 0 additions & 30 deletions src/Passive/CustomFriendCodePatch.cs

This file was deleted.

29 changes: 29 additions & 0 deletions src/Passive/SpoofedUserDataPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using HarmonyLib;

namespace MalumMenu;

[HarmonyPatch(typeof(EOSManager), nameof(EOSManager.ProductUserId), MethodType.Getter)]
public static class Passive_SpoofedPUIDPostfix
{
public static void Postfix(ref string __result)
{
if (CheatSettings.customUserData){
if (MalumPlugin.spoofPuid.Value != ""){
__result = MalumPlugin.spoofPuid.Value;
}
}
}
}

[HarmonyPatch(typeof(EOSManager), nameof(EOSManager.Update))]
public static class Passive_SpoofedFriendCodePostfix
{
public static void Postfix(EOSManager __instance)
{
if (CheatSettings.customUserData){
if (MalumPlugin.spoofPuid.Value != "" && MalumPlugin.spoofPuid.Value != __instance.FriendCode){
__instance.FriendCode = MalumPlugin.spoofPuid.Value;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Shapeshift/ShapeshiftAllPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.murderPlayer = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.kickPlayer = false;
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.murderPlayer = CheatSettings.copyOutfit = CheatSettings.teleportPlayer = CheatSettings.saveSpoofData = CheatSettings.kickPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
2 changes: 1 addition & 1 deletion src/Teleport/TeleportPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void Postfix(PlayerPhysics __instance){
//Close any player pick menus already open & their cheats
if (Utils_PlayerPickMenu.playerpickMenu != null){
Utils_PlayerPickMenu.playerpickMenu.Close();
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.copyOutfit = CheatSettings.kickPlayer = CheatSettings.murderPlayer = false;
CheatSettings.spectate = CheatSettings.callMeeting = CheatSettings.shapeshiftAll = CheatSettings.saveSpoofData = CheatSettings.copyOutfit = CheatSettings.kickPlayer = CheatSettings.murderPlayer = false;
}

List<PlayerControl> playerList = new List<PlayerControl>();
Expand Down
1 change: 1 addition & 0 deletions src/UI/CheatSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public struct CheatSettings

//RPC Exploit
public static bool kickPlayer;
public static bool saveSpoofData;
public static bool spamChat;
public static bool murderPlayer;
public static bool copyOutfit;
Expand Down
10 changes: 10 additions & 0 deletions src/UI/MenuUI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections.Generic;
using Cpp2IL.Core.Analysis.Actions.x86.Important;

namespace MalumMenu;
public class MenuUI : MonoBehaviour
Expand Down Expand Up @@ -110,6 +111,15 @@ private void Start()
new ToggleInfo(" VoteImmune", () => CheatSettings.voteImmune, x => CheatSettings.voteImmune = x)
}, new List<SubmenuInfo>()));

groups.Add(new GroupInfo("Spoofing", false, new List<ToggleInfo>() {
new ToggleInfo(" SaveSpoofData", () => CheatSettings.saveSpoofData, x => CheatSettings.saveSpoofData = x),
}, new List<SubmenuInfo> {
new SubmenuInfo("Spoof Status", false, new List<ToggleInfo>() {
new ToggleInfo(" FriendCode Spoof", () => MalumPlugin.spoofFriendCode.Value != "", (bool n) => { }),
new ToggleInfo(" PUID Spoof", () => MalumPlugin.spoofPuid.Value != "", (bool n) => { }),
}),
}));

groups.Add(new GroupInfo("Passive", false, new List<ToggleInfo>() {
new ToggleInfo(" FreeCosmetics", () => CheatSettings.freeCosmetics, x => CheatSettings.freeCosmetics = x),
new ToggleInfo(" AvoidPenalties", () => CheatSettings.avoidBans, x => CheatSettings.avoidBans = x),
Expand Down

0 comments on commit 2c2ae82

Please sign in to comment.