Add not enough gold screenshot logging and new MISSING_GOLD template

- src/inventory/vendor.py: Log screenshots when NotEnoughGold detected
  during gambling, purchasing, and repairing
- src/ui_manager.py: Update NotEnoughGold to use new MISSING_GOLD template
  from assets/npc/missing_gold/ (full dialog match instead of color-based)
- assets/npc/missing_gold/missing_gold.png: New template for the popup
This commit is contained in:
alex
2026-06-01 11:21:53 +02:00
parent 30bf163ee3
commit 2cd683ac7b
4 changed files with 9 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -8,7 +8,7 @@
; bnet_pass=${BOTTY_BNET_PASS}
; char_name=${BOTTY_CHAR_NAME}
; difficulty: game difficulty to create ("normal", "nightmare", "hell")
difficulty=nightmare
difficulty=hell
; name: bot profile name used in logs/messages and mod launch option replacement
name=fistman
; randomize_runs: 0 = run in listed order, 1 = shuffle run order

View File

@@ -9,6 +9,8 @@ from logger import Logger
from input_layer import mouse
from ui_manager import center_mouse, is_visible, select_screen_object_match, wait_until_visible, ScreenObjects
from inventory import personal, common, stash
from utils.log_rotation import safe_imwrite
import time
gamble_count = 0
gamble_status = False
@@ -44,6 +46,7 @@ def repair() -> bool:
select_screen_object_match(repair_btn)
if wait_until_visible(ScreenObjects.NotEnoughGold, 1).valid:
Logger.warning("Couldn't repair--out of gold. Continue.")
safe_imwrite(f"./log/screenshots/info/info_not_enough_gold_repair_{time.strftime('%Y%m%d_%H%M%S')}.png", grab())
keyboard.send("esc")
return False
return True
@@ -70,6 +73,7 @@ def gamble():
# make sure the "not enough gold" message doesn't exist
if is_visible(ScreenObjects.NotEnoughGold, img):
Logger.warning(f"Out of gold, stop gambling")
safe_imwrite(f"./log/screenshots/info/info_not_enough_gold_gambling_{time.strftime('%Y%m%d_%H%M%S')}.png", img)
keyboard.send("esc")
set_gamble_status(False)
break
@@ -118,6 +122,7 @@ def buy_item(template_name: str, quantity: int = 1, img: np.ndarray = None, shif
wait(0.4, 0.6)
if is_visible(ScreenObjects.NotEnoughGold):
Logger.warning(f"Out of gold, could not purchase {template_name}")
safe_imwrite(f"./log/screenshots/info/info_not_enough_gold_purchase_{time.strftime('%Y%m%d_%H%M%S')}.png", grab())
keyboard.send('shift', do_release=True)
keyboard.send("esc")
return False
@@ -131,6 +136,7 @@ def buy_item(template_name: str, quantity: int = 1, img: np.ndarray = None, shif
wait(0.9, 1.1)
if is_visible(ScreenObjects.NotEnoughGold):
Logger.warning(f"Out of gold, could not purchase {template_name}")
safe_imwrite(f"./log/screenshots/info/info_not_enough_gold_purchase_{time.strftime('%Y%m%d_%H%M%S')}.png", grab())
keyboard.send("esc")
return False
personal.set_inventory_gold_full(False)

View File

@@ -251,10 +251,8 @@ class ScreenObjects:
threshold=0.8,
)
NotEnoughGold=ScreenObject(
ref="NOT_ENOUGH_GOLD",
threshold=0.9,
color_match=Config().colors["red"],
use_grayscale=True
ref="MISSING_GOLD",
threshold=0.8,
)
QuestSkillBtn=ScreenObject(
ref="QUEST_SKILL_BTN",