#!/usr/bin/env bash
# Author: chal55rus
# type: games
# name: Elsword (ENG)
# image: elsword
# info_en: An anime-style MMORPG that combines elements of a platformer and a real-time combat system, allowing players to fight in exciting dungeons and PvP arenas. The game offers a variety of characters with unique skills, as well as opportunities for customization and playing together with friends.
# info_ru: MMORPG c аниме-стилем, которая сочетает в себе элементы платформера и боевой системы в реальном времени, позволяя игрокам сражаться в захватывающих подземельях и PvP-аренах. Игра предлагает множество персонажей с уникальными навыками, а также возможности для кастомизации и совместной игры с друзьями.
########################################################################
export PW_WINE_USE="WINE_LG"
export PW_PREFIX_NAME="ELSWORD"
export LAUNCH_PARAMETERS="/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/ElswordInstaller_NA(64bit).exe"
export PORTWINE_CREATE_SHORTCUT_NAME="Elsword"

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