trainerbase 3.2.0__tar.gz → 3.3.0__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.
- {trainerbase-3.2.0 → trainerbase-3.3.0}/PKG-INFO +1 -1
- {trainerbase-3.2.0 → trainerbase-3.3.0}/pyproject.toml +1 -1
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/gui.py +41 -13
- {trainerbase-3.2.0 → trainerbase-3.3.0}/LICENSE +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/README.rst +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/__init__.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/codeinjection.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/common.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/config.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/gameobject.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/main.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/memory.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/scriptengine.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/speedhack.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase/tts.py +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase_vendor/FASM.EXE +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase_vendor/speedhack32.dll +0 -0
- {trainerbase-3.2.0 → trainerbase-3.3.0}/trainerbase_vendor/speedhack64.dll +0 -0
|
@@ -28,10 +28,6 @@ from trainerbase.speedhack import SpeedHack
|
|
|
28
28
|
from trainerbase.tts import say
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
TAG_TELEPORT_LABELS = "__teleport_labels"
|
|
32
|
-
TAG_SPEEDHACK_FACTOR_INPUT = "tag_speedhack_factor_input"
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
class AbstractUIComponent(ABC):
|
|
36
32
|
@abstractmethod
|
|
37
33
|
def add_to_ui(self) -> None:
|
|
@@ -211,12 +207,14 @@ class GameObjectUI(AbstractUIComponent):
|
|
|
211
207
|
|
|
212
208
|
|
|
213
209
|
class TeleportUI(AbstractUIComponent):
|
|
210
|
+
DPG_TAG_TELEPORT_LABELS = "__teleport_labels"
|
|
211
|
+
|
|
214
212
|
def __init__(
|
|
215
213
|
self,
|
|
216
214
|
tp: Teleport,
|
|
217
|
-
hotkey_save_position: str | None =
|
|
218
|
-
hotkey_set_saved_position: str | None =
|
|
219
|
-
hotkey_dash: str | None =
|
|
215
|
+
hotkey_save_position: str | None = "Insert",
|
|
216
|
+
hotkey_set_saved_position: str | None = "Home",
|
|
217
|
+
hotkey_dash: str | None = "End",
|
|
220
218
|
tts_on_hotkey: bool = True,
|
|
221
219
|
):
|
|
222
220
|
self.tp = tp
|
|
@@ -261,7 +259,7 @@ class TeleportUI(AbstractUIComponent):
|
|
|
261
259
|
say("Dash!")
|
|
262
260
|
|
|
263
261
|
def on_goto_label(self):
|
|
264
|
-
self.tp.goto(dpg.get_value(
|
|
262
|
+
self.tp.goto(dpg.get_value(self.DPG_TAG_TELEPORT_LABELS))
|
|
265
263
|
|
|
266
264
|
def _tp_add_save_set_position_hotkeys_if_needed(self):
|
|
267
265
|
if self.hotkey_save_position is None or self.hotkey_set_saved_position is None:
|
|
@@ -289,14 +287,20 @@ class TeleportUI(AbstractUIComponent):
|
|
|
289
287
|
|
|
290
288
|
with dpg.group(horizontal=True):
|
|
291
289
|
dpg.add_button(label="Go To", callback=self.on_goto_label)
|
|
292
|
-
dpg.add_combo(label="Labels", tag=
|
|
290
|
+
dpg.add_combo(label="Labels", tag=self.DPG_TAG_TELEPORT_LABELS, items=labels, default_value=labels[0])
|
|
293
291
|
|
|
294
292
|
|
|
295
293
|
class SpeedHackUI(AbstractUIComponent):
|
|
296
|
-
|
|
294
|
+
DPG_TAG_SPEEDHACK_FACTOR_INPUT = "tag_speedhack_factor_input"
|
|
295
|
+
DPG_TAG_SPEEDHACK_PRESET_INPUT = "tag_speedhack_preset_input"
|
|
296
|
+
|
|
297
|
+
PRESETS: tuple[float, ...] = (0.1, 0.2, 0.3, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0, 20.0, 50.0)
|
|
298
|
+
|
|
299
|
+
def __init__(self, speedhack: SpeedHack, key: str = "Delete", default_factor_input_value: float = 3.0):
|
|
297
300
|
self.speedhack = speedhack
|
|
298
301
|
self.key = key
|
|
299
|
-
self.
|
|
302
|
+
self.default_factor_input_value = default_factor_input_value
|
|
303
|
+
self.switch = ShortLongPressSwitch(SpeedHackUISwitch(speedhack, self.DPG_TAG_SPEEDHACK_FACTOR_INPUT), key)
|
|
300
304
|
|
|
301
305
|
@override
|
|
302
306
|
def add_to_ui(self) -> None:
|
|
@@ -304,17 +308,41 @@ class SpeedHackUI(AbstractUIComponent):
|
|
|
304
308
|
dpg.add_text(f"Press [{self.key}] Toggle SpeedHack")
|
|
305
309
|
|
|
306
310
|
dpg.add_input_double(
|
|
307
|
-
tag=
|
|
311
|
+
tag=self.DPG_TAG_SPEEDHACK_FACTOR_INPUT,
|
|
308
312
|
label="SpeedHack Factor",
|
|
309
313
|
min_value=0.0,
|
|
310
314
|
max_value=100.0,
|
|
311
|
-
default_value=
|
|
315
|
+
default_value=self.default_factor_input_value,
|
|
312
316
|
min_clamped=True,
|
|
313
317
|
max_clamped=True,
|
|
318
|
+
callback=self.on_factor_change,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
dpg.add_slider_int(
|
|
322
|
+
tag=self.DPG_TAG_SPEEDHACK_PRESET_INPUT,
|
|
323
|
+
label="Preset",
|
|
324
|
+
min_value=0,
|
|
325
|
+
max_value=len(self.PRESETS) - 1,
|
|
326
|
+
clamped=True,
|
|
327
|
+
default_value=self.get_closest_preset_index(self.default_factor_input_value),
|
|
328
|
+
callback=self.on_preset_change,
|
|
314
329
|
)
|
|
315
330
|
|
|
316
331
|
self.switch.handle()
|
|
317
332
|
|
|
333
|
+
def on_preset_change(self):
|
|
334
|
+
new_factor = self.PRESETS[dpg.get_value(self.DPG_TAG_SPEEDHACK_PRESET_INPUT)]
|
|
335
|
+
dpg.set_value(self.DPG_TAG_SPEEDHACK_FACTOR_INPUT, new_factor)
|
|
336
|
+
|
|
337
|
+
def on_factor_change(self):
|
|
338
|
+
new_factor = dpg.get_value(self.DPG_TAG_SPEEDHACK_FACTOR_INPUT)
|
|
339
|
+
closest_preset_index = self.get_closest_preset_index(new_factor)
|
|
340
|
+
dpg.set_value(self.DPG_TAG_SPEEDHACK_PRESET_INPUT, closest_preset_index)
|
|
341
|
+
|
|
342
|
+
def get_closest_preset_index(self, factor: float) -> int:
|
|
343
|
+
closest_preset = min(self.PRESETS, key=lambda preset: abs(preset - factor))
|
|
344
|
+
return self.PRESETS.index(closest_preset)
|
|
345
|
+
|
|
318
346
|
|
|
319
347
|
class SpeedHackUISwitch(Switchable):
|
|
320
348
|
def __init__(self, speedhack: SpeedHack, dpg_tag: str):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|