';
$this->UserInfoDoll();
$this->UserInfoStats();
- echo '
';
- if ($this->married) {
- echo sprintf('
', $this->married, $this->married, $this->married);
- }
+ echo '
';
echo '
';
echo '
';
echo sprintf('
', $this->showStarSign());
@@ -122,31 +156,10 @@ class UserInfo extends User
echo '
';
echo '
';
echo '
Об игроке
';
- if ($this->realname) {
- echo sprintf('Имя: %s
', $this->realname);
- }
- if ($this->info) {
- echo nl2br($this->info);
- }
+ echo $this->realname ? "Имя: $this->realname" : "";
+ echo $this->info ? "
" . nl2br($this->info) : "";
echo '';
-
- if ($this->watcherIsAdmin || $this->watcherIsModerator) {
- echo '
';
- $infoString = 'E-Mail: %s
ДР Игрока: %s
IP Регистрации: %s';
- echo sprintf($infoString, $this->email, date('d.m.Y', strtotime($this->borndate)), $this->ip);
- if ($this->watcherIsAdmin) {
- $this->Bank = new Bank($this->id);
- $infoString = '
ИД Игрока: %s
ИД Комнаты: %s
Деньги: %s
Деньги в банке: %s
Опыт: %s
Нераспределённые очки: %s
Текущая сессия: %s';
- echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->getMoney(), $this->experience, $this->free_stat_points, $this->session_id);
- }
- $this->UserLogs = GameLogs::getUserLogs($this->id);
- echo '
Личное дело
';
- while ($userLogRow = $this->UserLogs->fetchArray(SQLITE3_ASSOC)) {
- echo sprintf('%s
', date("d.m.Y H:i ", strtotime($userLogRow['date'])) . $userLogRow['text']);
- }
- echo '
';
- echo '
';
- }
+ echo $this->showPrivateData();
}
public function showUserInfo()
@@ -155,14 +168,14 @@ class UserInfo extends User
$effects = new EffectsModel($this->id);
if ($this->block && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
- throw new GameException('
Персонаж ' . $this->login . ' заблокирован!');
+ echo "
Персонаж $this->login заблокирован!";
} elseif ($effects->getHideUserInfoStatus() && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
if ($effects->getHideUserInfoStatus() == -1) {
$date = 'навсегда';
} else {
$date = 'до' . date('d.m.Y', strtotime($effects->getHideUserInfoStatus()));
}
- throw new GameException('
Персонаж ' . $this->login . ' обезличен ' . $date . '.');
+ echo "
Персонаж $this->login обезличен $date.";
} else {
$this->Info();
}
@@ -194,4 +207,26 @@ class UserInfo extends User
echo '
';
}
+ public function showUserEffects(): string
+ {
+ $effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $this->id);
+ $img = UserEffects::$effectImage;
+ $r = '';
+ foreach ($effs as $effect) {
+ $timeleft = timeOut($effect->remaining_time - time());
+ $r .= "
+
+
+
{$effect->name}
+
$timeleft
+
+ ";
+ }
+ return $r;
+ }
+ public function showStarSign(): ?string
+ {
+ return parent::showStarSign();
+ }
+
}
\ No newline at end of file
diff --git a/classes/Battles/UserStats.php b/classes/Battles/UserStats.php
new file mode 100644
index 0000000..f514869
--- /dev/null
+++ b/classes/Battles/UserStats.php
@@ -0,0 +1,223 @@
+maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2));
+ $this->maxMana = round(($this->wisdom * 3) + ($this->wisdom / 2) * ($this->level - 1) + ($this->wisdom / 5) * (($this->level - 1) * ($this->level - 2) / 2));
+ }
+
+ /**
+ * Отдаёт информацию о базовом(!) стате.
+ *
+ * @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition',
+ * 'endurance', 'intelligence', 'wisdom'.
+ * @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку
+ * на повышение стата на 1, при условии наличия свободных очков статов.
+ *
+ * @return string
+ */
+ public function getStat($stat_name, $isMainWindow = 0): string
+ {
+ if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) {
+ return self::ERROR_STAT_UNKNOWN;
+ }
+ if ($this->free_stat_points && $isMainWindow && $this->$stat_name < self::STAT_MAXIMUM_AMOUNT) {
+ $this->$stat_name .= "
[+]";
+ }
+ return $this->$stat_name;
+
+ }
+
+ /**
+ * Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков
+ * статов.
+ *
+ * @param string $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition',
+ * 'endurance', 'intelligence', 'wisdom'.
+ *
+ * @throws GameException
+ */
+ public function addOnePointToStat(string $stat_name)
+ {
+ if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) {
+ throw new GameException(self::ERROR_STAT_UNKNOWN);
+ }
+ if ($this->free_stat_points <= 0 || $this->$stat_name >= self::STAT_MAXIMUM_AMOUNT) {
+ throw new GameException(self::ERROR_STAT_IS_MAXIMUM);
+ } else {
+ $query = "UPDATE users SET {$stat_name} = {$stat_name} + 1, free_stat_points = free_stat_points - 1 WHERE id = ?";
+ self::$db->execute($query, $this->id);
+ }
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getStrength()
+ {
+ return $this->strength;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDexterity()
+ {
+ return $this->dexterity;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getIntuition()
+ {
+ return $this->intuition;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getEndurance()
+ {
+ return $this->endurance;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getIntelligence()
+ {
+ return $this->intelligence;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getWisdom()
+ {
+ return $this->wisdom;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getHealth()
+ {
+ return $this->health;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getMana()
+ {
+ return $this->mana;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getFreeStatPoints()
+ {
+ return $this->free_stat_points;
+ }
+
+ /**
+ * @return float
+ */
+ public function getMaxHealth(): float
+ {
+ return $this->maxHealth;
+ }
+
+ /**
+ * @return float
+ */
+ public function getMaxMana(): float
+ {
+ return $this->maxMana;
+ }
+
+ /**
+ * @return int
+ */
+ public function getHeadArmor(): int
+ {
+ return $this->headArmor;
+ }
+
+ /**
+ * @return int
+ */
+ public function getChestArmor(): int
+ {
+ return $this->chestArmor;
+ }
+
+ /**
+ * @return int
+ */
+ public function getLegArmor(): int
+ {
+ return $this->legArmor;
+ }
+
+ public function getFullStats()
+ {
+ $query = "
+ select
+ sum(greatest(strength + (ifnull((select sum(add_strength) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_strength) from users_effects where owner_id = $this->id), 0)), 0)) as strength,
+ sum(greatest(dexterity + (ifnull((select sum(add_dexterity) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_dexterity) from users_effects where owner_id = $this->id), 0)), 0)) as dexterity,
+ sum(greatest(intuition + (ifnull((select sum(add_intuition) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_intuition) from users_effects where owner_id = $this->id), 0)), 0)) as intuition,
+ sum(greatest(endurance + (ifnull((select sum(add_endurance) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_endurance) from users_effects where owner_id = $this->id), 0)), 0)) as endurance,
+ sum(greatest(intelligence + (ifnull((select sum(add_intelligence) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_intelligence) from users_effects where owner_id = $this->id), 0)), 0)) as intelligence,
+ sum(greatest(wisdom + (ifnull((select sum(add_wisdom) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_wisdom) from users_effects where owner_id = $this->id), 0)), 0)) as wisdom,
+ ifnull((select sum(add_accuracy) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as accuracy,
+ ifnull((select sum(add_evasion) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as evasion,
+ ifnull((select sum(add_criticals) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as criticals,
+ sum(greatest($this->minDamage + (ifnull((select sum(add_min_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as min_physical_damage,
+ sum(greatest($this->maxDamage + (ifnull((select sum(add_max_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as max_physical_damage
+ from users where id = $this->id";
+ return self::$db->ofetch($query);
+ }
+
+}
\ No newline at end of file
diff --git a/classes/Cave/lose.php b/classes/Cave/lose.php
index b7afe84..1ae80ea 100644
--- a/classes/Cave/lose.php
+++ b/classes/Cave/lose.php
@@ -1,6 +1,6 @@
getRoom(), Config::$caverooms)) {
- $cavedata = Config::$cavedata ?? [];
+if (in_array($user->getRoom(), CAVE_ROOMS)) {
+ $cavedata = CAVE_DATA ?? [];
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
if (!isset($cavedata[$user->getRoom()]['x' . $floor])) {
$floor = 1;
@@ -11,7 +11,7 @@ $lomka1 = $lomka;
foreach ($lomka1 as $k => $v) {
if ($v < _BOTSEPARATOR_) {
- if (in_array($user->getRoom(), Config::$caverooms)) {
+ if (in_array($user->getRoom(), CAVE_ROOMS)) {
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->getRoom()]['x' . $floor] . "', `y` = '" . $cavedata[$user->getRoom()]['y' . $floor] . "', `dir` = '" . $cavedata[$user->getRoom()]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
}
if ($user['laba'] > 0) {
diff --git a/classes/Cave/win.php b/classes/Cave/win.php
index 8211ad3..6bacaef 100644
--- a/classes/Cave/win.php
+++ b/classes/Cave/win.php
@@ -21,7 +21,7 @@ function cavesys($text)
}
}
-if (in_array($user->getRoom(), Config::$caverooms)) {
+if (in_array($user->getRoom(), CAVE_ROOMS)) {
include("CaveItems.php");
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
diff --git a/classes/Database/db.php b/classes/Database/db.php
index 5104942..8a7d4bc 100644
--- a/classes/Database/db.php
+++ b/classes/Database/db.php
@@ -1,4 +1,7 @@
setDatabaseName("battles")
+ ->setDatabaseName(GameConfigs::DATABASE_NAME)
// Выбор кодировки
- ->setCharset("utf8");
+ ->setCharset(GameConfigs::DATABASE_CHARSET);
}
return self::$_instance;
}
diff --git a/classes/battle_new.class.php b/classes/battle_new.class.php
index 55b453f..bec76a5 100644
--- a/classes/battle_new.class.php
+++ b/classes/battle_new.class.php
@@ -1700,7 +1700,7 @@ class fbattle
}
- if (in_array($user->getRoom(), Config::$caverooms)) {
+ if (in_array($user->getRoom(), CAVE_ROOMS)) {
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
if ($location['dir'] == 0) {
@@ -1805,7 +1805,7 @@ class fbattle
function addAction($time, $vars, $vls, $uid)
{
- $ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")');
+ $ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . mysql_real_escape_string($vls) . '")');
if ($ins) {
return true;
} else {
diff --git a/classes/quests_class.php b/classes/quests_class.php
index 7a9ec69..a246ce4 100644
--- a/classes/quests_class.php
+++ b/classes/quests_class.php
@@ -76,7 +76,7 @@ class Quests
if (db::c()->getAffectedRows()) {
$tms = (time() + 60 * 60 * $pl['time']);
db::c()->query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES (?i,?i,"?s",?i,"?s","?s","?s","?s")',
- $uid, time(), 'capitalcity', 0, 'start_quest' . $id, $_SERVER['HTTP_X_REAL_IP'], 'go', $tms);
+ $uid, time(), 'capitalcity', 0, 'start_quest' . $id, $_SERVER['REMOTE_ADDR'], 'go', $tms);
return 'Вы успешно получили задание "' . $pl['name'] . '"';
} else {
return 'Не удалось получить данное задание ...';
diff --git a/config.php b/config.php
index 231ee33..1474720 100644
--- a/config.php
+++ b/config.php
@@ -1,5 +1,6 @@
* Project name: Battles-Game
@@ -35,184 +36,66 @@ spl_autoload_register(function ($className) {
}
});
-trait Config
-{
- public static $db_sqlite = '/volume2/web/battles/databases/logs.sqlite';
- // Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонажи на которых нельзя напасть.
- public static $unkilable = [
- 'rooms' => [620, 621, 1051, 1052],
- 'users' => [10962, 10964, 10965],
- ];
- // Неизвестная херня.
- public static $canalenters = [620];
- public static $caverooms = [621];
- public static $userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
- // Что-то связанное с магией.
- public static $elem_align = [
- "a" => ["a" => "1", "e" => "0", "f" => "0.5", "w" => "0.5"],
- "e" => ["a" => "0", "e" => "1", "f" => "0.5", "w" => "0.5"],
- "f" => ["a" => "0.5", "e" => "0.5", "f" => "1", "w" => "0"],
- "w" => ["a" => "0.5", "e" => "0.5", "f" => "0", "w" => "1"],
- ];
- public static $elem_bonus = [
- "a" => ["a" => "1", "e" => "0.75", "f" => "1.25", "w" => "1"],
- "e" => ["a" => "1.25", "e" => "1", "f" => "1", "w" => "0.75"],
- "f" => ["a" => "0.75", "e" => "1", "f" => "1", "w" => "1.25"],
- "w" => ["a" => "1", "e" => "1.25", "f" => "0.75", "w" => "1"],
- ];
- //Для кланов
- public static $clan_register_cost = 10000; //стоимость
- public static $clan_register_lock = 1; //запрет на регистрацию
- //Банк
- public static $bank_commission = 0.05; //5%
- // Старая таблица опыта
- public static $exptable = [
- 0 => [0, 0, 0, 0, 0, 20],
- 20 => [1, 0, 0, 0, 0, 45],
- 45 => [1, 0, 0, 2, 0, 75],
- 75 => [1, 0, 0, 4, 0, 110],
- 110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
+// Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонажи на которых нельзя напасть.
+const UNKILABLE = [
+ 'rooms' => [620, 621, 1051, 1052],
+ 'users' => [10962, 10964, 10965],
+];
- 160 => [1, 0, 0, 2, 0, 215],
- 215 => [1, 0, 0, 2, 0, 280],
- 280 => [1, 0, 0, 4, 0, 350],
- 350 => [1, 0, 0, 8, 0, 410],
- 410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
+// Кажется, для пещер.
+const CANAL_ENTERS = [620];
+const CAVE_ROOMS = [621];
+const CAVE_DATA = [
+ 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' => 'Проклятого Рудника'
+ ],
+];
- 530 => [1, 0, 0, 8, 0, 670],
- 670 => [1, 0, 0, 12, 0, 830],
- 830 => [1, 0, 0, 16, 0, 950],
- 950 => [1, 0, 0, 24, 0, 1100],
- 1100 => [1, 0, 0, 32, 0, 1300],
- 1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
+const EXPTABLE = [
+ 0 => [0, 0, 0, 0, 0, 20],
+ 20 => [1, 0, 0, 0, 0, 45],
+ 45 => [1, 0, 0, 2, 0, 75],
+ 75 => [1, 0, 0, 4, 0, 110],
+ 110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
- 1450 => [1, 0, 0, 10, 0, 1650],
- 1650 => [1, 0, 0, 20, 0, 1850],
- 1850 => [1, 0, 0, 30, 0, 2050],
- 2050 => [1, 0, 0, 40, 0, 2200],
- 2200 => [1, 0, 0, 50, 0, 2500],
- 2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
+ 160 => [1, 0, 0, 2, 0, 215],
+ 215 => [1, 0, 0, 2, 0, 280],
+ 280 => [1, 0, 0, 4, 0, 350],
+ 350 => [1, 0, 0, 8, 0, 410],
+ 410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
- 2900 => [1, 0, 0, 10, 0, 3350],
- 3350 => [1, 0, 0, 20, 0, 3800],
- 3800 => [1, 0, 0, 30, 0, 4200],
- 4200 => [1, 0, 0, 40, 0, 4600],
- 4600 => [1, 0, 0, 50, 0, 5000],
- 5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
+ 530 => [1, 0, 0, 8, 0, 670],
+ 670 => [1, 0, 0, 12, 0, 830],
+ 830 => [1, 0, 0, 16, 0, 950],
+ 950 => [1, 0, 0, 24, 0, 1100],
+ 1100 => [1, 0, 0, 32, 0, 1300],
+ 1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
- 6000 => [1, 0, 0, 15, 0, 7000],
- 7000 => [1, 0, 0, 30, 0, 8000],
- 8000 => [1, 0, 0, 40, 0, 9000],
- 9000 => [1, 0, 0, 50, 0, 10000],
- 10000 => [1, 0, 0, 40, 0, 11000],
- 11000 => [1, 0, 0, 50, 0, 12000],
- 12000 => [1, 0, 0, 60, 0, 12500],
- 12500 => [3, 1, 1, 90, 1, 14000], # Это шестой уровень
+ 1450 => [1, 0, 0, 10, 0, 1650],
+ 1650 => [1, 0, 0, 20, 0, 1850],
+ 1850 => [1, 0, 0, 30, 0, 2050],
+ 2050 => [1, 0, 0, 40, 0, 2200],
+ 2200 => [1, 0, 0, 50, 0, 2500],
+ 2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
- 14000 => [1, 0, 0, 20, 0, 15500],
- 15500 => [1, 0, 0, 30, 0, 17000],
- 17000 => [1, 0, 0, 50, 0, 19000],
- 19000 => [1, 0, 0, 55, 0, 21000],
- 21000 => [1, 0, 0, 50, 0, 23000],
- 23000 => [1, 0, 0, 55, 0, 27000],
- 27000 => [1, 0, 0, 50, 0, 30000],
- 30000 => [5, 1, 1, 100, 1, 60000], # Это седьмой уровень
-
- 60000 => [1, 0, 0, 100, 0, 75000],
- 75000 => [1, 0, 0, 100, 0, 150000],
- 150000 => [1, 0, 0, 150, 0, 175000],
- 175000 => [1, 0, 0, 50, 0, 200000],
- 200000 => [1, 0, 0, 100, 0, 225000],
- 225000 => [1, 0, 0, 50, 0, 250000],
- 250000 => [1, 0, 0, 100, 0, 260000],
- 260000 => [1, 0, 0, 50, 0, 280000],
- 280000 => [1, 0, 0, 100, 0, 300000],
- 300000 => [5, 1, 1, 700, 1, 1500000], # Это восьмой уровень
-
- 1500000 => [1, 0, 0, 500, 0, 1750000],
- 1750000 => [1, 0, 0, 200, 0, 2000000],
- 2000000 => [1, 0, 0, 300, 0, 2175000],
- 2175000 => [1, 0, 0, 100, 0, 2300000],
- 2300000 => [1, 0, 0, 100, 0, 2400000],
- 2400000 => [1, 0, 0, 100, 0, 2500000],
- 2500000 => [1, 0, 0, 200, 0, 2600000],
- 2600000 => [1, 0, 0, 100, 0, 2800000],
- 2800000 => [1, 0, 0, 200, 0, 3000000],
- 3000000 => [5, 1, 2, 1000, 1, 6000000], # Это девятый уровень
-
- 6000000 => [1, 0, 0, 200, 0, 6500000],
- 6500000 => [1, 0, 0, 250, 0, 7500000],
- 7500000 => [1, 0, 0, 200, 0, 8500000],
- 8500000 => [1, 0, 0, 250, 0, 9000000],
- 9000000 => [1, 0, 0, 400, 0, 9250000],
- 9250000 => [1, 0, 0, 250, 0, 9500000],
- 9500000 => [1, 0, 0, 400, 0, 9750000],
- 9750000 => [1, 0, 0, 350, 0, 9900000],
- 9900000 => [1, 0, 0, 500, 0, 10000000],
- 10000000 => [9, 1, 3, 2000, 1, 13000000], # Это десятый уровень
-
- 13000000 => [2, 0, 0, 200, 0, 14000000],
- 14000000 => [2, 0, 0, 200, 0, 15000000],
- 15000000 => [2, 0, 0, 200, 0, 16000000],
- 16000000 => [2, 0, 0, 200, 0, 17000000],
- 17000000 => [2, 0, 0, 200, 0, 17500000],
- 17500000 => [2, 0, 0, 200, 0, 18000000],
- 18000000 => [2, 0, 0, 200, 0, 19000000],
- 19000000 => [2, 0, 0, 200, 0, 19500000],
- 19500000 => [2, 0, 0, 200, 0, 20000000],
- 20000000 => [2, 0, 0, 250, 0, 30000000],
- 30000000 => [2, 0, 0, 200, 0, 32000000],
- 32000000 => [2, 0, 0, 250, 0, 34000000],
- 34000000 => [2, 0, 0, 200, 0, 35000000],
- 35000000 => [2, 0, 0, 250, 0, 36000000],
- 36000000 => [2, 0, 0, 200, 0, 38000000],
- 38000000 => [2, 0, 0, 250, 0, 40000000],
- 40000000 => [2, 0, 0, 200, 0, 42000000],
- 42000000 => [2, 0, 0, 250, 0, 44000000],
- 44000000 => [2, 0, 0, 350, 0, 47000000],
- 47000000 => [2, 0, 0, 300, 0, 50000000],
- 50000000 => [2, 0, 0, 350, 0, 52000000],
- 52000000 => [10, 1, 3, 3000, 1, 58000000], # Это одиннадцатый уровень
-
- 58000000 => [1, 0, 0, 350, 0, 65000000],
- 65000000 => [1, 0, 0, 300, 0, 72000000],
- 72000000 => [1, 0, 0, 350, 0, 77000000],
- 77000000 => [1, 0, 0, 350, 0, 82000000],
- 82000000 => [1, 0, 0, 300, 0, 87000000],
- 87000000 => [1, 0, 0, 350, 0, 92000000],
- 92000000 => [1, 0, 0, 350, 0, 100000000],
- 100000000 => [1, 0, 0, 350, 0, 120000000],
- 120000000 => [2, 0, 0, 400, 0, 140000000],
- 140000000 => [2, 0, 0, 400, 0, 160000000],
- 160000000 => [2, 0, 0, 600, 0, 180000000],
- 180000000 => [2, 0, 0, 400, 0, 210000000],
- 210000000 => [2, 0, 0, 400, 0, 240000000],
- 240000000 => [10, 2, 4, 5000, 1, 260000000], # Это двеннадцатый уровень
-
- 260000000 => [2, 0, 0, 400, 0, 320000000],
- 320000000 => [2, 0, 0, 400, 0, 400000000],
- 400000000 => [3, 0, 0, 600, 0, 455000000],
- 455000000 => [2, 0, 0, 150, 0, 510000000],
- 510000000 => [2, 0, 0, 100, 0, 600000000],
- 600000000 => [2, 0, 0, 300, 0, 750000000],
- 750000000 => [5, 0, 0, 700, 0, 770000000],
- 770000000 => [1, 0, 0, 400, 0, 815000000],
- 815000000 => [1, 0, 0, 200, 0, 860000000],
- 860000000 => [1, 0, 0, 600, 0, 1000000000],
- 1000000000 => [1, 0, 0, 300, 0, 1100000000],
- 1100000000 => [1, 0, 0, 450, 0, 1250000000],
- 1250000000 => [1, 0, 0, 450, 0, 1500000000],
- 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
+ 2900 => [1, 0, 0, 10, 0, 3350],
+ 3350 => [1, 0, 0, 20, 0, 3800],
+ 3800 => [1, 0, 0, 30, 0, 4200],
+ 4200 => [1, 0, 0, 40, 0, 4600],
+ 4600 => [1, 0, 0, 50, 0, 5000],
+ 5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
+];
\ No newline at end of file
diff --git a/cronjobs/cron_bots_battle.php b/cronjobs/cron_bots_battle.php
index d1d4986..5dede9b 100644
--- a/cronjobs/cron_bots_battle.php
+++ b/cronjobs/cron_bots_battle.php
@@ -421,7 +421,7 @@ class fbattle
addActions(time(), 'win_fiz', 0, $this->user['id']);
}
- if (in_array($user->getRoom(), Config::$caverooms)) {
+ if (in_array($user->getRoom(), CAVE_ROOMS)) {
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
if ($location['dir'] == 0) {
$y = $location['y'] * 2;
@@ -451,7 +451,7 @@ class fbattle
$winers .= implode(",
", $this->t2);
$lomka = $this->t1;
} else {
- if (in_array($user->getRoom(), Config::$caverooms)) {
+ if (in_array($user->getRoom(), CAVE_ROOMS)) {
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
if ($location['dir'] == 0) {
$y = $location['y'] * 2;
@@ -486,7 +486,8 @@ class fbattle
$inv_broken = mysql_query("SELECT * FROM `inventory` WHERE `type` != 12 AND `dressed` = 1 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
while ($br = mysql_fetch_array($inv_broken)) {
- dropitemid($br['type'], $v);
+ $item = new \Battles\DressedItems($v);
+ $item->undressItem($br['type']);
}
$its = mysql_query("SELECT `id` FROM `inventory` WHERE `dressed` = 0 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
@@ -573,7 +574,8 @@ class fbattle
$this->AddToLog('' . date("H:i") . ' ' . Nick::id($v)->short() . ' получил повреждение: ' . $tr . '
');
$inv_broken = mysql_query("SELECT `id`, `type`, `dressed`, `duration`, `maxdur`, `dategoden`, `owner` FROM `inventory` WHERE `type` != 12 AND `dressed` = 1 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
while ($br = mysql_fetch_array($inv_broken)) {
- dropitemid($br['type'], $v);
+ $item = new \Battles\DressedItems($v);
+ $item->undressItem($br['type']);
}
}
}
@@ -1063,7 +1065,7 @@ class fbattle
if ($uid == NULL) {
$uid = $this->user['id'];
}
- $ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")');
+ $ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . mysql_real_escape_string($vls) . '")');
return $ins;
}
diff --git a/cronjobs/cron_tower.php b/cronjobs/cron_tower.php
index bbf4a34..02d3c37 100644
--- a/cronjobs/cron_tower.php
+++ b/cronjobs/cron_tower.php
@@ -17,7 +17,7 @@ if (!$tr && $turnirstart[0] <= time() && $dd[0] >= 2) {
while ($row = mysql_fetch_array($data)) {
$pers = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row[0] . '" LIMIT 1'));
- undressall($pers['id']);
+ \Battles\DressedItems::undressAllItems($pers['id']);
###
mysql_query('UPDATE `inventory` SET `owner` = "' . ($pers['id'] + _BOTSEPARATOR_) . '" WHERE `owner` = "' . $pers['id'] . '"');
###
@@ -88,9 +88,9 @@ if (!$tr && $turnirstart[0] <= time() && $dd[0] >= 2) {
}
// Боты: Архивариус и два помощника.
- undressall(233);
- undressall(234);
- undressall(235);
+ \Battles\DressedItems::undressAllItems(233);
+ \Battles\DressedItems::undressAllItems(234);
+ \Battles\DressedItems::undressAllItems(235);
mysql_query("DELETE FROM `inventory` WHERE `owner` = 233");
mysql_query("DELETE FROM `inventory` WHERE `owner` = 234");
@@ -158,7 +158,7 @@ if ($tur_data['endtime'] < time() && $tur_data['id']) {
$list = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1");
while ($u = mysql_fetch_array($list)) {
- undressall($u['id']);
+ \Battles\DressedItems::undressAllItems($u['id']);
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $u['id'] . "' AND `bs` = 1");
while ($r = mysql_fetch_array($rep)) {
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $u['room'] . "')");
diff --git a/enter_cave.php b/enter_cave.php
index 92d97c9..5206583 100644
--- a/enter_cave.php
+++ b/enter_cave.php
@@ -65,7 +65,7 @@ if ($_GET['ext'] == 1) {
}
-if (in_array($user->getRoom(), Config::$canalenters)) {
+if (in_array($user->getRoom(), CANAL_ENTERS)) {
$podzemroom = $user->getRoom() + 1;
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
@@ -308,7 +308,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
}
$den = mysql_query("SELECT `id` FROM `vxodd` WHERE `glav_id` = '" . $_GET['naw_id'] . "'");
- if (mysql_num_rows($den) >= (in_array($user->getRoom() + 1, Config::$caverooms) ? 5 : 4)) {
+ if (mysql_num_rows($den) >= (in_array($user->getRoom() + 1, CAVE_ROOMS) ? 5 : 4)) {
echo "";
exit();
}
@@ -356,7 +356,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
}
if ($_GET['start']) {
- if (in_array($user->getRoom() + 1, Config::$caverooms)) {
+ if (in_array($user->getRoom() + 1, CAVE_ROOMS)) {
$nc = 1;
$locs = [];
}
@@ -391,7 +391,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
mysql_query('INSERT INTO `visit_podzem` (`login`, `time`, `room`) VALUES ("' . $n_login . '", "' . $vremya . '", \'' . $podzemroom . '\')');
$vrem = 30 * 60 + time();
- $cavedata = Config::$cavedata ?? [];
+ $cavedata = CAVE_DATA ?? [];
mysql_query("INSERT INTO `caveparties` SET `user` = '$esth[id]', `leader` = '$user[id]', `login` = '$esth[login]', `shadow` = '0.png', `x` = '" . $cavedata[$user->getRoom() + 1]['x1'] . "', `y` = '" . $cavedata[$user->getRoom() + 1]['y1'] . "', `dir` = '" . $cavedata[$user->getRoom() + 1]['dir1'] . "', `floor` = 1");
mysql_query("UPDATE `users`, `online` SET " . ($nc ? "`users`.`caveleader` = '$user[id]', " : "") . " `users`.`room` = '" . ($user->getRoom() + 1) . "', `online`.`room` = '" . ($user->getRoom() + 1) . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $esth['id'] . "'");
}
diff --git a/functions.php b/functions.php
index 3c9a77d..8ff7715 100644
--- a/functions.php
+++ b/functions.php
@@ -16,11 +16,11 @@ if (empty($_SESSION['uid'])) {
} else {
$user = new User($_SESSION['uid']);
}
-
if ($user->getId() && $user->getBlock()) {
exit('user blocked!');
}
+
/*
* Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам.
*/
@@ -109,7 +109,7 @@ $var_map = [
function get_out($u)
{
$pers = db::c()->query('SELECT * FROM users WHERE id = ?i', $u)->fetch_assoc_array();
- undressall($pers['id']);
+ \Battles\DressedItems::undressAllItems($pers['id']);
db::c()->query('UPDATE inventory SET owner = ?i WHERE owner = ?i', $pers['id'], $pers['id'] + _BOTSEPARATOR_);
###
$row = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i', $pers['id'] + _BOTSEPARATOR_);
@@ -209,13 +209,13 @@ function level_up($uid)
{
$us = db::c()->query('SELECT `id`, `login`, `level`, `money`, `exp`, `nextup`, `stats`, `master`, `ip`, `in_tower` FROM `users` WHERE `id` =?i', $uid)->fetch_assoc();
if (isset($us['id']) && $us['exp'] >= $us['nextup'] && !$us['in_tower']) {
- if (Config::$exptable[$us['nextup']][4] == 1) {
+ if (EXPTABLE[$us['nextup']][4] == 1) {
addch("Персонаж {$us['login']} перешел на " . ($us['level'] + 1) . " уровень.");
- addchp('Внимание! Вы перешли на новый уровень. За это Вы получаете: ' . Config::$exptable[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
+ addchp('Внимание! Вы перешли на новый уровень. За это Вы получаете: ' . EXPTABLE[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
}
- $us['nextup'] = Config::$exptable[$us['nextup']][5];
- $us['stats'] += Config::$exptable[$us['nextup']][0];
- $us['master'] += Config::$exptable[$us['nextup']][1];
+ $us['nextup'] = EXPTABLE[$us['nextup']][5];
+ $us['stats'] += EXPTABLE[$us['nextup']][0];
+ $us['master'] += EXPTABLE[$us['nextup']][1];
db::c()->query('UPDATE `users` SET `nextup` = ?i, `stats` = ?i, `master` = ?i, `level` = ?i WHERE `id` = ?i', $us['nextup'], $us['stats'], $us['master'], $us['level'], $us['id']);
}
@@ -399,40 +399,6 @@ function timeOut($ttm)
return $out;
}
-function show_eff_inf(int $u): string
-{
- $img = [
- 1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif",
- 5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif",
- 10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif",
- 14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif",
- 201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif",
- 216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif",
- 220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif",
- 224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif",
- 1022 => "sh/hidden.gif",
- ];
- $r = '';
-
-
- $effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $u);
-
- $i = 0;
- while ($i < count($effs)) {
- $timeleft = timeOut($effs[$i]->remaining_time - time());
- $r .= <<
-
- {$effs[$i]->name}
- $timeleft
-
-HTML;
- $i++;
- }
- unset($i);
- return $r;
-}
-
/**
* @param $time
* @param $vars
@@ -444,282 +410,11 @@ HTML;
function addActions($time, $vars, $vls, $uid)
{
db::c()->query('LOCK TABLES `actions` WRITE');
- $ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['HTTP_X_REAL_IP'], $vls);
+ $ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['REMOTE_ADDR'], $vls);
db::c()->query('UNLOCK TABLES');
return $ins;
}
-function undressall($user_id)
-{
- db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $user_id);
-}
-
-function dropitemid($slot, $id)
-{
- global $user;
- switch ($slot) {
- case 1:
- $slot1 = 'sergi';
- break;
- case 2:
- $slot1 = 'kulon';
- break;
- case 3:
- $slot1 = 'weap';
- break;
- case 4:
- $slot1 = 'bron';
- break;
- case 5:
- $slot1 = 'r1';
- break;
- case 6:
- $slot1 = 'r2';
- break;
- case 7:
- $slot1 = 'r3';
- break;
- case 8:
- $slot1 = 'helm';
- break;
- case 9:
- $slot1 = 'perchi';
- break;
- case 10:
- $slot1 = 'shit';
- break;
- case 11:
- $slot1 = 'boots';
- break;
- case 12:
- $slot1 = 'm1';
- break;
- case 13:
- $slot1 = 'm2';
- break;
- case 14:
- $slot1 = 'm3';
- break;
- case 15:
- $slot1 = 'm4';
- break;
- case 16:
- $slot1 = 'm5';
- break;
- case 17:
- $slot1 = 'm6';
- break;
- case 18:
- $slot1 = 'm7';
- break;
- case 19:
- $slot1 = 'm8';
- break;
- case 20:
- $slot1 = 'm9';
- break;
- case 21:
- $slot1 = 'm10';
- break;
- case 22:
- $slot1 = 'rybax';
- break;
- case 23:
- $slot1 = 'plaw';
- break;
- default:
- $slot1 = '';
- break;
- }
- $checkid = db::c()->query('SELECT 1 FROM `users` WHERE `id` = ?i', $id);
- if ($checkid->getNumRows()) {
- if (mysql_query('UPDATE `users`, `inventory` SET `users`.`' . $slot1 . '` = 0, `inventory`.`dressed` = 0, `users`.`sila` = `users`.`sila` - `inventory`.`gsila`, `users`.`lovk` = `users`.`lovk` - `inventory`.`glovk`, `users`.`inta` = `users`.`inta` - `inventory`.`ginta`, `users`.`intel` = `users`.`intel` - `inventory`.`gintel`, `users`.`maxhp` = `users`.`maxhp` - `inventory`.`ghp`, `users`.`noj` = `users`.`noj` - `inventory`.`gnoj`, `users`.`topor` = `users`.`topor` - `inventory`.`gtopor`, `users`.`dubina` = `users`.`dubina` - `inventory`.`gdubina`, `users`.`mec` = `users`.`mec` - `inventory`.`gmech`, `users`.`mfire` = `users`.`mfire` - `inventory`.`gfire`, `users`.`mwater` = `users`.`mwater` - `inventory`.`gwater`, `users`.`mair` = `users`.`mair` - `inventory`.`gair`, `users`.`mearth` = `users`.`mearth` - `inventory`.`gearth`, `users`.`mlight` = `users`.`mlight` - `inventory`.`glight`, `users`.`mgray` = `users`.`mgray` - `inventory`.`ggray`, `users`.`mdark` = `users`.`mdark` - `inventory`.`gdark`, `users`.`fkrit` = `users`.`fkrit` - `inventory`.`mfkrit`, `users`.`fakrit` = `users`.`fakrit` - `inventory`.`mfakrit`, `users`.`fuvorot` = `users`.`fuvorot` - `inventory`.`mfuvorot`, `users`.`fauvorot` = `users`.`fauvorot` - `inventory`.`mfauvorot`, `users`.`ubron1` = `users`.`ubron1` - `inventory`.`bron1`, `users`.`ubron2` = `users`.`ubron2` - `inventory`.`bron2`, `users`.`ubron3` = `users`.`ubron3` - `inventory`.`bron3`, `users`.`ubron4` = `users`.`ubron4` - `inventory`.`bron4`, `users`.`uminu` = `users`.`uminu` - `inventory`.`minu`, `users`.`umaxu` = `users`.`umaxu` - `inventory`.`maxu` WHERE `inventory`.`id` = `users`.`' . $slot1 . '` AND `inventory`.`dressed` = 1 AND `inventory`.`owner` = "' . $id . '" AND `users`.`id` = "' . $id . '"')) {
- db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $id);
- $user->$slot1 = 0;
- }
- return true;
- } else {
- return false;
- }
-}
-
-// снять предмет
-function dropitem($slot)
-{
- global $user;
- $wear_arr = [];
- switch ($slot) {
- case 1:
- $slot1 = 'sergi';
- break;
- case 2:
- $slot1 = 'kulon';
- break;
- case 3:
- $slot1 = 'weap';
- break;
- case 4:
- $slot1 = 'bron';
- break;
- case 5:
- $slot1 = 'r1';
- break;
- case 6:
- $slot1 = 'r2';
- break;
- case 7:
- $slot1 = 'r3';
- break;
- case 8:
- $slot1 = 'helm';
- break;
- case 9:
- $slot1 = 'perchi';
- break;
- case 10:
- $slot1 = 'shit';
- break;
- case 11:
- $slot1 = 'boots';
- break;
- case 12:
- $slot1 = 'm1';
- break;
- case 13:
- $slot1 = 'm2';
- break;
- case 14:
- $slot1 = 'm3';
- break;
- case 15:
- $slot1 = 'm4';
- break;
- case 16:
- $slot1 = 'm5';
- break;
- case 17:
- $slot1 = 'm6';
- break;
- case 18:
- $slot1 = 'm7';
- break;
- case 19:
- $slot1 = 'm8';
- break;
- case 20:
- $slot1 = 'm9';
- break;
- case 21:
- $slot1 = 'm10';
- break;
- case 22:
- $slot1 = 'rybax';
- break;
- case 23:
- $slot1 = 'plaw';
- break;
- default:
- $slot1 = '';
- break;
- }
-
- if (db::c()->query('UPDATE `users` as `u`, `inventory` as `i` SET `u`.?f = 0, `i`.`dressed` = 0,
- `u`.`sila` = `u`.`sila` - `i`.`gsila`,
- `u`.`lovk` = `u`.`lovk` - `i`.`glovk`,
- `u`.`inta` = `u`.`inta` - `i`.`ginta`,
- `u`.`intel` = `u`.`intel` - `i`.`gintel`,
- `u`.`maxhp` = `u`.`maxhp` - `i`.`ghp`,
- `u`.`noj` = `u`.`noj` - `i`.`gnoj`,
- `u`.`topor` = `u`.`topor` - `i`.`gtopor`,
- `u`.`dubina` = `u`.`dubina` - `i`.`gdubina`,
- `u`.`mec` = `u`.`mec` - `i`.`gmech`,
- `u`.`mfire` = `u`.`mfire` - `i`.`gfire`,
- `u`.`mwater` = `u`.`mwater` - `i`.`gwater`,
- `u`.`mair` = `u`.`mair` - `i`.`gair`,
- `u`.`mearth` = `u`.`mearth` - `i`.`gearth`,
- `u`.`mlight` = `u`.`mlight` - `i`.`glight`,
- `u`.`mgray` = `u`.`mgray` - `i`.`ggray`,
- `u`.`mdark` = `u`.`mdark` - `i`.`gdark`,
- `u`.`ubron1` = `u`.`ubron1` - `i`.`bron1`,
- `u`.`ubron2` = `u`.`ubron2` - `i`.`bron2`,
- `u`.`ubron3` = `u`.`ubron3` - `i`.`bron3`,
- `u`.`ubron4` = `u`.`ubron4` - `i`.`bron4`,
- `u`.`fkrit` = `u`.`fkrit` - `i`.`mfkrit`,
- `u`.`fakrit` = `u`.`fakrit` - `i`.`mfakrit`,
- `u`.`fuvorot` = `u`.`fuvorot` - `i`.`mfuvorot`,
- `u`.`fauvorot` = `u`.`fauvorot` - `i`.`mfauvorot`,
- `u`.`uminu` = `u`.`uminu` - `i`.`minu`,
- `u`.`umaxu` = `u`.`umaxu` - `i`.`maxu`
- WHERE `i`.`id` = `u`.?f AND `i`.`dressed` = 1 AND `i`.`owner` = ?i AND u.id = ?i', $slot1, $slot1, $user->getId(), $user->getId())) {
- db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $user->getId());
- }
-
- $wear_raw = db::c()->query('SELECT * FROM `inventory` where `owner` = ?i AND `dressed` = 1', $user->getId());
- while ($wear_list = $wear_raw->fetch_assoc()) {
- $wear_arr[] = $wear_list['prototype'];
- }
-
- $item['id'] = $user->$slot1;
-
- $get_pro = db::c()->query('SELECT * FROM `inventory` where `id` = ?i', $item['id'])->fetch_assoc();
- /////////////////////
- $sets_items = db::c()->query('SELECT * FROM `item_sets`');
-
- //для каждого комплекта
- while ($items_in_set = $sets_items->fetch_assoc()) {
- $checker = 0;
- $temp_is = explode(",", $items_in_set['prot_id']);
- $set_id = $items_in_set['set_id'];
-
- //если прото в комплекте и не одет
- if (in_array($get_pro['prototype'], $temp_is) && (!in_array($get_pro['prototype'], $wear_arr))) {
- $checker = 1;
-
- //для каждого одетого предмета
- foreach ($temp_is as $check_proto) {
- if ($check_proto != $get_pro['prototype'] && !in_array($check_proto, $wear_arr)) {
- $checker = 0;
- }
- }
- }
-
-
- //
- if (($checker == 1) && (!in_array($get_pro['prototype'], $wear_arr))) {
- db::c()->query('UPDATE `users` as `u`, `item_sets` as `s` SET
- `u`.`uminu` = `u`.`uminu` - `s`.`minu`,
- `u`.`umaxu` = `u`.`umaxu` - `s`.`maxu`,
- `u`.`sila = `u`.`sila - `s`.`gsila`,
- `u`.`lovk = `u`.`lovk - `s`.`glovk`,
- `u`.`inta = `u`.`inta - `s`.`ginta`,
- `u`.`intel = `u`.`intel - `s`.`gintel`,
- `u`.`maxhp = `u`.`maxhp - `s`.`ghp`,
- `u`.`maxmana = `u`.`maxmana - `s`.`gmana`,
- `u`.`fkrit = `u`.`fkrit - `s`.`mfkrit`,
- `u`.`fakrit = `u`.`fakrit - `s`.`mfakrit`,
- `u`.`fuvorot = `u`.`fuvorot - `s`.`mfuvorot`,
- `u`.`fauvorot = `u`.`fauvorot - `s`.`mfauvorot`,
- `u`.`noj = `u`.`noj - `s`.`gnoj`,
- `u`.`topor = `u`.`topor - `s`.`gtopor`,
- `u`.`dubina = `u`.`dubina - `s`.`gdubina`,
- `u`.`mec = `u`.`mec - `s`.`gmech`,
- `u`.`ubron1 = `u`.`ubron1 - `s`.`bron1`,
- `u`.`ubron2 = `u`.`ubron2 - `s`.`bron2`,
- `u`.`ubron3 = `u`.`ubron3 - `s`.`bron3`,
- `u`.`ubron4 = `u`.`ubron4 - `s`.`bron4`,
- `u`.`mfire = `u`.`mfire - `s`.`gfire`,
- `u`.`mwater = `u`.`mwater - `s`.`gwater`,
- `u`.`mair = `u`.`mair - `s`.`gair`,
- `u`.`mearth = `u`.`mearth - `s`.`gearth`,
- `u`.`mlight = `u`.`mlight - `s`.`glight`,
- `u`.`mgray = `u`.`mgray - `s`.`ggray`
- WHERE
- `u`.`id` = ?i AND `s`.`set_id`= ?i', $user->getId(), $set_id);
- }
- }
- return true;
-}
-
#15
function ref_drop()
{
@@ -766,27 +461,13 @@ function ref_drop()
$user = db::c()->query('SELECT `sergi`,`kulon`,`weap`,`bron`,`r1`,`r2`,`r3`,`helm`,`perchi`,`shit`,`boots`,`m1`,`m2`,`m3`,`m4`,`m5`,`m6`,`m7`,`m8`,`m9`,`m10` FROM `users` WHERE id = ?i', $_SESSION['uid'])->fetch_assoc();
for ($i = 0; $i <= 20; $i++) {
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
- dropitem($i + 1);
+ $item = new \Battles\DressedItems($_SESSION['uid']);
+ $item->undressItem($i + 1);
$user[$slot[$i]] = null;
}
}
}
-
-/**
- * Уничтожить предмет, принадлежащий игроку, вызывающего функцию.
- * @param $id - ID предмета игрока.
- * @throws \Krugozor\Database\Mysql\Exception
- */
-function destructitem($id)
-{
- global $user;
- $item = db::c()->query('SELECT 1 FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $id);
- if ($item->getNumRows()) {
- db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id);
- }
-}
-
// использовать магию
function usemagic($id, $target)
{
@@ -847,7 +528,7 @@ function usemagic($id, $target)
}
if ($bat) {
if ($row['maxdur'] <= ($row['duration'] + 1)) {
- destructitem($row['id']);
+ \Battles\InventoryItem::destroyItem($row['id']);
} else {
if (!$row['magic']) {
db::c()->query('UPDATE `inventory` SET `includemagicdex` =`includemagicdex` - ?i WHERE id = ?i', $bat, $row['id']);
@@ -971,47 +652,6 @@ function addlog($id, $log)
unset($id, $log);
}
-function star_sign($date)
-{
- /*
- * 1 aries
- * 2 taurus
- * 3 gemini
- * 4 cancer
- * 5 leo
- * 6 virgo
- * 7 libra
- * 8 scorpio
- * 9 sagittarios
- * 10 capricorn
- * 11 aquarius
- * 12 pisches
- */
- $zodiac[356] = "10";
- $zodiac[326] = "09";
- $zodiac[296] = "08";
- $zodiac[266] = "07";
- $zodiac[235] = "06";
- $zodiac[203] = "05";
- $zodiac[172] = "04";
- $zodiac[140] = "03";
- $zodiac[111] = "02";
- $zodiac[78] = "01";
- $zodiac[51] = "12";
- $zodiac[20] = "11";
- $zodiac[0] = "10";
- $dayOfYear = date("z", strtotime($date));
- $isLeapYear = date("L", strtotime($date)); //Высокосный?
- if ($isLeapYear && $dayOfYear > 59) {
- --$dayOfYear;
- }
- foreach ($zodiac as $day => $sign) {
- if ($dayOfYear > $day) {
- break;
- }
- }
- return $sign;
-}
function SolveExp($at_id, $def_id, $damage)
{
@@ -1107,55 +747,3 @@ function SolveExp($at_id, $def_id, $damage)
return round((($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2) / 3);
}
-
-/**
- * Апаем стат или мастерство на единицу.
- *
- * @param $name - техническое имя параметра, как в базе.
- * @param null $param - выбор что повышать.
- *
- * @return void
- */
-function addOnePoint($name, $param = null)
-{
- $allowed_stats = ['sila', 'lovk', 'inta', 'vinos', 'intel', 'mudra'];
- $allowed_mastery = ['noj', 'mec', 'dubina', 'topor', 'mfire', 'mwater', 'mair', 'mearth', 'mlight', 'mgray', 'mdark'];
- $naming = [
- 'sila' => 'Сила',
- 'lovk' => 'Ловкость',
- 'inta' => 'Интуиция',
- 'vinos' => 'Выносливость',
- 'intel' => 'Интеллект',
- 'mudra' => 'Мудрость',
- 'noj' => 'Владение кинжалами',
- 'mec' => 'Владение мечами',
- 'dubina' => 'Владение дубинами',
- 'topor' => 'Владение топорами',
- 'mfire' => 'Магия огня',
- 'mwater' => 'Магия воды',
- 'mair' => 'Магия воздуха',
- 'mearth' => 'Магия земли',
- 'mlight' => 'Магия света',
- 'mgray' => 'Магия серости',
- 'mdark' => 'Магия тьмы',
- ];
- if ($param == 'stat' && in_array($name, $allowed_stats)) {
- db::c()->query('UPDATE `users` SET ?f = ?f + 1, `stats` = `stats` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
- echo "
Параметр {$naming[$name]} увеличен на 1 ед.";
- } elseif ($param == 'mastery' && in_array($name, $allowed_mastery)) {
- $mastery_level = db::c()->query('SELECT ?f FROM `users` WHERE `id` = ?i', $name, $_SESSION['uid'])->fetch_assoc();
- if ($mastery_level[$name] < 10) {
- db::c()->query('UPDATE `users` SET ?f = ?f + 1, `master` = `master` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
- echo "
Параметр {$naming[$name]} увеличен на 1 ед.";
- } else {
- echo "
Ошибка: параметр достиг максимального значения!";
- }
- } else {
- return null;
- }
-}
-
-function checkIntInRange($int, $min = 1, $max = PHP_INT_MAX)
-{
- return (int)filter_var($int, FILTER_VALIDATE_INT, ['options' => ['min_range' => $min, 'max_range' => $max]]);
-}
\ No newline at end of file
diff --git a/hostel_room.php b/hostel_room.php
index 8ead626..2f2464d 100644
--- a/hostel_room.php
+++ b/hostel_room.php
@@ -12,7 +12,7 @@ $vips = [1 => 0.15, 2 => 0.30, 3 => 0.45];
function show_item($row, $txt, $place)
{
if (($row['maxdur'] <= $row['duration']) || ($row['dategoden'] && $row['dategoden'] <= time())) {
- destructitem($row['id']);
+ \Battles\InventoryItem::destroyItem($row['id']);
}
$r = '';
diff --git a/i/align_0.gif b/i/align_0.gif
deleted file mode 100644
index b237e44..0000000
Binary files a/i/align_0.gif and /dev/null differ
diff --git a/i/align_0.png b/i/align_0.png
new file mode 100644
index 0000000..2b04224
Binary files /dev/null and b/i/align_0.png differ
diff --git a/i/align_1.1.gif b/i/align_1.1.gif
deleted file mode 100644
index 8dd8ee6..0000000
Binary files a/i/align_1.1.gif and /dev/null differ
diff --git a/i/align_1.2.gif b/i/align_1.2.gif
deleted file mode 100644
index 3c843de..0000000
Binary files a/i/align_1.2.gif and /dev/null differ
diff --git a/i/align_1.3.gif b/i/align_1.3.gif
deleted file mode 100644
index f1f80eb..0000000
Binary files a/i/align_1.3.gif and /dev/null differ
diff --git a/i/align_1.4.gif b/i/align_1.4.gif
deleted file mode 100644
index 4c5e234..0000000
Binary files a/i/align_1.4.gif and /dev/null differ
diff --git a/i/align_1.5.gif b/i/align_1.5.gif
deleted file mode 100644
index 10e5dff..0000000
Binary files a/i/align_1.5.gif and /dev/null differ
diff --git a/i/align_1.6.gif b/i/align_1.6.gif
deleted file mode 100644
index c92732f..0000000
Binary files a/i/align_1.6.gif and /dev/null differ
diff --git a/i/align_1.gif b/i/align_1.gif
deleted file mode 100644
index c46243f..0000000
Binary files a/i/align_1.gif and /dev/null differ
diff --git a/i/align_1.png b/i/align_1.png
new file mode 100644
index 0000000..57961ae
Binary files /dev/null and b/i/align_1.png differ
diff --git a/i/align_2.1.gif b/i/align_2.1.gif
deleted file mode 100644
index aa9c991..0000000
Binary files a/i/align_2.1.gif and /dev/null differ
diff --git a/i/align_2.7.gif b/i/align_2.7.gif
deleted file mode 100644
index 7977861..0000000
Binary files a/i/align_2.7.gif and /dev/null differ
diff --git a/i/align_2.8.gif b/i/align_2.8.gif
deleted file mode 100644
index 6136368..0000000
Binary files a/i/align_2.8.gif and /dev/null differ
diff --git a/i/align_2.9.gif b/i/align_2.9.gif
deleted file mode 100644
index ddeff1c..0000000
Binary files a/i/align_2.9.gif and /dev/null differ
diff --git a/i/align_2.gif b/i/align_2.gif
deleted file mode 100644
index a677fd5..0000000
Binary files a/i/align_2.gif and /dev/null differ
diff --git a/i/align_2.png b/i/align_2.png
new file mode 100644
index 0000000..8e742c6
Binary files /dev/null and b/i/align_2.png differ
diff --git a/i/align_3.1.gif b/i/align_3.1.gif
deleted file mode 100644
index 3f05efa..0000000
Binary files a/i/align_3.1.gif and /dev/null differ
diff --git a/i/align_3.gif b/i/align_3.gif
deleted file mode 100644
index eb2b6b7..0000000
Binary files a/i/align_3.gif and /dev/null differ
diff --git a/i/align_3.png b/i/align_3.png
new file mode 100644
index 0000000..61f0925
Binary files /dev/null and b/i/align_3.png differ
diff --git a/i/align_4.png b/i/align_4.png
new file mode 100644
index 0000000..9027989
Binary files /dev/null and b/i/align_4.png differ
diff --git a/i/align_5.gif b/i/align_5.gif
deleted file mode 100644
index dcb9782..0000000
Binary files a/i/align_5.gif and /dev/null differ
diff --git a/i/align_5.png b/i/align_5.png
new file mode 100644
index 0000000..8ba4a55
Binary files /dev/null and b/i/align_5.png differ
diff --git a/i/align_6.gif b/i/align_6.gif
deleted file mode 100644
index ca8e813..0000000
Binary files a/i/align_6.gif and /dev/null differ
diff --git a/i/align_6.png b/i/align_6.png
new file mode 100644
index 0000000..ec468b8
Binary files /dev/null and b/i/align_6.png differ
diff --git a/i/align_7.gif b/i/align_7.gif
deleted file mode 100644
index cdf15d2..0000000
Binary files a/i/align_7.gif and /dev/null differ
diff --git a/i/align_7.png b/i/align_7.png
new file mode 100644
index 0000000..9389ccc
Binary files /dev/null and b/i/align_7.png differ
diff --git a/inf.php b/inf.php
index 05509f6..2f92f1b 100644
--- a/inf.php
+++ b/inf.php
@@ -1,21 +1,14 @@
id);
+$userInfo = new \Battles\UserInfo(urldecode($_SERVER['QUERY_STRING']));
+$presentsModel = new \Battles\Models\PresentsModel($userInfo->getId());
$presentsList = $presentsModel->getAllPresents();
$userInfo->watcher_id = $_SESSION['uid'] ?? null;
-\Battles\Template::header('Информация о ' . $userInfo->login);
-if (!$userInfo->id) {
- echo sprintf('Ошибка: персонаж
%s не найден...
←назад
', $login);
+\Battles\Template::header('Информация о ' . $userInfo->getLogin());
+if (!$userInfo->getId()) {
+ echo sprintf('Ошибка: персонаж
%s не найден...
←назад
', urldecode($_SERVER['QUERY_STRING']));
exit;
}
-try {
- $userInfo->showUserInfo();
-
-} catch (Exception $e_showUserInfo) {
- echo "
Ошибка генератора showUserInfo() в User.php: {$e_showUserInfo}
";
-}
-
+$userInfo->showUserInfo();
include_once 'views/presents-list.php';
\ No newline at end of file
diff --git a/js/ch.js b/js/ch.js
index 01675b9..897eb02 100644
--- a/js/ch.js
+++ b/js/ch.js
@@ -1,7 +1,8 @@
-//-------------------------------------------------------------
+"use strict"
// Функция для определения координат указателя мыши
function defPosition(event) {
- var x = y = 0;
+ let x = 0;
+ let y = 0;
if (document.attachEvent != null) { // Internet Explorer & Opera
x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
@@ -16,7 +17,6 @@ function defPosition(event) {
return {x:x, y:y};
}
-var flagpop=0;
var clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.setCSSEffects(true);
@@ -30,12 +30,14 @@ var flagpop=0;
* @return {boolean}
*/
function OpenMenu(evt,level){
+ let flagpop = 0
+ let login
+ let menu = document.getElementById("oMenu")
+ let html;
evt = evt || window.event;
evt.cancelBubble = true;
// Показываем собственное контекстное меню
- var menu = document.getElementById("oMenu");
- var html = "";
- login=(evt.target || evt.srcElement).innerHTML;
+ login = (evt.target || evt.srcElement).innerHTML;
clip.setText(login);
@@ -60,8 +62,8 @@ function OpenMenu(evt,level){
menu.style.left = defPosition(evt).x + "px";
menu.style.display = "";
}
- if (flagpop==0){
- flagpop=1;
+ if (flagpop === 0){
+ flagpop = 1;
clip.glue( 'd_clip_button' )
}
else
diff --git a/js/main.js b/js/main.js
index 2906a53..8dca01b 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,3 +1,39 @@
function hrefToFrame(link) {
top.frames['gameframe'].location = link
+}
+
+/**
+ * Отображаем уведомление на 5 секунд.
+ * @top Отступ сверху.
+ * @right Отступ справа.
+ * @className Тип уведомления.
+ * @html Текст уведомления в HTML формате.
+ */
+function showNotification({top = 0, right = 0, className, html}) {
+
+ let notification = document.createElement('div');
+ notification.style.cssText = `
+ position: fixed;
+ z-index: 1000;
+ padding: 5px;
+ border: 1px solid black;
+ font-size: 20px;
+ background: white;
+ text-align: center;
+ `;
+
+ if (className === "danger") {
+ notification.style.cssText += `
+ background: #b80000;
+ color: yellow;
+ `;
+ }
+
+ notification.style.top = top + 'px';
+ notification.style.right = right + 'px';
+
+ notification.innerHTML = html;
+ document.body.append(notification);
+
+ setTimeout(() => notification.remove(), 5000);
}
\ No newline at end of file
diff --git a/js/sl2.js b/js/sl2.js
index 5d637b5..e359cea 100644
--- a/js/sl2.js
+++ b/js/sl2.js
@@ -1,147 +1,183 @@
var Hint3Name = '';
-step=0;
-function errmess(s)
-{
- messid.innerHTML='
'+s+'';
- highlight();
-}
-function highlight()
-{
- if (step) return(0);
- step=10;
- setTimeout(dohi,50);
+step = 0;
+
+function errmess(s) {
+ messid.innerHTML = '
' + s + '';
+ highlight();
}
-function dohi()
-{
- var hx=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F");
-
- step--;
- messid.style.color="#"+hx[Math.floor(15-step/2)]+((step&1)?"F":"8")+"0000";
- if (step>0) setTimeout(dohi,50);
+function highlight() {
+ if (step) return (0);
+ step = 10;
+ setTimeout(dohi, 50);
}
-function fixspaces(s)
-{
- while (s.substr(s.length-1,s.length)==" ") s=s.substr(0,s.length-1);
- while (s.substr(0,1)==" ") s=s.substr(1,s.length);
- return(s);
+function dohi() {
+ let hx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F"];
+
+ step--;
+ messid.style.color = "#" + hx[Math.floor(15 - step / 2)] + ((step & 1) ? "F" : "8") + "0000";
+ if (step > 0) setTimeout(dohi, 50);
+}
+
+function fixspaces(s) {
+ while (s.substr(s.length - 1, s.length) == " ") s = s.substr(0, s.length - 1);
+ while (s.substr(0, 1) == " ") s = s.substr(1, s.length);
+ return (s);
}
// Заголовок, название скрипта, имя поля с логином
-function findlogin(title, script, name, defaultlogin)
-{
- document.all("hint3").innerHTML = '
';
- document.all("hint3").style.visibility = "visible";
- document.all("hint3").style.left = 100;
- document.all("hint3").style.top = 60;
- document.all(name).focus();
- Hint3Name = name;
+function findlogin(title, script, name1, defaultlogin) {
+ let hint3 = document.getElementById("hint3");
+ hint3.innerHTML = `
+
+
+
+ ${title}
+ |
+
+
+ x
+ |
+
+
+
+
+ |
+
+
+ `;
+ /*document.all("hint3").innerHTML = '
';
+ */
+ hint3.style.visibility = "visible";
+ hint3.style.left = "100";
+ hint3.style.top = "60";
+ document.all(name1).focus();
+ Hint3Name = name1;
}
// Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля
-function magicklogin(title, script, magickname, n, defaultlogin, extparam)
-{
- var s = '
';
- document.all("hint3").innerHTML = s;
- document.all("hint3").style.visibility = "visible";
- document.all("hint3").style.left = 100;
- document.all("hint3").style.top = document.body.scrollTop+50;
- document.all("param").focus();
- Hint3Name = 'param';
+function magicklogin(title, script, magickname, n, defaultlogin, extparam) {
+ var s = '
';
+ document.all("hint3").innerHTML = s;
+ document.all("hint3").style.visibility = "visible";
+ document.all("hint3").style.left = 100;
+ document.all("hint3").style.top = document.body.scrollTop + 50;
+ document.all("param").focus();
+ Hint3Name = 'param';
}
// Магия
function UseMagick(title, script, name, extparam, n, extparam2) {
- if ((extparam != null)&&(extparam != '')) {
+ if ((extparam != null) && (extparam != '')) {
- var t1='text',t2='text';
+ var t1 = 'text', t2 = 'text';
- if (extparam.substr(0,1) == "!")
- {
- t1='password';
- extparam=extparam.substr(1,extparam.length);
- }
- var s = '
';
- document.all("hint3").innerHTML = s;
- document.all("hint3").style.visibility = "visible";
- document.all("hint3").style.left = 100;
- document.all("hint3").style.top = document.body.scrollTop+50;
- document.all("param").focus();
- Hint3Name = 'param';
- } else {
- if (confirm('Использовать сейчас?')) { location=script+'?use='+name+'&n='+n; }
- }
+ if (extparam.substr(0, 1) == "!") {
+ t1 = 'password';
+ extparam = extparam.substr(1, extparam.length);
+ }
+ var s = '
';
+ document.all("hint3").innerHTML = s;
+ document.all("hint3").style.visibility = "visible";
+ document.all("hint3").style.left = 100;
+ document.all("hint3").style.top = document.body.scrollTop + 50;
+ document.all("param").focus();
+ Hint3Name = 'param';
+ } else {
+ if (confirm('Использовать сейчас?')) {
+ location = script + '?use=' + name + '&n=' + n;
+ }
+ }
}
// Закрывает окно ввода логина
-function closehint3()
-{
- document.all("hint3").style.visibility="hidden";
- Hint3Name='';
+function closehint3() {
+ document.all("hint3").style.visibility = "hidden";
+ Hint3Name = '';
}
// Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке
-function Bmagicklogin(title, magickname, n)
-{
- if (defend==false)
- {
- errmess("Блок не выбран.");
- return false;
- }
+function Bmagicklogin(title, magickname, n) {
+ if (defend == false) {
+ errmess("Блок не выбран.");
+ return false;
+ }
- document.all("hint3").innerHTML = '
';
- document.all("hint3").style.visibility = "visible";
- document.all("hint3").style.left = 100;
- document.all("hint3").style.top = 60;
- document.all("param").focus();
- Hint3Name = 'param';
+ document.all("hint3").innerHTML = '
';
+ document.all("hint3").style.visibility = "visible";
+ document.all("hint3").style.left = 100;
+ document.all("hint3").style.top = 60;
+ document.all("param").focus();
+ Hint3Name = 'param';
}
// Магия
function BUseMagick(name, extparam, n) {
- if (defend==false)
- {
- errmess("Блок не выбран.");
- return false;
- }
+ if (defend == false) {
+ errmess("Блок не выбран.");
+ return false;
+ }
- if ((extparam != null)&&(extparam != '')) {
- var s = prompt(extparam+':', '');
- if ((s != null)&&(s != '')) {
- re = /\%/g; s=s.replace(re, "%25");
- re = /\+/g; s=s.replace(re, "%2B");
- re = /\#/g; s=s.replace(re, "%23");
- re = /\?/g; s=s.replace(re, "%3F");
- re = /\&/g; s=s.replace(re, "%26");
- window.location.href='/battle.pl?use='+name+'¶m='+s+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;
+ if ((extparam != null) && (extparam != '')) {
+ var s = prompt(extparam + ':', '');
+ if ((s != null) && (s != '')) {
+ re = /\%/g;
+ s = s.replace(re, "%25");
+ re = /\+/g;
+ s = s.replace(re, "%2B");
+ re = /\#/g;
+ s = s.replace(re, "%23");
+ re = /\?/g;
+ s = s.replace(re, "%3F");
+ re = /\&/g;
+ s = s.replace(re, "%26");
+ window.location.href = '/battle.pl?use=' + name + '¶m=' + s + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
- }
- } else {
- if (confirm('Использовать сейчас?')) { location='/battle.pl?use='+name+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;}
- }
+ }
+ } else {
+ if (confirm('Использовать сейчас?')) {
+ location = '/battle.pl?use=' + name + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
+ }
+ }
}
diff --git a/labirint.php b/labirint.php
index 2448400..6825a00 100644
--- a/labirint.php
+++ b/labirint.php
@@ -142,7 +142,8 @@ if (isset($_POST['exit'])) {
}
$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']);
+ $item = new \Battles\DressedItems($user['id']);
+ $item->undressItem($pl['type']);
}
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'] . "'");
@@ -291,7 +292,8 @@ if ($user['y'] >= count($map_d) - 2) {
}
$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']);
+ $item = new \Battles\DressedItems($user['id']);
+ $item->undressItem($pl['type']);
}
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'] . '"');
diff --git a/library.php b/library.php
index 307c681..fb52f31 100644
--- a/library.php
+++ b/library.php
@@ -211,14 +211,13 @@ if ($_GET['lib_room'] == 'hall' || !$_GET['lib_room']) {
addchp('Вы успешно создали свиток
' . $dress['name'] . '!', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
}
}
- echo '
Вы стоите в небольшой комнате, от пола до потолка забтиой банками, пробирками, ингредиентами и прочими полезными вещами.
- Здесь Вы можете собрать предметы по имеющимся у Вас рецептам.
';
+ $a = new \Battles\UserInfo($user['id']);
+ echo " |
Вы стоите в небольшой комнате, от пола до потолка забтиой банками, пробирками, ингредиентами и прочими полезными вещами.
+ Здесь Вы можете собрать предметы по имеющимся у Вас рецептам.
showStarSign());
switch ($el) {
case 'a':
echo "Воздух";
@@ -234,7 +233,13 @@ if ($_GET['lib_room'] == 'hall' || !$_GET['lib_room']) {
break;
}
echo " Эффективность магии:";
- foreach (Config::$elem_align as $k => $ea) {
+ $elem_align = [
+ 'a' => ['a' => '1', 'e' => '0', 'f' => '0.5', 'w' => '0.5'],
+ 'e' => ['a' => '0', 'e' => '1', 'f' => '0.5', 'w' => '0.5'],
+ 'f' => ['a' => '0.5', 'e' => '0.5', 'f' => '1', 'w' => '0'],
+ 'w' => ['a' => '0.5', 'e' => '0.5', 'f' => '0', 'w' => '1'],
+ ];
+ foreach ($elem_align as $k => $ea) {
switch ($k) {
case 'a':
echo " Воздух";
diff --git a/magic/attack.php b/magic/attack.php
index 9dc94f6..048279f 100644
--- a/magic/attack.php
+++ b/magic/attack.php
@@ -24,9 +24,9 @@ if ($user['battle'] > 0) {
echo "Бой закрыт для вмешательства!";
} elseif (!$us['online']) {
echo "Персонаж не в игре!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/attack_blood.php b/magic/attack_blood.php
index 8742215..8f64472 100644
--- a/magic/attack_blood.php
+++ b/magic/attack_blood.php
@@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
echo "Запрещено входить в хаотический бой!";
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
echo "Бой закрыт для вмешательства!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/attack_t.php b/magic/attack_t.php
index 52b0377..ca684b0 100644
--- a/magic/attack_t.php
+++ b/magic/attack_t.php
@@ -21,9 +21,9 @@ elseif (!$us['online']) {
echo "Запрещено входить в хаотический бой!";
} elseif ($us['battle']>0 && $us_b['open']==0) {
echo "Бой закрыт для вмешательства!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/attackbot.php b/magic/attackbot.php
index 2273213..2d85843 100644
--- a/magic/attackbot.php
+++ b/magic/attackbot.php
@@ -17,9 +17,9 @@ if ($user['battle'] > 0) {
echo "Бой закрыт для вмешательства!";
} elseif ($user['zayavka'] > 0) {
echo "Вы ожидаете поединка...";
-} elseif(in_array($jert['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($jert['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($jert['id'], Config::$unkilable['users'])) {
+} elseif(in_array($jert['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/attackk.php b/magic/attackk.php
index a4ac153..0624b9e 100644
--- a/magic/attackk.php
+++ b/magic/attackk.php
@@ -24,9 +24,9 @@ if ($user['battle'] > 0) {
echo "Бой закрыт для вмешательства!";
} elseif ($user['zayavka'] > 0) {
echo "Вы ожидаете поединка...";
-} elseif (in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif (in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif (in_array($us['id'], Config::$unkilable['users'])) {
+} elseif (in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif (isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
@@ -117,8 +117,8 @@ if ($user['battle'] > 0) {
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('Архивариус','83','','" . $jert['hp'] . "');");
$jert['id'] = mysql_insert_id();
}
- undressall($jert['id']);
- undressall($user['id']);
+ \Battles\DressedItems::undressAllItems($jert['id']);
+ \Battles\DressedItems::undressAllItems($user['id']);
$teams = [];
$teams[$user['id']][$jert['id']] = [0, 0, time()];
$teams[$jert['id']][$user['id']] = [0, 0, time()];
diff --git a/magic/attackk_close.php b/magic/attackk_close.php
index 4211c78..983e5d2 100644
--- a/magic/attackk_close.php
+++ b/magic/attackk_close.php
@@ -31,9 +31,9 @@ elseif (!$us['online']) {
echo "Не атакуйте Администратора!";
} elseif ($user['zayavka'] > 0) {
echo "Вы ожидаете поединка...";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
@@ -104,8 +104,8 @@ elseif (!$us['online']) {
}
if(rand(0,100)<80)
- undressall($jert['id']);
- undressall($user['id']);
+ \Battles\DressedItems::undressAllItems($jert['id']);
+ \Battles\DressedItems::undressAllItems($user['id']);
$teams = array();
$teams[$user['id']][$jert['id']] = array(0,0,time());
$teams[$jert['id']][$user['id']] = array(0,0,time());
diff --git a/magic/attackk_open.php b/magic/attackk_open.php
index 4fee63f..d5638fa 100644
--- a/magic/attackk_open.php
+++ b/magic/attackk_open.php
@@ -29,9 +29,9 @@ if ($user['battle'] > 0) {
echo "Персонаж защищен от кулачного нападения!";
} elseif ($us['align']==2.99) {
echo "Не атакуйте Администратора!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
@@ -104,8 +104,8 @@ if ($user['battle'] > 0) {
}
if(rand(0,100)<80)
- undressall($jert['id']);
- undressall($user['id']);
+ \Battles\DressedItems::undressAllItems($jert['id']);
+ \Battles\DressedItems::undressAllItems($user['id']);
$teams = array();
$teams[$user['id']][$jert['id']] = array(0,0,time());
$teams[$jert['id']][$user['id']] = array(0,0,time());
diff --git a/magic/cpattack.php b/magic/cpattack.php
index 9059c4d..60d2f9f 100644
--- a/magic/cpattack.php
+++ b/magic/cpattack.php
@@ -31,9 +31,9 @@ elseif (!$us['online']) {
echo "Бой закрыт для вмешательства!";
} elseif ($us['align']==2.99) {
echo "Не атакуйте Администратора!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/down.php b/magic/down.php
index edcc5e3..3b5b218 100644
--- a/magic/down.php
+++ b/magic/down.php
@@ -3,7 +3,7 @@
if ($user['battle'] > 0) {
echo "Не в бою...";
} elseif (rand(1, 100) != 1) {
- undressall($user['id']);
+ \Battles\DressedItems::undressAllItems($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");
diff --git a/magic/eattack.php b/magic/eattack.php
index e055bba..7f4d144 100644
--- a/magic/eattack.php
+++ b/magic/eattack.php
@@ -36,9 +36,9 @@ elseif ($user['zayavka'] > 0) {
echo "Вы ожидаете поединка...";
} elseif ($owntravma['id'] && !$us['battle']) {
echo "Персонаж тяжело травмирован...";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/ebattack.php b/magic/ebattack.php
index 0ff0873..91fbc96 100644
--- a/magic/ebattack.php
+++ b/magic/ebattack.php
@@ -36,9 +36,9 @@ elseif ($user['zayavka'] > 0) {
echo "Вы ожидаете поединка...";
} elseif ($owntravma['id'] && !$us['battle']) {
echo "Персонаж тяжело травмирован...";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/incmagic.php b/magic/incmagic.php
index f84bc75..ae5e016 100644
--- a/magic/incmagic.php
+++ b/magic/incmagic.php
@@ -43,7 +43,7 @@ if ($user['battle'] > 0) {
echo "Этот свиток нельзя встраивать в предметы!";
} else {
// встраиваем
- destructitem($svitok['id']);
+ \Battles\InventoryItem::destroyItem($svitok['id']);
echo "Свиток \"" . $svitok['name'] . "\" удачно встроен в \"" . $dress['name'] . "\"";
mysql_query("UPDATE `inventory` SET
" . ($dress['nintel'] < $svitok['nintel'] ? "`nintel`='" . $svitok['nintel'] . "'," : "") . "
diff --git a/magic/usability_klan/attack.php b/magic/usability_klan/attack.php
index ae1ed9e..55cba51 100644
--- a/magic/usability_klan/attack.php
+++ b/magic/usability_klan/attack.php
@@ -16,9 +16,9 @@ if($vip['attack'] <= 0) {
echo "Запрещено входить в хаотический бой!";
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
echo "Бой закрыт для вмешательства!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/usability_klan/attack_blood.php b/magic/usability_klan/attack_blood.php
index 4e2b1a6..b143fef 100644
--- a/magic/usability_klan/attack_blood.php
+++ b/magic/usability_klan/attack_blood.php
@@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
echo "Запрещено входить в хаотический бой!";
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
echo "Бой закрыт для вмешательства!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/usability_user/attack.php b/magic/usability_user/attack.php
index f2f17f5..058eeeb 100644
--- a/magic/usability_user/attack.php
+++ b/magic/usability_user/attack.php
@@ -14,9 +14,9 @@ if($vip['attack'] <= 0) {
echo "Не в бою...";
} elseif($us_b['type'] == 3 || $us_b['type'] == 5) {
echo "Запрещено входить в хаотический бой!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/magic/usability_user/attack_blood.php b/magic/usability_user/attack_blood.php
index ff73615..e2c248c 100644
--- a/magic/usability_user/attack_blood.php
+++ b/magic/usability_user/attack_blood.php
@@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
echo "Запрещено входить в хаотический бой!";
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
echo "Бой закрыт для вмешательства!";
-} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
+} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
echo "В данной комнате запрещены нападения ...";
-} elseif(in_array($us['id'], Config::$unkilable['users'])) {
+} elseif(in_array($us['id'], UNKILABLE['users'])) {
echo "Персонаж под защитой от нападений ...";
} elseif(isset($effect['id'])) {
echo "Персонаж под защитой от нападений ...";
diff --git a/main.php b/main.php
index 91173ed..12a17ed 100644
--- a/main.php
+++ b/main.php
@@ -1,11 +1,13 @@
query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user->getId());
-} catch (\Krugozor\Database\Mysql\Exception $e) {
- echo "Ошибка: " . $e->getMessage() . " Стек: " . $e->getTraceAsString() . " ";
-}
+$user->setOnline();
// Инициализируем входящие GET\POST переменные.
$goto = $_GET['goto'] ?? null;
@@ -33,13 +31,59 @@ $mfs = $_GET['modif_mf'] ?? null;
$ids = $_GET['ids'] ?? null;
$setShadow = $_POST['setshadow'] ?? null;
$edit = $_GET['edit'] ?? null;
+
+if ($edit) {
+ $ups = $_GET['ups'] ?? null;
+ $use = $_GET['use'] ?? null;
+ $useTarget = $_POST['target'] ?? null;
+ $drop = $_GET['drop'] ?? null;
+ $dress = $_GET['dress'] ?? null;
+ $undress = $_GET['undress'] ?? null;
+ $destruct = $_GET['destruct'] ?? null;
+
+ if ($ups) {
+ $user->addOnePointToStat($ups);
+ }
+ if ($drop) {
+ $items = new DressedItems($_SESSION['uid']);
+ $items->undressItem($drop);
+ unset($items);
+ }
+ //Пока что одеваем предмет отсюда.
+ if ($dress) {
+ $dressing = new InventoryItem(DBPDO::INIT()->ofetch('select * from inventory where item_id = ? ', $dress));
+ $dressing->dressItem();
+ unset($dressing);
+ }
+ if ($destruct) {
+ $q = DBPDO::INIT()->ofetch('select name,dressed_slot from inventory where owner_id = ? and item_id = ?', [$user->getId(), $destruct]);
+ if ($q) {
+ if (empty($q->dressed_slot)) {
+ InventoryItem::destroyItem($destruct);
+ GameLogs::addUserLog($user->getId(), $user->getLogin() . ' выбросил предмет ' . $q->name . ' id:(cap' . $destruct . ')');
+ err('Предмет ' . $q->name . ' выброшен.');
+ } else {
+ err('Ошибка: нельзя выбросить одетый предмет!');
+ }
+ } else {
+ err('Ошибка: предмет не найден!');
+ }
+ }
+ if ($use) {
+ usemagic($use, $useTarget);
+ }
+ if ($undress) {
+ \Battles\DressedItems::undressAllItems($_SESSION['uid']);
+ }
+}
+
+
// Подготавливаем отображение инфы и предметов.
$userInfo = new UserInfo($user->getId());
-$getItemsBonuses = new DressedItems($_SESSION['uid']);
-$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
-$data = db::c()->query($data_query, $_SESSION['uid']);
+$userStats = new UserStats($user->getId());
+$data = DBPDO::INIT()->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId());
$iteminfo = [];
-while ($row = $data->fetch_assoc()) {
+foreach ($data as $row) {
$iteminfo[] = new InventoryItem($row);
}
@@ -89,84 +133,6 @@ function del_efs($id, $type)
}
}
-// одеть предмет
-function dressitem($id)
-{
- //bug #7
- define('HELMET', 1);
- define('ARMOR', 2);
- define('LEGS', 3);
- define('BOOTS', 4);
- define('GLOVES', 5);
- define('WEAPON', 6);
- define('SHIELD', 7);
- define('BELT', 8);
- define('RING', 9);
- define('AMULET', 10);
- define('DRESSITEM_ERROR', [
- 'TOO_MANY_ITEMS_IN_SLOTS' => 'Критическая ошибка: Переполнение слота!',
- 'UNKNOWN_ITEM_TYPE' => 'Неизвестный тип предмета!',
- 'ITEM_NOT_FOUND' => 'Предмет не найден!',
- ]);
- $itemInSlot = [];
- $selectedItemRow = db::c()->query('SELECT item_type FROM `inventory` WHERE item_id = ?i AND owner_id = ?i AND `dressed_slot` = 0', $id, $_SESSION['uid']);
- if ($selectedItemRow->getNumRows()) {
- $selectedItem = $selectedItemRow->fetch_object();
- $itemInSlotRow = db::c()->query('SELECT dressed_slot FROM inventory WHERE owner_id = ?i AND dressed_slot > 0 AND item_type = ?i', $_SESSION['uid'], $selectedItem->item_type);
- $itemInSlotQuantity = $itemInSlotRow->getNumRows();
- if ($itemInSlotQuantity) {
- while ($row = $itemInSlotRow->fetch_object()) {
- $itemInSlot[] = $row->dressed_slot;
- }
- }
- if (in_array($selectedItem->item_type, [HELMET, ARMOR, LEGS, BOOTS, GLOVES, WEAPON, SHIELD, BELT, AMULET])) {
- //работаем с нормальными слотами
- if (!$itemInSlotQuantity) {
- // просто одеваем предмет
- db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
- } elseif ($itemInSlotQuantity == 1) {
- // снимаем предмет и одеваем вместо
- db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]);
- db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
- } else {
- // невозможная ситуация - два предмета в одиночном слоте. критическая ошибка, запись в лог, раздевание.
- $error = DRESSITEM_ERROR['TOO_MANY_ITEMS_IN_SLOTS'];
- db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
- }
- } elseif ($selectedItem->item_type == RING) {
- // работаем с кольцами
- if ($itemInSlotQuantity < 3) {
- // Сравниваем массив колец и массив слотов для колец.
- $emptyRingSlots = array_diff([9, 10, 11], $itemInSlot);
- // Сортируем массив свободных слотов по возрастанию.
- sort($emptyRingSlots);
- // Одеваем предмет в первый свободный слот.
- db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id);
- } elseif ($itemInSlotQuantity == 3) {
- db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11');
- db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id);
- // снимаем предмет из слота 11 и одеваем вместо
- } else {
- // невозможная ситуация - больше трёх предметов на три слота. критическая ошибка, запись в лог, раздевание.
- $error = DRESSITEM_ERROR['TOO_MANY_ITEMS_IN_SLOTS'];
- db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
- }
- } else {
- //предмет вообще не должен одеваться, ошибка
- $error = DRESSITEM_ERROR['UNKNOWN_ITEM_TYPE'];
- }
- } else {
- //с предметом что-то сильно не ок, ошибка.
- $error = DRESSITEM_ERROR['ITEM_NOT_FOUND'];
- }
-
- if (isset($error)) {
- return $error;
- } else {
- return null;
- }
-}
-
// Входим и выходим если можем.
if ($goto) {
$imove = true;
@@ -174,7 +140,7 @@ if ($goto) {
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->getId());
//(масса: = $getItemsBonuses->getItemsWeight() . '/' . $user->strength * 4
- if ($d['sum_weight'] > $user->getStrength() * 4 && $goto) {
+ if ($d['sum_weight'] > $userStats->getStrength() * 4 && $goto) {
err('У вас переполнен рюкзак, вы не можете передвигаться...');
$imove = false;
}
@@ -200,60 +166,11 @@ if (isset($_GET['use'])) {
usemagic($_GET['use'], $_POST['target']);
}
-function setShadow($image)
-{
- global $user;
- $shadows = [
- 'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10',
- 'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10',
- 'person',
- ];
- if (in_array($image, $shadows)) {
- $i = $image . '.png';
- db::c()->query('UPDATE `users` SET `shadow` = "?s" WHERE `id` = ?i', $i, $user->getId());
- } else {
- err('Ошибка!');
- }
+if ($obraz) {
+ $user->setShadow($obraz);
+ $user->saveShadow();
}
-if ($obraz && ($user->getShadow() == 'g0.gif' || $user->getShadow() == 'man0.gif')) {
- setShadow($obraz);
-}
-
-if ($del == 1 && $effectId > 0) {
- $pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user->getId(), $effectId)->fetch_assoc();
- if (isset($pl['type'])) {
- echo del_efs($effectId, $pl['type']);
- } else {
- echo "Эффект не найден!";
- }
-}
-
-if ($brons && $ids) {
- try {
- $cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user->getId(), $ids)->fetch_assoc();
- } catch (\Krugozor\Database\Mysql\Exception $e) {
- echo "Ошибка: " . $e->getMessage() . " В файле: " . $e->getFile() . " (" . $e->getLine() . ") ";
- }
- if ($cur['free_bron'] > 0 && $cur[$brons] > 0) {
- db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->getId(), $ids);
- echo "Параметр брони увеличен!";
- }
-}
-if ($stats && $ids) {
- $cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids);
- if ($cur['free_stat'] > 0 && $cur[$stats] > 0) {
- db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->getId(), $ids);
- echo "Параметр увеличен!";
- }
-}
-if ($mfs && $ids) {
- $cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids);
- if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
- db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->getId(), $ids);
- echo "Параметр увеличен!";
- }
-}
if ($setShadow) {
Template::header('Образ персонажа');
?>
@@ -288,53 +205,6 @@ if ($setShadow) {
addOnePointToStat($ups);
- }
- if ($upm) {
- addOnePoint($upm, 'mastery');
- }
- if ($drop) {
- $items = new DressedItems($_SESSION['uid']);
- $items->undressItem($drop);
- }
- //Пока что одеваем предмет отсюда.
- if ($dress) {
- echo dressitem($dress);
- }
- if ($destruct) {
- $q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], $destruct);
- if ($q->getNumRows()) {
- $q = $q->fetch_assoc();
- if (empty($q['dressed'])) {
- destructitem($q['id']);
- GameLogs::addUserLog($user->getId(), $user->getLogin() . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")");
- err('Предмет ' . $q['name'] . ' выброшен.');
- } else {
- err('Ошибка: нельзя выбросить одетый предмет!');
- }
- } else {
- err('Ошибка: предмет не найден!');
- }
- }
- if ($use) {
- usemagic($use, $useTarget);
- }
- if ($undress) {
- undressall($_SESSION['uid']);
- }
-}
Template::header('Игра');
?>
@@ -351,9 +221,40 @@ Template::header('Игра');
if (errk === 1) {
errkom = 'Нельзя использовать символы: /\:*?"<>|+% ';
}
- document.getElementById("hint3").innerHTML = '';
+ document.getElementById("hint3").innerHTML = `
+
+
+
+ ${title}
+ |
+
+ x
+ |
+
+
+
+
+ |
+
+
+ `;
document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100';
@@ -362,16 +263,15 @@ Template::header('Игра');
}
-
-
+
showUserDoll(0, 1); ?>
-
+
Снять все
- = show_eff_inf($user->getId()) ?>
+ = $userInfo->showUserEffects() ?>
@@ -389,43 +289,43 @@ Template::header('Игра');
- Сила: = ($user->getFreeStatPoints() ? $user->getStat('strength', 1) . '(' . strval($user->getStrength() + $getItemsBonuses->getStrengthBonus()) . ')' : $user->getStrength() + $getItemsBonuses->getStrengthBonus()) ?>
+ Сила: = ($userStats->getFreeStatPoints() ? $userStats->getStat('strength', 1) . '(' . strval($userStats->getFullStats()->strength) . ')' : $userStats->getFullStats()->strength) ?>
- Ловкость: = ($user->getFreeStatPoints() ? $user->getStat('dexterity', 1) . '(' . strval($user->getDexterity() + $getItemsBonuses->getDexterityBonus()) . ')' : $user->getDexterity() + $getItemsBonuses->getDexterityBonus()) ?>
+ Ловкость: = ($userStats->getFreeStatPoints() ? $userStats->getStat('dexterity', 1) . '(' . strval($userStats->getFullStats()->dexterity) . ')' : $userStats->getFullStats()->dexterity) ?>
- Интуиция: = ($user->getFreeStatPoints() ? $user->getStat('intuition', 1) . '(' . strval($user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) . ')' : $user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) ?>
+ Интуиция: = ($userStats->getFreeStatPoints() ? $userStats->getStat('intuition', 1) . '(' . strval($userStats->getFullStats()->intuition) . ')' : $userStats->getFullStats()->intuition) ?>
- Выносливость: = ($user->getFreeStatPoints() ? $user->getStat('endurance', 1) . '(' . strval($user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) . ')' : $user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) ?>
+ Выносливость: = ($userStats->getFreeStatPoints() ? $userStats->getStat('endurance', 1) . '(' . strval($userStats->getFullStats()->endurance) . ')' : $userStats->getFullStats()->endurance) ?>
- Интеллект: = ($user->getFreeStatPoints() ? $user->getStat('intelligence', 1) . '(' . strval($user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) . ')' : $user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) ?>
+ Интеллект: = ($userStats->getFreeStatPoints() ? $userStats->getStat('intelligence', 1) . '(' . strval($userStats->getFullStats()->intelligence) . ')' : $userStats->getFullStats()->intelligence) ?>
- Мудрость: = ($user->getFreeStatPoints() ? $user->getStat('wisdom', 1) . '(' . strval($user->getWisdom() + $getItemsBonuses->getWisdomBonus()) . ')' : $user->getWisdom() + $getItemsBonuses->getWisdomBonus()) ?>
+ Мудрость: = ($userStats->getFreeStatPoints() ? $userStats->getStat('wisdom', 1) . '(' . strval($userStats->getFullStats()->wisdom) . ')' : $userStats->getFullStats()->wisdom) ?>
- getFreeStatPoints()): ?>
+ getFreeStatPoints()): ?>
Возможных
- увеличений: = $user->getFreeStatPoints() ?>
+ увеличений: = $userStats->getFreeStatPoints() ?>
- Здоровье: = $user->getHealth() ?>
- Пыль: = $user->getMana() ?>
- Уворот: = $getItemsBonuses->getEvasionBonus() ?>
- Точность: = $getItemsBonuses->getAccuracyBonus() ?>
- Шанс крита: = $getItemsBonuses->getCriticalsBonus() ?>
- Урон: = $user->getMinDamage() + $getItemsBonuses->getMinPhysDamage() ?>
- - = $user->getMaxDamage() + $getItemsBonuses->getMaxPhysDamage() ?>
+ Здоровье: = $userStats->getHealth() ?>
+ Пыль: = $userStats->getMana() ?>
+ Уворот: = $userStats->getFullStats()->evasion ?>
+ Точность: = $userStats->getFullStats()->accuracy ?>
+ Шанс крита: = $userStats->getFullStats()->criticals ?>
+ Урон: = $userStats->getFullStats()->min_physical_damage ?>
+ - = $userStats->getFullStats()->max_physical_damage ?>
Защита от огня: ??
Защита от воды: ??
Защита от вохдуха: ??
Защита от земли: ??
Защита от яда: ??
- Броня головы: = $user->getHeadArmor() ?>
- Броня корпуса: = $user->getChestArmor() ?>
- Броня ног: = $user->getLegArmor() ?>
+ Броня головы: = $userStats->getHeadArmor() ?>
+ Броня корпуса: = $userStats->getChestArmor() ?>
+ Броня ног: = $userStats->getLegArmor() ?>
|
-
+ |
-
+
Рюкзак
- (масса: = '?? /' . $user->getStrength() * 4 ?>)
+ (масса: = '?? /' . (int)$userStats->getStrength() * 4 ?>)
";
+ echo " | ";
$ii->printImage();
$ii->printControls();
- echo " | ";
+ echo " | ";
$ii->printInfo();
}
- if ($data->getNumRows() == 0) {
- echo " | Пусто";
+ if (!$data) {
+ echo " |
---|
Пусто";
}
?>
|
---|
diff --git a/register.php b/register.php
index 4af4e7a..7cc4bcb 100644
--- a/register.php
+++ b/register.php
@@ -25,7 +25,7 @@ if ($_COOKIE[GAMEDOMAIN] ?? null) {
return false;
}
$db->execute('INSERT INTO users (login,pass,email,borndate,ip,session_id,shadow)
- VALUES (?,?,?,?,?,?,?)', [$login, $password, $email, $birthday, $_SERVER['REMOTE_ADDR'], session_id(), '0.gif']);
+ VALUES (?,?,?,?,?,?,?)', [$login, $password, $email, $birthday, $_SERVER['REMOTE_ADDR'], session_id(), '0.png']);
$userId = $db->lastInsertId();
$db->execute('INSERT INTO online (user_id, date, room, real_time) VALUES (?,?,1,?)', [$userId, time(), time()]);
$db->execute('INSERT INTO bank (user_id) VALUES ?', $userId);
diff --git a/towerin.php b/towerin.php
index a358828..998619e 100644
--- a/towerin.php
+++ b/towerin.php
@@ -192,7 +192,7 @@ if ($rhar[$user->getRoom()][$_GET['path']] > 0 && $_GET['path'] < 5 && $_GET['pa
$list = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1 AND `battle` = 0");
while ($u = mysql_fetch_array($list)) {
if ($u['hp'] <= 0) {
- undressall($u['id']);
+ \Battles\DressedItems::undressAllItems($u['id']);
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $u['id'] . "' AND `bs` = 1");
while ($r = mysql_fetch_array($rep)) {
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $u['room'] . "')");
@@ -226,7 +226,7 @@ while ($u = mysql_fetch_array($list)) {
if (($kol_pl + $ls) < 2 && ($tur_data['start_time'] + 60) <= time()) {
$tur = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE LIMIT 1"));
- undressall($user['id']);
+ \Battles\DressedItems::undressAllItems($user['id']);
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `bs` = 1");
while ($r = mysql_fetch_array($rep)) {
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $user->getRoom() . "');");
diff --git a/towerstamp.php b/towerstamp.php
index 1eac2cb..3eaf2f9 100644
--- a/towerstamp.php
+++ b/towerstamp.php
@@ -8,7 +8,7 @@ if ($user->getRoom() != 31) {
if (isset($effect['id'])) {
exit('Для распределения статов на Вас не дожно быть никаких эффектов');
}
-undressall($user['id']);
+\Battles\DressedItems::undressAllItems($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");
diff --git a/user_anketa.php b/user_anketa.php
index 282c1ad..9c946cf 100644
--- a/user_anketa.php
+++ b/user_anketa.php
@@ -1,43 +1,35 @@
", $hobbie);
$hobbie = str_replace("\\r", "", $hobbie);
$hobbie = str_replace("<br />", " ", $hobbie);
-if ($name || $color || $hobbie) {
- switch ($color) {
- case 1:
- $color = 'blue';
- break;
- case 2:
- $color = 'green';
- break;
- default:
- $color = 'black';
- break;
- }
-
- if (strlen($hobbie) > INFO_CHAR_LIMIT) {
- err('Максимальная длинна поля Хобби: ' . INFO_CHAR_LIMIT . ' символов!');
+if ($name || $hobbie) {
+ if (strlen($hobbie) > User::INFO_CHAR_LIMIT) {
+ err('Максимальная длинна поля Хобби: ' . User::INFO_CHAR_LIMIT . ' символов!');
} else {
- $values = ['realname' => $name, 'color' => $color, 'info' => $hobbie];
- db::c()->query('UPDATE users SET ?As WHERE id = ?i', $values, $user->getId());
+ if ($name) {
+ $user->setRealname($name);
+ }
+ if ($hobbie) {
+ $user->setInfo($hobbie);
+ }
+ $user->saveAnketa();
}
}
-
if ($oldpsw && $newpsw) {
if (password_verify($oldpsw, $user->getPass())) {
- db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `id` = ?i', password_hash($newpsw, PASSWORD_DEFAULT), $user->getId());
+ $user->setPass(password_hash($newpsw, PASSWORD_DEFAULT));
+ $user->savePass();
} else {
err('Неверный текущий пароль!');
}
@@ -47,12 +39,10 @@ Template::header('Анкета');
← на главную
Анкета персонажа = $user->getLogin() ?>
diff --git a/zayavka.php b/zayavka.php
index 88bad11..73a8d50 100644
--- a/zayavka.php
+++ b/zayavka.php
@@ -421,11 +421,11 @@ class Zayavka
if ($z['type'] == 4 || $z['type'] == 5) {
foreach ($z['team1'] as $k => $v) {
- undressall($v);
+ \Battles\DressedItems::undressAllItems($v);
}
foreach ($z['team2'] as $k => $v) {
- undressall($v);
+ \Battles\DressedItems::undressAllItems($v);
}
}
| |