# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4
inherit versionator games

MY_PV="$(delete_all_version_separators)"
MY_PF="${PN/-bin}${MY_PV}"
MY_PN="${PN/-bin}"

DESCRIPTION="Tibia is a free fantasy MMORPG."
HOMEPAGE="http://www.tibia.com/"
SRC_URI="http://static.tibia.com/download/tibia1011.tgz"

LICENSE="CipSoft GmbH"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

RDEPEND="virtual/opengl"

S=${WORKDIR}/Tibia
src_install() {

dir="${GAMES_PREFIX_OPT}/${MY_PN}"

	exeinto ${dir}
	doexe Tibia Showerror Patch	|| die "doexe failed"
	insinto ${dir}
	doins Tibia.{dat,pic,spr,xpm}	|| die "doins failed"
	doexe "Patch"
	doexe "Showerror"
	doins "StartTibia.sh"
	doins -r "libc6"
	dosym /opt/tibia-client/Tibia /usr/bin/tibia

	make_desktop_entry ${PN} KickBall ${PN}.xpm

	prepgamesdirs
}