#!/usr/bin/env bash
# Author: chal55rus
# type: games
# name: Elsword (ENG)
# image: elsword
# info_en:
# info_ru:
########################################################################
export PW_WINE_USE="WINE_LG"
export PW_PREFIX_NAME="ELSWORD"
export LAUNCH_PARAMETERS=("/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-")
export PW_AUTOINSTALL_EXE="${PW_USER_TEMP}/ElswordInstaller_NA(64bit).exe"
export PORTWINE_CREATE_SHORTCUT_NAME="Elsword"

start_portwine
if try_download "https://elsword-us.dn.playkog.com/Download/Downloader/ElswordInstaller_NA(64bit).exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    pw_start_progress_bar_install_game "Elsword."
    pw_run "${PW_AUTOINSTALL_EXE}"
    portwine_exe="$WINEPREFIX/drive_c/KOGGames/Elsword64/elsword.exe"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${portwine_exe}.ppdb"
    kill_portwine
    pw_stop_progress_bar
    portwine_create_shortcut
fi
stop_portwine
