@@ -3241,6 +3241,43 @@ def execute_action(
32413241 f"'{ handler_name } ' but method not found"
32423242 )
32433243
3244+ # NEW: Also check UIButtons (legacy system still used by most roles)
3245+ # UIButtons don't have explicit handlers, so route to on_nacht_aktion
3246+ for button in ui_def .buttons :
3247+ btn_action_type = button .action_type
3248+ if (btn_action_type == action_type or
3249+ btn_action_type == normalized_action or
3250+ btn_action_type == original_action ):
3251+ # Found matching button - route to on_nacht_aktion with the action
3252+ ziel = targets [0 ] if len (targets ) == 1 else None
3253+ try :
3254+ result = self .on_nacht_aktion (spieler , ziel , kontext , aktion = normalized_action )
3255+ if result is None :
3256+ # Role didn't handle it, but button exists - create success
3257+ return AktionsErgebnis (
3258+ erfolg = True ,
3259+ nachricht = "Aktion ausgeführt." ,
3260+ effekte = {"aktion_ausgefuehrt" : True },
3261+ )
3262+ return result
3263+ except TypeError :
3264+ # Handler might not accept aktion kwarg
3265+ try :
3266+ result = self .on_nacht_aktion (spieler , ziel , kontext )
3267+ if result is None :
3268+ return AktionsErgebnis (
3269+ erfolg = True ,
3270+ nachricht = "Aktion ausgeführt." ,
3271+ effekte = {"aktion_ausgefuehrt" : True },
3272+ )
3273+ return result
3274+ except Exception as e :
3275+ logger .error (f"on_nacht_aktion failed for button { btn_action_type } : { e } " )
3276+ return AktionsErgebnis (
3277+ erfolg = False ,
3278+ nachricht = f"Fehler bei Aktion: { str (e )} " ,
3279+ )
3280+
32443281 # LEGACY: route to on_nacht_aktion for backwards compatibility
32453282 import inspect
32463283
0 commit comments