diff --git a/akadem.php b/akadem.php index 5621241..a8d18bd 100644 --- a/akadem.php +++ b/akadem.php @@ -1,20 +1,7 @@ room != 61) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fight.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); const SMITH = 'оружейник'; const MERCENARY = 'наёмник'; const MEDIC = 'лекарь'; diff --git a/aren_of_angels.php b/aren_of_angels.php index 5bb5531..8827612 100644 --- a/aren_of_angels.php +++ b/aren_of_angels.php @@ -1,10 +1,5 @@ query('SELECT `value` FROM `variables` WHERE `var` = "arena_of_gods"')->fetch_assoc(); diff --git a/bank.php b/bank.php index 25e4306..ce0eda0 100644 --- a/bank.php +++ b/bank.php @@ -1,21 +1,8 @@ room != 29) { - header("Location: main.php"); - exit; -} -if ($user->battle != 0) { - header('location: fbattle.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); const SUCCESS = "Успешная операция!"; $bank = new \Battles\Bank($user->id); diff --git a/buttons.php b/buttons.php index e6d892a..50d6246 100644 --- a/buttons.php +++ b/buttons.php @@ -1,9 +1,5 @@ room == 51) { header('location: city.php'); exit; diff --git a/c_haos.php b/c_haos.php index a4bda16..8ab98cc 100644 --- a/c_haos.php +++ b/c_haos.php @@ -1,19 +1,6 @@ room != 600) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - +require_once "functions.php"; $in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}';")); $owntravma = mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . " AND (type=13 OR type=12 OR type=14) limit 1;")); $wait_msg = "Ждем подтверждения от всей группы..."; diff --git a/c_haos_in.php b/c_haos_in.php index f405c50..e720d6f 100644 --- a/c_haos_in.php +++ b/c_haos_in.php @@ -1,11 +1,5 @@ "Босс глубин" );*/ -if ($user->room != 601) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} if ($in_haos['status'] == 4) { mysql_query("UPDATE `users`,`online` SET `users`.`room` = '600',`online`.`room` = '600' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;"); mysql_query("UPDATE `cit_haos_status` SET room='0',bot='0',group='0' WHERE id = '{$user['id']}'; "); diff --git a/c_park.php b/c_park.php index 891cbc5..42d4cfd 100644 --- a/c_park.php +++ b/c_park.php @@ -1,9 +1,6 @@ room != 602) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - //комнаты парка - $ch_rooms = [ // 0 - empty "1" => "Площадь (1)", diff --git a/canalizaciya.php b/canalizaciya.php index d5d4cbd..923c3f9 100644 --- a/canalizaciya.php +++ b/canalizaciya.php @@ -1,18 +1,9 @@ room == 403) { include "startpodzemel.php"; - if ($user->battle != 0) { - header('location: fbattle.php'); - exit; - } - if ($_GET['act'] == "cexit") { $das = mysql_query("select glava,glav_id from `labirint` where user_id='" . $user['id'] . "'"); $rf = mysql_fetch_array($das); diff --git a/cave.php b/cave.php index 366f9c4..56f7e81 100644 --- a/cave.php +++ b/cave.php @@ -1,9 +1,5 @@ room, Config::$caverooms)) { - header("Location: main.php"); - exit('Not in this life ...'); -} - if (isset($_GET['direction'])) { $dir = (int)$_GET['direction']; if ($dir >= 0 && $dir <= 3) { diff --git a/ch.php b/ch.php index e1c57f2..6b309ff 100644 --- a/ch.php +++ b/ch.php @@ -1,9 +1,5 @@ query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $u->i()['id']); diff --git a/chat.php b/chat.php index 3664401..8bf1d98 100644 --- a/chat.php +++ b/chat.php @@ -6,10 +6,6 @@ */ session_start(); -if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} require_once "config.php"; $msg = $_POST['msg'] ?? null; diff --git a/city.php b/city.php index 86193ec..371a69d 100644 --- a/city.php +++ b/city.php @@ -3,22 +3,9 @@ * Центральная площадь */ session_start(); -if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} - require_once "functions.php"; -$user = $user ?? []; +$user = $user ?? new \Battles\User($_SESSION['uid']); -if ($user->battle) { - header('location: fbattle.php'); - exit; -} -if ($user->in_tower == 1) { - header('Location: towerin.php'); - exit; -} if ($user->zayavka) { exit; } diff --git a/clan.php b/clan.php index 6ebabfc..14f0626 100644 --- a/clan.php +++ b/clan.php @@ -1,11 +1,7 @@ clan) { exit(err('Вы не состоите в клане!')); } diff --git a/clan_castle.php b/clan_castle.php index e6d6b20..908a26f 100644 --- a/clan_castle.php +++ b/clan_castle.php @@ -1,24 +1,8 @@ room != 45) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - $cc_date = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var`='cc_time' LIMIT 1;")); $ccd = $cc_date['value']; diff --git a/clan_create.php b/clan_create.php index 52d1c4a..803a72b 100644 --- a/clan_create.php +++ b/clan_create.php @@ -1,15 +1,7 @@ room != 30) { - header("Location: main.php"); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); $userClan = db::c()->query('SELECT short_name, full_name, info FROM clans where owner_id = ?i', $user->id)->fetch_object(); $clanFullName = $_POST['clan_full_name'] ?? ''; $clanShortName = $_POST['clan_short_name'] ?? ''; @@ -42,7 +34,7 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) { try { db::c()->query('INSERT INTO clans (owner_id, full_name, short_name, info) VALUES (?i,"?s","?s","?s")', $user->id, $clanFullName, $clanShortName, $clanInfo); $userBank->setMoney($userBank->getMoney() - Config::$clan_register_cost); - Bank::setBankMoney($userBank->getMoney(), $user->id, 'clanRegister'); + Battles\Bank::setBankMoney($userBank->getMoney(), $user->id, 'clanRegister'); // Заглушка для отображения данных по только что зарегистрированному клану, когда запрос в базу в начале файла ещё не проходит. $userClan = new stdClass(); $userClan->full_name = $clanFullName; @@ -59,8 +51,8 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) { } } } -\Battles\Template::header(Rooms::$roomNames[30]); -\Battles\Template::buildingTop(Rooms::$roomNames[30], 'strah'); +\Battles\Template::header(\Battles\Rooms::$roomNames[30]); +\Battles\Template::buildingTop(\Battles\Rooms::$roomNames[30], 'strah'); if ($userClan): ?>
diff --git a/classes/Battles/DressedItems.php b/classes/Battles/DressedItems.php index 25d01ad..f1acfa0 100644 --- a/classes/Battles/DressedItems.php +++ b/classes/Battles/DressedItems.php @@ -25,15 +25,15 @@ class DressedItems private function getDressedItems() { try { - $this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID); - } catch (Exception $e) { + $this->DB = \db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID); + } catch (\Exception $e) { echo '
Не прогрузилась таблица inventory (*) для класса DressedItems.
'; } } private function getDressedItemById($item_id) { - return db::c()->query('SELECT * FROM inventory WHERE item_id = ?i AND dressed_slot > 0', $item_id)->fetch_assoc(); + return \db::c()->query('SELECT * FROM inventory WHERE item_id = ?i AND dressed_slot > 0', $item_id)->fetch_assoc(); } private function getBonusesFromDressedItems() @@ -53,8 +53,8 @@ SELECT SUM(add_strength) as sum_strength, SUM(add_max_physical_damage) as sum_max_phys_damage FROM inventory WHERE owner_id = ?i AND dressed_slot > 0 SQL; - $this->DBSUM = db::c()->query($query, $this->USERID)->fetch_assoc(); - } catch (Exception $e) { + $this->DBSUM = \db::c()->query($query, $this->USERID)->fetch_assoc(); + } catch (\Exception $e) { echo '
Не прогрузилась таблица inventory (SUM) для класса DressedItems:' . $e . '
'; } } @@ -134,7 +134,7 @@ SQL; self::getItemsInSlots(); // Проверяем, что используется один из 12 слотов и наличие предмета в слоте. if (in_array($slot_id, Item::ITEM_TYPES_ALLOWED_IN_SLOTS) && $this->dressedItem[$slot_id]) { - db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID); + \db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID); } } diff --git a/classes/Battles/Models/PresentsModel.php b/classes/Battles/Models/PresentsModel.php index db04367..3b345a9 100644 --- a/classes/Battles/Models/PresentsModel.php +++ b/classes/Battles/Models/PresentsModel.php @@ -15,9 +15,6 @@ class PresentsModel { if (!$this->DB) { $this->DB = \db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id); - if ($this->DB->getNumRows() == 0) { - throw new GameException("
class PresentsModel: Не прогрузилась база!
"); - } } } diff --git a/classes/Battles/Travel.php b/classes/Battles/Travel.php index db72e9d..8cd2305 100644 --- a/classes/Battles/Travel.php +++ b/classes/Battles/Travel.php @@ -7,7 +7,7 @@ class Travel * Соответствие ID комнаты игровому файлу. * @var string[] */ - private static $roomFileName = [ + public static $roomFileName = [ 1 => 'main.php', 20 => 'city.php', 21 => 'city.php', @@ -21,18 +21,31 @@ class Travel 31 => 'tower.php', 34 => 'fshop.php', 37 => 'gotzamok.php', + 38 => 'gotzamok.php', + 39 => 'gotzamok.php', + 40 => 'gotzamok.php', + 41 => 'gotzamok.php', 51 => 'city.php', 61 => 'akadem.php', 401 => 'hell.php', - 402 => 'lab_chaos_enter.php', - 404 => 'vxod.php', + 402 => 'vxod.php', + 403 => 'canalizaciya.php', + //404 => 'vxod.php', + 600 => 'c_haos.php', + 601 => 'c_haos_in.php', + 602 => 'c_park.php', 603 => 'aren_of_angels.php', 620 => 'enter_cave.php', + 621 => 'cave.php', 650 => 'ul_clans.php', 660 => 'hostel.php', + 661 => 'hostel_room.php', + 662 => 'quest_room.php', 666 => 'jail.php', + 760 => 'c_forest.php', 777 => 'obshaga.php', 1051 => 'lab_enter.php', + 1052 => 'labirint.php', 1055 => 'group_arena.php', 2111 => 'city.php', 2601 => 'city.php', diff --git a/classes/Battles/UserInfo.php b/classes/Battles/UserInfo.php index 88ce6ec..26f01cb 100644 --- a/classes/Battles/UserInfo.php +++ b/classes/Battles/UserInfo.php @@ -20,8 +20,6 @@ class UserInfo extends User */ private function UserInfoDoll($isBattle = 0, $isMain = 0) { - //https://jsfiddle.net/ngx0yvhc - //TODO переверстать grid, чтобы он касался только куклы. $di = new DressedItems($this->id); $dressedItems = $di->getItemsInSlots(); for ($i = 1; $i <= 12; $i++) { @@ -103,7 +101,6 @@ class UserInfo extends User echo $variables; echo '
'; echo ''; - echo '
TODO: Сделать рассчёт модификаторов. Вывести полоску здоровья когда будет от чего отталкиваться.
'; echo ''; } @@ -172,7 +169,7 @@ class UserInfo extends User private function WatcherStatus() { - $query = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc(); + $query = \db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc(); if ($query['admin']) { $this->watcherIsAdmin = 1; } diff --git a/comission.php b/comission.php index 3cb60ed..d475239 100644 --- a/comission.php +++ b/comission.php @@ -1,27 +1,8 @@ level < 1) { - header("Location: main.php"); - exit; -} -if ($user->room != 25) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - +$user = $user ?? new \Battles\User($_SESSION['uid']); $get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING')); - $putItemCost = (int)filter_input(INPUT_POST, 'cost', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]); $putItemId = (int)filter_input(INPUT_POST, 'putId', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]); $returningItemId = (int)filter_input(INPUT_GET, 'back', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]); diff --git a/config.php b/config.php index 8552de3..6d0cb2f 100644 --- a/config.php +++ b/config.php @@ -4,7 +4,10 @@ * Author: Igor Barkov * Project name: Battles-Game */ - +if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; +} ini_set('display_errors', 'On'); error_reporting(E_ALL); define("GAMEDOMAIN", "battles.lan"); @@ -28,7 +31,7 @@ require_once 'classes/Database/db.php'; * Автозагрузка классов с учётом неймспейсов. */ -spl_autoload_register(function ($className){ +spl_autoload_register(function ($className) { $fileName = __DIR__ . '/classes/' . str_replace('\\', '/', $className . '.php'); if (file_exists($fileName)) { require_once $fileName; @@ -204,4 +207,14 @@ trait Config 1500000000 => [10, 1, 5, 8000, 1, 9999999999], # Это тринадцатый уровень ]; public static $cavedata = [621 => ['x1' => 6, 'y1' => 11, 'dir1' => 1, 'x2' => 10, 'y2' => 8, 'dir2' => 1, 'x3' => 20, 'y3' => 4, 'dir3' => 1, 'x4' => 10, 'y4' => 10, 'dir4' => 1, 'delay' => 360, 'name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']]; + + //DB + protected static $db = [ + 'host' => '192.168.20.5', + 'name' => 'battles', + 'user' => 'battles', + 'password' => 'bottle-neck-horse', + 'port' => 32101, + 'charset' => 'utf8', + ]; } \ No newline at end of file diff --git a/enter.php b/enter.php index 496652f..e363222 100644 --- a/enter.php +++ b/enter.php @@ -1,6 +1,6 @@ battle) { - header('location: fbattle.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); function secs2hrs($s, $short = 0) { diff --git a/fbattle.php b/fbattle.php index 7d27ae4..0fcd559 100644 --- a/fbattle.php +++ b/fbattle.php @@ -1,10 +1,6 @@ query('SELECT enter_game FROM users WHERE id = ?i', $_SESSION['uid'])->getNumRows() ?? 0; if (empty($userLoginStatus)) { @@ -15,40 +10,40 @@ if (empty($userLoginStatus)) { \Battles\Template::header('Окно игры'); ?> - - + .frametd { + height: inherit; + padding: 0; + } +
diff --git a/forest.php b/forest.php index eb22d9e..af87c7a 100644 --- a/forest.php +++ b/forest.php @@ -63,11 +63,6 @@ if ($rand < 15 && $user['battle'] == 0) { addchp('Внимание! На вас напал "' . $bots[$rbot] . '". ', '{[]}' . Nick::id($user["id"])->short() . '{[]}'); } -if ($user['battle'] > 0) { - header('location: fbattle.php'); - exit; -} - $les_login = mysql_fetch_array(mysql_query("SELECT * FROM `les_game` WHERE `owner` = '" . $user['id'] . "' LIMIT 1")); $rooms = ["A1" => ['20', '', 'A2', '', 'B1'], "A2" => ['15', 'A1', 'A3', '', ''], "A3" => ['15', 'A2', '', '', ''], "A4" => ['15', '', 'A5', '', 'B4'], "A5" => ['15', 'A4', '', '', 'B5'], "A6" => ['15', '', 'A7', '', 'B6'], "A7" => ['15', 'A6', 'A8', '', ''], "A8" => ['15', 'A7', '', '', 'B8'], "B1" => ['20', '', '', 'A1', ''], "B2" => ['15', '', 'B3', '', 'C2'], "B3" => ['15', 'B2', 'B4', '', ''], "B4" => ['15', 'B3', '', 'A4', ''], "B5" => ['15', '', 'B6', 'A5', ''], "B6" => ['15', 'B5', 'B7', 'A6', ''], "B7" => ['15', 'B6', '', '', 'C7'], "B8" => ['15', '', '', 'A8', 'C8'], "C1" => ['20', '', '', '', 'D1'], "C2" => ['15', '', 'C3', 'B2', 'D2'], "C3" => ['15', 'C2', '', '', 'D3'], "C4" => ['15', '', '', '', 'D4'], "C5" => ['15', '', '', '', 'D5'], "C6" => ['15', '', 'C7', '', ''], "C7" => ['15', 'C6', 'C8', 'B7', ''], "C8" => ['15', 'C7', '', 'B8', 'D8'], "D1" => ['20', '', 'D2', 'C1', 'E1'], "D2" => ['15', 'D1', 'D3', 'C2', 'E2'], "D3" => ['15', 'D2', 'D4', 'C3', 'E3'], "D4" => ['15', 'D3', 'D5', 'C4', 'E4'], "D5" => ['15', 'D4', '', 'C5', ''], "D6" => ['15', '', 'D7', '', 'E6'], "D7" => ['15', 'D6', '', '', ''], "D8" => ['15', '', '', 'C8', 'E8'], "E1" => ['20', '', 'E2', 'D1', 'F1'], "E2" => ['15', 'E1', 'E3', 'D2', 'F2'], "E3" => ['15', 'E2', 'E4', 'D3', 'F3'], "E4" => ['15', 'E3', 'E5', 'D4', 'F4'], "E5" => ['15', 'E4', 'E6', '', 'F5'], "E6" => ['15', 'E5', '', 'D6', ''], "E7" => ['15', '', 'E8', '', 'F7'], "E8" => ['15', 'E7', '', 'D8', 'F8'], "F1" => ['20', '', 'F2', 'E1', 'G1'], "F2" => ['15', 'F1', 'F3', 'E2', 'G2'], "F3" => ['15', 'F2', 'F4', 'E3', 'G3'], "F4" => ['15', 'F3', 'F5', 'E4', 'G4'], "F5" => ['15', 'F4', '', 'E5', 'G5'], "F6" => ['15', '', '', '', 'G6'], "F7" => ['15', '', '', 'E7', 'G7'], "F8" => ['15', '', '', 'E8', 'G8'], "G1" => ['20', '', '', 'F1', 'H1'], "G2" => ['15', '', '', 'F2', ''], "G3" => ['15', '', '', 'F3', ''], "G4" => ['15', '', '', 'F4', ''], "G5" => ['15', '', 'G6', 'F5', ''], "G6" => ['15', 'G5', 'G7', 'F6', ''], "G7" => ['15', 'G6', 'G8', 'F7', ''], "G8" => ['15', 'G7', '', 'F8', 'H8'], "H1" => ['20', '', 'H2', 'G1', 'I1'], "H2" => ['15', 'H1', '', '', 'I2'], "H3" => ['15', '', '', '', 'I3'], "H4" => ['15', '', 'H5', '', 'I4'], "H5" => ['15', 'H4', '', '', 'I5'], "H6" => ['15', '', 'H7', '', 'I6'], "H7" => ['15', 'H6', '', '', 'I7'], "H8" => ['15', 'H7', '', 'G8', 'I8'], "I1" => ['20', '', 'I2', 'H1', ''], "I2" => ['15', 'I1', 'I3', 'H2', ''], "I3" => ['15', 'I2', 'I4', 'H3', ''], "I4" => ['15', 'I3', 'I5', 'H4', ''], "I5" => ['15', 'I4', 'I6', 'H5', ''], "I6" => ['15', 'I5', 'I7', 'H6', ''], "I7" => ['15', 'I6', 'I8', 'H7', ''], "I8" => ['15', 'I7', '', 'H8', '']]; diff --git a/forum.php b/forum.php index 0045fe1..0b5a453 100644 --- a/forum.php +++ b/forum.php @@ -1,10 +1,6 @@ query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND `time` > ?i AND `type` = 3', $user['id'], time())->fetch_assoc(); $ps = $_GET['page'] ?? 0; diff --git a/functions.php b/functions.php index 18c307d..39de4d7 100644 --- a/functions.php +++ b/functions.php @@ -1,19 +1,69 @@ * Project name: Battles-Game */ require_once 'config.php'; -if (empty($_SESSION['uid'])) { - throw new \Exceptions\GameException('Не могу проинициализировать игрока!'); -} + $user = new \Battles\User($_SESSION['uid']); if ($user->id && $user->block) { exit('user blocked!'); } +/* + * Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам. + */ +$fbattleCheckFiles = [ + 'c_haos_in.php', + 'c_haos.php', + 'c_park.php', + 'city.php', + 'clan_castle.php', + 'comission.php', + 'enter_cave.php', + 'library.php', + 'atk.php', + 'podzem_dialog.php', + 'post.php', + 'shop.php', + 'tournament.php', + 'vxod.php', + 'bank.php', + 'canalizaciya,php', + 'forest.php', + 'main.php', + 'repair.php', + 'towerstamp.php', + 'hell.php', + 'ul_clans.php', + 'labirint.php', + 'akadem.php', + 'towerin.php', + 'user_anketa.php', + 'zayavka.php', +]; +//Может просто отовсюду? О_о +if ($user->battle && in_array(pathinfo(debug_backtrace()[0]['file'])['basename'], $fbattleCheckFiles)) { + header('location: fbattle.php'); + exit; +} +$towerinCheckFiles = ['main.php', 'city.php', 'tower.php']; +if ($user->in_tower && in_array(pathinfo(debug_backtrace()[0]['file'])['basename'], $towerinCheckFiles)) { + header('location: towerin.php'); + exit; +} +$roomsCheck = [22, 23, 25, 27, 29, 30, 31, 37, 38, 39, 40, 41, 45, 53, 61, 401, 402, 600, 601, 602, 621, 650, 1051, 1052]; +// Если я в одной из этих комнат, +// [И] Имя файла который инклюдит файл с проверкой не совпадает с именем файла локации в которой я нахожусь +// [И] Номер комнаты который я пытаюсь открыть есть в списке проверяемых +if (in_array($user->room, $roomsCheck) + && pathinfo(debug_backtrace()[0]['file'])['basename'] != \Battles\Travel::$roomFileName[$user->room] + && in_array(array_search(pathinfo(debug_backtrace()[0]['file'])['basename'], \Battles\Travel::$roomFileName), $roomsCheck)) { + header('location: main.php'); + exit; +} + $ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); if (isset($_GET['goto']) && isset($_GET['tStamp']) && isset($_GET['vcode']) && $_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) { db::c()->query('UPDATE `users`,`online` SET `users`.`room` = ?i, `online`.`room` = ?i WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_GET['goto'], $_GET['goto'], $_SESSION['uid']); diff --git a/game.php b/game.php deleted file mode 100644 index cd9efc3..0000000 --- a/game.php +++ /dev/null @@ -1,102 +0,0 @@ - - * Project name: Battles-Game - */ - -session_start(); -if (empty($_SESSION['uid'])) header("Location: index.php"); -//include("config.php"); - -//$msg = filter_input(INPUT_POST,'msg'); -//$uid = $_SESSION['uid']; -//if ($msg) db::c()->query('INSERT INTO `chat` (`cid`, `uid`, `msg`) VALUES (?i, ?i, "?s")', 1, $uid, $msg); -\Battles\Template::header('Окно игры'); -?> - - -
-
- - - - - - - - - -
-
-
-
-
- - -
-
-
- \ No newline at end of file diff --git a/game2.php b/game2.php deleted file mode 100644 index db47a98..0000000 --- a/game2.php +++ /dev/null @@ -1,206 +0,0 @@ - - * Project name: Battles-Game - */ - -session_start(); -if (empty($_SESSION['uid'])) header("Location: index.php"); -//include("config.php"); - -//$msg = filter_input(INPUT_POST,'msg'); -//$uid = $_SESSION['uid']; -//if ($msg) db::c()->query('INSERT INTO `chat` (`cid`, `uid`, `msg`) VALUES (?i, ?i, "?s")', 1, $uid, $msg); -\Battles\Template::header('Окно игры'); -?> - -
-
- Всякие заголовки, кнопки, ссылки, etc... -
-
- -
-
-
- Загрузка... -
-
-
-
- -
-
-
- - -
- - - \ No newline at end of file diff --git a/gotzamok.php b/gotzamok.php index 9988cfd..a76bc53 100644 --- a/gotzamok.php +++ b/gotzamok.php @@ -1,20 +1,8 @@ -room >= 37 && $user->room <= 41)) { - header("Location: main.php"); - exit; -} - $castleOwners = db::c()->query('SELECT * FROM `clans` WHERE `short` = (SELECT * FROM `variables` WHERE `var` = "?s")', 'gotzamok'); if ($castleOwners['id'] == $user['klan']) { diff --git a/hell.php b/hell.php index d75952e..f9e0881 100644 --- a/hell.php +++ b/hell.php @@ -1,20 +1,7 @@ room != 401) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('Location: fbattle.php'); - exit; -} - +$user = $user ?? new \Battles\User($_SESSION['uid']); class hellround { diff --git a/hostel.php b/hostel.php index 19d1cab..122ec11 100644 --- a/hostel.php +++ b/hostel.php @@ -1,10 +1,6 @@ [8, 16, 24, 32], 2 => [15, 30, 45, 60], 3 => [25, 50, 75, 100], 4 => [40, 80, 120, 160]]; diff --git a/hostel_room.php b/hostel_room.php index a528844..c15c34d 100644 --- a/hostel_room.php +++ b/hostel_room.php @@ -1,9 +1,5 @@ + + + + + +Игра

Демонстрационная версия

Ребята, давайте сперва сделаем чтобы работало, а потом будем делать красиво. Идёт?

diff --git a/lab.php b/lab.php index 0cbf190..13db79f 100644 --- a/lab.php +++ b/lab.php @@ -1,11 +1,6 @@ 000); diff --git a/lab2.php b/lab2.php index 720a02d..395a970 100644 --- a/lab2.php +++ b/lab2.php @@ -1,10 +1,6 @@ room == 1051) { - mysql_query('DELETE FROM `laba_zv` WHERE `time` < "' . (time() - 1 * 60 * 60) . '"'); - $var = mysql_fetch_array(mysql_query('SELECT `id`, `vals` FROM `actions` WHERE `vals` > "' . time() . '" AND `uid` = "' . $user['id'] . '" AND `vars` = "go_labirint" LIMIT 1')); - $zv = mysql_fetch_array(mysql_query('SELECT * FROM `laba_zv` WHERE `uid1` = "' . $user['id'] . '" OR `uid2` = "' . $user['id'] . '" OR `uid3` = "' . $user['id'] . '" OR `uid4` = "' . $user['id'] . '" LIMIT 1')); - $re = ''; - if (isset($_GET['exitlaba'])) { - if (isset($zv['id'])) { - $re = 'Подали заявку и убегаем? Не хорошо!'; +mysql_query('DELETE FROM `laba_zv` WHERE `time` < "' . (time() - 1 * 60 * 60) . '"'); +$var = mysql_fetch_array(mysql_query('SELECT `id`, `vals` FROM `actions` WHERE `vals` > "' . time() . '" AND `uid` = "' . $user['id'] . '" AND `vars` = "go_labirint" LIMIT 1')); +$zv = mysql_fetch_array(mysql_query('SELECT * FROM `laba_zv` WHERE `uid1` = "' . $user['id'] . '" OR `uid2` = "' . $user['id'] . '" OR `uid3` = "' . $user['id'] . '" OR `uid4` = "' . $user['id'] . '" LIMIT 1')); +$re = ''; +if (isset($_GET['exitlaba'])) { + if (isset($zv['id'])) { + $re = 'Подали заявку и убегаем? Не хорошо!'; + } else { + mysql_query("UPDATE `users`, `online` SET `users`.`room` = '2601', `online`.`room` = '2601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$user['id']}'"); + header('Location: city.php'); + } +} elseif (isset($_GET['pz1'])) { + if (isset($zv['id'])) { + $re = 'Вы уже подали заявку...'; + } else { + if ($user['level'] < 4) { + $re = 'Персонажам до 4-го уровня запрещается посещать лабиринт!'; + } elseif (isset($var['id'])) { + $tm = timeOut($var['vals'] - time()); + $re = 'Следующий поход через: ' . $tm; } else { - mysql_query("UPDATE `users`, `online` SET `users`.`room` = '2601', `online`.`room` = '2601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$user['id']}'"); - header('Location: city.php'); - } - } elseif (isset($_GET['pz1'])) { - if (isset($zv['id'])) { - $re = 'Вы уже подали заявку...'; - } else { - if ($user['level'] < 4) { - $re = 'Персонажам до 4-го уровня запрещается посещать лабиринт!'; - } elseif (isset($var['id'])) { - $tm = timeOut($var['vals'] - time()); - $re = 'Следующий поход через: ' . $tm; + $_POST['type_gors'] = (int)$_POST['type_gors']; + if ($_POST['type_gors'] == 0 && $user['level'] > 6) { + $re = 'Лабиринт для новичков доступен для 4-6 уровней!'; + } elseif ($_POST['type_gors'] == 1 && $user['level'] < 7) { + $re = 'Лабиринт для опытных доступен с 7 уровня!'; + } elseif ($_POST['type_gors'] == 2 && ($user['level'] < 9 || $user['rep_laba'] < 20000)) { + $re = 'Легендарный Лабиринт доступен с 9 уровня!
Так-же требуется 20000 репутации Лабиринтов! У Вас : ' . $user['rep_laba'] . ' репутации Лабиринтов.'; } else { - $_POST['type_gors'] = (int)$_POST['type_gors']; - if ($_POST['type_gors'] == 0 && $user['level'] > 6) { - $re = 'Лабиринт для новичков доступен для 4-6 уровней!'; - } elseif ($_POST['type_gors'] == 1 && $user['level'] < 7) { - $re = 'Лабиринт для опытных доступен с 7 уровня!'; - } elseif ($_POST['type_gors'] == 2 && ($user['level'] < 9 || $user['rep_laba'] < 20000)) { - $re = 'Легендарный Лабиринт доступен с 9 уровня!
Так-же требуется 20000 репутации Лабиринтов! У Вас : ' . $user['rep_laba'] . ' репутации Лабиринтов.'; - } else { - mysql_query('INSERT INTO `laba_zv` (`uid1`, `time`, `com`, `pass`, `type`, `level`) VALUES ("' . $user['id'] . '", "' . time() . '", "' . mysql_real_escape_string(htmlspecialchars($_POST['text'])) . '", "' . mysql_real_escape_string($_POST['text']) . '", "' . mysql_real_escape_string($_POST['type_gors']) . '", "' . $user['level'] . '")'); - header('Location: lab_enter.php'); - } + mysql_query('INSERT INTO `laba_zv` (`uid1`, `time`, `com`, `pass`, `type`, `level`) VALUES ("' . $user['id'] . '", "' . time() . '", "' . mysql_real_escape_string(htmlspecialchars($_POST['text'])) . '", "' . mysql_real_escape_string($_POST['text']) . '", "' . mysql_real_escape_string($_POST['type_gors']) . '", "' . $user['level'] . '")'); + header('Location: lab_enter.php'); } } - } elseif (isset($_GET['cancelzv'])) { - if (!isset($zv['id'])) { - $re = 'Вы не участвуете ни в одной из заявок!
'; - } else { - $i = 1; - $j = 4; - $k = 0; - $h = 0; - while ($i <= 4) { - if ($k == 0 && $zv['uid' . $i] != $user['id']) { - $k = $zv['uid' . $i]; - $h = $i; - } - $i++; - } - $i = 1; - while ($i <= 4) { - if ($zv['uid' . $i] == $user['id']) { - if ($i > 1) { - $zv['uid' . $i] = 0; - } else { - $zv['uid' . $i] = $k; - $zv['uid' . $h] = 0; - } - } - if ($zv['uid' . $i] == 0) { - $j--; - } - $i++; - } - if ($j < 1) { - mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); - } else { - mysql_query('UPDATE `laba_zv` SET `uid1` = "' . $zv['uid1'] . '", `uid2` = "' . $zv['uid2'] . '", `uid3` = "' . $zv['uid3'] . '", `uid4` = "' . $zv['uid4'] . '" WHERE `id` = "' . $zv['id'] . '" lIMIT 1'); - } - $re = 'Заявка успешно отменена!
'; - unset($zv); - } - } elseif (isset($_GET['priemzv'])) { - if (isset($zv['id'])) { - $re = 'Вы уже состоите в одной из заявок!'; - } else { - $tozv = mysql_fetch_array(mysql_query('SELECT * FROM `laba_zv` WHERE `id` = "' . mysql_real_escape_string($_GET['priemzv']) . '" LIMIT 1')); - if (!isset($tozv['id'])) { - $re = 'Заявка не найдена!'; - } elseif (isset($var['id'])) { - $tm = timeOut($var['vals'] - time()); - $re = 'Следующий поход через: ' . $tm; - } else { - if ($tozv['uid1'] > 0 && $tozv['uid2'] > 0 && $tozv['uid3'] > 0 && $tozv['uid4'] > 0) { - $re = 'В заявке нет свободных мест!'; - } else { - $i = 1; - $j = 0; - while ($i <= 4) { - if ($tozv['uid' . $i] == 0 && $j == 0) { - $j = $i; - } - $i++; - } - mysql_query('UPDATE `laba_zv` SET `uid' . $j . '` = "' . $user['id'] . '" WHERE `id` = "' . $tozv['id'] . '" LIMIT 1'); - header('Location: lab_enter.php'); - } - } - } - } elseif (isset($_GET['startzv'])) { - if (!isset($zv['id'])) { - $re = 'Вы должны сначала подать заявку!'; - } elseif ($zv['uid1'] != $user['id']) { - $re = 'Вы должны являться лидером группы!'; - } else { - if ($zv['type'] == 0) { - $level = 5; - } elseif ($zv['type'] == 1) { - $level = 8; - } elseif ($zv['type'] == 2) { - $level = 10; - } - - $k = floor(2.5 * $level); - $s = $k * 2 + 3; - $r = 10; - $count = 1; - $a = []; - for ($y = 0; $y < $s; $y++) { - for ($x = 0; $x < $s; $x++) { - $a[$y][$x] = 1; - } - } - for ($x = 0; $x < $s; $x++) { - $a[0][$x] = 0; - $a[$s - 1][$x] = 0; - $a[$x][0] = 0; - $a[$x][$s - 1] = 0; - } - $x = $y = ($k - 1) >> 1; - $a[$y * 2 + 2][$x * 2 + 2] = 0; - while (1) { - do { - $d = rand(0, 3); - for ($i = 0; $i < 4; $i++) { - if ($d == 0 && $a[$y * 2 + 2][$x * 2 + 4]) { - $a[$y * 2 + 2][$x++ * 2 + 3] = 0; - $a[$y * 2 + 2][$x * 2 + 2] = 0; - $i = 5; - $count++; - break; - } elseif ($d == 1 && $a[$y * 2][$x * 2 + 2]) { - $a[$y-- * 2 + 1][$x * 2 + 2] = 0; - $a[$y * 2 + 2][$x * 2 + 2] = 0; - $i = 5; - $count++; - break; - } elseif ($d == 2 && $a[$y * 2 + 2][$x * 2]) { - $a[$y * 2 + 2][$x-- * 2 + 1] = 0; - $a[$y * 2 + 2][$x * 2 + 2] = 0; - $i = 5; - $count++; - break; - } elseif ($d == 3 && $a[$y * 2 + 4][$x * 2 + 2]) { - $a[$y++ * 2 + 3][$x * 2 + 2] = 0; - $a[$y * 2 + 2][$x * 2 + 2] = 0; - $i = 5; - $count++; - break; - } - $d = ($d + 1) % 4; - } - } while ($i != 4); - if ($count >= $k * $k) { - break; - } - $x = rand(0, $k - 1); - $y = rand(0, $k - 1); - while ($a[$y * 2 + 2][$x * 2 + 2] || !$a[$y * 2 + 2][$x * 2 + 4] && !$a[$y * 2][$x * 2 + 2] && !$a[$y * 2 + 2][$x * 2] && !$a[$y * 2 + 4][$x * 2 + 2]) { - if (++$x >= $k) { - $x = 0; - if (++$y >= $k) { - $y = 0; - } - } - } - } - $rnds = [rand(1, 3), rand(1, 3)]; - $srg = []; - $objects = []; - if ($rnds[0] == 1) { - $a[2][1] = 0; - $a[2][2] = 0; - $srg = [2, 1]; - $objects[2][1] = '
'; - } elseif ($rnds[0] == 2) { - $a[$k][1] = 0; - $a[$k][2] = 0; - $srg = [$k, 1]; - $objects[$k][1] = '
'; - } elseif ($rnds[0] == 3) { - $a[$k * 2][1] = 0; - $a[$k * 2][2] = 0; - $srg = [$k * 2, 1]; - $objects[$k * 2][1] = '
'; - } - - if ($rnds[1] == 1) { - $a[2][$k * 2 + 1] = 0; - $a[2][$k * 2] = 0; - $objects[2][$k * 2 + 1] = '
'; - } elseif ($rnds[1] == 2) { - $a[$k][$k * 2 + 1] = 0; - $a[$k][$k * 2] = 0; - $objects[$k][$k * 2 + 1] = '
'; - } elseif ($rnds[1] == 3) { - $a[$k * 2][$k * 2 + 1] = 0; - $a[$k * 2][$k * 2] = 0; - $objects[$k * 2][$k * 2 + 1] = '
'; - } - - $map = []; - $i = 1; - while ($i < count($a) - 1) { - $j = 1; - while ($j < count($a[$i]) - 1) { - if ($a[$i][$j] == 0 && $i > 1 && $j > 1 && $i <= $k * 2 && $j <= $k * 2) { - $map[] = [$i, $j]; - } - $j++; - } - $i++; - } - $proc1 = round(1.7 * $level); //Сколько % занимают сундуки - $proc2 = round(2.5 * $level); //Сколько % занимают монстры - $proc3 = round(1.35 * $level); //Сколько % занимают хилки - $proc4 = round(0.5 * $level); //Сколько % занимают ловушки - $proc5 = round(0.1 * $level); //Сколько % занимают пандоры - $proc6 = round(0.2 * $level); // Сколько занимает Антидот - - $proc1 = round($proc1 / 2); - $proc1 = round(count($map) / 100 * $proc1); - $proc2 = round($proc2 / 2); - $proc2 = round(count($map) / 100 * $proc2); - $proc3 = round($proc3 / 2); - $proc3 = round(count($map) / 100 * $proc3); - $proc4 = round($proc4 / 2); - $proc4 = round(count($map) / 100 * $proc4); - $proc5 = round($proc5 / 2); - $proc5 = round(count($map) / 100 * $proc5); - $proc6 = round($proc6 / 2); - $proc6 = round(count($map) / 100 * $proc6); - - $usi = 0; - mysql_query('INSERT INTO `laba_now` (`time`, `uid`, `users`, `map_id`, `end`, `type`) VALUES ("' . time() . '", "' . $user['id'] . '", "-1", "0", "0", "' . $zv['type'] . '")'); - $ding = mysql_insert_id(); - $i = 1; - while ($i <= 4) { - if ($zv['uid' . $i] > 0) { - $plu = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "' . $zv['uid' . $i] . '" LIMIT 1')); - if (isset($plu['id'])) { - mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1052', `online`.`room` = '1052', `users`.`x` = '" . $srg[0] . "', `users`.`y` = '" . $srg[1] . "', `users`.`xf` = '" . $srg[0] . "', `users`.`yr` = '" . $srg[1] . "', `users`.`laba` = '" . $ding . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $plu['id'] . "'"); - $usi++; - } - } - $i++; - } - mysql_query('UPDATE `laba_now` SET `users` = "' . $usi . '" WHERE `id` = "' . $ding . '" LIMIT 1'); - mysql_query('INSERT INTO `laba_map` (`id`, `data`, `update`) VALUES ("' . $ding . '", "' . json_encode($a) . '", "' . time() . '")'); - mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); - - $i = 1; - while ($i <= 6) { - if (${'proc' . $i} > 0) { - $j = 0; - while ($j < ${'proc' . $i}) { - $cord = $map[rand(0, count($map) - 1)]; - $obj = ''; - if ($i == 1) { - $obj = 'ddp1s'; - } elseif ($i == 2) { - $obj = 'ddp1m'; - } elseif ($i == 3) { - $obj = 'ddp1h'; - } elseif ($i == 4) { - $obj = 'ddp1l'; - } elseif ($i == 5) { - $obj = 'ddp1p'; - } elseif ($i == 6) { - $obj = 'ddp1a'; - } - mysql_query('INSERT INTO `laba_obj` (`lib`, `x`, `y`, `type`, `img`, `name`, `time`, `use`) VALUES ("' . $ding . '", "' . $cord[0] . '", "' . $cord[1] . '", "' . $i . '", "' . $obj . '", "{standart}", "' . time() . '", "0")'); - $j++; - } - } - $i++; - } - mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); - header('Location: labirint.php'); - } } - \Battles\Template::header('Вход в Лабиринты'); - ?> +} elseif (isset($_GET['cancelzv'])) { + if (!isset($zv['id'])) { + $re = 'Вы не участвуете ни в одной из заявок!
'; + } else { + $i = 1; + $j = 4; + $k = 0; + $h = 0; + while ($i <= 4) { + if ($k == 0 && $zv['uid' . $i] != $user['id']) { + $k = $zv['uid' . $i]; + $h = $i; + } + $i++; + } + $i = 1; + while ($i <= 4) { + if ($zv['uid' . $i] == $user['id']) { + if ($i > 1) { + $zv['uid' . $i] = 0; + } else { + $zv['uid' . $i] = $k; + $zv['uid' . $h] = 0; + } + } + if ($zv['uid' . $i] == 0) { + $j--; + } + $i++; + } + if ($j < 1) { + mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `laba_zv` SET `uid1` = "' . $zv['uid1'] . '", `uid2` = "' . $zv['uid2'] . '", `uid3` = "' . $zv['uid3'] . '", `uid4` = "' . $zv['uid4'] . '" WHERE `id` = "' . $zv['id'] . '" lIMIT 1'); + } + $re = 'Заявка успешно отменена!
'; + unset($zv); + } +} elseif (isset($_GET['priemzv'])) { + if (isset($zv['id'])) { + $re = 'Вы уже состоите в одной из заявок!'; + } else { + $tozv = mysql_fetch_array(mysql_query('SELECT * FROM `laba_zv` WHERE `id` = "' . mysql_real_escape_string($_GET['priemzv']) . '" LIMIT 1')); + if (!isset($tozv['id'])) { + $re = 'Заявка не найдена!'; + } elseif (isset($var['id'])) { + $tm = timeOut($var['vals'] - time()); + $re = 'Следующий поход через: ' . $tm; + } else { + if ($tozv['uid1'] > 0 && $tozv['uid2'] > 0 && $tozv['uid3'] > 0 && $tozv['uid4'] > 0) { + $re = 'В заявке нет свободных мест!'; + } else { + $i = 1; + $j = 0; + while ($i <= 4) { + if ($tozv['uid' . $i] == 0 && $j == 0) { + $j = $i; + } + $i++; + } + mysql_query('UPDATE `laba_zv` SET `uid' . $j . '` = "' . $user['id'] . '" WHERE `id` = "' . $tozv['id'] . '" LIMIT 1'); + header('Location: lab_enter.php'); + } + } + } +} elseif (isset($_GET['startzv'])) { + if (!isset($zv['id'])) { + $re = 'Вы должны сначала подать заявку!'; + } elseif ($zv['uid1'] != $user['id']) { + $re = 'Вы должны являться лидером группы!'; + } else { + if ($zv['type'] == 0) { + $level = 5; + } elseif ($zv['type'] == 1) { + $level = 8; + } elseif ($zv['type'] == 2) { + $level = 10; + } + + $k = floor(2.5 * $level); + $s = $k * 2 + 3; + $r = 10; + $count = 1; + $a = []; + for ($y = 0; $y < $s; $y++) { + for ($x = 0; $x < $s; $x++) { + $a[$y][$x] = 1; + } + } + for ($x = 0; $x < $s; $x++) { + $a[0][$x] = 0; + $a[$s - 1][$x] = 0; + $a[$x][0] = 0; + $a[$x][$s - 1] = 0; + } + $x = $y = ($k - 1) >> 1; + $a[$y * 2 + 2][$x * 2 + 2] = 0; + while (1) { + do { + $d = rand(0, 3); + for ($i = 0; $i < 4; $i++) { + if ($d == 0 && $a[$y * 2 + 2][$x * 2 + 4]) { + $a[$y * 2 + 2][$x++ * 2 + 3] = 0; + $a[$y * 2 + 2][$x * 2 + 2] = 0; + $i = 5; + $count++; + break; + } elseif ($d == 1 && $a[$y * 2][$x * 2 + 2]) { + $a[$y-- * 2 + 1][$x * 2 + 2] = 0; + $a[$y * 2 + 2][$x * 2 + 2] = 0; + $i = 5; + $count++; + break; + } elseif ($d == 2 && $a[$y * 2 + 2][$x * 2]) { + $a[$y * 2 + 2][$x-- * 2 + 1] = 0; + $a[$y * 2 + 2][$x * 2 + 2] = 0; + $i = 5; + $count++; + break; + } elseif ($d == 3 && $a[$y * 2 + 4][$x * 2 + 2]) { + $a[$y++ * 2 + 3][$x * 2 + 2] = 0; + $a[$y * 2 + 2][$x * 2 + 2] = 0; + $i = 5; + $count++; + break; + } + $d = ($d + 1) % 4; + } + } while ($i != 4); + if ($count >= $k * $k) { + break; + } + $x = rand(0, $k - 1); + $y = rand(0, $k - 1); + while ($a[$y * 2 + 2][$x * 2 + 2] || !$a[$y * 2 + 2][$x * 2 + 4] && !$a[$y * 2][$x * 2 + 2] && !$a[$y * 2 + 2][$x * 2] && !$a[$y * 2 + 4][$x * 2 + 2]) { + if (++$x >= $k) { + $x = 0; + if (++$y >= $k) { + $y = 0; + } + } + } + } + $rnds = [rand(1, 3), rand(1, 3)]; + $srg = []; + $objects = []; + if ($rnds[0] == 1) { + $a[2][1] = 0; + $a[2][2] = 0; + $srg = [2, 1]; + $objects[2][1] = '
'; + } elseif ($rnds[0] == 2) { + $a[$k][1] = 0; + $a[$k][2] = 0; + $srg = [$k, 1]; + $objects[$k][1] = '
'; + } elseif ($rnds[0] == 3) { + $a[$k * 2][1] = 0; + $a[$k * 2][2] = 0; + $srg = [$k * 2, 1]; + $objects[$k * 2][1] = '
'; + } + + if ($rnds[1] == 1) { + $a[2][$k * 2 + 1] = 0; + $a[2][$k * 2] = 0; + $objects[2][$k * 2 + 1] = '
'; + } elseif ($rnds[1] == 2) { + $a[$k][$k * 2 + 1] = 0; + $a[$k][$k * 2] = 0; + $objects[$k][$k * 2 + 1] = '
'; + } elseif ($rnds[1] == 3) { + $a[$k * 2][$k * 2 + 1] = 0; + $a[$k * 2][$k * 2] = 0; + $objects[$k * 2][$k * 2 + 1] = '
'; + } + + $map = []; + $i = 1; + while ($i < count($a) - 1) { + $j = 1; + while ($j < count($a[$i]) - 1) { + if ($a[$i][$j] == 0 && $i > 1 && $j > 1 && $i <= $k * 2 && $j <= $k * 2) { + $map[] = [$i, $j]; + } + $j++; + } + $i++; + } + $proc1 = round(1.7 * $level); //Сколько % занимают сундуки + $proc2 = round(2.5 * $level); //Сколько % занимают монстры + $proc3 = round(1.35 * $level); //Сколько % занимают хилки + $proc4 = round(0.5 * $level); //Сколько % занимают ловушки + $proc5 = round(0.1 * $level); //Сколько % занимают пандоры + $proc6 = round(0.2 * $level); // Сколько занимает Антидот + + $proc1 = round($proc1 / 2); + $proc1 = round(count($map) / 100 * $proc1); + $proc2 = round($proc2 / 2); + $proc2 = round(count($map) / 100 * $proc2); + $proc3 = round($proc3 / 2); + $proc3 = round(count($map) / 100 * $proc3); + $proc4 = round($proc4 / 2); + $proc4 = round(count($map) / 100 * $proc4); + $proc5 = round($proc5 / 2); + $proc5 = round(count($map) / 100 * $proc5); + $proc6 = round($proc6 / 2); + $proc6 = round(count($map) / 100 * $proc6); + + $usi = 0; + mysql_query('INSERT INTO `laba_now` (`time`, `uid`, `users`, `map_id`, `end`, `type`) VALUES ("' . time() . '", "' . $user['id'] . '", "-1", "0", "0", "' . $zv['type'] . '")'); + $ding = mysql_insert_id(); + $i = 1; + while ($i <= 4) { + if ($zv['uid' . $i] > 0) { + $plu = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "' . $zv['uid' . $i] . '" LIMIT 1')); + if (isset($plu['id'])) { + mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1052', `online`.`room` = '1052', `users`.`x` = '" . $srg[0] . "', `users`.`y` = '" . $srg[1] . "', `users`.`xf` = '" . $srg[0] . "', `users`.`yr` = '" . $srg[1] . "', `users`.`laba` = '" . $ding . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $plu['id'] . "'"); + $usi++; + } + } + $i++; + } + mysql_query('UPDATE `laba_now` SET `users` = "' . $usi . '" WHERE `id` = "' . $ding . '" LIMIT 1'); + mysql_query('INSERT INTO `laba_map` (`id`, `data`, `update`) VALUES ("' . $ding . '", "' . json_encode($a) . '", "' . time() . '")'); + mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + + $i = 1; + while ($i <= 6) { + if (${'proc' . $i} > 0) { + $j = 0; + while ($j < ${'proc' . $i}) { + $cord = $map[rand(0, count($map) - 1)]; + $obj = ''; + if ($i == 1) { + $obj = 'ddp1s'; + } elseif ($i == 2) { + $obj = 'ddp1m'; + } elseif ($i == 3) { + $obj = 'ddp1h'; + } elseif ($i == 4) { + $obj = 'ddp1l'; + } elseif ($i == 5) { + $obj = 'ddp1p'; + } elseif ($i == 6) { + $obj = 'ddp1a'; + } + mysql_query('INSERT INTO `laba_obj` (`lib`, `x`, `y`, `type`, `img`, `name`, `time`, `use`) VALUES ("' . $ding . '", "' . $cord[0] . '", "' . $cord[1] . '", "' . $i . '", "' . $obj . '", "{standart}", "' . time() . '", "0")'); + $j++; + } + } + $i++; + } + mysql_query('DELETE FROM `laba_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + header('Location: labirint.php'); + } +} +\Battles\Template::header('Вход в Лабиринты'); +?>
@@ -308,146 +303,145 @@ if ($user->room == 1051) {

Вход в Лабиринты

- admin) { - mysql_query('UPDATE `laba_zv` SET `com` = "" WHERE `id` = "' . (int)$_GET['del_com'] . '" LIMIT 1'); - $re = 'Комментарий удалён'; - } else { - $re = 'Вы не можете удалять комментарии.'; - } +admin) { + mysql_query('UPDATE `laba_zv` SET `com` = "" WHERE `id` = "' . (int)$_GET['del_com'] . '" LIMIT 1'); + $re = 'Комментарий удалён'; + } else { + $re = 'Вы не можете удалять комментарии.'; } +} - if ($user['level'] >= 4) { - if (isset($_GET['quest'])) { - $q2 = mysql_fetch_array(mysql_query('SELECT * FROM `qst_user` WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0" LIMIT 1')); - if (!isset($q2['id'])) { - $q3 = mysql_fetch_array(mysql_query('SELECT * FROM `qst_user` WHERE `uid` = "' . $user['id'] . '" AND (`cancel` > "' . time() . '" OR `finish` > "' . time() . '") LIMIT 1')); - if (isset($q3['id'])) { - if ($q3['cancel'] > time()) { - $tm = timeOut($q3['cancel'] - time()); - } else { - $tm = timeOut($q3['finish'] - time()); - } - $re = 'Нельзя брать задания так часто, разрешенный лимит: Один раз в 12 часов.
Следующее задание можно взять через : ' . $tm; - } else { - $rand = []; - $sp = mysql_query('SELECT `id`, `name` FROM `qst` WHERE `level` = "' . $user['level'] . '"'); - while ($pl = mysql_fetch_array($sp)) { - $rand[] = $pl; - } - $rand = $rand[rand(0, count($rand) - 1)]; - if ($rand['id'] > 0) { - $re = 'Вы успешно взяли задание "' . $rand['name'] . '"!
'; - mysql_query('INSERT INTO `qst_user` (`uid`, `time`, `qid`) VALUES ("' . $user['id'] . '", "' . time() . '", "' . $rand['id'] . '")'); - } else { - $re = 'Неудалось взять задание, нет подходящих заданий у Хранителя Лабиринта
'; - } - } - } else { - $re = 'У вас уже есть задание.'; - } - } - +if ($user['level'] >= 4) { + if (isset($_GET['quest'])) { $q2 = mysql_fetch_array(mysql_query('SELECT * FROM `qst_user` WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0" LIMIT 1')); - $q1 = mysql_fetch_array(mysql_query('SELECT * FROM `qst` WHERE `id` = "' . $q2['qid'] . '" LIMIT 1')); - - if (isset($q2['id']) && isset($_GET['cancelqst'])) { - mysql_query('UPDATE `qst_user` SET `cancel` = "' . (time() + 6 * 3600) . '" WHERE `id` = "' . $q2['id'] . '" LIMIT 1'); - unset($q1, $q2); - $re = 'Вы успешно отказались от задания...
'; - } - - if (isset($q1['id'])) { - $re .= '
Задание : ' . $q1['name'] . ' [' . $q2['val'] . '/' . $q1['obj_val'] . ']
• Отказаться (Следующее можно будет взять через 12 часов)
'; - if ($q2['val'] >= $q1['obj_val']) { - if (isset($_GET['finishqst'])) { - $re = 'Вы успешно завершили задание и получили: '; - if ($q1['cr'] > 0) { - $re .= ' ' . $q1['cr'] . ' кр. '; - } - if ($q1['rep'] > 0) { - $re .= ' ' . $q1['rep'] . ' репутации. '; - } - $re .= '
'; - $user['money'] += $q1['cr']; - $user['doblest'] += $q1['rep']; - $user['rep_laba'] += $q1['rep']; - mysql_query('UPDATE `users` SET `money` = "' . $user['money'] . '", `doblest` = "' . $user['doblest'] . '", `rep_laba` = "' . $user['rep_laba'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); - mysql_query('UPDATE `qst_user` SET `finish` = "' . (time() + 60 * 60 * 12) . '" WHERE `id` = "' . $q2['id'] . '" AND `uid` = "' . $user['id'] . '" LIMIT 1'); - unset($q1, $q2); + if (!isset($q2['id'])) { + $q3 = mysql_fetch_array(mysql_query('SELECT * FROM `qst_user` WHERE `uid` = "' . $user['id'] . '" AND (`cancel` > "' . time() . '" OR `finish` > "' . time() . '") LIMIT 1')); + if (isset($q3['id'])) { + if ($q3['cancel'] > time()) { + $tm = timeOut($q3['cancel'] - time()); + } else { + $tm = timeOut($q3['finish'] - time()); + } + $re = 'Нельзя брать задания так часто, разрешенный лимит: Один раз в 12 часов.
Следующее задание можно взять через : ' . $tm; + } else { + $rand = []; + $sp = mysql_query('SELECT `id`, `name` FROM `qst` WHERE `level` = "' . $user['level'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + $rand[] = $pl; + } + $rand = $rand[rand(0, count($rand) - 1)]; + if ($rand['id'] > 0) { + $re = 'Вы успешно взяли задание "' . $rand['name'] . '"!
'; + mysql_query('INSERT INTO `qst_user` (`uid`, `time`, `qid`) VALUES ("' . $user['id'] . '", "' . time() . '", "' . $rand['id'] . '")'); + } else { + $re = 'Неудалось взять задание, нет подходящих заданий у Хранителя Лабиринта
'; } - $re .= ' • Завершить задание и получить награду!'; } } else { - ?> - - - 'Для новичков', 1 => 'Для опытных', 2 => 'Для легендарных']; - while ($pl = mysql_fetch_array($sp)) { - $userszv = ''; - $i = 1; - while ($i <= 4) { - if ($pl['uid' . $i] > 0) { - $plu = mysql_fetch_array(mysql_query('SELECT `id`, `align`, `login`, `level` FROM `users` WHERE `id` = "' . $pl['uid' . $i] . '" LIMIT 1')); - if (isset($plu['id'])) { - $userszv .= ', ' . $plu['login'] . ' [' . $plu['level'] . ']'; + $re = 'У вас уже есть задание.'; + } + } + + $q2 = mysql_fetch_array(mysql_query('SELECT * FROM `qst_user` WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0" LIMIT 1')); + $q1 = mysql_fetch_array(mysql_query('SELECT * FROM `qst` WHERE `id` = "' . $q2['qid'] . '" LIMIT 1')); + + if (isset($q2['id']) && isset($_GET['cancelqst'])) { + mysql_query('UPDATE `qst_user` SET `cancel` = "' . (time() + 6 * 3600) . '" WHERE `id` = "' . $q2['id'] . '" LIMIT 1'); + unset($q1, $q2); + $re = 'Вы успешно отказались от задания...
'; + } + + if (isset($q1['id'])) { + $re .= '
Задание : ' . $q1['name'] . ' [' . $q2['val'] . '/' . $q1['obj_val'] . ']
• Отказаться (Следующее можно будет взять через 12 часов)
'; + if ($q2['val'] >= $q1['obj_val']) { + if (isset($_GET['finishqst'])) { + $re = 'Вы успешно завершили задание и получили: '; + if ($q1['cr'] > 0) { + $re .= ' ' . $q1['cr'] . ' кр. '; } + if ($q1['rep'] > 0) { + $re .= ' ' . $q1['rep'] . ' репутации. '; + } + $re .= '
'; + $user['money'] += $q1['cr']; + $user['doblest'] += $q1['rep']; + $user['rep_laba'] += $q1['rep']; + mysql_query('UPDATE `users` SET `money` = "' . $user['money'] . '", `doblest` = "' . $user['doblest'] . '", `rep_laba` = "' . $user['rep_laba'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + mysql_query('UPDATE `qst_user` SET `finish` = "' . (time() + 60 * 60 * 12) . '" WHERE `id` = "' . $q2['id'] . '" AND `uid` = "' . $user['id'] . '" LIMIT 1'); + unset($q1, $q2); } - $i++; + $re .= ' • Завершить задание и получить награду!'; } - $userszv = ltrim($userszv, ', '); - if ($pl['com'] != '') { - if ($user->admin) { - $del = ' Удалить комментарий'; - } else { - $del = ''; + } else { + ?> + + + 'Для новичков', 1 => 'Для опытных', 2 => 'Для легендарных']; +while ($pl = mysql_fetch_array($sp)) { + $userszv = ''; + $i = 1; + while ($i <= 4) { + if ($pl['uid' . $i] > 0) { + $plu = mysql_fetch_array(mysql_query('SELECT `id`, `align`, `login`, `level` FROM `users` WHERE `id` = "' . $pl['uid' . $i] . '" LIMIT 1')); + if (isset($plu['id'])) { + $userszv .= ', ' . $plu['login'] . ' [' . $plu['level'] . ']'; } - $userszv .= ' (Комментарий: ' . $pl['com'] . '' . $del . ')'; } - if (!isset($zv['id'])) { - $userszv .= ' '; - } - echo '
' . date('H:i', $pl['time']) . ' Тип : ' . $typez[$pl['type']] . ' | ' . $userszv . '
'; + $i++; } - ?> + $userszv = ltrim($userszv, ', '); + if ($pl['com'] != '') { + if ($user->admin) { + $del = ' Удалить комментарий'; + } else { + $del = ''; + } + $userszv .= ' (Комментарий: ' . $pl['com'] . '' . $del . ')'; + } + if (!isset($zv['id'])) { + $userszv .= ' '; + } + echo '
' . date('H:i', $pl['time']) . ' Тип : ' . $typez[$pl['type']] . ' | ' . $userszv . '
'; +} +?>
- - - - - -
-
-
- Группа - Тип похода: - -
- Комментарий - -
- -  
-
-
-
- - - - - + + + + + +
+
+
+ Группа + Тип похода: + +
+ Комментарий + +
+ +  
+
+
+
+ + + - ' . $re . ''; - } + + +' . $re . ''; } \ No newline at end of file diff --git a/labirint.php b/labirint.php index c74b7b3..2448400 100644 --- a/labirint.php +++ b/labirint.php @@ -1,21 +1,12 @@ battle) { - header("Location: fbattle.php"); - exit; -} - $vipUsers = [ 'Father', ]; @@ -40,854 +31,852 @@ function money_add($sum) mysql_query('UPDATE `users` SET `money` = "' . $user['money'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); } -if ($user->room == 1052) { - $lab = mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "' . $user['laba'] . '" LIMIT 1')); - $map = mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "' . $user['laba'] . '" LIMIT 1')); - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $user['laba'] . '" AND `vars` = "dielaba" LIMIT 1')); - $dies = $dies[0]; - $map_d = json_decode($map['data']); - $usersDng = showProgressBar($user['hp'], $user['maxhp']); - $errors = ''; - $effed = ''; - $mapsee = ''; - $varos = []; - $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); - $real_x = $user['x']; - $real_y = $user['y']; - if ($real_y < 6) { - $real_y = 6; - } - if ($real_x < 6) { - $real_x = 6; - } - if ($real_y > count($map_d) - 7) { - $real_y = count($map_d) - 7; - } - if ($real_x > count($map_d) - 7) { - $real_x = count($map_d) - 7; - } - $objs = []; - $sp = mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '" AND `x` > ' . ($real_x - 7) . ' AND `x` < ' . ($real_x + 7) . ' AND `y` > ' . ($real_y - 12) . ' AND `y` < ' . ($real_y + 12) . ' LIMIT 144'); - while ($pl = mysql_fetch_array($sp)) { - $objs[$pl['x']][$pl['y']] = $pl; - } - $i = 1; - $goodgoo = [1 => 0, 2 => 0, 3 => 0, 4 => 0]; - while ($i <= 4) { - $goto = ['x' => $user['y'], 'y' => $user['x']]; - if ($i == 1) { - $goto['x']--; - } elseif ($i == 2) { - $goto['y']--; - } elseif ($i == 3) { - $goto['x']++; - } elseif ($i == 4) { - $goto['y']++; - } - if ($map_d[$goto['y']][$goto['x']] == 0 && $goto['x'] > 0 && $goto['x'] < count($map_d) - 1 && $user['timeGo'] <= time()) { - $goodgoo[$i] = 1; - } - $i++; - } - if (isset($_GET['goto'])) { - $goto = ['x' => $user['y'], 'y' => $user['x']]; - if ($_GET['goto'] == 1) { - $goto['x']--; - } elseif ($_GET['goto'] == 2) { - $goto['y']--; - } elseif ($_GET['goto'] == 3) { - $goto['x']++; - } elseif ($_GET['goto'] == 4) { - $goto['y']++; - } - if ($goodgoo[$_GET['goto']] == 1 && $user['timeGo'] <= time()) { - $user['y'] = $goto['x']; - $user['x'] = $goto['y']; - $real_x = $user['x']; - $real_y = $user['y']; - $varos['timego'] = 0; #5 - if (isset($varos['trap1']['id'])) { - $varos['timego'] += 3; - } - if ($user['align'] == 2.99) { - $varos['timego'] = 0; - } - $user['timeGo'] = (time() + $varos['timego']); - $user['timeGoL'] = time(); - if (!mysql_query('UPDATE `users` SET `x` = "' . $user['x'] . '", `y` = "' . $user['y'] . '", `timeGoL` = "' . $user['timeGoL'] . '", `timeGo` = "' . $user['timeGo'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1')) { - $errors = 'Ошибка перемещения!'; +$lab = mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "' . $user['laba'] . '" LIMIT 1')); +$map = mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "' . $user['laba'] . '" LIMIT 1')); +$dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $user['laba'] . '" AND `vars` = "dielaba" LIMIT 1')); +$dies = $dies[0]; +$map_d = json_decode($map['data']); +$usersDng = showProgressBar($user['hp'], $user['maxhp']); +$errors = ''; +$effed = ''; +$mapsee = ''; +$varos = []; +$varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); +$real_x = $user['x']; +$real_y = $user['y']; +if ($real_y < 6) { + $real_y = 6; +} +if ($real_x < 6) { + $real_x = 6; +} +if ($real_y > count($map_d) - 7) { + $real_y = count($map_d) - 7; +} +if ($real_x > count($map_d) - 7) { + $real_x = count($map_d) - 7; +} +$objs = []; +$sp = mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '" AND `x` > ' . ($real_x - 7) . ' AND `x` < ' . ($real_x + 7) . ' AND `y` > ' . ($real_y - 12) . ' AND `y` < ' . ($real_y + 12) . ' LIMIT 144'); +while ($pl = mysql_fetch_array($sp)) { + $objs[$pl['x']][$pl['y']] = $pl; +} +$i = 1; +$goodgoo = [1 => 0, 2 => 0, 3 => 0, 4 => 0]; +while ($i <= 4) { + $goto = ['x' => $user['y'], 'y' => $user['x']]; + if ($i == 1) { + $goto['x']--; + } elseif ($i == 2) { + $goto['y']--; + } elseif ($i == 3) { + $goto['x']++; + } elseif ($i == 4) { + $goto['y']++; + } + if ($map_d[$goto['y']][$goto['x']] == 0 && $goto['x'] > 0 && $goto['x'] < count($map_d) - 1 && $user['timeGo'] <= time()) { + $goodgoo[$i] = 1; + } + $i++; +} +if (isset($_GET['goto'])) { + $goto = ['x' => $user['y'], 'y' => $user['x']]; + if ($_GET['goto'] == 1) { + $goto['x']--; + } elseif ($_GET['goto'] == 2) { + $goto['y']--; + } elseif ($_GET['goto'] == 3) { + $goto['x']++; + } elseif ($_GET['goto'] == 4) { + $goto['y']++; + } + + if ($goodgoo[$_GET['goto']] == 1 && $user['timeGo'] <= time()) { + $user['y'] = $goto['x']; + $user['x'] = $goto['y']; + $real_x = $user['x']; + $real_y = $user['y']; + $varos['timego'] = 0; #5 + if (isset($varos['trap1']['id'])) { + $varos['timego'] += 3; + } + if ($user['align'] == 2.99) { + $varos['timego'] = 0; + } + $user['timeGo'] = (time() + $varos['timego']); + $user['timeGoL'] = time(); + if (!mysql_query('UPDATE `users` SET `x` = "' . $user['x'] . '", `y` = "' . $user['y'] . '", `timeGoL` = "' . $user['timeGoL'] . '", `timeGo` = "' . $user['timeGo'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1')) { + $errors = 'Ошибка перемещения!'; + } + } +} + +$tmdg = ($user['timeGo'] - time()); +$tmdgl = ($user['timeGo'] - $user['timeGoL']); +$tmdgp = floor(100 - $tmdg / $tmdgl * 100); +if ($tmdgp < 1) { + $tmdgp = 1; +} elseif ($tmdgp > 100) { + $tmdgp = 100; +} +$tmdgm = 25 * $tmdgl; +$tmdg = floor(40 / 100 * $tmdgp); + +if ($tmdg < 1) { + $tmdg = 1; +} elseif ($tmdg > 40) { + $tmdg = 40; +} + +if (isset($_POST['exit'])) { + if ($lab['users'] < 2) { + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); + while ($pl = mysql_fetch_array($dresed)) { + dropitemid($pl['type'], $user['id']); + } + mysql_query('DELETE FROM `inventory` WHERE `laba` > 0 AND `owner` = "' . $user['id'] . '"'); + mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); + mysql_query('UPDATE `qst_user` SET `val` = "0" WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0"'); + addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); + header('Location: lab_enter.php'); +} + +$itms = ''; + +if (isset($objs[$user['x']][$user['y']]['id'])) { + $var = []; + $mitm = $objs[$user['x']][$user['y']]; + if ($mitm['type'] == 2) { + if ($mitm['use'] == 0) { + $btl_pix = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` > 0 AND `laba` = "' . $lab['id'] . '" AND `x` = "' . $user['x'] . '" AND `y` = "' . $user['y'] . '" LIMIT 1')); + if (!isset($btl_pix['id'])) { + $bots = [ + 0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034], + 1 => [10111, 10112, 10113, 10114, 10115, 10116], + 2 => [10111, 10112, 10113], + ]; + $bot_pix2 = $bots[$lab['type']]; + + $teams = []; + $where = ''; + $bot_ids = ''; + $i = 0; + $j = (1 + rand(0, floor($user['level'] / rand(3, 4)))); + while ($i < $j) { + $bot_pix = $bot_pix2[rand(0, count($bot_pix2) - 1)]; + $bot_pix = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $bot_pix . '" LIMIT 1')); + mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $bot_pix['login'] . " (Бот #$i)', '" . $bot_pix['id'] . "', '', '" . $bot_pix['maxhp'] . "')"); + $bot = mysql_insert_id(); + $bot_ids .= $bot . ';'; + $teams[$user['id']][$bot] = [0, 0, time()]; + $teams[$bot][$user['id']] = [0, 0, time()]; + $where = ' `id` = ' . $bot . ' OR'; + $i++; + } + $bot_ids = rtrim($bot_ids, ';'); + $where = rtrim($where, ' OR'); + + if (!mysql_query("INSERT INTO `battle` (`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `x`, `y`) VALUES ('" . serialize($teams) . "', '3', '1', '0', '" . $user['id'] . "', '" . $bot_ids . "', '" . time() . "', '" . time() . "', '" . $user['x'] . "', '" . $user['y'] . "')")) { + exit('Error #2'); + } + + $id = mysql_insert_id(); + $bts = explode(';', $bot_ids); + $is = 0; + while ($is <= count($bts)) { + $nicks .= Nick::id($bts[$is])->full(1) . ', '; + $i_d .= $bts[$is] . ', '; + $is++; + } + $nicks = rtrim($nicks, ', '); + $who = '`id` IN (' . rtrim($i_d, ', ') . ')'; + + if ($user1['invis'] == 1) { + $rr = "невидимка и " . $nicks . ""; + } else { + $rr = "" . Nick::id($user['id'])->full(1) . " и " . $nicks . ""; + } + + if (!mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE " . $who . "")) { + exit('Error #1' . $who); + } + mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id`= {$user['id']} LIMIT 1"); + addlog($id, "Часы показывали " . date("Y.m.d H.i") . ", когда " . $rr . " бросили вызов друг другу.
"); + } else { + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1')); + $botd = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `battle` = "' . $bd['id'] . '" LIMIT 1')); + $battle = unserialize($bd['teams']); + $ak = array_keys($battle[$botd['id']]); + $battle[$user['id']] = $battle[$ak[0]]; + foreach ($battle[$user['id']] as $k => $v) { + $battle[$user['id']][$k] = [0, 0, time()]; + $battle[$k][$user['id']] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + $ttt = 1; + addlog($jert['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вмешался в поединок!
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\') WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1'); + mysql_query("UPDATE `users` SET `battle` = '" . $bd['id'] . "', `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1"); + header("Location: fbattle.php"); } + exit(""); } - } - - $tmdg = ($user['timeGo'] - time()); - $tmdgl = ($user['timeGo'] - $user['timeGoL']); - $tmdgp = floor(100 - $tmdg / $tmdgl * 100); - if ($tmdgp < 1) { - $tmdgp = 1; - } elseif ($tmdgp > 100) { - $tmdgp = 100; - } - $tmdgm = 25 * $tmdgl; - $tmdg = floor(40 / 100 * $tmdgp); - - if ($tmdg < 1) { - $tmdg = 1; - } elseif ($tmdg > 40) { - $tmdg = 40; - } - - if (isset($_POST['exit'])) { - if ($lab['users'] < 2) { - mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } elseif ($mitm['type'] == 1) { + if ($mitm['use'] == 0) { + $itms .= '
'; } else { - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + $itms .= '
'; } - $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); - while ($pl = mysql_fetch_array($dresed)) { - dropitemid($pl['type'], $user['id']); + } elseif ($mitm['type'] == 3) { + if ($mitm['use'] == 0) { + $itms .= '
'; + } else { + $itms .= '
'; + } + } elseif ($mitm['type'] == 4) { + if ($mitm['use'] == 0) { + $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); + $var['time'] = rand(1, 60); + if (isset($var['trap1']['id'])) { + mysql_query('UPDATE `laba_act` SET `vals` = "' . ($var['trap1']['vals'] + $var['time']) . '", `time` = "' . ($var['trap1']['time'] + $var['time'] * 60) . '" WHERE `id` = "' . $var['trap1']['id'] . '" LIMIT 1'); + } else { + mysql_query('INSERT INTO `laba_act` (`uid`, `time`, `lib`, `vars`, `vals`) VALUES ("' . $user['id'] . '", "' . (time() + $var['time'] * 60) . '", "' . $lab['id'] . '", "trap1", "' . $var['time'] . '")'); + } + $mitm['use'] = $user['id']; + mysql_query('UPDATE `laba_obj` SET `use` = "' . $mitm['use'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1'); + $var['sex'] = ''; + if ($user['sex'] == 0) { + $var['sex'] = 'а'; + } + $var['text'] = ' ' . $user['login'] . ' угодил' . $var['sex'] . ' в ловушку...'; + $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); + $errors .= ' ' . $user['login'] . ' угодил' . $var['sex'] . ' в ловушку... Время перехода +3 секунды (Длительность: +' . $var['time'] . ' мин.)'; + } + } elseif ($mitm['type'] == 5) { + if ($mitm['use'] == 0) { + $itms .= '
'; + } else { + $itms .= '
'; + } + } elseif ($mitm['type'] == 6) { + if ($mitm['use'] == 0) { + $itms .= '
'; + } else { + $itms .= '
'; } - mysql_query('DELETE FROM `inventory` WHERE `laba` > 0 AND `owner` = "' . $user['id'] . '"'); - mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); - mysql_query('UPDATE `qst_user` SET `val` = "0" WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0"'); - addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); - header('Location: lab_enter.php'); } + unset($var); +} - $itms = ''; +if ($user['y'] >= count($map_d) - 2) { + if ($lab['users'] < 2) { + mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); + mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); + } else { + $lab['users']--; + mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); + } + $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); + while ($pl = mysql_fetch_array($dresed)) { + dropitemid($pl['type'], $user['id']); + } + mysql_query('UPDATE `inventory` SET `laba` = 0 WHERE `laba` = 1 AND `owner` = "' . $user['id'] . '"'); + mysql_query('DELETE FROM `inventory` WHERE `laba` = 2 AND `owner` = "' . $user['id'] . '"'); + mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); + addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); + header('Location: lab_enter.php'); +} - if (isset($objs[$user['x']][$user['y']]['id'])) { - $var = []; - $mitm = $objs[$user['x']][$user['y']]; - if ($mitm['type'] == 2) { - if ($mitm['use'] == 0) { - $btl_pix = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` > 0 AND `laba` = "' . $lab['id'] . '" AND `x` = "' . $user['x'] . '" AND `y` = "' . $user['y'] . '" LIMIT 1')); - if (!isset($btl_pix['id'])) { - $bots = [ - 0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034], - 1 => [10111, 10112, 10113, 10114, 10115, 10116], - 2 => [10111, 10112, 10113], - ]; - $bot_pix2 = $bots[$lab['type']]; - - $teams = []; - $where = ''; - $bot_ids = ''; - $i = 0; - $j = (1 + rand(0, floor($user['level'] / rand(3, 4)))); - while ($i < $j) { - $bot_pix = $bot_pix2[rand(0, count($bot_pix2) - 1)]; - $bot_pix = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $bot_pix . '" LIMIT 1')); - mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $bot_pix['login'] . " (Бот #$i)', '" . $bot_pix['id'] . "', '', '" . $bot_pix['maxhp'] . "')"); - $bot = mysql_insert_id(); - $bot_ids .= $bot . ';'; - $teams[$user['id']][$bot] = [0, 0, time()]; - $teams[$bot][$user['id']] = [0, 0, time()]; - $where = ' `id` = ' . $bot . ' OR'; - $i++; - } - $bot_ids = rtrim($bot_ids, ';'); - $where = rtrim($where, ' OR'); - - if (!mysql_query("INSERT INTO `battle` (`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `x`, `y`) VALUES ('" . serialize($teams) . "', '3', '1', '0', '" . $user['id'] . "', '" . $bot_ids . "', '" . time() . "', '" . time() . "', '" . $user['x'] . "', '" . $user['y'] . "')")) { - exit('Error #2'); - } - - $id = mysql_insert_id(); - $bts = explode(';', $bot_ids); - $is = 0; - while ($is <= count($bts)) { - $nicks .= Nick::id($bts[$is])->full(1) . ', '; - $i_d .= $bts[$is] . ', '; - $is++; - } - $nicks = rtrim($nicks, ', '); - $who = '`id` IN (' . rtrim($i_d, ', ') . ')'; - - if ($user1['invis'] == 1) { - $rr = "невидимка и " . $nicks . ""; - } else { - $rr = "" . Nick::id($user['id'])->full(1) . " и " . $nicks . ""; - } - - if (!mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE " . $who . "")) { - exit('Error #1' . $who); - } - mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id`= {$user['id']} LIMIT 1"); - addlog($id, "Часы показывали " . date("Y.m.d H.i") . ", когда " . $rr . " бросили вызов друг другу.
"); - } else { - $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1')); - $botd = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `battle` = "' . $bd['id'] . '" LIMIT 1')); - $battle = unserialize($bd['teams']); - $ak = array_keys($battle[$botd['id']]); - $battle[$user['id']] = $battle[$ak[0]]; - foreach ($battle[$user['id']] as $k => $v) { - $battle[$user['id']][$k] = [0, 0, time()]; - $battle[$k][$user['id']] = [0, 0, time()]; - } - $t1 = explode(";", $bd['t1']); - $ttt = 1; - addlog($jert['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вмешался в поединок!
'); - mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\') WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1'); - mysql_query("UPDATE `users` SET `battle` = '" . $bd['id'] . "', `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1"); - header("Location: fbattle.php"); - } - exit(""); - } - } elseif ($mitm['type'] == 1) { - if ($mitm['use'] == 0) { - $itms .= '
'; - } else { - $itms .= '
'; - } - } elseif ($mitm['type'] == 3) { - if ($mitm['use'] == 0) { - $itms .= '
'; - } else { - $itms .= '
'; - } - } elseif ($mitm['type'] == 4) { - if ($mitm['use'] == 0) { - $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); - $var['time'] = rand(1, 60); - if (isset($var['trap1']['id'])) { - mysql_query('UPDATE `laba_act` SET `vals` = "' . ($var['trap1']['vals'] + $var['time']) . '", `time` = "' . ($var['trap1']['time'] + $var['time'] * 60) . '" WHERE `id` = "' . $var['trap1']['id'] . '" LIMIT 1'); - } else { - mysql_query('INSERT INTO `laba_act` (`uid`, `time`, `lib`, `vars`, `vals`) VALUES ("' . $user['id'] . '", "' . (time() + $var['time'] * 60) . '", "' . $lab['id'] . '", "trap1", "' . $var['time'] . '")'); - } - $mitm['use'] = $user['id']; - mysql_query('UPDATE `laba_obj` SET `use` = "' . $mitm['use'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1'); +if (isset($_GET['takeitm'])) { + $errors = 'Предмет не найден...'; +} elseif (isset($_GET['useobj'])) { + $var = ['obj' => mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `id` = "' . mysql_real_escape_string($_GET['useobj']) . '" AND `lib` = "' . $lab['id'] . '" AND `x` = "' . $user['x'] . '" AND `y` = "' . $user['y'] . '" LIMIT 1'))]; + if (isset($var['obj']['id'])) { + if ($var['obj']['use'] == 0) { + if ($var['obj']['type'] == 1) { $var['sex'] = ''; if ($user['sex'] == 0) { $var['sex'] = 'а'; } - $var['text'] = ' ' . $user['login'] . ' угодил' . $var['sex'] . ' в ловушку...'; - $varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); - $errors .= ' ' . $user['login'] . ' угодил' . $var['sex'] . ' в ловушку... Время перехода +3 секунды (Длительность: +' . $var['time'] . ' мин.)'; - } - } elseif ($mitm['type'] == 5) { - if ($mitm['use'] == 0) { - $itms .= '
'; - } else { - $itms .= '
'; - } - } elseif ($mitm['type'] == 6) { - if ($mitm['use'] == 0) { - $itms .= '
'; - } else { - $itms .= '
'; - } - } - unset($var); - } - - if ($user['y'] >= count($map_d) - 2) { - if ($lab['users'] < 2) { - mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); - } else { - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - } - $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); - while ($pl = mysql_fetch_array($dresed)) { - dropitemid($pl['type'], $user['id']); - } - mysql_query('UPDATE `inventory` SET `laba` = 0 WHERE `laba` = 1 AND `owner` = "' . $user['id'] . '"'); - mysql_query('DELETE FROM `inventory` WHERE `laba` = 2 AND `owner` = "' . $user['id'] . '"'); - mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); - addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); - header('Location: lab_enter.php'); - } - - if (isset($_GET['takeitm'])) { - $errors = 'Предмет не найден...'; - } elseif (isset($_GET['useobj'])) { - $var = ['obj' => mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `id` = "' . mysql_real_escape_string($_GET['useobj']) . '" AND `lib` = "' . $lab['id'] . '" AND `x` = "' . $user['x'] . '" AND `y` = "' . $user['y'] . '" LIMIT 1'))]; - if (isset($var['obj']['id'])) { - if ($var['obj']['use'] == 0) { - if ($var['obj']['type'] == 1) { - $var['sex'] = ''; - if ($user['sex'] == 0) { - $var['sex'] = 'а'; - } - $var['itm'] = $varsitm[rand(0, count($varsitm) - 1)]; - $var['itm'] = $var['itm'][0]; - $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`, `name` FROM `shop` WHERE `id` = "' . $var['itm'] . '" LIMIT 1')); - if (isset($var['itm']['id'])) { - if ($var['itm']['id'] == 270) { - $arr = [0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2]; - $kr = $arr[rand(0, count($arr) - 1)]; - $var['itm']['name'] = $kr . ' кр'; - money_add($kr); - unset($kr); - } else { - labaItemAdd($var['itm']['id']); - } + $var['itm'] = $varsitm[rand(0, count($varsitm) - 1)]; + $var['itm'] = $var['itm'][0]; + $var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`, `name` FROM `shop` WHERE `id` = "' . $var['itm'] . '" LIMIT 1')); + if (isset($var['itm']['id'])) { + if ($var['itm']['id'] == 270) { + $arr = [0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2]; + $kr = $arr[rand(0, count($arr) - 1)]; + $var['itm']['name'] = $kr . ' кр'; + money_add($kr); + unset($kr); } else { - $var['itm']['name'] = 'Предмет рассыпался на глазах...'; - } - $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' сундук...и забрал "' . $var['itm']['name'] . '"'; - $var['obj']['use'] = $user['id']; - } elseif ($var['obj']['type'] == 5) { - $var['sex'] = ''; - if ($user['sex'] == 0) { - $var['sex'] = 'а'; + labaItemAdd($var['itm']['id']); } + } else { + $var['itm']['name'] = 'Предмет рассыпался на глазах...'; + } + $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' сундук...и забрал "' . $var['itm']['name'] . '"'; + $var['obj']['use'] = $user['id']; + } elseif ($var['obj']['type'] == 5) { + $var['sex'] = ''; + if ($user['sex'] == 0) { + $var['sex'] = 'а'; + } - $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...и забрал "' . $var['itm']['name'] . '"'; - $var['obj']['use'] = $user['id']; - } elseif ($var['obj']['type'] == 3) { - $var['sex'] = ''; - if ($user['sex'] == 0) { - $var['sex'] = 'а'; - } - $var['hpp'] = rand(2, 5) * 10; - $var['hp'] = round($user['maxhp'] / 100 * $var['hpp']); - $user['hp'] += $var['hp']; - if ($user['hp'] > $user['maxhp']) { - $user['hp'] = $user['maxhp']; - } - mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); - $errors .= ' ' . $user['login'] . ' пополнил' . $var['sex'] . ' здоровье, Уровень Жизни +' . $var['hpp'] . '% (+' . $var['hp'] . 'HP)'; - $var['obj']['use'] = $user['id']; - } elseif ($var['obj']['type'] == 6) { - $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); - if (isset($var['trap1']['id'])) { - $var['time'] = rand(1, 50); - if ($var['trap1']['time'] <= (time() + 60 * $var['time'])) { - mysql_query('DELETE FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1'); - $errors .= '
Действие ловушки закончилось.'; - unset($var['trap1'], $var['time']); - } else { - $var['trap1']['time'] -= 60 * $var['time']; - mysql_query('UPDATE `laba_act` SET `time` = "' . $var['trap1']['time'] . '" WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1'); - $errors = '
Действие ловушки снижено на ' . $var['time'] . ' мин...'; - } - $var['obj']['use'] = $user['id']; + $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...и забрал "' . $var['itm']['name'] . '"'; + $var['obj']['use'] = $user['id']; + } elseif ($var['obj']['type'] == 3) { + $var['sex'] = ''; + if ($user['sex'] == 0) { + $var['sex'] = 'а'; + } + $var['hpp'] = rand(2, 5) * 10; + $var['hp'] = round($user['maxhp'] / 100 * $var['hpp']); + $user['hp'] += $var['hp']; + if ($user['hp'] > $user['maxhp']) { + $user['hp'] = $user['maxhp']; + } + mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); + $errors .= ' ' . $user['login'] . ' пополнил' . $var['sex'] . ' здоровье, Уровень Жизни +' . $var['hpp'] . '% (+' . $var['hp'] . 'HP)'; + $var['obj']['use'] = $user['id']; + } elseif ($var['obj']['type'] == 6) { + $var['trap1'] = mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1')); + if (isset($var['trap1']['id'])) { + $var['time'] = rand(1, 50); + if ($var['trap1']['time'] <= (time() + 60 * $var['time'])) { + mysql_query('DELETE FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1'); + $errors .= '
Действие ловушки закончилось.'; + unset($var['trap1'], $var['time']); } else { - $errors .= '
Вам нечего очищать ...'; + $var['trap1']['time'] -= 60 * $var['time']; + mysql_query('UPDATE `laba_act` SET `time` = "' . $var['trap1']['time'] . '" WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1'); + $errors = '
Действие ловушки снижено на ' . $var['time'] . ' мин...'; } + $var['obj']['use'] = $user['id']; + } else { + $errors .= '
Вам нечего очищать ...'; } - if ($var['obj']['use'] > 0) { - mysql_query('UPDATE `laba_obj` SET `use` = "' . $var['obj']['use'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1'); - #$var['obj']['use'] = $var['obj']['use']; ?!?!?!?!?! - } - } else { - $errors = 'Кто-то уже использовал это до Вас...'; + } + if ($var['obj']['use'] > 0) { + mysql_query('UPDATE `laba_obj` SET `use` = "' . $var['obj']['use'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1'); + #$var['obj']['use'] = $var['obj']['use']; ?!?!?!?!?! } } else { - $errors = 'Обьект не найден...'; + $errors = 'Кто-то уже использовал это до Вас...'; } - unset($var); + } else { + $errors = 'Обьект не найден...'; } + unset($var); +} - $sp = mysql_query('SELECT `x`, `y`, `level`, `login` FROM `users` WHERE `laba` = "' . $lab['id'] . '" AND `id` != "' . $user['id'] . '" LIMIT 3'); - $pi = 1; - while ($pl = mysql_fetch_array($sp)) { - $objs[$pl['x']][$pl['y']] = [2 => '
']; - $pi++; +$sp = mysql_query('SELECT `x`, `y`, `level`, `login` FROM `users` WHERE `laba` = "' . $lab['id'] . '" AND `id` != "' . $user['id'] . '" LIMIT 3'); +$pi = 1; +while ($pl = mysql_fetch_array($sp)) { + $objs[$pl['x']][$pl['y']] = [2 => '
']; + $pi++; +} + +$objs[$user['x']][$user['y']] = [2 => '
']; +$i = 0; +while ($i <= count($map_d)) { + $j = 0; + while ($j < count($map_d[$i])) { + if ($i > $real_x - 6 && $i < $real_x + 6 && $j > $real_y - 6 && $j < $real_y + 6) { + if ($map_d[$i][$j] == 1) { + $mapsee .= '
' . $objs[$i][$j][2] . '
'; + } else { + if (!isset($objs[$i][$j]['id'])) { + if ($j == 1) { + $objs[$i][$j][2] = '
'; + } elseif ($j == count($map_d) - 2) { + $objs[$i][$j][2] = '
'; + } + } else { + if ($objs[$i][$j]['use'] == 0) { + $objs[$i][$j][2] = '
'; + } else { + $objs[$i][$j][2] = ''; + } + } + $mapsee .= '
' . $objs[$i][$j][2] . '
'; + } + } + $j++; } + if ($i > $real_x - 6 && $i < $real_x + 6) { + $mapsee .= '
'; + } + $i++; +} +$mapsee = '
' . $mapsee . '
'; +if ($user['align'] == 2.99) { + unset($objs); $objs[$user['x']][$user['y']] = [2 => '
']; $i = 0; while ($i <= count($map_d)) { $j = 0; while ($j < count($map_d[$i])) { - if ($i > $real_x - 6 && $i < $real_x + 6 && $j > $real_y - 6 && $j < $real_y + 6) { - if ($map_d[$i][$j] == 1) { - $mapsee .= '
' . $objs[$i][$j][2] . '
'; - } else { - if (!isset($objs[$i][$j]['id'])) { - if ($j == 1) { - $objs[$i][$j][2] = '
'; - } elseif ($j == count($map_d) - 2) { - $objs[$i][$j][2] = '
'; - } - } else { - if ($objs[$i][$j]['use'] == 0) { - $objs[$i][$j][2] = '
'; - } else { - $objs[$i][$j][2] = ''; - } + if ($map_d[$i][$j] == 1) { + $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; + } else { + if (!isset($objs[$i][$j]['id'])) { + if ($j == 1 && $i > 0 && $i < count($map_d) - 2) { + $objs[$i][$j][2] = '
'; + } elseif ($j == count($map_d) - 2 && $i > 0 && $i < count($map_d) - 2) { + $objs[$i][$j][2] = '
'; + } + } else { + if ($objs[$i][$j]['use'] == 0) { + $objs[$i][$j][2] = '
'; + } else { + $objs[$i][$j][2] = ''; } - $mapsee .= '
' . $objs[$i][$j][2] . '
'; } + $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; } $j++; } - if ($i > $real_x - 6 && $i < $real_x + 6) { - $mapsee .= '
'; - } + $mapsee2 .= '
'; $i++; } - $mapsee = '
' . $mapsee . '
'; + $mapsee2 = '
' . $mapsee2 . '
'; +} - if ($user['align'] == 2.99) { - unset($objs); - $objs[$user['x']][$user['y']] = [2 => '
']; - $i = 0; - while ($i <= count($map_d)) { - $j = 0; - while ($j < count($map_d[$i])) { - if ($map_d[$i][$j] == 1) { - $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; - } else { - if (!isset($objs[$i][$j]['id'])) { - if ($j == 1 && $i > 0 && $i < count($map_d) - 2) { - $objs[$i][$j][2] = '
'; - } elseif ($j == count($map_d) - 2 && $i > 0 && $i < count($map_d) - 2) { - $objs[$i][$j][2] = '
'; - } - } else { - if ($objs[$i][$j]['use'] == 0) { - $objs[$i][$j][2] = '
'; - } else { - $objs[$i][$j][2] = ''; - } - } - $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; - } - $j++; - } - $mapsee2 .= '
'; - $i++; +if (isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0) { + $effed .= '
- Время перехода +3 секунды (Осталось : ' . timeOut($varos['trap1']['time'] - time()) . ')
'; +} +unset($varos); +\Battles\Template::header('labirint'); +?> + + - - - - - - - - - - + + +
- - - - - + + + + + + + + + + + + + + + + + + + + +
  - - -
-
-
- -
-
- -
-
- -
- 0) { - echo 'Кол-во смертей : ' . $dies . '/3
'; + function confirmSubmit(mes) { + const agree = confirm(mes); + return agree; + } + + + + + + + + + + + + - - -
+ + + + + + + + + + + + + + + + + + +
  + + +
+
+
+ +
+
+ +
+
+ +
+ 0) { + echo 'Кол-во смертей : ' . $dies . '/3
'; + } + ?> + Карта : #. Координаты : {X = | Y = } +
 
  + Задание: ' . $q1['name'] . '
• '; + if ($q1['type'] == 1) { + echo 'Собрать ресурсы: '; + $qobj = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "' . $q1['obj_id'] . '" LIMIT 1')); - - function progress_set(too) { - for (let i = 1; i <= too; i++) document.getElementById('progress' + i).style.backgroundColor = progressColor; + $qobj_f = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `inventory` WHERE `owner` = "' . $user['id'] . '" AND "name" = "' . $qobj['obj_id'] . '" LIMIT 1')); + if ($q2['val'] != $qobj[0]) { + mysql_query('UPDATE `qst_user` SET `val` = "' . $qobj[0] . '" WHERE `id` = "' . $q2['id'] . '" LIMIT 1'); + $q2['val'] = $qobj[0]; } + echo '' . $qobj['name'] . '  '; + } elseif ($q1['type'] == 2) { + echo 'Собрать трофеи: '; + $qobj = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "' . $q1['obj_id'] . '" LIMIT 1')); + $qobj_f = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `inventory` WHERE `owner` = "' . $user['id'] . '" AND "name" = "' . $qobj['obj_id'] . '" LIMIT 1')); - function progress_none() { - for (let i = 1; i <= 40; i++) document.getElementById('progress' + i).style.backgroundColor = progressColor; - } - - function progress_clear() { - for (let i = ; i <= progressEnd; i++) document.getElementById('progress' + i).style.backgroundColor = 'transparent'; - progressAt = ; - } - - function progress_update() { - document.getElementById('showbar').style.visibility = 'visible'; - progressAt++; - if (progressAt > progressEnd) { - clearTimeout(progressTimer); - return; - } else document.getElementById('progress' + progressAt).style.backgroundColor = progressColor; - progressTimer = setTimeout('progress_update()', progressInterval); + echo '' . $qobj['name'] . ''; + $qobj = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $q1['obj_id'] . '" LIMIT 1')); + if ($q2['val'] != $qobj[0]) { + mysql_query('UPDATE `qst_user` SET `val` = "' . $qobj[0] . '" WHERE `id` = "' . $q2['id'] . '" LIMIT 1'); + $q2['val'] = $qobj[0]; } + echo ' c монстров ' . $qobj['name'] . '  '; + } elseif ($q1['type'] == 3) { + echo 'Убить монстров: '; + $qobj = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $q1['obj_id'] . '" LIMIT 1')); + echo '' . $qobj['login'] . ' [' . $qobj['level'] . ']  '; + } + echo '[' . $q2['val'] . '/' . $q1['obj_val'] . ']
'; + echo '(Задание не засчитается, если Вы не найдёте выход.)'; + } + ?> +
 
 '; + } ?> + + ' . $mapsee2; + } + ?> +  
+
  + + + + - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + +
      +
+    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +    +
+
  
+ -
 
-
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Вверх
ВлевоОбновитьВправо
Вниз
-
-
- - - - - - - - -
-
- -
-
-
-
+ function progress_set(too) { + for (let i = 1; i <= too; i++) document.getElementById('progress' + i).style.backgroundColor = progressColor; + } -; i <= progressEnd; i++) document.getElementById('progress' + i).style.backgroundColor = 'transparent'; + progressAt = ; + } + + function progress_update() { + document.getElementById('showbar').style.visibility = 'visible'; + progressAt++; + if (progressAt > progressEnd) { + clearTimeout(progressTimer); + return; + } else document.getElementById('progress' + progressAt).style.backgroundColor = progressColor; + progressTimer = setTimeout('progress_update()', progressInterval); + } + + + progress_clear(); + progress_set(); + progress_update(); + +
 
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Вверх
ВлевоОбновитьВправо
Вниз
+
+
+ + + + + + + + +
+
+ +
+
+
+
\ No newline at end of file diff --git a/library.php b/library.php index faab5d3..307c681 100644 --- a/library.php +++ b/library.php @@ -1,19 +1,6 @@ room != 53) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} +require_once "functions.php"; \Battles\Template::header('Библиотека Просвещения'); ?> diff --git a/magic/bexit.php b/magic/bexit.php index b8e4846..577d4bc 100644 --- a/magic/bexit.php +++ b/magic/bexit.php @@ -5,59 +5,57 @@ if (empty($_SESSION['uid'])) { exit; } -$raid_t=mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' LIMIT 1;")); +$raid_t = mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' LIMIT 1;")); if ($user['battle'] == 0) { - echo "Это боевая магия..."; -} elseif ($user->room==600 || $user->room==601 || $user->room==602 || $us['room'] == 43 || $us['room'] == 45) { - echo "В этой локации выход из боя запрещен!"; -} elseif ($user['battle']==$raid_t['value']) { - echo "Вы защищаете весь город, а не только себя. Победа или смерть!"; + echo "Это боевая магия..."; +} elseif ($user->room == 600 || $user->room == 601 || $user->room == 602 || $us['room'] == 43 || $us['room'] == 45) { + echo "В этой локации выход из боя запрещен!"; +} elseif ($user['battle'] == $raid_t['value']) { + echo "Вы защищаете весь город, а не только себя. Победа или смерть!"; } else { + //unset($fbattle->battle[$user['id']]); + if ($us['sex'] == 1) { + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вышла из боя!
'); + } else { + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вышел из боя!
'); + } + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + //$ak = array_keys($battle[$user['id']]); + //$battle[$user['id']] = $battle[$ak[0]]; + unset($battle[$user['id']]); + foreach ($battle as $k => $v) { + unset($battle[$user['id']][$k]);// =array(0,0,time()); + unset($battle[$k][$user['id']]);// = array(0,0,time()); + } + $t1 = explode(";", $bd['t1']); + // проставляем кто-где + if (in_array($user['id'], $t1)) { + $t1 = explode(";", $bd['t1']); + unset ($t1[array_search($user['id'], $t1)]); + $tu = $t1; + $ttt = 1; - //unset($fbattle->battle[$user['id']]); - if($us['sex'] == 1) { - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вышла из боя!
'); - } else { - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вышел из боя!
'); - } - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - //$ak = array_keys($battle[$user['id']]); - //$battle[$user['id']] = $battle[$ak[0]]; - unset($battle[$user['id']]); - foreach($battle as $k => $v) { - unset( $battle[$user['id']][$k]);// =array(0,0,time()); - unset( $battle[$k][$user['id']]);// = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - // проставляем кто-где - if (in_array ($user['id'],$t1)) { - $t1 = explode(";",$bd['t1']); - unset ($t1[array_search($user['id'],$t1)]); - $tu=$t1; - $ttt=1; - - } else { - $t2 = explode(";",$bd['t2']); - unset ($t2[array_search($user['id'],$t2)]); - $tu=$t2; - $ttt=2; - } - mysql_query("UPDATE `inventory` SET `duration`=`duration`+1 WHERE `type` <>12 AND `dressed` = 1 AND `owner` = '{$user['id']}';"); - $magictime=time()+(10*60); - mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$user['id']."','Путы','$magictime',10);"); - addchp ('Внимание! Вы вышли из боя! ','{[]}'.Nick::id($user['id'])->short().'{[]}'); - mysql_query("UPDATE `battle` SET `teams` = '".serialize($battle)."', `t".$ttt."`='".implode(";",$tu)."' WHERE `id` = ".$user['battle']." ;"); - mysql_query('UPDATE users SET `battle` =0, `hp` = 0 WHERE `id` = '.$user['id'].';'); - header("Location:fbattle.php"); + } else { + $t2 = explode(";", $bd['t2']); + unset ($t2[array_search($user['id'], $t2)]); + $tu = $t2; + $ttt = 2; + } + mysql_query("UPDATE `inventory` SET `duration`=`duration`+1 WHERE `type` <>12 AND `dressed` = 1 AND `owner` = '{$user['id']}';"); + $magictime = time() + (10 * 60); + mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $user['id'] . "','Путы','$magictime',10);"); + addchp('Внимание! Вы вышли из боя! ', '{[]}' . Nick::id($user['id'])->short() . '{[]}'); + mysql_query("UPDATE `battle` SET `teams` = '" . serialize($battle) . "', `t" . $ttt . "`='" . implode(";", $tu) . "' WHERE `id` = " . $user['battle'] . " ;"); + mysql_query('UPDATE users SET `battle` =0, `hp` = 0 WHERE `id` = ' . $user['id'] . ';'); + header("Location:fbattle.php"); - $bet=1; - echo "Вы вышли из боя"; + $bet = 1; + echo "Вы вышли из боя"; } diff --git a/magic/check.php b/magic/check.php index 3b2f54c..14bd427 100644 --- a/magic/check.php +++ b/magic/check.php @@ -1,47 +1,39 @@ Персонаж \"$target\" состоит в клане, либо имеет склонность!"; - } - else { - $ok=0; - if ($user['align'] > '2' && $user['align'] < '3') { - $ok=1; - } - elseif ($user['align'] > '1.6' && $user['align'] < '2') { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Проверка Паладинов','".$magictime."','20');")) { - $messtel="Помечено, что персонаж чист перед законом"; - $mess="".$user['login']." сделал пометку что ".$_POST['target']." чист перед законом"; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - - /*Тут была привязка к телеграфу*/ - - echo "Успешно поставлена проверка персонажу \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете поставить проверку!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$target = $_POST['target']; +$tar = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$magictime = time() + 259200; +if ($tar['id']) { + if ($tar['klan'] || $tar['align']) { + echo "Персонаж \"$target\" состоит в клане, либо имеет склонность!"; + } else { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif ($user['align'] > '1.6' && $user['align'] < '2') { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Проверка Паладинов','" . $magictime . "','20');")) { + $messtel = "Помечено, что персонаж чист перед законом"; + $mess = "" . $user['login'] . " сделал пометку что " . $_POST['target'] . " чист перед законом"; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + + /*Тут была привязка к телеграфу*/ + + echo "Успешно поставлена проверка персонажу \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете поставить проверку!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/clones.php b/magic/clones.php index 9e12eda..e9e73f9 100644 --- a/magic/clones.php +++ b/magic/clones.php @@ -1,38 +1,43 @@ $v) { - $battle[$k][$bot] = array(0, 0, time()); - } + if (rand(1, 100) < $int) { + if ($user['invis'] == 1) { + $user['login'] = 'невидимка'; + } + $nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (клон%';")); + mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) values ('" . $user['login'] . " (клон " . ($nb[0] + 1) . ")', '" . $user['id'] . "', '" . $user['battle'] . "', '" . $user['hp'] . "')"); + $bot = mysql_insert_id(); - $t1 = explode(";", $bd['t1']); - if(in_array($user['id'], $t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - $lo = Nick::id($user['id'])->short(); - $los = Nick::id($bot)->short(); - addlog($user['battle'], ''.date("H:i").' '.$lo.' породил своего клона '.$los.'.
'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'` = CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = "'.$user['battle'].'" LIMIT 1'); - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1"); - echo "Клон создан"; - $bet = 1; - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet = 1; - } + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + $t1 = explode(";", $bd['t1']); + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + $lo = Nick::id($user['id'])->short(); + $los = Nick::id($bot)->short(); + addlog($user['battle'], '' . date("H:i") . ' ' . $lo . ' породил своего клона ' . $los . '.
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = "' . $user['battle'] . '" LIMIT 1'); + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1"); + echo "Клон создан"; + $bet = 1; + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/ddark.php b/magic/ddark.php index 79516c9..4e5b8af 100644 --- a/magic/ddark.php +++ b/magic/ddark.php @@ -1,7 +1,4 @@ '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action Темную склонность "$target""; - $messch="$angel "{$user['login']}" $action Темную склонность "$target""; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - echo "Успешно изменена склонность персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете менять склонность этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$target = mysql_real_escape_string($_POST['target']); +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$target}' LIMIT 1;")); +if ($tar['id']) { + { + $ok = 0; + if ($user['align'] == '2.99' && $tar['align'] == 0) { + $ok = 1; + } else echo("Персонаж " . $target . " уже имеет склонность!"); + + if ($ok == 1) { + if (mysql_query("UPDATE `users` set `align`=3 where `id` ='{$tar['id']}' LIMIT 1;")) { + $ldtarget = $target; + if ($user['sex'] == 1) { + $action = "присвоил"; + } else { + $action = "присвоила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action Темную склонность "$target""; + $messch = "$angel "{$user['login']}" $action Темную склонность "$target""; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно изменена склонность персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете менять склонность этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/death_off.php b/magic/death_off.php index 4349497..d2fca28 100644 --- a/magic/death_off.php +++ b/magic/death_off.php @@ -1,55 +1,48 @@ '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] == '1.99' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] == '1.99' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("UPDATE `users` SET `palcom` = '',`block`='0' WHERE `id` = {$tar['id']} LIMIT 1;")) { - if ($user['sex'] == 1) {$action="снял";} - else {$action="сняла";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие смерти с "$target".."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $mess"); - echo "Успешно снято заклятие смерти с персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете снять заклятие смерти с этого персонажа!"; - } - } - else { - echo "На персонаже \"$target\" нет заклятия смерти "; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`block` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$target = $_POST['target']; +if ($tar['id']) { + if ($tar['block'] == 1) { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] == '1.99' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] == '1.99' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("UPDATE `users` SET `palcom` = '',`block`='0' WHERE `id` = {$tar['id']} LIMIT 1;")) { + if ($user['sex'] == 1) { + $action = "снял"; + } else { + $action = "сняла"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие смерти с "$target".."; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $mess"); + echo "Успешно снято заклятие смерти с персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете снять заклятие смерти с этого персонажа!"; + } + } else { + echo "На персонаже \"$target\" нет заклятия смерти "; + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/dlight.php b/magic/dlight.php index d38bb1e..93477c5 100644 --- a/magic/dlight.php +++ b/magic/dlight.php @@ -1,6 +1,6 @@ '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action Светлую склонность "$target""; - $messch="$angel "{$user['login']}" $action Светлую склонность "$target""; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - echo "Успешно изменена склонность персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете менять склонность этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$target = mysql_real_escape_string($_POST['target']); +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$target}' LIMIT 1;")); +if ($tar['id']) { + { + + if ($tar['align'] == 0 && $user['align'] == 2.99) { + $ok = 1; + } else { + $ok = 0; + } + + if ($ok == 1) { + if (mysql_query("UPDATE `users` SET `align` = 6 WHERE `id` ='{$tar['id']}' LIMIT 1")) { + $ldtarget = $target; + if ($user['sex'] == 1) { + $action = "присвоил"; + } else { + $action = "присвоила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action Светлую склонность "$target""; + $messch = "$angel "{$user['login']}" $action Светлую склонность "$target""; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно изменена склонность персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете менять склонность этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/dneit.php b/magic/dneit.php index fda9900..a032b57 100644 --- a/magic/dneit.php +++ b/magic/dneit.php @@ -1,6 +1,6 @@ '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action Нейтральную склонность "$target""; - $messch="$angel "{$user['login']}" $action Нейтральную склонность "$target""; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - echo "Успешно изменена склонность персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете менять склонность этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$target = mysql_real_escape_string($_POST['target']); +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$target}' LIMIT 1;")); +if ($tar['id']) { + { + $ok = 0; + if ($user['align'] == '2.99' && $tar['align'] == 0) { + $ok = 1; + } else echo("Персонаж " . $target . " уже имеет склонность!"); + + if ($ok == 1) { + if (mysql_query("UPDATE `users` set `align`=2 where `id` ='{$tar['id']}' LIMIT 1")) { + $ldtarget = $target; + if ($user['sex'] == 1) { + $action = "присвоил"; + } else { + $action = "присвоила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action Нейтральную склонность "$target""; + $messch = "$angel "{$user['login']}" $action Нейтральную склонность "$target""; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно изменена склонность персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете менять склонность этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/down.php b/magic/down.php index 25d93bc..edcc5e3 100644 --- a/magic/down.php +++ b/magic/down.php @@ -1,38 +1,37 @@ 0) { - echo "Не в бою..."; -} elseif (rand(1,100)!=1) { - undressall($user['id']); - $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} elseif (rand(1, 100) != 1) { + undressall($user['id']); + $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - if($user['sila']>3){ - mysql_query("UPDATE `users` SET `stats`=`stats`+1,`sila` = `sila`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - if($user['inta']>3){ - mysql_query("UPDATE `users` SET `stats`=`stats`+1,`inta` = `inta`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - if($user['lovk']>3){ - mysql_query("UPDATE `users` SET `stats`=`stats`+1,`lovk` = `lovk`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - if($user['vinos']>3){ - if($user['hp']<= ($user['maxhp']-6)) { - mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - else { - mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6', `hp`=`hp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - } - if($user['intel'] >0) { - mysql_query("UPDATE `users` SET `stats`=`stats`+1,`intel` = `intel`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - if($user['mudra'] >0) { - mysql_query("UPDATE `users` SET `stats`=`stats`+1,`mudra` = `mudra`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); - } - echo "Удачно использована магия \"Шаг назад\""; - $bet=1; + if ($user['sila'] > 3) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1,`sila` = `sila`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + if ($user['inta'] > 3) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1,`inta` = `inta`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + if ($user['lovk'] > 3) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1,`lovk` = `lovk`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + if ($user['vinos'] > 3) { + if ($user['hp'] <= ($user['maxhp'] - 6)) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } else { + mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6', `hp`=`hp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + } + if ($user['intel'] > 0) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1,`intel` = `intel`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + if ($user['mudra'] > 0) { + mysql_query("UPDATE `users` SET `stats`=`stats`+1,`mudra` = `mudra`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"); + } + echo "Удачно использована магия \"Шаг назад\""; + $bet = 1; } diff --git a/magic/dpal.php b/magic/dpal.php index 4e16320..e526482 100644 --- a/magic/dpal.php +++ b/magic/dpal.php @@ -1,54 +1,49 @@ '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action "$target" в стройные ряды Паладинов"; - $messch="$angel "{$user['login']}" $action "$target" в стройные ряды Паладинов"; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - echo "Успешно принят рекрут \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете менять склонность этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$target = $_POST['target']; +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +if ($tar['id']) { + { + $ok = 0; + if ($tar['align'] == '0') { + $ok = 1; + } else echo("Персонаж " . $target . " уже имеет склонность!"); + + if ($ok == 1) { + if (mysql_query("UPDATE users set align='1.1' where id='{$tar['id']}';")) { + $ldtarget = $target; + if ($user['sex'] == 1) { + $action = "принял"; + } else { + $action = "приняла"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action "$target" в стройные ряды Паладинов"; + $messch = "$angel "{$user['login']}" $action "$target" в стройные ряды Паладинов"; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно принят рекрут \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете менять склонность этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/elem_ally_air.php b/magic/elem_ally_air.php index 7dd65f5..09fda8d 100644 --- a/magic/elem_ally_air.php +++ b/magic/elem_ally_air.php @@ -1,52 +1,53 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Воздуха - союзник%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('".$user['login']." (Элементаль Воздуха - союзник ".($nb[0]+1).")','1243','".$user['battle']."','2000','".$user['id']."');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - // проставляем кто-где - if (in_array ($user['id'],$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Воздуха - союзник%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('" . $user['login'] . " (Элементаль Воздуха - союзник " . ($nb[0] + 1) . ")','1243','" . $user['battle'] . "','2000','" . $user['id'] . "');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + // проставляем кто-где + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/elem_ally_earth.php b/magic/elem_ally_earth.php index 5516be3..6be76f8 100644 --- a/magic/elem_ally_earth.php +++ b/magic/elem_ally_earth.php @@ -1,52 +1,53 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Земли - союзник%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('".$user['login']." (Элементаль Земли - союзник ".($nb[0]+1).")','1244','".$user['battle']."','2500','".$user['id']."');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - // проставляем кто-где - if (in_array ($user['id'],$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Земли - союзник%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('" . $user['login'] . " (Элементаль Земли - союзник " . ($nb[0] + 1) . ")','1244','" . $user['battle'] . "','2500','" . $user['id'] . "');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + // проставляем кто-где + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/elem_ally_fire.php b/magic/elem_ally_fire.php index 1566573..3ffad5c 100644 --- a/magic/elem_ally_fire.php +++ b/magic/elem_ally_fire.php @@ -1,52 +1,53 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Огня - союзник%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('".$user['login']." (Элементаль Огня - союзник ".($nb[0]+1).")','1241','".$user['battle']."','1000','".$user['id']."');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - // проставляем кто-где - if (in_array ($user['id'],$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Огня - союзник%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('" . $user['login'] . " (Элементаль Огня - союзник " . ($nb[0] + 1) . ")','1241','" . $user['battle'] . "','1000','" . $user['id'] . "');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + // проставляем кто-где + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/elem_ally_water.php b/magic/elem_ally_water.php index e39bade..ed3ef24 100644 --- a/magic/elem_ally_water.php +++ b/magic/elem_ally_water.php @@ -1,52 +1,53 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Воды - союзник%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('".$user['login']." (Элементаль Воды - союзник ".($nb[0]+1).")','1242','".$user['battle']."','1500','".$user['id']."');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - // проставляем кто-где - if (in_array ($user['id'],$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Воды - союзник%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`,`owner`) values ('" . $user['login'] . " (Элементаль Воды - союзник " . ($nb[0] + 1) . ")','1242','" . $user['battle'] . "','1500','" . $user['id'] . "');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + // проставляем кто-где + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/elem_foe_fire.php b/magic/elem_foe_fire.php index ba98348..8476c16 100644 --- a/magic/elem_foe_fire.php +++ b/magic/elem_foe_fire.php @@ -1,57 +1,58 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Огня - враг%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$user['login']." (Элементаль Огня - враг ".($nb[0]+1).")','1241','".$user['battle']."','1000');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - - $t1 = explode(";",$bd['t1']); - if(in_array ($user['id'],$t1)) $bot_marker=$t2[0]; - else $bot_marker=$t1[0]; - - $battle[$bot] = $battle[$bot_marker]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - - // проставляем кто-где - if (in_array ($bot_marker,$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Огня - враг%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $user['login'] . " (Элементаль Огня - враг " . ($nb[0] + 1) . ")','1241','" . $user['battle'] . "','1000');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + + $t1 = explode(";", $bd['t1']); + if (in_array($user['id'], $t1)) $bot_marker = $t2[0]; + else $bot_marker = $t1[0]; + + $battle[$bot] = $battle[$bot_marker]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + // проставляем кто-где + if (in_array($bot_marker, $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/elem_foe_water.php b/magic/elem_foe_water.php index c44fec9..316bf88 100644 --- a/magic/elem_foe_water.php +++ b/magic/elem_foe_water.php @@ -1,57 +1,58 @@ = 8) { - $int=$magic['chanse'] + ($user['intel'] - 8)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '16' ;")); + if ($user['intel'] >= 8) { + $int = $magic['chanse'] + ($user['intel'] - 8) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (Элементаль Воды - враг%';")); - mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$user['login']." (Элементаль Воды - враг ".($nb[0]+1).")','1242','".$user['battle']."','1500');"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - - $t1 = explode(";",$bd['t1']); - if(in_array ($user['id'],$t1)) $bot_marker=$t2[0]; - else $bot_marker=$t1[0]; - - $battle[$bot] = $battle[$bot_marker]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - - // проставляем кто-где - if (in_array ($bot_marker,$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вызвал '.Nick::id($bot)->short().'
'); - - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - - $bet=1; - echo "Элементаль вызван"; - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (Элементаль Воды - враг%';")); + mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $user['login'] . " (Элементаль Воды - враг " . ($nb[0] + 1) . ")','1242','" . $user['battle'] . "','1500');"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + + $t1 = explode(";", $bd['t1']); + if (in_array($user['id'], $t1)) $bot_marker = $t2[0]; + else $bot_marker = $t1[0]; + + $battle[$bot] = $battle[$bot_marker]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + // проставляем кто-где + if (in_array($bot_marker, $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' породил своего клона '.nick::id($bot)->short().'
\') WHERE `id` = '.$user['battle'].';'); + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вызвал ' . Nick::id($bot)->short() . '
'); + + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + + $bet = 1; + echo "Элементаль вызван"; + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/haos.php b/magic/haos.php index 7d1fd46..d515b2d 100644 --- a/magic/haos.php +++ b/magic/haos.php @@ -1,7 +1,4 @@ '2' && $user['align'] < '3') {$ok=1;} - elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("UPDATE `effects` SET `time`='$magictime' WHERE `id` = '{$tar['id']}' LIMIT 1;")) { - $ldtarget=$target; - $ldblock=1; - - switch($_POST['timer']) { - case "2": $magictime="два дня."; break; - case "3": $magictime="три дня."; break; - case "7": $magictime="неделя."; break; - case "14": $magictime="две недели."; break; - case "30": $magictime="месяц."; break; - case "60": $magictime="два месяца."; break; - case "365": $magictime="бессрочно."; break; - } - if ($user['sex'] == 1) {$action="отправил";} - else {$action="отправила";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="Продление хаоса. $angel "{$user['login']}" $action в хаос "$target" сроком $magictime"; - $messch="Продление хаоса. $angel "{$user['login']}" $action в хаос "$target" сроком $magictime."; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $messch"); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Успешно наложено заклятие хаоса на персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете наложить заклятие хаоса на этого персонажа!"; - } - } - else { - echo "Вы не можете сократить срок наказания!"; - } - } - else { - $ok=0; - if ($user['align'] > '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Заклятие хаоса','$magictime',4);")) { - mysql_query("UPDATE `users` SET `align`='4', klan='', status='' WHERE `id` = {$tar['id']} LIMIT 1;"); - mysql_query("DELETE FROM `effects` where `type`='20' AND 'owner'= '{$tar['id']}' LIMIT 1;"); - $ldtarget=$target; - $ldblock=1; - - switch($_POST['timer']) { - case "2": $magictime="два дня."; break; - case "3": $magictime="три дня."; break; - case "7": $magictime="неделя."; break; - case "14": $magictime="две недели."; break; - case "30": $magictime="месяц."; break; - case "60": $magictime="два месяца."; break; - case "365": $magictime="бессрочно."; break; - } - if ($user['sex'] == 1) {$action="отправил";} - else {$action="отправила";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action в хаос "$target" сроком $magictime"; - $messch="$angel "{$user['login']}" $action в хаос "$target" сроком $magictime."; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $messch"); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Успешно наложено заклятие хаоса на персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете наложить заклятие хаоса на этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$magictime = time() + ($_POST['timer'] * 60 * 1440); +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$target = $_POST['target']; +if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1;")); + + if ($effect['time']) { + $time_still = $effect['time'] - time(); + $time_new = $magictime - time(); + if ($time_still < $time_new) { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("UPDATE `effects` SET `time`='$magictime' WHERE `id` = '{$tar['id']}' LIMIT 1;")) { + $ldtarget = $target; + $ldblock = 1; + + switch ($_POST['timer']) { + case "2": + $magictime = "два дня."; + break; + case "3": + $magictime = "три дня."; + break; + case "7": + $magictime = "неделя."; + break; + case "14": + $magictime = "две недели."; + break; + case "30": + $magictime = "месяц."; + break; + case "60": + $magictime = "два месяца."; + break; + case "365": + $magictime = "бессрочно."; + break; + } + if ($user['sex'] == 1) { + $action = "отправил"; + } else { + $action = "отправила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "Продление хаоса. $angel "{$user['login']}" $action в хаос "$target" сроком $magictime"; + $messch = "Продление хаоса. $angel "{$user['login']}" $action в хаос "$target" сроком $magictime."; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $messch"); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Успешно наложено заклятие хаоса на персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете наложить заклятие хаоса на этого персонажа!"; + } + } else { + echo "Вы не можете сократить срок наказания!"; + } + } else { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Заклятие хаоса','$magictime',4);")) { + mysql_query("UPDATE `users` SET `align`='4', klan='', status='' WHERE `id` = {$tar['id']} LIMIT 1;"); + mysql_query("DELETE FROM `effects` where `type`='20' AND 'owner'= '{$tar['id']}' LIMIT 1;"); + $ldtarget = $target; + $ldblock = 1; + + switch ($_POST['timer']) { + case "2": + $magictime = "два дня."; + break; + case "3": + $magictime = "три дня."; + break; + case "7": + $magictime = "неделя."; + break; + case "14": + $magictime = "две недели."; + break; + case "30": + $magictime = "месяц."; + break; + case "60": + $magictime = "два месяца."; + break; + case "365": + $magictime = "бессрочно."; + break; + } + if ($user['sex'] == 1) { + $action = "отправил"; + } else { + $action = "отправила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action в хаос "$target" сроком $magictime"; + $messch = "$angel "{$user['login']}" $action в хаос "$target" сроком $magictime."; + + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $messch"); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Успешно наложено заклятие хаоса на персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете наложить заклятие хаоса на этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/haos_off.php b/magic/haos_off.php index 4385c5c..5f50513 100644 --- a/magic/haos_off.php +++ b/magic/haos_off.php @@ -1,51 +1,45 @@ '2' && $user['align'] < '3') || ($user['align'] == '1.99')|| ($user['align'] == '1.98')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("DELETE FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1 ;")) { - mysql_query("UPDATE `users` SET `palcom` = '',`align`='0' WHERE `id` = {$tar['id']} LIMIT 1;"); - if ($user['sex'] == 1) {$action="выпустил";} - else {$action="выпустила";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action из хаоса "$target".."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $mess"); - echo "Успешно снято заклятие хаоса с персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$target = $_POST['target']; +if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1;")); + if ($effect['time']) { + $ok = 0; + if (($user['align'] > '2' && $user['align'] < '3') || ($user['align'] == '1.99') || ($user['align'] == '1.98')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("DELETE FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1 ;")) { + mysql_query("UPDATE `users` SET `palcom` = '',`align`='0' WHERE `id` = {$tar['id']} LIMIT 1;"); + if ($user['sex'] == 1) { + $action = "выпустил"; + } else { + $action = "выпустила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action из хаоса "$target".."; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $mess"); + echo "Успешно снято заклятие хаоса с персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете снять заклятие хаоса с этого персонажа!"; + } + } else { + echo "На персонаже \"$target\" нет заклятия хаоса "; } - else { - echo "Вы не можете снять заклятие хаоса с этого персонажа!"; - } - } - else { - echo "На персонаже \"$target\" нет заклятия хаоса "; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/ident.php b/magic/ident.php index 7bf74a9..e4bd1dd 100644 --- a/magic/ident.php +++ b/magic/ident.php @@ -1,34 +1,34 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else { - $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '3' ;")); - if ($user['intel'] >= 2) { - $int=$magic['chanse'] + ($user['intel'] - 2)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '3' ;")); + if ($user['intel'] >= 2) { + $int = $magic['chanse'] + ($user['intel'] - 2) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = '{$target}' AND `needident` = 1 LIMIT 1;")); - if (mysql_query("UPDATE `inventory` SET `needident` = 0 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$target}\" удачно идентифицирован "; - $bet=1; - } else { - echo "Неправильное имя предмета"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (rand(1, 100) < $int) { + + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = '{$target}' AND `needident` = 1 LIMIT 1;")); + if (mysql_query("UPDATE `inventory` SET `needident` = 0 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$target}\" удачно идентифицирован "; + $bet = 1; + } else { + echo "Неправильное имя предмета"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/incmagic.php b/magic/incmagic.php index b94ac1a..f84bc75 100644 --- a/magic/incmagic.php +++ b/magic/incmagic.php @@ -5,75 +5,61 @@ if (empty($_SESSION['uid'])) { } //запрещенная для встройки магия -$forbidden=array("1","2","3","7","6","8","18","19","20","21","22","43","46","47","48","55","56","58","74","75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", - "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", - "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", - "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "135", "136", "137", "138","139",); +$forbidden = ["1", "2", "3", "7", "6", "8", "18", "19", "20", "21", "22", "43", "46", "47", "48", "55", "56", "58", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", + "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", + "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", + "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "135", "136", "137", "138", "139",]; // magic // встраивание магии if ($user['battle'] > 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 17) { - $int=80 + $user['intel'] - 17; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) <= $int OR !$_SESSION['scroll']) { - if(!$_SESSION['scroll']) { - $_SESSION['scroll'] = $_POST['target']; - ?>У вас нет такого свитка!"; - }elseif(!$dress OR $dress['type'] >= 12){ - echo "У вас нет такого предмета!"; - }else { - $incmagic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$svitok['magic']}' LIMIT 1;")); - if((!$incmagic['img'])||in_array($svitok['magic'],$forbidden)) { - echo "Этот свиток нельзя встраивать в предметы!"; - } else { - // встраиваем - destructitem($svitok['id']); - echo "Свиток \"".$svitok['name']."\" удачно встроен в \"".$dress['name']."\""; - mysql_query("UPDATE `inventory` SET - ".($dress['nintel']<$svitok['nintel']?"`nintel`='".$svitok['nintel']."',":"")." - ".($dress['nlevel']<$svitok['nlevel']?"`nlevel`='".$svitok['nlevel']."',":"")." - ".($dress['nmudra']<$svitok['nmudra']?"`nmudra`='".$svitok['nmudra']."',":"")." - ".($dress['ngray']<$svitok['ngray']?"`ngray`='".$svitok['ngray']."',":"")." - ".($dress['ndark']<$svitok['ndark']?"`ndark`='".$svitok['ndark']."',":"")." - ".($dress['nlight']<$svitok['nlight']?"`nlevel`='".$svitok['nlight']."',":"")." - `massa`=`massa`+1,`cost`=`cost`+'".$svitok['cost']."', `includemagic` = '".$svitok['magic']."', `includemagicdex` = '".$svitok['maxdur']."', `includemagicmax` = '".$svitok['maxdur']."', `includemagicname` = '".$svitok['name']."', `includemagicuses` = '100+".$user['intel']."', `includemagiccost` = '".($svitok['cost']/2)."' WHERE `id` = '{$dress['id']}' LIMIT 1;"); - $bet=1; - } - } - } - - - //$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` LIKE '%Топор%' AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - //$svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +1' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - /*if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ntopor` = `ntopor`+1, `nsila` = `nsila`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - }*/ - } else - { - echo "Cвиток рассыпался в ваших руках..."; - $bet=1; - $_SESSION['scroll'] = null; - } -} -?> \ No newline at end of file + echo "Не в бою..."; +} else { + if ($user['intel'] >= 17) { + $int = 80 + $user['intel'] - 17; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) <= $int or !$_SESSION['scroll']) { + if (!$_SESSION['scroll']) { + $_SESSION['scroll'] = $_POST['target']; + ?> + У вас нет такого свитка!"; + } elseif (!$dress or $dress['type'] >= 12) { + echo "У вас нет такого предмета!"; + } else { + $incmagic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$svitok['magic']}' LIMIT 1;")); + if ((!$incmagic['img']) || in_array($svitok['magic'], $forbidden)) { + echo "Этот свиток нельзя встраивать в предметы!"; + } else { + // встраиваем + destructitem($svitok['id']); + echo "Свиток \"" . $svitok['name'] . "\" удачно встроен в \"" . $dress['name'] . "\""; + mysql_query("UPDATE `inventory` SET + " . ($dress['nintel'] < $svitok['nintel'] ? "`nintel`='" . $svitok['nintel'] . "'," : "") . " + " . ($dress['nlevel'] < $svitok['nlevel'] ? "`nlevel`='" . $svitok['nlevel'] . "'," : "") . " + " . ($dress['nmudra'] < $svitok['nmudra'] ? "`nmudra`='" . $svitok['nmudra'] . "'," : "") . " + " . ($dress['ngray'] < $svitok['ngray'] ? "`ngray`='" . $svitok['ngray'] . "'," : "") . " + " . ($dress['ndark'] < $svitok['ndark'] ? "`ndark`='" . $svitok['ndark'] . "'," : "") . " + " . ($dress['nlight'] < $svitok['nlight'] ? "`nlevel`='" . $svitok['nlight'] . "'," : "") . " + `massa`=`massa`+1,`cost`=`cost`+'" . $svitok['cost'] . "', `includemagic` = '" . $svitok['magic'] . "', `includemagicdex` = '" . $svitok['maxdur'] . "', `includemagicmax` = '" . $svitok['maxdur'] . "', `includemagicname` = '" . $svitok['name'] . "', `includemagicuses` = '100+" . $user['intel'] . "', `includemagiccost` = '" . ($svitok['cost'] / 2) . "' WHERE `id` = '{$dress['id']}' LIMIT 1;"); + $bet = 1; + } + } + } + } else { + echo "Cвиток рассыпался в ваших руках..."; + $bet = 1; + $_SESSION['scroll'] = null; + } +} \ No newline at end of file diff --git a/magic/ldadd.php b/magic/ldadd.php index 79467e2..76bf86f 100644 --- a/magic/ldadd.php +++ b/magic/ldadd.php @@ -1,53 +1,50 @@ Успешно изменена причина отправки в хаос/блокировки персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - $mess="Сообщение от ".$user['login'].": ".$_POST['ldtext']; - if (mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');")) { - $mess="Добавлена запись в дело "{$_POST['ldnick']}": $mess"; - mysql_query("INSERT INTO `paldelo`(`author`,`text`,`date`) VALUES ('".$_SESSION['uid']."','$mess','".time()."');"); - echo "Успешно добавлена запись в дело игрока \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - } - else { - echo "Вы не можете добавить запись в дело этого персонажа!"; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } + if ($ok == 1) { + if ($_POST['red']) { + if (!$_POST['ldtext']) { + $pal = ''; + } else { + $date_today = date("m.d.y H:i"); + $pal = $date_today . " " . $_POST['ldtext']; + } + + if (mysql_query("UPDATE `users` SET `palcom` = '$pal' WHERE `id` = {$tar['id']} LIMIT 1;")) { + $mess = "Сообщение от " . $user['login'] . ": " . $_POST['ldtext']; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + $mess = "Изменена причина отправки в хаос/блокировки "{$_POST['ldnick']}": $mess"; + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно изменена причина отправки в хаос/блокировки персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + $mess = "Сообщение от " . $user['login'] . ": " . $_POST['ldtext']; + if (mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');")) { + $mess = "Добавлена запись в дело "{$_POST['ldnick']}": $mess"; + mysql_query("INSERT INTO `paldelo`(`author`,`text`,`date`) VALUES ('" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + echo "Успешно добавлена запись в дело игрока \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } + } else { + echo "Вы не можете добавить запись в дело этого персонажа!"; + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/marry.php b/magic/marry.php index 1a0eb7a..248c78d 100644 --- a/magic/marry.php +++ b/magic/marry.php @@ -1,5 +1,8 @@ На персонаже \"$target\" уже есть заклятие обезличивания "; - } - else { - $ok=0; - if ($user['align'] > '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Заклятие обезличивания','$magictime',5);")) { - $ldtarget=$target; - switch($_POST['timer']) { - case "2": $magictime="два дня."; break; - case "3": $magictime="три дня."; break; - case "14": $magictime="две недели."; break; - case "30": $magictime="месяц."; break; - case "60": $magictime="два месяца."; break; - case "365": $magictime="бессрочно."; break; - } - if ($user['sex'] == 1) {$action="наложил";} - else {$action="наложила";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие обезличивания на "$target" сроком $magictime"; - $messch="$angel "{$user['login']}" $action заклятие обезличивания на "$target" сроком $magictime."; + $magictime = time() + ($_POST['timer'] * 60 * 1440); + $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); + $target = $_POST['target']; + if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '5' LIMIT 1;")); + if ($effect['time']) { + echo "На персонаже \"$target\" уже есть заклятие обезличивания "; + } else { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Заклятие обезличивания','$magictime',5);")) { + $ldtarget = $target; + switch ($_POST['timer']) { + case "2": + $magictime = "два дня."; + break; + case "3": + $magictime = "три дня."; + break; + case "14": + $magictime = "две недели."; + break; + case "30": + $magictime = "месяц."; + break; + case "60": + $magictime = "два месяца."; + break; + case "365": + $magictime = "бессрочно."; + break; + } + if ($user['sex'] == 1) { + $action = "наложил"; + } else { + $action = "наложила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие обезличивания на "$target" сроком $magictime"; + $messch = "$angel "{$user['login']}" $action заклятие обезличивания на "$target" сроком $magictime."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $messch"); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Успешно наложено заклятие обезличивания на персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете наложить заклятие обезличивания на этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $messch"); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Успешно наложено заклятие обезличивания на персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете наложить заклятие обезличивания на этого персонажа!"; + } + } + } else { + echo "Персонаж \"$target\" не существует!"; + } diff --git a/magic/obezl_off.php b/magic/obezl_off.php index 43da389..bc9f822 100644 --- a/magic/obezl_off.php +++ b/magic/obezl_off.php @@ -1,56 +1,48 @@ '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '5' LIMIT 1 ;")) { - if ($user['sex'] == 1) {$action="снял";} - else {$action="сняла";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие обезличивания с "$target"."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $mess"); - echo "Успешно снято заклятие обезличивания с персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете снять заклятие обезличивания с этого персонажа!"; - } - } - else { - echo "На персонаже \"$target\" нет заклятия обезличивания "; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$target = $_POST['target']; +if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '5' LIMIT 1;")); + if ($effect['time']) { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1.6' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '5' LIMIT 1 ;")) { + if ($user['sex'] == 1) { + $action = "снял"; + } else { + $action = "сняла"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие обезличивания с "$target"."; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $mess"); + echo "Успешно снято заклятие обезличивания с персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете снять заклятие обезличивания с этого персонажа!"; + } + } else { + echo "На персонаже \"$target\" нет заклятия обезличивания "; + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/rom.php b/magic/rom.php index 6f4ed69..0f5b995 100644 --- a/magic/rom.php +++ b/magic/rom.php @@ -1,24 +1,34 @@ РЎ Вами что то произошло..."; - $bet=1; - } + mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`,`sila`,`lovk`,`inta`,`vinos`) values ('" . $_SESSION['uid'] . "','Опьянение'," . (time() + 3600) . ",51,'" . $s . "','" . $l . "','" . $i . "','0');"); + mysql_query("UPDATE `users` SET `sila`=`sila`+'" . $s . "', `lovk`=`lovk`+'" . $l . "', `inta`=`inta`+'" . $i . "' WHERE `id` = '" . $_SESSION['uid'] . "' LIMIT 1;"); + + + echo "РЎ Вами что то произошло..."; + $bet = 1; +} diff --git a/magic/scaner.php b/magic/scaner.php index c1011b8..b55085f 100644 --- a/magic/scaner.php +++ b/magic/scaner.php @@ -1,26 +1,25 @@ 0) { - echo "Не в бою..."; -} elseif (rand(1,100)!=1) { - //undressall($user['id']); - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} elseif (rand(1, 100) != 1) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - global $rooms; - $rs = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1 ORDER by `room` DESC;"); - while($r = mysql_fetch_array($rs)) { - if($rt != $r['room']) { - $rt = $r['room']; - $rr .= "\n".$rooms[$r['room']].": "; - } - $rr .= $r['login'].", "; - } - echo "Отчет о сканировании у вас в рюкзаке"; - - mysql_query("INSERT INTO `inventory` (`bs`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`letter`,`maxdur`,`isrep`)VALUES('1','{$_SESSION['uid']}','Отчет о сканировании','200',1,0,'paper100.gif','{$rr}',1,0) ;"); - - $bet=1; + global $rooms; + $rs = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1 ORDER by `room` DESC;"); + while ($r = mysql_fetch_array($rs)) { + if ($rt != $r['room']) { + $rt = $r['room']; + $rr .= "\n" . $rooms[$r['room']] . ": "; + } + $rr .= $r['login'] . ", "; + } + echo "Отчет о сканировании у вас в рюкзаке"; + + mysql_query("INSERT INTO `inventory` (`bs`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`letter`,`maxdur`,`isrep`)VALUES('1','{$_SESSION['uid']}','Отчет о сканировании','200',1,0,'paper100.gif','{$rr}',1,0) ;"); + + $bet = 1; } diff --git a/magic/sharp_d1.php b/magic/sharp_d1.php index ecd0ae2..2c57c46 100644 --- a/magic/sharp_d1.php +++ b/magic/sharp_d1.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=51 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 51 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +1' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ndubina` = `ndubina`+1, `nlovk` = `nlovk`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +1' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ndubina` = `ndubina`+1, `nlovk` = `nlovk`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_d11.php b/magic/sharp_d11.php index 949464a..a179b8f 100644 --- a/magic/sharp_d11.php +++ b/magic/sharp_d11.php @@ -1,39 +1,36 @@ 0) { - echo "РќРµ РІ Р±РѕСЋ..."; -} else { - if ($user['intel'] >= 1) { - $int=91 + $user['intel'] - 1; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "РќРµ РІ Р±РѕСЋ..."; +} else { + if ($user['intel'] >= 1) { + $int = 91 + $user['intel'] - 1; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%РґСѓР±РёРЅРєР°%' OR `name` LIKE '%РґСѓР±РёРЅР°%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° РґСѓР±РёРЅС‹ +11' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `ndubina` = `ndubina`+11, `nlovk` = `nlovk`+11 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное РёРјСЏ предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%РґСѓР±РёРЅРєР°%' OR `name` LIKE '%РґСѓР±РёРЅР°%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° РґСѓР±РёРЅС‹ +11' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `ndubina` = `ndubina`+11, `nlovk` = `nlovk`+11 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное РёРјСЏ предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_d2.php b/magic/sharp_d2.php index b357123..d2d8d4e 100644 --- a/magic/sharp_d2.php +++ b/magic/sharp_d2.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=61 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 61 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +2' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `ndubina` = `ndubina`+2, `nlovk` = `nlovk`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +2' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `ndubina` = `ndubina`+2, `nlovk` = `nlovk`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_d3.php b/magic/sharp_d3.php index 0501fb4..d54809d 100644 --- a/magic/sharp_d3.php +++ b/magic/sharp_d3.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=71 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 71 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +3' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `ndubina` = `ndubina`+3, `nlovk` = `nlovk`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +3' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `ndubina` = `ndubina`+3, `nlovk` = `nlovk`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_d4.php b/magic/sharp_d4.php index 0b80cf5..219ef3a 100644 --- a/magic/sharp_d4.php +++ b/magic/sharp_d4.php @@ -1,39 +1,36 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=81 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 81 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +4' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `ndubina` = `ndubina`+4, `nlovk` = `nlovk`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +4' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `ndubina` = `ndubina`+4, `nlovk` = `nlovk`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_d5.php b/magic/sharp_d5.php index a703ce1..c19b521 100644 --- a/magic/sharp_d5.php +++ b/magic/sharp_d5.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=91 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 91 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +5' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `ndubina` = `ndubina`+5, `nlovk` = `nlovk`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%дубинка%' OR `name` LIKE '%дубина%' OR `name` LIKE '%булава%' OR `name` LIKE '%Клевец%' OR `name` LIKE '%молот%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на дубины +5' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `ndubina` = `ndubina`+5, `nlovk` = `nlovk`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_m1.php b/magic/sharp_m1.php index e34fbfd..d575db2 100644 --- a/magic/sharp_m1.php +++ b/magic/sharp_m1.php @@ -1,38 +1,36 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else - if ($user['intel'] >= 4) { - $int=51 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + if ($user['intel'] >= 4) { + $int = 51 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } +if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +1' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `nmech` = `nmech`+1, `cost` = `cost`+6, `nvinos` = `nvinos`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +1' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `nmech` = `nmech`+1, `cost` = `cost`+6, `nvinos` = `nvinos`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; +} diff --git a/magic/sharp_m11.php b/magic/sharp_m11.php index 5359f7f..0120856 100644 --- a/magic/sharp_m11.php +++ b/magic/sharp_m11.php @@ -1,39 +1,37 @@ 0) { - echo "РќРµ РІ Р±РѕСЋ..."; + echo "РќРµ РІ Р±РѕСЋ..."; } else - if ($user['intel'] >= 1) { - $int=91 + $user['intel'] - 1; - if ($int>100){$int=100;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; + if ($user['intel'] >= 1) { + $int = 91 + $user['intel'] - 1; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + +if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° мечи +11' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `nmech` = `nmech`+11, `cost` = `cost`+72, `nvinos` = `nvinos`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное РёРјСЏ предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; } - - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° мечи +11' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `nmech` = `nmech`+11, `cost` = `cost`+72, `nvinos` = `nvinos`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное РёРјСЏ предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } diff --git a/magic/sharp_m2.php b/magic/sharp_m2.php index 5d1da1b..bbc3643 100644 --- a/magic/sharp_m2.php +++ b/magic/sharp_m2.php @@ -1,38 +1,39 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else - if ($user['intel'] >= 4) { - $int=61 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; + if ($user['intel'] >= 4) { + $int = 61 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } +if (rand(1, 100) < $int) { + + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +2' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `minu` = `minu`+2, `maxu`=`maxu`+2, `nmech` = `nmech`+2, `cost` = `cost`+12, `nvinos` = `nvinos`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; } - - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +2' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `minu` = `minu`+2, `maxu`=`maxu`+2, `nmech` = `nmech`+2, `cost` = `cost`+12, `nvinos` = `nvinos`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } diff --git a/magic/sharp_m3.php b/magic/sharp_m3.php index 737ce13..f93930d 100644 --- a/magic/sharp_m3.php +++ b/magic/sharp_m3.php @@ -1,37 +1,38 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else - if ($user['intel'] >= 4) { - $int=71 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; + if ($user['intel'] >= 4) { + $int = 71 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } +if (rand(1, 100) < $int) { + + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +3' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `cost` = `cost`+18,`name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `nmech` = `nmech`+3, `nvinos` = `nvinos`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; } - - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +3' AND `owner` = '{$user['id']}' LIMIT 1;")); - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `cost` = `cost`+18,`name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `nmech` = `nmech`+3, `nvinos` = `nvinos`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } diff --git a/magic/sharp_m4.php b/magic/sharp_m4.php index 37492a4..927b2f6 100644 --- a/magic/sharp_m4.php +++ b/magic/sharp_m4.php @@ -1,38 +1,36 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else - if ($user['intel'] >= 4) { - $int=81 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; + if ($user['intel'] >= 4) { + $int = 81 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } +if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +4' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `nmech` = `nmech`+4, `nvinos` = `nvinos`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; } - - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +4' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `nmech` = `nmech`+4, `nvinos` = `nvinos`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } diff --git a/magic/sharp_m5.php b/magic/sharp_m5.php index e86d9f4..b0d30d5 100644 --- a/magic/sharp_m5.php +++ b/magic/sharp_m5.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else - if ($user['intel'] >= 4) { - $int=91 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; + if ($user['intel'] >= 4) { + $int = 91 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + +if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +5' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `nmech` = `nmech`+5, `cost` = `cost`+30, `nvinos` = `nvinos`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } +} else { + echo "Неудачно..."; + $bet = 1; } - - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Меч%' OR `name` LIKE '%Жало%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на мечи +5' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `nmech` = `nmech`+5, `cost` = `cost`+30, `nvinos` = `nvinos`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } diff --git a/magic/sharp_n1.php b/magic/sharp_n1.php index 3536076..26c08ae 100644 --- a/magic/sharp_n1.php +++ b/magic/sharp_n1.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=51 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 51 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +1' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `nnoj` = `nnoj`+1, `ninta` = `ninta`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +1' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `nnoj` = `nnoj`+1, `ninta` = `ninta`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_n11.php b/magic/sharp_n11.php index 72d49ce..f8343c3 100644 --- a/magic/sharp_n11.php +++ b/magic/sharp_n11.php @@ -1,39 +1,37 @@ 0) { - echo "РќРµ РІ Р±РѕСЋ..."; -} else { - if ($user['intel'] >= 1) { - $int=91 + $user['intel'] - 1; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "РќРµ РІ Р±РѕСЋ..."; +} else { + if ($user['intel'] >= 1) { + $int = 91 + $user['intel'] - 1; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%РЅРѕР¶%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° ножи +11' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `nnoj` = `nnoj`+1, `ninta` = `ninta`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное РёРјСЏ предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%РЅРѕР¶%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° ножи +11' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `nnoj` = `nnoj`+1, `ninta` = `ninta`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное РёРјСЏ предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_n2.php b/magic/sharp_n2.php index 90b7bdd..6b8f300 100644 --- a/magic/sharp_n2.php +++ b/magic/sharp_n2.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=61 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 61 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +2' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `nnoj` = `nnoj`+2, `ninta` = `ninta`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +2' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `nnoj` = `nnoj`+2, `ninta` = `ninta`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_n3.php b/magic/sharp_n3.php index fe26eab..7d83325 100644 --- a/magic/sharp_n3.php +++ b/magic/sharp_n3.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=71 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 71 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +3' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `nnoj` = `nnoj`+3, `ninta` = `ninta`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +3' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `nnoj` = `nnoj`+3, `ninta` = `ninta`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_n4.php b/magic/sharp_n4.php index 775f41d..ffa444c 100644 --- a/magic/sharp_n4.php +++ b/magic/sharp_n4.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=81 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 81 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +4' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `nnoj` = `nnoj`+4, `ninta` = `ninta`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +4' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `nnoj` = `nnoj`+4, `ninta` = `ninta`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_n5.php b/magic/sharp_n5.php index c2e0372..3012557 100644 --- a/magic/sharp_n5.php +++ b/magic/sharp_n5.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=91 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 91 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +5' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `nnoj` = `nnoj`+5, `ninta` = `ninta`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%кастет%' OR `name` LIKE '%нож%' OR `name` LIKE '%кинжал%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на ножи +5' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `nnoj` = `nnoj`+5, `ninta` = `ninta`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t1.php b/magic/sharp_t1.php index 3ddcba5..da590af 100644 --- a/magic/sharp_t1.php +++ b/magic/sharp_t1.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=51 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 51 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +1' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ntopor` = `ntopor`+1, `nsila` = `nsila`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +1' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ntopor` = `ntopor`+1, `nsila` = `nsila`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t11.php b/magic/sharp_t11.php index d22d0ec..ed1ef07 100644 --- a/magic/sharp_t11.php +++ b/magic/sharp_t11.php @@ -1,39 +1,40 @@ 0) { - echo "РќРµ РІ Р±РѕСЋ..."; -} else { - if ($user['intel'] >= 1) { - $int=91 + $user['intel'] - 1; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "РќРµ РІ Р±РѕСЋ..."; +} else { + if ($user['intel'] >= 1) { + $int = 91 + $user['intel'] - 1; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%РўРѕРїРѕСЂ%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° топоры +11' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `ntopor` = `ntopor`+1, `nsila` = `nsila`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное РёРјСЏ предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%РўРѕРїРѕСЂ%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка РЅР° топоры +11' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+11'), `minu` = `minu`+11, `maxu`=`maxu`+11, `cost` = `cost`+72, `ntopor` = `ntopor`+1, `nsila` = `nsila`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +11. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное РёРјСЏ предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t2.php b/magic/sharp_t2.php index 30bca3a..8dd4f04 100644 --- a/magic/sharp_t2.php +++ b/magic/sharp_t2.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=61 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 61 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +2' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `ntopor` = `ntopor`+2, `nsila` = `nsila`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +2' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+2'), `cost` = `cost`+12, `minu` = `minu`+2, `maxu`=`maxu`+2, `ntopor` = `ntopor`+2, `nsila` = `nsila`+2 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +2. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t3.php b/magic/sharp_t3.php index 94f264b..35f98fb 100644 --- a/magic/sharp_t3.php +++ b/magic/sharp_t3.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=71 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 71 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +3' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `ntopor` = `ntopor`+3, `nsila` = `nsila`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `(`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +3' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+3'), `minu` = `minu`+3, `maxu`=`maxu`+3, `cost` = `cost`+18, `ntopor` = `ntopor`+3, `nsila` = `nsila`+3 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +3. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t4.php b/magic/sharp_t4.php index f607c7a..c25baaf 100644 --- a/magic/sharp_t4.php +++ b/magic/sharp_t4.php @@ -1,39 +1,37 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=81 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1,100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 81 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +4' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `ntopor` = `ntopor`+4, `nsila` = `nsila`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +4' AND `owner` = '{$user['id']}' LIMIT 1;")); + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `ntopor` = `ntopor`+4, `nsila` = `nsila`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +4. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sharp_t5.php b/magic/sharp_t5.php index 03130b6..322c339 100644 --- a/magic/sharp_t5.php +++ b/magic/sharp_t5.php @@ -1,39 +1,40 @@ 0) { - echo "Не в бою..."; -} else { - if ($user['intel'] >= 4) { - $int=91 + $user['intel'] - 4; - if ($int>100){$int=100;} - } - else {$int=0;} - if (rand(1, 100) < $int) { - - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + echo "Не в бою..."; +} else { + if ($user['intel'] >= 4) { + $int = 91 + $user['intel'] - 4; + if ($int > 100) { + $int = 100; + } + } else { + $int = 0; + } + if (rand(1, 100) < $int) { - - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); - $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +5' AND `owner` = '{$user['id']}' LIMIT 1;")); - - - if ($dress && $svitok) { - if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `ntopor` = `ntopor`+5, `nsila` = `nsila`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { - echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } else { - echo "Неправильное имя предмета или неправильный свиток"; - } - } else - { - echo "Неудачно..."; - $bet=1; - } + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } + + + $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `name` LIKE '%Секира%') AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); + $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +5' AND `owner` = '{$user['id']}' LIMIT 1;")); + + + if ($dress && $svitok) { + if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+5'), `minu` = `minu`+5, `maxu`=`maxu`+5, `cost` = `cost`+30, `ntopor` = `ntopor`+5, `nsila` = `nsila`+5 WHERE `id` = {$dress['id']} LIMIT 1;")) { + echo "Предмет \"{$_POST['target']}\" удачно заточен +5. "; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Неправильное имя предмета или неправильный свиток"; + } + } else { + echo "Неудачно..."; + $bet = 1; + } } diff --git a/magic/sleep.php b/magic/sleep.php index 515811e..15a27a4 100644 --- a/magic/sleep.php +++ b/magic/sleep.php @@ -1,7 +1,4 @@ На персонаже \"$target\" уже есть заклятие молчания "; + } else { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } elseif (($user['align'] > '7' && $user['align'] < '8') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Заклятие молчания','$magictime',2);")) { + $ldtarget = $target; + switch ($_POST['timer']) { + case "15": + $magictime = "15 мин."; + break; + case "30": + $magictime = "30 мин."; + break; + case "60": + $magictime = "1 час."; + break; + case "180": + $magictime = "3 часа."; + break; + case "360": + $magictime = "6 часов."; + break; + case "720": + $magictime = "12 часов."; + break; + case "1440": + $magictime = "1 сутки."; + break; + } + if ($user['sex'] == 1) { + $action = "наложил"; + } else { + $action = "наложила"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие молчания на "$target" сроком $magictime"; + $messch = "$angel "{$user['login']}" $action заклятие молчания на "$target" сроком $magictime"; - $magictime=time()+($_POST['timer']*60); - $target=$_POST['target']; - $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); - if ($tar['id']) { - $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '2' LIMIT 1;")); - if ($effect['time']) { - echo "На персонаже \"$target\" уже есть заклятие молчания "; - } - else { - $ok=0; - if ($user['align'] > '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - elseif (($user['align'] > '7' && $user['align'] < '8') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Заклятие молчания','$magictime',2);")) { - $ldtarget=$target; - switch($_POST['timer']) { - case "15": $magictime="15 мин."; break; - case "30": $magictime="30 мин."; break; - case "60": $magictime="1 час."; break; - case "180": $magictime="3 часа."; break; - case "360": $magictime="6 часов."; break; - case "720": $magictime="12 часов."; break; - case "1440": $magictime="1 сутки."; break; - } - if ($user['sex'] == 1) {$action="наложил";} - else {$action="наложила";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие молчания на "$target" сроком $magictime"; - $messch="$angel "{$user['login']}" $action заклятие молчания на "$target" сроком $magictime"; - - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $messch"); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Успешно наложено заклятие молчания на персонажа \"$target\""; - $outok=1; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете наложить заклятие молчания на этого персонажа!"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $messch"); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Успешно наложено заклятие молчания на персонажа \"$target\""; + $outok = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете наложить заклятие молчания на этого персонажа!"; + } + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/sleep_off.php b/magic/sleep_off.php index fdba2e4..263b4c4 100644 --- a/magic/sleep_off.php +++ b/magic/sleep_off.php @@ -1,57 +1,52 @@ room > 2000) && ($user->room < 2100)) {echo "Не в Проходе...";} - else { - $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); - $target=$_POST['target']; - if ($tar['id']) { - $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '2' LIMIT 1;")); - if ($effect['time']) { - $ok=0; - if ($user['align'] > '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '2' LIMIT 1 ;")) { - if ($user['sex'] == 1) {$action="снял";} - else {$action="сняла";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие молчания с "$target"."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $mess"); - echo "Успешно снято заклятие молчания с персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете снять заклятие молчания с этого персонажа!"; - } - } - else { - echo "На персонаже \"$target\" нет заклятия молчания "; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - }} +if (($user->room > 2000) && ($user->room < 2100)) { + echo "Не в Проходе..."; +} else { + $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); + $target = $_POST['target']; + if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '2' LIMIT 1;")); + if ($effect['time']) { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '2' LIMIT 1 ;")) { + if ($user['sex'] == 1) { + $action = "снял"; + } else { + $action = "сняла"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие молчания с "$target"."; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $mess"); + echo "Успешно снято заклятие молчания с персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете снять заклятие молчания с этого персонажа!"; + } + } else { + echo "На персонаже \"$target\" нет заклятия молчания "; + } + } else { + echo "Персонаж \"$target\" не существует!"; + } +} diff --git a/magic/sleepf_off.php b/magic/sleepf_off.php index bd05ee2..c291f58 100644 --- a/magic/sleepf_off.php +++ b/magic/sleepf_off.php @@ -1,56 +1,49 @@ '2' && $user['align'] < '3') { - $ok=1; - } - elseif (($user['align'] > '1.2' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { - $ok=1; - } - elseif (($user['align'] > '1.2' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { - $ok=1; - } - if ($ok == 1) { - if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '3' LIMIT 1 ;")) { - if ($user['sex'] == 1) {$action="снял";} - else {$action="сняла";} - if ($user['align'] > '2' && $user['align'] < '3') { - $angel="Ангел"; - } - elseif ($user['align'] > '1' && $user['align'] < '2') { - $angel="Паладин"; - } - $mess="$angel "{$user['login']}" $action заклятие форумного молчания с "$target"."; - mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');"); - mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');"); - addch(" $mess"); - echo "Успешно снято заклятие форумного молчания с персонажа \"$target\""; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Вы не можете снять заклятие форумного молчания с этого персонажа!"; - } - } - else { - echo "На персонаже \"$target\" нет заклятия форумного молчания "; - } - } - else { - echo "Персонаж \"$target\" не существует!"; - } +$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$target = $_POST['target']; +if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '3' LIMIT 1;")); + if ($effect['time']) { + $ok = 0; + if ($user['align'] > '2' && $user['align'] < '3') { + $ok = 1; + } elseif (($user['align'] > '1.2' && $user['align'] < '2') && ($tar['align'] > '1' && $tar['align'] < '2') && ($user['align'] > $tar['align'])) { + $ok = 1; + } elseif (($user['align'] > '1.2' && $user['align'] < '2') && !($tar['align'] > '2' && $tar['align'] < '3') && !($tar['align'] > '1' && $tar['align'] < '2')) { + $ok = 1; + } + if ($ok == 1) { + if (mysql_query("DELETE FROM`effects` WHERE `owner` = '{$tar['id']}' and `type` = '3' LIMIT 1 ;")) { + if ($user['sex'] == 1) { + $action = "снял"; + } else { + $action = "сняла"; + } + if ($user['align'] > '2' && $user['align'] < '3') { + $angel = "Ангел"; + } elseif ($user['align'] > '1' && $user['align'] < '2') { + $angel = "Паладин"; + } + $mess = "$angel "{$user['login']}" $action заклятие форумного молчания с "$target"."; + mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');"); + mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');"); + addch(" $mess"); + echo "Успешно снято заклятие форумного молчания с персонажа \"$target\""; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Вы не можете снять заклятие форумного молчания с этого персонажа!"; + } + } else { + echo "На персонаже \"$target\" нет заклятия форумного молчания "; + } +} else { + echo "Персонаж \"$target\" не существует!"; +} diff --git a/magic/stop.php b/magic/stop.php index b4c1b2c..355a42e 100644 --- a/magic/stop.php +++ b/magic/stop.php @@ -1,47 +1,47 @@ невидимка'; +} +if (($user->room > 2000) && ($user->room < 2100)) { + echo "Не в Проходе..."; +} else { + $magictime = (time() + 10 * 60); + $target = $_POST['target']; + $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`room` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); + if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '10' LIMIT 1;")); + if ($effect['time']) { + echo "На персонаже \"$target\" уже есть путы "; + } else { - if($user['invis'] == 1) { $user['login'] = 'невидимка'; } -if (($user->room > 2000) && ($user->room < 2100)) {echo "Не в Проходе...";} - else { - $magictime = (time()+10*60); - $target=$_POST['target']; - $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`room` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); - if ($tar['id']) { - $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '10' LIMIT 1;")); - if ($effect['time']) { - echo "На персонаже \"$target\" уже есть путы "; - } - else { - - if ($tar['room']==$user->room) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Путы','$magictime',10);")) { - $ldtarget=$target; - - if ($user['sex'] == 1) {$action="наложил";} - else {$action="наложила";} - - $messch="Персонаж "{$user['login']}" $action путы на "$target""; - - addch(" $messch"); - echo "Вы наложили путы на персонажа \"$target\""; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Персонаж в другой комнате"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - }} + if ($tar['room'] == $user->room) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Путы','$magictime',10);")) { + $ldtarget = $target; + + if ($user['sex'] == 1) { + $action = "наложил"; + } else { + $action = "наложила"; + } + + $messch = "Персонаж "{$user['login']}" $action путы на "$target""; + + addch(" $messch"); + echo "Вы наложили путы на персонажа \"$target\""; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Персонаж в другой комнате"; + } + } + } else { + echo "Персонаж \"$target\" не существует!"; + } +} diff --git a/magic/stop_200.php b/magic/stop_200.php index 7f13bd1..8d7586e 100644 --- a/magic/stop_200.php +++ b/magic/stop_200.php @@ -1,47 +1,48 @@ невидимка'; } -if (($user->room > 2000) && ($user->room < 2100)) {echo "Не в Проходе...";} - else { - $magictime = (time()+10*60*10); - $target=$_POST['target']; - $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`room` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); - if ($tar['id']) { - $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '10' LIMIT 1;")); - if ($effect['time']) { - echo "На персонаже \"$target\" уже есть путы "; - } - else { - - if ($tar['room']==$user->room) { - if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$tar['id']."','Паралич','$magictime',10);")) { - $ldtarget=$target; - - if ($user['sex'] == 1) {$action="паролизовал";} - else {$action="паролизовала";} - - $messch="Персонаж "{$user['login']}" $action "$target""; - - addch(" $messch"); - echo "Вы парализовали персонажа \"$target\""; - $bet=1; - } - else { - echo "Произошла ошибка!"; - } - } - else { - echo "Персонаж в другой комнате"; - } - } - } - else { - echo "Персонаж \"$target\" не существует!"; - }} +if ($user['invis'] == 1) { + $user['login'] = 'невидимка'; +} +if (($user->room > 2000) && ($user->room < 2100)) { + echo "Не в Проходе..."; +} else { + $magictime = (time() + 10 * 60 * 10); + $target = $_POST['target']; + $tar = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`room` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); + if ($tar['id']) { + $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '10' LIMIT 1;")); + if ($effect['time']) { + echo "На персонаже \"$target\" уже есть путы "; + } else { + + if ($tar['room'] == $user->room) { + if (mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('" . $tar['id'] . "','Паралич','$magictime',10);")) { + $ldtarget = $target; + + if ($user['sex'] == 1) { + $action = "паролизовал"; + } else { + $action = "паролизовала"; + } + + $messch = "Персонаж "{$user['login']}" $action "$target""; + + addch(" $messch"); + echo "Вы парализовали персонажа \"$target\""; + $bet = 1; + } else { + echo "Произошла ошибка!"; + } + } else { + echo "Персонаж в другой комнате"; + } + } + } else { + echo "Персонаж \"$target\" не существует!"; + } +} diff --git a/magic/unclone.php b/magic/unclone.php index 7bd4593..c675b2e 100644 --- a/magic/unclone.php +++ b/magic/unclone.php @@ -1,79 +1,76 @@ = 3) { - $int=$magic['chanse'] + ($user['intel'] - 3)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '17' ;")); - if (rand(1,100) < $int) { - //$nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (клон%';")); - //mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$user['login']." (клон ".($nb[0]+1).")','".$user['id']."','".$user['battle']."','".$user['hp']."');"); - //$bot = mysql_insert_id(); - $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."';")); - if($bot && strpos($_POST['target'],"(клон" )) { - $bot = $bot[0]; - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle as $k => $v) { - unset($battle[$k][$bot]); - } - - foreach($battle[$user['id']] as $k => $v) { - $battle[$k][$bot] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - $t2 = explode(";",$bd['t2']); - foreach($t1 as $k=>$v) { - if($v==$bot) { - unset($t1[$k]); - } - } - foreach($t2 as $k=>$v) { - if($v==$bot) { - unset($t2[$k]); - } - } - // проставлЯем кто-где - if (in_array ($user['id'],$t1)) { - $ttt = 1; - $t1[] = $bot; - } else { - $ttt = 2; - $t2[] = $bot; - } - - $t1 = implode(";",$t1); - $t2 = implode(";",$t2); - - //mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\''.date("H:i").' '.nick::id($user['id'])->short().' переманил клона '.nick::id($bot)->short().' на свою сторону
\') WHERE `id` = '.$user['battle'].';'); - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' переманил клона '.Nick::id($bot)->short().' на свою сторону
'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t1` = \''.$t1.'\', `t2` = \''.$t2.'\' WHERE `id` = '.$user['battle'].' ;'); - - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;"); - mysql_query("UPDATE bots set 'owner'='".$user['id']."' WHERE `name` = '".$_POST['target']."';"); - - $bet=1; - echo "‚ы переманили клона"; - } else { - echo "Ќет такого клона"; - } - } else { - echo "свиток рассыпалсЯ в ваших руках..."; - $bet=1; - } + if ($user['intel'] >= 3) { + $int = $magic['chanse'] + ($user['intel'] - 3) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "';")); + if ($bot && strpos($_POST['target'], "(клон")) { + $bot = $bot[0]; + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle as $k => $v) { + unset($battle[$k][$bot]); + } + + foreach ($battle[$user['id']] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); + $t2 = explode(";", $bd['t2']); + foreach ($t1 as $k => $v) { + if ($v == $bot) { + unset($t1[$k]); + } + } + foreach ($t2 as $k => $v) { + if ($v == $bot) { + unset($t2[$k]); + } + } + // проставлЯем кто-где + if (in_array($user['id'], $t1)) { + $ttt = 1; + $t1[] = $bot; + } else { + $ttt = 2; + $t2[] = $bot; + } + + $t1 = implode(";", $t1); + $t2 = implode(";", $t2); + + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' переманил клона ' . Nick::id($bot)->short() . ' на свою сторону
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t1` = \'' . $t1 . '\', `t2` = \'' . $t2 . '\' WHERE `id` = ' . $user['battle'] . ' ;'); + + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1;"); + mysql_query("UPDATE bots set 'owner'='" . $user['id'] . "' WHERE `name` = '" . $_POST['target'] . "';"); + + $bet = 1; + echo "‚ы переманили клона"; + } else { + echo "Ќет такого клона"; + } + } else { + echo "свиток рассыпалсЯ в ваших руках..."; + $bet = 1; + } } diff --git a/magic/unmarry.php b/magic/unmarry.php index 7a46c5e..2f624bd 100644 --- a/magic/unmarry.php +++ b/magic/unmarry.php @@ -1,5 +1,8 @@ query('SELECT `id`,`married`,`login` FROM `users` WHERE `login $u2Row = db::c()->query('SELECT `id`,`married`,`login` FROM `users` WHERE `login` = "?s"', $u2)->fetch_assoc(); if ($u1Row['id'] and $u2Row['id']) { - if (($u1Row['married'] != $u2Row['login']) OR ($u2Row['married'] != $u1Row['login'])) { + if (($u1Row['married'] != $u2Row['login']) or ($u2Row['married'] != $u1Row['login'])) { $status = "Персонажи {$u1Row['login']} и {$u2Row['login']} не состоят в браке друг с другом!"; } else { if ($user['align'] > '1.6' && $user['align'] < '2') { diff --git a/magic/usability_klan/clone.php b/magic/usability_klan/clone.php index 5f4ab1c..e261436 100644 --- a/magic/usability_klan/clone.php +++ b/magic/usability_klan/clone.php @@ -1,38 +1,43 @@ = 1) { - if($user['invis'] == 1) { $user['login'] = 'невидимка'; } - $nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `name` LIKE '".$user['login']." (клон%' AND `battle` = $user[battle]")); - mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`, `owner`) values ('".$user['login']." (клон ".($nb[0]+1).")', '".$user['id']."', '".$user['battle']."', '".$user['hp']."', '".$user['id']."')"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0, 0, time()); - } - - $t1 = explode(";", $bd['t1']); - if(in_array($user['id'], $t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - $lo = Nick::id($user['id'])->short(); - $los = Nick::id($bot)->short(); - addlog($user['battle'], ''.date("H:i").' '.$lo.' породил своего клона '.$los.'.
'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'` = CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = "'.$user['battle'].'" LIMIT 1'); - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1"); - echo "Клон создан"; - $vip['clone'] -= 1; - mysql_query('UPDATE `abils_klan` SET `clone` = "'.$vip['clone'].'" WHERE `klan` = "'.$vip['klan'].'" LIMIT 1'); - } else { - echo "Свиток рассыпался в ваших руках..."; - } +if ($_SESSION['uid'] == null) { + header("Location: index.php"); + exit; +} +$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `clone` FROM `abils_klan` WHERE `klan` = "' . $user['klan'] . '" LIMIT 1')); + +if ($user['battle'] == 0) { + echo "Это боевая магия..."; +} else { + if ($vip['clone'] >= 1) { + if ($user['invis'] == 1) { + $user['login'] = 'невидимка'; + } + $nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (клон%' AND `battle` = $user[battle]")); + mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`, `owner`) values ('" . $user['login'] . " (клон " . ($nb[0] + 1) . ")', '" . $user['id'] . "', '" . $user['battle'] . "', '" . $user['hp'] . "', '" . $user['id'] . "')"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + $t1 = explode(";", $bd['t1']); + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + $lo = Nick::id($user['id'])->short(); + $los = Nick::id($bot)->short(); + addlog($user['battle'], '' . date("H:i") . ' ' . $lo . ' породил своего клона ' . $los . '.
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = "' . $user['battle'] . '" LIMIT 1'); + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1"); + echo "Клон создан"; + $vip['clone'] -= 1; + mysql_query('UPDATE `abils_klan` SET `clone` = "' . $vip['clone'] . '" WHERE `klan` = "' . $vip['klan'] . '" LIMIT 1'); + } else { + echo "Свиток рассыпался в ваших руках..."; + } } diff --git a/magic/usability_klan/unclone.php b/magic/usability_klan/unclone.php index 5201885..a6731d5 100644 --- a/magic/usability_klan/unclone.php +++ b/magic/usability_klan/unclone.php @@ -1,67 +1,70 @@ = 1) { - $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '".mysql_real_escape_string($_POST['target'])."' AND `battle` = '".$user['battle']."' LIMIT 1")); - - if($bot) { - $prototype = mysql_fetch_array(mysql_query('SELECT `id`, `intel` FROM `users` WHERE `id` = "'.$bot['prototype'].'" LIMIT 1')); - } - if($prototype['intel'] > $user['intel']) { - echo 'Ваш противник имеет более высокий интелект ...'; - } elseif($bot && strpos($_POST['target'], "клон")) { - $bot = $bot[0]; - $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle as $k => $v) { - unset($battle[$k][$bot]); - } - - foreach($battle[$user['id']] as $k => $v) { - $battle[$k][$bot] = array(0, 0, time()); - } - - $t1 = explode(";", $bd['t1']); - $t2 = explode(";", $bd['t2']); - - foreach($t1 as $k => $v) { - if($v == $bot) { - unset($t1[$k]); - } - } - - foreach($t2 as $k => $v) { - if($v == $bot) { - unset($t2[$k]); - } - } - - if(in_array($user['id'], $t1)) { - $ttt = 1; - $t1[] = $bot; - } else { - $ttt = 2; - $t2[] = $bot; - } - - $t1 = implode(";", $t1); - $t2 = implode(";", $t2); - - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' переманил клона '.Nick::id($bot)->short().' на свою сторону
'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t1` = \''.$t1.'\', `t2` = \''.$t2.'\' WHERE `id` = '.$user['battle'].' LIMIT 1'); - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1"); - echo "Вы переманили клона"; - $vip['unclone'] -= 1; - mysql_query('UPDATE `abils_klan` SET `unclone` = "'.$vip['unclone'].'" WHERE `klan` = "'.$vip['klan'].'" LIMIT 1'); - } else { - echo "Нет такого клона"; - } - } else { - echo "Свиток рассыпался в ваших руках..."; - } +if ($_SESSION['uid'] == null) { + header("Location: index.php"); + exit; +} +$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `unclone` FROM `abils_klan` WHERE `klan` = "' . $user['klan'] . '" LIMIT 1')); + +if ($user['battle'] == 0) { + echo "Это боевая магия..."; +} else { + if ($vip['unclone'] >= 1) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . mysql_real_escape_string($_POST['target']) . "' AND `battle` = '" . $user['battle'] . "' LIMIT 1")); + + if ($bot) { + $prototype = mysql_fetch_array(mysql_query('SELECT `id`, `intel` FROM `users` WHERE `id` = "' . $bot['prototype'] . '" LIMIT 1')); + } + if ($prototype['intel'] > $user['intel']) { + echo 'Ваш противник имеет более высокий интелект ...'; + } elseif ($bot && strpos($_POST['target'], "клон")) { + $bot = $bot[0]; + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $user['battle'] . '" LIMIT 1')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle as $k => $v) { + unset($battle[$k][$bot]); + } + + foreach ($battle[$user['id']] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + $t1 = explode(";", $bd['t1']); + $t2 = explode(";", $bd['t2']); + + foreach ($t1 as $k => $v) { + if ($v == $bot) { + unset($t1[$k]); + } + } + + foreach ($t2 as $k => $v) { + if ($v == $bot) { + unset($t2[$k]); + } + } + + if (in_array($user['id'], $t1)) { + $ttt = 1; + $t1[] = $bot; + } else { + $ttt = 2; + $t2[] = $bot; + } + + $t1 = implode(";", $t1); + $t2 = implode(";", $t2); + + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' переманил клона ' . Nick::id($bot)->short() . ' на свою сторону
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t1` = \'' . $t1 . '\', `t2` = \'' . $t2 . '\' WHERE `id` = ' . $user['battle'] . ' LIMIT 1'); + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1"); + echo "Вы переманили клона"; + $vip['unclone'] -= 1; + mysql_query('UPDATE `abils_klan` SET `unclone` = "' . $vip['unclone'] . '" WHERE `klan` = "' . $vip['klan'] . '" LIMIT 1'); + } else { + echo "Нет такого клона"; + } + } else { + echo "Свиток рассыпался в ваших руках..."; + } } diff --git a/magic/usability_user/clone.php b/magic/usability_user/clone.php index 44dc5bf..663e5f9 100644 --- a/magic/usability_user/clone.php +++ b/magic/usability_user/clone.php @@ -1,38 +1,51 @@ = 1) { - if($user['invis'] == 1) { $user['login'] = 'невидимка'; } - $nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `battle` = $user[battle] AND `name` LIKE '".$user['login']." (клон%'")); - mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`, `owner`) VALUES ('".$user['login']." (клон ".($nb[0]+1).")', '".$user['id']."', '".$user['battle']."', '".$user['hp']."', '".$user['id']."')"); - $bot = mysql_insert_id(); - - $bd = mysql_fetch_array(mysql_query('SELECT `id`, `t1`, `t2`, `teams` FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle[$bot] as $k => $v) { - $battle[$k][$bot] = array(0, 0, time()); - } - - $t1 = explode(";", $bd['t1']); - if(in_array($user['id'], $t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - if($user['invis'] == 1) { $lo = 'невидимка'; } else { $lo = Nick::id($user['id'])->short(); } - if($user['invis'] == 1) { $los = 'невидимка'; } else { $los = Nick::id($bot)->short(); } - addlog($user['battle'], ''.date("H:i").' '.$lo.' породил своего клона '.$los.'.

'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'` = CONCAT(`t'.$ttt.'`,\';'.$bot.'\') WHERE `id` = "'.$user['battle'].'" LIMIT 1'); - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1"); - echo "Клон создан"; - $vip['clone'] -= 1; - mysql_query('UPDATE `abils_user` SET `clone` = "'.$vip['clone'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1'); - } else { - echo "Свиток рассыпался в ваших руках..."; - } +if ($_SESSION['uid'] == null) { + header("Location: index.php"); + exit; +} +$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `clone` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1')); + +if ($user['battle'] == 0) { + echo "Это боевая магия..."; +} else { + if ($vip['clone'] >= 1) { + if ($user['invis'] == 1) { + $user['login'] = 'невидимка'; + } + $nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `battle` = $user[battle] AND `name` LIKE '" . $user['login'] . " (клон%'")); + mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`, `owner`) VALUES ('" . $user['login'] . " (клон " . ($nb[0] + 1) . ")', '" . $user['id'] . "', '" . $user['battle'] . "', '" . $user['hp'] . "', '" . $user['id'] . "')"); + $bot = mysql_insert_id(); + + $bd = mysql_fetch_array(mysql_query('SELECT `id`, `t1`, `t2`, `teams` FROM `battle` WHERE `id` = "' . $user['battle'] . '" LIMIT 1')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle[$bot] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + $t1 = explode(";", $bd['t1']); + if (in_array($user['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + if ($user['invis'] == 1) { + $lo = 'невидимка'; + } else { + $lo = Nick::id($user['id'])->short(); + } + if ($user['invis'] == 1) { + $los = 'невидимка'; + } else { + $los = Nick::id($bot)->short(); + } + addlog($user['battle'], '' . date("H:i") . ' ' . $lo . ' породил своего клона ' . $los . '.

'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = "' . $user['battle'] . '" LIMIT 1'); + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1"); + echo "Клон создан"; + $vip['clone'] -= 1; + mysql_query('UPDATE `abils_user` SET `clone` = "' . $vip['clone'] . '" WHERE `id` = "' . $vip['id'] . '" LIMIT 1'); + } else { + echo "Свиток рассыпался в ваших руках..."; + } } diff --git a/magic/usability_user/unclone.php b/magic/usability_user/unclone.php index 45e92ed..a72398f 100644 --- a/magic/usability_user/unclone.php +++ b/magic/usability_user/unclone.php @@ -1,71 +1,74 @@ = 1) { - $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '".mysql_real_escape_string($_POST['target'])."' AND `battle` = '".$user['battle']."' LIMIT 1")); - - if($bot) { - $prototype = mysql_fetch_array(mysql_query('SELECT `id`, `intel` FROM `users` WHERE `id` = "'.$bot['prototype'].'" LIMIT 1')); - } - - if($bot['hp'] <= 0) { - echo 'Мертвых переманивать нельзя ... '.$bot['id'].'='.$bot['hp']; - } elseif($prototype['intel'] > $user['intel']) { - echo 'Ваш противник имеет более высокий интелект ...'; - } elseif($bot && strpos($_POST['target'], "клон")) { - $bot = $bot[0]; - $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1')); - $battle = unserialize($bd['teams']); - $battle[$bot] = $battle[$user['id']]; - foreach($battle as $k => $v) { - unset($battle[$k][$bot]); - } - - foreach($battle[$user['id']] as $k => $v) { - $battle[$k][$bot] = array(0, 0, time()); - } - - $t1 = explode(";", $bd['t1']); - $t2 = explode(";", $bd['t2']); - - foreach($t1 as $k => $v) { - if($v == $bot) { - unset($t1[$k]); - } - } - - foreach($t2 as $k => $v) { - if($v == $bot) { - unset($t2[$k]); - } - } - - if(in_array($user['id'], $t1)) { - $ttt = 1; - $t1[] = $bot; - } else { - $ttt = 2; - $t2[] = $bot; - } - - $t1 = implode(";", $t1); - $t2 = implode(";", $t2); - - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' переманил клона '.Nick::id($bot)->short().' на свою сторону.
'); - mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t1` = \''.$t1.'\', `t2` = \''.$t2.'\' WHERE `id` = "'.$user['battle'].'" LIMIT 1'); - mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = '".$user['battle']."' LIMIT 1"); - echo mysql_error(); - echo "Вы переманили клона"; - $vip['unclone'] -= 1; - mysql_query('UPDATE `abils_user` SET `unclone` = "'.$vip['unclone'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1'); - } else { - echo "Нет такого клона"; - } - } else { - echo "Свиток рассыпался в ваших руках..."; - } +if ($_SESSION['uid'] == null) { + header("Location: index.php"); + exit; +} +$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `unclone` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1')); + +if ($user['battle'] == 0) { + echo "Это боевая магия..."; +} else { + if ($vip['unclone'] >= 1) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . mysql_real_escape_string($_POST['target']) . "' AND `battle` = '" . $user['battle'] . "' LIMIT 1")); + + if ($bot) { + $prototype = mysql_fetch_array(mysql_query('SELECT `id`, `intel` FROM `users` WHERE `id` = "' . $bot['prototype'] . '" LIMIT 1')); + } + + if ($bot['hp'] <= 0) { + echo 'Мертвых переманивать нельзя ... ' . $bot['id'] . '=' . $bot['hp']; + } elseif ($prototype['intel'] > $user['intel']) { + echo 'Ваш противник имеет более высокий интелект ...'; + } elseif ($bot && strpos($_POST['target'], "клон")) { + $bot = $bot[0]; + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $user['battle'] . '" LIMIT 1')); + $battle = unserialize($bd['teams']); + $battle[$bot] = $battle[$user['id']]; + foreach ($battle as $k => $v) { + unset($battle[$k][$bot]); + } + + foreach ($battle[$user['id']] as $k => $v) { + $battle[$k][$bot] = [0, 0, time()]; + } + + $t1 = explode(";", $bd['t1']); + $t2 = explode(";", $bd['t2']); + + foreach ($t1 as $k => $v) { + if ($v == $bot) { + unset($t1[$k]); + } + } + + foreach ($t2 as $k => $v) { + if ($v == $bot) { + unset($t2[$k]); + } + } + + if (in_array($user['id'], $t1)) { + $ttt = 1; + $t1[] = $bot; + } else { + $ttt = 2; + $t2[] = $bot; + } + + $t1 = implode(";", $t1); + $t2 = implode(";", $t2); + + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' переманил клона ' . Nick::id($bot)->short() . ' на свою сторону.
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t1` = \'' . $t1 . '\', `t2` = \'' . $t2 . '\' WHERE `id` = "' . $user['battle'] . '" LIMIT 1'); + mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = '" . $user['battle'] . "' LIMIT 1"); + echo mysql_error(); + echo "Вы переманили клона"; + $vip['unclone'] -= 1; + mysql_query('UPDATE `abils_user` SET `unclone` = "' . $vip['unclone'] . '" WHERE `id` = "' . $vip['id'] . '" LIMIT 1'); + } else { + echo "Нет такого клона"; + } + } else { + echo "Свиток рассыпался в ваших руках..."; + } } diff --git a/magic/vampir.php b/magic/vampir.php index 8db331d..0f88b69 100644 --- a/magic/vampir.php +++ b/magic/vampir.php @@ -1,170 +1,191 @@ 0) { - echo "Не в бою..."; + echo "Не в бою..."; } else { - if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} + if (empty($_SESSION['uid'])) { + header("Location: index.php"); + exit; + } - $target=$_POST['target']; - $us = mysql_fetch_array(mysql_query("SELECT *, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Чеснок%' LIMIT 1) AS `che`, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Осиновый кол%' LIMIT 1) AS `kol`,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); - $effs = mysql_query("SELECT * FROM `effects` WHERE `owner` = '{$us['id']}' and (`type`=12 or `type`=13 or `type`=14) limit 1;"); - //echo - if ($us['battle']) { echo "Персонаж находится в поединке!"; } - elseif ($us['battle']) { echo "Персонаж ожидает поединка!"; } - elseif ($us['id'] == $user['id']) { echo "На самого себя? Хм.... может еще и ногу себе откусишь? :)"; } - elseif ($us['align'] == 3) { echo "Что ж ты делаешь, гад?! "{$us['login']}" - твой темный собрат!"; } - elseif ($us['room'] == 31 || $us['room'] == 46 || $us['room'] == 47 || $us['room'] == 48 || $us['room'] == 49 ||$us['room'] == 600 || $us['room'] == 601 || $us['room'] == 45 || $us['room'] == 602 || $us['room'] == 43 || $us['room'] ==45) { - echo "Нападения в этой локации запрещены!";} - elseif ($user['hp'] > $user['maxhp']*0.66) { echo "Нет необходимости кусать, силы скоро восстановятся сами "; } - elseif ($user['hp'] < $user['maxhp']*0.33) { echo "Вы слишком ослаблены для укуса."; } - elseif ($us['hp'] < $us['maxhp']*0.33) { echo "Жертва слишком слаба."; } - elseif ($us['level'] == 0) { echo "Нельзя укусить новичка, они защищены Мироздателем!"; } - elseif ($us['align'] > 2 && $us['align'] < 3) { echo "Вы решили укусить Ангела? ;)"; } - elseif ($user->room != $us['room']) { echo "Персонаж находится в другой комнате.)"; } - elseif ($user['battle']) { echo "Не в бою..."; } - elseif ($user->room == 31) { echo "Нельзя укусить в этой комнате!"; } - elseif (((int)date("H") < 22) && ((int)date("H") >= 6)) { echo "Вампиры кусают только по ночам"; } - elseif ($us['level'] > $user['level']) { echo "Нельзя укусить персонажа большего левела!)"; } - elseif ($us['online'] == 0) { echo "Персонаж находится в оффлайне"; } - else { - if ($user['sex'] == 1) {$action="напал"; $golod="Оголодавший"; $pil="выпил";} - else {$action="напала"; $golod="Оголодавшая"; $pil="выпила";} - if ($us['sex'] == 1) {$otvet="он дал"; $who="его";} - else {$otvet="она дала"; $who="её";} - if (($us['che']==0) && ($us['kol']==0)) { - mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';"); - mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<= $us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Все прошло удачно!"; - } - elseif (($us['kol']!=0 && rand(1,100) < 30) || ($us['id'] == 83 && rand(1,100) < 20)) { - mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';"); - mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<= $us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Все прошло удачно!"; - } - elseif (($us['kol']!=0) || ($us['id'] == 83)) { - echo "Полный провал!.."; - if ($effs['type']) { - echo "Полный провал!.."; - mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$user['id']."';"); - mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '".$us['kol']."' LIMIT 1;"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); - } - else { - mysql_query("UPDATE `users` SET `hp` = '".(round(($user['hp']/2),0))."' WHERE `id` = '".$user['id']."';"); - mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '".$us['kol']."' LIMIT 1;"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); - $jert = $us; - if($jert['zayavka']) { - $fict1 = mysql_fetch_array(mysql_query("SELECT * FROM `zayavka` WHERE `team1` LIKE '{$jert['id']};%' OR `team1` LIKE '%;{$jert['id']};%' LIMIT 1;")); - $fict2 = mysql_fetch_array(mysql_query("SELECT * FROM `zayavka` WHERE `team2` LIKE '{$jert['id']};%' OR `team2` LIKE '%;{$jert['id']};%' LIMIT 1;")); - if($fict1) { $team=1; } - elseif($fict2) { $team=2; } + $target = $_POST['target']; + $us = mysql_fetch_array(mysql_query("SELECT *, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Чеснок%' LIMIT 1) AS `che`, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Осиновый кол%' LIMIT 1) AS `kol`,(select `id` from `online` WHERE `date` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); + $effs = mysql_query("SELECT * FROM `effects` WHERE `owner` = '{$us['id']}' and (`type`=12 or `type`=13 or `type`=14) limit 1;"); + //echo + if ($us['battle']) { + echo "Персонаж находится в поединке!"; + } elseif ($us['battle']) { + echo "Персонаж ожидает поединка!"; + } elseif ($us['id'] == $user['id']) { + echo "На самого себя? Хм.... может еще и ногу себе откусишь? :)"; + } elseif ($us['align'] == 3) { + echo "Что ж ты делаешь, гад?! "{$us['login']}" - твой темный собрат!"; + } elseif ($us['room'] == 31 || $us['room'] == 46 || $us['room'] == 47 || $us['room'] == 48 || $us['room'] == 49 || $us['room'] == 600 || $us['room'] == 601 || $us['room'] == 45 || $us['room'] == 602 || $us['room'] == 43 || $us['room'] == 45) { + echo "Нападения в этой локации запрещены!"; + } elseif ($user['hp'] > $user['maxhp'] * 0.66) { + echo "Нет необходимости кусать, силы скоро восстановятся сами "; + } elseif ($user['hp'] < $user['maxhp'] * 0.33) { + echo "Вы слишком ослаблены для укуса."; + } elseif ($us['hp'] < $us['maxhp'] * 0.33) { + echo "Жертва слишком слаба."; + } elseif ($us['level'] == 0) { + echo "Нельзя укусить новичка, они защищены Мироздателем!"; + } elseif ($us['align'] > 2 && $us['align'] < 3) { + echo "Вы решили укусить Ангела? ;)"; + } elseif ($user->room != $us['room']) { + echo "Персонаж находится в другой комнате.)"; + } elseif ($user['battle']) { + echo "Не в бою..."; + } elseif ($user->room == 31) { + echo "Нельзя укусить в этой комнате!"; + } elseif (((int)date("H") < 22) && ((int)date("H") >= 6)) { + echo "Вампиры кусают только по ночам"; + } elseif ($us['level'] > $user['level']) { + echo "Нельзя укусить персонажа большего левела!)"; + } elseif ($us['online'] == 0) { + echo "Персонаж находится в оффлайне"; + } else { + if ($user['sex'] == 1) { + $action = "напал"; + $golod = "Оголодавший"; + $pil = "выпил"; + } else { + $action = "напала"; + $golod = "Оголодавшая"; + $pil = "выпила"; + } + if ($us['sex'] == 1) { + $otvet = "он дал"; + $who = "его"; + } else { + $otvet = "она дала"; + $who = "её"; + } + if (($us['che'] == 0) && ($us['kol'] == 0)) { + mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '" . $us['id'] . "';"); + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . ((($user['maxhp'] - $user['hp']) <= $us['hp']) ? ($user['maxhp'] - $user['hp']) : $us['hp']) . "' WHERE `id` = '" . $user['id'] . "';"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Все прошло удачно!"; + } elseif (($us['kol'] != 0 && rand(1, 100) < 30) || ($us['id'] == 83 && rand(1, 100) < 20)) { + mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '" . $us['id'] . "';"); + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . ((($user['maxhp'] - $user['hp']) <= $us['hp']) ? ($user['maxhp'] - $user['hp']) : $us['hp']) . "' WHERE `id` = '" . $user['id'] . "';"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Все прошло удачно!"; + } elseif (($us['kol'] != 0) || ($us['id'] == 83)) { + echo "Полный провал!.."; + if ($effs['type']) { + echo "Полный провал!.."; + mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '" . $user['id'] . "';"); + mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); + } else { + mysql_query("UPDATE `users` SET `hp` = '" . (round(($user['hp'] / 2), 0)) . "' WHERE `id` = '" . $user['id'] . "';"); + mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); + $jert = $us; + if ($jert['zayavka']) { + $fict1 = mysql_fetch_array(mysql_query("SELECT * FROM `zayavka` WHERE `team1` LIKE '{$jert['id']};%' OR `team1` LIKE '%;{$jert['id']};%' LIMIT 1;")); + $fict2 = mysql_fetch_array(mysql_query("SELECT * FROM `zayavka` WHERE `team2` LIKE '{$jert['id']};%' OR `team2` LIKE '%;{$jert['id']};%' LIMIT 1;")); + if ($fict1) { + $team = 1; + } elseif ($fict2) { + $team = 2; + } - mysql_query("UPDATE `users` SET `zayavka` = '' WHERE `id` = {$jert['id']} LIMIT 1;"); - $z = mysql_fetch_array(mysql_query("SELECT `team{$team}` FROM `zayavka` WHERE `id`=".$jert['zayavka'].";")); + mysql_query("UPDATE `users` SET `zayavka` = '' WHERE `id` = {$jert['id']} LIMIT 1;"); + $z = mysql_fetch_array(mysql_query("SELECT `team{$team}` FROM `zayavka` WHERE `id`=" . $jert['zayavka'] . ";")); - $teams = str_replace($jert['id'].";","",implode(";",$z[0])); - mysql_query("UPDATE `zayavka` SET team{$team} = '{$teams}' WHERE id = {$jert['zayavka']};"); - } + $teams = str_replace($jert['id'] . ";", "", implode(";", $z[0])); + mysql_query("UPDATE `zayavka` SET team{$team} = '{$teams}' WHERE id = {$jert['zayavka']};"); + } - $teams = array(); - $teams[$user['id']][$us['id']] = array(0,0,time()); - $teams[$us['id']][$user['id']] = array(0,0,time()); - $sv = array(3,5,7,10); - //$tou = array_rand($sv,1); - mysql_query("INSERT INTO `battle` + $teams = []; + $teams[$user['id']][$us['id']] = [0, 0, time()]; + $teams[$us['id']][$user['id']] = [0, 0, time()]; + $sv = [3, 5, 7, 10]; + //$tou = array_rand($sv,1); + mysql_query("INSERT INTO `battle` ( `id`,`coment`,`teams`,`timeout`,`type`,`status`,`t1`,`t2`,`to1`,`to2`,`blood` ) VALUES ( - NULL,'','".serialize($teams)."','".$sv[rand(0,3)]."','6','0','".$user['id']."','".$us['id']."','".time()."','".time()."','1' + NULL,'','" . serialize($teams) . "','" . $sv[rand(0, 3)] . "','6','0','" . $user['id'] . "','" . $us['id'] . "','" . time() . "','" . time() . "','1' )"); - $id = mysql_insert_id(); + $id = mysql_insert_id(); - // апдейтим врага - if($bot) { - mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$us['id']} LIMIT 1;"); - } else { - mysql_query("UPDATE `users` SET `battle` = {$id} WHERE `id` = {$us['id']} LIMIT 1;"); - } + // апдейтим врага + if ($bot) { + mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$us['id']} LIMIT 1;"); + } else { + mysql_query("UPDATE `users` SET `battle` = {$id} WHERE `id` = {$us['id']} LIMIT 1;"); + } - // создаем лог - $rr = "".Nick::id($user['id'])->full(1)." и ".Nick::id($us['id'])->full(1).""; - addch ("Бой между ".Nick::id($user['id'])->short()." и ".Nick::id($us['id'])->short()." начался. ",$user->room); + // создаем лог + $rr = "" . Nick::id($user['id'])->full(1) . " и " . Nick::id($us['id'])->full(1) . ""; + addch("Бой между " . Nick::id($user['id'])->short() . " и " . Nick::id($us['id'])->short() . " начался. ", $user->room); - //mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали ".date("Y.m.d H.i").", когда ".$rr." бросили вызов друг другу.
');"); - addlog($id,'Часы показывали '.date("Y.m.d H.i").', когда '.$rr.' бросили вызов друг другу.
'); + //mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали ".date("Y.m.d H.i").", когда ".$rr." бросили вызов друг другу.
');"); + addlog($id, 'Часы показывали ' . date("Y.m.d H.i") . ', когда ' . $rr . ' бросили вызов друг другу.
'); - mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']} OR `id` = {$us['id']}"); - header("Location:fbattle.php"); - exit(""); - } - } - elseif ($us['che']!=0 && rand(1,100) < 30) { - mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';"); - mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<= $us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); - addchp($coma[rand(0,count($coma)-1)],"Комментатор"); - echo "Все прошло удачно!"; - } - else { - echo "Полный провал!.."; - mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$user['id']."';"); - mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '".$us['che']."' LIMIT 1;"); - addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); - } + mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']} OR `id` = {$us['id']}"); + header("Location:fbattle.php"); + exit(""); + } + } elseif ($us['che'] != 0 && rand(1, 100) < 30) { + mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '" . $us['id'] . "';"); + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . ((($user['maxhp'] - $user['hp']) <= $us['hp']) ? ($user['maxhp'] - $user['hp']) : $us['hp']) . "' WHERE `id` = '" . $user['id'] . "';"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию."); + addchp($coma[rand(0, count($coma) - 1)], "Комментатор"); + echo "Все прошло удачно!"; + } else { + echo "Полный провал!.."; + mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '" . $user['id'] . "';"); + mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['che'] . "' LIMIT 1;"); + addch("{$golod} "{$user['login']}" {$action} на "{$target}", но {$otvet} достойный отпор вампиру."); + } - } + } - //mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$user['id']."','Заклятие молчания',".(time()+1800).",2);"); - //if (mysql_query("UPDATE `inventory` SET `needident` = 0 WHERE `id` = {$dress['id']} LIMIT 1;")) { - // echo "На персонажа \"{$target}\" наложено заклятие молчания "; - // $bet=1; - //} else { - //echo "Неправильное имя персонажа"; - //} - //} else - //{ - // echo "Неудачно..."; - // $bet=1; - //} + //mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$user['id']."','Заклятие молчания',".(time()+1800).",2);"); + //if (mysql_query("UPDATE `inventory` SET `needident` = 0 WHERE `id` = {$dress['id']} LIMIT 1;")) { + // echo "На персонажа \"{$target}\" наложено заклятие молчания "; + // $bet=1; + //} else { + //echo "Неправильное имя персонажа"; + //} + //} else + //{ + // echo "Неудачно..."; + // $bet=1; + //} } diff --git a/magic/wis_air_h1.php b/magic/wis_air_h1.php index 988d7f5..cb2c8d8 100644 --- a/magic/wis_air_h1.php +++ b/magic/wis_air_h1.php @@ -1,15 +1,16 @@ Цепь Исцеления [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 55; +$needint = 80; +$elem = 'a'; +$t_min = 1; +$t_max = 2; +$count = mt_rand($t_min, $t_max); +$mag_id = 114; +$log_text = "Цепь Исцеления [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,112 +19,129 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=Config::$elem_align[$user_elem][$elem]; - if($us) $dmg*=Config::$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= Config::$elem_align[$user_elem][$elem]; + if ($us) $dmg *= Config::$elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_air_m1.php b/magic/wis_air_m1.php index 4614535..fa86616 100644 --- a/magic/wis_air_m1.php +++ b/magic/wis_air_m1.php @@ -1,12 +1,13 @@ Молния [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 20; +$needint = 80; +$elem = 'a'; +$mag_id = 93; +$log_text = "Молния [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,121 +15,136 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=Config::$elem_align[$user_elem][$elem]; - if($us) $dmg*=Config::$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= Config::$elem_align[$user_elem][$elem]; + if ($us) $dmg *= Config::$elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_air_m2.php b/magic/wis_air_m2.php index 5dad328..919d6b3 100644 --- a/magic/wis_air_m2.php +++ b/magic/wis_air_m2.php @@ -1,12 +1,13 @@ Молния [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 35; +$needint = 100; +$elem = 'a'; +$mag_id = 94; +$log_text = "Молния [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_air_t1.php b/magic/wis_air_t1.php index 43c3314..98cb7f7 100644 --- a/magic/wis_air_t1.php +++ b/magic/wis_air_t1.php @@ -1,15 +1,16 @@ Цепь Молний [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 50; +$needmana = 55; +$needint = 80; +$elem = 'a'; +$t_min = 3; +$t_max = 4; +$count = mt_rand($t_min, $t_max); +$mag_id = 102; +$log_text = "Цепь Молний [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_air_t3.php b/magic/wis_air_t3.php index d6ea827..4a9e1fa 100644 --- a/magic/wis_air_t3.php +++ b/magic/wis_air_t3.php @@ -1,15 +1,16 @@ Цепь Молний [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 80; +$needint = 120; +$elem = 'a'; +$t_min = 3; +$t_max = 7; +$count = mt_rand($t_min, $t_max); +$mag_id = 104; +$log_text = "Цепь Молний [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_earth_k1.php b/magic/wis_earth_k1.php index 16e946a..1211c24 100644 --- a/magic/wis_earth_k1.php +++ b/magic/wis_earth_k1.php @@ -1,15 +1,16 @@ Каменный Дождь [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 50; +$needmana = 55; +$needint = 80; +$elem = 'e'; +$t_min = 3; +$t_max = 4; +$count = mt_rand($t_min, $t_max); +$mag_id = 105; +$log_text = "Каменный Дождь [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,109 +19,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_earth_m1.php b/magic/wis_earth_m1.php index dbf7a69..b7a09fa 100644 --- a/magic/wis_earth_m1.php +++ b/magic/wis_earth_m1.php @@ -1,12 +1,13 @@ Метеорит [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 20; +$needint = 80; +$elem = 'e'; +$mag_id = 96; +$log_text = "Метеорит [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_earth_m2.php b/magic/wis_earth_m2.php index df6fbb3..a9855f0 100644 --- a/magic/wis_earth_m2.php +++ b/magic/wis_earth_m2.php @@ -1,12 +1,13 @@ Метеорит [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 35; +$needint = 100; +$elem = 'e'; +$mag_id = 97; +$log_text = "Метеорит [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_earth_m3.php b/magic/wis_earth_m3.php index 99a17ab..c01d50d 100644 --- a/magic/wis_earth_m3.php +++ b/magic/wis_earth_m3.php @@ -1,12 +1,13 @@ Метеорит [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 300; +$needmana = 50; +$needint = 120; +$elem = 'e'; +$mag_id = 98; +$log_text = "Метеорит [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_p1.php b/magic/wis_fire_p1.php index 7dbf68f..5e27f7b 100644 --- a/magic/wis_fire_p1.php +++ b/magic/wis_fire_p1.php @@ -1,15 +1,16 @@ Пожирающее Пламя [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 50; +$needmana = 55; +$needint = 80; +$elem = 'f'; +$t_min = 3; +$t_max = 4; +$count = mt_rand($t_min, $t_max); +$mag_id = 108; +$log_text = "Пожирающее Пламя [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_p2.php b/magic/wis_fire_p2.php index 37bbb24..d37d737 100644 --- a/magic/wis_fire_p2.php +++ b/magic/wis_fire_p2.php @@ -1,15 +1,16 @@ Пожирающее Пламя [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 70; +$needmana = 65; +$needint = 100; +$elem = 'f'; +$t_min = 3; +$t_max = 5; +$count = mt_rand($t_min, $t_max); +$mag_id = 109; +$log_text = "Пожирающее Пламя [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_p3.php b/magic/wis_fire_p3.php index b3ae75d..3f2bcaf 100644 --- a/magic/wis_fire_p3.php +++ b/magic/wis_fire_p3.php @@ -1,15 +1,16 @@ Пожирающее Пламя [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 80; +$needint = 120; +$elem = 'f'; +$t_min = 3; +$t_max = 7; +$count = mt_rand($t_min, $t_max); +$mag_id = 110; +$log_text = "Пожирающее Пламя [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_t1.php b/magic/wis_fire_t1.php index bc8eb4f..73bfdda 100644 --- a/magic/wis_fire_t1.php +++ b/magic/wis_fire_t1.php @@ -1,15 +1,16 @@ Тепло Жизни [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 55; +$needint = 80; +$elem = 'f'; +$t_min = 1; +$t_max = 2; +$count = mt_rand($t_min, $t_max); +$mag_id = 120; +$log_text = "Тепло Жизни [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_t2.php b/magic/wis_fire_t2.php index 674d6eb..a29e901 100644 --- a/magic/wis_fire_t2.php +++ b/magic/wis_fire_t2.php @@ -1,15 +1,16 @@ Тепло Жизни [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 210; +$needmana = 65; +$needint = 100; +$elem = 'f'; +$t_min = 1; +$t_max = 3; +$count = mt_rand($t_min, $t_max); +$mag_id = 121; +$log_text = "Тепло Жизни [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_t3.php b/magic/wis_fire_t3.php index f29a19a..e143505 100644 --- a/magic/wis_fire_t3.php +++ b/magic/wis_fire_t3.php @@ -1,15 +1,16 @@ Тепло Жизни [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 330; +$needmana = 75; +$needint = 120; +$elem = 'f'; +$t_min = 1; +$t_max = 4; +$count = mt_rand($t_min, $t_max); +$mag_id = 122; +$log_text = "Тепло Жизни [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_v2.php b/magic/wis_fire_v2.php index 731d348..dc9dc1c 100644 --- a/magic/wis_fire_v2.php +++ b/magic/wis_fire_v2.php @@ -1,12 +1,13 @@ Вспышка [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 35; +$needint = 100; +$elem = 'f'; +$mag_id = 91; +$log_text = "Вспышка [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_fire_v3.php b/magic/wis_fire_v3.php index e217df0..7f4ecc9 100644 --- a/magic/wis_fire_v3.php +++ b/magic/wis_fire_v3.php @@ -1,137 +1,152 @@ Вспышка [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 300; +$needmana = 50; +$needint = 120; +$elem = 'f'; +$mag_id = 92; +$log_text = "Вспышка [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); - if (empty($_SESSION['uid'])) { header("Location: index.php"); exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_o1.php b/magic/wis_water_o1.php index 6c4573c..9d66b2c 100644 --- a/magic/wis_water_o1.php +++ b/magic/wis_water_o1.php @@ -1,12 +1,13 @@ Оледенение [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 20; +$needint = 80; +$elem = 'w'; +$mag_id = 99; +$log_text = "Оледенение [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_o2.php b/magic/wis_water_o2.php index 1bd5000..28d4345 100644 --- a/magic/wis_water_o2.php +++ b/magic/wis_water_o2.php @@ -1,12 +1,13 @@ Оледенение [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 35; +$needint = 100; +$elem = 'w'; +$mag_id = 100; +$log_text = "Оледенение [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -14,123 +15,138 @@ if (empty($_SESSION['uid'])) { exit; } -$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); +$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;")); $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); -if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if($us) $e_id=$us['id']; -else $e_id=$bot['id']; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if ($us) $e_id = $us['id']; +else $e_id = $bot['id']; if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) { + echo("У Вас нет необходимой книги магии!"); +} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) { echo "Персонаж в Вашей команде!"; -} elseif($user['login']==$_POST['target']) { +} elseif ($user['login'] == $_POST['target']) { echo "Герр Леопольд фон Захер Мазох был бы доволен Вами..."; -} elseif ($us && $us['battle']!=$user['battle']) { - echo "Персонаж не в Вашем бою!"; -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; -} elseif (!$us['online']&&!$bot) { +} elseif ($us && $us['battle'] != $user['battle']) { + echo "Персонаж не в Вашем бою!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; +} elseif (!$us['online'] && !$bot) { echo "Персонаж не в игре!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + } else { + $int = 0; + } + + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; } - + //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; // команды - $t1 = explode(";",$bat['t1']); - $t2 = explode(";",$bat['t2']); - if (in_array ($user['id'],$t1)) { - $us_team = "B1"; - $tar_team = "B2"; - } - else { - $us_team = "B2"; - $tar_team = "B1"; - } - - $targeted=' на '.Nick::id($target)->short(); + $t1 = explode(";", $bat['t1']); + $t2 = explode(";", $bat['t2']); + if (in_array($user['id'], $t1)) { + $us_team = "B1"; + $tar_team = "B2"; + } else { + $us_team = "B2"; + $tar_team = "B1"; + } + + $targeted = ' на ' . Nick::id($target)->short(); //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - else - echo "Не нарушайте покой мертвых!"; - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - //проверка hp>0 - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + echo "Не нарушайте покой мертвых!"; + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + //проверка hp>0 + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_r1.php b/magic/wis_water_r1.php index 46a617b..410a482 100644 --- a/magic/wis_water_r1.php +++ b/magic/wis_water_r1.php @@ -1,15 +1,16 @@ Регенерация [1]"; - $book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 150; +$needmana = 55; +$needint = 80; +$elem = 'w'; +$t_min = 1; +$t_max = 2; +$count = mt_rand($t_min, $t_max); +$mag_id = 123; +$log_text = "Регенерация [1]"; +$book = 866; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_r2.php b/magic/wis_water_r2.php index 6ad1702..0489ef3 100644 --- a/magic/wis_water_r2.php +++ b/magic/wis_water_r2.php @@ -1,15 +1,16 @@ Регенерация [2]"; - $book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 210; +$needmana = 65; +$needint = 100; +$elem = 'w'; +$t_min = 1; +$t_max = 3; +$count = mt_rand($t_min, $t_max); +$mag_id = 124; +$log_text = "Регенерация [2]"; +$book = 908; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_r3.php b/magic/wis_water_r3.php index 70a525d..0fc5784 100644 --- a/magic/wis_water_r3.php +++ b/magic/wis_water_r3.php @@ -1,15 +1,16 @@ Регенерация [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 330; +$needmana = 75; +$needint = 120; +$elem = 'w'; +$t_min = 1; +$t_max = 4; +$count = mt_rand($t_min, $t_max); +$mag_id = 125; +$log_text = "Регенерация [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { @@ -18,113 +19,130 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t1; -if(in_array($user['id'],$t2)) $e_team=$t2; -foreach($e_team as $k=>$l) -{ - if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); - else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); - if($e_hp['hp']<1) unset($e_team[$k]); +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t1; +if (in_array($user['id'], $t2)) $e_team = $t2; +foreach ($e_team as $k => $l) { + if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;")); + else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;")); + if ($e_hp['hp'] < 1) unset($e_team[$k]); } shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} - - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; - } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; - } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - - //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $delta=$us['maxhp']-$us['hp']; - else $delta=$b_maxhp-$bot['hp']; - if($delta<$dmg) $dmg=floor($delta); - if($dmg<1) $dmg=0; - - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit='-1'; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - addlog($user['battle'],''.date("H:i").' '.$action.' +'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; } + } else { + $int = 0; } - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; + } + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; + } + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + + //mass magic + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $delta = $us['maxhp'] - $us['hp']; + else $delta = $b_maxhp - $bot['hp']; + if ($delta < $dmg) $dmg = floor($delta); + if ($dmg < 1) $dmg = 0; + + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = '-1'; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' +' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/magic/wis_water_tr3.php b/magic/wis_water_tr3.php index a7b376b..ff3ab23 100644 --- a/magic/wis_water_tr3.php +++ b/magic/wis_water_tr3.php @@ -1,15 +1,16 @@ Отравление [3]"; - $book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); +$basedmg = 110; +$needmana = 80; +$needint = 120; +$elem = 'w'; +$t_min = 3; +$t_max = 7; +$count = mt_rand($t_min, $t_max); +$mag_id = 113; +$log_text = "Отравление [3]"; +$book = 909; +$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;")); if (empty($_SESSION['uid'])) { header("Location: index.php"); @@ -17,109 +18,128 @@ if (empty($_SESSION['uid'])) { } $magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;")); -$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); +$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); //mana needed -$t1 = explode(";",$bat['t1']); -$t2 = explode(";",$bat['t2']); -if(in_array($user['id'],$t1)) $e_team=$t2; -if(in_array($user['id'],$t2)) $e_team=$t1; +$t1 = explode(";", $bat['t1']); +$t2 = explode(";", $bat['t2']); +if (in_array($user['id'], $t1)) $e_team = $t2; +if (in_array($user['id'], $t2)) $e_team = $t1; shuffle($e_team); if ($user['battle'] == 0) { - echo "Это боевая магия..."; + echo "Это боевая магия..."; } elseif (!$have_book['id']) { - echo("У Вас нет необходимой книги магии!"); -} elseif ($user['mana']<$needmana) { - echo "Недостаточно энергии!"; + echo("У Вас нет необходимой книги магии!"); +} elseif ($user['mana'] < $needmana) { + echo "Недостаточно энергии!"; } else { - //attack script - if ($user['intel'] >= $needint) { - $int=$magic['chanse'] + ($user['intel'] - $needint)*3; - if ($int>98){$int=99;} - } - else {$int=0;} + //attack script + if ($user['intel'] >= $needint) { + $int = $magic['chanse'] + ($user['intel'] - $needint) * 3; + if ($int > 98) { + $int = 99; + } + } else { + $int = 0; + } - if (rand(1,100) < $int) { - global $elem_align,$elem_bonus; - $user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2))); - - switch($user_elem) - { - case 'f':$uel='mfire';break; - case 'a':$uel='mair';break; - case 'w':$uel='mwater';break; - case 'e':$uel='mearth';break; + if (rand(1, 100) < $int) { + global $elem_align, $elem_bonus; + $user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2))); + + switch ($user_elem) { + case 'f': + $uel = 'mfire'; + break; + case 'a': + $uel = 'mair'; + break; + case 'w': + $uel = 'mwater'; + break; + case 'e': + $uel = 'mearth'; + break; } - switch($elem) - { - case 'f':$sel='mfire';break; - case 'a':$sel='mair';break; - case 'w':$sel='mwater';break; - case 'e':$sel='mearth';break; + switch ($elem) { + case 'f': + $sel = 'mfire'; + break; + case 'a': + $sel = 'mair'; + break; + case 'w': + $sel = 'mwater'; + break; + case 'e': + $sel = 'mearth'; + break; } - $sex_action="применил";if($user['sex']==0) $sex_action.="а"; - addlog($user['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'
'); - + $sex_action = "применил"; + if ($user['sex'] == 0) $sex_action .= "а"; + addlog($user['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '
'); + //mass magic - mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';"); - foreach($e_team as $v) - if($count>0) - { - $count--; - $bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); - $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); - if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];} - //dmg=base+INT/LVL+X_magic - $dmg=$basedmg+($user['intel']/4)+$user[$sel]; - //MF - $dmg*=$elem_align[$user_elem][$elem]; - if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))]; - //- MF - if($us) { - $def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100); - $dmg-=$def; - } - //rand +- 25% - $dmg=mt_rand(0.75*$dmg,1.25*$dmg); - $dmg=round($dmg); - if($us) $target=$us['id']; - else $target=$bot['id']; - - $targeted=''; - //dmg >0 - go - $all_dmg=unserialize($bat['damage']); - $all_exp=unserialize($bat['exp']); - $all_dmg[$user['id']]+=$dmg; - $all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg); - - //сработало - if($dmg>0) $hit=1; else $hit=0; - $action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target)); - if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1))) - if($dmg>0) - { - if($us) - mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - else - mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';"); - mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';"); - - - addlog($user['battle'],''.date("H:i").' '.$action.' -'.$dmg.'
'); - - $bet=1; - } - else - //не сработало - { - addlog($user['battle'],''.date("H:i").' '.$action.'
'); - $bet=1; - } - } - - } else { - echo "Свиток рассыпался в ваших руках..."; - $bet=1; - } + mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';"); + foreach ($e_team as $v) + if ($count > 0) { + $count--; + $bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';")); + $us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;")); + if (!$us) { + $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;")); + $b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;")); + $b_maxhp = $b_maxhp['maxhp']; + } + //dmg=base+INT/LVL+X_magic + $dmg = $basedmg + ($user['intel'] / 4) + $user[$sel]; + //MF + $dmg *= $elem_align[$user_elem][$elem]; + if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))]; + //- MF + if ($us) { + $def = magic_def($elem, $_POST['target'], $user_elem); + $dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100); + $dmg -= $def; + } + //rand +- 25% + $dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg); + $dmg = round($dmg); + if ($us) $target = $us['id']; + else $target = $bot['id']; + + $targeted = ''; + //dmg >0 - go + $all_dmg = unserialize($bat['damage']); + $all_exp = unserialize($bat['exp']); + $all_dmg[$user['id']] += $dmg; + $all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg); + + //сработало + if ($dmg > 0) $hit = 1; else $hit = 0; + $action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target)); + if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1))) + if ($dmg > 0) { + if ($us) + mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + else + mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';"); + mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';"); + + + addlog($user['battle'], '' . date("H:i") . ' ' . $action . ' -' . $dmg . '
'); + + $bet = 1; + } else //не сработало + { + addlog($user['battle'], '' . date("H:i") . ' ' . $action . '
'); + $bet = 1; + } + } + + } else { + echo "Свиток рассыпался в ваших руках..."; + $bet = 1; + } } diff --git a/main.php b/main.php index c2da4e8..3b894f4 100644 --- a/main.php +++ b/main.php @@ -6,11 +6,6 @@ if ($get == 'exit') { session_destroy(); header("Location: fight.php"); } -if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} - require_once 'functions.php'; try { @@ -18,15 +13,6 @@ try { } catch (\Krugozor\Database\Mysql\Exception $e) { echo "
Ошибка: " . $e->getMessage() . "
Стек: " . $e->getTraceAsString() . "
"; } -if ($user->battle) { - header('location: fbattle.php'); - exit(); -} -//БС -if ($user->in_tower == 1) { - header('Location: towerin.php'); - exit(); -} // Инициализируем входящие GET\POST переменные. $goto = $_GET['goto'] ?? null; @@ -77,125 +63,8 @@ if ($edit === null) { header('Location: city.php'); exit(); } - if ($user->room == 22) { - header('Location: shop.php'); - exit(); - } - if ($user->room == 23) { - header('Location: repair.php'); - exit(); - } - if ($user->room == 25) { - header('Location: comission.php'); - exit(); - } - if ($user->room == 27) { - header('Location: post.php'); - exit(); - } - if ($user->room == 29) { - header('Location: bank.php'); - exit(); - } - if ($user->room == 31) { - header('Location: tower.php'); - exit(); - } - if ($user->room == 30) { - header('Location: clan_create.php'); - exit(); - } - if ($user->room == 34) { - header('Location: fshop.php'); - exit(); - } - if ($user->room == 45) { - header('Location: clan_castle.php'); - exit(); - } - if ($user->room == 53) { - header('Location: library.php'); - exit(); - } - if ($user->room == 61) { - header('Location: akadem.php'); - exit(); - } - if ($user->room == 650) { - header('Location: ul_clans.php'); - exit(); - } -//ЦХ - if ($user->room == 600) { - header('Location: c_haos.php'); - exit(); - } - if ($user->room == 601) { - header('Location: c_haos_in.php'); - exit(); - } - if ($user->room == 602) { - header('Location: c_park.php'); - exit(); - } - if ($user->room == 603) { - header('Location: aren_of_angels.php'); - exit(); - } - if ($user->room == 620) { - header('Location: enter_cave.php'); - exit(); - } - if ($user->room == 621) { - header('Location: cave.php'); - exit(); - } - if ($user->room == 660) { - header('Location: hostel.php'); - exit(); - } - if ($user->room == 661) { - header('Location: hostel_room.php'); - exit(); - } - if ($user->room == 662) { - header('Location: quest_room.php'); - exit(); - } - if ($user->room == 760) { - header('Location: c_forest.php'); - exit(); - } - if ($user->room == 1000) { - header('Location: solib/enterbezdna.php'); - exit(); - } - if ($user->room == 1001) { - header('Location: solib/dungeon.php'); - exit(); - } - if ($user->room == 1051) { - header('Location: lab_enter.php'); - exit(); - } - if ($user->room == 1052) { - header('Location: labirint.php'); - exit(); - } - if ($user->room == 402) { - header('Location: vxod.php'); - exit(); - } - if ($user->room == 403) { - header('Location: canalizaciya.php'); - exit(); - } - if ($user->room == 1055) { - header('Location: group_arena.php'); - exit(); - } - if ($user->room == 666) { - header('Location: jail.php'); + if (in_array($user->room, [22, 23, 25, 27, 29, 30, 31, 34, 45, 53, 61, 402, 403, 600, 601, 602, 603, 620, 621, 650, 660, 661, 662, 666, 760, 1051, 1052, 1055])) { + header('location: ' . \Battles\Travel::$roomFileName[$user->room]); exit(); } } @@ -557,7 +426,7 @@ if ($edit) {
room == 20): ?> - + room == 1): ?> diff --git a/podzem/atk.php b/podzem/atk.php index 0ecc6b3..a920c82 100644 --- a/podzem/atk.php +++ b/podzem/atk.php @@ -1,65 +1,56 @@ 0)) header("Location: index.php"); - if ($user->battle) { header('location: fbattle.php'); exit; } - include "../config.php"; -if($_GET['act']=="atk"){ -$ass = mysql_query("SELECT glav_id,glava,name FROM labirint WHERE user_id=".$user['id'].""); -$lab = mysql_fetch_array($ass); -$glav_id = $lab["glav_id"]; -$asx = mysql_query("SELECT login FROM labirint WHERE glav_id='$glav_id' and boi='".$_GET['n']."'"); -if(!$lax = mysql_fetch_array($asx)){ -$f = mysql_query("SELECT `n".$_GET['n']."` FROM podzem3 WHERE glava='".$lab["glava"]."' and name='".$lab["name"]."'"); -$rt = mysql_fetch_array($f); - - -startpod($user['login'],$rt['n'.$_GET['n'].''],$_GET['n'],$user); - -}else{ - -$jert = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '".$lax["login"]."' LIMIT 1;")); -if($jert['id']!=$user['id']) { - - $bet=1; - //арх - if($jert['id'] > _BOTSEPARATOR_) { - $arha = mysql_fetch_array(mysql_query ('SELECT * FROM `bots` WHERE `prototype` = '.$jert['id'].' LIMIT 1;')); - $jert['battle'] = $arha['battle']; - $jert['id'] = $arha['id']; - $bot=1; - } - if($jert['battle'] > 0) { - //вмешиваемся - $bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$jert['battle'].' LIMIT 1;')); - $battle = unserialize($bd['teams']); - $battle[$user['id']] = $battle[$jert['id']]; - foreach($battle[$user['id']] as $k => $v) { - $battle[$k][$user['id']] = array(0,0,time()); - } - $t1 = explode(";",$bd['t1']); - - // проставляем кто-где - if (in_array ($jert['id'],$t1)) { - $ttt = 1; - } else { - $ttt = 2; - } - -//addch ("".nick7($user['id'])." вмешался в поединок »». ",$user->room); +session_start(); +require_once "functions.php"; +if ($_GET['act'] == "atk") { + $ass = mysql_query("SELECT glav_id,glava,name FROM labirint WHERE user_id=" . $user['id'] . ""); + $lab = mysql_fetch_array($ass); + $glav_id = $lab["glav_id"]; + $asx = mysql_query("SELECT login FROM labirint WHERE glav_id='$glav_id' and boi='" . $_GET['n'] . "'"); + if (!$lax = mysql_fetch_array($asx)) { + $f = mysql_query("SELECT `n" . $_GET['n'] . "` FROM podzem3 WHERE glava='" . $lab["glava"] . "' and name='" . $lab["name"] . "'"); + $rt = mysql_fetch_array($f); + startpod($user['login'], $rt['n' . $_GET['n'] . ''], $_GET['n'], $user); -addlog($jert['battle'],''.date("H:i").' '.Nick::id($user['id'])->short().' вмешался в поединок1!
'); + } else { -mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$user['id'].'\') WHERE `id` = '.$jert['battle'].' ;'); + $jert = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '" . $lax["login"] . "' LIMIT 1;")); + if ($jert['id'] != $user['id']) { -mysql_query("UPDATE users SET `battle` =".$jert['battle'].",`zayavka`=0 WHERE `id`= ".$user['id']); -mysql_query("UPDATE `labirint` SET `boi`='".$_GET['n']."',`di`='0' WHERE `user_id`='".$user['id']."'"); + $bet = 1; + //арх + if ($jert['id'] > _BOTSEPARATOR_) { + $arha = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `prototype` = ' . $jert['id'] . ' LIMIT 1;')); + $jert['battle'] = $arha['battle']; + $jert['id'] = $arha['id']; + $bot = 1; + } + if ($jert['battle'] > 0) { + //вмешиваемся + $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $jert['battle'] . ' LIMIT 1;')); + $battle = unserialize($bd['teams']); + $battle[$user['id']] = $battle[$jert['id']]; + foreach ($battle[$user['id']] as $k => $v) { + $battle[$k][$user['id']] = [0, 0, time()]; + } + $t1 = explode(";", $bd['t1']); -}}} + // проставляем кто-где + if (in_array($jert['id'], $t1)) { + $ttt = 1; + } else { + $ttt = 2; + } + addlog($jert['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вмешался в поединок1!
'); + mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\') WHERE `id` = ' . $jert['battle'] . ' ;'); + mysql_query("UPDATE users SET `battle` =" . $jert['battle'] . ",`zayavka`=0 WHERE `id`= " . $user['id']); + mysql_query("UPDATE `labirint` SET `boi`='" . $_GET['n'] . "',`di`='0' WHERE `user_id`='" . $user['id'] . "'"); + } + } + } - -print ""; -exit; + print ""; + exit; } diff --git a/podzem/edit.php b/podzem/edit.php index 62270cc..527df37 100644 --- a/podzem/edit.php +++ b/podzem/edit.php @@ -1,51 +1,51 @@ 0)) header("Location: index.php"); - include "../config.php"; - $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); - if ($user['login']=="testik2" || $user['login']=="-apollon-") { +session_start(); +require_once "../config.php"; +$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); +if ($user['admin']) { + ?> +
+ + + +
+ + + + +
+ " . $sc['name'] . "
"; -?> - - -
- - - - + - -
-".$sc['name']."
"; + } + ?> -} -?> - -
- -
- - -location.href='main.php?act=none'"; -exit;} -if($_GET['news']){ -$SQL2 = mysql_query("INSERT INTO podzem2(name) VALUES('".$_GET['name']."')"); -print ""; -exit;} +
- }else{ ?> - - - + + + + location.href='main.php?act=none'"; + exit; + } + if ($_GET['news']) { + $SQL2 = mysql_query("INSERT INTO podzem2(name) VALUES('" . $_GET['name'] . "')"); + print ""; + exit; + } -
- -
- + + + +
+
+ \ No newline at end of file diff --git a/podzem/edit_podzem.php b/podzem/edit_podzem.php index 1ccc143..3bb6d3c 100644 --- a/podzem/edit_podzem.php +++ b/podzem/edit_podzem.php @@ -3,7 +3,7 @@ if ($user->battle) { header('location: fbattle.php'); exit; } include "../config.php"; $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); - if ($user['login']=="testik2" || $user['login']=="-apollon-" ) { + if ($user['admin']) { ?> diff --git a/podzem_dialog.php b/podzem_dialog.php index fc662d3..87d823a 100644 --- a/podzem_dialog.php +++ b/podzem_dialog.php @@ -1,16 +1,7 @@ battle) { - header('location: fbattle.php'); - exit; -} $df = mysql_query("select `location`,`name`,`glava` from `labirint` where `user_id`='" . $_SESSION['uid'] . "'"); $fd = mysql_fetch_array($df); $cd = mysql_query("select `n18` from `podzem3` where `glava`='" . $fd['glava'] . "' and `name`='Канализация 1 этаж'"); diff --git a/post.php b/post.php index d38b3f4..95efccb 100644 --- a/post.php +++ b/post.php @@ -1,20 +1,7 @@ room != 27) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); if ($_GET['change'] ?? 0) { unset($_SESSION['receiverName']); } diff --git a/presents.php b/presents.php index 1df19cf..24639c3 100644 --- a/presents.php +++ b/presents.php @@ -14,7 +14,10 @@ */ session_start(); -if ($_SESSION['uid'] != 2) header("Location: index.php"); +if ($_SESSION['uid'] != 2) { + header("Location: index.php"); + exit; +} require_once 'config.php'; $user = new \Battles\User($_SESSION['uid']); diff --git a/repair.php b/repair.php index 35b5185..f1d87f4 100644 --- a/repair.php +++ b/repair.php @@ -1,19 +1,7 @@ query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc(); -if ($user->room != 23) { - header("Location: main.php"); - exit(); -} -if ($user->battle) { - header('location: fbattle.php'); - exit(); -} define('GRAV_LIMIT', 32); define('GRAV_COST', 30); define('REPAIR_STATUS', [ diff --git a/shop.php b/shop.php index 2d94636..80d6712 100644 --- a/shop.php +++ b/shop.php @@ -1,23 +1,8 @@ room != 22) { - header("Location: main.php"); - exit; -} -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - +$user = $user ?? new \Battles\User($_SESSION['uid']); /* * aheroshop.php * $data = db::c()->query('SELECT * FROM `ahero_shop` WHERE `count` > 0 AND `razdel` = ?i ORDER by `point` ASC', $_GET['otdel']); diff --git a/tournament.php b/tournament.php index f173613..2c76008 100644 --- a/tournament.php +++ b/tournament.php @@ -1,16 +1,7 @@ battle) { - header('location: fbattle.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); $Tournament = new Tournament(); \Battles\Template::header('Турниры'); ?> diff --git a/tower.php b/tower.php index 90da4d2..7adde1a 100644 --- a/tower.php +++ b/tower.php @@ -1,20 +1,6 @@ room != 31) { - header("Location: main.php"); - exit; -} -if ($user['in_tower'] == 1) { - header('Location: towerin.php'); - exit; -} - - class predbannik_bs { public $userid = 0; diff --git a/towerin.php b/towerin.php index ad140e2..f02e833 100644 --- a/towerin.php +++ b/towerin.php @@ -1,19 +1,11 @@ battle) { - header('Location: fbattle.php'); - exit; -} $rooms[0] = ''; $rhar = [ diff --git a/towerstamp.php b/towerstamp.php index 4dbe162..a096f81 100644 --- a/towerstamp.php +++ b/towerstamp.php @@ -1,107 +1,127 @@ battle) { header('location: fbattle.php'); exit; } -if($user->room != 31) { exit('Для распределения статов необходимо находиться в прихожей "Башни смерти"'); } -if(isset($effect['id'])) { exit('Для распределения статов на Вас не дожно быть никаких эффектов'); } +if ($user->room != 31) { + exit('Для распределения статов необходимо находиться в прихожей "Башни смерти"'); +} +if (isset($effect['id'])) { + exit('Для распределения статов на Вас не дожно быть никаких эффектов'); +} undressall($user['id']); -if((int)$_GET['delsn'] > 0) { - mysql_query("DELETE FROM `deztow_charstams` WHERE `id` = '".(int)$_GET['delsn']."' AND `name` = '".$_GET['ddname']."' AND `owner` = '".(int)$user['id']."' LIMIT 1"); +if ((int)$_GET['delsn'] > 0) { + mysql_query("DELETE FROM `deztow_charstams` WHERE `id` = '" . (int)$_GET['delsn'] . "' AND `name` = '" . $_GET['ddname'] . "' AND `owner` = '" . (int)$user['id'] . "' LIMIT 1"); } -if($_POST['name']) { - $stats = 83; +if ($_POST['name']) { + $stats = 83; - if($stats == abs($_POST['sila'])+abs($_POST['lovk'])+abs($_POST['inta'])+abs($_POST['vinos'])+abs($_POST['intel'])) { - mysql_query("INSERT `deztow_charstams` (`owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`) VALUES ('".$user['id']."', '".$_POST['name']."', '".abs($_POST['sila'])."', '".abs($_POST['lovk'])."', '".abs($_POST['inta'])."', '".abs($_POST['vinos'])."', '".abs($_POST['intel'])."') ON DUPLICATE KEY UPDATE `sila` = '".abs($_POST['sila'])."', `lovk` = '".abs($_POST['lovk'])."', `inta` = '".abs($_POST['inta'])."', `vinos` = '".abs($_POST['vinos'])."', `intel` = '".abs($_POST['intel'])."'"); - echo "Сохранено!".mysql_error(); - } else { - echo "Что-то не то со статами... сумму проверьте. Необходимо использовать все статы!"; - } + if ($stats == abs($_POST['sila']) + abs($_POST['lovk']) + abs($_POST['inta']) + abs($_POST['vinos']) + abs($_POST['intel'])) { + mysql_query("INSERT `deztow_charstams` (`owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`) VALUES ('" . $user['id'] . "', '" . $_POST['name'] . "', '" . abs($_POST['sila']) . "', '" . abs($_POST['lovk']) . "', '" . abs($_POST['inta']) . "', '" . abs($_POST['vinos']) . "', '" . abs($_POST['intel']) . "') ON DUPLICATE KEY UPDATE `sila` = '" . abs($_POST['sila']) . "', `lovk` = '" . abs($_POST['lovk']) . "', `inta` = '" . abs($_POST['inta']) . "', `vinos` = '" . abs($_POST['vinos']) . "', `intel` = '" . abs($_POST['intel']) . "'"); + echo "Сохранено!" . mysql_error(); + } else { + echo "Что-то не то со статами... сумму проверьте. Необходимо использовать все статы!"; + } } -$tec = mysql_fetch_array(mysql_query("SELECT `id`, `owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `mudra`, `def` FROM `deztow_charstams` WHERE `owner` = '{$user['id']}' AND `id` = '".(int)$_GET['id']."' LIMIT 1")); +$tec = mysql_fetch_array(mysql_query("SELECT `id`, `owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `mudra`, `def` FROM `deztow_charstams` WHERE `owner` = '{$user['id']}' AND `id` = '" . (int)$_GET['id'] . "' LIMIT 1")); -if(!isset($tec['id'])) { - $tec['sila'] = 3; - $tec['lovk'] = 3; - $tec['inta'] = 3; - $tec['vinos'] = 10; - $tec['intel'] = 0; +if (!isset($tec['id'])) { + $tec['sila'] = 3; + $tec['lovk'] = 3; + $tec['inta'] = 3; + $tec['vinos'] = 10; + $tec['intel'] = 0; } -if($_GET['setdef']){ - mysql_query("UPDATE `deztow_charstams` SET `def` = 1 WHERE `owner` = '{$user['id']}' AND `id` = ".(int)$_GET['setdef']." LIMIT 1"); - mysql_query("UPDATE `deztow_charstams` SET `def` = 0 WHERE `owner` = '{$user['id']}' AND `id` != ".(int)$_GET['setdef'].""); - echo "Сохранено.".mysql_error(); +if ($_GET['setdef']) { + mysql_query("UPDATE `deztow_charstams` SET `def` = 1 WHERE `owner` = '{$user['id']}' AND `id` = " . (int)$_GET['setdef'] . " LIMIT 1"); + mysql_query("UPDATE `deztow_charstams` SET `def` = 0 WHERE `owner` = '{$user['id']}' AND `id` != " . (int)$_GET['setdef'] . ""); + echo "Сохранено." . mysql_error(); } \Battles\Template::header('towerstamp'); ?> -

Профили характеристик

- Статы не позволяют сходить в БС? Раскиньте ваши статы так, как вы хотите, и участвуйте в турнире! Выбранный по умолчанию профиль, загрузится сам. Вы можете создавать неограниченное число профилей, и менять их за секунды до турнира! -

-
+

Профили характеристик

+Статы не позволяют сходить в БС? Раскиньте ваши статы так, как вы хотите, и участвуйте в турнире! Выбранный по умолчанию профиль, загрузится сам. Вы можете создавать неограниченное число профилей, и менять их за секунды до турнира! +

+
- - - \n"; - } - ?> -
НазваниеПо ум.Удалить
{$row['name']}".($row['def']?"По умолчанию":"Установить")."X

- - - - Назв.: - - - - - - - - - - - - - - - - - - - - - - -
Характеристика  Знач.
Сила
Ловкость
Интуиция
Выносливость
Интеллект
Свободных
- - \ No newline at end of file + +
+ Назв.: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Характеристика  Знач.
Сила +
Ловкость +
Интуиция +
Выносливость +
Интеллект +
Свободных
+ +
\ No newline at end of file diff --git a/ul_clans.php b/ul_clans.php index 58a7335..5099a7c 100644 --- a/ul_clans.php +++ b/ul_clans.php @@ -1,23 +1,7 @@ room != 650) { - header("Location: main.php"); - exit; -} - -if ($user->battle) { - header('location: fbattle.php'); - exit; -} - if ($_GET['id'] && $user->admin) { echo "Пробуем перейти на выбранную замковую улицу..."; $_SESSION["klan"] = $_GET['klan']; diff --git a/user_abilities.php b/user_abilities.php index e417335..4f8c4a7 100644 --- a/user_abilities.php +++ b/user_abilities.php @@ -7,12 +7,8 @@ */ session_start(); -if (empty($_SESSION['uid'])) { - header("Location: index.php"); - exit; -} require_once 'functions.php'; -$user = $user ?? []; +$user = $user ?? new \Battles\User($_SESSION['uid']); if (!empty($_GET['teleport']) && $user->admin == 1) { db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']); } diff --git a/user_anketa.php b/user_anketa.php index 6cdfc05..983affd 100644 --- a/user_anketa.php +++ b/user_anketa.php @@ -1,15 +1,6 @@ battle) { - header('Location: /fbattle.php'); - exit(); -} - define('INFO_CHAR_LIMIT', 1500); $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING); $oldpsw = filter_input(INPUT_POST, 'oldpsw', FILTER_SANITIZE_SPECIAL_CHARS); diff --git a/vxod.php b/vxod.php index e99db4c..b2d5dd9 100644 --- a/vxod.php +++ b/vxod.php @@ -1,15 +1,7 @@ battle) { - header('location: fbattle.php'); - exit; -} +$user = $user ?? new \Battles\User($_SESSION['uid']); if ($user->level < 4 && $user->level > 10) { header('location: main.php?act=none'); exit; @@ -19,11 +11,6 @@ if ($user->room == 403) { header('Location: canalizaciya.php'); exit; } -if ($user->room != 402) { - header('Location: main.php'); - exit; -} - \Battles\Template::header('Вход в водосток'); ?>