<?php
session_start();
if($_SESSION['logged'] == 'true'){
require_once ("data_class.php");
class GUI extends Data {
function Language() {
// language initalization
$this->DefineLang();
}
function Menu() {
//include lang file
$this->Language();
require $this->lang;
$this->menu = array(
"<a class='menu' href='./?p=home'>$menu_phome</a> | ",
"<a class='menu' href='./?p=cudoviste'>$menu_pcudoviste</a> | ",
"<a class='menu' href='./?p=world'>World map</a> | ",
"<a class='menu' href='./?p=inv'>$menu_inventory</a> | ",
"<a class='menu' href='./?p=shop'>$menu_pshop</a> | ",
"<a class='menu' href='./?p=raid'>$menu_praid</a> | ",
"<a class='menu' href='./?p=duel'>$menu_pduel</a> | ",
"<a class='menu' href='./?p=msg'>$menu_pmsg</a> | "
);
$max = count($this->menu);
$i = 0;
while ($i <= $max) {
echo $this->menu[$i];
$i++;
}
echo " Lang: <a href='' title='Change language'>".$this->user[lang]."</a>";
}
function GetPage() {
if (isset($_GET["p"])) {
$this->page = $_GET["p"];
$str = array("world","home", "cudoviste", "raid", "duel", "shop", "action", "msg", "attack", "inv","create");
if (in_array($this->page, $str))
{
include ("$this->page.php");
}
else {
echo "<div align='center' style='font-size: 16px; text-align: center;'>$gui_error</div>";
}
} // p
else if (isset($_GET["o"])) {
$this->page = $_GET["o"];
$str = array("cudoviste", "level", "skills");
if (in_array($this->page, $str))
{
include ("$this->page.php");
}
else {
echo "<div align='center' style='font-size: 16px; text-align: center;'>$gui_error</div>";
}
}
}
function GameInfo() {
//include lang file
$this->Language();
require $this->lang;
// Check private messages
$m = mysql_query("
SELECT
private_msgs.id,
private_msgs.mfrom,
private_msgs.mto
FROM
private_msgs
WHERE
private_msgs.mto = '".$_SESSION["id"]."'
AND
private_msgs.mread = 0
");
$mCount = mysql_num_rows($m);
if ($mCount <= 0) {
$this->msgString = "<img src='img/msgBig_bw.jpg' align='left'
title='header=[$info_msg] body=[$no_msg]' border='0' />";
} else {
$this->msgString = "<a href='?p=msg'><img src='img/msgBig.jpg' align='left'
title='header=[$info_msg] body=[<b>$mCount</b> $new_msg]' border='0' /></a>";
}
// Check raid status
$r = mysql_query("
SELECT
rfrom,
rto
FROM
village_raids
WHERE
uid = '".$_SESSION["id"]."'
AND
active = 1");
$rCount = mysql_num_rows($r);
if ($rCount <= 0) {
$this->raidString = "<img src='img/raidBig_bw.jpg' align='left'
title='header=[$info_raid] body=[$no_raid]' border='0' />";
} else {
$this->r = mysql_fetch_assoc($r);
if ($this->r[rto] <= time()) {
$this->raidString = "<a href='?p=raid'><img src='img/raidBig_ok.jpg' align='left'
title='header=[$info_raid] body=[$done_raid]' border='0' /></a>";
} else {
$difR = $this->r[rto] - time();
$this->raidString = "<img src='img/raidBig.jpg' align='left'
title='header=[$info_raid] body=[$new_raid<i><b>$difR</b> </i>]' border='0' />";
}
}
// check attack status
$h = mysql_query("
SELECT
id,
rfrom,
rto
FROM
creature_hunts
WHERE
uid = '".$_SESSION["id"]."'
AND
active = 1");
$hCount = mysql_num_rows($h);
if ($hCount <= 0) {
$alarm = mysql_query("
SELECT
id,
rfrom,
rto
FROM
creature_hunts
WHERE
tid = '".$_SESSION["id"]."'
AND
active = 1");
if (mysql_num_rows($alarm) > 0) {
$this->t = mysql_fetch_assoc($alarm);
$this->huntString = "<a href='?p=duel&s=".$this->t[id]."'><img src='img/huntBig_att.jpg' align='left'
title='header=[$info_duel] body=[$att_duel]' border='0' /></a>";
} else {
$this->huntString = "<img src='img/huntBig_bw.jpg' align='left'
title='header=[$info_duel] body=[$no_duel]' border='0' />";
}
} else {
$this->h = mysql_fetch_assoc($h);
if ($this->h[rto] <= time()) {
$this->huntString = "<a href='?p=duel&s=".$this->h[id]."'><img src='img/huntBig_ok.jpg' align='left'
title='header=[$info_duel] body=[$done_duel]' border='0' /></a>";
} else {
$dift = $this->h[rto] - time();
$this->huntString = "<img src='img/huntBig.jpg' align='left'
title='header=[$info_duel] body=[$new_duel<i><b>$dift</b></i>]' border='0' />";
}
}
// output data:
//turns status:
$t = mysql_query("SELECT turns FROM users WHERE id = '".$_SESSION["id"]."'");
$turns = mysql_fetch_assoc($t);
echo "<table align='right' width='120'><tr><td>Turns: ".$turns[turns]."</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$info_msg</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$this->msgString</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$info_raid</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$this->raidString</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$info_duel</td></tr><tr>";
echo "<td style='padding-top: 8px; margin-bottom: 3px;'>$this->huntString</td></tr><tr>";
echo "</tr></table>";
} // game info function end
} //class end
} else {}
?>