2023-04-05 13:01:06 +02:00
|
|
|
# Easy steps to add a cheat to this app:
|
|
|
|
|
|
|
|
1. Create a file in [the cheat directory](./cheats/)
|
|
|
|
2. Create a class that inherits from `Hack`:
|
|
|
|
|
|
|
|
```python
|
|
|
|
from hack import Hack
|
|
|
|
|
2023-04-05 13:07:39 +02:00
|
|
|
class Mycheat(Hack):
|
2023-04-05 13:01:06 +02:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2023-04-05 13:07:39 +02:00
|
|
|
# Here you can initialize global variables for your cheat
|
2023-04-05 13:01:06 +02:00
|
|
|
```
|
|
|
|
|
2023-05-05 16:05:00 +02:00
|
|
|
3. Add the method who will contain the cheat logic, note that:
|
|
|
|
- Your method must contain a sub-method and must be added to
|
2023-04-05 13:07:39 +02:00
|
|
|
the `hackloop` at the end of the method (see example below)
|
2023-04-05 13:01:06 +02:00
|
|
|
|
|
|
|
```python
|
|
|
|
def mycheat(self) -> None:
|
2023-04-05 13:07:39 +02:00
|
|
|
# Cheat initialization, will only run once
|
2023-04-05 13:01:06 +02:00
|
|
|
|
|
|
|
def cheat():
|
|
|
|
# Your cheat logic, will be looped
|
|
|
|
|
2023-04-05 13:07:39 +02:00
|
|
|
# Setting up the loop
|
2023-04-05 13:01:06 +02:00
|
|
|
self.hack_loop(cheat)
|
|
|
|
```
|
|
|
|
|
2023-04-05 13:07:39 +02:00
|
|
|
4. If you need to unload something before closing the app (e.g. restore the
|
|
|
|
initial state of something), you can add a second method called
|
|
|
|
`MYCHEAT_unload` with `MYCHEAT` the same name as the previous method
|
|
|
|
|
|
|
|
```python
|
|
|
|
def mycheat_unload(self) -> None:
|
|
|
|
# Called when the app is closed
|
|
|
|
```
|
|
|
|
|
|
|
|
5. For more examples, see [the cheats already done](./cheats/)
|
|
|
|
|
2023-04-06 12:38:10 +02:00
|
|
|
6. If your cheat logic modifies the same memory of another cheat at the same
|
|
|
|
time, then add that cheat to the list of incompatibilities in [cheat](./cheat.py)
|
|
|
|
after the `Incompatible cheats` comment. Add only one entry for your cheat,
|
|
|
|
it will automatically propagate to the other ones
|
|
|
|
|
2023-04-05 13:01:06 +02:00
|
|
|
## Extra infos
|
|
|
|
|
|
|
|
- `self.pm` is used to read/write memory
|
|
|
|
- `self.offsets` contains a list of offsets
|
|
|
|
- `self.find_module` finds a module (`.dll`)
|
|
|
|
- `self.find_uint` always returns something (blocking thread)
|
|
|
|
- You can always add time between each loop call by calling `sleep`
|
|
|
|
- See the [utils](./utils.py) file if you need more tools, like a vector class,
|
|
|
|
colour etc.
|
|
|
|
- If needed, feel free to add your own offsets to the `self.offsets` variable
|
2023-05-05 17:03:11 +02:00
|
|
|
|
|
|
|
# Miscellaneous
|
|
|
|
|
|
|
|
Please, use `black` before doing a pull request, as it's the formatter the
|
|
|
|
project use.
|
2023-05-07 04:09:08 +02:00
|
|
|
|
|
|
|
On Linux, you can copy the git hook stored in [githooks/](./githooks) who check
|
|
|
|
the code, preventing any commit with bad formatting.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ cp githooks/* .git/hooks/
|
|
|
|
```
|