<?
$ctime = time();
$now = time();
include("inc/db_connect.php");
// $stat = mysql_fetch_array(mysql_query("select id, user, bloked, level, vitality, hp, hp_now, power, energy, energy_now, strength, dex, agility, razum, rase, exp, wins, losses, proff, tribe, credits from players where user='$user' and pass='$pass'"));
$stat = mysql_fetch_array(mysql_query("select * from players where user='".addslashes($user)."' and pass='".addslashes($pass)."' LIMIT 1"));
if (empty($stat['id'])) { header("Location: http://192.168.1.1"); exit; }
if ($stat['bloked']) { echo"<script>top.location='index.php?action=logout'</script>"; exit; }
if ($stat['last_battle']) mysql_query("UPDATE players SET last_battle=NULL WHERE user='".$stat['user']."'");
include("inc/html_header.php");
echo"<script language=JavaScript src='i/login_form.js'></script>";
echo"<script language=JavaScript src='i/show_inf.js'></script>";
echo"<script language=JavaScript src='i/time.js'></script>";
echo"<div id=mainform style='position:absolute; left:11px; top:30px'></div>";
echo"<div id=hint1 class=hint></div>";
$levels=mysql_fetch_array(mysql_query("SELECT exp FROM levels WHERE level=".$stat['level']."+1"));
?>
<BODY bgcolor=EBEDEC leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="bg.jpg">
<table width=100% cellspacing=0 border=0 cellpadding=5 bordercolor=red>
<tr>
<td width=230 valign=top>
<?
include("inc/main/changed.php");
$uri=GetEnv("REQUEST_URI");
$uri=explode("?",$uri);
$uri=$uri['0'];
if (empty($set) && $uri=="/main.php" || $set=="edit" && $uri=="/main.php" || $set=="map" && $uri=="/main.php" || $uri=="/battle.php") include("inc/magic/use.php");
elseif ($set=="abils" && $uri=="/main.php") include("inc/magic/abils/use.php");
$hp_max=$stat['hp_max'];
$mn_max=$stat['mn_max'];
################################################################################
###########
$time_hp = $stat[cure_hp];
if ($stat[hp_max]>$stat[hp_now]){
if ($stat[cure_hp] == 0) {
$time_hp = floor($now + ($stat[hp_max]-$stat[hp_now])*(1200/$stat[hp_max]));
$q=mysql_query("UPDATE players SET cure_hp='$time_hp' WHERE id='$stat[id]'");
}
else {
if ($now >= $stat[cure_hp]) {
mysql_query("UPDATE players SET hp_now=$stat[hp_max], cure_hp='0' WHERE id='$stat[id]'");
}
else {
$t = ($stat[hp_max]-$stat[hp_now])*(1200/$stat[hp_max]);
$hp_need = $stat[hp_max]-$stat[hp_now];
$x = $t / $hp_need;
$t1 = $time_hp-$t;
$t_need = $t-($time_hp-$now);
$hp = floor($t_need / $x);
$hp_s = $hp+$stat[hp_now];
$q=mysql_query("UPDATE players SET hp_now=hp_now+$hp WHERE id='$stat[id]'");
}
}
}
else{
$SS = mysql_query("UPDATE players SET cure_hp='0' WHERE id='$stat[id]'");
}
if ($hp > 0) {$stat[hp_now] = $stat[hp_now]+$hp;}
################################################################################
###########
################################################################################
###########
$time_mn = $stat[cure_mn];
if ($stat[mn_max]>$stat[energy_now]){
if ($stat[cure_mn] == 0) {
$time_mn = floor($now + ($stat[mn_max]-$stat[energy_now])*(1200/$stat[mn_max]));
mysql_query("UPDATE players SET cure_mn='$time_mn' WHERE id='$stat[id]'");
echo "123";
}
else {
if ($now >= $stat[cure_mn]) {
mysql_query("UPDATE players SET energy_now=$stat[mn_max], cure_mn='0' WHERE id='$stat[id]'");
}
else {
$t = ($stat[mn_max]-$stat[energy_now])*(1200/$stat[mn_max]);
$mn_need = $stat[mn_max]-$stat[energy_now];
$x = $t / $mn_need;
$t1 = $time_mn-$t;
$t_need = $t-($time_mn-$now);
$mn = floor($t_need / $x);
$mn_s = $mn+$stat[energy_now];
mysql_query("UPDATE players SET energy_now=energy_now+$mn WHERE id='$stat[id]'");
}
}
}
else{
$SS = mysql_query("UPDATE players SET cure_mn='0' WHERE id='$stat[id]'");
}
################################################################################
###########
?>
<body onLoad="setHP(<? echo "$stat[hp_now],$stat[hp_max]"; ?>); setMN(<?echo "$stat[energy_now],$stat[mn_max]";?>)">
<script language="javascript">
var rnd = Math.random();
var delay = 12;
var redHP = 0.33;
var yellowHP = 0.66;
var TimerOn = -1;
var tkHP, maxHP;
function setHP(value, max) {
tkHP=value; maxHP=max;
if (TimerOn>=0) { clearTimeout(TimerOn); TimerOn=-1; }
setHPlocal();
}
function setHPlocal() {
if (tkHP>maxHP) { tkHP=maxHP; }
var sz1 = Math.round((110/maxHP)*tkHP);
var sz2 = 111 - sz1;
if (document.all("HP")) {
document.HP1.width=sz1;
document.HP2.width=sz2;
if (tkHP/maxHP < redHP) { document.HP1.src='img/icon/green.gif'; }
else {
if (tkHP/maxHP < yellowHP) { document.HP1.src='img/icon/green.gif'; }
else { document.HP1.src='img/icon/green.gif'; }
}
var s = document.all("HP").innerHTML;
document.all("HP").innerHTML = s.substring(0, s.lastIndexOf(':')+1) + Math.round(tkHP)+"/"+maxHP;
}
tkHP = (tkHP+(maxHP/100));
if (tkHP<maxHP) { TimerOn=setTimeout('setHPlocal()', delay*1000); }
else { TimerOn=-1; }
}
var rnd2 = Math.random();
var delay2 = 12;
var TimerOn2 = -1;
var tkMN, maxMN;
function setMN(value, max) {
tkMN=value; maxMN=max;
if (TimerOn2>=0) { clearTimeout(TimerOn2); TimerOn2=-1; }
setMNlocal();
}
function setMNlocal() {
if (tkMN>maxMN) { tkMN=maxMN; }
var sz1 = Math.round((110/maxMN)*tkMN);
var sz2 = 111 - sz1;
if (document.all("MN")) {
document.MN1.width=sz1;
document.MN2.width=sz2;
document.MN1.src='img/icon/blue.gif';
var s = document.all("MN").innerHTML;
document.all("MN").innerHTML = s.substring(0, s.lastIndexOf(':')+1) + Math.round(tkMN)+"/"+maxMN;
}
tkMN = (tkMN+(maxMN/100));
if (tkMN<maxMN) { TimerOn2=setTimeout('setMNlocal()', delay2*1000); }
else { TimerOn2=-1; }
}
</script>
<?
$widthhp=$stat['hp_now']/$hp_max*181;
if ($widthhp==0) $widthhp+=2;
if ($widthhp==1) $widthhp+=1;
if ($widthhp>1) $widthhp-=1;
$energy_max=$stat['power']*5+$stat['energy'];
$widthenergy=$stat['energy_now']/($stat['power']*5+$stat['energy'])*181;
if ($widthenergy==0) $widthenergy+=2;
if ($widthenergy==1) $widthenergy+=1;
if ($widthenergy>1) $widthenergy-=1;
include("inc/main/inf.php");
?>
</td>
<td valign=top width=175>
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<?
echo"<FIELDSET><LEGEND align=center><font class=ch>Характеристики</font></LEGEND>";
echo"<table width=175 cellspacing=0 cellpadding=3><tr><td>
Сила: <a class=ch>$stat[strength]</a>
Ловкость: <a class=ch>$stat[dex]</a>
Удача: <a class=ch>$stat[agility]</a>
Выносливость: <a class=ch>$stat[vitality]</a>
Энергия: <a class=ch>$stat[power]</a>
";
if ($stat[level]>=4) echo" Разум: <a class=ch>$stat[razum]</a>
";
if ($set=="edit") {
echo"
<HR color=CCCCCC>
Крит. удара: <a class=ch>$stat[krit]%</a>
Анти крит. удара: <a class=ch>$stat[unkrit]%</a>
Уворота: <a class=ch>$stat[uv]%</a>
Анти уворота: <a class=ch>$stat[unuv]%</a>
<HR color=CCCCCC>
Мин. урон: <a class=ch>",round(($stat[strength]/3+$stat[min])*(1+($stat['ork']/100))),"</a>
Макс. урон: <a class=ch>",round((1+$stat[strength]/1.5+$stat[max])*(1+($stat['ork']/100))),"</a>
<HR color=CCCCCC>
Броня головы: <a class=ch>$stat[br1]</a>
Броня корпуса: <a class=ch>$stat[br2]</a>
Броня живота: <a class=ch>$stat[br3]</a>
Броня пояса: <a class=ch>$stat[br4]</a>
Броня ног: <a class=ch>$stat[br5]</a>
";
}
echo"</td></tr></table></FIELDSET>";
switch ($stat['rase']) {
case 1: $rase="Орк"; break;
case 2: $rase="Эльф"; break;
case 3: $rase="Человек"; break;
case 4: $rase="Гном"; break;
case 100: $rase="Ангел"; break; }
echo"<FIELDSET><LEGEND align=center><font class=ch>Статистика</font></LEGEND>";
echo"<table width=175 cellspacing=0 cellpadding=3><tr><td>
Уровень: $stat[level]
Опыт: $stat[exp] [$levels[exp]]
Побед: $stat[wins]
Поражений: $stat[losses]
Раса: [b]$rase[/b]
Профессия: [b]";
switch ($stat['proff']) {
case 1: echo"Лекарь"; break;
case 2: echo"Провожатый"; break;
case 3: echo"Кузнец"; break;
case 4: echo"Жрец"; break;
case 5: echo"Наёмник"; break;
default: echo"нет"; break; }
echo"[/b]
";
if ($stat['tribe']) echo" Гильдия: [url="'encicl.php?view=tribes&name=$stat[tribe]'"]$stat[tribe][/url]
";
echo"</td></tr></table></FIELDSET>";
echo"<FIELDSET><LEGEND align=center><font class=ch>Ресурсы</font></LEGEND>
<table width=175 cellspacing=0 cellpadding=3><tr><td>
Деньги: [b]$stat[credits] зм.[/b]
Слитки: [b]$stat[f_credits] сз.[/b]
Валюта: [b]$stat[valute] сп.[/b]
</td></tr></table></FIELDSET>";
if ($stat['s_updates'] || $stat['o_updates'])
echo"<FIELDSET><LEGEND align=center><font class=ch>Советуем Вам...</font></LEGEND>
<table width=175 cellspacing=0 cellpadding=3><tr><td>
[url="'main.php?set=updates'><font"]Распределить \"Умения\"</font>[/url]
</td></tr></table></FIELDSET>";
if ($stat['hp_now']<$stat['hp_max'] && !$stat[battle]) {
$user_offer=mysql_fetch_array(
mysql_query(
"select offers.time,offers.type,participants.side from offers, participants
where offers.time>$now
and offers.done=0
and participants.time=offers.time
and participants.id=$stat[id]"));
if (empty($user_offer[time])) {
echo"<FIELDSET><LEGEND align=center><font class=ch>Лечение</font></LEGEND>
<table width=175 cellspacing=0 cellpadding=3><tr>
<td align=center><input type=button onclick='window.location.href = \"world.php?room=8&\"+Math.random();' class=search style='WIDTH: 160px; font-weight: bold;' value='Подлечиться'></td>
</tr></table></FIELDSET>"; }}
include('inc/main/status.php');
?>
</td>
</tr>
</table>
</td>
<td valign=top>
<?
if (!empty($nms)) echo"
<center><font color=red>[b]$nms[/b]</font></center>
";
?>