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