223 lines
11 KiB
PHP
223 lines
11 KiB
PHP
<?
|
|
echo "
|
|
<script language='JavaScript'>
|
|
var elem = document.getElementById('se-pre-con');
|
|
elem.parentNode.removeChild(elem);
|
|
</script>
|
|
";
|
|
if(!defined('GAME')) { die(); }
|
|
if($u->room['file']=='ruine') {
|
|
|
|
$rn = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_now` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1'));
|
|
if(!isset($rn['id'])) {
|
|
die('Ðóèíû. Òóðíèð áûë çàêîí÷åí, ëèáî íå íàéäåí...');
|
|
}
|
|
|
|
$ru = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_users` WHERE `bot` = "'.$u->info['id'].'" AND `tid` = "'.$rn['id'].'" LIMIT 1'));
|
|
if(!isset($rn['id'])) {
|
|
die('Ðóèíû. Âû óæå íå ó÷àñòâóåòå â òóðíèðå...');
|
|
}
|
|
|
|
function add_log($txt) {
|
|
global $rn;
|
|
if( isset($rn['id']) ) {
|
|
mysql_query('INSERT INTO `ruine_logs` ( `tid` , `time` , `text` ) VALUES (
|
|
"'.$rn['id'].'","'.time().'","'.mysql_real_escape_string($txt).'"
|
|
)');
|
|
}
|
|
}
|
|
|
|
if( isset($_GET['ruine_exit']) ) {
|
|
//Çàïèñûâàåì â ëîã ÷òî èãðîê ïîêèíóë òóðíèð
|
|
if( $u->info['real'] == 0 ) {
|
|
$txt = $u->microLogin($u->info['__id'],1);
|
|
if( $u->info['sex'] == 0 ) {
|
|
$txt .= ' ïîêèíóë òóðíèð è íè÷åãî íå ïîëó÷èë!';
|
|
}else{
|
|
$txt .= ' ïîêèíóëà òóðíèð è íè÷åãî íå ïîëó÷èëà!';
|
|
}
|
|
add_log($txt);
|
|
//
|
|
mysql_query('DELETE FROM `ruine_users` WHERE `bot` = "'.$u->info['id'].'" LIMIT 1');
|
|
mysql_query('DELETE FROM `users` WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
|
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
|
mysql_query('DELETE FROM `eff_users` WHERE `id` = "'.$u->info['id'].'"');
|
|
mysql_query('DELETE FROM `users_delo` WHERE `id` = "'.$u->info['id'].'"');
|
|
mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$u->info['id'].'"');
|
|
mysql_query('DELETE FROM `actions` WHERE `id` = "'.$u->info['id'].'"');
|
|
//
|
|
mysql_query('UPDATE `users` SET `room` = "412", `inUser` = "0" WHERE `id` = "'.$u->info['__id'].'" LIMIT 1');
|
|
header('location: main.php');
|
|
}else{
|
|
die('Ðåàëüíûé ïîëüçîâàòåëü â òóðíèðå! Îáðàòèòåñü ê Àäìèíèñòðàöèè, ÑÐÎ×ÍÎ!');
|
|
}
|
|
}elseif( isset($_GET['attack']) ) {
|
|
$ra = mysql_fetch_array(mysql_query('SELECT `id`,`sex`,`battle`,`real`,`login`,`align`,`clan` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_GET['attack']).'" AND `room` = "'.$u->info['room'].'" AND `real` = 0 LIMIT 1'));
|
|
if(!isset($ra['id'])) {
|
|
$u->error = 'Ó÷àñòíèê òóðíèðà ñ ëîãèíîì "'.htmlspecialchars($_GET['attack']).'" íå íàéäåí.';
|
|
}else{
|
|
$ra_st = mysql_fetch_array(mysql_query('SELECT `id`,`x`,`y`,`hpNow` FROM `stats` WHERE `id` = "'.$ra['id'].'" LIMIT 1'));
|
|
if( $ra_st['x'] != $u->info['x'] || $ra_st['y'] != $ra_st['y'] ) {
|
|
$u->error = 'Âû íàõîäèòåñü â ðàçíûõ êîìíàòàõ.';
|
|
}else{
|
|
$ra_ru = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_users` WHERE `bot` = "'.$ra['id'].'" AND `tid` = "'.$rn['id'].'" LIMIT 1'));
|
|
if( $ra_ru['team'] == $ru['team'] ) {
|
|
$u->error = 'Íåëüçÿ íàïàäàòü íà ñîþçíèêîâ!';
|
|
}else{
|
|
//
|
|
$tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$ra['battle'].'" AND `team_win` = "-1" LIMIT 1'));
|
|
if( !isset($tbtl['id']) && $ra['battle'] > 0 ) {
|
|
$ra['battle'] = 0;
|
|
$ra_st['team'] = 0;
|
|
mysql_query('UPDATE `users` SET `battle` = 0 WHERE `id` = "'.$usr['id'].'" LIMIT 1');
|
|
if( $ra_st['hpNow'] < 1 ) {
|
|
mysql_query('UPDATE `stats` SET `hpNow` = 1 WHERE `id` = "'.$usr['id'].'" LIMIT 1');
|
|
}
|
|
}
|
|
//
|
|
$ua1 = $u->microLogin($u->info['__id'],1);
|
|
$ua2 = $u->microLogin($ra_ru['uid'],1);
|
|
//
|
|
$btl_id = $magic->atackUser($u->info['id'],$ra['id'],$ra_st['team'],$ra['battle']);
|
|
//
|
|
if( $ra['battle'] > 0 ) {
|
|
if( $u->info['sex'] == 0 ) {
|
|
$txt = $ua1 . ' âìåøàëñÿ â <a target="_blank" title="Áîé #'.$ra['battle'].'" href="/logs.php?log='.$btl_id.'">áîé</a> ïðîòèâ ' . $ua2 . '.';
|
|
}else{
|
|
$txt = $ua1 . ' âìåøàëàñÿ â <a target="_blank" title="Áîé #'.$ra['battle'].'" href="/logs.php?log='.$btl_id.'">áîé</a> ïðîòèâ ' . $ua2 . '.';
|
|
}
|
|
}else{
|
|
if( $u->info['sex'] == 0 ) {
|
|
$txt = $ua1 . ' íàïàë íà ' . $ua2 . ' è çàâÿçàëñÿ <a target="_blank" href="/logs.php?log='.$btl_id.'">áîé</a>.';
|
|
}else{
|
|
$txt = $ua1 . ' íàïàëà íà ' . $ua2 . ' è çàâÿçàëñÿ <a target="_blank" href="/logs.php?log='.$btl_id.'">áîé</a>.';
|
|
}
|
|
}
|
|
add_log($txt);
|
|
//
|
|
if( $btl_id > 0 ) {
|
|
mysql_query('UPDATE `battle` SET `inTurnir` = "'.$rn['id'].'",`timeout` = "'.(rand(1,3)*60).'" WHERE `id` = "'.$btl_id.'" LIMIT 1');
|
|
}
|
|
//
|
|
header('location: main.php');
|
|
//
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
<script>
|
|
function ruin_exit() {
|
|
if(confirm('Âûéòè è íè÷åãî íå ïîëó÷èòü?')){ top.frames['main'].location = 'https://new-combats.com/main.php?ruine_exit=1'; }
|
|
}
|
|
</script>
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td>
|
|
<div style="padding-left:0px;" align="center">
|
|
<h3>Òåñòîâàÿ ëîêàöèÿ</h3>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<?
|
|
|
|
if($u->error != '') {
|
|
echo '<div><font color="red"><b>'.$u->error.'</b></font></div><br>';
|
|
}
|
|
|
|
$tmn = array(
|
|
1 => array(
|
|
'Êðàñíûå','red'
|
|
),
|
|
2 => array(
|
|
'Ñèíèå','blue'
|
|
)
|
|
);
|
|
$tm1 = $ru['team'];
|
|
if( $tm1 == 1 ) {
|
|
$tm2 = 2;
|
|
}else{
|
|
$tm2 = 1;
|
|
}
|
|
echo 'Ñ÷åò: <b><font color="'.$tmn[1][1].'">'.$rn['t1w'].'</font></b> - <b><font color="'.$tmn[2][1].'">'.$rn['t2w'].'</font></b><br><br>';
|
|
echo '<div style="padding-bottom:5px;"><b>Âàøà êîìàíäà: <font color="'.$tmn[$tm1][1].'">'.$tmn[$tm1][0].'</font></b></div>';
|
|
$i = 0;
|
|
$ph = 100;
|
|
$sp = mysql_query('SELECT * FROM `ruine_users` WHERE `tid` = "'.$rn['id'].'" AND `team` = "'.$tm1.'"');
|
|
while( $pl = mysql_fetch_array($sp) ) {
|
|
$plst = $u->getStats($pl['bot'],0);
|
|
$hppx = -10;
|
|
if( $plst['mpAll'] < 1 ) {
|
|
$hppx = -4;
|
|
}
|
|
$hpmp = '
|
|
<div style="padding-left:10px;position:relative;"><div id="vhp'.($plst['id']+1000000000000).'" title="Óðîâåíü æèçíè" align="left" class="seehp" style="position:absolute; top:'.$hppx.'px; width:120px; height:10px; z-index:12;"> '.floor($plst['hpNow']).'/'.$plst['hpAll'].'</div>
|
|
<div title="Óðîâåíü æèçíè" class="hpborder" style="position:absolute; top:'.$hppx.'px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div class="hp_3 senohp" style="height:9px; width:'.floor(120/100*$ph).'px; position:absolute; top:'.$hppx.'px; z-index:11;" id="lhp'.($plst['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div title="Óðîâåíü æèçíè" class="hp_none" style="position:absolute; top:'.$hppx.'px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
|
|
';
|
|
if( $plst['mpAll'] >= 1 ) {
|
|
$hpmp .= '
|
|
<div id="vmp'.($plst['id']+1000000000000).'" title="Óðîâåíü ìàíû" align="left" class="seemp" style="position:absolute; top:0px; width:120px; height:10px; z-index:12;"> '.floor($plst['mpNow']).'/'.$plst['mpAll'].'</div>
|
|
<div title="Óðîâåíü ìàíû" class="hpborder" style="position:absolute; top:0px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div class="hp_mp senohp" style="height:9px; position:absolute; top:0px; width:'.floor(120/100*$ph).'px; z-index:11;" id="lmp'.($plst['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div title="Óðîâåíü ìàíû" class="hp_none" style="position:absolute; top:0px; width:120px; height:10px; z-index:10;"></div>
|
|
';
|
|
}
|
|
echo '<table border="0" cellspacing="0" cellpadding="0" height="20">
|
|
<tr><td valign="middle">'.$u->microLogin($pl['bot'],1).'</td><td width="'.($ph+40).'">'.$hpmp.'</td><td><small>(x: '.$plst['x'].', y: '.$plst['y'].')</small></td></tr></table>';
|
|
$i++;
|
|
}
|
|
unset($plst,$sp,$pl);
|
|
|
|
if( $i == 0 ) {
|
|
echo '<br><i>'.$tmn[$tm1][0].' ïîêèíóëè òóðíèð.</i>';
|
|
}
|
|
|
|
echo '<br><br><div style="padding-bottom:5px;"><b>Êîìàíäà ïðîòèâíèêà: <font color="'.$tmn[$tm2][1].'">'.$tmn[$tm2][0].'</font></b></div>';
|
|
$i = 0;
|
|
$sp = mysql_query('SELECT * FROM `ruine_users` WHERE `tid` = "'.$rn['id'].'" AND `team` = "'.$tm2.'"');
|
|
while( $pl = mysql_fetch_array($sp) ) {
|
|
$plst = $u->getStats($pl['bot'],0);
|
|
$hppx = -10;
|
|
if( $plst['mpAll'] < 1 ) {
|
|
$hppx = -4;
|
|
}
|
|
$hpmp = '
|
|
<div style="padding-left:10px;position:relative;"><div id="vhp'.($plst['id']+1000000000000).'" title="Óðîâåíü æèçíè" align="left" class="seehp" style="position:absolute; top:'.$hppx.'px; width:120px; height:10px; z-index:12;"> '.floor($plst['hpNow']).'/'.$plst['hpAll'].'</div>
|
|
<div title="Óðîâåíü æèçíè" class="hpborder" style="position:absolute; top:'.$hppx.'px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div class="hp_3 senohp" style="height:9px; width:'.floor(120/100*$ph).'px; position:absolute; top:'.$hppx.'px; z-index:11;" id="lhp'.($plst['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div title="Óðîâåíü æèçíè" class="hp_none" style="position:absolute; top:'.$hppx.'px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
|
|
';
|
|
if( $plst['mpAll'] >= 1 ) {
|
|
$hpmp .= '
|
|
<div id="vmp'.($plst['id']+1000000000000).'" title="Óðîâåíü ìàíû" align="left" class="seemp" style="position:absolute; top:0px; width:120px; height:10px; z-index:12;"> '.floor($plst['mpNow']).'/'.$plst['mpAll'].'</div>
|
|
<div title="Óðîâåíü ìàíû" class="hpborder" style="position:absolute; top:0px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div class="hp_mp senohp" style="height:9px; position:absolute; top:0px; width:'.floor(120/100*$ph).'px; z-index:11;" id="lmp'.($plst['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
|
|
<div title="Óðîâåíü ìàíû" class="hp_none" style="position:absolute; top:0px; width:120px; height:10px; z-index:10;"></div>
|
|
';
|
|
}
|
|
echo '<table border="0" cellspacing="0" cellpadding="0" height="20">
|
|
<tr><td valign="middle">'.$u->microLogin($pl['bot'],1).'</td><td width="'.($ph+40).'">'.$hpmp.'</td><td><small>(x: '.$plst['x'].', y: '.$plst['y'].')</small></td></tr></table>';
|
|
$i++;
|
|
}
|
|
if( $i == 0 ) {
|
|
echo '<br><i>'.$tmn[$tm2][0].' ïîêèíóëè òóðíèð.</i>';
|
|
}
|
|
?>
|
|
</td>
|
|
<td align="right" valign="top">
|
|
<input type="button" value="Îáíîâèòü" class="btnnew" onclick="location.href='https://new-combats.com/main.php';">
|
|
<input onClick="top.atackTower();" class="btnnew3" style="padding-left:24px; background-image:url('https://img.new-combats.com/i/fighttype50.gif'); background-position:2px -2px; background-repeat:no-repeat;" type="button" value="Íàïàñòü">
|
|
<a href="/ruins/<?=$rn['id']?>" target="_blank" style="font-size:10px;" class="btnnew">Ëîãè òóðíèðà</a>
|
|
<input onclick="ruin_exit()" type="button" value="Âûéòè è íè÷åãî íå ïîëó÷èòü!" class="btnnew2">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<? } ?>
|