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

###
# Knights of Pen and Paper expansions:
# - Deluxier Edition
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260707.1

PLAYIT_COMPATIBILITY_LEVEL=2.35

GAME_ID=knights-of-pen-and-paper
GAME_NAME='Knights of Pen and Paper'

EXPANSION_ID_DELUXIER=deluxier
EXPANSION_NAME_DELUXIER='Deluxier Edition'

ARCHIVE_BASE_DELUXIER_0_NAME='gog_knights_of_pen_and_paper_1_deluxier_edition_upgrade_2.0.0.1.sh'
ARCHIVE_BASE_DELUXIER_0_MD5=b3033693afd93cc885883aede7ede4b0
ARCHIVE_BASE_DELUXIER_0_SIZE=1457
ARCHIVE_BASE_DELUXIER_0_VERSION=2.34c-1

CONTENT_PATH_DEFAULT='data/noarch/game'
CONTENT_GAME_MAIN_FILES='
knightspp_Data/Managed/Assembly-CSharp.dll'

PKG_PARENT_ID=$GAME_ID
PKG_COMMON_ID=${GAME_ID}-common

PKG_MAIN_PROVIDES="
$PKG_COMMON_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 game data.

archive_extraction_default

# Include game data.

content_inclusion_default

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
