#!/bin/sh
# SPDX-License-Identifier: ACSL
# SPDX-FileCopyrightText: © 2021 Mopi
# SPDX-FileCopyrightText: © 2024 Antoine Le Gonidec <vv221@dotslashplay.it>
set -o errexit

###
# Lumino City
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260418.1

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='lumino-city'
GAME_NAME='Lumino City'

ARCHIVE_BASE_0_NAME='setup_lumino_city_1.0_(21180).exe'
ARCHIVE_BASE_0_MD5='32f0e9251c7936180321f30811bab8d9'
ARCHIVE_BASE_0_TYPE='innosetup'
ARCHIVE_BASE_0_SIZE='930000'
ARCHIVE_BASE_0_VERSION='1.0-gog21180'
ARCHIVE_BASE_0_URL='https://www.gog.com/game/lumino_city'

# AIR_NAME is not supported by the library yet,
# the current game script is a prototype.
# (./play.it 2.35)
AIR_NAME='Lumino City'

CONTENT_PATH_DEFAULT='.'
CONTENT_GAME_BIN_FILES="
Adobe AIR
META-INF
mimetype
${AIR_NAME}.exe"
CONTENT_GAME_DATA_FILES='
assets
LumeMenu.swf'

WINE_PERSISTENT_DIRECTORIES='
users/${USER}/AppData/Roaming/com.stateofplaygames.LuminoCity'

APP_MAIN_EXE="${AIR_NAME}.exe"
APP_MAIN_ICONS_LIST='
APP_MAIN_ICON_128
APP_MAIN_ICON_152
APP_MAIN_ICON_512
APP_MAIN_ICON_1024'
APP_MAIN_ICON_128='assets/icons/LuminoCity-128.png'
APP_MAIN_ICON_152='assets/icons/LuminoCity-152.png'
APP_MAIN_ICON_512='assets/icons/LuminoCity-512.png'
APP_MAIN_ICON_1024='assets/icons/LuminoCity-1024.png'

PACKAGES_LIST='
PKG_BIN
PKG_DATA'

PKG_BIN_ARCH='32'
PKG_BIN_DEPENDENCIES_SIBLINGS='
PKG_DATA'

PKG_DATA_ID="${GAME_ID}-data"
PKG_DATA_DESCRIPTION='data'

# Load common functions.

if [ -z "$PLAYIT_LIB2" ]; then
	for playit_lib_dir in \
		"$PWD" \
		"${HOME}/.local/lib/play.it" \
		'/usr/local/lib/play.it' \
		'/usr/lib/play.it'
	do
		playit_lib_path="${playit_lib_dir}/libplayit.sh.2"
		if [ -e "$playit_lib_path" ]; then
			PLAYIT_LIB2="$playit_lib_path"
			break
		fi
	done
fi
if [ -z "$PLAYIT_LIB2" ]; then
	printf '\n\033[1;31mError:\033[0m\n'
	printf 'libplayit.sh.2 not found.\n'
	exit 1
fi
# shellcheck source=libplayit.sh.2
. "$PLAYIT_LIB2"

# Run default initialisation actions.

initialization_default "$@"

# Extract game data.

archive_extraction_default

# Include game data.

content_inclusion_icons 'PKG_DATA'
content_inclusion_default

# Write launchers.

launchers_generation

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
