initial commit
This commit is contained in:
1419
classes/MysqliDb.php
Normal file
1419
classes/MysqliDb.php
Normal file
File diff suppressed because it is too large
Load Diff
1995
classes/battle_new.class.php
Normal file
1995
classes/battle_new.class.php
Normal file
File diff suppressed because it is too large
Load Diff
5
classes/cave/cave_bots.php
Normal file
5
classes/cave/cave_bots.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?
|
||||
$bots = array(1 => 10025, 2 => 10026, 3 => 10027, 4 => 10028, 5 => 10031, 6 => 10032, 7 => 10033, 8 => 10034);
|
||||
$botnames = array(1 => "Паук", 2 => "Тарантул", 3 => "Гигантская крыса", 4 => "Покровитель нечести", 5 => "Нечто", 6 => "Обезумевший крыс", 7 => "Призрак короля крыс ", 8 => "Обезумевший палач");
|
||||
|
||||
?>
|
||||
12
classes/cave/caveitems.php
Normal file
12
classes/cave/caveitems.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if($user['room'] == 621) {
|
||||
$caveitems[1] = array(array('id' => 1126, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 50, 'podzem' => 1));
|
||||
$caveitems[2] = array(array('id' => 1125, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 40, 'podzem' => 1));
|
||||
$caveitems[3] = array(array('id' => 1127, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 15, 'podzem' => 1));
|
||||
$caveitems[4] = array(array('id' => 1128, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 5, 'podzem' => 1));
|
||||
$caveitems[5] = array(array('id' => 1126, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 60, 'podzem' => 1));
|
||||
$caveitems[6] = array(array('id' => 1130, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 7), 'podzem' => 1);
|
||||
$caveitems[7] = array(array('id' => 1129, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 10, 'podzem' => 1));
|
||||
$caveitems[8] = array(array('id' => 1131, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 5, 'podzem' => 1));
|
||||
}
|
||||
?>
|
||||
23
classes/cave/lose.php
Normal file
23
classes/cave/lose.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?
|
||||
if(in_array($user['room'], $caverooms)) {
|
||||
include_once("cavedata.php");
|
||||
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
if(!isset($cavedata[$user['room']]['x'.$floor])) {
|
||||
$floor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$lomka1 = $lomka;
|
||||
|
||||
foreach($lomka1 as $k => $v) {
|
||||
if($v < _BOTSEPARATOR_) {
|
||||
if(in_array($user['room'], $caverooms)) {
|
||||
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '".$cavedata[$user['room']]['x'.$floor]."', `y` = '".$cavedata[$user['room']]['y'.$floor]."', `dir` = '".$cavedata[$user['room']]['dir'.$floor]."', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
|
||||
}
|
||||
if($user['laba'] > 0) {
|
||||
mysql_query('UPDATE `users` SET `x` = `xf`, `y` = `yr` WHERE `id` = "'.$v.'" LIMIT 1');
|
||||
die('Suka');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
60
classes/cave/win.php
Normal file
60
classes/cave/win.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?
|
||||
if(in_array($user['room'], $caverooms)) {
|
||||
include("caveitems.php");
|
||||
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
|
||||
if($location['dir'] == 0) {
|
||||
$y = $location['y']*2;
|
||||
$x = ($location['x']-1)*2;
|
||||
}
|
||||
|
||||
if($location['dir'] == 1) {
|
||||
$y = ($location['y']-1)*2;
|
||||
$x = $location['x']*2;
|
||||
}
|
||||
|
||||
if($location['dir'] == 2) {
|
||||
$y = $location['y']*2;
|
||||
$x = ($location['x']+1)*2;
|
||||
}
|
||||
|
||||
if($location['dir'] == 3) {
|
||||
$y = ($location['y']+1)*2;
|
||||
$x = $location['x']*2;
|
||||
}
|
||||
|
||||
$floor = $location['floor'];
|
||||
|
||||
$r = mysql_query("SELECT `bot`, `x`, `y`, `cnt` FROM `cavebots` WHERE `battle` = '".$this->battle_data["id"]."'");
|
||||
$i = 0; $cnt = 0;
|
||||
while($rec = mysql_fetch_assoc($r)) {
|
||||
$bot = $rec['bot'];
|
||||
$cnt = $rec['cnt'];
|
||||
if(@$caveitems[$bot]) {
|
||||
if($user['room'] == 621) {
|
||||
$i = mt_rand(0, (count($caveitems[$bot]) - 1));
|
||||
$item = $caveitems[$bot][$i];
|
||||
if(getchance($item['chance'])) {
|
||||
$it = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `img` FROM `$item[from]` WHERE `id` = $item[id] LIMIT 1"));
|
||||
$podz = 1;
|
||||
mysql_query('INSERT INTO `caveitems` SET `podzem` = "'.$item['podzem'].'", `leader` = "'.$user['caveleader'].'", `x` = "'.$rec['x'].'", `y` = "'.$rec['y'].'", `floor` = "'.$floor.'", `name` = "'.$it['name'].'", `img` = "'.$it['img'].'", `item` = "'.$item['id'].'"'.($item['foronetrip'] ? ", `foronetrip` = 1" : ""));
|
||||
cavesys("У <b>".$cavebots[$bot]."</b> был предмет <b>$it[name]</b> и кто угодно может подобрать его.");
|
||||
$this->AddToLog('<span class=date>'.date("H:i")."</span> У <b>".$cavebots[$bot]."</b> был предмет <b>$it[name]</b>.<BR>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($user['caveleader'] > 0) {
|
||||
$bots = array(1 => 10025, 2 => 10026, 3 => 10027, 4 => 10028, 5 => 10031, 6 => 10032, 7 => 10033, 8 => 10034);
|
||||
$tp = 1;
|
||||
while($tp <= $cnt) {
|
||||
addActions(time(), 'win_bot_'.$bots[$bot], 0, $user['id']);
|
||||
$tp++;
|
||||
}
|
||||
}
|
||||
|
||||
mysql_query("DELETE FROM `cavebots` WHERE `battle` = '".$this->battle_data["id"]."'");
|
||||
mysql_query('UNLOCK TABLES');
|
||||
}
|
||||
?>
|
||||
4998
classes/class.upload.php
Normal file
4998
classes/class.upload.php
Normal file
File diff suppressed because it is too large
Load Diff
470
classes/fbattle.php
Normal file
470
classes/fbattle.php
Normal file
@@ -0,0 +1,470 @@
|
||||
<?php
|
||||
ob_start("ob_gzhandler");
|
||||
session_start();
|
||||
if(!isset($_SESSION['uid'])) { header("Location: index.php"); }
|
||||
if($_POST['end']) { header("Location: main.php"); }
|
||||
|
||||
include('config.php');
|
||||
include('functions.php');
|
||||
include('cave/cave_bots.php');
|
||||
$cavebots = $botnames;
|
||||
|
||||
mysql_query("LOCK TABLES `bots` WRITE, `laba_obj` WRITE, `qst_user` WRITE, `qst` WRITE, `` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `magic` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE, `variables` WRITE, `logs_arena` WRITE, `cavebots` WRITE, `caveparties` WRITE");
|
||||
if(isset($user['id'])) {
|
||||
mysql_query("UPDATE `online` SET `real_time` = '".time()."' WHERE `id` = '{$user['id']}' LIMIT 1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//include('./classes/battle_old.class.php');
|
||||
include('./classes/battle_new.class.php');
|
||||
|
||||
$fbattle = new fbattle($user['battle']);
|
||||
?><html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="i/main.css" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-type" />
|
||||
<meta http-equiv="Cache-Control" content="no-cache" />
|
||||
<meta http-equiv="PRAGMA" content="NO-CACHE" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<script type="text/javascript" src="i/popup/ZeroClipboard.js"></script>
|
||||
<script type="text/javascript" src="i/sl2.js"></script>
|
||||
<script type="text/javascript" src="i/ch.js"></script>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
||||
<script src="js/tooltip.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/tooltip.css" />
|
||||
<script>
|
||||
var Hint3Name = '';
|
||||
function findlogin(title, script, name) {
|
||||
document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+
|
||||
'<form action="'+script+'" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2>'+
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="'+name+'"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = 100;
|
||||
document.all(name).focus();
|
||||
Hint3Name = name;
|
||||
}
|
||||
|
||||
var attack = false; var defend = false;
|
||||
|
||||
function check() {
|
||||
if((! attack) || (! defend)) { alert('Блок или удар не выбран.'); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
function Prv(logins) {
|
||||
top.frames['bottom'].window.document.F1.text.focus();
|
||||
top.frames['bottom'].document.forms[0].text.value = logins + top.frames['bottom'].document.forms[0].text.value;
|
||||
}
|
||||
|
||||
function setattack() {
|
||||
attack = true;
|
||||
}
|
||||
|
||||
function setdefend() {
|
||||
defend = true;
|
||||
}
|
||||
|
||||
function refreshPeriodic() {
|
||||
<? if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>'; <? } ?>
|
||||
timerID = setTimeout("refreshPeriodic()", 30000);
|
||||
}
|
||||
|
||||
timerID = setTimeout("refreshPeriodic()", 30000);
|
||||
|
||||
function checksubmit() {
|
||||
var ajaxload = 1;
|
||||
if(ajaxload > 0) {
|
||||
var enemy = <? echo $fbattle->enemy; ?>;
|
||||
var batl = <?=($user['battle']?$user['battle']:$_REQUEST['batl'])?>;
|
||||
var tac_at = $('input[name=attack]:checked').val();
|
||||
var att = "&attack="+$('input[name=attack]:checked').val();
|
||||
var def = $('input[name=defend]:checked').val();
|
||||
|
||||
if(tac_at >= 1 && def >= 1) {
|
||||
$.ajax({
|
||||
url: "fbattle.php",
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: "batl="+batl+"&myid=1053012363"+att+"&defend="+def+"&enemy="+enemy+"",
|
||||
success: function(html) {
|
||||
$("body").html(html);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('Выберите зону атаки и блока!');
|
||||
$("#at").prop("disabled", false);
|
||||
}
|
||||
} else {
|
||||
document.f1.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function checksubmit_vip() {
|
||||
var ajaxload = 1;
|
||||
if(ajaxload > 0) {
|
||||
var enemy = <? echo $fbattle->enemy; ?>;
|
||||
var batl = <?=($user['battle']?$user['battle']:$_REQUEST['batl'])?>;
|
||||
var tac_at = <? echo mt_rand(1, 4); ?>;
|
||||
var att = "&attack="+tac_at+"";
|
||||
var def = <? echo mt_rand(1, 4); ?>;
|
||||
$("#A"+tac_at+"").attr("checked", "checked");
|
||||
$("#D"+def+"").attr("checked", "checked");
|
||||
|
||||
if(tac_at > 0 && def > 0) {
|
||||
$.ajax({
|
||||
url: "fbattle.php",
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: "batl="+batl+"&myid="+batl+att+"&defend="+def+"&enemy="+enemy+"",
|
||||
success: function(html) {
|
||||
$("body").html(html);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('Var error #1');
|
||||
$("#at").prop("disabled", false);
|
||||
}
|
||||
} else {
|
||||
document.f1.submit();
|
||||
}
|
||||
}
|
||||
|
||||
$("document").ready(function() {
|
||||
$('#refresh').click(function() {
|
||||
$.ajax({
|
||||
url: "fbattle.php",
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$("body").html(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.menu { background-color: #d2d0d0; border-color: #ffffff #626060 #626060 #ffffff; border-style: solid; border-width: 1px; position: absolute; left: 0px; top: 0px; visibility: hidden; }
|
||||
a.menuItem { border: 0px solid #000000; color: #003388; display: block; font-family: MS Sans Serif, Arial, Tahoma,sans-serif; font-size: 8pt; font-weight: bold; padding: 2px 12px 2px 8px; text-decoration: none; }
|
||||
a.menuItem:hover { background-color: #a2a2a2; color: #0066FF; }
|
||||
span { font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; text-decoration: none; font-weight: bold; cursor: pointer; }
|
||||
#hp_value { font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; text-decoration: none; font-weight: normal; }
|
||||
.my_clip_button { border: 0px solid #000000; color: #003388; display: block; font-family: MS Sans Serif, Arial, Tahoma,sans-serif; font-size: 8pt; font-weight: bold; padding: 2px 12px 2px 8px; text-decoration: none; }
|
||||
.my_clip_button.hover { background-color: #a2a2a2; color: #0066FF; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=e2e0e0 onLoad="top.setHP(<?=$user['hp']?>,<?=$user['maxhp']?>)">
|
||||
<div id="hint3" class="ahint"></div>
|
||||
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST" name="f1" id="f1">
|
||||
<table width=100% cellspacing=0 cellpadding=0 border=0>
|
||||
<input type="hidden" value="<?=($user['battle']?$user['battle']:$_REQUEST['batl'])?>" name="batl" /><input type="hidden" value="<?=$enemy?>" name="enemy1" /><input type="hidden" name="myid" value="1053012363" />
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<table width=250 cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td valign=top width=250 nowrap>
|
||||
<? echo showinf_pers($user['id'], 1, 1, 1); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td valign=top width=80%>
|
||||
<? switch($fbattle->return) {
|
||||
case 1 :
|
||||
?>
|
||||
<table width=100% cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td colspan=2><h3>Поединок</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font color=660000><b>Ваш ход</b>
|
||||
</td>
|
||||
<td align=right> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<center>
|
||||
<? if($user['level'] > 3) {
|
||||
if(@$_GET['use']) {
|
||||
$dressed = mysql_fetch_row(mysql_query("SELECT `id` FROM `inventory` WHERE `id` = '".(int)$_GET['use']."' AND `dressed` = 1"));
|
||||
if((int)$dressed[0] > 0) {
|
||||
$my_class = $fbattle->my_class;
|
||||
ob_start();
|
||||
usemagic($_GET['use'], "".$_POST['target']);
|
||||
$bb = explode("<!--", ob_get_clean());
|
||||
$bb = str_replace('"', """, (strip_tags($bb[0])));
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?buf=".$bb);
|
||||
} else {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['buf']) {
|
||||
echo "<font color=red><b>".$_GET['buf']."</b></font><br />";
|
||||
}
|
||||
|
||||
echoscroll('m1'); echoscroll('m2'); echoscroll('m3'); echoscroll('m4'); echoscroll('m5'); echoscroll('m6');
|
||||
echoscroll('m7'); echoscroll('m8'); echoscroll('m9'); echoscroll('m10');
|
||||
}
|
||||
?>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td align=center bgcolor=f2f0f0><b>Атака</b></td>
|
||||
<td> </td>
|
||||
<td align=center bgcolor=f2f0f0><b>Защита</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr><td><input type="radio" id="A1" name="attack" value="1" onclick="setattack()" /><label for="A1">удар в голову</label></td></tr>
|
||||
<tr><td><input type="radio" id="A2" name="attack" value="2" onclick="setattack()" /><label for="A2">удар в корпус</label></td></tr>
|
||||
<tr><td><input type="radio" id="A3" name="attack" value="3" onclick="setattack()" /><label for="A3">удар в пояс(пах)</label></td></tr>
|
||||
<tr><td><input type="radio" id="A4" name="attack" value="4" onclick="setattack()" /><label for="A4">удар по ногам</label></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr><td><input type="radio" id="D1" name="defend" value="1" onclick="setdefend()" /><label for="D1">блок головы и корпуса</label></td></tr>
|
||||
<tr><td><input type="radio" id="D2" name="defend" value="2" onclick="setdefend()" /><label for="D2">блок корпуса и пояса</label></td></tr>
|
||||
<tr><td><input type="radio" id="D3" name="defend" value="3" onclick="setdefend()" /><label for="D3">блок пояса и ног</label></td></tr>
|
||||
<tr><td><input type="radio" id="D4" name="defend" value="4" onclick="setdefend()" /><label for="D4">блок головы и ног</label></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center bgcolor=f2f0f0>
|
||||
<table cellspacing=0 cellpadding=0 width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
<td align=center><? if($user['vip'] > 0 || $user['align'] == 2.99 || $user['id'] == 10063) { ?> <input type="submit" name="go" value="Автоудар" onclick="this.disabled = true; checksubmit_vip(); return false;" /><? } ?> <input type="submit" name="go" value="Вперед !!!" onclick="this.disabled = true; checksubmit(); return false;" id="at" /></td><!--checksubmit(); -->
|
||||
<td align=right>
|
||||
<img src='i/ico_refresh.gif' width="16" height="19" style='cursor: pointer;' id="refresh" />
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<input type="hidden" name="enemy" value="<?=$fbattle->enemy?>" />
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
<?
|
||||
break;
|
||||
case 2 :
|
||||
if(($user['hp']>0) && $fbattle->battle) {
|
||||
echo '<FONT COLOR=red>Ожидаем хода противника...</FONT><BR><CENTER><INPUT TYPE=submit value="Обновить" name=',(($user['battle']>0)?"battle":"end"),'><BR></CENTER>';
|
||||
}
|
||||
elseif($user['hp'] <= 0 && $fbattle->battle) {
|
||||
ref_drop ($user['id']);
|
||||
echo '<FONT COLOR=red>Ожидаем, пока бой закончат другие игроки...</FONT><BR><CENTER><INPUT TYPE=submit value="Обновить" name=',(($user['battle']>0)?"battle":"end"),'><BR></CENTER>';
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
echo "<center><br />Противник долго не делает свой ход, вы можете закончить бой победителем<br />
|
||||
<INPUT TYPE=submit value=\"Да, я победил!!!\" name=victory_time_out id=\"refreshb\"><br />";
|
||||
if(!$fbattle->user['in_tower'] && $fbattle->user['room']!=200) {
|
||||
echo "или признать ничью<br />
|
||||
<INPUT TYPE=submit id=\"refreshb\" value=\"Считаем, что этого боя не было\" name=victory_time_out2><br />";
|
||||
}
|
||||
echo "или<br />
|
||||
<INPUT TYPE=submit value=\"Подождать еще немного\" name=",(($user['battle']>0)?"battle":"end"),">
|
||||
</center>";
|
||||
break;
|
||||
}
|
||||
echo '</form>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($enemy == 0){
|
||||
// проверяем на вшивость
|
||||
if(!$fbattle->battle) {
|
||||
if($user['battle']) { $ll = $user['battle'];} else { $ll = $_POST['batl']; }
|
||||
if(!$ll)
|
||||
{
|
||||
$ll_r=mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE (`t1` LIKE '%{$user['id']}%' || `t2` LIKE '%{$user['id']}%') AND `win` = '3' LIMIT 1"));
|
||||
$ll=$ll_r['id'];
|
||||
}
|
||||
$data = @mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = {$ll} LIMIT 1"));
|
||||
$damage = unserialize($data['damage']);
|
||||
$exp = unserialize($data['exp']);
|
||||
if(empty($damage[$user['id']])) { $damage[$user['id']] = 0; }
|
||||
if($user['caveleader'] > 0 || $user['laba'] > 0) {
|
||||
$rep = floor($damage[$user['id']]/300);
|
||||
if($rep <= 0) {
|
||||
$rep = 0;
|
||||
}
|
||||
$ads = '. Репутации: '.$rep.' ед.';
|
||||
} else {
|
||||
$rep = 0;
|
||||
$ads = '.';
|
||||
}
|
||||
|
||||
echo '<center><br /><b><font color=red>Бой закончен! Всего вами нанесено урона '.$damage[$user['id']].' HP. Получено опыта '.(int)$exp[$user['id']].' ('.check_proc($user['id']).'%)'.$ads.'</FONT></B><br /><input type="submit" value="Вернуться" name="end" /><br /></center>';
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
|
||||
</center>
|
||||
<? }
|
||||
if($fbattle->battle) {
|
||||
?>
|
||||
<hr />
|
||||
<div id=mes>
|
||||
<?
|
||||
foreach($fbattle->t1 as $k => $v) {
|
||||
if(in_array($v, array_keys($fbattle->battle))) {
|
||||
++$i;
|
||||
if($i > 1) { $cc = ', '; } else { $cc = ''; }
|
||||
$ffs .= $cc.nick4($v, "B1");
|
||||
$zz .= "private [".nick7($v)."] ";
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
?>
|
||||
<img src="i/lock.gif" width="20" height="15" border="0" style="cursor: pointer;" onclick="Prv('<?=$zz?> ')" />
|
||||
<?=$ffs?>
|
||||
против
|
||||
<?
|
||||
$ffs = ''; $zz = '';
|
||||
foreach($fbattle->t2 as $k => $v) {
|
||||
if(in_array($v, array_keys($fbattle->battle))) {
|
||||
++$i;
|
||||
if($i > 1) { $cc = ', '; } else { $cc = ''; }
|
||||
$ffs .= $cc.nick4($v, "B2");
|
||||
$zz .= "private [".nick7($v)."] ";
|
||||
}
|
||||
}
|
||||
$i = 0;
|
||||
?>
|
||||
<img src="i/lock.gif" width="20" height="15" border="0" style="cursor: pointer;" onclick="Prv('<?=$zz?> ')" />
|
||||
<?=$ffs?>
|
||||
<hr />
|
||||
На данный момент вами нанесено урона: <b><?=(int)$fbattle->damage[$user['id']]?> HP</b>.
|
||||
<? if(!$user['in_tower']) { ?>
|
||||
<font style="margin-left: 200px;">(Бой идет с таймаутом <?=$fbattle->battle_data['timeout']?> мин.)</font>
|
||||
<? } ?>
|
||||
<br /><hr />
|
||||
</div>
|
||||
<?
|
||||
} else {
|
||||
echo "<HR>";
|
||||
}
|
||||
|
||||
if($user['battle']) { $ll = $user['battle']; } elseif($_REQUEST['batl']) { $ll = $_REQUEST['batl']; } else { $ll = $_SESSION['batl']; }
|
||||
|
||||
if(!$ll) {
|
||||
$ll_r = mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE (`t1` LIKE '%{$user['id']}%' OR `t2` LIKE '%{$user['id']}%') AND `win` = 3 LIMIT 1"));
|
||||
$ll = $ll_r['id'];
|
||||
}
|
||||
|
||||
$fs = filesize("backup/logs/battle".$ll.".txt");
|
||||
$fh = fopen("backup/logs/battle".$ll.".txt", "r");
|
||||
fseek($fh, -4256, SEEK_END);
|
||||
$log[0] = fread($fh, 4256);
|
||||
fclose($fh);
|
||||
$log = explode("<BR>", $log[0]);
|
||||
$ic = count($log)-2;
|
||||
|
||||
if($fs >= 4256) {
|
||||
$max = 1;
|
||||
} else {
|
||||
$max = 0;
|
||||
}
|
||||
|
||||
for($i = $ic; $i >= 0+$max; --$i) {
|
||||
if(eregi("<hr>", $log[$i])) {
|
||||
$log[$i] = str_replace("<hr>", "", $log[$i]);
|
||||
$log[$i] = $log[$i]."<hr>";
|
||||
}
|
||||
if(eregi(">".$user['login']."</span>", $log[$i])) {
|
||||
$log[$i] = str_replace("<span class=date>", "<span class=date2>", $log[$i]);
|
||||
}
|
||||
if($ll != 0) {
|
||||
if(eregi("<hr>", $log[$i])) {
|
||||
echo $log[$i];
|
||||
} else {
|
||||
echo $log[$i]."<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($ic);
|
||||
|
||||
if($max == 1) {
|
||||
?>
|
||||
Полную версию лога боя, смотрите <a href="logs.php?log=<?=$user['battle']?>" target="_blank">здесь»</a>
|
||||
<br />
|
||||
<? } ?>
|
||||
</td>
|
||||
<td valign=top align=rigth>
|
||||
<table width=250 cellspacing=0 cellpadding=0><tr>
|
||||
<td valign=top width=250 nowrap><center>
|
||||
<?
|
||||
|
||||
if($fbattle->return == 1) {
|
||||
echo showinf_pers($fbattle->enemy, 1, 1);
|
||||
} else {
|
||||
if($fbattle->battle_data['type'] == 4 || $fbattle->battle_data['type'] == 5) {
|
||||
$a = array(6, 16);
|
||||
echo "<img src='i/im/".$a[mt_rand(0, 1)].".gif' />";
|
||||
} elseif($fbattle->return > 1) {
|
||||
echo "<img src='i/im/".mt_rand(1, 34).".jpg' />";
|
||||
} elseif($exp[$user['id']] > 0) {
|
||||
echo "<img src='i/im/".mt_rand(113, 115).".jpg' />";
|
||||
} else {
|
||||
echo "<img src='i/im/".mt_rand(110, 112).".jpg' />";
|
||||
}
|
||||
}
|
||||
|
||||
if($fbattle->needrefresh) {
|
||||
header("Location: fbattle.php?".time());
|
||||
}
|
||||
|
||||
if($fbattle->battle_data['needbb']) {
|
||||
foreach($fbattle->battle as $k => $v) {
|
||||
if($k > _BOTSEPARATOR_) {
|
||||
foreach($v as $k2 => $v2) {
|
||||
if($k2 < _BOTSEPARATOR_) continue;
|
||||
$hp_1 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "'.$k.'" LIMIT 1'));
|
||||
$hp_2 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "'.$k2.'" LIMIT 1'));
|
||||
if($fbattle->battle[$k][$k2][0] && $fbattle->battle[$k2][$k][0] && $hp_1['hp'] > 0 && $hp_2['hp'] > 0 && time()-$fbattle->battle[$k][$k2][2] > 1 && time()-$fbattle->battle[$k2][$k][2] > 1) {
|
||||
$at_1 = $fbattle->battle[$k][$k2][0];
|
||||
$def_1 = $fbattle->battle[$k][$k2][1];
|
||||
$at_2 = $fbattle->battle[$k2][$k][0];
|
||||
$def_2 = $fbattle->battle[$k2][$k][1];
|
||||
$fbattle->makechange($k, $k2, $at_1, $at_2, $def_1, $def_2);
|
||||
$fbattle->write_log();
|
||||
$fbattle->battle[$k][$k2] = array(0, 0, time());
|
||||
$fbattle->battle[$k2][$k] = array(0, 0, time());
|
||||
$fbattle->needupdate = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($fbattle->needupdate) {
|
||||
$fbattle->UpdateBattle();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div id="oMenu" onmouseout="closeMenu()" style="position: absolute; border: 1px solid #666; background-color: #CCC; display: none; "></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php mysql_query("UNLOCK TABLES"); ?>
|
||||
160
classes/filter_class.php
Normal file
160
classes/filter_class.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?
|
||||
class Filter {
|
||||
|
||||
public $sm = array("laugh"=>1,"fingal"=>1,"eek"=>1,"smoke"=>1,"hi"=>1,"bye"=>1,"king"=>1,"king2"=>1,"boks2"=>1,"boks"=>1,"gent"=>1,"lady"=>1,"tongue"=>1,"smil"=>1,"rotate"=>1,"ponder"=>1,"bow"=>1,"angel"=>1,"angel2"=>1,"hello"=>1,"dont"=>1,"idea"=>1,"mol"=>1,"super"=>1,"beer"=>1,"drink"=>1,"baby"=>1,"tongue2"=>1,"sword"=>1,"agree"=>1,"loveya"=>1,"kiss"=>1,"kiss2"=>1,"kiss3"=>1,"kiss4"=>1,"rose"=>1,"love"=>1,"love2"=>1,"confused"=>1,"yes"=>1,"no"=>1,"shuffle"=>1,"nono"=>1,"maniac"=>1,"privet"=>1,"ok"=>1,"ninja"=>1,"pif"=>1,"smash"=>1,"alien"=>1,"pirate"=>1,"gun"=>1,"trup"=>1,"mdr"=>1,"sneeze"=>1,"mad"=>1,"friday"=>1,"cry"=>1,"grust"=>1,"rupor"=>1,"fie"=>1,"nnn"=>1,"row"=>1,"red"=>1,"lick"=>1,"help"=>1,"wink"=>1,"jeer"=>1,"tease"=>1,"nunu"=>1,"inv"=>1,"duel"=>1,"susel"=>1,"nun"=>1,"kruger"=>1,"flowers"=>1,"horse"=>1,"hug"=>1,"str"=>1,"alch"=>1,"pal"=>1,"mag"=>1,"sniper"=>1,"vamp"=>1,"doc"=>1,"doc2"=>1,"sharp"=>1,"naem"=>1,"naem2"=>1,"naem3"=>1,"invis"=>1,"chtoza"=>1,"beggar"=>1,"sorry"=>1,"sorry2"=>1,"creator"=>1,"grace"=>1,"dustman"=>1,"carreat"=>1,"lordhaos"=>1,"ura"=>1,"elix"=>1,"dedmoroz"=>1,"snegur"=>1,"showng"=>1,"superng"=>1,"podz"=>1,"sten"=>1,"devil"=>1,"cat"=>1,"owl"=>1,"lightfly"=>1,"snowfight"=>1,"rocket"=>1,"ball"=>1,"smile"=>1,"fuck"=>1);
|
||||
public $abuse = array("лох"=>1,"мудак"=>2);
|
||||
|
||||
public function e($t) {
|
||||
mysql_query('INSERT INTO `chat` (`text`, `city`, `to`, `type`, `new`, `time`) VALUES ("#'.date('d.m.Y').' %'.date('H:i:s').': <b>'.mysql_real_escape_string($t).'</b>", "capitalcity", "The Kite Runner", "6", "1", "-1")');
|
||||
}
|
||||
|
||||
public function setOnline($online, $uid, $afk) {
|
||||
$add = 0;
|
||||
if(time()-$online >= 1) {
|
||||
if(time()-$online < 60) {
|
||||
$add += time()-$online;
|
||||
} else {
|
||||
$add += 60;
|
||||
}
|
||||
}
|
||||
|
||||
$afk = 0;
|
||||
if($add > 0) {
|
||||
$on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `id` = "'.$uid.'" LIMIT 1'));
|
||||
if(isset($on['id'])) {
|
||||
$mt = 0;
|
||||
$lst = time();
|
||||
mysql_query('UPDATE `online` SET `date` = "'.$lst.'" WHERE `id` = "'.$on['id'].'" LIMIT 1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function mystr($string) {
|
||||
$str = strtolower($string);
|
||||
if(strtolower('S') != 's') {
|
||||
$ru = 'АБВГДЕЁЖЗРЙКЛМНОПРСТУФХЦЧШЩЫРЮЯЬЪ';
|
||||
$ru2 = 'абвгдеёжзийклмнопрстуфхцчшщъьыэюяьъ';
|
||||
$en = 'QWERTYUIOPASDFGHJKLZXCVBNM';
|
||||
$en2 = 'qwertyuiopasdfghjklzxcvbnm';
|
||||
$i = 0;
|
||||
while($i < 33) {
|
||||
if(isset($ru[$i])) {
|
||||
$str = strtr($str, $ru[$i], $ru2[$i]);
|
||||
}
|
||||
if(isset($en[$i])) {
|
||||
$str = strtr($str, $en[$i], $en2[$i]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function reverse_i($str) {
|
||||
$newstr = $str;
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
public function spamFiltr($txt) {
|
||||
$nospam = 0;
|
||||
$txt = str_replace('>', '', $txt);
|
||||
$txt = str_replace('<', '', $txt);
|
||||
$txt = str_replace('"', '', $txt);
|
||||
$txt = $this->mystr($txt);
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
while($i <= count($this->sm)) {
|
||||
if(isset($this->sm[$i])) {
|
||||
$txt = preg_replace('/:'.$this->sm[$i].':/', "", $txt);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$spam = file_get_contents('spambase.txt',"r");
|
||||
$testEN = preg_replace('/[^a-z]*/i', '', $txt);
|
||||
$testEN2 = $txt;
|
||||
$testEN2 = str_replace('Р°','a',$testEN2);
|
||||
$testEN2 = str_replace('Р±','b',$testEN2);
|
||||
$testEN2 = str_replace('СЃ','c',$testEN2);
|
||||
$testEN2 = str_replace('РІ','b',$testEN2);
|
||||
$testEN2 = str_replace('Рµ','e',$testEN2);
|
||||
$testEN2 = str_replace('С‚','t',$testEN2);
|
||||
$testEN2 = str_replace('Рѕ','o',$testEN2);
|
||||
$testEN2 = str_replace('СЂ','p',$testEN2);
|
||||
$testEN2 = str_replace('Рј','m',$testEN2);
|
||||
$testEN2 = str_replace('РЅ','h',$testEN2);
|
||||
$testEN2 = str_replace('Сѓ','y',$testEN2);
|
||||
$testEN2 = str_replace('Рє','k',$testEN2);
|
||||
$testEN2 = str_replace('Рё','u',$testEN2);
|
||||
$testEN2 = str_replace('С…','x',$testEN2);
|
||||
$testEN2 = str_replace('()','o',$testEN2);
|
||||
$testEN2 = str_replace('0','o',$testEN2);
|
||||
$testEN2 = preg_replace('/[^a-z]*/i', '', $testEN2);
|
||||
$testRU = preg_replace('/[^Р°-СЏ]*/i', '', $txt);
|
||||
|
||||
$testRU2 = $txt;
|
||||
$testRU2 = str_replace('a','Р°',$testRU2);
|
||||
$testRU2 = str_replace('b','Р±',$testRU2);
|
||||
$testRU2 = str_replace('c','СЃ',$testRU2);
|
||||
$testRU2 = str_replace('b','РІ',$testRU2);
|
||||
$testRU2 = str_replace('e','Рµ',$testRU2);
|
||||
$testRU2 = str_replace('t','С‚',$testRU2);
|
||||
$testRU2 = str_replace('o','Рѕ',$testRU2);
|
||||
$testRU2 = str_replace('p','СЂ',$testRU2);
|
||||
$testRU2 = str_replace('m','Рј',$testRU2);
|
||||
$testRU2 = str_replace('h','РЅ',$testRU2);
|
||||
$testRU2 = str_replace('y','Сѓ',$testRU2);
|
||||
$testRU2 = str_replace('k','Рє',$testRU2);
|
||||
$testRU2 = str_replace('x','С…',$testRU2);
|
||||
$testRU2 = str_replace('u','Рё',$testRU2);
|
||||
$testRU2 = str_replace('()','Рѕ',$testRU2);
|
||||
$testRU2 = str_replace('0','Рѕ',$testRU2);
|
||||
$testRU2 = preg_replace('/[^Р°-СЏ]*/i', '', $testRU2);
|
||||
$i = 0; $spe = explode('|',$spam);
|
||||
while($i <= count($spe)) {
|
||||
if(isset($spe[$i]) && $spe[$i] != '' && $spe[$i] != 'capitalcity.old-dark.ru') {
|
||||
if(preg_match("/".($spe[$i])."/i", ($testEN))) {
|
||||
$nospam .= '%'.$spe[$i];
|
||||
} elseif(preg_match("/".($spe[$i])."/i", ($testRU))) {
|
||||
$nospam .= '%'.$spe[$i];
|
||||
} elseif(preg_match("/".($spe[$i])."/i", ($testEN2))) {
|
||||
$nospam .= '%'.$spe[$i];
|
||||
} elseif(preg_match("/".($spe[$i])."/i", ($testRU2))) {
|
||||
$nospam .= '%'.$spe[$i];
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $nospam;
|
||||
}
|
||||
|
||||
public function getSmiles($txt, $lg) {
|
||||
$i = 0; $j = 0;
|
||||
$txt = ' '.$txt; $h = explode(':', $txt);
|
||||
while($i <= count($this->sm)) {
|
||||
if(isset($h[$i])) {
|
||||
if(isset($this->sm[$h[$i]])) {
|
||||
if($j < 6) {
|
||||
$clk = 'onclick=\"top.addSm(\''.$h[$i].'\');\" style=\"cursor: pointer;\"';
|
||||
$h[$i] = '*not_dbl_ponts*<img '.$clk.' src=\"//img.capitalcity.old-dark.ru/i/smile/'.$h[$i].'.gif\" .>*not_dbl_ponts*';
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$txt = implode($h, ':');
|
||||
$txt = str_replace(':*not_dbl_ponts*', '', $txt);
|
||||
$txt = str_replace('*not_dbl_ponts*:', '', $txt);
|
||||
$txt = str_replace('*not_dbl_ponts*', '', $txt);
|
||||
$txt = trim($txt,' ');
|
||||
return $txt;
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
trigger_error('Дублирование не допускается.', E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
$filter = new Filter();
|
||||
?>
|
||||
590
classes/quests_class.php
Normal file
590
classes/quests_class.php
Normal file
@@ -0,0 +1,590 @@
|
||||
<?
|
||||
|
||||
class Quests {
|
||||
public $free_x = 28, $data = array(), $error = '';
|
||||
|
||||
public function testGood($pl, $uid) {
|
||||
if(!is_array($pl)) {
|
||||
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.$pl.'" LIMIT 1'));
|
||||
}
|
||||
|
||||
$r = 1;
|
||||
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT `id`, `vals` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" LIMIT 1'));
|
||||
if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') {
|
||||
$r = 2;
|
||||
}
|
||||
unset($qlst, $qlst2);
|
||||
|
||||
$d = $this->expl($pl['tr_date']);
|
||||
|
||||
if(isset($d['tr_endq'])) {
|
||||
$i = 0;
|
||||
$e = explode(',', $d['tr_endq']);
|
||||
while($i < count($e)) {
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT `id`, `vals` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$e[$i].'" AND `vals` = "win" LIMIT 1'));
|
||||
if(!isset($qlst['id'])) {
|
||||
$r = 3;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
unset($qn, $qlst, $qlst2);
|
||||
}
|
||||
|
||||
if(isset($d['tr_zdr'])) {
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" ORDER BY `time` DESC LIMIT 1'));
|
||||
if($qlst['time']+($d['tr_zdr']*60*60)-time() > 0) {
|
||||
$r = 4;
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
if(isset($d['tr_tm1'])) {
|
||||
$d['tr_tm1'] = str_replace('d', date('d'), $d['tr_tm1']);
|
||||
$d['tr_tm1'] = str_replace('m', date('m'), $d['tr_tm1']);
|
||||
$d['tr_tm1'] = str_replace('y', date('y'), $d['tr_tm1']);
|
||||
$d['tr_tm2'] = str_replace('d', date('d'), $d['tr_tm2']);
|
||||
$d['tr_tm2'] = str_replace('m', date('m'), $d['tr_tm2']);
|
||||
$d['tr_tm2'] = str_replace('y', date('y'), $d['tr_tm2']);
|
||||
}
|
||||
|
||||
if(isset($d['tr_raz'])) {
|
||||
$qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" LIMIT '.$d['tr_raz'], 2);
|
||||
if($d['tr_raz'] > 0 && $d['tr_raz']-$qlst[0] <= 0) {
|
||||
$r = 5;
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
if(isset($d['tr_raz2'])) {
|
||||
$qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" AND `vals` != "win" LIMIT '.$d['tr_raz2'], 2);
|
||||
if($d['tr_raz2']-$qlst[0] <= 0) {
|
||||
$r = 6;
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
trigger_error('Дублирование не допускается.', E_USER_ERROR);
|
||||
}
|
||||
|
||||
public function startq($id, $val = NULL, $uid) {
|
||||
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `delete` = "0" AND `id` = "'.mysql_real_escape_string($id).'" LIMIT 1'));
|
||||
if(isset($pl['id'])) {
|
||||
$tms = (time()+60*60*$pl['time']);
|
||||
$this->addAction(time(), 'start_quest'.$pl['id'], 'go', $uid, $tms);
|
||||
$this->error = 'Вы успешно получили задание "'.$pl['name'].'"';
|
||||
} else {
|
||||
$this->error = 'Не удалось получить данное задание ...';
|
||||
}
|
||||
}
|
||||
|
||||
public function list_quest($pl, $u) {
|
||||
$r = ''; $t = ''; $nagr = ''; $tr = '';
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u.'" AND `vars` = "start_quest'.$pl['id'].'" ORDER BY `time` DESC LIMIT 1'));
|
||||
|
||||
$ds = $this->expl($pl['win_date']);
|
||||
if(isset($ds['add_cr'])) {
|
||||
$nagr .= 'Деньги : '.$ds['add_cr'].' кр. ';
|
||||
}
|
||||
if(isset($ds['add_point'])) {
|
||||
$nagr .= ' Репутация : '.$ds['add_point'].' ед. ';
|
||||
}
|
||||
if(isset($ds['add_exp'])) {
|
||||
$nagr .= ' Опыт : '.$ds['add_exp'].' ед. ';
|
||||
}
|
||||
|
||||
$d = $this->expl($pl['act_date']);
|
||||
if(isset($d['heal'])) {
|
||||
$tr .= '<small>Вылечить <b>'.$d['heal'].'</b> игроков от травм.</small><br />';
|
||||
}
|
||||
if(isset($d['tr_win_haot'])) {
|
||||
$tr .= '<small>Выйграть <b>'.$d['tr_win_haot'].'</b> хаотических поединков.</small><br />';
|
||||
}
|
||||
if(isset($d['kill_clone'])) {
|
||||
$tr .= '<small>Выйграть <b>'.$d['kill_clone'].'</b> поединков против своего клона.</small><br />';
|
||||
}
|
||||
// if(isset($d['tr_win'])) {
|
||||
// $tr .= '<small>Выйграть <b>'.$d['tr_win'].'</b> физических поединков против игроков.</small><br />';
|
||||
// }
|
||||
if(isset($d['kill_bot'])) {
|
||||
$x = '';
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$i = 0;
|
||||
while($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT `id`, `login` FROM `users` WHERE `id` = "'.$ex2[0].'" LIMIT 1'));
|
||||
if(isset($bot2['id'])) {
|
||||
$x .= ' • <b>'.$bot2['login'].'</b> '.$ex2[1].'<br />';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($x != '') {
|
||||
$x = trim($x, ', ');
|
||||
$tr .= '<small>Убить ботов: <br />'.$x.'</small>';
|
||||
}
|
||||
}
|
||||
if($tr != '') {
|
||||
$ts = 'Требования :<br />'.$tr;
|
||||
}
|
||||
|
||||
$za = '';
|
||||
if($qlst['time']+($pl['heal']*60*60)-time() > 0) {
|
||||
$tms = $this->timeOut($qlst['time']+($pl['heal']*60*60)-time());
|
||||
$za = '<b style=\'color: Red;\'>Задержка еще : '.$tms.'</b><br />';
|
||||
}
|
||||
|
||||
$d = $this->expl($pl['tr_date']);
|
||||
$r .= '<div class="ctContainerA quest_target_item">';
|
||||
$r .= '<div class="ctTitle"><a class="action-start" href="?quid='.$pl['id'].'">я берусь</a>Задание "'.$pl['name'].'"</div>';
|
||||
|
||||
$r .= '<div><div>'.$pl['info'].'<hr style=\'width: 75%;\' /></div>
|
||||
<div>
|
||||
<div><span style=\'font-weight: bold;\'>Награда :</span> '.$nagr.'</div>
|
||||
</div>
|
||||
<div>
|
||||
<span style=\'font-weight: bold;\'>Время на выполнение:</span> '.$pl['time'].' ч.</span><br />
|
||||
'.$ts.$za.'
|
||||
<div>
|
||||
Задание для ['.$pl['min_lvl'].'-'.$pl['max_lvl'].'] уровней, с задержкой '.$pl['heal'].' ч.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
|
||||
$r .= '</div>';
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function info($pl, $uid) {
|
||||
$r = ''; $t = '';
|
||||
$qst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` = "go" LIMIT 1'));
|
||||
$d = $this->expl($pl['tr_date']);
|
||||
|
||||
if(isset($d['tr_endq'])) {
|
||||
$t .= 'Завершить квесты : ';
|
||||
$i = 0;
|
||||
$e = explode(',', $d['tr_endq']);
|
||||
while($i <= count($e)) {
|
||||
if($e[$i] > 0) {
|
||||
$qn = mysql_fetch_array(mysql_query('SELECT `name` FROM `quests` WHERE `id` = "'.$e[$i].'" LIMIT 1'));
|
||||
if(isset($qn['name'])) {
|
||||
$t .= '"'.$qn['name'].'", ';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$t = trim($t, ', ');
|
||||
$t .= '<br />';
|
||||
unset($qn);
|
||||
}
|
||||
|
||||
if(isset($d['tr_botitm'])) {
|
||||
$t .= 'Из ботов выпадают предметы :<ul>';
|
||||
$e = explode('|', $d['tr_botitm']);
|
||||
$i = 0;
|
||||
while($i < count($e)) {
|
||||
$j = 0;
|
||||
$e2 = explode('-', $e[$i]);
|
||||
|
||||
if($e2[0] > 0) {
|
||||
$qn = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "'.$e2[0].'" LIMIT 1'));
|
||||
$t .= ' • Из "'.$qn['login'].'" выпадает: ';
|
||||
} else {
|
||||
$t .= ' • Из любых ботов выпадает: ';
|
||||
}
|
||||
|
||||
$j = 0;
|
||||
$e3 = explode(',',$e2[1]);
|
||||
while($j < count($e3)) {
|
||||
$e4 = explode('=', $e3[$j]);
|
||||
$qi = mysql_fetch_array(mysql_query('SELECT `id`, `name`, `img` FROM `shop` WHERE `id` = "'.$e4[0].'" LIMIT 1'));
|
||||
$t .= '<img src="/i/sh/'.$qi['img'].'" style="max-height: 12px;"> '.$qi['name'].', ';
|
||||
$j++;
|
||||
}
|
||||
$t = trim($t, ', ');
|
||||
$i++;
|
||||
}
|
||||
$t .= '<br />';
|
||||
unset($qn, $qi, $e2, $e3, $e4);
|
||||
}
|
||||
|
||||
if(isset($d['tr_winitm'])) {
|
||||
$t .= 'После победы выпадают предметы :<br />';
|
||||
$e = explode('|', $d['tr_winitm']);
|
||||
$i = 0;
|
||||
while($i < count($e)) {
|
||||
$j = 0;
|
||||
$e2 = explode('-', $e[$i]);
|
||||
$t .= ' • ';
|
||||
|
||||
if($e2[0] > 0) {
|
||||
$t .= 'Из людей выпадает : ';
|
||||
} else {
|
||||
$t .= 'Из ботов выпадает : ';
|
||||
}
|
||||
|
||||
$j = 0;
|
||||
$e3 = explode(',', $e2[1]);
|
||||
while($j < count($e3)) {
|
||||
$e4 = explode('=', $e3[$j]);
|
||||
$qi = mysql_fetch_array(mysql_query('SELECT `id`, `name`, `img` FROM `shop` WHERE `id` = "'.$e4[0].'" LIMIT 1'));
|
||||
$t .= '<img src="/i/sh/'.$qi['img'].'" style="max-height: 12px;"> '.$qi['name'].', ';
|
||||
$j++;
|
||||
}
|
||||
$t = trim($t, ', ');
|
||||
$t .= '<br />';
|
||||
$i++;
|
||||
}
|
||||
unset($qn, $qi, $e2, $e3, $e4);
|
||||
}
|
||||
|
||||
if(isset($d['tr_zdr'])) {
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" LIMIT 1'));
|
||||
$t .= 'Задержка между выполнением задания : '.$this->timeOut($d['tr_zdr']*60*60);
|
||||
if($qlst['time']+($d['tr_zdr']*60*60)-time() > 0) {
|
||||
$t .= '<small>(Осталось : '.$this->timeOut($qlst['time']+($d['tr_zdr']*60*60)-time()).' ч.)</small>';
|
||||
}
|
||||
$t .= '<br />';
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
if(isset($d['tr_tm1'])) {
|
||||
$d['tr_tm1'] = str_replace('d', date('d'), $d['tr_tm1']);
|
||||
$d['tr_tm1'] = str_replace('m', date('m'), $d['tr_tm1']);
|
||||
$d['tr_tm1'] = str_replace('y', date('y'), $d['tr_tm1']);
|
||||
$d['tr_tm2'] = str_replace('d', date('d'), $d['tr_tm2']);
|
||||
$d['tr_tm2'] = str_replace('m', date('m'), $d['tr_tm2']);
|
||||
$d['tr_tm2'] = str_replace('y', date('y'), $d['tr_tm2']);
|
||||
$t .= 'Период квеста : '.$d['tr_tm1'].' - '.$d['tr_tm2'].'<br />';
|
||||
}
|
||||
|
||||
if(isset($d['tr_raz'])) {
|
||||
if($d['tr_raz'] == -1) {
|
||||
$t .= 'Сколько еще раз можно выполнить задание: <b><small>бесконечно</small></b><br>';
|
||||
} else {
|
||||
$qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" LIMIT '.$d['tr_raz'], 2);
|
||||
$t .= 'Сколько раз можно выполнить задание: '.($d['tr_raz']-$qlst[0]).'<br />';
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
if(isset($d['tr_raz2'])) {
|
||||
$qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" AND `vals` != "win" LIMIT '.$d['tr_raz2'], 2);
|
||||
$t .= 'Осталось попыток выполнить задание : '.($d['tr_raz2']-$qlst[0]).'<br />';
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
$d = $this->expl($pl['act_date']);
|
||||
|
||||
if(isset($d['kill_bot'])) {
|
||||
$x = '';
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$i = 0;
|
||||
if(isset($d['all_kill']) && $d['all_kill'] > 0 ) {
|
||||
while($i < count($ex)) {
|
||||
$x2 = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
if(isset($qst['id'])) {
|
||||
$x2 = $this->testAction('`uid` = "'.$uid.'" AND `time` > '.$qst['time'].' AND `vars` = "win_bot_'.$ex2[0].'" LIMIT '.$ex2[1], 2);
|
||||
$x2 = (0+$x2[0]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$ex2[0].'" LIMIT 1'));
|
||||
$bot2['id'] = $bot2['id'];
|
||||
if(isset($bot2['id'])){
|
||||
$x .= ' • <b>'.$bot2['login'].'</b> ['.$x2.'/'.$d['all_kill'].']<br />';
|
||||
} else {
|
||||
$x .= ' • <b>'.$pl['name'].'</b> ['.$x2.'/'.$d['all_kill'].']<br />';
|
||||
}
|
||||
} else {
|
||||
while($i < count($ex)) {
|
||||
$x2 = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$ex2[0].'" LIMIT 1'));
|
||||
if(isset($bot2['id'])) {
|
||||
if(isset($qst['id'])) {
|
||||
$x2 = $this->testAction('`uid` = "'.$uid.'" AND `time` > '.$qst['time'].' AND `vars` = "win_bot_'.$ex2[0].'" LIMIT '.$ex2[1], 2);
|
||||
$x2 = (0+$x2[0]);
|
||||
}
|
||||
$x .= ' • <b>'.$bot2['login'].'</b> ['.$x2.'/'.$ex2[1].']<br />';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if($x != '') {
|
||||
$x = trim($x, ', ');
|
||||
$t .= 'Убить ботов: <br />'.$x.'';
|
||||
}
|
||||
unset($x, $ex, $x2, $bot2, $ex2);
|
||||
}
|
||||
|
||||
if(isset($d['tr_win_haot'])) {
|
||||
$x = $this->testAction('`uid` = "'.$uid.'" AND `time` > "'.$qst['time'].'" AND `vars` = "win_haot" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
$t .= 'Победить в хаотических поединках : ['.$x.'/'.$d['tr_win_haot'].']<br />';
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['kill_clone'])) {
|
||||
$x = $this->testAction('`uid` = "'.$uid.'" AND `time` > "'.$qst['time'].'" AND `vars` = "kill_clone" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
$t .= 'Победите в : ['.$x.'/'.$d['kill_clone'].'] физических боях с клоном.<br />';
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['tr_win'])) {
|
||||
$x = $this->testAction('`uid` = "'.$uid.'" AND `time` > "'.$qst['time'].'" AND `vars` = "win_fiz" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
$t .= 'Победите в : ['.$x.'/'.$d['tr_win'].'] физических против игроков.<br />';
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['heal'])) {
|
||||
$x = $this->testAction('`uid` = "'.$uid.'" AND `time` > "'.$qst['time'].'" AND `vars` LIKE "heal%" AND `vars` != "heal_'.$uid.'" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
$t .= 'Вылечите : ['.$x.'/'.$d['heal'].'] игроков от травм.<br />';
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['tk_itm'])) {
|
||||
$ex = explode(',', $d['tk_itm']);
|
||||
$i = 0; $x = '';
|
||||
while($i < count($ex)) {
|
||||
$ex2 = explode('=',$ex[$i]);
|
||||
$x2 = mysql_fetch_array(mysql_query('SELECT `koll` FROM `inventory` WHERE `prototype` = "'.mysql_real_escape_string($ex2[0]).'" AND `owner` = "'.$uid.'" LIMIT 1'));
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT `id`, `name`, `img` FROM `shop` WHERE `id` = "'.mysql_real_escape_string($ex2[0]).'" LIMIT 1'));
|
||||
$x .= ' • <b>'.$bot2['name'].'</b> ['.$x2[0].'/'.$ex2[1].']<br />';
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($x != '') {
|
||||
$x = trim($x, ', ');
|
||||
$t .= 'Собрать ресурсы : <br />'.$x.'';
|
||||
}
|
||||
}
|
||||
|
||||
if($t != '') {
|
||||
$r .= '<b>Условия задания :</b><br />'.$t.'<br />';
|
||||
$t = '';
|
||||
}
|
||||
|
||||
$ds = $this->expl($pl['win_date']);
|
||||
if(isset($ds['add_cr'])) {
|
||||
$t .= 'Деньги : '.$ds['add_cr'].' кр.<br />';
|
||||
}
|
||||
|
||||
if(isset($ds['add_point'])) {
|
||||
$t .= 'Репутация : '.$ds['add_point'].' ед.<br />';
|
||||
}
|
||||
|
||||
if(isset($ds['add_exp'])) {
|
||||
$t .= 'Опыт : '.$ds['add_exp'].' ед.<br />';
|
||||
}
|
||||
|
||||
if($t != '') {
|
||||
$r = '<b>Награда:</b><br />'.$t.'<br />'.$r;
|
||||
$t = '';
|
||||
}
|
||||
|
||||
if($t != '') {
|
||||
$r = '<br /><b>Действия задания :</b><br />'.$t.'<br />'.$r;
|
||||
$t = '';
|
||||
}
|
||||
|
||||
if($r == '') {
|
||||
$r = 'Дополнительная информация по заданию отсутствует';
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function endq($id, $tp, $user) {
|
||||
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `delete` = "0" AND `min_lvl` <= "'.$user['level'].'" AND `max_lvl` >= "'.$user['level'].'" AND `id` = "'.mysql_real_escape_string($id).'" LIMIT 1'));
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `actions` WHERE `uid` = "'.$user['id'].'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` = "go" LIMIT 1'));
|
||||
if(isset($qlst['id'])) {
|
||||
if($tp == 'end') {
|
||||
mysql_query('UPDATE `actions` SET `vals` = "end" WHERE `id` = "'.$qlst['id'].'" LIMIT 1');
|
||||
$this->error = 'Вы успешно отказались от задания "'.$pl['name'].'"';
|
||||
} elseif($tp == 'win') {
|
||||
mysql_query('UPDATE `actions` SET `vals` = "win" WHERE `id` = "'.$qlst['id'].'" LIMIT 1');
|
||||
}
|
||||
} else {
|
||||
$this->error = 'Не удалось отказаться от задания ...';
|
||||
}
|
||||
}
|
||||
|
||||
public function testAction($filter, $tp) {
|
||||
if($tp == 1) {
|
||||
$ins = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val` FROM `actions` WHERE '.$filter.''));
|
||||
} elseif($tp == 2) {
|
||||
$ins = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `actions` WHERE '.$filter.''));
|
||||
}
|
||||
return $ins;
|
||||
}
|
||||
|
||||
public function timeOut($ttm) {
|
||||
$out = '';
|
||||
$time_still = $ttm;
|
||||
$tmp = floor($time_still/2592000);
|
||||
$id = 0;
|
||||
if($tmp > 0) {
|
||||
$id++;
|
||||
if($id < 3) { $out .= $tmp." мес. "; }
|
||||
$time_still = $time_still-$tmp*2592000;
|
||||
}
|
||||
$tmp = floor($time_still/86400);
|
||||
if($tmp > 0) {
|
||||
$id++;
|
||||
if($id < 3) { $out .= $tmp." дн. "; }
|
||||
$time_still = $time_still-$tmp*86400;
|
||||
}
|
||||
$tmp = floor($time_still/3600);
|
||||
if($tmp > 0) {
|
||||
$id++;
|
||||
if($id < 3) { $out .= $tmp." ч. "; }
|
||||
$time_still = $time_still-$tmp*3600;
|
||||
}
|
||||
$tmp = floor($time_still/60);
|
||||
if($tmp > 0) {
|
||||
$id++;
|
||||
if($id < 3) { $out .= $tmp." мин. "; }
|
||||
}
|
||||
if($out == '') {
|
||||
if($time_still < 0) {
|
||||
$time_still = 0;
|
||||
}
|
||||
$out = $time_still.' сек.';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function addAction($time, $vars, $vls, $uid, $val) {
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("'.$uid.'", "'.$time.'", "capitalcity", "0", "'.mysql_real_escape_string($vars).'", "'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'", "'.mysql_real_escape_string($vls).'", "'.$val.'")');
|
||||
if($ins) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function expl($d) {
|
||||
$i = 0;
|
||||
$e = explode(':|:', $d);
|
||||
while($i < count($e)) {
|
||||
$t = explode(':=:', $e[$i]);
|
||||
if(isset($t[0])) {
|
||||
$dr[$t[0]] = $t[1];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
unset($i, $e, $t);
|
||||
return $dr;
|
||||
}
|
||||
|
||||
public function winqst($id, $user) {
|
||||
$bad = 0;
|
||||
$qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$user['id'].'" AND `vars` = "start_quest'.$id.'" AND `vals` = "go" LIMIT 1'));
|
||||
$qu = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.$id.'" LIMIT 1'));
|
||||
if(isset($qlst['id'])) {
|
||||
$d = $this->expl($qu['act_date']);
|
||||
|
||||
if(isset($d['heal'])) {
|
||||
$x = $this->testAction('`uid` = "'.$user['id'].'" AND `time` > "'.$qlst['time'].'" AND `vars` LIKE "heal%" AND `vars` != "heal_'.$user['id'].'" LIMIT 1', 2);
|
||||
$x = ($x[0]+0);
|
||||
if($x < $d['heal']) { $bad = 1; }
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['tr_win'])) {
|
||||
$x = $this->testAction('`uid` = "'.$user['id'].'" AND `time` > "'.$qlst['time'].'" AND `vars` = "win_fiz" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
if($x < $d['tr_win']) { $bad = 1; }
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['kill_clone'])) {
|
||||
$x = $this->testAction('`uid` = "'.$user['id'].'" AND `time` > "'.$qlst['time'].'" AND `vars` = "kill_clone" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
if($x < $d['kill_clone']) { $bad = 1; }
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['tr_win_haot'])) {
|
||||
$x = $this->testAction('`uid` = "'.$user['id'].'" AND `time` > "'.$qlst['time'].'" AND `vars` = "win_haot" LIMIT 1', 2);
|
||||
$x = (0+$x[0]);
|
||||
if($x < $d['tr_win_haot']) { $bad = 1; }
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if(isset($d['kill_bot'])) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$i = 0;
|
||||
while($i < count($ex)) {
|
||||
$x = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT `id`, `login` FROM `users` WHERE `id` = "'.$ex2[0].'" LIMIT 1'));
|
||||
if(isset($bot2['id'])) {
|
||||
if(isset($qlst['id'])) {
|
||||
$x = $this->testAction('`uid` = "'.$user['id'].'" AND `time` > "'.$qlst['time'].'" AND `vars` = "win_bot_'.$ex2[0].'"', 2);
|
||||
$x = ($x[0]+0);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if($x < $ex2[1]) { $bad = 1; }
|
||||
unset($x);
|
||||
}
|
||||
|
||||
if($bad == 0) {
|
||||
$nagr = $this->expl($qu['win_date']);
|
||||
mysql_query('UPDATE `actions` SET `vals` = "win" WHERE `uid` = "'.$user['id'].'" AND `vars` = "start_quest'.$id.'" LIMIT 1');
|
||||
if(isset($nagr['add_cr'])) {
|
||||
$user['money'] += $nagr['add_cr']; $c .= $nagr['add_cr'].' кр. ';
|
||||
}
|
||||
if(isset($nagr['add_point'])) {
|
||||
$user['doblest'] += $nagr['add_point'];
|
||||
if(isset($nagr['add_cr'])) {
|
||||
$c .= 'и '.$nagr['add_point'].' репутации ';
|
||||
} else {
|
||||
$c .= $nagr['add_point'].' репутации ';
|
||||
}
|
||||
}
|
||||
if(isset($nagr['add_exp'])) {
|
||||
$user['exp'] += $nagr['add_exp'];
|
||||
if(isset($nagr['add_cr']) || isset($nagr['add_point'])) {
|
||||
$c .= 'и '.$nagr['add_exp'].' опыта';
|
||||
} else {
|
||||
$c .= $nagr['add_exp'].' опыта';
|
||||
}
|
||||
}
|
||||
mysql_query('UPDATE `users` SET `money` = "'.$user['money'].'", `exp` = "'.$user['exp'].'", `doblest` = "'.$user['doblest'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
|
||||
$this->error = 'Вы успешно сдали задание!';
|
||||
$text = '<font style="color: Red;">Внимание!</font> За успешно выполненное задание Вы получили : '.$c;
|
||||
$this->msg($text, '{[]}'.$user['login'].'{[]}', $user['room']);
|
||||
} else {
|
||||
$this->error = 'Не все условия задания были выполнены ...';
|
||||
}
|
||||
} else {
|
||||
$this->error = 'Квест не найден ...';
|
||||
}
|
||||
}
|
||||
|
||||
public function msg($text, $who, $room) {
|
||||
$fp = fopen("/tmp/chat.txt", "a");
|
||||
flock($fp, LOCK_EX);
|
||||
fputs($fp, ":[".time()."]:[{$who}]:[".($text)."]:[".$room."]\r\n");
|
||||
fflush($fp);
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
$q = new Quests;
|
||||
88
classes/utils_class.php
Normal file
88
classes/utils_class.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
class Utils {
|
||||
|
||||
public function get_inf($id, $login = null) {
|
||||
if($login != null) {
|
||||
return mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($login).'" LIMIT 1'));
|
||||
} else {
|
||||
return mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1'));
|
||||
}
|
||||
}
|
||||
|
||||
public function show_fields($table) {
|
||||
$fields = array();
|
||||
$res = mysql_query("SHOW COLUMNS FROM `$table`");
|
||||
while($x = mysql_fetch_assoc($res)) {
|
||||
$fields[] = $x['Field'];
|
||||
}
|
||||
foreach($fields as $f) {
|
||||
echo "`".$f."`, ";
|
||||
}
|
||||
}
|
||||
|
||||
public function SecureAll() {
|
||||
global $_POST, $_GET;
|
||||
$RichText = array("title", "text", "comment");
|
||||
if(count($_POST) > 0) {
|
||||
foreach($_POST as $k => $v) {
|
||||
if($v != null) {
|
||||
if(in_array($k, $RichText)) {
|
||||
$_POST[$k] = nl2br($_POST[$k]);
|
||||
$_POST[$k] = mysql_real_escape_string($_POST[$k]);
|
||||
} else {
|
||||
$_POST[$k] = preg_replace("/[^a-zA-Zа-яА-Я0-9_ -]/", "", $_POST[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count($_GET) > 0) {
|
||||
foreach($_GET as $k => $v) {
|
||||
if($v != null)
|
||||
$_GET[$k] = preg_replace("/[^a-zA-Zа-яА-Я0-9_ -]/", "", $_GET[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function Short($uid, $ad) {
|
||||
$us = $this->get_inf($uid);
|
||||
$clan_arr = mysql_fetch_assoc(mysql_query("SELECT `id`, `short` FROM `clans` WHERE `id` = '".$us['klan']."' LIMIT 1"));
|
||||
echo "login=".$us['login']."<br />";
|
||||
echo "level=".$us['level']."<br />";
|
||||
echo "align=".$us['align']."<br />";
|
||||
echo "klan=".$clan_arr['short']."<br />";
|
||||
echo "sex=".$us['sex']."<br />";
|
||||
echo "str=".$us['sila']."<br />";
|
||||
echo "agil=".$us['lovk']."<br />";
|
||||
echo "int=".$us['inta']."<br />";
|
||||
echo "dex=".$us['vinos']."<br />";
|
||||
echo "status=".$us['status']."<br />";
|
||||
echo "borncity=".$us['borncity']."<br />";
|
||||
echo "block=".$us['block']."<br />";
|
||||
echo "palmessage=".$us['palcom']."<br />";
|
||||
echo "online=".(int)(time()-$us['chattime'] < 60*5)."<br />";
|
||||
echo "hp=".$us['hp']."<br />";
|
||||
echo "maxhp=".$us['maxhp']."<br />";
|
||||
if($ad == 2.99) {
|
||||
echo "money=".$us['money']."<br />";
|
||||
echo "rep=".$us['doblest']."<br />";
|
||||
echo "laba=".$us['laba']."<br />";
|
||||
if($us['laba'] > 0) {
|
||||
echo "-----------------------<br />";
|
||||
echo "laba_x=".$us['x']."<br />";
|
||||
echo "laba_y=".$us['y']."<br />";
|
||||
echo "-----------------------<br />";
|
||||
}
|
||||
echo "room=".$us['room']."<br />";
|
||||
}
|
||||
echo "dress=";
|
||||
$dresses = mysql_query("SELECT `id`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = '".$us['id']."' AND `dressed` = 1 AND `type` != 12");
|
||||
while($dr = mysql_fetch_array($dresses)) {
|
||||
echo $dr['name']." ".(int)$dr['duration']."/".(int)$dr['maxdur'].",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$Utils = new Utils();
|
||||
Reference in New Issue
Block a user