code:
#! /usr/bin/env dash
#	$Id: sbdep,v 1.33 2024/09/12 16:32:39 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

usage() {
cat << EOF
usage: ${0##*/} [OPTS] PRGNAM [PRGNAM2 [...]]
-e     check for additional dependencies in $ENVDIR
-E     specify path to ENVDIR (implies -e)
-r     show packages already installed as well
-s     print only the name, without the category
-S     slackbuilds directory
-T     specify a different TAG
-V     print version information
EOF
	exit 1
}

while getopts eE:rsS:T:V f 2>/dev/null; do
	case "$f" in
	e)	readenv=1 ;;
	E)	readenv=1 ; ENVDIR=$OPTARG ;;
	r)	rebuild=1 ;;
	s)	short=1 ;;
	S)	SLACKBUILDS=$OPTARG ;;
	T)	TAG=$OPTARG ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

[ $# = 0 ] && usage

chkdir SLACKBUILDS "$SLACKBUILDS"
[ -n "$readenv" ] && chkdir ENVDIR "$ENVDIR"

SLACKBUILDS=$(echo "$SLACKBUILDS" | sed 's/\/*$//')

get_deps() {
	local dep catnam

	[ -f "$ENVDIR/$1.deps" ] || return 1

	while read -r dep; do
		if [ -n "$short" ]; then
			_deps "$SLACKBUILDS/"*/"$dep/$dep.info"
		else
			catnam=$(find		\
			-L "$SLACKBUILDS"	\
			-type d			\
			-maxdepth 2		\
			-name "$dep"		\
			-printf "%P\\n")
			if [ -n "$catnam" ]; then
				_deps	\
				"$SLACKBUILDS/$catnam/${catnam##*/}.info"
			fi
		fi

		if ! _seen "$dep" "$deps"; then
			deps="$deps $dep"
			[ -z "$short" ] && catn="$catn $catnam"
		fi
	done < "$ENVDIR/$1.deps"
}

_deps() {
	local PRGNAM REQUIRES req nam info=$1
	_source "$info"
	[ -n "$readenv" ] && get_deps "$PRGNAM"
	for req in $REQUIRES; do
		if [ "$req" = %README% ]; then
			_echo "# Check ${info%/*}/README for additional dependencies"
			continue
		fi

		_seen "$req" "$deps" && continue

		if [ -n "$short" ]; then
			_deps "$SLACKBUILDS"/*/"$req/$req.info"
		else
			nam=$(find		\
			-L "$SLACKBUILDS"	\
			-type d			\
			-maxdepth 2		\
			-name "$req"		\
			-printf "%P\\n")
			if [ -n "$nam" ]; then
				_deps "$SLACKBUILDS/$nam/${nam##*/}.info"
			fi
		fi
		deps="$deps $req"
		[ -z "$short" ] && catn="$catn $nam"
		[ -n "$readenv" ] && get_deps "$req"
	done
}

for arg; do
	case "$arg" in
	*/*)
		_deps "$SLACKBUILDS/$arg/${arg##*/}.info"
		;;
	*)
		cat=$(find		\
		-L "$SLACKBUILDS"	\
		-type d			\
		-maxdepth 2		\
		-name "$arg"		\
		-printf "%P\\n")
		_deps "$SLACKBUILDS/$cat/$arg.info"
		;;
	esac

	if [ -n "$short" ]; then
		if ! _seen "${arg##*/}" "$deps"; then
			deps="$deps ${arg##*/}"
		fi
	elif ! _seen "${cat##*/}" "$deps"; then
		deps="$deps ${cat##*/}"
		catn="$catn $cat"
	fi
done

if [ -n "$short" ]; then
	alldeps="$deps"
else
	alldeps="$catn"
fi

if [ -n "$rebuild" ] && [ -n "$alldeps" ]; then
	for d in $alldeps; do
		echo "$d"
	done
elif [ -n "$alldeps" ]; then
	for d in $alldeps; do
		setup_vals "$d"
		test -f "$VLP/$PRGNAM-$VERSION"-*-"$CBUILD$TAG" || echo "$d"
	done
fi

path: sbdep


code:
#! /usr/bin/env dash
#	$Id: sbdist,v 1.32 2024/09/12 16:32:39 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

prog=${0##*/}

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

usage() {
cat << EOF
usage: ${0##*/} [OPTS]
-c     distfiles directory does not use subdirectories
-D     path to distfiles directory
-S     path to slackbuilds directory
-T     TAG to use when using -c
-u     remove all distfiles of SlackBuilds no longer installed
-V     print version information
EOF
	exit 1
}

while getopts cD:S:T:uV f 2>/dev/null; do
	case "$f" in
	c)	nosub=1 ;;
	D)	DISTFILES=$OPTARG ;;
	S)	SLACKBUILDS=$OPTARG ;;
	T)	TAG=$OPTARG ;;
	u)	uninstalled=1 ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

chkdir DISTFILES "$DISTFILES"
chkdir SLACKBUILDS "$SLACKBUILDS"

SLACKBUILDS=$(echo "$SLACKBUILDS" | sed 's/\/*$//')
DISTFILES=$(echo "$DISTFILES" | sed 's/\/*$//')

tmpd=$(mktemp -d -t "$prog".XXXXXX) || exit 1
allfiles=$(mktemp -p "$tmpd" "$prog".XXXXXX)
installed=$(mktemp -p "$tmpd" "$prog".XXXXXX)
installed_sorted=$(mktemp -p "$tmpd" "$prog".XXXXXX)
downloads=$(mktemp -p "$tmpd" "$prog".XXXXXX)
downloads_sorted=$(mktemp -p "$tmpd" "$prog".XXXXXX)

cleanup() {
	[ -d "$tmpd" ] && rm -f "$tmpd"/*
	rmdir "$tmpd"
	exit "${1:-1}"
}
trap cleanup INT

ARCH=${ARCH:-$(uname -m)}

find -L "$DISTFILES" -type f | sort |	\
grep -v -e /LATEST -e /local > "$allfiles"

if [ -n "$uninstalled" ]; then
	names=$(find "$VLP"/*"$TAG" |	\
	cut -f5 -d / | rev | cut -f4- -d - | rev)

	:> "$installed"
	for n in $names; do
		grep /"$n" "$allfiles" >> "$installed"
	done
	sort "$installed" | uniq > "$installed_sorted"
	comm -2 -3 "$allfiles" "$installed_sorted" | sed 's/.*/"&"/g'
	cleanup 0
fi

if [ -n "$nosub" ]; then
	# shellcheck disable=2035
	if _ls *"$TAG"; then
		names=$(find "$VLP"/*"$TAG" |	\
		cut -f5 -d / | rev | cut -f4- -d - | rev)
	else
		_echo "no packages with tag $TAG installed"
		cleanup
	fi
else
	cd "$DISTFILES" || cleanup 1
	names=$(find . -type d -mindepth 2 -maxdepth 2 | sed 's/\.\///g')
fi

for n in $names; do
	if [ -n "$nosub" ]; then
		if test -f "$SLACKBUILDS/"*/"$n/$n.info"; then
			. "$SLACKBUILDS/"*/"$n/$n.info"
		else
			continue
		fi
	else
		if test -f "$SLACKBUILDS/$n/${n##*/}.info"; then
			. "$SLACKBUILDS/$n/${n##*/}.info"
		else
			continue
		fi
	fi

	# (Sourced via .info file.)
	if [ -n "$DOWNLOAD_x86_64" ]; then
		case "${DOWNLOAD_x86_64%%:*}" in
		http|https|ftp)
			[ "$ARCH" = x86_64 ] &&	\
			DL=$DOWNLOAD_x86_64 ||	\
			DL=$DOWNLOAD
			;;
		*)	DL=$DOWNLOAD ;;
		esac
	else
		DL=$DOWNLOAD
	fi
	for d in $DL; do
		if [ -n "$nosub" ]; then
			echo "$DISTFILES/${d##*/}" >> "$downloads"
		else
			echo "$DISTFILES/$n/${d##*/}" >> "$downloads"
		fi
	done
done

sort "$downloads" > "$downloads_sorted"

comm -2 -3 "$allfiles" "$downloads_sorted" | sed 's/.*/"&"/g'

cleanup 0

repo_name: lems/simbo

path: sbdist


code:
#! /usr/bin/env dash
#	$Id: sbfetch,v 1.35 2025/07/03 18:27:23 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

FETCHCMD=${FETCHCMD:-"wget -q --show-progress -O"}

usage() {
cat << EOF
usage: ${0##*/} [OPTS] [PRGNAM [PRGNAM2 [...]]]
-c     don't use a subdirectory structure
-C     override FETCHCMD, default: $FETCHCMD
-D     location of distfiles directory
-f     force download (combine with -c/-C of wget/curl)
-i     ignore download failure (exits with status of 0 instead of 1)
-M     the MD5SUM/MD5SUM_x86_64 value (simbo)
-N     the category/name part (simbo)
-p     to be used with xargs and sbchksum
-S     location of slackbuilds directory
-U     the DOWNLOAD/DOWNLOAD_x86_64 value (simbo)
-v     print URL and path to file (in case it exists)
-V     print version information
EOF
	exit 1
}

while getopts cC:D:fiM:N:pS:U:vV f 2>/dev/null; do
	# (Used via checkfuncs.sh.)
	# shellcheck disable=SC2034
	case "$f" in
	c)	nosub=1 ;;
	C)	FETCHCMD=$OPTARG ;;
	D)	DISTFILES=$OPTARG ;;
	f)	force=1 ;;
	i)	ignore=1 ;;
	M)	SUMS=$OPTARG ; skipinfo=1 ;;
	N)	NAME=$OPTARG ; skipinfo=1 ;;
	p)	print=1 ;;
	S)	SLACKBUILDS=$OPTARG ;;
	U)	DLS=$OPTARG ; skipinfo=1 ;;
	v)	verbose=1 ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

if [ $# = 0 ]; then
	[ -z "$skipinfo" ] && usage
fi

_source "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/checkfuncs.sh"

# shellcheck disable=SC2086
[ -n "$NAME" ] && set -- $NAME
exitstatus=0

for prog; do
	# shellcheck disable=SC2086
	setup_lists $prog
	count=0
	toprint=
	# (checkfuncs.sh)
	# shellcheck disable=SC2154
	while read -r dl; do
		count=$((count + 1))
		if [ -n "$nosub" ]; then
			DEST="$DISTFILES"
		else
			DEST="$DISTFILES/$dir"
		fi

		dist="$DEST/${dl##*/}"

		if [ ! -d "$DEST" ]; then
			mkdir -p "$DEST" ||	\
			cleanup 1
		fi

		recd_md5=$(sed -n "${count}"p "$md5sums")
		m5_st=$(echo "$recd_md5" | cut -b1)
		m5_nd=$(echo "$recd_md5" | cut -b2)

		if [ ! -s "$dist" ] || ishtml "$dist"	\
		|| [ "$force" = 1 ]; then
			[ "$force" = 1 ] || rm -f "$dist"
			_verbose "$dir: $dl"
			$FETCHCMD "$dist" "$dl"
		else
			_verbose "$dist exists" >&2
		fi
		URLS="
		https://sourceforge.net/projects/slackbuildsdirectlinks/files/${dir##*/}/${dl##*/}
		http://pkgs.fedoraproject.org/repo/pkgs/${dir##*/}/${dl##*/}/$recd_md5/${dl##*/}
		http://ftp.osuosl.org/pub/gentoo/distfiles/${dl##*/}
		http://distcache.FreeBSD.org/ports-distfiles/${dl##*/}
		http://ftp.netbsd.org/pub/pkgsrc/distfiles/${dl##*/}
		http://slackware.uk/sbosrcarch/by-md5/$m5_st/$m5_nd/$recd_md5/${dl##*/}
		"
		for u in $URLS; do
			if [ ! -s "$dist" ] || ishtml "$dist"; then
				rm -f "$dist"
				_verbose "trying $u"
				$FETCHCMD "$dist" "$u"
			else
				break
			fi
		done

		if [ ! -s "$dist" ] || ishtml "$dist"; then
			_echo "unable to retrieve ${dl##*/}"
			[ "$ignore" = 1 ] || exitstatus=1
		else
			[ -n "$print" ] && toprint=$dir
		fi
	done < "$downloads"
	[ -n "$print" ] && echo "$toprint"
done
cleanup "$exitstatus"

path: sbfetch


code:
#! /usr/bin/env dash
#	$Id: sbinfo,v 1.33 2025/07/09 05:12:21 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

usage() {
cat << EOF
usage: ${0##*/} [OPTS] PRGNAM [PRGNAM2 [...]]
-a     use wildcards around PRGNAM, producing more matches
-b     show SlackBuild
-i     show .info file
-p     display category/name only
-r     show slack-desc
-R     show README
-s     suppress category
-S     path to slackbuilds directory
-t     search TAGS.txt, if available; specify twice to colourize output
-v     print version of SlackBuild
-V     print version information
EOF
	exit 1
}

optsum=0
while getopts abiprRsS:t:vV f 2>/dev/null; do
	case "$f" in
	a)	all=1 ;;
	b)	optsum=$((optsum+1)) ; show_build=1 ;;
	i)	optsum=$((optsum+1)) ; info=1 ;;
	p)	noinfo=1 ;;
	r)	optsum=$((optsum+1)) ; show_desc=1 ;;
	R)	optsum=$((optsum+1)) ; show_readme=1 ;;
	s)	short=1 ;;
	S)	SLACKBUILDS=$OPTARG ;;
	t)
		tag=1
		if [ "$OPTARG" = t ]; then
			do_colour=1
		else
			t_keyword=$OPTARG
		fi
		;;
	v)	version=1 ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

if [ "$optsum" -gt 1 ]; then
	_echo "must use only one of -b, -i, -r, -R"
	exit 1
fi

chkdir SLACKBUILDS "$SLACKBUILDS"
SLACKBUILDS=$(echo "$SLACKBUILDS" | sed 's/\/*$//')

if [ "$tag" = 1 ]; then
	TAGS=$SLACKBUILDS/TAGS.txt
	if [ -f "$TAGS" ]; then
		if [ -n "$do_colour" ]; then
			grep -i --color=always "$1" "$TAGS"
		else
			grep -i --color=no "$t_keyword" "$TAGS"
		fi
	else
		_echo "\`$TAGS' does not exist"
		exit 1
	fi
	exit 0
fi

[ $# = 0 ] && usage

_names=$(mktemp -t "${0##*/}".XXXXXX) || exit 1
trap 'rm -f "$_names" ; exit 1' INT EXIT

for arg; do
	[ -n "$all" ] && arg=\*$arg\*
	find 	\
	-L "$SLACKBUILDS"	\
	-type d			\
	-maxdepth 2		\
	-name "$arg"		\
	-printf "%P\\n"		\
	> "$_names"

	while IFS= read -r name; do
		shortn="${name##*/}"

		sdesc="$SLACKBUILDS/$name/slack-desc"
		info_file="$SLACKBUILDS/$name/$shortn.info"
		readme="$SLACKBUILDS/$name/README"
		sbuild="$SLACKBUILDS/$name/$shortn.SlackBuild"

		if [ "$noinfo" = 1 ]; then
			echo "$name"
		elif [ "$show_readme" = 1 ]	\
		|| [ "$show_desc" = 1 ]		\
		|| [ "$info" = 1 ]		\
		|| [ "$show_build" = 1 ]; then
			if [ "$show_readme" = 1 ]; then
				_file="$readme"
			elif [ "$show_desc" = 1 ]; then
				_file="$sdesc"
			elif [ "$info" = 1 ]; then
				_file="$info_file"
			elif [ "$show_build" = 1 ]; then
				_file="$sbuild"
			fi
			if [ -e "$_file" ]; then
				_whence "$PAGER" || PAGER="cat"
				case "$_file" in
				*/README|*/$shortn.info|*/$shortn.SlackBuild)
					$PAGER "$_file"
					;;
				*/slack-desc)
					grep "$shortn": "$_file"	\
					| $PAGER
					;;
				esac
			else
				_echo "\`$_file': not found for $name"
				exit 1
			fi
		elif [ -f "$sdesc" ]; then
			desc=$(grep ^"${name##*/}": -m1 "$sdesc"	\
			| sed -e 's/.*://')

			# Remove program name and braces from description
			brace_name="${name##*/}"
			# leading whitespace
			desc="${desc# "$brace_name" (}"
			desc="${desc%)*}"

			_name="$name"
			[ "$short" = 1 ] && _name="$shortn"

			if [ -n "$version" ]; then
				_source "$SLACKBUILDS/$name/${name##*/}.info"
				# (Part of .info file.)
				# shellcheck disable=SC2153
				printf "%s (%s): %s" "$_name" "$VERSION" "$desc"
			else
				printf "%s: %s" "$_name" "$desc"
			fi
			echo
		else
			_echo "no slack-desc found for $name"
			exit 1
		fi
	done < "$_names"
done
rm -f "$_names" || exit 1
exit 0

path: sbinfo


code:
#! /usr/bin/env dash
#	$Id: sbobsolete,v 1.9 2024/09/12 16:32:39 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

usage() {
cat << EOF
usage: ${0##*/} [OPTS]
-S     path to slackbuilds directory
-T     tag to use [$TAG]
-V     print version information
EOF
	exit 1
}

while getopts S:T:V f 2>/dev/null; do
	case "$f" in
	S)	SLACKBUILDS=$OPTARG ;;
	T)	TAG=$OPTARG ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

chkdir SLACKBUILDS "$SLACKBUILDS"

for pkg in "$VLP"/*"$TAG"; do
	name=${pkg##*/}
	name=${name%-*}
	name=${name%-*}
	name=${name%-*}

	test -f "$SLACKBUILDS/"*/"$name/$name.info" ||	\
	echo "$name"
done

path: sbobsolete


code:
#! /usr/bin/env dash
#	$Id: sbupdate,v 1.42 2025/07/10 05:38:28 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

usage() {
cat << EOF
usage: ${0##*/} [OPTS]
-a     display all packages of TAG
-b     ignore SlackBuilds listed in SBO_BLACKLIST
-B     blacklist SlackBuilds, separated by a comma
-i     display old and new version
-S     path to slackbuilds directory
-T     tag to use [$TAG]
-V     print version information
EOF
	exit 1
}

while getopts aB:biS:T:V f 2>/dev/null; do
	case "$f" in
	a)	all=1 ;;
	B)	blacklist=1 ; _blacklist=$OPTARG ;;
	b)	blacklist=1 ;;
	i)	info=1 ;;
	S)	SLACKBUILDS=$OPTARG ;;
	T)	TAG=$OPTARG ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

chkdir SLACKBUILDS "$SLACKBUILDS"

for pkg in "$VLP"/*"$TAG"; do
	name=${pkg##*/}
	name=${name%-*}
	name=${name%-*}
	name=${name%-*}

	if [ "$blacklist" = 1 ]; then
		if [ -n "$_blacklist" ]; then
			OIFS=$IFS
			IFS=,
			for b in $_blacklist; do
				[ "$name" = "$b" ] && name=
			done
			IFS=$OIFS
		elif [ -n "$SBO_BLACKLIST" ]; then
			for b in $SBO_BLACKLIST; do
				[ "$name" = "$b" ] && name=
			done
		fi
	fi

	if [ -n "$all" ]; then
		[ -n "$name" ] && echo "$name"
		continue
	fi

	if test -f "$SLACKBUILDS/"*/"$name/$name.info"; then
		. "$SLACKBUILDS/"*/"$name/$name.info"
	else
		continue
	fi

	# (Assigned via common-funcs.sh.)
	# shellcheck disable=SC2154
	_seen "$PRGNAM" "$kernpkgs" && modver=${VERSION}_$kernver ||	\
	modver=$VERSION
	if ! test -f "$VLP/$PRGNAM-$modver"-*-*"$TAG"; then
		if [ -n "$info" ]; then
			over=$(getver "$pkg")
			printf "%-30s %-15s %-5s %-15s\\n" "$PRGNAM" "$over" "->" "$modver"
		else
			echo "$PRGNAM"
		fi
	else
		getbld -B "$SLACKBUILDS/"*/"$PRGNAM/$PRGNAM.SlackBuild"
		if ! test -f "$VLP/$PRGNAM-$modver"-*-"$CBUILD$TAG"; then
			if [ -n "$info" ]; then
				over=$(getver "$pkg")
				obld=$(getbld "$pkg")
				printf "%-30s %-15s %-5s %-15s\\n" "$PRGNAM" "$over ($obld)" "->" "$modver ($CBUILD)"
			else
				echo "$PRGNAM"
			fi
		fi
	fi
done

path: sbupdate


code:
#! /usr/bin/env dash
#	$Id: simbo,v 1.102 2025/07/09 05:12:21 lems Exp $
#
# Copyright 2016 Leonard Schmidt
# All rights reserved. See the file `LICENSE' for license details.
#

# shellcheck disable=SC2043,SC1090
for _func in common-funcs.sh; do
	[ -f "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func" ] &&	\
	. "${SIMBO_FUNCS:-_EXECPREFIX_/functions.d}/$_func"
done

OUTPUT=${OUTPUT:-/usr/SBo/packages}
TMP=${TMP:-/tmp/SBo}

usage() {
cat <<EOF
usage: ${0##*/} [OPTS] PRGNAM [PRGNAM2 [...]]
-a     use logical ANDs to connect all commands
-b     if a binary package exists, use it instead
-c     don't create subdirectories
-C     check MD5 hashes using sbchksum
-d     show download commands only
-D     distfiles directory
-e     look for additional variables to set in $ENVDIR
-E     specify path to ENVDIR
-f     use fakeroot and sudo
-g     get all distfiles first
-H     divide commands using hyphens
-k     generate list of SlackBuilds tagged with uname -r's output
-L     list files of PRGNAM only
-o     display relevant environment variables and their values
-r     rebuild; display commands for programs already installed
-S     slackbuilds directory
-v     for -C: pass -v to sbchksum
-V     print version information
EOF
	exit 1
}

while getopts abcCD:deE:fgHkLorS:vV f 2>/dev/null; do
	case "$f" in
	a)	useand=1 ;;
	b)	binary=1 ;;
	c)	nosub=1 ;;
	C)	checksum=1 ;;
	d)	dlonly=1 ;;
	D)	DISTFILES=$OPTARG ;;
	e)	readenv=1 ;;
	E)	ENVDIR=$OPTARG ;;
	f)	fakeroot=fakeroot ; sudo=sudo ;;
	g)	getall=1 ;;
	H)	verbose=1 ;;
	k)	regen=1 ;;
	L)	list=1 ;;
	o)
		for VAR in			\
		"\$ENVDIR:$ENVDIR"		\
		"\$DISTFILES:$DISTFILES"	\
		"\$OUTPUT:$OUTPUT"		\
		"\$SBO_CHANGELOG:$SBO_CHANGELOG"	\
		"\$SBO_MIRROR:$SBO_MIRROR"	\
		"\$SLACKBUILDS:$SLACKBUILDS"	\
		"\$TMP:$TMP"			\
		; do
			printf "%14s = %s\n" "${VAR%%:*}" "${VAR#*:}"
		done
		exit 0
		;;
	r)	rebuild=1 ; reinstall=--reinstall ;;
	S)	SLACKBUILDS=$OPTARG ;;
	v)	showcheck=1 ;;
	V)	_version ;;
	\?)	usage ;;
	esac
done
shift $((OPTIND - 1))

[ $# = 0 ] && [ -z "$regen" ] && usage

chkdir SLACKBUILDS "$SLACKBUILDS"
chkdir DISTFILES "$DISTFILES"
chkdir OUTPUT "$OUTPUT"
[ -n "$readenv" ] && chkdir ENVDIR "$ENVDIR"

SLACKBUILDS=$(echo "$SLACKBUILDS" | sed 's/\/*$//')
DISTFILES=$(echo "$DISTFILES" | sed 's/\/*$//')
TMP=$(echo "$TMP" | sed 's/\/*$//')
OUTPUT=$(echo "$OUTPUT" | sed 's/\/*$//')

if [ "$regen" = 1 ]; then
	if [ -w "$kernsb_file" ] || [ ! -e "$kernsb_file" ]; then
		gen_kernpkgs
	else
		echo "\`$kernsb_file': not writable" >&2
		exit 1
	fi

	if [ -f "$kernsb_file" ]; then
		echo "\`$kernsb_file' generated" >&2
		exit 0
	else
		echo "\`$kernsb_file' could not be generated" >&2
		exit 1
	fi
fi

du_list() {
	for F in $(du -a "$1" 2>/dev/null | cut -f2- -d '	'); do
		if [ -e "$F" ] && [ ! -d "$F" ]; then
			printf "%s\n" "$F"
		fi
	done
}

read_env() {
	local env_file env prgnam=$1 eopt=$2 ecmd append

	[ -n "$useand" ] && append='&& \'
	env_file="$ENVDIR/$prgnam.env"

	if [ "$eopt" = -s ]; then
		ecmd=export
	else
		ecmd=unset
	fi

	if [ -f "$env_file" ]; then
		while read -r env; do
			[ "$ecmd" = unset ] && env=${env%%=*}
			echo "$ecmd" "$env" "$append"
		done < "$env_file"
	fi
}

# shellcheck disable=SC2153
_build() {
	local name=$1

	[ -n "$verbose" ] && {
		if [ -n "$getall" ] && [ -n "$dlonly" ]; then
			:
		else
			echo "# $PRGNAM" >&2
			echo '# ----------------------------------------------------------------------' >&2
		fi
	}
	[ -z "$getall" ] && _download "$name"
	_cmds "$name"
}

_cmds() {
	local append catnam=$1 OUTPUT
	# shellcheck disable=SC1003
	[ -n "$useand" ] && append='&& \'

	if [ -n "$nosub" ]; then
		OUTPUT=$OUTPUT/$_ARCH
	else
		OUTPUT="$OUTPUT/$_ARCH/$catnam"
	fi

	if [ -z "$dlonly" ]; then
		if ls "$OUTPUT/$PRGNAM-$VERSION"-*-"$CBUILD$TAG".t?z 2>/dev/null 1>&2; then
			if [ -n "$binary" ]; then
				# shellcheck disable=SC2086
				echo $sudo /sbin/upgradepkg --install-new $reinstall \""$OUTPUT/"\"$PRGNAM-$VERSION-*-$CBUILD$TAG.t?z "$append"
				return
			fi
		fi
		[ ! -d "$OUTPUT" ] &&	\
		echo mkdir -p \""$OUTPUT"\" \&\& \\
		echo cd \""$SLACKBUILDS/$catnam"\" \&\& \\
		[ -n "$readenv" ] && read_env "${catnam##*/}" -s
		printf "OUTPUT=%s " "$OUTPUT"
		if [ "${catnam##*/}" != bmake ]; then
			printf "TAG=%s " "$TAG"
		fi
		# shellcheck disable=SC2086
		echo TMP=$TMP $fakeroot /bin/sh \""$SLACKBUILDS/$catnam/${catnam##*/}.SlackBuild"\" \&\& \\
		# shellcheck disable=SC2086
		echo $sudo /sbin/upgradepkg --install-new $reinstall \""$OUTPUT/"\"$PRGNAM-$VERSION-*-$CBUILD$TAG.t?z "$append"
		[ -n "$readenv" ] && read_env "${catnam##*/}"
	fi
}

_download() {
	if [ -n "$binary" ]; then
		if ls "$OUTPUT/$PRGNAM-$VERSION"-*-"$CBUILD$TAG".t?z 2>/dev/null 1>&2; then
			return
		fi
	fi
	local catnam=$1
	prep_dl
	_getsrc "$catnam"
}

_getsrc() {
	local outfile src cflag vflag DEST	\
	link ln_dst missing catnam=$1 append

	# shellcheck disable=SC1003
	[ -n "$useand" ] && append='&& \'

	if [ -n "$nosub" ]; then
		DEST="$DISTFILES"
	else
		DEST="$DISTFILES/$catnam"
	fi
	[ ! -d "$DEST" ] && echo mkdir -p \""$DEST"\" "$append"

	for src in $DL; do
		link=$SLACKBUILDS/$catnam/${src##*/}
		[ -n "$nosub" ] && outfile="$DISTFILES/${src##*/}" ||	\
		outfile="$DISTFILES/$catnam/${src##*/}"

		if [ ! -s "$outfile" ] || ishtml "$outfile"; then
			[ "$binary" = 1 ] || missing=1
		fi

		if [ -h "$link" ]; then
			ln_dst=$(readlink "$link")
			if [ "$ln_dst" != "$DEST/${src##*/}" ]; then
				echo rm -f \""$link"\" "$append"
				echo ln -s \""$outfile"\" \""$link"\" "$append"
			fi
		else
			echo ln -s \""$outfile"\" \""$link"\" "$append"
		fi
	done
	[ -n "$nosub" ] && cflag=-c
	# shellcheck disable=SC2086,SC2248
	[ -n "$missing" ] &&	\
	echo sbfetch $cflag $vflag -U \""$DL"\" -N \""$catnam"\" -M \""$M5"\" "$append"
	if [ -n "$checksum" ]; then
		[ -n "$showcheck" ] && vflag=-v
		# shellcheck disable=SC2248
		echo sbchksum $cflag $vflag -U \""$DL"\" -N \""$catnam"\" -M \""$M5"\" "$append"
	fi
}

if [ -n "$getall" ]; then
	for arg; do
		case "$arg" in
		*/*)
			_source "$SLACKBUILDS/$arg/${arg##*/}.info"
			_download "$arg"
			;;
		*)
			pname=$(find -L "$SLACKBUILDS" -type d -maxdepth 2 -mindepth 2 -name "$arg" -printf "%P\\n")
			_source "$SLACKBUILDS/$pname/${pname##*/}.info"
			_download "$pname"
			;;
		esac
	done
fi

for arg; do
	if [ -n "$list" ]; then
		_dir="$SLACKBUILDS/$arg"
		if [ ! -d "$_dir" ]; then
			du_list "$SLACKBUILDS"/*/"$arg"
		else
			du_list "$_dir"
		fi
		continue
	fi
	case "$arg" in
	*/*)
		# shellcheck disable=SC2086
		setup_vals $arg
		if [ -n "$rebuild" ]; then
			_build "$arg"
		else
			test -f	\
			"$VLP/$PRGNAM-$VERSION"-*-"$CBUILD$TAG"	\
			|| _build "$arg"
		fi
		;;
	*)
		pname=$(find -L "$SLACKBUILDS" -type d -maxdepth 2 -mindepth 2 -name "$arg" -printf "%P\\n")
		# shellcheck disable=SC2086
		setup_vals $pname
		if [ -n "$rebuild" ]; then
			_build "$pname"
		else
			test -f "$VLP/$PRGNAM-$VERSION"-*-"$CBUILD$TAG" || \
			_build "$pname"
		fi
		;;
	esac
done
[ -n "$useand" ] && echo true

path: simbo


code:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Start.tw
src/config/start.tw

path: .gitignore


code:
# Ignore everything in this directory
*
# Except this file
!.gitignore


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod.html src/config/start.tw

rm src/config/start.tw

path: compile


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep -m1 commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod_$HASH.html src/config/start.tw

rm src/config/start.tw

echo "FC_pregmod_$HASH.html" compilation finished.

path: compile-git


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw
ECHO Done


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64
:: Will wait for keypress before terminating.

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw

ECHO Done
PAUSE


code:
:: slave generation widgets [nobr]

<<widget "NationalityToRace">>

<<if $fixedRace == 0>>

<<if ($activeSlave.nationality is "American")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "latina", "latina", "asian", "amerindian", "mixed race")>>
<<elseif ($activeSlave.nationality is "Canadian")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "amerindian")>>
<<elseif ($activeSlave.nationality is "Puerto Rican")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Cuban")>>
	<<set $activeSlave.race to either("latina", "black")>>
<<elseif ($activeSlave.nationality is "Haitian")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Jamaican")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Mexican")>>
	<<set $activeSlave.race to either("latina", "latina", "latina", "latina", "latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Dominican")>>
	<<set $activeSlave.race to either("mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "white", "white", "black")>>
<<elseif ($activeSlave.nationality is "Peruvian")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Venezuelan")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Bolivian")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Guatemalan")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Brazilian")>>
	<<set $activeSlave.race to either("black", "latina", "mixed race", "mixed race", "amerindian", "white")>>
<<elseif ($activeSlave.nationality is "Argentinian")>>
	<<set $activeSlave.race to either("white", "latina", "latina")>>
<<elseif ($activeSlave.nationality is "Chilean")>>
	<<set $activeSlave.race to either("white", "latina", "latina", "latina")>>
<<elseif ($activeSlave.nationality is "Colombian")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Egyptian")>>
	<<set $activeSlave.race to either("black", "middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Turkish")>>
	<<set $activeSlave.race to either("middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Iranian")>>
	<<set $activeSlave.race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Armenian")>>
	<<set $activeSlave.race to either("indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Israeli")>>
	<<set $activeSlave.race to either("white", "middle eastern", "semitic", "semitic")>>
<<elseif ($activeSlave.nationality is "Saudi")>>
	<<set $activeSlave.race to either("black", "asian", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Moroccan")>>
	<<set $activeSlave.race to either("middle eastern", "middle eastern", "black")>>
<<elseif ($activeSlave.nationality is "Nigerian")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Kenyan")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Zimbabwean")>>
	<<set $activeSlave.race to either("black", "black", "black", "black", "white")>>
<<elseif ($activeSlave.nationality is "Ugandan")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Tanzanian")>>
	<<set $activeSlave.race to either("black", "black", "black", "semitic")>>
<<elseif ($activeSlave.nationality is "Ghanan")>>
	<<set $activeSlave.race to either("black", "black", "black", "semitic")>>
<<elseif ($activeSlave.nationality is "Congolese")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Ethiopian")>>
	<<set $activeSlave.race to either("black", "black", "black", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "South African")>>
	<<set $activeSlave.race to either("black", "black", "black", "white")>>
<<elseif ($activeSlave.nationality is "Chinese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Japanese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Thai")>>
	<<set $activeSlave.race to either("asian", "asian", "malay")>>
<<elseif ($activeSlave.nationality is "Vietnamese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Indonesian")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "pacific islander")>>
<<elseif ($activeSlave.nationality is "Filipina")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "pacific islander")>>
<<elseif ($activeSlave.nationality is "Burmese")>>
	<<set $activeSlave.race to either("asian", "asian", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Nepalese")>>
	<<set $activeSlave.race to either("asian", "asian", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Uzbek")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Afghan")>>
	<<set $activeSlave.race to either("indo-aryan", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Algerian")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Libyan")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Tunisian")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Lebanese")>>
	<<set $activeSlave.race to either("middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Jordanian")>>
	<<set $activeSlave.race to either("middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Emirati")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Omani")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Malian")>>
	<<set $activeSlave.race to either("black", "black", "black", "black", "black", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Sudanese")>>
	<<set $activeSlave.race to either("black", "black", "black", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Yemeni")>>
	<<set $activeSlave.race to either("black", "semitic", "middle eastern", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Iraqi")>>
	<<set $activeSlave.race to either("semitic", "middle eastern", "middle eastern", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Indian")>>
	<<set $activeSlave.race to either("indo-aryan")>>
<<elseif ($activeSlave.nationality is "Malaysian")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "malay")>>
<<elseif ($activeSlave.nationality is "Kazakh")>>
	<<set $activeSlave.race to either("asian", "asian", "asian", "semitic", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Pakistani")>>
	<<set $activeSlave.race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Bangladeshi")>>
	<<set $activeSlave.race to either("indo-aryan")>>
<<elseif ($activeSlave.nationality is "Belarusian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Russian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Ukrainian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Irish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Icelandic")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Finnish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Swiss")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Danish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Norwegian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Austrian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Slovak")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Dutch")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Belgian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Czech")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Serbian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Portuguese")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Hungarian")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Estonian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Polish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Romanian")>>
	<<set $activeSlave.race to either("semitic", "white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Swedish")>>
	<<set $activeSlave.race to either("middle eastern", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "white", "white", "southern European")>>
<<elseif ($activeSlave.nationality is "Italian")>>
	<<set $activeSlave.race to either("middle eastern", "southern European", "southern European", "white", "white")>>
<<elseif ($activeSlave.nationality is "Greek")>>
	<<set $activeSlave.race to either("southern European")>>
<<elseif ($activeSlave.nationality is "Spanish")>>
	<<set $activeSlave.race to either("semitic", "southern European", "southern European")>>
<<elseif ($activeSlave.nationality is "British")>>
	<<set $activeSlave.race to either("indo-aryan", "white", "white", "white", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Scottish")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan", "white", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Australian")>>
	<<set $activeSlave.race to either("white", "white", "black", "asian")>>
<<elseif ($activeSlave.nationality is "a New Zealander")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "pacific islander")>>
<</if>>

/% Begin mixed race rate adjustment. %/
/% Some countries are extremely ethnically homogeneous and unlikely to change soon. %/
<<if ($activeSlave.nationality is "Japanese")>>
	<<if random(1,100) > 98>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<if random(1,100) > 95>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif ($activeSlave.nationality is "Polish") or ($activeSlave.nationality is "Romanian") or ($activeSlave.nationality is "Bulgarian") or ($activeSlave.nationality is "Lithuanian") or ($activeSlave.nationality is "Croatian")>>
	/% Croatia isn't an origin currently but the game might add it in the future. %/
	<<if random(1,100) > 98>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif random(1,100) > 90>>
	/% Default rate. %/
	<<set $activeSlave.race to "mixed race">>
<</if>>
/% End mixed race rate adjustment. %/

<<else>>

<<switch $fixedRace>>
<<case "white">>
	<<set $activeSlave.nationality to $whiteNationalities.random()>>
<<case "asian">>
	<<set $activeSlave.nationality to $asianNationalities.random()>>
<<case "latina">>
	<<set $activeSlave.nationality to $latinaNationalities.random()>>
<<case "middle eastern">>
	<<set $activeSlave.nationality to $middleEasternNationalities.random()>>
<<case "black">>
	<<set $activeSlave.nationality to $blackNationalities.random()>>
<<case "indo-aryan">>
	<<set $activeSlave.nationality to $indoAryan"Nationalities.random()>>
<<case "pacific islander">>
	<<set $activeSlave.nationality to $pacificIslanderNationalities.random()>>
<<case "malay">>
	<<set $activeSlave.nationality to $malayNationalities.random()>>
<<case "amerindian">>
	<<set $activeSlave.nationality to $amerindianNationalities.random()>>
<<case "southern european">>
	<<set $activeSlave.nationality to $southernEuropean"Nationalities.random()>>
<<case "semitic">>
	<<set $activeSlave.nationality to $semiticNationalities.random()>>
<</switch>>
<<set $activeSlave.race = $fixedRace>>

<</if>>

<<if $arcologies[0].FSSupremacistLawME != 0>>
<<if $activeSlave.race == $arcologies[0].FSSupremacistRace>>
	<<set $activeSlave.race to "mixed race">>
<</if>>
<</if>>

<</widget>>

<<widget "NationalityToName">>

<<if ($activeSlave.nationality is "American")>>
	<<if $activeSlave.race is "black">>
		<<set $activeSlave.birthName to $africanAmericanSlaveNames.random()>>
	<<elseif $activeSlave.race is "latina">>
		<<set $activeSlave.birthName to $latinaSlaveNames.random()>>
	<<elseif $activeSlave.race is "asian">>
		<<set $activeSlave.birthName to $asianAmericanSlaveNames.random()>>
	<<elseif $activeSlave.race is "middle eastern">>
		<<set $activeSlave.birthName to $egyptianSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $whiteAmericanSlaveNames.random()>>
	<</if>>
<<case "Canadian">>
	<<set $activeSlave.birthName to $canadianSlaveNames.random()>>
<<case "Mexican">>
	<<set $activeSlave.birthName to $mexicanSlaveNames.random()>>
<<case "Dominican">>
	<<set $activeSlave.birthName to $dominicanSlaveNames.random()>>
<<case "Puerto Rican">>
	<<set $activeSlave.birthName to $puertoRicanSlaveNames.random()>>
<<case "Haitian">>
	<<set $activeSlave.birthName to $haitianSlaveNames.random()>>
<<case "Jamaican">>
	<<set $activeSlave.birthName to $jamaicanSlaveNames.random()>>
<<case "Cuban">>
	<<set $activeSlave.birthName to $cubanSlaveNames.random()>>
<<case "Guatemalan">>
	<<set $activeSlave.birthName to $guatemalanSlaveNames.random()>>
<<case "Chilean">>
	<<set $activeSlave.birthName to $chileanSlaveNames.random()>>
<<case "Peruvian">>
	<<set $activeSlave.birthName to $peruvianSlaveNames.random()>>
<<case "Bolivian">>
	<<set $activeSlave.birthName to $bolivianSlaveNames.random()>>
<<case "Venezuelan">>
	<<set $activeSlave.birthName to $venezuelanSlaveNames.random()>>
<<case "Belarusian">>
	<<set $activeSlave.birthName to $belarusianSlaveNames.random()>>
<<case "Russian">>
	<<set $activeSlave.birthName to $russianSlaveNames.random()>>
<<case "Ukrainian">>
	<<set $activeSlave.birthName to $ukrainianSlaveNames.random()>>
<<case "Italian">>
	<<set $activeSlave.birthName to $italianSlaveNames.random()>>
<<case "Spanish">>
	<<set $activeSlave.birthName to $spanishSlaveNames.random()>>
<<case "British">>
	<<set $activeSlave.birthName to $britishSlaveNames.random()>>
<<case "Scottish">>
	<<set $activeSlave.birthName to $scottishSlaveNames.random()>>
<<case "French">>
	<<set $activeSlave.birthName to $frenchSlaveNames.random()>>
<<case "German">>
	<<set $activeSlave.birthName to $germanSlaveNames.random()>>
<<case "Lithuanian">>
	<<set $activeSlave.birthName to $lithuanianSlaveNames.random()>>
<<case "Norwegian">>
	<<set $activeSlave.birthName to $norwegianSlaveNames.random()>>
<<case "Slovak">>
	<<set $activeSlave.birthName to $slovakSlaveNames.random()>>
<<case "Danish">>
	<<set $activeSlave.birthName to $danishSlaveNames.random()>>
<<case "Dutch">>
	<<set $activeSlave.birthName to $dutchSlaveNames.random()>>
<<case "Austrian">>
	<<set $activeSlave.birthName to $austrianSlaveNames.random()>>
<<case "Swiss">>
	<<set $activeSlave.birthName to $swissSlaveNames.random()>>
<<case "Serbian">>
	<<set $activeSlave.birthName to $serbianSlaveNames.random()>>
<<case "Belgian">>
	<<set $activeSlave.birthName to $belgianSlaveNames.random()>>
<<case "Czech">>
	<<set $activeSlave.birthName to $czechSlaveNames.random()>>
<<case "Portuguese">>
	<<set $activeSlave.birthName to $portugueseSlaveNames.random()>>
<<case "Swedish">>
	<<set $activeSlave.birthName to $swedishSlaveNames.random()>>
<<case "Romanian">>
	<<set $activeSlave.birthName to $romanianSlaveNames.random()>>
<<case "Hungarian">>
	<<set $activeSlave.birthName to $hungarianSlaveNames.random()>>
<<case "Estonian">>
	<<set $activeSlave.birthName to $estonianSlaveNames.random()>>
<<case "Irish">>
	<<set $activeSlave.birthName to $irishSlaveNames.random()>>
<<case "Icelandic">>
	<<set $activeSlave.birthName to $icelandicSlaveNames.random()>>
<<case "Finnish">>
	<<set $activeSlave.birthName to $finnishSlaveNames.random()>>
<<case "Greek">>
	<<set $activeSlave.birthName to $greekSlaveNames.random()>>
<<case "Polish">>
	<<set $activeSlave.birthName to $polishSlaveNames.random()>>
<<case "Brazilian">>
	<<set $activeSlave.birthName to $brazilianSlaveNames.random()>>
<<case "Egyptian">>
	<<set $activeSlave.birthName to $egyptianSlaveNames.random()>>
<<case "Colombian">>
	<<set $activeSlave.birthName to $colombianSlaveNames.random()>>
<<case "Argentinian">>
	<<set $activeSlave.birthName to $argentinianSlaveNames.random()>>
<<case "Turkish">>
	<<set $activeSlave.birthName to $turkishSlaveNames.random()>>
<<case "Iranian">>
	<<set $activeSlave.birthName to $iranianSlaveNames.random()>>
<<case "Armenian">>
	<<set $activeSlave.birthName to $armenianSlaveNames.random()>>
<<case "Israeli">>
	<<set $activeSlave.birthName to $israeliSlaveNames.random()>>
<<case "Saudi">>
	<<set $activeSlave.birthName to $saudiSlaveNames.random()>>
<<case "South African">>
	<<if $activeSlave.race is "black">>
		<<set $activeSlave.birthName to $blackSouthAfricanSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $whiteSouthAfricanSlaveNames.random()>>
	<</if>>
<<case "Nigerian">>
	<<set $activeSlave.birthName to $nigerianSlaveNames.random()>>
<<case "Congolese">>
	<<set $activeSlave.birthName to $congoleseSlaveNames.random()>>
<<case "Kenyan">>
	<<set $activeSlave.birthName to $kenyanSlaveNames.random()>>
<<case "Tanzanian">>
	<<set $activeSlave.birthName to $tanzanianSlaveNames.random()>>
<<case "Zimbabwean">>
	<<if $activeSlave.race == "white">>
		<<set $activeSlave.birthName to $britishSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $zimbabweanSlaveNames.random()>>
	<</if>>
<<case "Ghanan">>
	<<set $activeSlave.birthName to $ghananSlaveNames.random()>>
<<case "Ugandan">>
	<<set $activeSlave.birthName to $ugandanSlaveNames.random()>>
<<case "Ethiopian">>
	<<set $activeSlave.birthName to $ethiopianSlaveNames.random()>>
<<case "Moroccan">>
	<<set $activeSlave.birthName to $moroccanSlaveNames.random()>>
<<case "Chinese">>
	<<set $activeSlave.birthName to $chineseSlaveNames.random()>>
<<case "Korean">>
	<<set $activeSlave.birthName to $koreanSlaveNames.random()>>
<<case "Thai">>
	<<set $activeSlave.birthName to $thaiSlaveNames.random()>>
<<case "Vietnamese">>
	<<set $activeSlave.birthName to $vietnameseSlaveNames.random()>>
<<case "Japanese">>
	<<set $activeSlave.birthName to $japaneseSlaveNames.random()>>
<<case "Indonesian">>
	<<set $activeSlave.birthName to $indonesianSlaveNames.random()>>
<<case "Filipina">>
	<<set $activeSlave.birthName to $filipinaSlaveNames.random()>>
<<case "Bangladeshi">>
	<<set $activeSlave.birthName to $bangladeshiSlaveNames.random()>>
<<case "Malaysian">>
	<<set $activeSlave.birthName to $malaysianSlaveNames.random()>>
<<case "Uzbek">>
	<<set $activeSlave.birthName to $uzbekSlaveNames.random()>>
<<case "Afghan">>
	<<set $activeSlave.birthName to $afghanSlaveNames.random()>>
<<case "Nepalese">>
	<<set $activeSlave.birthName to $nepaleseSlaveNames.random()>>
<<case "Burmese">>
	<<set $activeSlave.birthName to $burmeseSlaveNames.random()>>
<<case "Iraqi">>
	<<set $activeSlave.birthName to $iraqiSlaveNames.random()>>
<<case "Yemeni">>
	<<set $activeSlave.birthName to $yemeniSlaveNames.random()>>
<<case "Sudanese">>
	<<set $activeSlave.birthName to $sudaneseSlaveNames.random()>>
<<case "Algerian">>
	<<set $activeSlave.birthName to $algerianSlaveNames.random()>>
<<case "Tunisian">>
	<<set $activeSlave.birthName to $tunisianSlaveNames.random()>>
<<case "Libyan">>
	<<set $activeSlave.birthName to $libyanSlaveNames.random()>>
<<case "Omani">>
	<<set $activeSlave.birthName to $omaniSlaveNames.random()>>
<<case "Malian">>
	<<set $activeSlave.birthName to $malianSlaveNames.random()>>
<<case "Jordanian">>
	<<set $activeSlave.birthName to $jordanianSlaveNames.random()>>
<<case "Lebanese">>
	<<set $activeSlave.birthName to $lebaneseSlaveNames.random()>>
<<case "Emirati">>
	<<set $activeSlave.birthName to $emiratiSlaveNames.random()>>
<<case "Kazakh">>
	<<set $activeSlave.birthName to $kazakhSlaveNames.random()>>
<<case "Pakistani">>
	<<set $activeSlave.birthName to $pakistaniSlaveNames.random()>>
<<case "Indian">>
	<<set $activeSlave.birthName to $indianSlaveNames.random()>>
<<case "Australian">>
	<<set $activeSlave.birthName to $australianSlaveNames.random()>>
<<case "a New Zealander">>
	<<set $activeSlave.birthName to $newZealanderSlaveNames.random()>>
<<default>>
	<<set $activeSlave.birthName to $whiteAmericanSlaveNames.random()>>
<</switch>>

<</widget>>

<<widget "NationalityToAccent">>

<<set $seed to either(0,1,1,2,2,2,3,3,3,3)>>

<<if ($activeSlave.nationality is "American")>>
	<<if $activeSlave.race is "black">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<else>>
		<<set $activeSlave.accent to either(0,1,1,2,2,2,3,3,3,3)>>
	<</if>>
	<<elseif $activeSlave.race is "latina">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Spanish">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<elseif $activeSlave.race is "asian">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Chinese">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<elseif $activeSlave.race is "middle eastern">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Arabic">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<else>>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<</if>>
<<elseif ($activeSlave.nationality is "Canadian")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Mexican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Dominican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Puerto Rican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Haitian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Jamaican")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Cuban")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Guatemalan")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Chilean")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Peruvian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Bolivian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Venezuelan")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Russian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Ukrainian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Italian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Spanish")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "British")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Scottish")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 2>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Belarusian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Norwegian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Slovak")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Danish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Dutch")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Austrian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Swiss")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Serbian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Belgian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Czech")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Portuguese")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Swedish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Romanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Hungarian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Estonian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Irish")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Icelandic")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Finnish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Greek")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Polish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Brazilian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Egyptian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Colombian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Argentinian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Turkish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Iranian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Armenian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Israeli")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Saudi")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "South African")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Nigerian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Congolese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Kenyan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Tanzanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Zimbabwean")>>
	<<if $language is "English" && $activeSlave.race == "white">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Ghanan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Ugandan")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Ethiopian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Moroccan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Chinese")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Thai")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Vietnamese")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Japanese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Indonesian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Filipina")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Bangladeshi")>>
	<<if $language is "Indian">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Malaysian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Uzbek")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Afghan")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Nepalese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Burmese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Iraqi")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Yemeni")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Sudanese")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Algerian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Tunisian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Libyan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Omani")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Malian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Jordanian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Lebanese")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Emirati")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Kazakh")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Pakistani")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Indian")>>
	<<if $language is "Indian">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Australian")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "a New Zealander")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Roman Revivalist">>
	<<if $language is "Latin">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Ancient Egyptian Revivalist">>
	<<if $language is "Ancient Egyptian">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Edo Revivalist">>
	<<if $language is "Japanese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Arabian Revivalist">>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Ancient Chinese Revivalist">>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<else>>
	<<set $activeSlave.accent to $seed>>
<</if>>

<<if $activeSlave.nationality is $language>>
	<<set $activeSlave.accent to 0>>
<</if>>

<</widget>>

path: devNotes/Slave Generation Widgets.txt


code:
########################################################################################################################
#
# sugarcube-2.py
#
# Copyright (c) 2013-2017 Thomas Michael Edwards <tmedwards@motoslave.net>. All rights reserved.
# Use of this source code is governed by a Simplified BSD License which can be found in the LICENSE file.
#
########################################################################################################################

import os, os.path, header
from collections import OrderedDict

class Header (header.Header):

	def filesToEmbed(self):
		userLibPath = self.path + os.sep + 'userlib.js'
		if os.path.isfile(userLibPath):
			return OrderedDict([
				('"USER_LIB"', userLibPath)
			])
		else:
			return OrderedDict()

	def storySettings(self):
		return "SugarCube 2.x does not support the StorySettings special passage.\n\nInstead, you should use its configuration object, config.\n    See: http://www.motoslave.net/sugarcube/2/docs/config-object.html"

	def isEndTag(self, name, tag):
		return (name == ('/' + tag) or name == ('end' + tag))

	def nestedMacros(self):
		return [
				# standard macros
				'append',
				'button',
				'capture',
				'createplaylist',
				'for',
				'if',
				'link',
				'linkappend',
				'linkprepend',
				'linkreplace',
				'nobr',
				'prepend',
				'repeat',
				'replace',
				'script',
				'switch',
				'silently',
				'timed',
				'widget',
				# deprecated macros
				'click'
			]

	def passageTitleColor(self, passage):
		additionalSpecialPassages = [
				'PassageDone',
				'PassageFooter',
				'PassageHeader',
				'PassageReady',
				'StoryBanner',
				'StoryCaption',
				'StoryShare'
			]
		if passage.isStylesheet():
			return ((111, 49, 83), (234, 123, 184))
		elif passage.isScript():
			return ((89, 66, 28), (226, 170, 80))
		elif ('widget' in passage.tags):
			return ((80, 106, 26), (134, 178, 44))
		elif passage.isInfoPassage() or (passage.title in additionalSpecialPassages):
			return ((28, 89, 74), (41, 214, 113))
		elif passage.title == 'Start':
			return ('#4ca333', '#4bdb24')

	def passageChecks(self):
		return super(Header, self).passageChecks()


code:
How to mod (basic doc):

1. All sources now in the src subdir, in separate files. 1 passage = 1 file.

2. Special files and dir's:
    - src/config 		- configuration of the story is here.
    - src/config/start.tw 	- contains list of .tw passage files, regenerated automatic, by building scripts. Do not change by hands. (origial passage Start from pregmod renamed and moved to src/events/intro/introSummary.tw)
    - src/js/storyJS.tw		- special passage with [script] tag - contain all native JavaScript from pregmod.
    - devTools/tweeGo/targets/sugarcube-2/userlib.js - on original FC JS moved here (I deleted it after moving JS to storyJS.tw). Compare to storyJS.tw but do not copy file here. May conflict with src/js/storyJS.tw if copied.
    - src/pregmod 		- I put all pregmod-only passages here.
    - .gitignore 		- special file for git - to ignore some files. For example - compilation results.

3. Compilation:

    Windows:
    Run compile.bat - result will be file bin/FC_pregmod.html
    Second run of compile.but will overwrite bin/FC_pregmod.html without prompt.

    Linux:
    Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!)
    Ensure executable permission on file "compile"
    In the root dir of sources (where you see src, devTools, bin...) run command "./compile" from console
    compile-git will produce the same result file but with current commit hash in filename.

    Mac:
    Don't supported directly (I don't have access to Mac for testing).
    But potentially can be used linux compilation script if you download tweego for mac from here: https://bitbucket.org/tmedwards/tweego/downloads/ and replace linux executable with mac executable in ./devTools/tweeGo/ folder. This is not tested though.

4. Simple comparing and merging with original FC:

    Use meld tool. Place folder FreeCities (original FC sources tree) near FreeCitiesPregmod (this sources tree) and use command:
    meld FreeCities FreeCitiesPregmod
    or just select these folders in meld's GUI.

5. All modders will be wery grateful if any, who make some changes to game, with .html file also post his/her resulting src folder tree.

6. For contributors to pregmod: if you don't use git, then you need to post yours version of src folder tree, not just produced FC_pregmod.html file!!! This html file can't be reverted to proper sources, and useless as contribution!

7. Git workflow:
    - Master branch is pregmod-master. Only Pregmodder can add something to it directly. Always contain his last public changes.
    - pregmod-dev - branch with experimental code mainly by pregmodfan.
    - Any contributions will be placed in separate branches like pregmod-mod-<something> (if it's ready to merge with master complete feature/mod) or pregmod-contrib-<something> if it's partial work until contributions is reviewed.

    Typical cycle with git:
	1. Make account on gitgud if you don't have usable one.
	2. Fork main repository through gitgud interface. (Or pull changes from main repo if you already have fork.)
	3. Clone your fork to local machine witn git client  (Or pull changes if already cloned.)
	4. Make you changes as you like, commit, and push result into your forked repository (with git client).
	5. Make merge request through gitgud interface.


code:
:: MOD_Edit Arcology Cheat [nobr]

	<<set $nextButton = "Continue">>
	<<set $nextLink = "MOD_Edit Arcology Cheat Datatype Cleanup">>
	<<set $PC.actualAge = Math.clamp($PC.actualAge, 14, 80)>>

''Cheating Edit Arcology''

<<if ($economy != 1) || ($seeDicks != 25) || ($continent != "North America") || ($internationalTrade != 1) || ($internationalVariety != 1) || ($seeRace != 1) || ($seeNationality != 1) || ($seeExtreme != 0) || ($plot != 1)>>
	//[[restore defaults|MOD_Edit Arcology Cheat][$seeDicks = 25,$economy = 1,$continent = "North America",$internationalTrade = 1,$internationalVariety = 1,$seeRace = 1,$seeNationality = 1,$seeExtreme = 0,$plot = 1]]//
<</if>>

<<if $economy == 1>>
	The world economy is in ''doubtful'' shape.
	[[Easier|MOD_Edit Arcology Cheat][$economy = 0.5]] | [[Harder|MOD_Edit Arcology Cheat][$economy = 1.5]]
<<elseif $economy < 1>>
	The world economy is still in ''good'' shape.
	[[Harder|MOD_Edit Arcology Cheat][$economy = 1]]
<<else>>
	The world economy is in ''terrible'' shape.
	[[Easier|MOD_Edit Arcology Cheat][$economy = 1]]
<</if>>

<<set $drugsCost = Math.trunc(100*$economy)>>
<<set $rulesCost = Math.trunc(100*$economy)>>
<<set $modCost = Math.trunc(50*$economy)>>
<<set $surgeryCost = Math.trunc(300*$economy)>>

The arcology is located in ''$continent''.

[[North America|MOD_Edit Arcology Cheat][$continent = "North America", $language = "English"]] | [[South America|MOD_Edit Arcology Cheat][$continent = "South America", $language = "Spanish"]] | [[Europe|MOD_Edit Arcology Cheat][$continent = "Europe", $language = "English"]] | [[the Middle East|MOD_Edit Arcology Cheat][$continent = "the Middle East", $language = "Arabic"]] | [[Africa|MOD_Edit Arcology Cheat][$continent = "Africa", $language = "Arabic"]] | [[Asia|MOD_Edit Arcology Cheat][$continent = "Asia", $language = "Chinese"]] | [[Australia|MOD_Edit Arcology Cheat][$continent = "Australia", $language = "English"]] | [[Japan|MOD_Edit Arcology Cheat][$continent = "Japan", $language = "Japanese"]]

The lingua franca of the arcology is ''$language''.

<<if $language != "English">>
	[[English|MOD_Edit Arcology Cheat][$language = "English"]] |
<<else>>
	English |
<</if>>
<<if $language != "Spanish">>
	[[Spanish|MOD_Edit Arcology Cheat][$language = "Spanish"]] |
<<else>>
	Spanish |
<</if>>
<<if $language != "Arabic">>
	[[Arabic|MOD_Edit Arcology Cheat][$language = "Arabic"]] |
<<else>>
	Arabic |
<</if>>
<<if $language != "Chinese">>
	[[Chinese|MOD_Edit Arcology Cheat][$language = "Chinese"]] |
<<else>>
	Chinese |
<</if>>
Custom: <<textbox "$language" $language "MOD_Edit Arcology Cheat">>

<<if $internationalTrade == 0>>
	The slave trade is ''continental,'' so a narrower variety of slaves will be available.
	[[Allow intercontinental trade|MOD_Edit Arcology Cheat][$internationalTrade = 1]]
<<else>>
	The slave trade is ''international,'' so a wider variety of slaves will be available.
	[[Restrict the trade to continental|MOD_Edit Arcology Cheat][$internationalTrade = 0]]
<</if>>

<<if $internationalTrade == 1>>
<<if $internationalVariety == 0>>
	International slave variety is ''semi-realistic,'' so more populous nations will be more common.
	[[Normalized national variety|MOD_Edit Arcology Cheat][$internationalVariety = 1]]
<<else>>
	International slave variety is ''normalized,'' so small nations will appear nearly as much as large ones.
	[[Semi-realistic national variety|MOD_Edit Arcology Cheat][$internationalVariety = 0]]
<</if>>
<</if>>

<<if $seeRace == 1>>
	Ethnicity will ''occasionally'' be mentioned.
	[[Disable most mentions of race|MOD_Edit Arcology Cheat][$seeRace = 0]]
<<else>>
	Ethnicity will ''almost never'' be mentioned.
	[[Enable mentions of race|MOD_Edit Arcology Cheat][$seeRace = 1]]
<</if>>

<<if $seeNationality == 1>>
	Nationality will ''occasionally'' be mentioned.
	[[Disable most mentions of nationality|MOD_Edit Arcology Cheat][$seeNationality = 0]]
<<else>>
	Nationality will ''almost never'' be mentioned.
	[[Enable mentions of nationality|MOD_Edit Arcology Cheat][$seeNationality = 1]]
<</if>>

<<if $seeExtreme == 1>>
	Extreme content like amputation is ''enabled''.
	[[Disable|MOD_Edit Arcology Cheat][$seeExtreme = 0]]
<<else>>
	Extreme content like amputation is ''disabled''.
	[[Enable|MOD_Edit Arcology Cheat][$seeExtreme = 1]]
<</if>>

<<if ($weightAffectsAssets != 0)>>
Slave assets affected by weight is ''enabled''. [[Disable|MOD_Edit Arcology Cheat][$weightAffectsAssets = 0]]
<<else>>
Slave assets affected by weight is ''disabled''. [[Enable|MOD_Edit Arcology Cheat][$weightAffectsAssets = 1]]
<</if>> //If enabled, thin slaves will have large assets drop in size and vice versa at week end. (Diet still affects asset sizes).//

<<if ($curativeSideEffects != 0)>>
Curative side effects are ''enabled''. [[Disable|MOD_Edit Arcology Cheat][$curativeSideEffects = 0]]
<<else>>
Curative side effects are ''disabled''. [[Enable|MOD_Edit Arcology Cheat][$curativeSideEffects = 1]]
<</if>> //If enabled, curatives have a chance to give slaves harmful side effects.//

Slave girls will
<<if $seeDicks >= 90>>
	''almost always'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
<<elseif $seeDicks > 50>>
	''more likely than not'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<elseif $seeDicks > 25>>
	''occasionally'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<elseif $seeDicks > 0>>
	''rarely'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<else>>
	''almost never'' have dicks.
	 [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<</if>>
<<link "Go your own dick way">>
	<<textbox "$seeDicks" $seeDicks>>
	[[Apply|MOD_Edit Arcology Cheat][$seeDicks = Number($seeDicks)]]
<</link>>

<<if $plot == 1>>
	Game mode: ''two-handed''. Includes non-erotic events concerning the changing world.
	[[Disable non-erotic events|MOD_Edit Arcology Cheat][$plot = 0]]
<<else>>
	Game mode: ''one-handed''. No non-erotic events concerning the changing world.
	[[Enable non-erotic events|MOD_Edit Arcology Cheat][$plot = 1]]
<</if>>

/*<<nobr>>
<<if $normalizedEvents == 1>>
	Random events distribution: ''normalized''. Random events will happen with equal frequency.
	[[Realistic|MOD_Edit Arcology Cheat][$normalizedEvents = 0]]
<<else>>
	Random events distribution: ''realistic''. Events will happen more frequently if more slaves qualify for them.
	[[Normalize|MOD_Edit Arcology Cheat][$normalizedEvents = 1]]
<</if>>
<</nobr>>*/

__Player Character__

<<if $PC.title > 0>>
	Conversational title: ''Master''.
	[[Switch to Mistress|MOD_Edit Arcology Cheat][$PC.title = 0]]
<<else>>
	Conversational title: ''Mistress''.
	[[Switch to Master|MOD_Edit Arcology Cheat][$PC.title = 1]]
<</if>>

	Career: ''$PC.career''.
	[[Wealth|MOD_Edit Arcology Cheat][$PC.career = "wealth"]] |
	[[Business|MOD_Edit Arcology Cheat][$PC.career = "capitalist"]] |
	[[PMC work|MOD_Edit Arcology Cheat][$PC.career = "mercenary"]] |
	[[Slaving|MOD_Edit Arcology Cheat][$PC.career = "slaver"]] |
	[[Engineering|MOD_Edit Arcology Cheat][$PC.career = "engineer"]] |
	[[Medicine|MOD_Edit Arcology Cheat][$PC.career = "medicine"]] |
	[[Celebrity|MOD_Edit Arcology Cheat][$PC.career = "celebrity"]]

	Method of acquiring the arcology: ''$PC.rumor''.
	[[Wealth|MOD_Edit Arcology Cheat][$PC.rumor = "wealth"]] |
	[[Hard work|MOD_Edit Arcology Cheat][$PC.rumor = "diligence"]] |
	[[Force|MOD_Edit Arcology Cheat][$PC.rumor = "force"]] |
	[[Social engineering|MOD_Edit Arcology Cheat][$PC.rumor = "social engineering"]] |
	[[Luck|MOD_Edit Arcology Cheat][$PC.rumor = "luck"]]

<<if $PC.dick > 0>>
	Genitalia: ''penis''. Standard sex scenes; easier reputation maintenance.
	[[Switch to vagina|MOD_Edit Arcology Cheat][$PC.dick = 0]]
<<else>>
	Genitalia: ''vagina''. Sex scene variations; more difficult reputation maintenance.
	[[Switch to penis|MOD_Edit Arcology Cheat][$PC.dick = 1]]
<</if>>

<<if $PC.boobs > 0>>
	Chest: ''breasts''. Sex scene variations; more difficult reputation maintenance.
	[[Remove breasts|MOD_Edit Arcology Cheat][$PC.boobs = 0]]
<<else>>
	Chest: ''masculine''. Standard sex scenes; easier reputation maintenance.
	[[Add breasts|MOD_Edit Arcology Cheat][$PC.boobs = 1]]
<</if>>

Age:
<<if $PC.actualAge >= 65>>
	''old''.
<<elseif $PC.actualAge >= 50>>
	''well into middle age''.
<<elseif $PC.actualAge >= 35>>
	''entering middle age''.
<<else>>
	''surprisingly young''.
<</if>>
<<textbox "$PC.actualAge" $PC.actualAge "MOD_Edit Arcology Cheat">>
<<set $PC.physicalAge = $PC.actualAge, $PC.visualAge = $PC.actualAge>>

<<if $playerAging == 2>>
	You will ''age naturally.''
	[[Disable aging|MOD_Edit Arcology Cheat][$playerAging = 0]] |
	[[Semi aging|MOD_Edit Arcology Cheat][$playerAging = 1]]
<<elseif $playerAging == 1>>
	You ''will'' celebrate birthdays, but ''not age.''
	[[Enable aging fully|MOD_Edit Arcology Cheat][$playerAging = 2]] |
	[[Disable aging|MOD_Edit Arcology Cheat][$playerAging = 0]]
<<else>>
	You will ''not age,'' and not experience birthdays.
	[[Enable aging|MOD_Edit Arcology Cheat][$playerAging = 2]] |
	[[Semi aging|MOD_Edit Arcology Cheat][$playerAging = 1]]
<</if>>
//This option cannot be changed during the game//

Rename your character: <<textbox "$PCName" $PCName "MOD_Edit Arcology Cheat">>

Nationality: ''$PC.nationality''.<<textbox "$PC.nationality" $PC.nationality "MOD_Edit Arcology Cheat">>

Race: ''$PC.race''.
	[[White|MOD_Edit Arcology Cheat][$PC.race = "white"]] |
	[[Asian|MOD_Edit Arcology Cheat][$PC.race = "asian"]] |
	[[Latina|MOD_Edit Arcology Cheat][$PC.race = "latina"]] |
	[[Middle Eastern|MOD_Edit Arcology Cheat][$PC.race = "middle eastern"]] |
	[[Black|MOD_Edit Arcology Cheat][$PC.race = "black"]] |
	[[Semitic|MOD_Edit Arcology Cheat][$PC.race = "semitic"]] |
	[[Southern European|MOD_Edit Arcology Cheat][$PC.race = "southern european"]] |
	[[Indo-aryan|MOD_Edit Arcology Cheat][$PC.race = "indo-aryan"]] |
	[[Amerindian|MOD_Edit Arcology Cheat][$PC.race = "amerindien"]] |
	[[Pacific Islander|MOD_Edit Arcology Cheat][$PC.race = "pacific islander"]] |
	[[Malay|MOD_Edit Arcology Cheat][$PC.race = "malay"]] |
	[[Mixed Race|MOD_Edit Arcology Cheat][$PC.race = "mixed race"]]

Skin: ''$PC.skin''.
	[[White|MOD_Edit Arcology Cheat][$PC.skin = "white"]] |
	[[Fair|MOD_Edit Arcology Cheat][$PC.skin = "fair"]] |
	[[Light|MOD_Edit Arcology Cheat][$PC.skin = "light"]] |
	[[Dark|MOD_Edit Arcology Cheat][$PC.skin = "dark"]] |
	[[Olive|MOD_Edit Arcology Cheat][$PC.skin = "olive"]] |
	[[Black|MOD_Edit Arcology Cheat][$PC.skin = "black"]] |
	[[Light Brown|MOD_Edit Arcology Cheat][$PC.skin = "light brown"]] |
	[[Brown|MOD_Edit Arcology Cheat][$PC.skin = "brown"]] |
	[[Pale|MOD_Edit Arcology Cheat][$PC.skin = "pale"]] |
	[[Extremely Pale|MOD_Edit Arcology Cheat][$PC.skin = "extremely pale"]]

Eye color: ''$PC.eyeColor''.
<<textbox "$PC.eyeColor" $PC.eyeColor "MOD_Edit Arcology Cheat">>

Hair color: ''$PC.hColor''.
<<textbox "$PC.hColor" $PC.hColor "MOD_Edit Arcology Cheat">>

Preferred refreshment: <<textbox "$PC.refreshment" $PC.refreshment "MOD_Edit Arcology Cheat">> [[Cigars|MOD_Edit Arcology Cheat][$PC.refreshment = "cigar",$PC.refreshmentType = 0]] | [[Whiskey|MOD_Edit Arcology Cheat][$PC.refreshment = "whiskey",$PC.refreshmentType = 1]]

Preferred method of consumption: <<if $PC.refreshmentType == 0>>Smoked<<elseif $PC.refreshmentType == 1>>Drank<<elseif $PC.refreshmentType == 2>>Eaten<<elseif $PC.refreshmentType == 3>>Snorted<<else>>Injected<</if>>

[[Smoked|MOD_Edit Arcology Cheat][$PC.refreshmentType = 0]] | [[Drank|MOD_Edit Arcology Cheat][$PC.refreshmentType = 1]] | [[Eaten|MOD_Edit Arcology Cheat][$PC.refreshmentType = 2]] | [[Snorted|MOD_Edit Arcology Cheat][$PC.refreshmentType = 3]] | [[Injected|MOD_Edit Arcology Cheat][$PC.refreshmentType = 4]]

Arcology citizens: $ACitizens
<<textbox "$ACitizens" $ACitizens>>

Arcology sex slaves: $ASlaves
<<textbox "$ASlaves" $ASlaves>>

Arcology menial slaves:  $AHelots
<<textbox "$AHelots" $AHelots>>

Arcology prosperity cap: $AProsperityCap
<<textbox "$AProsperityCap" $AProsperityCap>>

Shelter Abuse Counter: $shelterAbuse
<<textbox "$shelterAbuse" $shelterAbuse>>

''The Slavegirl School:''

TSS Students Bought: <<textbox "$TSS.studentsBought" $TSS.studentsBought>>

TSS Upgrades: ''$TSS.schoolUpgrade'' |
<<radiobutton "$TSS.schoolUpgrade" 0>> 0
| <<radiobutton "$TSS.schoolUpgrade" 1>> 1
| <<radiobutton "$TSS.schoolUpgrade" 2>> 2

TSS Moved to Arcology: ''$TSS.schoolPresent'' |
<<radiobutton "$TSS.schoolPresent" 0>> 0
| <<radiobutton "$TSS.schoolPresent" 1>> 1 (Moved)

TSS Prosperity: <<textbox "$TSS.schoolProsperity" $TSS.schoolProsperity>>

TSS Failed: ''$TSS.schoolAnnexed'' |
<<radiobutton "$TSS.schoolAnnexed" 0>> 0
| <<radiobutton "$TSS.schoolAnnexed" 1>> 1 (Failed)

''The Growth Research Institute:''

GRI Students Bought: <<textbox "$GRI.studentsBought" $GRI.studentsBought>>

GRI Upgrades: ''$GRI.schoolUpgrade'' |
<<radiobutton "$GRI.schoolUpgrade" 0>> 0
| <<radiobutton "$GRI.schoolUpgrade" 1>> 1
| <<radiobutton "$GRI.schoolUpgrade" 2>> 2

GRI Moved to Arcology: ''$GRI.schoolPresent'' |
<<radiobutton "$GRI.schoolPresent" 0>> 0
| <<radiobutton "$GRI.schoolPresent" 1>> 1 (Moved)

GRI Prosperity: <<textbox "$GRI.schoolProsperity" $GRI.schoolProsperity>>

GRI Failed: ''$GRI.schoolAnnexed'' |
<<radiobutton "$GRI.schoolAnnexed" 0>> 0
| <<radiobutton "$GRI.schoolAnnexed" 1>> 1 (Failed)

''St. Claver Preparatory:''

SCP Students Bought: <<textbox "$SCP.studentsBought" $SCP.studentsBought>>

SCP Upgrades: ''$SCP.schoolUpgrade'' |
<<radiobutton "$SCP.schoolUpgrade" 0>> 0
| <<radiobutton "$SCP.schoolUpgrade" 1>> 1
| <<radiobutton "$SCP.schoolUpgrade" 2>> 2

SCP Moved to Arcology: ''$SCP.schoolPresent'' |
<<radiobutton "$SCP.schoolPresent" 0>> 0
| <<radiobutton "$SCP.schoolPresent" 1>> 1 (Moved)

SCP Prosperity: <<textbox "$SCP.schoolProsperity" $SCP.schoolProsperity>>

SCP Failed: ''$SCP.schoolAnnexed'' |
<<radiobutton "$SCP.schoolAnnexed" 0>> 0
| <<radiobutton "$SCP.schoolAnnexed" 1>> 1 (Failed)

<<if ($seeDicks != 0)>>

''L'Ecole des Enculees:''

LDE Students Bought: <<textbox "$LDE.studentsBought" $LDE.studentsBought>>

LDE Upgrades: ''$LDE.schoolUpgrade'' |
<<radiobutton "$LDE.schoolUpgrade" 0>> 0
| <<radiobutton "$LDE.schoolUpgrade" 1>> 1
| <<radiobutton "$LDE.schoolUpgrade" 2>> 2

LDE Moved to Arcology: ''$LDE.schoolPresent'' |
<<radiobutton "$LDE.schoolPresent" 0>> 0
| <<radiobutton "$LDE.schoolPresent" 1>> 1 (Moved)

LDE Prosperity: <<textbox "$LDE.schoolProsperity" $LDE.schoolProsperity>>

LDE Failed: ''$LDE.schoolAnnexed'' |
<<radiobutton "$LDE.schoolAnnexed" 0>> 0
| <<radiobutton "$LDE.schoolAnnexed" 1>> 1 (Failed)

	''The Gymnasium-Academy:''

TGA Students Bought: <<textbox "$TGA.studentsBought" $TGA.studentsBought>>

TGA Upgrades: ''$TGA.schoolUpgrade''
<<radiobutton "$TGA.schoolUpgrade" 0>> 0
| <<radiobutton "$TGA.schoolUpgrade" 1>> 1
| <<radiobutton "$TGA.schoolUpgrade" 2>> 2

TGA Moved to Arcology: ''$TGA.schoolPresent'' |
<<radiobutton "$TGA.schoolPresent" 0>> 0
| <<radiobutton "$TGA.schoolPresent" 1>> 1 (Moved)

TGA Prosperity: <<textbox "$TGA.schoolProsperity" $TGA.schoolProsperity>>

TGA Failed: ''$TGA.schoolAnnexed'' |
<<radiobutton "$TGA.schoolAnnexed" 0>> 0
| <<radiobutton "$TGA.schoolAnnexed" 1>> 1 (Failed)

	''The Futanari Sisters:''

TFS Students Bought: <<textbox "$TFS.studentsBought" $TFS.studentsBought>>

TFS Upgrades: ''$TFS.schoolUpgrade'' |
<<radiobutton "$TFS.schoolUpgrade" 0>> 0
| <<radiobutton "$TFS.schoolUpgrade" 1>> 1
| <<radiobutton "$TFS.schoolUpgrade" 2>> 2

TFS Moved to Arcology: ''$TFS.schoolPresent'' |
<<radiobutton "$TFS.schoolPresent" 0>> 0
| <<radiobutton "$TFS.schoolPresent" 1>> 1 (Moved)

TFS Prosperity:<<textbox "$TFS.schoolProsperity" $TFS.schoolProsperity>>

TFS Failed: ''$TFS.schoolAnnexed'' |
<<radiobutton "$TFS.schoolAnnexed" 0>> 0
| <<radiobutton "$TFS.schoolAnnexed" 1>> 1 (Failed)
<</if>>

__Arcologies:__

    __''$arcologies[0].name''__ is your arcology.

You own: ''$arcologies[0].ownership%'' of the arcology <<textbox "$arcologies[0].ownership" $arcologies[0].ownership>>

Other minority ownership: ''$arcologies[0].minority%'' <<textbox "$arcologies[0].minority" $arcologies[0].minority>>

$arcologies[0].name's GSP is
@@color:yellowgreen;¤<<print Math.trunc(0.1*$arcologies[0].prosperity)>>m@@.

<<if $arcologies.length > 1>>
<<set _neighbors = Number($arcologies.length-1)>>

Your arcology has <<print Number($arcologies.length-1)>>
<<if _neighbors == 1>> neighbor<<else>> neighbors<</if>>.
<<else>>
Your arcology has no neighbors.
<</if>>

<<if $arcologies.length < 8>>
<<link "Add neighbor">>
	<<set $seed = ["north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest"]>>

	<<set $activeArcology = {name: "Arcology X-", direction: "north", government: "an individual", honeymoon: 0, prosperity: 50, ownership: 50, minority: 20, PCminority: 0, demandFactor:0, FSSupremacist: "unset", FSSupremacistRace: 0, FSSubjugationist: "unset", FSSubjugationistRace: 0, FSGenderRadicalist: "unset", FSGenderFundamentalist: "unset", FSPaternalist: "unset", FSDegradationist: "unset", FSBodyPurist: "unset", FSTransformationFetishist: "unset", FSYouthPreferentialist: "unset", FSMaturityPreferentialist: "unset", FSSlimnessEnthusiast: "unset", FSAssetExpansionist: "unset", FSPastoralist: "unset", FSPhysicalIdealist: "unset", FSChattelReligionist: "unset", FSRomanRevivalist: "unset", FSEgyptianRevivalist: "unset", FSEdoRevivalist: "unset", FSArabianRevivalist: "unset", FSChineseRevivalist: "unset", FSNull: "unset", embargo: 1, embargoTarget: -1, influenceTarget: -1, influenceBonus: 0, rival: 0}>>

	<<if $arcologies.length < 4>>
		<<set $activeArcology.name = $activeArcology.name+$arcologies.length>>
	<<else>>
		<<set $activeArcology.name = $activeArcology.name+($arcologies.length+1)>>
	<</if>>

	<<set $activeArcology.direction = $seed.pluck()>>
	<<set $activeArcology.government = random(0,5)>>
	<<set $activeArcology.prosperity += random(-20,20)>>
	<<set $activeArcology.ownership += random(-10,0)>>
	<<set $activeArcology.minority += random(-5,5)>>
	<<set $arcologies.push($activeArcology)>>

	<<goto "MOD_Edit Arcology Cheat">>
<</link>>
<</if>>

<<set $averageProsperity = 0>>
<<set $seed = 0>>
<<for $i = 0; $i lt $arcologies.length; $i++>>
	<<set $averageProsperity += $arcologies[$i].prosperity>>
	<<set $seed += 1>>
<</for>>
<<set $averageProsperity = $averageProsperity/$seed>>

<<for $i = 0; $i < $arcologies.length; $i++>>
	<<if $arcologies[$i].direction != 0>>
	<<display "Neighbor Description">>
	<</if>>

	<<if $i != 0>>
	<<print "[[Remove neighbor|MOD_Edit Arcology Cheat][$arcologies.pluck( [" + $i + "], [" + $i + "] )]]">>
	<</if>>
<</for>>


code:
:: MOD_Edit Arcology Cheat Datatype Cleanup

<<nobr>>
	<<set $nextButton = "Continue">>
	<<set $nextLink = "Manage Arcology">>

	<<set $ACitizens = Number($ACitizens)>>
	<<set $ASlaves = Number($ASlaves)>>
	<<set $AHelots = Number($AHelots)>>
	<<set $shelterAbuse = Number($shelterAbuse)>>

	<<set $TSS.studentsBought = Number($TSS.studentsBought)>>
	<<set $TSS.schoolProsperity = Number($TSS.schoolProsperity)>>

	<<set $GRI.studentsBought = Number($GRI.studentsBought)>>
	<<set $GRI.schoolProsperity = Number($GRI.schoolProsperity)>>

	<<set $SCP.studentsBought = Number($SCP.studentsBought)>>
	<<set $SCP.schoolProsperity = Number($SCP.schoolProsperity)>>

	<<set $LDE.studentsBought = Number($LDE.studentsBought)>>
	<<set $LDE.schoolProsperity = Number($LDE.schoolProsperity)>>

	<<set $TGA.studentsBought = Number($TGA.studentsBought)>>
	<<set $TGA.schoolProsperity = Number($TGA.schoolProsperity)>>

	<<set $TFS.studentsBought = Number($TFS.studentsBought)>>
	<<set $TFS.schoolProsperity = Number($TFS.schoolProsperity)>>

	<<set $arcologies[0].ownership = Number($arcologies[0].ownership)>>
	<<set $arcologies[0].minority = Number($arcologies[0].minority)>>

	<<set $PC.actualAge = Number($PC.actualAge)>>
	<<set $PC.physicalAge = $PC.actualAge, $PC.visualAge = $PC.actualAge>>

	The chanting grows louder and louder, CHEAT! CHEAT! CHEAT!

	The Arcology morphs and changes shape, CHEAT! CHEAT! CHEAT!

	The Arcology has been changed forever and you forfeit your CHEATING CHEATY SOUL!
<</nobr>>\