#!/usr/bin/env bash
# Author: cefeiko
# type: games
# name: Wargaming Game Center
# image: wgc
# info_en: Launcher for Wargaming studio games.
# info_ru: Лаунчер для игр Wargaming.
########################################################################
export LAUNCH_PARAMETERS="/VERYSILENT"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/Wargaming_Game_Center_Install_WoT_EU.exe"
export PW_PREFIX_NAME="WGC"

start_portproton
if try_download "https://redirect.wargaming.net/WGC/Wargaming_Game_Center_Install_WoT_EU.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    pw_kill_autostart wgc.exe &
    pw_run "${PW_AUTOINSTALL_EXE}"
    PW_EXE_FILE="$WINEPREFIX/drive_c/ProgramData/Wargaming.net/GameCenter/api/wgc_api.exe"
    export PORTWINE_CREATE_SHORTCUT_NAME="Wargaming Game Center"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${PW_EXE_FILE}.ppdb"
    kill_portwine
    portwine_create_shortcut
fi
stop_portproton
