- if($user['room']==37) { echo " "; } ?>
- if($user['room']==38) { echo " "; } ?>
- if($user['room']==39) { echo " "; } ?>
- if($user['room']==40) { echo " "; } ?>
- if($user['room']==41) { echo " "; } ?>
-
-
+/* Разрушенный замок на замковой улице.
+ * */
+session_start();
+define("CASTLE_MAX_LEVEL", 10);
+if ($_SESSION['uid'] == null) header("Location: index.php");
+require_once 'functions.php';
- if($user['room'] == 38) {
- $glava = mysql_fetch_array(mysql_query("SELECT `glava` FROM `clans` WHERE `short` = '".$user['klan']."' LIMIT 1;"));
+if (!($user['room'] >= 37 AND $user['room'] <= 41)) {
+ header("Location: main.php");
+ die();
+}
- echo "Арсенал ";
- ?>
-
-
- echo "
- Хранилище вещей клана. К сожалению перкочует к новому владельцу вместе с замком...
";
- // возврат шмотки
- if($_GET['back']) {
- $it = mysql_fetch_array(mysql_query("SELECT * FROM `gotzam_arsenal` WHERE `id` = ".$_GET['back'].";"));
- if($it['owner'] ==$user['id'] OR $user['id']==$glava[0]) {
- err("Вы забрали вещь из арсенала.");
- mysql_query("update `inventory` SET `owner` = ".$user['id']." WHERE `id` = ".$it['id_it'].";");
- mysql_query("delete from `gotzam_arsenal` WHERE `id` = ".$_GET['back'].";");
- }
- }
- // положить шмотку
- if($_GET['add']) {
- $it = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `dressed`=0 AND `setsale` = 0 AND `owner` =".$user['id']." AND `id` = ".$_GET['add'].";"));
- if($it['owner'] ==$user['id']) {
- err("Вы оставили вещь в арсенале.");
- mysql_query("update `inventory` SET `owner` = '' WHERE `id` = ".$it['id'].";");
- mysql_query("insert `gotzam_arsenal` (`id_it`,`owner`) values (".$it['id'].",".$user['id'].");");
- }
- }
- if(!$_GET['do']) {
- $data = mysql_query("SELECT * FROM `gotzam_arsenal`;");
+$zam = db::c()->query('SELECT * FROM `variables` WHERE `var` = "?s"', 'gotzamok')->fetch_assoc();
+if ($zam['value'] == $user['klan']) {
+ // если мой клан
+ if ($_GET['goto'] == 'arsenal') $user['room'] = 38;
+ if ($_GET['goto'] == 'home') $user['room'] = 37;
+ if ($_GET['goto'] == 'dvor') $user['room'] = 39;
+ if ($_GET['goto'] == 'master') $user['room'] = 40;
+ if ($_GET['goto'] == 'rest') $user['room'] = 41;
+ if (in_array($_GET['goto'], ['arsenal', 'home', 'dvor', 'master', 'rest'])) {
+ db::c()->query('UPDATE `users`,`online` SET `users`.`room` = ?i,`online`.`room` = ?i WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $user['room'], $user['room'], $_SESSION['uid']);
+ header('location: gotzamok.php');
+ } else $status = 'В этом замке нет такого места!';
+}
- echo '';
- while($it = mysql_fetch_array($data)) {
- $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$it['id_it']}' LIMIT 1;"));
- $row['count'] = 1;
- if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; }
- echo "
-
- Положил: ".nick::id($it['owner'])->full(1)." ";
- ?>
+switch ($user['room']) {
+ case '37' :
+ $backgroundImage = '689_small_550.jpg';
+ break;
+ case '41' :
+ $backgroundImage = 'ko.jpg';
+ break;
+}
-
- if($it['owner'] ==$user['id'] OR $user['id']==$glava[0]) {
- ?>забрать
- }
- else {
- echo 'Вы не можете забрать эту вещь из арсенала ';
- }
- ?>
-
- ";
- showitem ($row);
- echo " ";
- }
- echo "
"; }
- else {
- echo '';
- $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `setsale`=0 ORDER by `update` DESC; ");
- while($row = mysql_fetch_array($data)) {
- $row['count'] = 1;
- if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; }
- echo " ";
- ?>
- сдать в арсенал
-
- ";
- showitem ($row);
- echo " ";
- }
- echo "
";
- }
- }
+if ($user['room'] == 38) {
+ $glava = db::c()->query('SELECT `glava` FROM `clans` WHERE `short` = "?s"', $user['klan'])->fetch_assoc();
+ // возврат шмотки
+ if ($_GET['back']) {
+ $item = db::c()->query('SELECT * FROM `gotzam_arsenal` WHERE `id` = ?i', $_GET['back'])->fetch_assoc();
- if($user['room'] == 40) {
+ if ($_SESSION['uid'] == $item['owner'] OR $_SESSION['uid'] == $glava['glava']) {
+ $status = 'Вы забрали вещь из арсенала.';
+ db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id` = ?i', $_SESSION['uid'], $item['id_it']);
+ db::c()->query('DELETE FROM `gotzam_arsenal` WHERE `id` = ?i', $_GET['back']);
+ }
+ }
+ // положить шмотку
+ if ($_GET['add']) {
+ $item = db::c()->query('SELECT * FROM `inventory` WHERE `dressed`=0 AND `setsale` = 0 AND `owner` =?i AND `id` = ?i', $_SESSION['uid'], $_GET['add'])->fetch_assoc();
- $at = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_att' LIMIT 1;"));
- $def = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_def' LIMIT 1;"));
- $level = mysql_fetch_array(mysql_query("SELECT `level` FROM `users` WHERE `id` = (SELECT `glava` FROM `clans` WHERE `short` = '".$user['klan']."') LIMIT 1;"));
- if($_GET['up']=='at') {
- if($at[1] >= $level[0]) {
- err("Укрепление достигло максимального уровня");
- }
- elseif((pow(52,$at[1]+1)) <= $user['money']) {
- mysql_query("update users set money = money - ".(pow(52,$at[1]+1))." where id = ".$user['id'].";");
- mysql_query("update `variables` set value=value+1 WHERE `var` = 'gotzam_att' LIMIT 1;");
+ if ($_SESSION['uid'] == $it['owner']) {
+ $status = 'Вы оставили вещь в арсенале.';
+ db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id` = ?i', -5, $item['id']);
+ db::c()->query('INSERT INTO `gotzam_arsenal` (`id_it`, `owner`) VALUES (?i, ?i)', $item['id'], $_SESSION['uid']);
+ }
+ }
+}
- $at = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_att' LIMIT 1;"));
- $def = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_def' LIMIT 1;"));
- $level = mysql_fetch_array(mysql_query("SELECT `level` FROM `users` WHERE `id` = (SELECT `glava` FROM `clans` WHERE `short` = '".$user['klan']."') LIMIT 1;"));
- }
- else {
- err("Не хватает денег");
- }
- }
- if($_GET['up']=='def') {
- if($def[1] >= $level[0]) {
- err("Укрепление достигло максимального уровня");
- }
- elseif((pow(32,$at[1]+1)) <= $user['money']) {
- mysql_query("update users set money = money - ".(pow(32,$at[1]+1))." where id = ".$user['id'].";");
- mysql_query("update `variables` set value=value+1 WHERE `var` = 'gotzam_def' LIMIT 1;");
+if ($user['room'] == 40) {
+ $at = db::c()->query('SELECT * FROM `variables` WHERE `var` = "?s"', 'gotzam_att')->fetch_assoc();
+ $def = db::c()->query('SELECT * FROM `variables` WHERE `var` = "?s"', 'gotzam_def')->fetch_assoc();
- $at = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_att' LIMIT 1;"));
- $def = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'gotzam_def' LIMIT 1;"));
- $level = mysql_fetch_array(mysql_query("SELECT `level` FROM `users` WHERE `id` = (SELECT `glava` FROM `clans` WHERE `short` = '".$user['klan']."') LIMIT 1;"));
- }
- else {
- err("Не хватает денег");
- }
- }
+ if ($_GET['up'] == 'at') {
+ if ($at[1] >= CASTLE_MAX_LEVEL) $status = 'Укрепление достигло максимального уровня!';
+ elseif ((pow(52, $at[1] + 1)) <= $user['money']) {
+ db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', pow(52, $at[1] + 1), $_SESSION['uid']);
+ db::c()->query('UPDATE `variables` SET `value` = `value` + 1 WHERE `var` = "?s"', 'gotzam_att');
+ $at += 1;
+ } else $status = 'Не хватает денег!';
+ }
+ if ($_GET['up'] == 'def') {
+ if ($def[1] >= CASTLE_MAX_LEVEL) $status = 'Укрепление достигло максимального уровня!';
+ elseif ((pow(32, $def[1] + 1)) <= $user['money']) {
+ db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', pow(52, $def[1] + 1), $_SESSION['uid']);
+ db::c()->query('UPDATE `variables` SET `value` = `value` + 1 WHERE `var` = "?s"', 'gotzam_def');
+ $def += 1;
+ } else $status = 'Не хватает денег!';
+ }
+}
+?>
+
+
+
+
+
+
+
+
+Приветствую тебя в замке .gif'> = $zam['value'] ?>, воин!
+
+ Вернуться
+
+
- echo "Мастерские
- Здесь вы можете улучшить оборонные способности вашего замка!
- Максимальный уровень ваших укреплений: ".$level[0]."
-
-
-
-
";
- }
- if($user['room'] == 41) {
- echo "Комнаты отдыха
- В этих палатах ваше здоровье восстанавливается быстрее...
";
- }
- ?>
-