From 7fd8483ec104403911e81938292fd05590da0cd2 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 7 May 2023 03:12:51 +0200 Subject: [PATCH] Add rank reveal cheat --- cheats/rankreveal.py | 107 +++++++++++++++++++++++++++++++++++++++++++ hack.py | 4 ++ 2 files changed, 111 insertions(+) create mode 100644 cheats/rankreveal.py diff --git a/cheats/rankreveal.py b/cheats/rankreveal.py new file mode 100644 index 0000000..16ce338 --- /dev/null +++ b/cheats/rankreveal.py @@ -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) diff --git a/hack.py b/hack.py index 91023df..0ebe1d0 100644 --- a/hack.py +++ b/hack.py @@ -53,6 +53,10 @@ class Hack: "head_x": 0x0C, "head_y": 0x1C, "head_z": 0x2C, + "player_info_items": 0x40, + "player_info_item": 0xC, + "player_info_elem": 0x28, + "player_info_elem_size": 0x34, } )