trainerbase 2.12.5__tar.gz → 2.13.1__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 (23) hide show
  1. {trainerbase-2.12.5 → trainerbase-2.13.1}/PKG-INFO +1 -1
  2. {trainerbase-2.12.5 → trainerbase-2.13.1}/pyproject.toml +5 -1
  3. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/codeinjection.py +3 -2
  4. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/common.py +3 -3
  5. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/gui.py +31 -8
  6. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/gui.py +4 -4
  7. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/scripts.py +0 -1
  8. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/tts.py +1 -0
  9. {trainerbase-2.12.5 → trainerbase-2.13.1}/LICENSE +0 -0
  10. {trainerbase-2.12.5 → trainerbase-2.13.1}/README.md +0 -0
  11. {trainerbase-2.12.5 → trainerbase-2.13.1}/fasm/FASM.EXE +0 -0
  12. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/__init__.py +0 -0
  13. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/config.py +1 -1
  14. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/gameobject.py +1 -1
  15. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/memory.py +0 -0
  16. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/scriptengine.py +0 -0
  17. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/__init__.py +0 -0
  18. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/injections.py +0 -0
  19. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/main.py +0 -0
  20. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/memory.py +0 -0
  21. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/src/objects.py +0 -0
  22. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/template/trainerbase.toml +0 -0
  23. {trainerbase-2.12.5 → trainerbase-2.13.1}/trainerbase/use_trainer_template.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TrainerBase
3
- Version: 2.12.5
3
+ Version: 2.13.1
4
4
  Summary: Framework for creating game trainers/mods
5
5
  Home-page: https://gitlab.com/python-trainers/trainer-base
6
6
  Author-Email: v01d <v01d@v01d.ru>, doomayka <zd@doomayka.ru>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "TrainerBase"
3
- version = "2.12.5"
3
+ version = "2.13.1"
4
4
  description = "Framework for creating game trainers/mods"
5
5
  authors = [
6
6
  { name = "v01d", email = "v01d@v01d.ru" },
@@ -33,6 +33,10 @@ target-version = [
33
33
  ]
34
34
  line-length = 120
35
35
 
36
+ [tool.isort]
37
+ lines_after_imports = 2
38
+ skip = "trainerbase/template/"
39
+
36
40
  [tool.pdm.build]
37
41
  includes = [
38
42
  "fasm/",
@@ -1,10 +1,11 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from pathlib import Path
3
- from subprocess import run as run_executable, DEVNULL
3
+ from subprocess import DEVNULL
4
+ from subprocess import run as run_executable
4
5
  from tempfile import TemporaryDirectory
5
6
  from uuid import uuid4
6
7
 
7
- from trainerbase.memory import ARCH, Address, pm, make_address
8
+ from trainerbase.memory import ARCH, Address, make_address, pm
8
9
 
9
10
 
10
11
  FASM_EXECUTABLE_PATH = Path(__file__).resolve().parent.parent / "fasm" / "FASM.EXE"
@@ -1,10 +1,10 @@
1
- from operator import mul, add
2
- from itertools import starmap, repeat
1
+ from itertools import repeat, starmap
3
2
  from math import sqrt
3
+ from operator import add, mul
4
4
 
5
5
  from pymem.exception import MemoryReadError
6
6
 
7
- from trainerbase.gameobject import GameInt, GameFloat
7
+ from trainerbase.gameobject import GameFloat, GameInt
8
8
  from trainerbase.scriptengine import Script
9
9
 
10
10
 
@@ -1,12 +1,26 @@
1
1
  from collections.abc import Callable
2
+ from functools import partial
3
+ from typing import Any
2
4
 
3
5
  from dearpygui import dearpygui as dpg
4
6
  from keyboard import add_hotkey
5
7
 
6
- from trainerbase.scriptengine import Script
7
- from trainerbase.gameobject import GameObject
8
8
  from trainerbase.codeinjection import AbstractCodeInjection
9
9
  from trainerbase.common import Teleport
10
+ from trainerbase.gameobject import (
11
+ GameBool,
12
+ GameByte,
13
+ GameDouble,
14
+ GameFloat,
15
+ GameInt,
16
+ GameLongLong,
17
+ GameObject,
18
+ GameShort,
19
+ GameUnsignedInt,
20
+ GameUnsignedLongLong,
21
+ GameUnsignedShort,
22
+ )
23
+ from trainerbase.scriptengine import Script
10
24
  from trainerbase.tts import say
11
25
 
12
26
 
@@ -76,6 +90,7 @@ def add_gameobject_to_gui(
76
90
  gameobject: GameObject,
77
91
  label: str,
78
92
  hotkey: str = None,
93
+ default_setter_input_value: Any = 0,
79
94
  before_set: Callable = int,
80
95
  tts_on_hotkey: bool = True,
81
96
  ):
@@ -83,11 +98,7 @@ def add_gameobject_to_gui(
83
98
  gameobject.frozen = gameobject.value if dpg.get_value(gameobject.dpg_tag_frozen) else None
84
99
 
85
100
  def on_value_set():
86
- raw_new_value = dpg.get_value(gameobject.dpg_tag_setter)
87
- if not raw_new_value:
88
- return
89
-
90
- new_value = before_set(raw_new_value)
101
+ new_value = before_set(dpg.get_value(gameobject.dpg_tag_setter))
91
102
 
92
103
  if gameobject.frozen is None:
93
104
  gameobject.value = new_value
@@ -108,11 +119,23 @@ def add_gameobject_to_gui(
108
119
 
109
120
  label = f"[{hotkey}] {label}"
110
121
 
122
+ match gameobject:
123
+ case GameFloat():
124
+ add_setter_input = dpg.add_input_float
125
+ case GameDouble():
126
+ add_setter_input = dpg.add_input_double
127
+ case GameByte() | GameShort() | GameInt() | GameLongLong() | GameBool():
128
+ add_setter_input = dpg.add_input_int
129
+ case GameUnsignedShort() | GameUnsignedInt() | GameUnsignedLongLong():
130
+ add_setter_input = partial(dpg.add_input_int, min_clamped=True, min_value=0)
131
+ case _:
132
+ add_setter_input = dpg.add_input_text
133
+
111
134
  with dpg.group(horizontal=True):
112
135
  dpg.add_checkbox(tag=gameobject.dpg_tag_frozen, callback=on_frozen_state_change)
113
136
  dpg.add_text(label)
114
137
  dpg.add_input_text(width=220, tag=gameobject.dpg_tag_getter, readonly=True)
115
- dpg.add_input_text(width=220, tag=gameobject.dpg_tag_setter, hint="Set value here")
138
+ add_setter_input(width=220, tag=gameobject.dpg_tag_setter, default_value=default_setter_input_value)
116
139
  dpg.add_button(label="Set", callback=on_value_set)
117
140
 
118
141
 
@@ -1,4 +1,4 @@
1
- import dearpygui.dearpygui as dpg
1
+ from dearpygui import dearpygui as dpg
2
2
  from trainerbase.gui import add_script_to_gui, add_gameobject_to_gui, add_codeinjection_to_gui, simple_trainerbase_menu
3
3
 
4
4
  from scripts import *
@@ -11,13 +11,13 @@ def run_menu():
11
11
  with dpg.tab_bar():
12
12
  # (!) Example:
13
13
  #
14
- # with dpg.tab(label="Scripts", tag="scripts"):
14
+ # with dpg.tab(label="Scripts"):
15
15
  # add_script_to_gui(script, "Readable Name")
16
16
  #
17
- # with dpg.tab(label="Objects", tag="objects"):
17
+ # with dpg.tab(label="Objects"):
18
18
  # add_gameobject_to_gui(game_object, "Readable Name")
19
19
  #
20
- # with dpg.tab(label="Code Injections", tag="code_injections"):
20
+ # with dpg.tab(label="Code Injections"):
21
21
  # add_codeinjection_to_gui(injection, "Injection Name")
22
22
 
23
23
  ...
@@ -1,4 +1,3 @@
1
- from trainerbase.gameobject import GameObject
2
1
  from trainerbase.scriptengine import ScriptEngine, system_script_engine
3
2
 
4
3
 
@@ -1,4 +1,5 @@
1
1
  from threading import Thread
2
+
2
3
  from pyttsx3 import init as init_tts_engine
3
4
 
4
5
 
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- from tomllib import load as load_toml
2
1
  from pathlib import Path
2
+ from tomllib import load as load_toml
3
3
 
4
4
 
5
5
  with Path("./trainerbase.toml").resolve().open("rb") as trainerbase_toml:
@@ -1,6 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
- from uuid import uuid4
3
2
  from typing import Self
3
+ from uuid import uuid4
4
4
 
5
5
  from trainerbase.memory import Address, make_address, pm
6
6