#!/usr/bin/env bash
# Author: chal55rus
# type: games
# name: Albion Online
# image: albiononline
# info_en: A multiplayer sandbox MMORPG where players can explore an open world, engage in crafting, gather resources, and battle against other players. The game features a unique class system that allows players to change their roles based on the gear they equip.
# info_ru: Многопользовательская песочница в жанре MMORPG, где игроки могут исследовать открытый мир, заниматься ремеслом, добычей ресурсов и сражаться с другими игроками. Игра предлагает уникальную систему классов, позволяющую игрокам изменять свои роли в зависимости от выбранного снаряжения.
########################################################################
export PW_PREFIX_NAME="ALBION_ONLINE"
export LAUNCH_PARAMETERS="/S"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/albion-online-setup.exe"
export PORTWINE_CREATE_SHORTCUT_NAME="Albion Online"

start_portproton
if try_download "https://live.albiononline.com/clients/20260311101310/albion-online-setup.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    pw_run "${PW_AUTOINSTALL_EXE}"
    PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/AlbionOnline/launcher/AlbionLauncher.exe"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${PW_EXE_FILE}.ppdb"
    kill_portwine
    portwine_create_shortcut
fi
stop_portproton
