Будь проклят тот день, когда я решил ввести неймспейсы...
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
trait CaveBots
|
||||
{
|
||||
public static $bots = [
|
||||
1 => 10025,
|
||||
2 => 10026,
|
||||
3 => 10027,
|
||||
4 => 10028,
|
||||
5 => 10031,
|
||||
6 => 10032,
|
||||
7 => 10033,
|
||||
8 => 10034];
|
||||
public static $botnames = [
|
||||
1 => "Паук",
|
||||
2 => "Тарантул",
|
||||
3 => "Гигантская крыса",
|
||||
4 => "Покровитель нечести",
|
||||
5 => "Нечто",
|
||||
6 => "Обезумевший крыс",
|
||||
7 => "Призрак короля крыс ",
|
||||
8 => "Обезумевший палач"];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
trait CaveItems
|
||||
{
|
||||
static function getCaveItems($room)
|
||||
{
|
||||
if ($room == 621) {
|
||||
$caveitems[1] = [['id' => 1126, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 50, 'podzem' => 1]];
|
||||
$caveitems[2] = [['id' => 1125, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 40, 'podzem' => 1]];
|
||||
$caveitems[3] = [['id' => 1127, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 15, 'podzem' => 1]];
|
||||
$caveitems[4] = [['id' => 1128, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 5, 'podzem' => 1]];
|
||||
$caveitems[5] = [['id' => 1126, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 60, 'podzem' => 1]];
|
||||
$caveitems[6] = [['id' => 1130, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 7], 'podzem' => 1];
|
||||
$caveitems[7] = [['id' => 1129, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 10, 'podzem' => 1]];
|
||||
$caveitems[8] = [['id' => 1131, 'from' => 'shop', 'foronetrip' => 0, 'chance' => 5, 'podzem' => 1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if (in_array($user->room, Config::$caverooms)) {
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
if (!isset($cavedata[$user->room]['x' . $floor])) {
|
||||
$floor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$lomka1 = $lomka;
|
||||
|
||||
foreach ($lomka1 as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
if (in_array($user->room, Config::$caverooms)) {
|
||||
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->room]['x' . $floor] . "', `y` = '" . $cavedata[$user->room]['y' . $floor] . "', `dir` = '" . $cavedata[$user->room]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
|
||||
}
|
||||
if ($user['laba'] > 0) {
|
||||
mysql_query('UPDATE `users` SET `x` = `xf`, `y` = `yr` WHERE `id` = "' . $v . '" LIMIT 1');
|
||||
exit('Suka');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
function getchance($p)
|
||||
{
|
||||
if (mt_rand(1, 100) <= $p) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function cavesys($text)
|
||||
{
|
||||
global $user;
|
||||
if ($fp = @fopen("tmp/chat.txt", "a")) {
|
||||
flock($fp, LOCK_EX);
|
||||
fputs($fp, ":[" . time() . "]:[!cavesys!!]:[$text]:[$user[caveleader]]\r\n");
|
||||
fflush($fp);
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($user->room, Config::$caverooms)) {
|
||||
include("CaveItems.php");
|
||||
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
|
||||
if ($location['dir'] == 0) {
|
||||
$y = $location['y'] * 2;
|
||||
$x = ($location['x'] - 1) * 2;
|
||||
}
|
||||
|
||||
if ($location['dir'] == 1) {
|
||||
$y = ($location['y'] - 1) * 2;
|
||||
$x = $location['x'] * 2;
|
||||
}
|
||||
|
||||
if ($location['dir'] == 2) {
|
||||
$y = $location['y'] * 2;
|
||||
$x = ($location['x'] + 1) * 2;
|
||||
}
|
||||
|
||||
if ($location['dir'] == 3) {
|
||||
$y = ($location['y'] + 1) * 2;
|
||||
$x = $location['x'] * 2;
|
||||
}
|
||||
|
||||
$floor = $location['floor'];
|
||||
|
||||
$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("У <b>" . $cavebots[$bot] . "</b> был предмет <b>$it[name]</b> и кто угодно может подобрать его.");
|
||||
$this->AddToLog('<span class=date>' . date("H:i") . "</span> У <b>" . $cavebots[$bot] . "</b> был предмет <b>$it[name]</b>.<BR>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user