Define undefined variables

This commit is contained in:
lopar 2018-12-10 22:16:42 +02:00
parent bd506df449
commit 0022ccafe7

View File

@ -36,7 +36,7 @@ function createbot($bot, $login = "")
$rec['login'] = $login;
}
$botname = $rec['login'];
db::c()->query('INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ("?s", "?s", "?s", "?s")', $botname, $bot, $battle, $rec['maxhp']);
db::c()->query('INSERT INTO `bots` (`name`, `prototype`, `hp`) VALUES ("?s", "?s", "?s")', $botname, $bot, $rec['maxhp']);
$nid = db::c()->getLastInsertId();
return array("id" => $nid, "login" => $botname);
} else {
@ -50,8 +50,6 @@ $unkilable = [
'users' => [10962, 10964, 10965]
];
$runes_exp = ['1' => 10500, '2' => 23500, '3' => 38500, '4' => 57000, '5' => 77000, '6' => 103000, '7' => 136500, '8' => 171500, '9' => 212500, '10' => 257500];
$canalenters = [620];
$caverooms = [621];
$userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
@ -105,7 +103,7 @@ function get_out($u)
$pers['vinos'] += $efs['vinos'];
$pers['maxhp'] += $efs['hp'];
}
$efs['owner'] = $user['id'];
$efs['owner'] = $_SESSION['uid'];
mysql_query('UPDATE `effects` SET `owner` = "' . $efs['owner'] . '" WHERE `id` = "' . $efs['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `sila` = "' . $pers['sila'] . '", `lovk` = "' . $pers['lovk'] . '", `inta` = "' . $pers['inta'] . '", `vinos` = "' . $pers['vinos'] . '", `maxhp` = "' . $pers['maxhp'] . '" WHERE `id` = "' . $pers['id'] . '" LIMIT 1');
}
@ -115,6 +113,8 @@ function get_out($u)
function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '', $fields = 0, $uid = 0, $koll = 1, $podzem = 0)
{
global $user;
$flds = [];
$goden = '';
if (!$uid) {
$uid = $user['id'];
}
@ -150,7 +150,7 @@ function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '',
$sql = "";
while ($rec = mysql_fetch_assoc($r)) {
if (!@$flds[$rec['Field']]) continue;
if (!$flds[$rec['Field']]) continue;
if ($rec['Field'] == "dategoden") {
$goden = $rec1[$rec['Field']];
}
@ -169,7 +169,7 @@ function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '',
$goden = $fields["goden"];
}
mysql_query("INSERT INTO `inventory` SET " . ($present ? "`present` = '$present'," : "") . (@$rec1['podzem'] ? "`podzem` = '$rec1[podzem]'," : "") . " `owner` = '$uid', `otdel` = $rec1[razdel] , `prototype` = '$item' " . ($onlyonetrip ? ", `foronetrip` = 1" : "") . ($goden ? ", `dategoden` = '" . ($goden * 60 * 60 * 24 + time()) . "'" : "") . " $sql");
mysql_query("INSERT INTO `inventory` SET " . ($present ? "`present` = '$present'," : "") . ($rec1['podzem'] ? "`podzem` = '$rec1[podzem]'," : "") . " `owner` = '$uid', `otdel` = $rec1[razdel] , `prototype` = '$item' " . ($onlyonetrip ? ", `foronetrip` = 1" : "") . ($goden ? ", `dategoden` = '" . ($goden * 60 * 60 * 24 + time()) . "'" : "") . " $sql");
return array("img" => $rec1['img'], "name" => $rec1['name'], "id" => mysql_insert_id());
}
@ -827,6 +827,7 @@ function show_eff_inf($u, $type)
];
$r = '';
$and = '';
$adds = '';
if ($type == 1) {
$and = " AND `type` != 1022";
}
@ -1003,6 +1004,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$title = '';
$d = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
@ -1328,6 +1330,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
<TD><?php
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$title = '';
$d = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
@ -1573,7 +1576,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
function addActions($time, $vars, $vls, $uid)
{
db::c()->query('LOCK TABLES `actions` WRITE');
$ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $_SERVER['HTTP_X_REAL_IP'], $vls);
$ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['HTTP_X_REAL_IP'], $vls);
db::c()->query('UNLOCK TABLES');
if ($ins) {
return true;
@ -1606,10 +1609,14 @@ function plusorminus($n, $shownum = 1)
* @param bool $infOnly
* @return string
*/
function showitem($row, $type, $returned = false, $infOnly = false)
{
global $user, $runes_exp;
global $user;
$runes_exp = ['1' => 10500, '2' => 23500, '3' => 38500, '4' => 57000, '5' => 77000, '6' => 103000, '7' => 136500, '8' => 171500, '9' => 212500, '10' => 257500];
$returnHTML = '';
$incmagic = [];
$up = '';
if ((($row['maxdur'] <= ($row['duration'])) || ($row['dategoden'] && $row['dategoden'] <= time()))) {
destructitem($row['id']);
}
@ -1632,7 +1639,7 @@ function showitem($row, $type, $returned = false, $infOnly = false)
if ($incmagic['max']) {
$returnHTML .= "<img class=\"tooltip\" src='mg2.php?p=" . ($incmagic['cur'] / $incmagic['max'] * 100) . "&i={$row['img']}' style=\"filter:shadow(color=red, direction=90, strength=3);\"><BR>";
} else {
$returnHTML .= "<img " . ((($row['maxdur'] - 2) <= $row['duration'] && $dress['duration'] > 2) ? " style='background-image:url(i/blink.gif);' " : "") . " src='i/sh/{$row['img']}'><BR>";
$returnHTML .= "<img " . ((($row['maxdur'] - 2) <= $row['duration'] && $row['duration'] > 2) ? " style='background-image:url(i/blink.gif);' " : "") . " src='i/sh/{$row['img']}'><BR>";
}
if (($user['sila'] >= $row['nsila']) &&
@ -1911,7 +1918,8 @@ function showitem($row, $type, $returned = false, $infOnly = false)
function show_rune($slot, $uid, $type = 0)
{
global $user, $runes_exp;
global $user;
$runes_exp = ['1' => 10500, '2' => 23500, '3' => 38500, '4' => 57000, '5' => 77000, '6' => 103000, '7' => 136500, '8' => 171500, '9' => 212500, '10' => 257500];
$us = db::c()->query('SELECT `id`, `rune_1`, `rune_2`, `rune_3` FROM `users` WHERE `id` = ?i', $uid)->fetch_assoc();
if (isset($us['id'])) {
if ($us['rune_' . $slot] > 0) {
@ -2025,6 +2033,9 @@ function dropitemid($slot, $id)
case 26:
$slot1 = 'rune_3';
break;
default:
$slot1 = '';
break;
}
if (mysql_query('UPDATE `users`, `inventory` SET `users`.`' . $slot1 . '` = 0, `inventory`.`dressed` = 0, `users`.`sila` = `users`.`sila` - `inventory`.`gsila`, `users`.`lovk` = `users`.`lovk` - `inventory`.`glovk`, `users`.`inta` = `users`.`inta` - `inventory`.`ginta`, `users`.`intel` = `users`.`intel` - `inventory`.`gintel`, `users`.`maxhp` = `users`.`maxhp` - `inventory`.`ghp`, `users`.`noj` = `users`.`noj` - `inventory`.`gnoj`, `users`.`topor` = `users`.`topor` - `inventory`.`gtopor`, `users`.`dubina` = `users`.`dubina` - `inventory`.`gdubina`, `users`.`mec` = `users`.`mec` - `inventory`.`gmech`, `users`.`mfire` = `users`.`mfire` - `inventory`.`gfire`, `users`.`mwater` = `users`.`mwater` - `inventory`.`gwater`, `users`.`mair` = `users`.`mair` - `inventory`.`gair`, `users`.`mearth` = `users`.`mearth` - `inventory`.`gearth`, `users`.`mlight` = `users`.`mlight` - `inventory`.`glight`, `users`.`mgray` = `users`.`mgray` - `inventory`.`ggray`, `users`.`mdark` = `users`.`mdark` - `inventory`.`gdark`, `users`.`fkrit` = `users`.`fkrit` - `inventory`.`mfkrit`, `users`.`fakrit` = `users`.`fakrit` - `inventory`.`mfakrit`, `users`.`fuvorot` = `users`.`fuvorot` - `inventory`.`mfuvorot`, `users`.`fauvorot` = `users`.`fauvorot` - `inventory`.`mfauvorot`, `users`.`ubron1` = `users`.`ubron1` - `inventory`.`bron1`, `users`.`ubron2` = `users`.`ubron2` - `inventory`.`bron2`, `users`.`ubron3` = `users`.`ubron3` - `inventory`.`bron3`, `users`.`ubron4` = `users`.`ubron4` - `inventory`.`bron4`, `users`.`uminu` = `users`.`uminu` - `inventory`.`minu`, `users`.`umaxu` = `users`.`umaxu` - `inventory`.`maxu` WHERE `inventory`.`id` = `users`.`' . $slot1 . '` AND `inventory`.`dressed` = 1 AND `inventory`.`owner` = "' . $user['id'] . '" AND `users`.`id` = "' . $user['id'] . '"')) {
@ -2040,6 +2051,7 @@ function dropitemid($slot, $id)
function dropitem($slot)
{
global $user;
$wear_arr = [];
switch ($slot) {
case 1:
$slot1 = 'sergi';
@ -2119,6 +2131,9 @@ function dropitem($slot)
case 26:
$slot1 = 'rune_3';
break;
default:
$slot1 = '';
break;
}
{
if (db::c()->query('UPDATE `users` as `u`, `inventory` as `i` SET `u`.?f = 0, `i`.`dressed` = 0,
@ -2236,18 +2251,11 @@ function ref_drop()
function derj($id)
{
//global $user;
$user = db::c()->query('SELECT `id`, `align` FROM `users` WHERE `id` = ?i',$_SESSION['uid'])->fetch_assoc();
$ts = db::c()->query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = ?i',$id)->fetch_assoc();
$al = '(1 = 1)';
if ($ts['nalign'] > 0) {
if ($ts['nalign'] == 1.1) {
if (($user['align'] == 6 || ($user['align'] > 1 && $user['align'] < 2))) {
$al = '(1 = 1)';
} else {
$al = '(1 = 2)';
}
}
}
if ($dd = db::c()->query('SELECT `i`.`id` FROM `users` AS `u`, `inventory` AS `i`
if ($ts['nalign'] == 1.1) $al = '(1 = 2)';
$dd = db::c()->query('SELECT `i`.`id` FROM `users` AS `u`, `inventory` AS `i`
WHERE
`i`.`needident` = 0 AND
`i`.`id` = ?i AND
@ -2273,13 +2281,11 @@ function ref_drop()
`u`.`mgray` >= `i`.`ngray` AND
`u`.`mdark` >= `i`.`ndark` AND
`i`.`setsale` = 0 AND
`u`.`id` = ?i',$id,$user['id'],$al,$user['align'],$user['id'])) {
$dd = $dd->fetch_row();
if ($dd[0] > 0) {
return true;
} else {
return false;
}
`u`.`id` = ?i',$id,$user['id'],$al,$user['align'],$user['id']);
if ($dd->getNumRows() > 0) {
return true;
} else {
return false;
}
}
@ -2454,7 +2460,7 @@ function usemagic($id)
include("magic/" . $magic['file']);
echo "</b></font>";
}
if ($bet) {
if ($bat) {
if ($row['maxdur'] <= ($row['duration'] + 1)) {
//echo "<!--";
destructitem($row['id']);
@ -2462,9 +2468,9 @@ function usemagic($id)
} else {
if (!$row['magic']) {
mysql_query("UPDATE `inventory` SET `includemagicdex` =`includemagicdex`-{$bet} WHERE `id` = {$row['id']} LIMIT 1;");
mysql_query("UPDATE `inventory` SET `includemagicdex` =`includemagicdex`-{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
} else {
mysql_query("UPDATE `inventory` SET `duration` =`duration`+{$bet} WHERE `id` = {$row['id']} LIMIT 1;");
mysql_query("UPDATE `inventory` SET `duration` =`duration`+{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
}
}
if (!$charge) $charge = 0;
@ -2569,6 +2575,7 @@ function settravma($id, $type, $time = 86400, $kill = false)
switch ($owntravma['type']) {
case 20:
$st = mt_rand(0, 2);
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
@ -2766,6 +2773,9 @@ function SolveExp($at_id, $def_id, $damage)
{
$mods = ['bloodb' => 1.2, 'btl_1' => 1, 'btl_2' => 0.5, 'btl_3' => 0.05];
$baseexp = ["0" => "2", "1" => "5", "2" => "10", "3" => "15", "4" => "30", "5" => "60", "6" => "90", "7" => "115", "8" => "300", "9" => "400", "10" => "500", "11" => "600", "12" => "700", "13" => "800", "14" => "900", "15" => "1000", "16" => "1100", "17" => "1200", "18" => "1300", "19" => "1400", "20" => "1500", "21" => "1600"];
$expmf = 0;
$bot_active = false;
$bot_def = false;
if ($at_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $at_id . '" LIMIT 1'));