Skip to content

Commit 9d5edd8

Browse files
committed
Fix killVanished cheat acting like killAnyone
1 parent 0a81197 commit 9d5edd8

File tree

3 files changed

+48
-46
lines changed

3 files changed

+48
-46
lines changed

src/Patches/RoleBehaviourPatches.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using UnityEngine;
55
using Sentry.Internal.Extensions;
6+
using AmongUs.GameOptions;
67

78
namespace MalumMenu;
89

@@ -75,16 +76,11 @@ public static void Postfix(PhantomRole __instance){
7576
public static class PhantomRole_IsValidTarget
7677
{
7778
// Prefix patch of PhantomRole.IsValidTarget to allow killing while invisible
78-
public static bool Prefix(PhantomRole __instance, NetworkedPlayerInfo target, ref bool __result){
79+
public static void Postfix(NetworkedPlayerInfo target, ref bool __result){
7980

8081
if (CheatToggles.killVanished){
8182
__result = Utils.isValidTarget(target);
82-
83-
return false;
8483
}
85-
86-
return true;
87-
8884
}
8985
}
9086

@@ -93,16 +89,12 @@ public static class ImpostorRole_IsValidTarget
9389
{
9490
// Prefix patch of ImpostorRole.IsValidTarget to allow forbidden kill targets for killAnyone cheat
9591
// Allows killing ghosts (with seeGhosts), impostors, players in vents, etc...
96-
public static bool Prefix(NetworkedPlayerInfo target, ref bool __result){
92+
public static void Postfix(NetworkedPlayerInfo target, ref bool __result){
9793

9894
if (CheatToggles.killAnyone){
9995
__result = Utils.isValidTarget(target);
100-
101-
return false;
10296
}
10397

104-
return true;
105-
10698
}
10799
}
108100

src/UI/MenuUI.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ private void Start()
1616
{
1717
groups.Add(new GroupInfo("Player", false, new List<ToggleInfo>() {
1818
new ToggleInfo(" NoClip", () => CheatToggles.noClip, x => CheatToggles.noClip = x),
19-
new ToggleInfo(" SpeedBoost", () => CheatToggles.speedBoost, x => CheatToggles.speedBoost = x),
19+
new ToggleInfo(" Boost Speed", () => CheatToggles.speedBoost, x => CheatToggles.speedBoost = x),
2020
}, new List<SubmenuInfo> {
2121
new SubmenuInfo("Murder", false, new List<ToggleInfo>() {
22-
new ToggleInfo(" MurderPlayer", () => CheatToggles.murderPlayer, x => CheatToggles.murderPlayer = x),
23-
new ToggleInfo(" MurderAll", () => CheatToggles.murderAll, x => CheatToggles.murderAll = x),
22+
new ToggleInfo(" Murder Player", () => CheatToggles.murderPlayer, x => CheatToggles.murderPlayer = x),
23+
new ToggleInfo(" Murder All", () => CheatToggles.murderAll, x => CheatToggles.murderAll = x),
2424
}),
2525
new SubmenuInfo("Teleport", false, new List<ToggleInfo>() {
2626
new ToggleInfo(" to Cursor", () => CheatToggles.teleportCursor, x => CheatToggles.teleportCursor = x),
@@ -30,14 +30,14 @@ private void Start()
3030
));
3131

3232
groups.Add(new GroupInfo("ESP", false, new List<ToggleInfo>() {
33-
new ToggleInfo(" SeeRoles", () => CheatToggles.seeRoles, x => CheatToggles.seeRoles = x),
34-
new ToggleInfo(" SeeGhosts", () => CheatToggles.seeGhosts, x => CheatToggles.seeGhosts = x),
35-
new ToggleInfo(" FullBright", () => CheatToggles.fullBright, x => CheatToggles.fullBright = x),
36-
new ToggleInfo(" RevealVotes", () => CheatToggles.revealVotes, x => CheatToggles.revealVotes = x),
37-
new ToggleInfo(" AlwaysChat", () => CheatToggles.alwaysChat, x => CheatToggles.alwaysChat = x)
33+
new ToggleInfo(" See Roles", () => CheatToggles.seeRoles, x => CheatToggles.seeRoles = x),
34+
new ToggleInfo(" See Ghosts", () => CheatToggles.seeGhosts, x => CheatToggles.seeGhosts = x),
35+
new ToggleInfo(" No Shadows", () => CheatToggles.fullBright, x => CheatToggles.fullBright = x),
36+
new ToggleInfo(" Reveal Votes", () => CheatToggles.revealVotes, x => CheatToggles.revealVotes = x),
37+
new ToggleInfo(" Always Chat", () => CheatToggles.alwaysChat, x => CheatToggles.alwaysChat = x)
3838
}, new List<SubmenuInfo> {
3939
new SubmenuInfo("Camera", false, new List<ToggleInfo>() {
40-
new ToggleInfo(" ZoomOut", () => CheatToggles.zoomOut, x => CheatToggles.zoomOut = x),
40+
new ToggleInfo(" Zoom Out", () => CheatToggles.zoomOut, x => CheatToggles.zoomOut = x),
4141
new ToggleInfo(" Spectate", () => CheatToggles.spectate, x => CheatToggles.spectate = x),
4242
new ToggleInfo(" Freecam", () => CheatToggles.freecam, x => CheatToggles.freecam = x)
4343
}),
@@ -57,43 +57,43 @@ private void Start()
5757
}));
5858

5959
groups.Add(new GroupInfo("Roles", false, new List<ToggleInfo>() {
60-
new ToggleInfo(" ChangeRole", () => CheatToggles.changeRole, x => CheatToggles.changeRole = x),
60+
new ToggleInfo(" Set Fake Role", () => CheatToggles.changeRole, x => CheatToggles.changeRole = x),
6161
},
6262
new List<SubmenuInfo> {
63-
new SubmenuInfo("Crewmate", false, new List<ToggleInfo>() {
64-
new ToggleInfo(" CompleteMyTasks", () => CheatToggles.completeMyTasks, x => CheatToggles.completeMyTasks = x)
65-
}),
6663
new SubmenuInfo("Impostor", false, new List<ToggleInfo>() {
67-
new ToggleInfo(" KillAnyone", () => CheatToggles.killAnyone, x => CheatToggles.killAnyone = x),
68-
new ToggleInfo(" NoKillCooldown", () => CheatToggles.zeroKillCd, x => CheatToggles.zeroKillCd = x),
69-
new ToggleInfo(" KillReach", () => CheatToggles.killReach, x => CheatToggles.killReach = x),
64+
new ToggleInfo(" Kill Anyone", () => CheatToggles.killAnyone, x => CheatToggles.killAnyone = x),
65+
new ToggleInfo(" No Kill Cooldown", () => CheatToggles.zeroKillCd, x => CheatToggles.zeroKillCd = x),
66+
new ToggleInfo(" Kill Reach", () => CheatToggles.killReach, x => CheatToggles.killReach = x),
7067
}),
7168
new SubmenuInfo("Phantom", false, new List<ToggleInfo>() {
72-
new ToggleInfo(" VanishKills", () => CheatToggles.killVanished, x => CheatToggles.killVanished = x),
69+
new ToggleInfo(" Kill While Vanished", () => CheatToggles.killVanished, x => CheatToggles.killVanished = x),
7370
}),
7471
new SubmenuInfo("Shapeshifter", false, new List<ToggleInfo>() {
75-
new ToggleInfo(" NoSsAnimation", () => CheatToggles.noShapeshiftAnim, x => CheatToggles.noShapeshiftAnim = x),
76-
new ToggleInfo(" EndlessSsDuration", () => CheatToggles.endlessSsDuration, x => CheatToggles.endlessSsDuration = x),
72+
new ToggleInfo(" No Ss Animation", () => CheatToggles.noShapeshiftAnim, x => CheatToggles.noShapeshiftAnim = x),
73+
new ToggleInfo(" Endless Ss Duration", () => CheatToggles.endlessSsDuration, x => CheatToggles.endlessSsDuration = x),
74+
}),
75+
new SubmenuInfo("Crewmate", false, new List<ToggleInfo>() {
76+
new ToggleInfo(" Complete My Tasks", () => CheatToggles.completeMyTasks, x => CheatToggles.completeMyTasks = x)
7777
}),
7878
new SubmenuInfo("Tracker", false, new List<ToggleInfo>() {
79-
new ToggleInfo(" EndlessTracking", () => CheatToggles.endlessTracking, x => CheatToggles.endlessTracking = x),
80-
new ToggleInfo(" NoTrackDelay", () => CheatToggles.noTrackingDelay, x => CheatToggles.noTrackingDelay = x),
81-
new ToggleInfo(" NoTrackCooldown", () => CheatToggles.noTrackingCooldown, x => CheatToggles.noTrackingCooldown = x),
79+
new ToggleInfo(" Endless Tracking", () => CheatToggles.endlessTracking, x => CheatToggles.endlessTracking = x),
80+
new ToggleInfo(" No Track Delay", () => CheatToggles.noTrackingDelay, x => CheatToggles.noTrackingDelay = x),
81+
new ToggleInfo(" No Track Cooldown", () => CheatToggles.noTrackingCooldown, x => CheatToggles.noTrackingCooldown = x),
8282
}),
8383
new SubmenuInfo("Engineer", false, new List<ToggleInfo>() {
84-
new ToggleInfo(" EndlessVentTime", () => CheatToggles.endlessVentTime, x => CheatToggles.endlessVentTime = x),
85-
new ToggleInfo(" NoVentCooldown", () => CheatToggles.noVentCooldown, x => CheatToggles.noVentCooldown = x),
84+
new ToggleInfo(" Endless Vent Time", () => CheatToggles.endlessVentTime, x => CheatToggles.endlessVentTime = x),
85+
new ToggleInfo(" No Vent Cooldown", () => CheatToggles.noVentCooldown, x => CheatToggles.noVentCooldown = x),
8686
}),
8787
new SubmenuInfo("Scientist", false, new List<ToggleInfo>() {
88-
new ToggleInfo(" EndlessBattery", () => CheatToggles.endlessBattery, x => CheatToggles.endlessBattery = x),
89-
new ToggleInfo(" NoVitalsCooldown", () => CheatToggles.noVitalsCooldown, x => CheatToggles.noVitalsCooldown = x),
88+
new ToggleInfo(" Endless Battery", () => CheatToggles.endlessBattery, x => CheatToggles.endlessBattery = x),
89+
new ToggleInfo(" No Vitals Cooldown", () => CheatToggles.noVitalsCooldown, x => CheatToggles.noVitalsCooldown = x),
9090
}),
9191
}));
9292

9393
groups.Add(new GroupInfo("Ship", false, new List<ToggleInfo> {
94-
new ToggleInfo(" UnfixableLights", () => CheatToggles.unfixableLights, x => CheatToggles.unfixableLights = x),
95-
new ToggleInfo(" ReportBody", () => CheatToggles.reportBody, x => CheatToggles.reportBody = x),
96-
new ToggleInfo(" CloseMeeting", () => CheatToggles.closeMeeting, x => CheatToggles.closeMeeting = x),
94+
new ToggleInfo(" Unfixable Lights", () => CheatToggles.unfixableLights, x => CheatToggles.unfixableLights = x),
95+
new ToggleInfo(" Report Body", () => CheatToggles.reportBody, x => CheatToggles.reportBody = x),
96+
new ToggleInfo(" Close Meeting", () => CheatToggles.closeMeeting, x => CheatToggles.closeMeeting = x),
9797
}, new List<SubmenuInfo> {
9898
new SubmenuInfo("Sabotage", false, new List<ToggleInfo>() {
9999
new ToggleInfo(" Reactor", () => CheatToggles.reactorSab, x => CheatToggles.reactorSab = x),
@@ -126,9 +126,9 @@ private void Start()
126126
//}, new List<SubmenuInfo>()));
127127

128128
groups.Add(new GroupInfo("Passive", false, new List<ToggleInfo>() {
129-
new ToggleInfo(" FreeCosmetics", () => CheatToggles.freeCosmetics, x => CheatToggles.freeCosmetics = x),
130-
new ToggleInfo(" AvoidPenalties", () => CheatToggles.avoidBans, x => CheatToggles.avoidBans = x),
131-
new ToggleInfo(" UnlockFeatures", () => CheatToggles.unlockFeatures, x => CheatToggles.unlockFeatures = x),
129+
new ToggleInfo(" Free Cosmetics", () => CheatToggles.freeCosmetics, x => CheatToggles.freeCosmetics = x),
130+
new ToggleInfo(" Avoid Penalties", () => CheatToggles.avoidBans, x => CheatToggles.avoidBans = x),
131+
new ToggleInfo(" Unlock Features", () => CheatToggles.unlockFeatures, x => CheatToggles.unlockFeatures = x),
132132
}, new List<SubmenuInfo>()));
133133
}
134134

src/Utilities/Utils.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Reflection;
88
using AmongUs.GameOptions;
99
using Sentry.Internal.Extensions;
10+
using Il2CppSystem.Net.NetworkInformation;
1011

1112
namespace MalumMenu;
1213
public static class Utils
@@ -49,7 +50,7 @@ public static ClientData getClientByPlayer(PlayerControl player)
4950
}
5051

5152
// Get ClientData.Id by PlayerControl
52-
public static int getClientIdByPlayer(this PlayerControl player)
53+
public static int getClientIdByPlayer(PlayerControl player)
5354
{
5455
if (player == null) return -1;
5556
var client = getClientByPlayer(player);
@@ -71,7 +72,16 @@ public static bool isVanished(NetworkedPlayerInfo playerInfo)
7172
// Custom isValidTarget method for cheats
7273
public static bool isValidTarget(NetworkedPlayerInfo target)
7374
{
74-
return target != null && !target.Disconnected && (!target.IsDead || CheatToggles.seeGhosts) && target.PlayerId != PlayerControl.LocalPlayer.PlayerId && !(target.Object == null);
75+
bool killAnyoneRequirements = !(target == null) && !target.Disconnected && target.Object.Visible && target.PlayerId != PlayerControl.LocalPlayer.PlayerId && !(target.Role == null) && !(target.Object == null);
76+
77+
bool fullRequirements = killAnyoneRequirements && !target.IsDead && !target.Object.inVent && !target.Object.inMovingPlat && target.Role.CanBeKilled;
78+
79+
if (CheatToggles.killAnyone){
80+
return killAnyoneRequirements;
81+
}
82+
83+
return fullRequirements;
84+
7585
}
7686

7787
// Adjusts HUD resolution
@@ -90,7 +100,7 @@ public static void murderPlayer(PlayerControl target, MurderResultFlags result)
90100
{
91101
if (isFreePlay){
92102

93-
PlayerControl.LocalPlayer.RpcMurderPlayer(target, true);
103+
PlayerControl.LocalPlayer.MurderPlayer(target, MurderResultFlags.Succeeded);
94104
return;
95105

96106
}

0 commit comments

Comments
 (0)