# Contributor: Ben R <thebenj88 *AT* gmail *DOT* com>
# Modified by: Brandon D <draygera *AT* gmail *DOT* com>
pkgname=dungeon-defenders-hib
pkgver=03052013
pkgrel=1
pkgdesc="A co-operative 3D tower defense game with medieval theming."
url="http://dungeondefenders.com/"
license=('custom: "commercial"')
arch=('i686' 'x86_64')
depends=('libstdc++5' 'glibc>=2.12.2' 'unzip' 'libxss')
options=(!strip)
source=("dungeon-defenders.desktop"
"http://uk-microsites.ign.com/playstationoffers/images/charts/dlc/dungeon_defenders.png")
sha256sums=('b7c299ef6430db375519846b7a18002a9cfb418f4ed83969cb880b369f4918d5'
'1d5292e72931d2e59d9568454f082b0c2e92074c28f2b7260eda549c01b560e3')
screenshot="http://dungeondefenders.com/wp-content/gallery/screenshots/forestscreenfinal.jpg"
_gamepkg="dundef-linux-${pkgver}.mojo.run"
build() {
cd "${srcdir}"
msg "You need a full copy of this game in order to install it"
msg "Searching for ${_gamepkg} in dir: $(readlink -f `pwd`/..)"
if [[ -f "../${_gamepkg}" ]]; then
msg "Found game package, installing..."
ln -fs "../${_gamepkg}" .
else
error "Game package not found, please type absolute path to ${_gamepkg} (/home/joe):"
read pkgpath
if [[ -f "${pkgpath}/${_gamepkg}" ]]; then
msg "Found game package, installing..."
ln -fs "${pkgpath}/${_gamepkg}" .
else
error "Unable to find game package."
return 1
fi
fi
msg 'Extracting game files from mojosetup installer'
unzip -uo ${_gamepkg} || true # Mojo.run files are actually zip files with an extra header most of the time.
}
package(){
msg 'Installing game icon and desktop files'
install -Dm644 "${srcdir}/dungeon-defenders.desktop" \
"${pkgdir}/usr/applications/dungeon-defenders.desktop"
install -Dm644 "${srcdir}/dungeon_defenders.png" \
"${pkgdir}/usr/share/icons/dungeon-defenders.png"
msg 'Installing game files'
install -d "${pkgdir}/opt/"
mv ${srcdir}/data/ ${pkgdir}/opt/DungeonDefenders/
msg 'Installing launcher'
install -d "${pkgdir}/usr/bin/"
ln -s /opt/DungeonDefenders/DungeonDefenders \
${pkgdir}/usr/bin/dungeon-defenders
msg 'Fixing infinite start bug as found here: https://bugzilla.icculus.org/show_bug.cgi?id=5894'
sed -i 's/DefaultGameplayLevel=LobbyLevel_Valentines2013.udk/LobbyLevel.udk/g' ${pkgdir}/opt/DungeonDefenders/UDKGame/Config/DefaultDunDef.ini
sed -i 's/DefaultGameplayLevelRanked=LobbyLevel_Valentines2013.udk/LobbyLevel.udk/g' ${pkgdir}/opt/DungeonDefenders/UDKGame/Config/DefaultDunDef.ini
}
# Locate a file or folder provided by the user, and symlink it into $srcdir
_get_local_source() {
msg "Looking for '$1'..."
declare -A _search=(['build dir']="$startdir"
['$LOCAL_PACKAGE_SOURCES']="$LOCAL_PACKAGE_SOURCES"
['$_gamedir']="$_gamedir")
for _key in "${!_search[@]}"; do local _dir="${_search["$_key"]}"
if [ -z "$_dir" ]; then _dir="<undefined>"; fi
echo -n " - in $_key ['$_dir'] ... ";
if [ -e "$_dir/$1" ]; then
echo "FOUND"; ln -sfT "$(readlink -f "$_dir/$1")" "$srcdir/$1"; break; fi
echo "NOT FOUND"
done
if [ ! -e "$srcdir/$1" ]; then return 1; fi
}