Зачем-то инкапсулирем.

This commit is contained in:
lopar
2021-02-01 21:20:23 +02:00
parent 7dd6368b84
commit 2ccb5ef128
63 changed files with 345 additions and 345 deletions
+21 -21
View File
@@ -18,29 +18,29 @@ class User
protected $align = 0;
protected $clan = 0;
protected $money = 0;
public $strength = 0;
public $dexterity = 0;
public $intuition = 0;
public $endurance = 0;
public $intelligence = 0;
public $wisdom = 0;
public $health;
public $mana;
public $ip;
public $session_id;
public $admin = 0;
public $enter_game;
public $room;
public $block;
public $shadow;
protected $strength = 0;
protected $dexterity = 0;
protected $intuition = 0;
protected $endurance = 0;
protected $intelligence = 0;
protected $wisdom = 0;
protected $health;
protected $mana;
protected $ip;
protected $session_id;
protected $admin = 0;
protected $enter_game;
protected $room;
protected $block;
protected $shadow;
// Удар кулаком всегда 1-2.
public $minDamage = 1;
public $maxDamage = 2;
protected $minDamage = 1;
protected $maxDamage = 2;
//Броня без предметов не существует.
public $headArmor = 0;
public $chestArmor = 0;
public $legArmor = 0;
public $free_stat_points = 0;
protected $headArmor = 0;
protected $chestArmor = 0;
protected $legArmor = 0;
protected $free_stat_points = 0;
public const STAT_MAXIMUM_AMOUNT = 40;
private const ERROR_STAT_IS_MAXIMUM = 'Ошибка: Параметр достиг своего лимита!';
private const ERROR_STAT_UNKNOWN = 'Ошибка: Неизвестный параметр!';
+4 -4
View File
@@ -1,8 +1,8 @@
<?php
if (in_array($user->room, Config::$caverooms)) {
if (in_array($user->getRoom(), Config::$caverooms)) {
$cavedata = Config::$cavedata ?? [];
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
if (!isset($cavedata[$user->room]['x' . $floor])) {
if (!isset($cavedata[$user->getRoom()]['x' . $floor])) {
$floor = 1;
}
}
@@ -11,8 +11,8 @@ $lomka1 = $lomka;
foreach ($lomka1 as $k => $v) {
if ($v < _BOTSEPARATOR_) {
if (in_array($user->room, Config::$caverooms)) {
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->room]['x' . $floor] . "', `y` = '" . $cavedata[$user->room]['y' . $floor] . "', `dir` = '" . $cavedata[$user->room]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
if (in_array($user->getRoom(), Config::$caverooms)) {
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) {
mysql_query('UPDATE `users` SET `x` = `xf`, `y` = `yr` WHERE `id` = "' . $v . '" LIMIT 1');
+2 -2
View File
@@ -21,7 +21,7 @@ function cavesys($text)
}
}
if (in_array($user->room, Config::$caverooms)) {
if (in_array($user->getRoom(), Config::$caverooms)) {
include("CaveItems.php");
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
@@ -55,7 +55,7 @@ if (in_array($user->room, Config::$caverooms)) {
$bot = $rec['bot'];
$cnt = $rec['cnt'];
if (@$caveitems[$bot]) {
if ($user->room == 621) {
if ($user->getRoom() == 621) {
$i = mt_rand(0, (count($caveitems[$bot]) - 1));
$item = $caveitems[$bot][$i];
if (getchance($item['chance'])) {
+1 -1
View File
@@ -158,7 +158,7 @@ class Tournament
mysql_query("UPDATE `users` SET `battle` = {$id} WHERE `id` = " . $user1 . " OR `id` = " . $user2);
// создаем лог
$rr = "<b>" . Nick::id($user['id'])->full(1) . "</b> и <b>" . Nick::id($jert['id'])->full(1) . "</b>";
addch("<a href=logs.php?log=" . $id . " target=_blank>Бой</a> между <B><b>" . Nick::id($user['id'])->short() . "</b> и <b>" . Nick::id($jert['id'])->short() . "</b> начался. ", $user->room);
addch("<a href=logs.php?log=" . $id . " target=_blank>Бой</a> между <B><b>" . Nick::id($user['id'])->short() . "</b> и <b>" . Nick::id($jert['id'])->short() . "</b> начался. ", $user->getRoom());
addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " решили выяснить кто из них сильнее. <i>(турнир)</i><BR>");
return $id;
}
+2 -2
View File
@@ -1700,7 +1700,7 @@ class fbattle
}
if (in_array($user->room, Config::$caverooms)) {
if (in_array($user->getRoom(), Config::$caverooms)) {
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
if ($location['dir'] == 0) {
@@ -1789,7 +1789,7 @@ class fbattle
// выносим хп-ку и выходим из боя
mysql_query('UPDATE `battle` SET `t1hist` = \'' . implode(", ", $nks1hist) . '\', `t2hist` = \'' . implode(", ", $nks2hist) . '\' WHERE `id` = ' . $this->battle_data['id'] . ' ;');
addch("<a href=logs.php?log=" . $this->battle_data['id'] . " target=_blank>Поединок</a> между <B>" . $rr . "</B> закончен. ", $user->room);
addch("<a href=logs.php?log=" . $this->battle_data['id'] . " target=_blank>Поединок</a> между <B>" . $rr . "</B> закончен. ", $user->getRoom());
mysql_query('UPDATE `battle` SET `exp` = \'' . serialize($this->exp) . '\' WHERE `id` = ' . $this->battle_data['id'] . ' ;');
mysql_query("DELETE FROM `bots` WHERE `battle` = {$this->user['battle']};");
mysql_query("UPDATE users SET `battle` =0, `fullhptime` = " . time() . " WHERE `battle` = {$this->user['battle']}");
+1 -1
View File
@@ -569,7 +569,7 @@ TASK;
mysql_query('UPDATE `users` SET `money` = "' . $user['money'] . '", `exp` = "' . $user['exp'] . '", `doblest` = "' . $user['doblest'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
$this->error = 'Вы успешно сдали задание!';
$text = '<font style="color: Red;">Внимание!</font> За успешно выполненное задание Вы получили : ' . $c;
$this->msg($text, '{[]}' . $user['login'] . '{[]}', $user->room);
$this->msg($text, '{[]}' . $user['login'] . '{[]}', $user->getRoom());
} else {
$this->error = 'Не все условия задания были выполнены ...';
}