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:
Igor Barkov (iwork) 2021-05-25 18:15:51 +03:00
parent 3480dcf5a8
commit db3855cbd5

View File

@ -1,6 +1,7 @@
<?php
# Date: 26.10.2020 (16:08)
namespace Battles;
use Battles\Database\DBPDO;
class Travel
@ -57,17 +58,16 @@ class Travel
/**
* Перемещение по комнатам.
* @param int $roomId ID куда идём.
* @param int $roomIdCurrent ID откуда идём.
* @param DBPDO|null $db
* @param int $roomId ID куда идём.
* @param int $roomIdCurrent ID откуда идём.
*/
public static function toRoom(int $roomId, int $roomIdCurrent): void
{
$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']);
$errors = [];
if ($itemsWeight['all_weight'] > get_meshok()) {
if ($itemsWeight['weight_overflow'] > 0) {
$errors[0] = 'У вас переполнен рюкзак, вы не можете передвигаться...';
}
if ($eff['type'] == 10) {