#!/usr/bin/env bash
# Author: chal55rus
# type: games
# name: Broken Ranks (ENG)
# image: brokenranks
# info_en: An MMORPG game offering deep sleep and a unique combat system that focuses on the strategy and activities of the person. Players explore a dark world full of intrigue and danger, developing their characters and making key decisions that affect the course of history.
# info_ru: MMORPG игра, предлагающая глубокий сон и уникальную боевую систему, которая ориентирует внимание на стратегию и деятельность персоны. Игроки исследуют мрачный мир, полный интриг и опасностей, развивая своих героев и принимая ключевые решения, влияющие на ход истории.
########################################################################
export PW_PREFIX_NAME="BROKEN_RANKS"
export LAUNCH_PARAMETERS="/q"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/BrokenRanksInstaller.exe"
export PORTWINE_CREATE_SHORTCUT_NAME="Broken Ranks"

start_portproton
if try_download "https://eu.brokenranks.com/BrokenRanksInstaller.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    pw_kill_autostart ConsoleLauncher.exe &
    pw_run "${PW_AUTOINSTALL_EXE}"
    PW_EXE_FILE="$WINEPREFIX/drive_c/Whitemoon/BrokenRanks/ConsoleLauncher.exe"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${PW_EXE_FILE}.ppdb"
    kill_portwine
    portwine_create_shortcut
fi
stop_portproton
