diff --git a/functions.php b/functions.php index 64051c6..7b297aa 100644 --- a/functions.php +++ b/functions.php @@ -2728,10 +2728,22 @@ function telegraph($to, $text) function get_meshok() { global $user; - $d = db::c()->query('SELECT SUM(`gmeshok`) AS `ves` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0 AND `gmeshok` > 0', $user['id'])->fetch_assoc(); + $d = db::c()->query('SELECT SUM(`gmeshok`) AS `ves` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0 AND `gmeshok` > 0', $_SESSION['uid'])->fetch_assoc(); return ($user['sila'] * 4 + $d['ves']); } +/** + * Надеюсь временная заглушка, которая объединяет get_meshok() и другую выдачу одной строкой. + * @return string + * @throws \Krugozor\Database\Mysql\Exception + */ +function getItemsMassaInfo() +{ + $i_row = db::c()->query('SELECT SUM(`massa`) AS `massa`, SUM(`gmeshok`) AS `massa_bonus` FROM `inventory` WHERE `setsale` = 0 AND `owner` = ?i',$_SESSION['uid'])->fetch_assoc(); + $u_row = db::c()->query('SELECT `sila` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc(); + return $i_row['massa'] . "/" . ($u_row['sila'] * 4 + $i_row['massa_bonus']); +} + function addlog($id, $log) { $fp = fopen("backup/logs/battle" . $id . ".txt", "a"); diff --git a/main.php b/main.php index a6802e4..4caf260 100644 --- a/main.php +++ b/main.php @@ -2234,7 +2234,7 @@ if (input::get('edit')) {