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

###
# Sunless Skies expansions:
# - Cyclopean Owl
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260710.1

PLAYIT_COMPATIBILITY_LEVEL=2.35

GAME_ID='sunless-skies'
GAME_NAME='Sunless Skies'

EXPANSION_ID_OWL='cyclopean-owl'
EXPANSION_NAME_OWL='Cyclopean Owl'

ARCHIVE_BASE_OWL_3_NAME='sunless_skies_cyclopean_owl_2_0_5_6e8c8ff_74416.sh'
ARCHIVE_BASE_OWL_3_MD5=163712d560736a51eb51fda83cee7336
ARCHIVE_BASE_OWL_3_SIZE=899
ARCHIVE_BASE_OWL_3_VERSION=2.0.5-1

ARCHIVE_BASE_OWL_2_NAME='sunless_skies_cyclopean_owl_2_0_4_fcf0af7a_52215.sh'
ARCHIVE_BASE_OWL_2_MD5=c3749871147607f488f58881b30b9600
ARCHIVE_BASE_OWL_2_SIZE=1300
ARCHIVE_BASE_OWL_2_VERSION=2.0.4-1

ARCHIVE_BASE_OWL_0_NAME='sunless_skies_cyclopean_owl_2_0_2_9bcd3d8c_48199.sh'
ARCHIVE_BASE_OWL_0_MD5=9d0dee370093bce46c35dc114c0d6241
ARCHIVE_BASE_OWL_0_SIZE=1300
ARCHIVE_BASE_OWL_0_VERSION=2.0.2-1


CONTENT_PATH_DEFAULT='data/noarch/game'
CONTENT_GAME_MAIN_FILES='
dlc'

PKG_PARENT_ID=$GAME_ID
PKG_MAIN_DEPENDENCIES_SIBLINGS=PKG_PARENT

# 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 archive contents.

archive_extraction_default

# Work around directory name case mismatch.

path_archive_contents=$(path_archive_contents)
if [ -e "${path_archive_contents}/DLC" ]; then
	mv \
		"${path_archive_contents}/DLC" \
		"${path_archive_contents}/dlc"
fi

# Include game data.

content_inclusion_default

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
