#!/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="${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
