Убрал дубликаты файлов.
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
session_start();
|
||||
error_reporting(1);
|
||||
ini_set('display_errors', 'on');
|
||||
|
||||
include("config.php");
|
||||
if (!isset($_SESSION['uid'])) {
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
||||
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $_SESSION['uid'] . '" LIMIT 1'));
|
||||
include("functions.php");
|
||||
include('cave/cave_bots.php');
|
||||
require_once 'functions.php';
|
||||
//require_once 'cave/cave_bots.php';
|
||||
|
||||
class Cave
|
||||
{
|
||||
use CaveBots, CaveItems;
|
||||
public static function cancarry($m, $user)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cancarry($m, $u)
|
||||
{
|
||||
@@ -149,8 +154,6 @@ function battlewithbot($b, $name = '', $time = 3, $blood = 1, $group = 1, $battl
|
||||
} else {
|
||||
|
||||
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('$name', '$b', '', '" . $bot['maxhp'] . "')");
|
||||
$botnames = [];
|
||||
$botnames[$name] = 1;
|
||||
$hps[$b] = $bot['maxhp'];
|
||||
$botid1 = mysql_insert_id();
|
||||
$cond = " `id` = '$botid1' ";
|
||||
@@ -164,14 +167,14 @@ function battlewithbot($b, $name = '', $time = 3, $blood = 1, $group = 1, $battl
|
||||
$hps = [];
|
||||
|
||||
foreach ($otherbots as $k => $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 .= "<img title=\"$botname" . ($cnt > 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 .= "<img title=\"$botname" . ($cnt > 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 = "<img title=\"" . $dialogs[$d] . "\" " . ($x == 3 && $y == 1 ? "onclick=\"speakmenu(event);\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/npcs/$d.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][1] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />";
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user