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

###
# Gobliins 6
# send your bug reports to vv221@dotslashplay.it
###

script_version=20260325.1

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='goblins-6'
GAME_NAME='Gobliins 6: Le Prince Bouffon - Les Fous de l’An 1000'

# DRM-free build sent by the developer to backers
ARCHIVE_BASE_DIRECT_0_NAME='Windows.rar'
ARCHIVE_BASE_DIRECT_0_MD5='357f615a8542dcaa52a1c16907a95b02'
ARCHIVE_BASE_DIRECT_0_SIZE='1411322'
ARCHIVE_BASE_DIRECT_0_VERSION='1.0-1'

ARCHIVE_BASE_ITCH_3_NAME='gobliins6-windows.zip'
ARCHIVE_BASE_ITCH_3_MD5='e4c20da15f7295ab33998eaad5b017b0'
ARCHIVE_BASE_ITCH_3_SIZE='1411328'
ARCHIVE_BASE_ITCH_3_VERSION='1.0-itch.2026.03.20'
ARCHIVE_BASE_ITCH_3_URL='https://pierre-gilhodes.itch.io/gobliins6'

ARCHIVE_BASE_ITCH_2_NAME='gobliins6-windows.zip'
ARCHIVE_BASE_ITCH_2_MD5='4a4e22e258f10ed820e05440e29d01b1'
ARCHIVE_BASE_ITCH_2_SIZE='1411326'
ARCHIVE_BASE_ITCH_2_VERSION='1.0-itch.2026.02.27'

ARCHIVE_BASE_ITCH_1_NAME='gobliins6-windows.zip'
ARCHIVE_BASE_ITCH_1_MD5='2101a3a8164c9a87569f5bd12ab6df0d'
ARCHIVE_BASE_ITCH_1_SIZE='1411323'
ARCHIVE_BASE_ITCH_1_VERSION='1.0-itch.2026.02.12'

ARCHIVE_BASE_ITCH_0_NAME='gobliins6-windows.zip'
ARCHIVE_BASE_ITCH_0_MD5='08ae2a6bc2874d2ff867c8d584ed1826'
ARCHIVE_BASE_ITCH_0_SIZE='1411322'
ARCHIVE_BASE_ITCH_0_VERSION='1.0-itch.2026.02.10'

GAME_ENGINE='ags'

CONTENT_PATH_DEFAULT='.'

APP_MAIN_SCUMMID='ags'
APP_MAIN_ICON='Gobliins6.exe'

# 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 'libplayit2.sh not found.\n'
	exit 1
fi
# shellcheck source=libplayit2.sh
. "$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
