Add rank reveal cheat

This commit is contained in:
Mylloon 2023-05-07 03:12:51 +02:00
parent 4d01d803b3
commit 7fd8483ec1
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 111 additions and 0 deletions

107
cheats/rankreveal.py Normal file
View file

@ -0,0 +1,107 @@
from hack import Hack, sleep
class Rankreveal(Hack):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.ranks = [
"Unranked",
"Silver I",
"Silver II",
"Silver III",
"Silver IV",
"Silver Elite (V)",
"Silver Elite Master (VI)",
"Gold Nova I",
"Gold Nova II",
"Gold Nova III",
"Gold Nova Master (IV)",
"Master Guardian I",
"Master Guardian II",
"Master Guardian Elite (III)",
"Distinguished Master Guardian (IV)",
"Legendary Eagle (I)",
"Legendary Eagle Master (II)",
"Supreme Master First Class (III)",
"The Global Elite",
]
def rankreveal(self) -> None:
# Aliases
mem = self.pm
offset = self.offsets
# Get module addresses
client = self.find_module("client")
engine = self.find_module("engine")
# Get client state
client_state = self.find_uint(engine, offset["dwClientState"])
def cheat():
founds = []
# Loop all entities
for i in range(1, 32): # 0 is world
entity = int(
mem.read_uint(
client + offset["dwEntityList"] + i * offset["entity_size"]
)
)
# Ignore if entity doesn't exist
if not entity:
continue
# Ignore non-player
if not mem.read_uint(entity + offset["m_iTeamNum"]):
continue
# Get player info
player_info = int(
mem.read_uint(client_state + offset["dwClientState_PlayerInfo"])
)
# Get player's item
player_info_items = int(
mem.read_uint(
int(mem.read_uint(player_info + offset["player_info_items"]))
+ offset["player_info_item"],
)
)
info = int(
mem.read_uint(
player_info_items
+ offset["player_info_elem"]
+ (i * offset["player_info_elem_size"])
)
)
name_entity = mem.read_string(info + offset["entity_size"])
if name_entity != "GOTV":
player_ressources = int(
mem.read_uint(client + offset["dwPlayerResource"])
)
rank = int(
mem.read_uint(
player_ressources
+ offset["m_iCompetitiveRanking"]
+ (i * 4)
)
)
founds.append((name_entity, rank))
if len(founds) > 0:
# Print ranks
max_len = len(max(list(zip(*founds))[0], key=len)) # use for formatting
[print(f"{i:{max_len}} --> {self.ranks[j]}") for (i, j) in founds]
founds = []
sleep(1000)
else:
sleep(2)
self.hack_loop(cheat)

View file

@ -53,6 +53,10 @@ class Hack:
"head_x": 0x0C, "head_x": 0x0C,
"head_y": 0x1C, "head_y": 0x1C,
"head_z": 0x2C, "head_z": 0x2C,
"player_info_items": 0x40,
"player_info_item": 0xC,
"player_info_elem": 0x28,
"player_info_elem_size": 0x34,
} }
) )