Fatal error: Uncaught Error: Call to undefined method Battles\User::getStrength() in /volume2/web/battles/functions.php:626 Stack trace: #0 /volume2/web/battles/classes/Battles/Travel.php(70): get_meshok() #1 /volume2/web/battles/city.php(23): Battles\Travel::toRoom(21, 29) #2 {main} thrown in /volume2/web/battles/functions.php on line 626
This commit is contained in:
parent
3480dcf5a8
commit
db3855cbd5
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
# Date: 26.10.2020 (16:08)
|
# Date: 26.10.2020 (16:08)
|
||||||
namespace Battles;
|
namespace Battles;
|
||||||
|
|
||||||
use Battles\Database\DBPDO;
|
use Battles\Database\DBPDO;
|
||||||
|
|
||||||
class Travel
|
class Travel
|
||||||
@ -57,17 +58,16 @@ class Travel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Перемещение по комнатам.
|
* Перемещение по комнатам.
|
||||||
* @param int $roomId ID куда идём.
|
* @param int $roomId ID куда идём.
|
||||||
* @param int $roomIdCurrent ID откуда идём.
|
* @param int $roomIdCurrent ID откуда идём.
|
||||||
* @param DBPDO|null $db
|
|
||||||
*/
|
*/
|
||||||
public static function toRoom(int $roomId, int $roomIdCurrent): void
|
public static function toRoom(int $roomId, int $roomIdCurrent): void
|
||||||
{
|
{
|
||||||
$db = DBPDO::INIT();
|
$db = DBPDO::INIT();
|
||||||
$itemsWeight = $db->fetch('SELECT SUM(weight) AS all_weight FROM inventory WHERE owner_id = ? AND on_sale = 0', $_SESSION['uid']);
|
$itemsWeight = $db->fetch('SELECT SUM(weight) - (select strength * 5 from users where id = ?) AS weight_overflow FROM inventory WHERE owner_id = ? AND on_sale = 0', [$_SESSION['uid'], $_SESSION['uid']]);
|
||||||
$eff = $db->fetch('SELECT type FROM users_effects WHERE owner_id = ? AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid']);
|
$eff = $db->fetch('SELECT type FROM users_effects WHERE owner_id = ? AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid']);
|
||||||
$errors = [];
|
$errors = [];
|
||||||
if ($itemsWeight['all_weight'] > get_meshok()) {
|
if ($itemsWeight['weight_overflow'] > 0) {
|
||||||
$errors[0] = 'У вас переполнен рюкзак, вы не можете передвигаться...';
|
$errors[0] = 'У вас переполнен рюкзак, вы не можете передвигаться...';
|
||||||
}
|
}
|
||||||
if ($eff['type'] == 10) {
|
if ($eff['type'] == 10) {
|
||||||
|
Loading…
Reference in New Issue
Block a user