trainerbase 4.9.0__tar.gz → 4.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {trainerbase-4.9.0 → trainerbase-4.9.2}/PKG-INFO +18 -18
  2. {trainerbase-4.9.0 → trainerbase-4.9.2}/README.md +16 -16
  3. {trainerbase-4.9.0 → trainerbase-4.9.2}/pyproject.toml +22 -11
  4. {trainerbase-4.9.0 → trainerbase-4.9.2}/pyproject.toml.orig +13 -12
  5. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/keyboard.py +3 -3
  6. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/config.py +0 -6
  7. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/helpers.py +1 -0
  8. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/injections.py +2 -2
  9. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/main.py +12 -5
  10. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/speedhack.py +11 -8
  11. trainerbase-4.9.2/trainerbase/vendor/big_logo.png +0 -0
  12. trainerbase-4.9.2/trainerbase/vendor/speedhack32.dll +0 -0
  13. trainerbase-4.9.2/trainerbase/vendor/speedhack64.dll +0 -0
  14. trainerbase-4.9.2/trainerbase/vendor/trainerbase.ico +0 -0
  15. trainerbase-4.9.0/trainerbase/vendor/big_logo.png +0 -0
  16. trainerbase-4.9.0/trainerbase/vendor/speedhack32.dll +0 -0
  17. trainerbase-4.9.0/trainerbase/vendor/speedhack64.dll +0 -0
  18. trainerbase-4.9.0/trainerbase/vendor/trainerbase.ico +0 -0
  19. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/__init__.py +0 -0
  20. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/abc.py +0 -0
  21. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/codeinjection.py +0 -0
  22. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/__init__.py +0 -0
  23. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/abc.py +0 -0
  24. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/helpers.py +0 -0
  25. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/rainbow.py +0 -0
  26. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/tapper.py +0 -0
  27. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/common/teleport.py +0 -0
  28. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gameobject.py +0 -0
  29. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/__init__.py +0 -0
  30. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/misc.py +0 -0
  31. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/objects.py +0 -0
  32. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/rainbow.py +0 -0
  33. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/scripts.py +0 -0
  34. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/speedhack.py +0 -0
  35. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/tapper.py +0 -0
  36. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/teleport.py +0 -0
  37. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/gui/types.py +0 -0
  38. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/logger.py +0 -0
  39. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/memory.py +0 -0
  40. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/process.py +0 -0
  41. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/py.typed +0 -0
  42. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/scriptengine.py +0 -0
  43. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/tts.py +0 -0
  44. {trainerbase-4.9.0 → trainerbase-4.9.2}/trainerbase/vendor/FASM.EXE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trainerbase
3
- Version: 4.9.0
3
+ Version: 4.9.2
4
4
  Summary: Framework for creating game trainers/mods
5
5
  Author: v01d, doomayka
6
6
  Author-email: v01d <v01d@v01d.ru>, doomayka <doomaykaka@gmail.com>
@@ -11,7 +11,7 @@ Requires-Dist: dearpygui>=2.3.1
11
11
  Requires-Dist: keyboard>=0.13.5
12
12
  Requires-Dist: mouse>=0.7.1
13
13
  Requires-Dist: psutil>=7.2.2
14
- Requires-Dist: pydantic>=2.14.0
14
+ Requires-Dist: pydantic>=2.14.1
15
15
  Requires-Dist: pymem>=1.14.0
16
16
  Requires-Dist: pyttsx3>=2.99
17
17
  Requires-Dist: trainerbase-injector>=1.0.1
@@ -20,19 +20,19 @@ Project-URL: Homepage, https://gitlab.com/python-trainers/
20
20
  Project-URL: Repository, https://gitlab.com/python-trainers/trainer-base
21
21
  Description-Content-Type: text/markdown
22
22
 
23
- # Trainer Base
24
-
25
- [![PyPI version](https://badge.fury.io/py/TrainerBase.svg)](https://badge.fury.io/py/TrainerBase)
26
- [![Downloads](https://static.pepy.tech/badge/trainerbase)](https://pepy.tech/project/trainerbase)
27
-
28
- ![Logo](https://gitlab.com/python-trainers/trainer-base/-/raw/main/trainerbase/vendor/big_logo.png)
29
-
30
- ## To create project from template using cookiecutter
31
-
32
- ```bash
33
- cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
34
- ```
35
-
36
- ## Examples
37
-
38
- [Python Trainers](https://gitlab.com/python-trainers)
23
+ # Trainer Base
24
+
25
+ [![PyPI version](https://badge.fury.io/py/TrainerBase.svg)](https://badge.fury.io/py/TrainerBase)
26
+ [![Downloads](https://static.pepy.tech/badge/trainerbase)](https://pepy.tech/project/trainerbase)
27
+
28
+ ![Logo](https://gitlab.com/python-trainers/trainer-base/-/raw/main/trainerbase/vendor/big_logo.png)
29
+
30
+ ## To create project from template using cookiecutter
31
+
32
+ ```bash
33
+ cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
34
+ ```
35
+
36
+ ## Examples
37
+
38
+ [Python Trainers](https://gitlab.com/python-trainers)
@@ -1,16 +1,16 @@
1
- # Trainer Base
2
-
3
- [![PyPI version](https://badge.fury.io/py/TrainerBase.svg)](https://badge.fury.io/py/TrainerBase)
4
- [![Downloads](https://static.pepy.tech/badge/trainerbase)](https://pepy.tech/project/trainerbase)
5
-
6
- ![Logo](https://gitlab.com/python-trainers/trainer-base/-/raw/main/trainerbase/vendor/big_logo.png)
7
-
8
- ## To create project from template using cookiecutter
9
-
10
- ```bash
11
- cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
12
- ```
13
-
14
- ## Examples
15
-
16
- [Python Trainers](https://gitlab.com/python-trainers)
1
+ # Trainer Base
2
+
3
+ [![PyPI version](https://badge.fury.io/py/TrainerBase.svg)](https://badge.fury.io/py/TrainerBase)
4
+ [![Downloads](https://static.pepy.tech/badge/trainerbase)](https://pepy.tech/project/trainerbase)
5
+
6
+ ![Logo](https://gitlab.com/python-trainers/trainer-base/-/raw/main/trainerbase/vendor/big_logo.png)
7
+
8
+ ## To create project from template using cookiecutter
9
+
10
+ ```bash
11
+ cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
12
+ ```
13
+
14
+ ## Examples
15
+
16
+ [Python Trainers](https://gitlab.com/python-trainers)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trainerbase"
3
- version = "4.9.0"
3
+ version = "4.9.2"
4
4
  description = "Framework for creating game trainers/mods"
5
5
  license = "MIT"
6
6
  requires-python = ">=3.14"
@@ -10,7 +10,7 @@ dependencies = [
10
10
  "keyboard>=0.13.5",
11
11
  "mouse>=0.7.1",
12
12
  "psutil>=7.2.2",
13
- "pydantic>=2.14.0",
13
+ "pydantic>=2.14.1",
14
14
  "pymem>=1.14.0",
15
15
  "pyttsx3>=2.99",
16
16
  "trainerbase-injector>=1.0.1",
@@ -32,6 +32,21 @@ email = "doomaykaka@gmail.com"
32
32
  Homepage = "https://gitlab.com/python-trainers/"
33
33
  Repository = "https://gitlab.com/python-trainers/trainer-base"
34
34
 
35
+ [[tool.poe.tasks.lint]]
36
+ cmd = "ruff format ."
37
+
38
+ [[tool.poe.tasks.lint]]
39
+ cmd = "ruff check --fix ."
40
+
41
+ [[tool.poe.tasks.lint]]
42
+ cmd = "basedpyright"
43
+
44
+ [[tool.poe.tasks.build]]
45
+ script = "poethepoet.scripts:rm('dist')"
46
+
47
+ [[tool.poe.tasks.build]]
48
+ cmd = "uv build"
49
+
35
50
  [tool.ruff]
36
51
  src = ["trainerbase"]
37
52
  line-length = 120
@@ -66,27 +81,23 @@ lines-after-imports = 2
66
81
  [tool.ruff.format]
67
82
  line-ending = "lf"
68
83
 
69
- [tool.pyright]
84
+ [tool.basedpyright]
70
85
  include = ["trainerbase"]
71
86
  typeCheckingMode = "standard"
72
87
  pythonPlatform = "All"
73
88
  pythonVersion = "3.14"
74
89
 
75
- [[tool.pyright.executionEnvironments]]
76
- root = "."
77
- extraPaths = ["src"]
78
-
79
90
  [tool.uv.build-backend]
80
91
  module-name = "trainerbase"
81
92
  module-root = ""
82
93
 
83
94
  [build-system]
84
- requires = ["uv_build>=0.11.3,<1.0.0"]
95
+ requires = ["uv_build>=0.13.6,<1.0.0"]
85
96
  build-backend = "uv_build"
86
97
 
87
98
  [dependency-groups]
88
99
  dev = [
89
- "invoke>=3.0.3",
90
- "pyright>=1.1.414",
91
- "ruff>=0.17.0",
100
+ "basedpyright>=1.40.2",
101
+ "poethepoet>=0.49.0",
102
+ "ruff>=0.17.3",
92
103
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trainerbase"
3
- version = "4.9.0"
3
+ version = "4.9.2"
4
4
  description = "Framework for creating game trainers/mods"
5
5
  license = "MIT"
6
6
  authors = [
@@ -14,7 +14,7 @@ dependencies = [
14
14
  "keyboard>=0.13.5",
15
15
  "mouse>=0.7.1",
16
16
  "psutil>=7.2.2",
17
- "pydantic>=2.14.0",
17
+ "pydantic>=2.14.1",
18
18
  "pymem>=1.14.0",
19
19
  "pyttsx3>=2.99",
20
20
  "trainerbase-injector>=1.0.1",
@@ -29,6 +29,14 @@ classifiers = [
29
29
  Homepage = "https://gitlab.com/python-trainers/"
30
30
  Repository = "https://gitlab.com/python-trainers/trainer-base"
31
31
 
32
+ [tool.poe.tasks]
33
+ lint = [
34
+ { cmd = "ruff format ." },
35
+ { cmd = "ruff check --fix ." },
36
+ { cmd = "basedpyright" },
37
+ ]
38
+ build = [{ script = "poethepoet.scripts:rm('dist')" }, { cmd = "uv build" }]
39
+
32
40
  [tool.ruff]
33
41
  src = ["trainerbase"]
34
42
  line-length = 120
@@ -63,26 +71,19 @@ lines-after-imports = 2
63
71
  [tool.ruff.format]
64
72
  line-ending = "lf"
65
73
 
66
- [tool.pyright]
74
+ [tool.basedpyright]
67
75
  include = ["trainerbase"]
68
76
  typeCheckingMode = "standard"
69
77
  pythonPlatform = "All"
70
78
  pythonVersion = "3.14"
71
- executionEnvironments = [
72
- { root = ".", extraPaths = ["src"] }
73
- ]
74
79
 
75
80
  [tool.uv.build-backend]
76
81
  module-name = "trainerbase"
77
82
  module-root = ""
78
83
 
79
84
  [build-system]
80
- requires = ["uv_build>=0.11.3,<1.0.0"]
85
+ requires = ["uv_build>=0.13.6,<1.0.0"]
81
86
  build-backend = "uv_build"
82
87
 
83
88
  [dependency-groups]
84
- dev = [
85
- "invoke>=3.0.3",
86
- "pyright>=1.1.414",
87
- "ruff>=0.17.0",
88
- ]
89
+ dev = ["basedpyright>=1.40.2", "poethepoet>=0.49.0", "ruff>=0.17.3"]
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Callable
2
- from time import time
2
+ from time import monotonic
3
3
  from typing import override
4
4
 
5
5
  from keyboard import add_hotkey, on_press_key, on_release_key
@@ -78,7 +78,7 @@ class ShortLongHotkeyPressSwitch(AbstractKeyboardHandler):
78
78
 
79
79
  def _on_press(self, _):
80
80
  if self._press_timestamp is None:
81
- self._press_timestamp = time()
81
+ self._press_timestamp = monotonic()
82
82
  self.on_press()
83
83
 
84
84
  def _on_release(self, _):
@@ -93,7 +93,7 @@ class ShortLongHotkeyPressSwitch(AbstractKeyboardHandler):
93
93
  if self._press_timestamp is None:
94
94
  return 0
95
95
 
96
- return time() - self._press_timestamp
96
+ return monotonic() - self._press_timestamp
97
97
 
98
98
  def _is_short_delta(self):
99
99
  return self._get_press_delta() <= self._short_press_max_delta
@@ -19,14 +19,8 @@ class Process(BaseModel):
19
19
  ignore_case: bool = False
20
20
 
21
21
 
22
- class SpeedhackConfig(BaseModel):
23
- offset_x64: int = 0x47098
24
- offset_x32: int = 0x40058
25
-
26
-
27
22
  class Vendor(BaseModel):
28
23
  extra_search_paths: list[Path] | None = None
29
- speedhack: SpeedhackConfig = SpeedhackConfig()
30
24
 
31
25
  @property
32
26
  def folder(self) -> Path:
@@ -37,6 +37,7 @@ def simple_trainerbase_menu(
37
37
  height=height,
38
38
  resizable=False,
39
39
  small_icon=ICON_PATH,
40
+ large_icon=ICON_PATH,
40
41
  )
41
42
  dpg.setup_dearpygui()
42
43
 
@@ -1,4 +1,3 @@
1
- from traceback import print_exc
2
1
  from typing import override
3
2
  from uuid import uuid4
4
3
 
@@ -8,6 +7,7 @@ from pymem.exception import MemoryReadError, MemoryWriteError
8
7
 
9
8
  from trainerbase.codeinjection import AbstractCodeInjection
10
9
  from trainerbase.gui.types import AbstractUIComponent
10
+ from trainerbase.logger import logger
11
11
  from trainerbase.tts import say
12
12
 
13
13
 
@@ -44,7 +44,7 @@ class CodeInjectionUI(AbstractUIComponent):
44
44
  change_codeinjection_state()
45
45
  except MemoryReadError, MemoryWriteError, ValueError:
46
46
  dpg.set_value(self.dpg_tag, not dpg.get_value(self.dpg_tag))
47
- print_exc()
47
+ logger.exception("Failed to change code injection state: %s", self.pure_label)
48
48
 
49
49
  def on_hotkey_press(self):
50
50
  dpg.set_value(self.dpg_tag, not dpg.get_value(self.dpg_tag))
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Callable
2
2
  from os import _exit as force_exit
3
- from traceback import print_exc
3
+ from signal import SIG_IGN, SIGBREAK, SIGINT, SIGTERM, default_int_handler, signal
4
4
  from typing import NoReturn
5
5
 
6
6
  from trainerbase.codeinjection import safely_eject_all_code_injections
@@ -28,6 +28,11 @@ def run(
28
28
  on_shutdown_hook: Callback | None = None,
29
29
  ) -> NoReturn:
30
30
  def on_shutdown() -> NoReturn:
31
+ # Poe repeats console signals while waiting for cleanup to finish.
32
+ signal(SIGINT, SIG_IGN)
33
+ signal(SIGTERM, SIG_IGN)
34
+ signal(SIGBREAK, SIG_IGN)
35
+
31
36
  logger.info("Shutting down...")
32
37
 
33
38
  logger.debug("Ejecting Code Injections.")
@@ -60,10 +65,12 @@ def run(
60
65
  try:
61
66
  on_gui_initialized_hook()
62
67
  except Exception:
63
- logger.error("Exception occurred while calling on_gui_initialized_hook. See stderr.")
64
- print_exc()
68
+ logger.exception("Exception occurred while calling on_gui_initialized_hook.")
65
69
  on_shutdown()
66
70
 
71
+ signal(SIGTERM, default_int_handler)
72
+ signal(SIGBREAK, default_int_handler)
73
+
67
74
  logger.info("Starting...")
68
75
  logger.debug("Registering core scripts")
69
76
  system_script_engine.simple_script(update_frozen_objects, enabled=True)
@@ -77,8 +84,8 @@ def run(
77
84
  try:
78
85
  run_gui(on_gui_initialized, on_shutdown)
79
86
  except Exception:
80
- print_exc()
87
+ logger.exception("Exception occurred while running GUI.")
81
88
  except KeyboardInterrupt:
82
- logger.info("KeyboardInterrupt (Ctrl+C)")
89
+ logger.info("Shutdown requested (KeyboardInterrupt)")
83
90
 
84
91
  on_shutdown()
@@ -7,15 +7,13 @@ from trainerbase_injector import inject
7
7
 
8
8
  from trainerbase.config import config
9
9
  from trainerbase.gameobject import GameDouble
10
- from trainerbase.memory import ARCH, get_module_address
10
+ from trainerbase.memory import ARCH, AOBScan
11
11
  from trainerbase.process import pm
12
12
 
13
13
 
14
14
  SPEEDHACK_DLL_MODULE_NAME: Final[str] = f"speedhack{ARCH}.dll"
15
15
  SPEEDHACK_DLL_PATH: Final[Path] = config.vendor.folder / SPEEDHACK_DLL_MODULE_NAME
16
- SPEED_MODIFIER_OFFSET: Final[int] = (
17
- config.vendor.speedhack.offset_x32 if ARCH == 32 else config.vendor.speedhack.offset_x64
18
- )
16
+ SPEED_MODIFIER_ANCHOR: Final[bytes] = b"trainerbase__speedhackrs__anchor"
19
17
 
20
18
 
21
19
  class SpeedHack:
@@ -28,14 +26,19 @@ class SpeedHack:
28
26
  return cls._instance
29
27
 
30
28
  def __init__(self):
31
- self._dll_injection_address = self._inject()
32
- self._speed_modifier = GameDouble(self._dll_injection_address + SPEED_MODIFIER_OFFSET)
29
+ self._inject()
30
+ self._speed_modifier = GameDouble(
31
+ AOBScan(
32
+ SPEED_MODIFIER_ANCHOR,
33
+ add=len(SPEED_MODIFIER_ANCHOR),
34
+ module_name=SPEEDHACK_DLL_MODULE_NAME,
35
+ ),
36
+ )
33
37
 
34
38
  self.factor = 1.0
35
39
 
36
- def _inject(self) -> int:
40
+ def _inject(self):
37
41
  inject(cast(int, pm.process_id), str(SPEEDHACK_DLL_PATH))
38
- return get_module_address(SPEEDHACK_DLL_MODULE_NAME)
39
42
 
40
43
  @property
41
44
  def factor(self):