diff --git a/cave.php b/cave.php
index c366b79..f95d116 100644
--- a/cave.php
+++ b/cave.php
@@ -1,16 +1,21 @@
$v) {
- if (@$botnames[$v['name']]) {
+ if (CaveBots::$botnames[$v['name']]) {
$i = 1;
- while (@$botnames["$v[name] ($i)"]) $i++;
+ while (CaveBots::$botnames["$v[name] ($i)"]) $i++;
$botname = "$v[name] ($i)";
} else {
$botname = $v['name'];
}
- $botnames[$botname] = 1;
+ CaveBots::$botnames[$botname] = 1;
if (!@$hps[$v['id']]) {
$hps[$v['id']] = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users` WHERE `id` = '$v[id]' LIMIT 1"));
}
@@ -828,8 +831,9 @@ if (@$_GET['speak']) {
header("location: dialog.php?char=$tmp[2]");
die();
}
- if ($tmp[0] == "b" && isset($dialogs[$bots[$tmp[1]]])) {
- header("location: dialog.php?char=" . $bots[$tmp[1]]);
+
+ if ($tmp[0] == "b" && isset($dialogs[CaveBots::$bots[$tmp[1]]])) {
+ header("location: dialog.php?char=" . CaveBots::$bots[$tmp[1]]);
die();
}
}
@@ -860,20 +864,20 @@ if (@$_GET['attack']) {
} elseif (isset($rec['bot'])) {
$btl = $rec['battle'];
if ($btl > 0) {
- battlewithbot($bots[$rec['bot']], "", "", 10, 0, 0, $btl);
+ battlewithbot(CaveBots::$bots[$rec['bot']], "", "", 10, 0, 0, $btl);
} else {
- $firstbot = $bots[$rec['bot']];
+ $firstbot = CaveBots::$bots[$rec['bot']];
$otherbots = [];
$rec['cnt']--;
while ($rec['cnt'] > 0) {
- $otherbots[] = ['id' => $bots[$rec['bot']], 'name' => $botnames[$rec['bot']]];
+ $otherbots[] = ['id' => CaveBots::$bots[$rec['bot']], 'name' => CaveBots::$botnames[$rec['bot']]];
$rec["cnt"]--;
}
while ($rec = mysql_fetch_assoc($r)) {
while ($rec['cnt'] > 0) {
- $otherbots[] = ['id' => $bots[$rec['bot']], 'name' => $botnames[$rec['bot']]];
+ $otherbots[] = ['id' => CaveBots::$bots[$rec['bot']], 'name' => CaveBots::$botnames[$rec['bot']]];
$rec['cnt']--;
}
}
@@ -1382,7 +1386,7 @@ if ($user['hp'] <= 0) {
function drawmap($map1, $players, $x, $y, $direction)
{
- global $base, $user, $botnames, $imgdata;
+ global $base, $user, CaveBots::$botnames, $imgdata;
$startx = max($x * 2 - 8, 0);
$starty = max($y * 2 - 8, 0);
@@ -1480,13 +1484,13 @@ function drawmap($map1, $players, $x, $y, $direction)
function drawbot($cell, $x, $y)
{
- global $botnames, $imgdata, $bots, $dialogs, $user, $floor;
+ global CaveBots::$botnames, $imgdata, CaveBots::$bots, $dialogs, $user, $floor;
$data = explode("/", $cell);
$i = 1;
$bc = (count($data) - 1) / 2;
while ($data[$i]) {
$bot = $data[$i];
- $botname = $botnames[$bot];
+ $botname = CaveBots::$botnames[$bot];
$cnt = $data[$i + 1];
if ($i == 1) {
if ($bc == 1) {
@@ -1526,7 +1530,7 @@ function drawmap($map1, $players, $x, $y, $direction)
$rrm = $user['room'];
- if (isset($dialogs[$bots[$data[1]]]) && ($bots[$data[1]] == 11147 && $user['room'] == 74)) {
+ if (isset($dialogs[CaveBots::$bots[$data[1]]]) && (CaveBots::$bots[$data[1]] == 11147 && $user['room'] == 74)) {
$ret .= " 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? "onclick=\"speakattackmenu(event);\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />";
} else {
$ret .= " 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? " onclick=\"document.location.href='cave.php?attack=1';\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />";
@@ -1543,7 +1547,7 @@ function drawmap($map1, $players, $x, $y, $direction)
$i = 1;
$d = $data[2];
$bot = $data[$i];
- $botname = $botnames[$bot];
+ $botname = CaveBots::$botnames[$bot];
$cnt = $data[$i + 1];
$ret = "";
return $ret;
@@ -1551,7 +1555,7 @@ function drawmap($map1, $players, $x, $y, $direction)
function drawuser($cell, $x, $y)
{
- global $botnames, $imgdata, $party;
+ global CaveBots::$botnames, $imgdata, $party;
$data = explode("/", $cell);
$i = 1;
$bc = (count($data) - 1);
diff --git a/classes/UserInfo.php b/classes/UserInfo.php
index 9c9bf4a..745038a 100644
--- a/classes/UserInfo.php
+++ b/classes/UserInfo.php
@@ -1,9 +1,4 @@
, ", $this->t1);
$lomka = $this->t2;
- include('../cave/win.php');
+ //include('../cave/win.php');
} elseif (in_array($ss[0], $this->t2)) {
$flag = 2;
foreach ($this->t2 as $k => $v) {
@@ -1727,7 +1727,7 @@ class fbattle
if ($this->battle_data['x'] > 0 || $this->battle_data['y'] > 0 && $this->user['laba'] > 0) {
mysql_query('UPDATE `users` SET `x` = "' . $this->user['xf'] . '", `y` = "' . $this->user['yr'] . '" WHERE `laba` = "' . $this->user['laba'] . '" AND `x` = "' . $this->battle_data['x'] . '" AND `y` = "' . $this->battle_data['y'] . '" AND `battle` = "' . $this->battle_data['id'] . '" LIMIT 1');
}
- include("../cave/lose.php");
+ //include("../cave/lose.php");
}
diff --git a/classes/cave/win.php b/classes/cave/win.php
index 51685d8..105bbc2 100644
--- a/classes/cave/win.php
+++ b/classes/cave/win.php
@@ -1,4 +1,4 @@
-
+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("У ".$cavebots[$bot]." был предмет $it[name] и кто угодно может подобрать его.");
- $this->AddToLog(''.date("H:i")." У ".$cavebots[$bot]." был предмет $it[name].
");
+ $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("У " . $cavebots[$bot] . " был предмет $it[name] и кто угодно может подобрать его.");
+ $this->AddToLog('' . date("H:i") . " У " . $cavebots[$bot] . " был предмет $it[name].
");
+ }
+ }
}
- }
}
- }
- 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++;
+ if ($user['caveleader'] > 0) {
+ $bots = [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');
+ mysql_query("DELETE FROM `cavebots` WHERE `battle` = '" . $this->battle_data["id"] . "'");
+ mysql_query('UNLOCK TABLES');
}
diff --git a/cronjobs/cron_bots_battle.php b/cronjobs/cron_bots_battle.php
index ecc4e4c..3fc6be1 100644
--- a/cronjobs/cron_bots_battle.php
+++ b/cronjobs/cron_bots_battle.php
@@ -7,7 +7,7 @@
include_once '../config.php';
include_once '../functions.php';
-include_once '../cave/cave_bots.php';
+//include_once '../cave/cave_bots.php';
$cavebots = $botnames;
function addlogs($id, $log)
@@ -390,7 +390,7 @@ class fbattle
}
$winers .= implode(", ", $this->t1);
$lomka = $this->t2;
- include('cave/win.php');
+ //include('cave/win.php');
} elseif (in_array($ss[0], $this->t2)) {
$flag = 2;
foreach ($this->t2 as $k => $v) {
@@ -486,7 +486,7 @@ class fbattle
if ($this->battle_data['x'] > 0 || $this->battle_data['y'] > 0 && $this->user['laba'] > 0) {
mysql_query('UPDATE `users` SET `x` = "' . $this->user['xf'] . '", `y` = "' . $this->user['yr'] . '" WHERE `laba` = "' . $this->user['laba'] . '" AND `x` = "' . $this->battle_data['x'] . '" AND `y` = "' . $this->battle_data['y'] . '" AND `battle` = "' . $this->battle_data['id'] . '" LIMIT 1');
}
- include("cave/lose.php");
+ //include("cave/lose.php");
}
if ($lomka) {
diff --git a/fbattle.php b/fbattle.php
index f917f96..7e573b4 100644
--- a/fbattle.php
+++ b/fbattle.php
@@ -11,7 +11,7 @@ if (isset($_POST['end'])) {
include('config.php');
include('functions.php');
-include('cave/cave_bots.php');
+//include('cave/cave_bots.php');
$cavebots = $botnames;
db::c()->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');
diff --git a/inf.php b/inf.php
index 11ee4ea..2c58bab 100644
--- a/inf.php
+++ b/inf.php
@@ -7,7 +7,7 @@ $userInfo = new UserInfo($login);
$presentsModel = new PresentsModel($userInfo->id);
$presentsList = $presentsModel->getAllPresents();
$userInfo->watcher_id = $userInfo->id ?? null;
-if (empty($user->id)): ?>
+if (empty($userInfo->id)): ?>
@@ -23,7 +23,7 @@ if (empty($user->id)): ?>
- Информация о = $user->login ?>
+ Информация о = $userInfo->login ?>