#!/usr/bin/env bash
# Author: chal55rus
# type: games
# name: Lost Light
# image: lostlight
# info_en: A multiplayer first-person shooter with survival elements, where players explore a post-apocalyptic world and fight for resources. Players must team up to overcome dangers and complete missions, while constantly feeling the tension from potential encounters with other groups.
# info_ru: Многопользовательская игра в жанре шутера от первого лица с элементами выживания, где игроки исследуют постапокалиптический мир и сражаются за ресурсы. Игроки должны объединяться в команды, чтобы преодолевать опасности и выполнять миссии, при этом постоянно испытывая напряжение от возможных столкновений с другими группами.
########################################################################
export PW_PREFIX_NAME="LOST_LIGHT"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/LostLight_installer.exe"
export PORTWINE_CREATE_SHORTCUT_NAME="Lost Light"

URL_LOST_LIGHT="$(curl -s --list-only "https://adl.easebar.com/d/g/yhtj/c/lostlightcspc" | grep 'var pc_link =' | awk -F\" '{print $2}')"

start_portproton
if try_download "${URL_LOST_LIGHT}" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/LostLight"
    export PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/LostLight/launcher.exe"
    pw_create_unique_exe "lostlight_launcher_pp"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${PW_EXE_FILE}.ppdb"
    kill_portwine
    portwine_create_shortcut
fi
stop_portproton
