#!/bin/sh
# SPDX-License-Identifier: ACSL
# SPDX-FileCopyrightText: © 2023 Fabien Givors <captnfab@debian-facile.org>
# SPDX-FileCopyrightText: © 2024 Antoine Le Gonidec <vv221@dotslashplay.it>
set -o errexit

###
# Heroine's Quest: The Herald of Ragnarok
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260615.1

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='heroines-quest-the-herald-of-ragnarok'
GAME_NAME='Heroine’s Quest: The Herald of Ragnarok'

ARCHIVE_BASE_FIREFLOWER_0_NAME='Heroines_Quest_Linux.zip'
ARCHIVE_BASE_FIREFLOWER_0_MD5='a421c0e15731510130d26343942f2553'
ARCHIVE_BASE_FIREFLOWER_0_SIZE='487786'
ARCHIVE_BASE_FIREFLOWER_0_VERSION='1.2.3-1'
ARCHIVE_BASE_FIREFLOWER_0_URL='https://fireflowergames.com/products/heroines-quest'

ARCHIVE_BASE_GOG_0_NAME='heroine_s_quest_the_herald_of_ragnarok_1_2_9_2_68339.sh'
ARCHIVE_BASE_GOG_0_MD5='a9cfa6ca34e28fa4b06d7d6fc565421d'
ARCHIVE_BASE_GOG_0_SIZE='500000'
ARCHIVE_BASE_GOG_0_VERSION='1.2.9.2-1'

AGS_NAME='heroinesquest'

CONTENT_PATH_DEFAULT_FIREFLOWER='.'
CONTENT_PATH_DEFAULT_GOG='data/noarch/game/data'
CONTENT_DOC_MAIN_FILES='
history.txt'
CONTENT_DOC0_MAIN_RELATIVE_PATH_GOG='..'
CONTENT_DOC0_MAIN_FILES='
*.pdf'

APP_MAIN_ICON_FIREFLOWER="Heroine's Quest.exe"
APP_MAIN_ICON_GOG='../../support/icon.png'

# Easier upgrades from pre-20241216.2 packages
PKG_MAIN_PROVIDES='
heroines-quest-the-herald-of-ragnarok-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
. "$PLAYIT_LIB2"

# Run default initialisation actions.

initialization_default "$@"

# Extract game data.

archive_extraction_default

# Include game data.

content_inclusion_icons
content_inclusion_default

# Write launchers.

launchers_generation

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
