feat(build,blackjack,docs): add cross-platform single-file build scripts, full Blackjack showdown reveal & updated READMEs
This commit is contained in:
parent
c08e2e17fd
commit
5929831402
|
|
@ -1,87 +1,122 @@
|
||||||
@echo off
|
@echo off
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
REM =============================================================================
|
REM =============================================================================
|
||||||
REM The Goth Cardgame Collection - One-File Build Script (Windows)
|
REM The Goth Cardgame Collection - One-File Build Script (Windows + WSL)
|
||||||
REM Output: dist\windows\TheGothCardgameCollection.exe
|
REM Output: dist\windows\TheGothCardgameCollection.exe
|
||||||
REM Usage: build_scripts\build.bat [--current | --all | --clean]
|
REM Usage: build_scripts\build.bat [--current | --all | --clean]
|
||||||
REM =============================================================================
|
REM =============================================================================
|
||||||
|
|
||||||
|
set "SCRIPT_FILE=%~f0"
|
||||||
cd /d "%~dp0.."
|
cd /d "%~dp0.."
|
||||||
set "PROJECT_ROOT=%CD%"
|
set "PROJECT_ROOT=%CD%"
|
||||||
set "APP_NAME=TheGothCardgameCollection"
|
set "APP_NAME=TheGothCardgameCollection"
|
||||||
|
set "MAIN_FILE=main.py"
|
||||||
|
set "RES_DIR=resources"
|
||||||
|
set "GAMES_DIR=games"
|
||||||
set "MODE=%~1"
|
set "MODE=%~1"
|
||||||
if "%MODE%"=="" set "MODE=--current"
|
if "%MODE%"=="" set "MODE=--current"
|
||||||
|
|
||||||
if /I "%MODE%"=="--clean" (
|
if /I "%MODE%"=="--clean" (
|
||||||
echo [CLEAN] Entferne temporaere Build-Ordner...
|
|
||||||
if exist "build" rmdir /s /q "build"
|
if exist "build" rmdir /s /q "build"
|
||||||
if exist ".venv_build_win" rmdir /s /q ".venv_build_win"
|
if exist ".venv_build_win" rmdir /s /q ".venv_build_win"
|
||||||
echo [OK] Aufgeraeumt ^(dist\ blieb erhalten^).
|
del /q "*.spec" 2>nul
|
||||||
|
echo [OK] Temporaere Build-Dateien bereinigt.
|
||||||
exit /b 0
|
exit /b 0
|
||||||
)
|
)
|
||||||
|
|
||||||
echo ============================================================
|
REM ----------------------------------------------------
|
||||||
echo Building %APP_NAME%.exe ^(Single-File^) -^> dist\windows\
|
REM 0. ADMIN-RECHTE PRUEFEN (net session)
|
||||||
echo ============================================================
|
REM ----------------------------------------------------
|
||||||
|
set "IS_ADMIN=0"
|
||||||
|
net session >nul 2>nul
|
||||||
|
if not errorlevel 1 set "IS_ADMIN=1"
|
||||||
|
|
||||||
set "PY_CMD="
|
REM Kaputte Altlast-Venvs vorab bereinigen
|
||||||
where python >nul 2>nul && (
|
if exist ".venv_build_win" (
|
||||||
python -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=python"
|
if not exist ".venv_build_win\Scripts\python.exe" rmdir /s /q ".venv_build_win"
|
||||||
)
|
|
||||||
if "%PY_CMD%"=="" (
|
|
||||||
where py >nul 2>nul && (
|
|
||||||
py -3 -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=py -3"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if "%PY_CMD%"=="" (
|
|
||||||
where python3 >nul 2>nul && (
|
|
||||||
python3 -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=python3"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%PY_CMD%"=="" (
|
REM Vorhandenes Python ermitteln
|
||||||
echo [ERROR] Keine funktionierende Python-3-Installation im PATH gefunden!
|
call :FIND_PYTHON
|
||||||
|
|
||||||
|
REM Pruefen, ob System-Installationen noetig sind (Python fehlt oder WSL-Distro fehlt bei --all)
|
||||||
|
set "NEEDS_ADMIN=0"
|
||||||
|
if "%WIN_PY%"=="" set "NEEDS_ADMIN=1"
|
||||||
|
|
||||||
|
set "WSL_DISTRO="
|
||||||
|
if /I "%MODE%"=="--all" (
|
||||||
|
call :FIND_WSL_DISTRO
|
||||||
|
if "!WSL_DISTRO!"=="" set "NEEDS_ADMIN=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Falls etwas auf Systemebene installiert werden muss und KEINE Admin-Rechte vorliegen -> UAC anfordern!
|
||||||
|
if "%NEEDS_ADMIN%"=="1" if "%IS_ADMIN%"=="0" (
|
||||||
|
if /I "%~2"=="--elevated" (
|
||||||
|
echo [ERROR] Administrator-Rechte wurden verweigert oder konnten nicht erlangt werden!
|
||||||
|
echo Bitte starte die Konsole / PowerShell explizit "Als Administrator".
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
)
|
||||||
|
echo [ADMIN] Fehlende Systemkomponenten erkannt ^(Python oder WSL^).
|
||||||
|
echo Fordere Administrator-Rechte ueber Windows-UAC an...
|
||||||
|
powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/k \"\"%SCRIPT_FILE%\" %MODE% --elevated\"' -Verb RunAs"
|
||||||
|
exit /b 0
|
||||||
|
)
|
||||||
|
|
||||||
|
echo ====================================================
|
||||||
|
echo Starte Build fuer %APP_NAME% ^(Modus: %MODE% ^| Admin: %IS_ADMIN%^)
|
||||||
|
echo ====================================================
|
||||||
|
|
||||||
|
REM Falls Python fehlte -> jetzt mit garantierten Admin-Rechten systemweit installieren
|
||||||
|
if "%WIN_PY%"=="" (
|
||||||
|
echo [BOOTSTRAP] Installiere Python 3.11 via winget ^(Administrator^)...
|
||||||
|
winget install -e --id Python.Python.3.11 --scope machine --accept-source-agreements --accept-package-agreements
|
||||||
|
for %%P in (
|
||||||
|
"%ProgramFiles%\Python311"
|
||||||
|
"%LocalAppData%\Programs\Python\Python311"
|
||||||
|
"C:\Python311"
|
||||||
|
) do (
|
||||||
|
if exist "%%~P\python.exe" set "PATH=%%~P;%%~P\Scripts;!PATH!"
|
||||||
|
)
|
||||||
|
call :FIND_PYTHON
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%WIN_PY%"=="" (
|
||||||
|
echo [ERROR] Python 3.11+ konnte nicht gefunden oder installiert werden!
|
||||||
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
set "VENV_DIR=%PROJECT_ROOT%\.venv_build_win"
|
REM ----------------------------------------------------
|
||||||
if not exist "%VENV_DIR%\Scripts\python.exe" (
|
REM TEIL 1: WINDOWS .EXE BAUEN
|
||||||
echo [1/3] Erstelle isolierte Build-Umgebung ^(.venv_build_win^)...
|
REM ----------------------------------------------------
|
||||||
%PY_CMD% -m venv "%VENV_DIR%"
|
echo.
|
||||||
if errorlevel 1 exit /b 1
|
echo ---^> [1] Baue Windows .exe mit %WIN_PY%...
|
||||||
|
|
||||||
|
REM Ohne Admin-Rechte & ausserhalb einer Venv installieren wir Pakete sauber mit --user
|
||||||
|
set "PIP_EXTRA="
|
||||||
|
if "%IS_ADMIN%"=="0" if "%USING_VENV%"=="0" set "PIP_EXTRA=--user"
|
||||||
|
|
||||||
|
%WIN_PY% -m pip install --upgrade pip
|
||||||
|
%WIN_PY% -m pip install %PIP_EXTRA% --upgrade pillow pygame pyinstaller
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo [ERROR] Konnte Python-Pakete ^(PyInstaller/Pillow/Pygame^) nicht installieren!
|
||||||
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
set "VENV_PY=%VENV_DIR%\Scripts\python.exe"
|
|
||||||
|
|
||||||
echo [2/3] Pruefe ^& aktualisiere Build-Abhaengigkeiten ^(PyInstaller, Pillow, Pygame^)...
|
|
||||||
"%VENV_PY%" -m pip install --upgrade --quiet pip
|
|
||||||
"%VENV_PY%" -m pip install --quiet pyinstaller pillow pygame
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
|
|
||||||
set "DIST_DIR=%PROJECT_ROOT%\dist\windows"
|
|
||||||
set "WORK_DIR=%PROJECT_ROOT%\build\windows"
|
|
||||||
if not exist "%DIST_DIR%" mkdir "%DIST_DIR%"
|
|
||||||
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
|
|
||||||
|
|
||||||
set "ICON_ARG="
|
set "ICON_ARG="
|
||||||
if exist "%PROJECT_ROOT%\resources\images\game_icon.ico" (
|
if exist "resources\images\game_icon.ico" set "ICON_ARG=--icon resources\images\game_icon.ico"
|
||||||
set "ICON_ARG=--icon %PROJECT_ROOT%\resources\images\game_icon.ico"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo [3/3] Kompiliere kompakte Einzeldatei mit absoluten Ressourcen-Pfaden...
|
%WIN_PY% -m PyInstaller ^
|
||||||
"%VENV_PY%" -m PyInstaller ^
|
|
||||||
--noconfirm ^
|
--noconfirm ^
|
||||||
--clean ^
|
--noconsole ^
|
||||||
--onefile ^
|
--onefile ^
|
||||||
--windowed ^
|
--clean ^
|
||||||
--name "%APP_NAME%" ^
|
--distpath "dist\windows" ^
|
||||||
--distpath "%DIST_DIR%" ^
|
--workpath "build\windows" ^
|
||||||
--workpath "%WORK_DIR%" ^
|
--specpath "build\windows" ^
|
||||||
--specpath "%WORK_DIR%" ^
|
|
||||||
%ICON_ARG% ^
|
%ICON_ARG% ^
|
||||||
--add-data "%PROJECT_ROOT%\resources;resources" ^
|
--add-data "%RES_DIR%;%RES_DIR%" ^
|
||||||
--add-data "%PROJECT_ROOT%\games;games" ^
|
--add-data "%GAMES_DIR%;%GAMES_DIR%" ^
|
||||||
--collect-submodules games ^
|
--collect-submodules games ^
|
||||||
--collect-submodules controller ^
|
--collect-submodules controller ^
|
||||||
--collect-submodules models ^
|
--collect-submodules models ^
|
||||||
|
|
@ -92,35 +127,95 @@ echo [3/3] Kompiliere kompakte Einzeldatei mit absoluten Ressourcen-Pfaden...
|
||||||
--hidden-import tkinter.font ^
|
--hidden-import tkinter.font ^
|
||||||
--hidden-import sqlite3 ^
|
--hidden-import sqlite3 ^
|
||||||
--hidden-import PIL._tkinter_finder ^
|
--hidden-import PIL._tkinter_finder ^
|
||||||
--exclude-module matplotlib ^
|
--name "%APP_NAME%" ^
|
||||||
--exclude-module numpy ^
|
"%MAIN_FILE%"
|
||||||
--exclude-module scipy ^
|
|
||||||
--exclude-module pandas ^
|
|
||||||
--exclude-module pytest ^
|
|
||||||
--exclude-module unittest ^
|
|
||||||
--exclude-module pydoc ^
|
|
||||||
"%PROJECT_ROOT%\main.py"
|
|
||||||
|
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo [ERROR] PyInstaller-Build fehlgeschlagen!
|
echo [ERROR] Windows-Build fehlgeschlagen!
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
if exist "build\windows" rmdir /s /q "build\windows"
|
||||||
|
echo [OK] Windows-Build fertig: dist\windows\%APP_NAME%.exe
|
||||||
|
|
||||||
if exist "%WORK_DIR%" rmdir /s /q "%WORK_DIR%"
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo [DONE] Fertige ausfuehrbare Datei liegt bereit unter:
|
|
||||||
echo dist\windows\%APP_NAME%.exe
|
|
||||||
|
|
||||||
|
REM ----------------------------------------------------
|
||||||
|
REM TEIL 2: LINUX EXECUTABLE VIA WSL (nur bei --all)
|
||||||
|
REM ----------------------------------------------------
|
||||||
if /I "%MODE%"=="--all" (
|
if /I "%MODE%"=="--all" (
|
||||||
where wsl >nul 2>nul
|
echo.
|
||||||
if not errorlevel 1 (
|
echo ---^> [2] Baue Linux Executable ^(via WSL^)...
|
||||||
echo [WSL] Starte Linux-Build -^> dist/linux/%APP_NAME% ...
|
call :FIND_WSL_DISTRO
|
||||||
wsl bash ./build_scripts/build.sh --current
|
|
||||||
) else (
|
if "!WSL_DISTRO!"=="" (
|
||||||
echo [SKIP] WSL nicht verfuegbar - ueberspringe Linux-Build.
|
echo [BOOTSTRAP] Keine Linux-Distribution in WSL gefunden. Installiere Ubuntu ^(als Administrator^)...
|
||||||
|
wsl.exe --install -d Ubuntu --no-launch
|
||||||
|
call :FIND_WSL_DISTRO
|
||||||
|
if "!WSL_DISTRO!"=="" (
|
||||||
|
echo [HINWEIS] WSL/Ubuntu wurde vorbereitet. Windows erfordert einmalig einen System-Neustart,
|
||||||
|
echo bevor Linux-Builds in WSL ausgefuehrt werden koennen!
|
||||||
|
goto :SUMMARY
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [WSL] Nutze Distribution: !WSL_DISTRO! ^(als root fuer Paket-Rechte^)
|
||||||
|
set "WSL_PROJ_PATH="
|
||||||
|
for /f "usebackq delims=" %%P in (`wsl.exe -d "!WSL_DISTRO!" -u root -- wslpath -a "%PROJECT_ROOT%" 2^>nul`) do (
|
||||||
|
set "WSL_PROJ_PATH=%%P"
|
||||||
|
)
|
||||||
|
|
||||||
|
if "!WSL_PROJ_PATH!"=="" (
|
||||||
|
echo [ERROR] Konnte Projektpfad "%PROJECT_ROOT%" in WSL nicht aufloesen.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Fuehrt build.sh in WSL direkt als root (-u root) aus -> keine Passwort-Abfrage & volle apt-Rechte!
|
||||||
|
wsl.exe -d "!WSL_DISTRO!" -u root -- bash -lc "cd '!WSL_PROJ_PATH!' && sed -i 's/\r$//' build_scripts/build.sh && chmod +x build_scripts/build.sh && ./build_scripts/build.sh --current"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo [ERROR] Linux-Build in WSL fehlgeschlagen!
|
||||||
|
exit /b 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:SUMMARY
|
||||||
|
echo.
|
||||||
|
echo ====================================================
|
||||||
|
echo BUILD ABGESCHLOSSEN!
|
||||||
|
if exist "dist\windows\%APP_NAME%.exe" echo Windows: dist\windows\%APP_NAME%.exe
|
||||||
|
if exist "dist\linux\%APP_NAME%" echo Linux: dist\linux\%APP_NAME%
|
||||||
|
echo ====================================================
|
||||||
endlocal
|
endlocal
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
|
|
||||||
|
REM ====================================================
|
||||||
|
REM HILFSROUTINEN
|
||||||
|
REM ====================================================
|
||||||
|
:FIND_PYTHON
|
||||||
|
set "WIN_PY="
|
||||||
|
set "USING_VENV=0"
|
||||||
|
if exist ".venv\Scripts\python.exe" (
|
||||||
|
".venv\Scripts\python.exe" -m pip --version >nul 2>nul && (
|
||||||
|
set "WIN_PY=.venv\Scripts\python.exe"
|
||||||
|
set "USING_VENV=1"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if "%WIN_PY%"=="" (
|
||||||
|
where python >nul 2>nul && (
|
||||||
|
python -c "import sys, tkinter; sys.exit(0)" >nul 2>nul && set "WIN_PY=python"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if "%WIN_PY%"=="" (
|
||||||
|
where py >nul 2>nul && (
|
||||||
|
py -3 -c "import sys, tkinter; sys.exit(0)" >nul 2>nul && set "WIN_PY=py -3"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
:FIND_WSL_DISTRO
|
||||||
|
set "WSL_DISTRO="
|
||||||
|
where wsl.exe >nul 2>nul
|
||||||
|
if errorlevel 1 exit /b 0
|
||||||
|
for /f "usebackq delims=" %%L in (`powershell -NoProfile -Command "$d = (wsl.exe -l -q 2>$null) -replace '\x00','' | ForEach-Object { $_.Trim() } | Where-Object { $_ -and $_ -notmatch '^docker-desktop' }; if ($d) { $d | Select-Object -First 1 }"`) do (
|
||||||
|
if "!WSL_DISTRO!"=="" set "WSL_DISTRO=%%L"
|
||||||
|
)
|
||||||
|
exit /b 0
|
||||||
|
|
@ -5,106 +5,162 @@
|
||||||
# Output: dist/<os>/TheGothCardgameCollection
|
# Output: dist/<os>/TheGothCardgameCollection
|
||||||
# Usage: ./build_scripts/build.sh [--current | --all | --clean]
|
# Usage: ./build_scripts/build.sh [--current | --all | --clean]
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
set -euo pipefail
|
set -e
|
||||||
|
|
||||||
# Immer ins Projekt-Hauptverzeichnis wechseln
|
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
||||||
cd "${PROJECT_ROOT}"
|
cd "${PROJECT_ROOT}"
|
||||||
|
|
||||||
APP_NAME="TheGothCardgameCollection"
|
APP_NAME="TheGothCardgameCollection"
|
||||||
|
MAIN_FILE="main.py"
|
||||||
|
RES_DIR="resources"
|
||||||
|
GAMES_DIR="games"
|
||||||
|
ICON_FILE="resources/images/game_icon.ico"
|
||||||
MODE="${1:---current}"
|
MODE="${1:---current}"
|
||||||
|
|
||||||
if [[ "${MODE}" == "--clean" ]]; then
|
if [ "$MODE" = "--clean" ]; then
|
||||||
echo "[CLEAN] Entferne temporäre Build-Ordner..."
|
echo "🧹 Räume temporäre Build-Ordner auf..."
|
||||||
rm -rf build .venv_build_linux .venv_build_macos
|
rm -rf build .venv_build_* *.spec
|
||||||
echo "[OK] Aufgeräumt (dist/ blieb erhalten)."
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ziel-OS automatisch erkennen
|
|
||||||
UNAME_OUT="$(uname -s)"
|
UNAME_OUT="$(uname -s)"
|
||||||
case "${UNAME_OUT}" in
|
case "${UNAME_OUT}" in
|
||||||
Linux*) OS_NAME="linux" ;;
|
Linux*) OS_NAME="linux" ;;
|
||||||
Darwin*) OS_NAME="macos" ;;
|
Darwin*) OS_NAME="macos" ;;
|
||||||
*) echo "[ERROR] Unbekanntes Unix-System: ${UNAME_OUT}"; exit 1 ;;
|
*) echo "❌ Unbekanntes Unix-System: ${UNAME_OUT}"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "============================================================"
|
# ----------------------------------------------------
|
||||||
echo " Building ${APP_NAME} (Single-File) -> dist/${OS_NAME}/"
|
# 0. ROOT / SUDO RECHTE-CHECK FÜR SYSTEM-INSTALLATIONEN
|
||||||
echo "============================================================"
|
# ----------------------------------------------------
|
||||||
|
NEEDS_SYS_INSTALL=0
|
||||||
|
if ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; then
|
||||||
|
NEEDS_SYS_INSTALL=1
|
||||||
|
fi
|
||||||
|
if [ "$MODE" = "--all" ] && [ "$OS_NAME" = "linux" ] && ! command -v wine &>/dev/null; then
|
||||||
|
NEEDS_SYS_INSTALL=1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! command -v python3 >/dev/null 2>&1; then
|
if [ "$OS_NAME" = "linux" ] && [ "$NEEDS_SYS_INSTALL" -eq 1 ]; then
|
||||||
echo "[ERROR] python3 nicht gefunden."
|
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
|
||||||
|
echo "🔒 Es fehlen Systempakete (z.B. python3-tk oder wine), für deren Installation Root-Rechte nötig sind."
|
||||||
|
if command -v sudo &>/dev/null; then
|
||||||
|
echo "🔑 Fordere Root-Rechte via sudo an und starte Skript neu..."
|
||||||
|
exec sudo -E bash "$SCRIPT_PATH" "$@"
|
||||||
|
else
|
||||||
|
echo "❌ FEHLER: Keine Root-Rechte (EUID != 0) und 'sudo' ist nicht installiert!"
|
||||||
|
echo " Bitte führe das Skript als root aus: su -c '$SCRIPT_PATH $MODE'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
# Automatische Installation von python3-venv / python3-tk auf Linux/Ubuntu/Debian falls fehlend
|
|
||||||
if [[ "${OS_NAME}" == "linux" ]]; then
|
|
||||||
if ! python3 -c "import venv" >/dev/null 2>&1; then
|
|
||||||
echo "[INFO] Python venv Modul fehlt. Versuche automatische Installation..."
|
|
||||||
if command -v apt-get >/dev/null 2>&1; then
|
|
||||||
sudo apt-get update && sudo apt-get install -y python3-venv python3-tk || true
|
|
||||||
elif command -v dnf >/dev/null 2>&1; then
|
|
||||||
sudo dnf install -y python3-virtualenv python3-tkinter || true
|
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
|
||||||
sudo pacman -S --noconfirm python-virtualenv tk || true
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! python3 -c "import tkinter" >/dev/null 2>&1; then
|
# Echten User ermitteln (wichtig, falls Skript via sudo/root läuft, damit Wine & Dateirechte stimmen!)
|
||||||
echo "[WARNING] Das Python-Modul 'tkinter' scheint zu fehlen."
|
if [ "${EUID:-$(id -u)}" -eq 0 ] && [ -n "${SUDO_USER:-}" ]; then
|
||||||
echo " Bitte installieren: z.B. 'sudo apt install python3-tk' (Debian/Ubuntu/ChromeOS)"
|
REAL_USER="$SUDO_USER"
|
||||||
|
REAL_HOME="$(getent passwd "$SUDO_USER" | cut -d: -f6)"
|
||||||
|
WINE_RUNNER=(sudo -u "$REAL_USER" HOME="$REAL_HOME")
|
||||||
|
else
|
||||||
|
REAL_USER="$(whoami)"
|
||||||
|
REAL_HOME="$HOME"
|
||||||
|
WINE_RUNNER=()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Isolierte Build-Venv anlegen & Dependencies automatisch installieren
|
echo "===================================================="
|
||||||
VENV_DIR="${PROJECT_ROOT}/.venv_build_${OS_NAME}"
|
echo " 🦇 Starte Build für $APP_NAME (OS: $OS_NAME | Modus: $MODE)"
|
||||||
if [[ ! -d "${VENV_DIR}" ]]; then
|
echo "===================================================="
|
||||||
echo "[1/3] Erstelle isolierte Build-Umgebung (${VENV_DIR})..."
|
|
||||||
if ! python3 -m venv "${VENV_DIR}"; then
|
# ----------------------------------------------------
|
||||||
echo "[ERROR] Konnte die virtuelle Umgebung nicht erstellen."
|
# SYSTEMPAKETE INSTALLIEREN (läuft garantiert als root!)
|
||||||
echo " Bitte installiere manuell: sudo apt install python3-venv (Ubuntu/Debian/ChromeOS)"
|
# ----------------------------------------------------
|
||||||
|
install_linux_pkgs() {
|
||||||
|
if command -v apt-get &>/dev/null; then
|
||||||
|
apt-get update -qq
|
||||||
|
apt-get install -y "$@"
|
||||||
|
elif command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y "$@"
|
||||||
|
elif command -v yum &>/dev/null; then
|
||||||
|
yum install -y "$@"
|
||||||
|
elif command -v zypper &>/dev/null; then
|
||||||
|
zypper --non-interactive install "$@"
|
||||||
|
elif command -v pacman &>/dev/null; then
|
||||||
|
pacman -Sy --noconfirm --needed "$@"
|
||||||
|
else
|
||||||
|
echo "❌ Kein unterstützter Paketmanager (apt/dnf/yum/zypper/pacman) gefunden!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$OS_NAME" = "linux" ] && { ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; }; then
|
||||||
|
echo "⚙️ Installiere fehlende Python-/Tkinter-Systempakete..."
|
||||||
|
if command -v apt-get &>/dev/null; then
|
||||||
|
install_linux_pkgs python3 python3-pip python3-venv python3-tk wget
|
||||||
|
elif command -v dnf &>/dev/null || command -v yum &>/dev/null; then
|
||||||
|
install_linux_pkgs python3 python3-pip python3-tkinter wget
|
||||||
|
elif command -v zypper &>/dev/null; then
|
||||||
|
install_linux_pkgs python3 python3-pip python3-tk wget
|
||||||
|
elif command -v pacman &>/dev/null; then
|
||||||
|
install_linux_pkgs python python-pip tk wget
|
||||||
|
fi
|
||||||
|
elif [ "$OS_NAME" = "macos" ] && { ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; }; then
|
||||||
|
if [ "${EUID:-$(id -u)}" -eq 0 ]; then
|
||||||
|
echo "❌ Unter macOS darf Homebrew nicht als root ausgeführt werden. Bitte ohne sudo starten."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if command -v brew &>/dev/null; then
|
||||||
|
brew install python@3.11 python-tk@3.11
|
||||||
|
else
|
||||||
|
echo "❌ Python3/Tkinter fehlt und Homebrew ist nicht installiert."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC1091
|
# ----------------------------------------------------
|
||||||
source "${VENV_DIR}/bin/activate"
|
# TEIL 1: LINUX / MACOS EXECUTABLE BAUEN
|
||||||
|
# ----------------------------------------------------
|
||||||
|
echo ""
|
||||||
|
echo "---> [1] Baue ${OS_NAME} Executable..."
|
||||||
|
|
||||||
echo "[2/3] Prüfe & aktualisiere Build-Abhängigkeiten (PyInstaller, Pillow, Pygame)..."
|
# Defekte Venvs automatisch bereinigen
|
||||||
python -m pip install --upgrade --quiet pip
|
for VDIR in ".venv_build_${OS_NAME}" ".venv" "venv"; do
|
||||||
python -m pip install --quiet pyinstaller pillow pygame
|
if [ -d "$VDIR" ] && [ ! -x "$VDIR/bin/python3" ]; then
|
||||||
|
echo "🧹 Entferne defektes Venv: $VDIR"
|
||||||
|
rm -rf "$VDIR"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Ziel- & Arbeitsverzeichnisse vorbereiten
|
if [ -x ".venv/bin/python3" ]; then
|
||||||
DIST_DIR="${PROJECT_ROOT}/dist/${OS_NAME}"
|
LINUX_PY=".venv/bin/python3"
|
||||||
WORK_DIR="${PROJECT_ROOT}/build/${OS_NAME}"
|
elif [ -x "venv/bin/python3" ]; then
|
||||||
mkdir -p "${DIST_DIR}" "${WORK_DIR}"
|
LINUX_PY="venv/bin/python3"
|
||||||
|
else
|
||||||
ICON_ARGS=()
|
LINUX_PY="python3"
|
||||||
if [[ -f "${PROJECT_ROOT}/resources/images/game_icon.ico" ]]; then
|
|
||||||
ICON_ARGS=(--icon "${PROJECT_ROOT}/resources/images/game_icon.ico")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STRIP_ARGS=()
|
# Falls wir nicht root sind und kein Venv nutzen, pip mit --user ausführen, damit es keine Permission-Errors gibt
|
||||||
if command -v strip >/dev/null 2>&1; then
|
PIP_USER_FLAG=()
|
||||||
STRIP_ARGS=(--strip)
|
if [ "$LINUX_PY" = "python3" ] && [ "${EUID:-$(id -u)}" -ne 0 ]; then
|
||||||
|
PIP_USER_FLAG=(--user)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[3/3] Kompiliere kompakte Einzeldatei mit absoluten Pfaden..."
|
$LINUX_PY -m pip install "${PIP_USER_FLAG[@]}" --upgrade pillow pygame pyinstaller --break-system-packages 2>/dev/null \
|
||||||
python -m PyInstaller \
|
|| $LINUX_PY -m pip install "${PIP_USER_FLAG[@]}" --upgrade pillow pygame pyinstaller
|
||||||
|
|
||||||
|
ICON_ARG=()
|
||||||
|
[ -f "$ICON_FILE" ] && ICON_ARG=(--icon "$ICON_FILE")
|
||||||
|
|
||||||
|
$LINUX_PY -m PyInstaller \
|
||||||
--noconfirm \
|
--noconfirm \
|
||||||
--clean \
|
--noconsole \
|
||||||
--onefile \
|
--onefile \
|
||||||
--windowed \
|
--clean \
|
||||||
"${STRIP_ARGS[@]}" \
|
--distpath "dist/${OS_NAME}" \
|
||||||
--name "${APP_NAME}" \
|
--workpath "build/${OS_NAME}" \
|
||||||
--distpath "${DIST_DIR}" \
|
--specpath "build/${OS_NAME}" \
|
||||||
--workpath "${WORK_DIR}" \
|
"${ICON_ARG[@]}" \
|
||||||
--specpath "${WORK_DIR}" \
|
--add-data "${RES_DIR}:${RES_DIR}" \
|
||||||
"${ICON_ARGS[@]}" \
|
--add-data "${GAMES_DIR}:${GAMES_DIR}" \
|
||||||
--add-data "${PROJECT_ROOT}/resources:resources" \
|
|
||||||
--add-data "${PROJECT_ROOT}/games:games" \
|
|
||||||
--collect-submodules games \
|
--collect-submodules games \
|
||||||
--collect-submodules controller \
|
--collect-submodules controller \
|
||||||
--collect-submodules models \
|
--collect-submodules models \
|
||||||
|
|
@ -115,34 +171,96 @@ python -m PyInstaller \
|
||||||
--hidden-import tkinter.font \
|
--hidden-import tkinter.font \
|
||||||
--hidden-import sqlite3 \
|
--hidden-import sqlite3 \
|
||||||
--hidden-import PIL._tkinter_finder \
|
--hidden-import PIL._tkinter_finder \
|
||||||
--exclude-module matplotlib \
|
--name "${APP_NAME}" \
|
||||||
--exclude-module numpy \
|
"$MAIN_FILE"
|
||||||
--exclude-module scipy \
|
|
||||||
--exclude-module pandas \
|
|
||||||
--exclude-module pytest \
|
|
||||||
--exclude-module unittest \
|
|
||||||
--exclude-module pydoc \
|
|
||||||
"${PROJECT_ROOT}/main.py"
|
|
||||||
|
|
||||||
deactivate
|
chmod +x "dist/${OS_NAME}/${APP_NAME}"
|
||||||
|
rm -rf "build/${OS_NAME}"
|
||||||
|
echo "✔ ${OS_NAME}-Build fertig: dist/${OS_NAME}/${APP_NAME}"
|
||||||
|
|
||||||
chmod +x "${DIST_DIR}/${APP_NAME}" 2>/dev/null || true
|
|
||||||
rm -rf "${WORK_DIR}"
|
# ----------------------------------------------------
|
||||||
|
# TEIL 2: WINDOWS .EXE BAUEN VIA WINE (nur bei --all unter Linux)
|
||||||
|
# ----------------------------------------------------
|
||||||
|
if [ "$MODE" = "--all" ] && [ "$OS_NAME" = "linux" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "---> [2] Baue Windows .exe (via Wine)..."
|
||||||
|
|
||||||
|
if ! command -v wine &>/dev/null; then
|
||||||
|
echo "⚙️ Installiere 'wine' und 'wget' (Root-Rechte bereits geprüft)..."
|
||||||
|
if command -v apt-get &>/dev/null; then
|
||||||
|
dpkg --add-architecture amd64 2>/dev/null || true
|
||||||
|
install_linux_pkgs wine wget
|
||||||
|
else
|
||||||
|
install_linux_pkgs wine wget
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v wine &>/dev/null; then
|
||||||
|
echo "❌ 'wine' konnte nicht installiert werden!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WINE_DRIVE_C="${REAL_HOME}/.wine/drive_c"
|
||||||
|
WINE_PY=$(find "$WINE_DRIVE_C" -iname "python.exe" 2>/dev/null | grep -i "Python3" | head -n 1 || true)
|
||||||
|
|
||||||
|
if [ -z "$WINE_PY" ]; then
|
||||||
|
echo "⚙️ Windows-Python in Wine (${WINE_DRIVE_C}) nicht gefunden. Installiere Python 3.11.9 automatisch..."
|
||||||
|
INSTALLER="/tmp/python-3.11.9-amd64.exe"
|
||||||
|
if [ ! -f "$INSTALLER" ]; then
|
||||||
|
wget -O "$INSTALLER" https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe
|
||||||
|
fi
|
||||||
|
"${WINE_RUNNER[@]}" wine "$INSTALLER" /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
|
||||||
|
"${WINE_RUNNER[@]}" wineserver -w || true
|
||||||
|
rm -f "$INSTALLER"
|
||||||
|
WINE_PY=$(find "$WINE_DRIVE_C" -iname "python.exe" 2>/dev/null | grep -i "Python3" | head -n 1 || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$WINE_PY" ]; then
|
||||||
|
echo "❌ Konnte python.exe in ${WINE_DRIVE_C} nicht finden!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✔ Nutze Wine-Python: $WINE_PY"
|
||||||
|
|
||||||
|
"${WINE_RUNNER[@]}" wine "$WINE_PY" -m pip install --upgrade pip pillow pygame pyinstaller
|
||||||
|
|
||||||
|
"${WINE_RUNNER[@]}" wine "$WINE_PY" -m PyInstaller \
|
||||||
|
--noconfirm \
|
||||||
|
--noconsole \
|
||||||
|
--onefile \
|
||||||
|
--clean \
|
||||||
|
--distpath "dist/windows" \
|
||||||
|
--workpath "build/windows" \
|
||||||
|
--specpath "build/windows" \
|
||||||
|
"${ICON_ARG[@]}" \
|
||||||
|
--add-data "${RES_DIR};${RES_DIR}" \
|
||||||
|
--add-data "${GAMES_DIR};${GAMES_DIR}" \
|
||||||
|
--collect-submodules games \
|
||||||
|
--collect-submodules controller \
|
||||||
|
--collect-submodules models \
|
||||||
|
--collect-submodules view \
|
||||||
|
--collect-submodules resources \
|
||||||
|
--hidden-import tkinter \
|
||||||
|
--hidden-import tkinter.ttk \
|
||||||
|
--hidden-import tkinter.font \
|
||||||
|
--hidden-import sqlite3 \
|
||||||
|
--hidden-import PIL._tkinter_finder \
|
||||||
|
--name "${APP_NAME}" \
|
||||||
|
"$MAIN_FILE"
|
||||||
|
|
||||||
|
rm -rf "build/windows"
|
||||||
|
echo "✔ Windows-Build fertig: dist/windows/${APP_NAME}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Falls via sudo gestartet, Besitzrechte von dist/ wieder auf den normalen User übertragen
|
||||||
|
if [ "${EUID:-$(id -u)}" -eq 0 ] && [ -n "${SUDO_USER:-}" ]; then
|
||||||
|
chown -R "$SUDO_USER:$SUDO_USER" dist/ 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[DONE] Fertige ausführbare Datei liegt bereit under:"
|
echo "===================================================="
|
||||||
echo " dist/${OS_NAME}/${APP_NAME}"
|
echo " ✅ BUILD ERFOLGREICH ABGESCHLOSSEN!"
|
||||||
|
[ -f "dist/${OS_NAME}/${APP_NAME}" ] && echo " 🐧 ${OS_NAME}-Version: dist/${OS_NAME}/${APP_NAME}"
|
||||||
# Optionaler Cross-Build via Wine (falls --all übergeben wurde und Wine + Python installiert ist)
|
[ -f "dist/windows/${APP_NAME}.exe" ] && echo " 🪟 Windows-Version: dist/windows/${APP_NAME}.exe"
|
||||||
if [[ "${MODE}" == "--all" && "${OS_NAME}" == "linux" ]]; then
|
echo "===================================================="
|
||||||
echo ""
|
|
||||||
echo "------------------------------------------------------------"
|
|
||||||
echo " Prüfe optionalen Windows-Cross-Build via Wine..."
|
|
||||||
echo "------------------------------------------------------------"
|
|
||||||
if command -v wine >/dev/null 2>&1 && wine python --version >/dev/null 2>&1; then
|
|
||||||
echo "[WINE] Starte Windows-Build -> dist/windows/${APP_NAME}.exe ..."
|
|
||||||
wine cmd /c "build_scripts\\build.bat --current"
|
|
||||||
else
|
|
||||||
echo "[SKIP] Wine mit Windows-Python nicht gefunden – überspringe Windows-Cross-Build."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -343,8 +343,13 @@ class BlackjackTableView:
|
||||||
self._photo_refs.append(photo)
|
self._photo_refs.append(photo)
|
||||||
tk.Label(cards_f, image=photo, bg=CELL_BG, bd=0).pack(side="left", padx=2)
|
tk.Label(cards_f, image=photo, bg=CELL_BG, bd=0).pack(side="left", padx=2)
|
||||||
|
|
||||||
if reveal_opponents and bot.hand and bot.is_active_in_pot:
|
if reveal_opponents and bot.hand:
|
||||||
b_val, _ = HandEvaluator.evaluate(bot.hand)
|
b_val, _ = HandEvaluator.evaluate(bot.hand)
|
||||||
|
if bot.folded:
|
||||||
|
info_txt = t("bj_rank_folded", b_val)
|
||||||
|
elif bot.busted:
|
||||||
|
info_txt = t("bj_rank_busted", b_val)
|
||||||
|
else:
|
||||||
info_txt = t("bj_bot_showdown_val", b_val, bot.bet_in_pot)
|
info_txt = t("bj_bot_showdown_val", b_val, bot.bet_in_pot)
|
||||||
elif bot.status_text:
|
elif bot.status_text:
|
||||||
info_txt = bot.status_text
|
info_txt = bot.status_text
|
||||||
|
|
@ -929,11 +934,120 @@ class BlackjackTableView:
|
||||||
)
|
)
|
||||||
return xp_gained, (new_lvl if new_lvl > old_lvl else None)
|
return xp_gained, (new_lvl if new_lvl > old_lvl else None)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _format_hand_rank_label(
|
||||||
|
cards, is_split: bool = False, busted: bool = False, folded: bool = False
|
||||||
|
) -> str:
|
||||||
|
val, _ = HandEvaluator.evaluate(cards)
|
||||||
|
if folded:
|
||||||
|
return t("bj_rank_folded", val)
|
||||||
|
if busted or val > 21:
|
||||||
|
return t("bj_rank_busted", val)
|
||||||
|
if HandEvaluator.is_triple_seven(cards):
|
||||||
|
return t("bj_rank_777")
|
||||||
|
if not is_split and HandEvaluator.is_natural_blackjack(cards):
|
||||||
|
return t("bj_rank_natural_bj")
|
||||||
|
if val == 21:
|
||||||
|
return t("bj_rank_split_21") if is_split else t("bj_rank_multi_21", len(cards))
|
||||||
|
return t("bj_rank_points", val, len(cards))
|
||||||
|
|
||||||
|
def _collect_showdown_snapshot(self, instant_777_winner: str | None = None) -> list[dict]:
|
||||||
|
"""Serialisiert alle Tischhände JSON-sicher für Popup & Devil's-Deal-Save."""
|
||||||
|
snapshot: list[dict] = []
|
||||||
|
|
||||||
|
# 1. Haus-Dealer
|
||||||
|
d_cards = self.engine.dealer_hand
|
||||||
|
d_val, _ = HandEvaluator.evaluate(d_cards)
|
||||||
|
d_rank = self.engine._hand_rank(d_cards)
|
||||||
|
snapshot.append({
|
||||||
|
"role": "DEALER",
|
||||||
|
"name": "",
|
||||||
|
"hand_no": 0,
|
||||||
|
"card_images": [c.image_filename for c in d_cards],
|
||||||
|
"cards_raw": [[c.suit, c.rank] for c in d_cards],
|
||||||
|
"is_split": False,
|
||||||
|
"busted": d_val > 21,
|
||||||
|
"folded": False,
|
||||||
|
"rank_tuple": list(d_rank),
|
||||||
|
})
|
||||||
|
|
||||||
|
# 2. Spieler-Hand / Split-Hände
|
||||||
|
multi_p = len(self.engine.player_hands) > 1
|
||||||
|
for idx, h in enumerate(self.engine.player_hands):
|
||||||
|
hr = self.engine._hand_rank(h.cards, is_split=h.is_split_hand) if h.is_active_in_pot else (0, 0)
|
||||||
|
snapshot.append({
|
||||||
|
"role": "PLAYER",
|
||||||
|
"name": "",
|
||||||
|
"hand_no": (idx + 1) if multi_p else 0,
|
||||||
|
"card_images": [c.image_filename for c in h.cards],
|
||||||
|
"cards_raw": [[c.suit, c.rank] for c in h.cards],
|
||||||
|
"is_split": h.is_split_hand,
|
||||||
|
"busted": h.busted,
|
||||||
|
"folded": h.folded,
|
||||||
|
"rank_tuple": list(hr),
|
||||||
|
})
|
||||||
|
|
||||||
|
# 3. Alle Bots am Tisch
|
||||||
|
for b in self.bots:
|
||||||
|
br = self.engine._hand_rank(b.hand) if b.is_active_in_pot else (0, 0)
|
||||||
|
snapshot.append({
|
||||||
|
"role": "BOT",
|
||||||
|
"name": b.name,
|
||||||
|
"hand_no": 0,
|
||||||
|
"card_images": [c.image_filename for c in b.hand],
|
||||||
|
"cards_raw": [[c.suit, c.rank] for c in b.hand],
|
||||||
|
"is_split": False,
|
||||||
|
"busted": b.busted,
|
||||||
|
"folded": b.folded,
|
||||||
|
"rank_tuple": list(br),
|
||||||
|
})
|
||||||
|
|
||||||
|
# Gewinner-Markierung anhand derselben Showdown-Regeln wie BlackjackEngine
|
||||||
|
contenders = [s for s in snapshot if s["role"] != "DEALER" and not s["busted"] and not s["folded"]]
|
||||||
|
dealer_entry = snapshot[0]
|
||||||
|
|
||||||
|
if instant_777_winner is not None:
|
||||||
|
for s in snapshot:
|
||||||
|
if instant_777_winner == "PLAYER" and s["role"] == "PLAYER" and s["rank_tuple"] == [3, 21]:
|
||||||
|
s["is_winner"] = True
|
||||||
|
elif s["role"] == "BOT" and s["name"] == instant_777_winner and s["rank_tuple"] == [3, 21]:
|
||||||
|
s["is_winner"] = True
|
||||||
|
else:
|
||||||
|
s["is_winner"] = False
|
||||||
|
return snapshot
|
||||||
|
|
||||||
|
if not contenders:
|
||||||
|
dealer_entry["is_winner"] = True
|
||||||
|
for s in snapshot[1:]:
|
||||||
|
s["is_winner"] = False
|
||||||
|
return snapshot
|
||||||
|
|
||||||
|
best_contender = max(tuple(s["rank_tuple"]) for s in contenders)
|
||||||
|
d_rnk = tuple(dealer_entry["rank_tuple"])
|
||||||
|
|
||||||
|
if d_rnk > best_contender:
|
||||||
|
dealer_entry["is_winner"] = True
|
||||||
|
for s in snapshot[1:]:
|
||||||
|
s["is_winner"] = False
|
||||||
|
elif d_rnk == best_contender:
|
||||||
|
dealer_entry["is_winner"] = True
|
||||||
|
for s in snapshot[1:]:
|
||||||
|
s["is_winner"] = (not s["busted"] and not s["folded"] and tuple(s["rank_tuple"]) == best_contender)
|
||||||
|
else:
|
||||||
|
dealer_entry["is_winner"] = False
|
||||||
|
for s in snapshot[1:]:
|
||||||
|
s["is_winner"] = (not s["busted"] and not s["folded"] and tuple(s["rank_tuple"]) == best_contender)
|
||||||
|
|
||||||
|
return snapshot
|
||||||
|
|
||||||
def _trigger_instant_777_win(self, winner_is_player: bool, winning_bot: BlackjackBotSeat | None):
|
def _trigger_instant_777_win(self, winner_is_player: bool, winning_bot: BlackjackBotSeat | None):
|
||||||
self.engine.state = "SHOWDOWN"
|
self.engine.state = "SHOWDOWN"
|
||||||
self._count_all_table_cards()
|
self._count_all_table_cards()
|
||||||
pot_total = self.engine.pot
|
pot_total = self.engine.pot
|
||||||
total_p_bet = self.engine.total_player_bet
|
total_p_bet = self.engine.total_player_bet
|
||||||
|
snap = self._collect_showdown_snapshot(
|
||||||
|
instant_777_winner="PLAYER" if winner_is_player else winning_bot.name
|
||||||
|
)
|
||||||
|
|
||||||
if winner_is_player:
|
if winner_is_player:
|
||||||
payout = pot_total + (total_p_bet if not self.bots else 0)
|
payout = pot_total + (total_p_bet if not self.bots else 0)
|
||||||
|
|
@ -944,12 +1058,14 @@ class BlackjackTableView:
|
||||||
payload = {
|
payload = {
|
||||||
"winner_type": "PLAYER",
|
"winner_type": "PLAYER",
|
||||||
"winner_names": [],
|
"winner_names": [],
|
||||||
|
"instant_777": "PLAYER",
|
||||||
"player_won": True,
|
"player_won": True,
|
||||||
"player_net": net,
|
"player_net": net,
|
||||||
"bank_gain": 0,
|
"bank_gain": 0,
|
||||||
"bot_gains": [],
|
"bot_gains": [],
|
||||||
"xp_gained": xp,
|
"xp_gained": xp,
|
||||||
"leveled_to": leveled_to,
|
"leveled_to": leveled_to,
|
||||||
|
"showdown_snapshot": snap,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
winning_bot.gold += pot_total
|
winning_bot.gold += pot_total
|
||||||
|
|
@ -959,12 +1075,14 @@ class BlackjackTableView:
|
||||||
payload = {
|
payload = {
|
||||||
"winner_type": "BOT",
|
"winner_type": "BOT",
|
||||||
"winner_names": [winning_bot.name],
|
"winner_names": [winning_bot.name],
|
||||||
|
"instant_777": winning_bot.name,
|
||||||
"player_won": False,
|
"player_won": False,
|
||||||
"player_net": -total_p_bet,
|
"player_net": -total_p_bet,
|
||||||
"bank_gain": 0,
|
"bank_gain": 0,
|
||||||
"bot_gains": [(winning_bot.name, bot_net)] if bot_net > 0 else [],
|
"bot_gains": [(winning_bot.name, bot_net)] if bot_net > 0 else [],
|
||||||
"xp_gained": xp,
|
"xp_gained": xp,
|
||||||
"leveled_to": leveled_to,
|
"leveled_to": leveled_to,
|
||||||
|
"showdown_snapshot": snap,
|
||||||
}
|
}
|
||||||
|
|
||||||
self._last_popup_payload = payload
|
self._last_popup_payload = payload
|
||||||
|
|
@ -1016,6 +1134,7 @@ class BlackjackTableView:
|
||||||
def _finalize_showdown(self):
|
def _finalize_showdown(self):
|
||||||
self._count_all_table_cards()
|
self._count_all_table_cards()
|
||||||
res = self.engine.resolve_showdown(self.bots)
|
res = self.engine.resolve_showdown(self.bots)
|
||||||
|
snap = self._collect_showdown_snapshot(instant_777_winner=None)
|
||||||
|
|
||||||
if res["player_payout"] > 0:
|
if res["player_payout"] > 0:
|
||||||
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], res["player_payout"])
|
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], res["player_payout"])
|
||||||
|
|
@ -1043,12 +1162,14 @@ class BlackjackTableView:
|
||||||
payload = {
|
payload = {
|
||||||
"winner_type": w_type,
|
"winner_type": w_type,
|
||||||
"winner_names": res["winner_names"],
|
"winner_names": res["winner_names"],
|
||||||
|
"instant_777": None,
|
||||||
"player_won": player_won_flag,
|
"player_won": player_won_flag,
|
||||||
"player_net": res["player_net"],
|
"player_net": res["player_net"],
|
||||||
"bank_gain": res["bank_gain"],
|
"bank_gain": res["bank_gain"],
|
||||||
"bot_gains": res["bot_gains"],
|
"bot_gains": res["bot_gains"],
|
||||||
"xp_gained": xp,
|
"xp_gained": xp,
|
||||||
"leveled_to": leveled_to,
|
"leveled_to": leveled_to,
|
||||||
|
"showdown_snapshot": snap,
|
||||||
}
|
}
|
||||||
self._last_popup_payload = payload
|
self._last_popup_payload = payload
|
||||||
if self.devils_locked:
|
if self.devils_locked:
|
||||||
|
|
@ -1060,6 +1181,8 @@ class BlackjackTableView:
|
||||||
self._open_result_popup(self._build_localized_popup_data(payload))
|
self._open_result_popup(self._build_localized_popup_data(payload))
|
||||||
|
|
||||||
def _build_localized_popup_data(self, payload: dict) -> dict:
|
def _build_localized_popup_data(self, payload: dict) -> dict:
|
||||||
|
from models.card import Card
|
||||||
|
|
||||||
w_type = payload["winner_type"]
|
w_type = payload["winner_type"]
|
||||||
if w_type == "BANK":
|
if w_type == "BANK":
|
||||||
headline = t("bj_popup_bank_won")
|
headline = t("bj_popup_bank_won")
|
||||||
|
|
@ -1070,6 +1193,41 @@ class BlackjackTableView:
|
||||||
else:
|
else:
|
||||||
headline = t("bj_popup_tie")
|
headline = t("bj_popup_tie")
|
||||||
|
|
||||||
|
# Lokalisierte Hand-Karten & Begründung aufbauen
|
||||||
|
showdown_hands = []
|
||||||
|
raw_snap = payload.get("showdown_snapshot", [])
|
||||||
|
for s in raw_snap:
|
||||||
|
cards_obj = [Card(sr[0], sr[1]) for sr in s.get("cards_raw", [])]
|
||||||
|
if s["role"] == "DEALER":
|
||||||
|
owner_lbl = t("bj_showdown_seat_dealer")
|
||||||
|
elif s["role"] == "PLAYER":
|
||||||
|
owner_lbl = (
|
||||||
|
t("bj_showdown_seat_you_hand", s["hand_no"])
|
||||||
|
if s.get("hand_no") else t("bj_showdown_seat_you")
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
owner_lbl = s["name"]
|
||||||
|
|
||||||
|
rank_lbl = self._format_hand_rank_label(
|
||||||
|
cards_obj,
|
||||||
|
is_split=s.get("is_split", False),
|
||||||
|
busted=s.get("busted", False),
|
||||||
|
folded=s.get("folded", False),
|
||||||
|
)
|
||||||
|
showdown_hands.append({
|
||||||
|
"owner_label": owner_lbl,
|
||||||
|
"is_dealer": (s["role"] == "DEALER"),
|
||||||
|
"is_winner": s.get("is_winner", False),
|
||||||
|
"busted": s.get("busted", False),
|
||||||
|
"folded": s.get("folded", False),
|
||||||
|
"card_images": s.get("card_images", []),
|
||||||
|
"rank_label": rank_lbl,
|
||||||
|
"rank_tuple": tuple(s.get("rank_tuple", [0, 0])),
|
||||||
|
"role": s["role"],
|
||||||
|
})
|
||||||
|
|
||||||
|
reason_text = self._build_showdown_reason(payload, showdown_hands)
|
||||||
|
|
||||||
other_gains = []
|
other_gains = []
|
||||||
if payload["bank_gain"] > 0:
|
if payload["bank_gain"] > 0:
|
||||||
other_gains.append(t("bj_popup_bank_gain", payload["bank_gain"]))
|
other_gains.append(t("bj_popup_bank_gain", payload["bank_gain"]))
|
||||||
|
|
@ -1088,6 +1246,8 @@ class BlackjackTableView:
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"headline": headline,
|
"headline": headline,
|
||||||
|
"reason_text": reason_text,
|
||||||
|
"showdown_hands": showdown_hands,
|
||||||
"player_won": payload["player_won"],
|
"player_won": payload["player_won"],
|
||||||
"player_net": payload["player_net"],
|
"player_net": payload["player_net"],
|
||||||
"other_gains": other_gains,
|
"other_gains": other_gains,
|
||||||
|
|
@ -1097,6 +1257,65 @@ class BlackjackTableView:
|
||||||
"can_leave_menu": not self.devils_locked,
|
"can_leave_menu": not self.devils_locked,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _build_showdown_reason(payload: dict, showdown_hands: list[dict]) -> str:
|
||||||
|
if not showdown_hands:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
inst = payload.get("instant_777")
|
||||||
|
if inst:
|
||||||
|
who = t("bj_showdown_seat_you") if inst == "PLAYER" else inst
|
||||||
|
return t("bj_reason_777_win", who)
|
||||||
|
|
||||||
|
dealer = showdown_hands[0]
|
||||||
|
contenders = [h for h in showdown_hands[1:] if not h["busted"] and not h["folded"]]
|
||||||
|
if not contenders:
|
||||||
|
return t("bj_reason_all_out")
|
||||||
|
|
||||||
|
winners = [h for h in showdown_hands if h["is_winner"]]
|
||||||
|
if not winners:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
top_rank = winners[0]["rank_tuple"]
|
||||||
|
winner_names_str = ", ".join(dict.fromkeys(w["owner_label"] for w in winners if not w["is_dealer"]))
|
||||||
|
|
||||||
|
# Fall 1: Gleichstand mit dem Haus-Dealer (Push)
|
||||||
|
if dealer["is_winner"] and len(winners) > 1:
|
||||||
|
return t("bj_reason_dealer_tie_push", dealer["rank_label"])
|
||||||
|
|
||||||
|
# Fall 2: Jemand hat ebenfalls 21 Punkte, verliert aber wegen 2-Karten-Blackjack oder 7-7-7!
|
||||||
|
losers_with_21 = [
|
||||||
|
h for h in showdown_hands
|
||||||
|
if not h["is_winner"] and not h["busted"] and not h["folded"] and h["rank_tuple"][1] == 21
|
||||||
|
]
|
||||||
|
win_label = dealer["owner_label"] if dealer["is_winner"] else winner_names_str
|
||||||
|
if top_rank == (3, 21) and losers_with_21:
|
||||||
|
return t("bj_reason_777_beats_21", win_label)
|
||||||
|
if top_rank == (2, 21) and losers_with_21:
|
||||||
|
return t("bj_reason_nat_beats_reg21", win_label)
|
||||||
|
|
||||||
|
# Fall 3: Mehrere Spieler/Bots teilen sich den Sieg
|
||||||
|
non_dealer_winners = [w for w in winners if not w["is_dealer"]]
|
||||||
|
if len(non_dealer_winners) > 1:
|
||||||
|
return t("bj_reason_split_pot", non_dealer_winners[0]["rank_label"], winner_names_str)
|
||||||
|
|
||||||
|
# Fall 4: Haus-Dealer hat sich überkauft
|
||||||
|
if dealer["busted"] and not dealer["is_winner"]:
|
||||||
|
return t("bj_reason_dealer_bust", dealer["rank_label"], win_label, winners[0]["rank_label"])
|
||||||
|
|
||||||
|
# Fall 5: Regulärer Punktesieg gegen die nächstbeste Hand am Tisch
|
||||||
|
others_alive = [
|
||||||
|
h for h in showdown_hands
|
||||||
|
if not h["is_winner"] and not h["busted"] and not h["folded"]
|
||||||
|
]
|
||||||
|
if others_alive:
|
||||||
|
runner_up = max(others_alive, key=lambda x: x["rank_tuple"])
|
||||||
|
runner_desc = f"{runner_up['owner_label']}: {runner_up['rank_label']}"
|
||||||
|
else:
|
||||||
|
runner_desc = f"{dealer['owner_label']}: {dealer['rank_label']}"
|
||||||
|
|
||||||
|
return t("bj_reason_higher_score", win_label, winners[0]["rank_label"], runner_desc)
|
||||||
|
|
||||||
def _open_result_popup(self, popup_data: dict):
|
def _open_result_popup(self, popup_data: dict):
|
||||||
for w in self.controls_frame.winfo_children():
|
for w in self.controls_frame.winfo_children():
|
||||||
w.destroy()
|
w.destroy()
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from resources.code_res.game_constants import (
|
from resources.code_res.game_constants import (
|
||||||
ACCENT_GOLD, ACCENT_GOTH, CELL_BG, ERROR_FG,
|
ACCENT_GOLD, ACCENT_GOTH, CELL_BG, ERROR_FG,
|
||||||
FG_COLOR, MODAL_BG, MUTED_FG, SUBTLE_BORDER
|
FG_COLOR, MODAL_BG, MUTED_FG, PANEL_BG, SUBTLE_BORDER
|
||||||
)
|
)
|
||||||
from resources.code_res.i18n import t
|
from resources.code_res.i18n import t
|
||||||
from view.widgets.image_button import ImageButton
|
from view.widgets.image_button import ImageButton
|
||||||
|
|
||||||
|
SHOWDOWN_MINI_CARD_SIZE = (52, 76)
|
||||||
|
|
||||||
|
|
||||||
class BlackjackResultDialog(tk.Frame):
|
class BlackjackResultDialog(tk.Frame):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -20,7 +22,7 @@ class BlackjackResultDialog(tk.Frame):
|
||||||
on_back_to_menu,
|
on_back_to_menu,
|
||||||
):
|
):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
parent, bg=MODAL_BG, padx=32, pady=24,
|
parent, bg=MODAL_BG, padx=26, pady=18,
|
||||||
highlightthickness=2, highlightbackground=ACCENT_GOTH
|
highlightthickness=2, highlightbackground=ACCENT_GOTH
|
||||||
)
|
)
|
||||||
self.assets = assets
|
self.assets = assets
|
||||||
|
|
@ -29,14 +31,19 @@ class BlackjackResultDialog(tk.Frame):
|
||||||
self.on_next_round = on_next_round
|
self.on_next_round = on_next_round
|
||||||
self.on_back_to_menu = on_back_to_menu
|
self.on_back_to_menu = on_back_to_menu
|
||||||
self._gif_job = None
|
self._gif_job = None
|
||||||
|
self._card_photos = []
|
||||||
|
|
||||||
self.place(relx=0.5, rely=0.5, anchor="center")
|
self.place(relx=0.5, rely=0.5, anchor="center")
|
||||||
self.lift()
|
self.lift()
|
||||||
self._build()
|
self._build()
|
||||||
|
|
||||||
def _build(self):
|
def _build(self):
|
||||||
self.gif_lbl = tk.Label(self, bg=MODAL_BG, bd=0)
|
# Kompaktere Kopfzeile (GIF + Headline), damit alle Karten sauber Platz haben
|
||||||
self.gif_lbl.pack(pady=(0, 6))
|
header_row = tk.Frame(self, bg=MODAL_BG)
|
||||||
|
header_row.pack(pady=(0, 6))
|
||||||
|
|
||||||
|
self.gif_lbl = tk.Label(header_row, bg=MODAL_BG, bd=0)
|
||||||
|
self.gif_lbl.pack(pady=(0, 4))
|
||||||
if self.data.get("player_won") is True:
|
if self.data.get("player_won") is True:
|
||||||
self._start_gif("win_gif")
|
self._start_gif("win_gif")
|
||||||
elif self.data.get("player_won") is False:
|
elif self.data.get("player_won") is False:
|
||||||
|
|
@ -46,15 +53,88 @@ class BlackjackResultDialog(tk.Frame):
|
||||||
MUTED_FG if self.data.get("player_won") is None else ERROR_FG
|
MUTED_FG if self.data.get("player_won") is None else ERROR_FG
|
||||||
)
|
)
|
||||||
tk.Label(
|
tk.Label(
|
||||||
self, text=self.data["headline"],
|
header_row, text=self.data["headline"],
|
||||||
font=("Georgia", 18, "bold"), fg=headline_color, bg=MODAL_BG,
|
font=("Georgia", 17, "bold"), fg=headline_color, bg=MODAL_BG,
|
||||||
).pack(pady=(2, 12))
|
).pack()
|
||||||
|
|
||||||
info_box = tk.Frame(
|
# Klare Begründung (z. B. warum Natural BJ gegen 3-Karten-21 gewonnen hat)
|
||||||
self, bg=CELL_BG, padx=22, pady=14,
|
reason_txt = self.data.get("reason_text", "")
|
||||||
|
if reason_txt:
|
||||||
|
reason_box = tk.Frame(
|
||||||
|
self, bg=PANEL_BG, padx=14, pady=7,
|
||||||
|
highlightthickness=1, highlightbackground=ACCENT_GOLD
|
||||||
|
)
|
||||||
|
reason_box.pack(fill="x", pady=(2, 10))
|
||||||
|
tk.Label(
|
||||||
|
reason_box, text=reason_txt,
|
||||||
|
font=("Helvetica", 10, "bold"), fg=ACCENT_GOLD, bg=PANEL_BG,
|
||||||
|
wraplength=760, justify="center"
|
||||||
|
).pack()
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# SHOWDOWN-KARTENANSICHT ALLER TEILNEHMER (Dealer, Du, Bots)
|
||||||
|
# =========================================================
|
||||||
|
hands_list = self.data.get("showdown_hands", [])
|
||||||
|
if hands_list:
|
||||||
|
hands_outer = tk.Frame(
|
||||||
|
self, bg=CELL_BG, padx=12, pady=10,
|
||||||
highlightthickness=1, highlightbackground=SUBTLE_BORDER
|
highlightthickness=1, highlightbackground=SUBTLE_BORDER
|
||||||
)
|
)
|
||||||
info_box.pack(fill="x", pady=(0, 14))
|
hands_outer.pack(fill="x", pady=(0, 10))
|
||||||
|
|
||||||
|
tk.Label(
|
||||||
|
hands_outer, text=t("bj_showdown_section_title"),
|
||||||
|
font=("Georgia", 10, "bold"), fg=ACCENT_GOTH, bg=CELL_BG
|
||||||
|
).pack(anchor="w", pady=(0, 6))
|
||||||
|
|
||||||
|
cards_grid = tk.Frame(hands_outer, bg=CELL_BG)
|
||||||
|
cards_grid.pack()
|
||||||
|
|
||||||
|
max_cols = 3 if len(hands_list) <= 3 else 3
|
||||||
|
for idx, entry in enumerate(hands_list):
|
||||||
|
r_idx = idx // max_cols
|
||||||
|
c_idx = idx % max_cols
|
||||||
|
|
||||||
|
is_win = entry.get("is_winner", False)
|
||||||
|
is_dead = entry.get("busted", False) or entry.get("folded", False)
|
||||||
|
border_col = ACCENT_GOLD if is_win else (ERROR_FG if is_dead else SUBTLE_BORDER)
|
||||||
|
|
||||||
|
seat_card = tk.Frame(
|
||||||
|
cards_grid, bg=PANEL_BG, padx=10, pady=7,
|
||||||
|
highlightthickness=2 if is_win else 1, highlightbackground=border_col
|
||||||
|
)
|
||||||
|
seat_card.grid(row=r_idx, column=c_idx, padx=5, pady=4, sticky="nsew")
|
||||||
|
|
||||||
|
title_col = ACCENT_GOLD if is_win else (ACCENT_GOTH if entry.get("is_dealer") else FG_COLOR)
|
||||||
|
tk.Label(
|
||||||
|
seat_card, text=entry["owner_label"],
|
||||||
|
font=("Georgia", 10, "bold"), fg=title_col, bg=PANEL_BG
|
||||||
|
).pack()
|
||||||
|
|
||||||
|
c_row = tk.Frame(seat_card, bg=PANEL_BG)
|
||||||
|
c_row.pack(pady=4)
|
||||||
|
for img_name in entry.get("card_images", []):
|
||||||
|
photo = self.assets.get_card_photo(img_name, size=SHOWDOWN_MINI_CARD_SIZE)
|
||||||
|
if photo:
|
||||||
|
self._card_photos.append(photo)
|
||||||
|
tk.Label(c_row, image=photo, bg=PANEL_BG, bd=0).pack(side="left", padx=2)
|
||||||
|
|
||||||
|
badge_col = (
|
||||||
|
"#7be08a" if is_win else (ERROR_FG if is_dead else FG_COLOR)
|
||||||
|
)
|
||||||
|
tk.Label(
|
||||||
|
seat_card, text=entry["rank_label"],
|
||||||
|
font=("Helvetica", 9, "bold"), fg=badge_col, bg=PANEL_BG
|
||||||
|
).pack()
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# GOLD- & XP-ABRECHNUNG
|
||||||
|
# =========================================================
|
||||||
|
info_box = tk.Frame(
|
||||||
|
self, bg=CELL_BG, padx=18, pady=10,
|
||||||
|
highlightthickness=1, highlightbackground=SUBTLE_BORDER
|
||||||
|
)
|
||||||
|
info_box.pack(fill="x", pady=(0, 10))
|
||||||
|
|
||||||
p_net = self.data["player_net"]
|
p_net = self.data["player_net"]
|
||||||
if p_net > 0:
|
if p_net > 0:
|
||||||
|
|
@ -64,39 +144,39 @@ class BlackjackResultDialog(tk.Frame):
|
||||||
else:
|
else:
|
||||||
own_txt, own_col = t("bj_popup_your_even"), FG_COLOR
|
own_txt, own_col = t("bj_popup_your_even"), FG_COLOR
|
||||||
|
|
||||||
tk.Label(info_box, text=own_txt, font=("Helvetica", 12, "bold"), fg=own_col, bg=CELL_BG).pack(pady=3)
|
tk.Label(info_box, text=own_txt, font=("Helvetica", 11, "bold"), fg=own_col, bg=CELL_BG).pack(pady=2)
|
||||||
|
|
||||||
for extra_line in self.data.get("other_gains", []):
|
for extra_line in self.data.get("other_gains", []):
|
||||||
tk.Label(info_box, text=extra_line, font=("Helvetica", 11), fg=MUTED_FG, bg=CELL_BG).pack(pady=2)
|
tk.Label(info_box, text=extra_line, font=("Helvetica", 10), fg=MUTED_FG, bg=CELL_BG).pack(pady=1)
|
||||||
|
|
||||||
tk.Frame(info_box, bg=SUBTLE_BORDER, height=1).pack(fill="x", pady=10)
|
tk.Frame(info_box, bg=SUBTLE_BORDER, height=1).pack(fill="x", pady=6)
|
||||||
|
|
||||||
tk.Label(
|
tk.Label(
|
||||||
info_box, text=t("bj_popup_xp_earned", self.data["xp_gained"]),
|
info_box, text=t("bj_popup_xp_earned", self.data["xp_gained"]),
|
||||||
font=("Helvetica", 12, "bold"), fg=ACCENT_GOTH, bg=CELL_BG,
|
font=("Helvetica", 11, "bold"), fg=ACCENT_GOTH, bg=CELL_BG,
|
||||||
).pack(pady=2)
|
).pack(pady=1)
|
||||||
|
|
||||||
if self.data.get("new_level_title"):
|
if self.data.get("new_level_title"):
|
||||||
tk.Label(
|
tk.Label(
|
||||||
info_box, text=self.data["new_level_title"],
|
info_box, text=self.data["new_level_title"],
|
||||||
font=("Georgia", 11, "bold"), fg=ACCENT_GOLD, bg=CELL_BG,
|
font=("Georgia", 10, "bold"), fg=ACCENT_GOLD, bg=CELL_BG,
|
||||||
).pack(pady=(4, 0))
|
).pack(pady=(3, 0))
|
||||||
|
|
||||||
btn_row = tk.Frame(self, bg=MODAL_BG)
|
btn_row = tk.Frame(self, bg=MODAL_BG)
|
||||||
btn_row.pack(fill="x", pady=(6, 0))
|
btn_row.pack(fill="x", pady=(4, 0))
|
||||||
|
|
||||||
if self.data.get("can_continue", True):
|
if self.data.get("can_continue", True):
|
||||||
ImageButton(
|
ImageButton(
|
||||||
btn_row, t("bj_popup_next_round_btn"),
|
btn_row, t("bj_popup_next_round_btn"),
|
||||||
self.assets.raw_btn, self.assets.raw_btn_active,
|
self.assets.raw_btn, self.assets.raw_btn_active,
|
||||||
self._handle_next, sound_mgr=self.sounds, width=195, height=40, font=("Helvetica", 10, "bold")
|
self._handle_next, sound_mgr=self.sounds, width=195, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=(0, 10))
|
).pack(side="left", padx=(0, 10))
|
||||||
|
|
||||||
if self.data.get("can_leave_menu", True):
|
if self.data.get("can_leave_menu", True):
|
||||||
ImageButton(
|
ImageButton(
|
||||||
btn_row, t("bj_popup_to_menu_btn"),
|
btn_row, t("bj_popup_to_menu_btn"),
|
||||||
self.assets.raw_sel, self.assets.raw_sel_active,
|
self.assets.raw_sel, self.assets.raw_sel_active,
|
||||||
self._handle_menu, sound_mgr=self.sounds, width=165, height=40, font=("Helvetica", 10, "bold")
|
self._handle_menu, sound_mgr=self.sounds, width=165, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="right")
|
).pack(side="right")
|
||||||
|
|
||||||
def _start_gif(self, key: str):
|
def _start_gif(self, key: str):
|
||||||
|
|
@ -119,6 +199,7 @@ class BlackjackResultDialog(tk.Frame):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self._gif_job = None
|
self._gif_job = None
|
||||||
|
self._card_photos.clear()
|
||||||
if self.winfo_exists():
|
if self.winfo_exists():
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -884,4 +884,50 @@ INSERT OR REPLACE INTO base_i18n (key, lang, val) VALUES
|
||||||
('pk_popup_fold_win', 'EN', 'All opponents folded'),
|
('pk_popup_fold_win', 'EN', 'All opponents folded'),
|
||||||
('pk_popup_bot_gain', 'EN', 'Pot profit of {0}: +{1} Gold');
|
('pk_popup_bot_gain', 'EN', 'Pot profit of {0}: +{1} Gold');
|
||||||
|
|
||||||
|
INSERT OR REPLACE INTO base_i18n (key, lang, val) VALUES
|
||||||
|
-- =========================================================================
|
||||||
|
-- DE: BLACKJACK SHOWDOWN & WERTUNGS-ERKLÄRUNGEN
|
||||||
|
-- =========================================================================
|
||||||
|
('bj_showdown_section_title', 'DE', 'Aufgedeckte Hände & Wertung'),
|
||||||
|
('bj_showdown_seat_dealer', 'DE', 'Haus-Dealer'),
|
||||||
|
('bj_showdown_seat_you', 'DE', 'Du'),
|
||||||
|
('bj_showdown_seat_you_hand', 'DE', 'Du (Hand {0})'),
|
||||||
|
('bj_rank_777', 'DE', '★ 7-7-7 Triple Seven (Rang 1) ★'),
|
||||||
|
('bj_rank_natural_bj', 'DE', '★ Blackjack (21 mit 2 Karten) ★'),
|
||||||
|
('bj_rank_split_21', 'DE', '21 Punkte (nach Split = reguläre 21)'),
|
||||||
|
('bj_rank_multi_21', 'DE', '21 Punkte ({0} Karten)'),
|
||||||
|
('bj_rank_points', 'DE', '{0} Punkte ({1} Karten)'),
|
||||||
|
('bj_rank_busted', 'DE', 'Überkauft ({0} Punkte)'),
|
||||||
|
('bj_rank_folded', 'DE', 'Ausgetreten ({0} Punkte)'),
|
||||||
|
('bj_reason_777_win', 'DE', '{0} gewinnt sofort mit 7-7-7 (höchste Blackjack-Hand überhaupt)!'),
|
||||||
|
('bj_reason_all_out', 'DE', 'Alle Herausforderer haben sich überkauft oder sind ausgetreten – die Bank zieht den Pot ein.'),
|
||||||
|
('bj_reason_nat_beats_reg21', 'DE', '{0} gewinnt mit echtem Blackjack (21 aus 2 Startkarten) gegen reguläre 21 (3+ Karten / Split)!'),
|
||||||
|
('bj_reason_777_beats_21', 'DE', '{0} schlägt mit 7-7-7 sogar jede andere 21 / jeden Blackjack!'),
|
||||||
|
('bj_reason_dealer_tie_push', 'DE', 'Gleichwertige Top-Hand mit dem Haus-Dealer ({0}) – Einsatz geht zurück (Push).'),
|
||||||
|
('bj_reason_dealer_bust', 'DE', 'Haus-Dealer überkauft sich ({0}) – {1} gewinnt mit {2}!'),
|
||||||
|
('bj_reason_higher_score', 'DE', '{0} gewinnt mit {1} gegen {2}.'),
|
||||||
|
('bj_reason_split_pot', 'DE', 'Gleichwertige beste Hände ({0}) – der Pot wird geteilt ({1}).'),
|
||||||
|
|
||||||
|
-- =========================================================================
|
||||||
|
-- EN: BLACKJACK SHOWDOWN & EVALUATION REASONS
|
||||||
|
-- =========================================================================
|
||||||
|
('bj_showdown_section_title', 'EN', 'Revealed Hands & Evaluation'),
|
||||||
|
('bj_showdown_seat_dealer', 'EN', 'House Dealer'),
|
||||||
|
('bj_showdown_seat_you', 'EN', 'You'),
|
||||||
|
('bj_showdown_seat_you_hand', 'EN', 'You (Hand {0})'),
|
||||||
|
('bj_rank_777', 'EN', '★ 7-7-7 Triple Seven (Rank 1) ★'),
|
||||||
|
('bj_rank_natural_bj', 'EN', '★ Natural Blackjack (2-card 21) ★'),
|
||||||
|
('bj_rank_split_21', 'EN', '21 Points (after Split = regular 21)'),
|
||||||
|
('bj_rank_multi_21', 'EN', '21 Points ({0} cards)'),
|
||||||
|
('bj_rank_points', 'EN', '{0} Points ({1} cards)'),
|
||||||
|
('bj_rank_busted', 'EN', 'Busted ({0} Points)'),
|
||||||
|
('bj_rank_folded', 'EN', 'Folded ({0} Points)'),
|
||||||
|
('bj_reason_777_win', 'EN', '{0} wins instantly with 7-7-7 (highest possible hand)!'),
|
||||||
|
('bj_reason_all_out', 'EN', 'All contenders busted or folded — the House takes the pot.'),
|
||||||
|
('bj_reason_nat_beats_reg21', 'EN', '{0} wins with a Natural Blackjack (2-card 21) over a regular 21 (3+ cards / Split)!'),
|
||||||
|
('bj_reason_777_beats_21', 'EN', '{0} beats every other 21 / Blackjack with 7-7-7!'),
|
||||||
|
('bj_reason_dealer_tie_push', 'EN', 'Equal top hand with the House Dealer ({0}) — bet returned (Push).'),
|
||||||
|
('bj_reason_dealer_bust', 'EN', 'House Dealer busts ({0}) — {1} wins with {2}!'),
|
||||||
|
('bj_reason_higher_score', 'EN', '{0} wins with {1} against {2}.'),
|
||||||
|
('bj_reason_split_pot', 'EN', 'Tied best hands ({0}) — pot is split ({1}).');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
BIN
user_data.db
BIN
user_data.db
Binary file not shown.
Loading…
Reference in New Issue