remove deprecated

This commit is contained in:
lopar 2020-06-23 22:10:00 +03:00
parent 4a0f48d0d3
commit c784decc91

View File

@ -273,14 +273,12 @@ function ClanImage($clan_id)
}
}
function GiveExp($id, $exp)
{
mysql_query("UPDATE `users` SET `exp` = (`exp`+'" . $exp . "') WHERE `id` = '" . $id . "' LIMIT 1");
function GiveExp($id, $exp){
db::c()->query('UPDATE users SET exp = exp + ?i WHERE id = ?i', $exp, $id);
}
function GiveRep($id, $rep)
{
mysql_query("UPDATE `users` SET `doblest` = (`doblest`+$rep), `rep_laba` = (`rep_laba`+$rep) WHERE `id` = '" . $id . "' LIMIT 1");
function GiveRep($id, $rep){
db::c()->query('UPDATE users SET doblest = (doblest + ?i), rep_laba = (rep_laba + ?i) WHERE `id` = ?i', $rep, $rep, $id);
}
@ -477,7 +475,7 @@ function show_eff_inf($u, $type)
$adds = '';
}
$r .= '<div>';
$r .= '<img class="image" src="/i/{$img[$etype]}">';
$r .= '<img class="image" src="i/{$img[$etype]}">';
$r .= '<span class="title">' . $adds . $effs['name'] . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
@ -504,7 +502,7 @@ function show_eff_inf($u, $type)
function timetoheals($user)
{
$efs = mysql_fetch_array(mysql_query('SELECT SUM(`speed`) AS `speed` FROM `effects` WHERE `owner` = "' . $user['id'] . '" LIMIT 1'));
$efs = db::c()->query('SELECT SUM(`speed`) AS `speed` FROM `effects` WHERE `owner` = ?i', $user['id'])->fetch_assoc_array();
$efs['speed'] += 0;
if ($efs['speed'] > 0) {
$fulltime = $efs['speed'] * 2000;
@ -761,9 +759,9 @@ HTML;
} else {
$rrm = $rooms[$data['room']];
}
$r .= '<center>Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></center>';
$r .= '<div style="text-align: center;">Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></div>';
} else {
$r .= "<center>Персонаж не в игре.</center>";
$r .= '<div style="text-align: center;">Персонаж не в игре.</div>';
}
if ($user['battle'] > 0 && $user['invis'] == 0) {
@ -1604,21 +1602,22 @@ function destructitem($id)
function usemagic($id)
{
global $user;
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1"));
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
$row = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND id = ?i', $user['id'], $id)->fetch_assoc_array();
$bat = db::c()->query('SELECT * FROM `battle` WHERE `id` = ?i', $user['battle'])->fetch_assoc_array();
$all_magic = unserialize($bat['magic']);
$charge = 0;
$magic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '" . $row['magic'] . "' LIMIT 1"));
$magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['magic'])->fetch_assoc_array();
if ($magic['needcharge'] > 0) {
$charge = $magic['needcharge'];
}
$incmagic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '" . $row['includemagic'] . "' LIMIT 1"));
$incmagic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['includemagic'])->fetch_assoc_array();
if ($incmagic['needcharge'] > 0) {
$charge = $incmagic['needcharge'];
}
if (($all_magic[$user['id']] < 1) || ($charge == '0'))
if (($all_magic[$user['id']] < 1) || ($charge == '0')) {
if ((($user['sila'] >= $row['nsila']) &&
($user['lovk'] >= $row['nlovk']) &&
($user['inta'] >= $row['ninta']) &&
@ -1649,40 +1648,37 @@ function usemagic($id)
return false;
}
$magic['targeted'] = $incmagic['targeted'];
echo "<font color=red><b>";
echo "<span class='error'>";
include("magic/" . $incmagic['file']);
echo "</b></font>";
echo "</span>";
} else {
echo "<font color=red><b>";
echo "<span class='error'>";
include("magic/" . $magic['file']);
echo "</b></font>";
echo "</span>";
}
if ($bat) {
if ($row['maxdur'] <= ($row['duration'] + 1)) {
//echo "<!--";
destructitem($row['id']);
//echo "-->";
} else {
if (!$row['magic']) {
mysql_query("UPDATE `inventory` SET `includemagicdex` =`includemagicdex`-{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
db::c()->query('UPDATE `inventory` SET `includemagicdex` =`includemagicdex` - ?i WHERE id = ?i', $bat, $row['id']);
} else {
mysql_query("UPDATE `inventory` SET `duration` =`duration`+{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
db::c()->query('UPDATE `inventory` SET duration = duration + ?i WHERE id = ?i', $bat, $row['id']);
}
}
if (!$charge) $charge = 0;
//ограничение по кол-ву за ход
if ($user['battle'] > 0)
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
$bat = db::c()->query('SELECT * FROM `battle` WHERE `id` = ?i', $user['battle'])->fetch_assoc_array();
if ($bat['magic'] == '')
$all_magic = [];
else
$all_magic = unserialize($bat['magic']);
$all_magic[$user['id']] += $charge;
mysql_query("UPDATE `battle` SET `magic`='" . serialize($all_magic) . "' WHERE `id`='{$user['battle']}';");
db::c()->query('UPDATE `battle` SET `magic`= "?s" WHERE id = ?i', serialize($all_magic), $user['battle']);
}
}
}
}
function addch($text, $room = 0)
@ -1723,7 +1719,7 @@ function addchp($text, $who, $room = 0)
*/
function AddChatSystem($msg)
{
if ($msg) db::c()->query('INSERT INTO `chat` (`cid`,`msg`,`type`) VALUES (?i,"?s","?s")', 1, $msg, 'sys');
if ($msg) {db::c()->query('INSERT INTO `chat` (`cid`,`msg`,`type`) VALUES (?i,"?s","?s")', 1, $msg, 'sys');}
}
function err($t)
@ -1732,174 +1728,174 @@ function err($t)
return true;
}
// TODO: Переписать выдачу травм.
// ставим травму
function settravma($id, $type, $time = 86400, $kill = false)
{
$user = mysql_fetch_array(mysql_query("SELECT `align`, `level` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ((($user['align'] == 2 && mt_rand(1, 100) > 20) && !$kill) || ($user['level'] == 0)) {
return false;
} else {
$travmalist = ["разбитый нос", "сотрясение первой степени", "потрепанные уши", "прикушенный язык", "перелом переносицы", "растяжение ноги", "растяжение руки", "подбитый глаз", "синяк под глазом", "кровоточащее рассечение", "отбитая <пятая точка>", "заклинившая челюсть", "выбитый зуб <мудрости>", "косоглазие"];
$travmalist2 = ["отбитые почки", "вывих <вырезано цензурой>", "сотрясение второй степени", "оторванное ухо", "вывих руки", "оторванные уши", "поврежденный позвоночник", "отбитые почки", "поврежденный копчик", "разрыв сухожилия", "перелом ребра", "перелом двух ребер", "вывих ноги", "сломанная челюсть"];
$travmalist3 = ["пробитый череп", "разрыв селезенки", "смещение позвонков", "открытый перелом руки", "открытый перелом <вырезано цензурой>", "излом носоглотки", "непонятные, но множественные травмы", "сильное внутреннее кровотечение", "раздробленная коленная чашечка", "перелом шеи", "смещение позвонков", "открытый перелом ключицы", "перелом позвоночника", "вывих позвоночника", "сотрясение третьей степени"];
$owntravma = mysql_fetch_array(mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `hp` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13) ORDER BY `type` DESC LIMIT 1"));
if ($type != 0 && $type != 100) {
$owntravma['type'] = $type;
} elseif ($type != 0 && $type == 100 && $owntravma['type'] == 0) {
$type = mt_rand(1, 100);
if ($type < 10) {
$owntravma['type'] = 25;
} elseif ($type < 60) {
$owntravma['type'] = "set";
} elseif ($type < 85) {
$owntravma['type'] = 11;
} else {
$owntravma['type'] = 12;
}
} elseif ($owntravma['type'] == 0) {
$tr = mt_rand(1, 3);
switch ($tr) {
case 1:
$owntravma['type'] = 0;
break;
case 2:
$owntravma['type'] = 11;
break;
case 3:
$owntravma['type'] = 12;
break;
}
}
switch ($owntravma['type']) {
case 20:
$st = mt_rand(0, 2);
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level'] + $st) * 3;
break;
case 2:
$l = ($user['level'] + $st) * 3;
break;
case 3:
$i = ($user['level'] + $st) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
default:
$st = mt_rand(0, 2);
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = $user['level'] + $st;
break;
case 2:
$l = $user['level'] + $st;
break;
case 3:
$i = $user['level'] + $st;
break;
}
$trv = $travmalist[mt_rand(0, count($travmalist) - 1)];
$time = 60 * 60 * mt_rand(1, 5);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '11', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 11:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 2;
break;
case 2:
$l = ($user['level']) * 2;
break;
case 3:
$i = ($user['level']) * 2;
break;
}
$trv = $travmalist2[mt_rand(0, count($travmalist2) - 1)];
$time = 60 * 60 * mt_rand(5, 15);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '12', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 12:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 3;
break;
case 2:
$l = ($user['level']) * 3;
break;
case 3:
$i = ($user['level']) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
$time = 60 * 60 * mt_rand(15, 24);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 13:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 3;
break;
case 2:
$l = ($user['level']) * 3;
break;
case 3:
$i = ($user['level']) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
$time = 60 * 60 * mt_rand(25, 26);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '14', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
}
}
}
function deltravma($id)
{
$owntravmadb = mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `owner` FROM `effects` WHERE `id` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14)");
while ($owntravma = mysql_fetch_array($owntravmadb)) {
mysql_query("DELETE FROM `effects` WHERE `id` = '" . $owntravma['id'] . "' LIMIT 1");
mysql_query("UPDATE `users` SET `sila` = (`sila`+'" . $owntravma['sila'] . "'), `lovk` = (`lovk`+'" . $owntravma['lovk'] . "'), `inta` = (`inta`+'" . $owntravma['inta'] . "') WHERE `id` = '" . $owntravma['owner'] . "' LIMIT 1");
}
}
//function settravma($id, $type, $time = 86400, $kill = false)
//{
// $user = mysql_fetch_array(mysql_query("SELECT `align`, `level` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
// if ((($user['align'] == 2 && mt_rand(1, 100) > 20) && !$kill) || ($user['level'] == 0)) {
// return false;
// } else {
// $travmalist = ["разбитый нос", "сотрясение первой степени", "потрепанные уши", "прикушенный язык", "перелом переносицы", "растяжение ноги", "растяжение руки", "подбитый глаз", "синяк под глазом", "кровоточащее рассечение", "отбитая «пятая точка»", "заклинившая челюсть", "выбитый зуб «мудрости»", "косоглазие"];
// $travmalist2 = ["отбитые почки", "вывих «вырезано цензурой»", "сотрясение второй степени", "оторванное ухо", "вывих руки", "оторванные уши", "поврежденный позвоночник", "отбитые почки", "поврежденный копчик", "разрыв сухожилия", "перелом ребра", "перелом двух ребер", "вывих ноги", "сломанная челюсть"];
// $travmalist3 = ["пробитый череп", "разрыв селезенки", "смещение позвонков", "открытый перелом руки", "открытый перелом «вырезано цензурой»", "излом носоглотки", "непонятные, но множественные травмы", "сильное внутреннее кровотечение", "раздробленная коленная чашечка", "перелом шеи", "смещение позвонков", "открытый перелом ключицы", "перелом позвоночника", "вывих позвоночника", "сотрясение третьей степени"];
// $owntravma = mysql_fetch_array(mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `hp` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13) ORDER BY `type` DESC LIMIT 1"));
// if ($type != 0 && $type != 100) {
// $owntravma['type'] = $type;
// } elseif ($type != 0 && $type == 100 && $owntravma['type'] == 0) {
// $type = mt_rand(1, 100);
// if ($type < 10) {
// $owntravma['type'] = 25;
// } elseif ($type < 60) {
// $owntravma['type'] = "set";
// } elseif ($type < 85) {
// $owntravma['type'] = 11;
// } else {
// $owntravma['type'] = 12;
// }
// } elseif ($owntravma['type'] == 0) {
// $tr = mt_rand(1, 3);
// switch ($tr) {
// case 1:
// $owntravma['type'] = 0;
// break;
// case 2:
// $owntravma['type'] = 11;
// break;
// case 3:
// $owntravma['type'] = 12;
// break;
// }
// }
//
// switch ($owntravma['type']) {
//
// case 20:
// $st = mt_rand(0, 2);
// $zz = mt_rand(1, 3);
// $s = 0;
// $l = 0;
// $i = 0;
// switch ($zz) {
// case 1:
// $s = ($user['level'] + $st) * 3;
// break;
// case 2:
// $l = ($user['level'] + $st) * 3;
// break;
// case 3:
// $i = ($user['level'] + $st) * 3;
// break;
// }
// $trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
// mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
// mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
// return $trv;
// break;
//
// default:
// $st = mt_rand(0, 2);
// $zz = mt_rand(1, 3);
// $s = 0;
// $l = 0;
// $i = 0;
// switch ($zz) {
// case 1:
// $s = $user['level'] + $st;
// break;
// case 2:
// $l = $user['level'] + $st;
// break;
// case 3:
// $i = $user['level'] + $st;
// break;
// }
// $trv = $travmalist[mt_rand(0, count($travmalist) - 1)];
// $time = 60 * 60 * mt_rand(1, 5);
// mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '11', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
// mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
// return $trv;
// break;
//
// case 11:
// $zz = mt_rand(1, 3);
// $s = 0;
// $l = 0;
// $i = 0;
// switch ($zz) {
// case 1:
// $s = ($user['level']) * 2;
// break;
// case 2:
// $l = ($user['level']) * 2;
// break;
// case 3:
// $i = ($user['level']) * 2;
// break;
// }
// $trv = $travmalist2[mt_rand(0, count($travmalist2) - 1)];
// $time = 60 * 60 * mt_rand(5, 15);
// mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '12', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
// mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
// return $trv;
// break;
//
// case 12:
// $zz = mt_rand(1, 3);
// $s = 0;
// $l = 0;
// $i = 0;
// switch ($zz) {
// case 1:
// $s = ($user['level']) * 3;
// break;
// case 2:
// $l = ($user['level']) * 3;
// break;
// case 3:
// $i = ($user['level']) * 3;
// break;
// }
// $trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
// $time = 60 * 60 * mt_rand(15, 24);
// mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
// mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
// return $trv;
// break;
//
// case 13:
// $zz = mt_rand(1, 3);
// $s = 0;
// $l = 0;
// $i = 0;
// switch ($zz) {
// case 1:
// $s = ($user['level']) * 3;
// break;
// case 2:
// $l = ($user['level']) * 3;
// break;
// case 3:
// $i = ($user['level']) * 3;
// break;
// }
// $trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
// $time = 60 * 60 * mt_rand(25, 26);
// mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '14', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
// mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
// return $trv;
// break;
// }
// }
//}
//
//function deltravma($id)
//{
// $owntravmadb = db::c()->query('SELECT id FROM effects WHERE (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14) AND id = ?i', $id);
// while ($owntravma = $owntravmadb->fetch_assoc_array()) {
// db::c()->query('DELETE FROM `effects` WHERE `id` = ?i', $owntravma['id']);
// }
//}
/**
* @param $name
@ -1964,26 +1960,27 @@ function SolveExp($at_id, $def_id, $damage)
$bot_def = false;
if ($at_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $at_id . '" LIMIT 1'));
$bots = db::c()->query('SELECT * FROM bots WHERE id = ?i', $at_id)->fetch_assoc_array();
$at_id = $bots['prototype'];
$bot_active = true;
}
$at = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $at_id)->fetch_assoc();
$def = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $def_id)->fetch_assoc();
$at_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $at_id . "' LIMIT 1"));
$def_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $def_id . "' LIMIT 1"));
$at_cost = db::c()->query('SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = ?i', $at_id)->fetch_assoc_array();
$def_cost = db::c()->query('SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = ?i', $def_id)->fetch_assoc_array();
if ($at_id > _BOTSEPARATOR_) {
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `bots` WHERE `id` = '$at_id' LIMIT 1"));
$table_name = 'bots';
} else {
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `users` WHERE `id` = '$at_id' LIMIT 1"));
$table_name = 'users';
}
$bat_raw = db::c()->query('SELECT battle FROM ?f WHERE id = ?i', $table_name, $at_id)->fetch_assoc_array();
$bat = $bat_raw['battle'];
$bt = db::c()->query('SELECT `blood`,`type`,`t1`,`t2` FROM `battle` WHERE `id` = ?i', $bat)->fetch_assoc();
if ($def_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $def_id . '" LIMIT 1'));
$bots = db::c()->query('SELECT * FROM bots WHERE id = ?i', $def_id)->fetch_assoc_array();
$def_id = $bots['prototype'];
$bot_def = true;
}