Из shop уехали все запросы в класс. Теперь он только отображает.
This commit is contained in:
parent
4cf370327f
commit
d2c8c8d7d5
@ -27,7 +27,7 @@ class InventoryItem extends Item
|
||||
|
||||
public function printInfo()
|
||||
{
|
||||
parent::printAllInfo();
|
||||
echo $this->getAllInfo();
|
||||
if ($this->present) {
|
||||
echo "<p style='color: maroon; font-style: italic'>Это подарок от $this->present. Вы не можете передать его кому-либо ещё.</p>";
|
||||
}
|
||||
@ -48,9 +48,8 @@ IMG;
|
||||
}
|
||||
}
|
||||
|
||||
public function printControls()
|
||||
{
|
||||
/* Тут будут кнопки под картинкой. */
|
||||
public function printControls(){
|
||||
// Для кнопок управления под картинкой.
|
||||
}
|
||||
|
||||
private function dressStatsChecks(): ?string
|
||||
@ -130,14 +129,9 @@ IMG;
|
||||
return $error ?? true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $itemId
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function destroyItem($itemId): bool
|
||||
public static function destroyItem($itemId)
|
||||
{
|
||||
return DBPDO::INIT()->execute('delete from inventory where dressed_slot = 0 and owner_id = ? and item_id = ?', [$_SESSION['uid'], $itemId]);
|
||||
DBPDO::INIT()->execute('delete from inventory where dressed_slot = 0 and owner_id = ? and item_id = ?', [$_SESSION['uid'], $itemId]);
|
||||
}
|
||||
|
||||
/** Надеюсь, временная заглушка, которая объединяет get_meshok() и другую выдачу одной строкой.
|
||||
|
@ -102,6 +102,14 @@ class Item
|
||||
$this->typename = 'Хлам';
|
||||
}
|
||||
|
||||
$this->item_cost = $this->calculateItemCost();
|
||||
}
|
||||
|
||||
/** Рассчёт стоимости предмета в зависимости от его характеристик.
|
||||
* @return int
|
||||
*/
|
||||
private function calculateItemCost(): int
|
||||
{
|
||||
$sum_stats =
|
||||
$this->add_strength +
|
||||
$this->add_dexterity +
|
||||
@ -121,8 +129,7 @@ class Item
|
||||
$mods_cost_modifier = 2 + floor($sum_mods / 50);
|
||||
$damage_cost_modifier = 1 + floor($sum_damage / 100);
|
||||
$result = intval($sum_stats * $stats_cost_modifier + $sum_mods * $mods_cost_modifier + $sum_damage * $damage_cost_modifier);
|
||||
|
||||
$this->item_cost = $result < 1 ? 1 : $result;
|
||||
return $result < 1 ? 1 : $result;
|
||||
}
|
||||
|
||||
protected function wrap(int $number): string
|
||||
@ -134,50 +141,51 @@ class Item
|
||||
}
|
||||
}
|
||||
|
||||
protected function printAllInfo()
|
||||
public function getAllInfo(): string
|
||||
{
|
||||
$needsLines = [
|
||||
"сила" => $this->need_strength,
|
||||
"ловкость" => $this->need_dexterity,
|
||||
"интуиция" => $this->need_intuition,
|
||||
"выносливость" => $this->need_endurance,
|
||||
"интеллект" => $this->need_intelligence,
|
||||
"мудрость" => $this->need_wisdom,
|
||||
'сила' => $this->need_strength,
|
||||
'ловкость' => $this->need_dexterity,
|
||||
'интуиция' => $this->need_intuition,
|
||||
'выносливость' => $this->need_endurance,
|
||||
'интеллект' => $this->need_intelligence,
|
||||
'мудрость' => $this->need_wisdom,
|
||||
];
|
||||
$addsLines = [
|
||||
"Сила" => $this->add_strength,
|
||||
"Ловкость" => $this->add_dexterity,
|
||||
"Интуиция" => $this->add_intuition,
|
||||
"Выносливость" => $this->add_endurance,
|
||||
"Интеллект" => $this->add_intelligence,
|
||||
"Мудрость" => $this->add_wisdom,
|
||||
"Точность" => $this->add_accuracy,
|
||||
"Увёртливость" => $this->add_evasion,
|
||||
"Шанс крита" => $this->add_criticals,
|
||||
'Сила' => $this->add_strength,
|
||||
'Ловкость' => $this->add_dexterity,
|
||||
'Интуиция' => $this->add_intuition,
|
||||
'Выносливость' => $this->add_endurance,
|
||||
'Интеллект' => $this->add_intelligence,
|
||||
'Мудрость' => $this->add_wisdom,
|
||||
'Точность' => $this->add_accuracy,
|
||||
'Увёртливость' => $this->add_evasion,
|
||||
'Шанс крита' => $this->add_criticals,
|
||||
];
|
||||
echo "<b>$this->name</b> (Масса: $this->weight)";
|
||||
echo "<br> Стоимость: " . $this->item_cost;
|
||||
echo "<br> Долговечность: " . $this->durability;
|
||||
echo "<br><em>$this->typename</em><br>";
|
||||
$str = "<b>$this->name</b> (Масса: $this->weight)";
|
||||
$str .= '<br> Стоимость: ' . $this->item_cost;
|
||||
$str .= '<br> Долговечность: ' . $this->durability;
|
||||
$str .= "<br><em>$this->typename</em><br>";
|
||||
foreach ($needsLines as $stat => $value) {
|
||||
if ($value > 0) {
|
||||
echo "<br>Требуется $stat" . $this->wrap($value);
|
||||
$str .= "<br>Требуется $stat" . $this->wrap($value);
|
||||
}
|
||||
}
|
||||
foreach ($addsLines as $stat => $value) {
|
||||
if ($value) {
|
||||
echo "<br>$stat" . $this->wrap($value);
|
||||
$str .= "<br>$stat" . $this->wrap($value);
|
||||
}
|
||||
}
|
||||
if ($this->add_min_physical_damage && !$this->add_max_physical_damage) {
|
||||
$damage = $this->add_min_physical_damage . " - " . $this->add_min_physical_damage;
|
||||
$damage = $this->add_min_physical_damage . ' - ' . $this->add_min_physical_damage;
|
||||
} elseif (!$this->add_min_physical_damage && $this->add_max_physical_damage) {
|
||||
$damage = $this->add_max_physical_damage . " - " . $this->add_max_physical_damage;
|
||||
$damage = $this->add_max_physical_damage . ' - ' . $this->add_max_physical_damage;
|
||||
} elseif ($this->add_min_physical_damage && $this->add_max_physical_damage) {
|
||||
$damage = $this->add_min_physical_damage . " - " . $this->add_max_physical_damage;
|
||||
$damage = $this->add_min_physical_damage . ' - ' . $this->add_max_physical_damage;
|
||||
}
|
||||
if (isset($damage)) {
|
||||
echo "<br>Урон: " . $damage;
|
||||
$str .= '<br>Урон: ' . $damage;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
@ -49,6 +49,7 @@ SQL;
|
||||
private $optype;
|
||||
private ?int $shop_item_quantity;
|
||||
private ?int $price;
|
||||
public static string $status = '';
|
||||
|
||||
public function __construct($row, $operationType = null)
|
||||
{
|
||||
@ -61,11 +62,12 @@ SQL;
|
||||
$this->item_id = $row->item_id ?? $row->id;
|
||||
}
|
||||
|
||||
public function printInfo()
|
||||
public function printInfo(): string
|
||||
{
|
||||
$this->printAllInfo();
|
||||
//$this->printAllInfo();
|
||||
$str = $this->getAllInfo();
|
||||
if ($this->optype === 'buyshop' && $this->shop_item_quantity > 0 && $this->shop_item_quantity < 20) {
|
||||
echo "<div style='margin-top: 9px; font-style: italic;'>На складе осталось $this->shop_item_quantity единиц товара!</div>";
|
||||
$str .= "<div style='margin-top: 9px; font-style: italic;'>На складе осталось $this->shop_item_quantity единиц товара!</div>";
|
||||
}
|
||||
if ($this->optype === 'sellshop') {
|
||||
if ($this->getSellPriceMean() < 50) {
|
||||
@ -79,36 +81,37 @@ SQL;
|
||||
} else {
|
||||
$goods = 'это превосходное изделие';
|
||||
}
|
||||
echo "<div style='margin-top: 9px; font-style: italic;'>В среднем за $goods можно выручить <span class='success'>{$this->getSellPriceMean()}</span> кр.</div>";
|
||||
$str .= "<div style='margin-top: 9px; font-style: italic;'>В среднем за $goods можно выручить <span class='success'>{$this->getSellPriceMean()}</span> кр.</div>";
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function printImage()
|
||||
public function printImage(): string
|
||||
{
|
||||
if (!$this->image) {
|
||||
$this->image = 'noitem.png';
|
||||
}
|
||||
echo "<img src='/i/sh/$this->image' class='item-wrap-normal' alt=''>";
|
||||
return "<img src='/i/sh/$this->image' class='item-wrap-normal' alt=''>";
|
||||
}
|
||||
|
||||
//todo наличка после покупки отображается с задержкой.
|
||||
public static function buyItem($id, User $buyer): string
|
||||
public static function buyItem($id, User $buyer)
|
||||
{
|
||||
$db = new DBPDO();
|
||||
$check = $db->ofetch("select * from trade_offers where shop_item_id = ?", $id);
|
||||
if (empty($check->shop_item_quantity) || empty($check->shop_item_id)) {
|
||||
return self::NO_ITEMS_IN_STOCK;
|
||||
self::$status = self::NO_ITEMS_IN_STOCK;
|
||||
}
|
||||
|
||||
// TODO БАРТЕР!
|
||||
if (isset($check->barter_item_list_json)) {
|
||||
echo "Работаем по бартеру!";
|
||||
self::$status = "Работаем по бартеру!";
|
||||
}
|
||||
|
||||
$db->execute(self::BUY_QUERY, [$buyer->getId(), $check->shop_item_id]);
|
||||
$item = $db->ofetch("select item_id, name, price from inventory where item_id = ?", $db->lastInsertId());
|
||||
if (empty($item->item_id) || empty($item->name)) {
|
||||
return 'Запрос в базу не прошёл.';
|
||||
self::$status = 'Запрос в базу не прошёл.';
|
||||
} else {
|
||||
$user = new User($_SESSION['uid']);
|
||||
// Если не хватает налички, снимаем с банка с комиссией.
|
||||
@ -117,14 +120,12 @@ SQL;
|
||||
$bank = new Bank($buyer->getId());
|
||||
$bank->withdrawMoney($item->price);
|
||||
} catch (GameException $e) {
|
||||
echo 'Банковская ошибка!';
|
||||
return self::NO_MONEY;
|
||||
self::$status = 'Банковская ошибка! ' . self::NO_MONEY;
|
||||
}
|
||||
} else {
|
||||
$user->setMoney($user->getMoney() - $item->price);
|
||||
$user->saveMoney();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($check->shop_item_quantity != -1) {
|
||||
@ -133,10 +134,10 @@ SQL;
|
||||
|
||||
$deloText = $buyer->getLogin() . " купил товар «" . $item->name . "» id:(" . $item->item_id . ") в магазине за " . $item->price . ".";
|
||||
GameLogs::addUserLog($buyer->getId(), $deloText);
|
||||
return "Предмет " . $item->name . " куплен за " . $item->price . ".";
|
||||
self::$status = "Предмет " . $item->name . " куплен за " . $item->price . ".";
|
||||
}
|
||||
|
||||
public static function sellItem($id, User $seller, $bankTrade = 0): string
|
||||
public static function sellItem($id, User $seller, $bankTrade = 0)
|
||||
{
|
||||
$db = new DBPDO();
|
||||
$item = $db->ofetch('select * from inventory where item_id = ?', $id);
|
||||
@ -154,11 +155,10 @@ SQL;
|
||||
$deloText = "{$seller->getLogin()} продал товар «{$sellingItemName}» id:($id) в магазине за $sellingPrice кр.";
|
||||
GameLogs::addUserLog($seller->getId(), $deloText);
|
||||
if ($sellingPrice == 0) {
|
||||
$status = "После длительных и изнурительных торгов вы плюнули на всё и просто подарили ваш «{$sellingItemName}» торговцу.";
|
||||
self::$status = "После длительных и изнурительных торгов вы плюнули на всё и просто подарили ваш «{$sellingItemName}» торговцу.";
|
||||
} else {
|
||||
$status = "Вы продали «{$sellingItemName}» за $sellingPrice кр.";
|
||||
self::$status = "Вы продали «{$sellingItemName}» за $sellingPrice кр.";
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
/** Подчсчёт средней суммы продажи.
|
||||
@ -177,18 +177,19 @@ SQL;
|
||||
/**
|
||||
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
|
||||
*/
|
||||
public function printControls()
|
||||
public function printControls(): string
|
||||
{
|
||||
if (in_array($this->optype, ['setmarket', 'unsetmarket', 'buymarket', 'sellshop', 'buyshop',])) {
|
||||
$str = $this->optype == 'setmarket' ? '<input placeholder=" ' . $this->price . ' " name="cost">' : '';
|
||||
$button_name = self::BUTTON[$this->optype];
|
||||
echo <<<FORM
|
||||
if (!in_array($this->optype, ['setmarket', 'unsetmarket', 'buymarket', 'sellshop', 'buyshop',])) {
|
||||
return '';
|
||||
}
|
||||
$str = $this->optype == 'setmarket' ? '<input placeholder=" ' . $this->price . ' " name="cost">' : '';
|
||||
$button_name = self::BUTTON[$this->optype];
|
||||
return <<<FORM
|
||||
<form method="post">$str
|
||||
<input type="hidden" name="itemId" value="$this->item_id">
|
||||
<br><input type="submit" name="$this->optype" value="$button_name">
|
||||
</form>
|
||||
FORM;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,11 @@
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\User;
|
||||
|
||||
include_once 'classes/Database/db.php';
|
||||
include_once 'classes/Database/Mysql.php';
|
||||
include_once 'classes/Database/Statement.php';
|
||||
include_once 'classes/Database/Exception.php';
|
||||
|
||||
ini_set('display_errors', 'On');
|
||||
error_reporting(E_ALL);
|
||||
const GAMEDOMAIN = "battles.lan";
|
||||
|
223
shop.php
223
shop.php
@ -1,220 +1,75 @@
|
||||
<?php
|
||||
|
||||
use Battles\Bank;
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\InventoryItem;
|
||||
use Battles\Item;
|
||||
use Battles\Shop;
|
||||
use Battles\ShopItem;
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
|
||||
require_once 'functions.php';
|
||||
$saleItems = false;
|
||||
$shopCategoryType = $_POST['sale'] ?? '';
|
||||
$shopCategoryTypeNumber = $_GET['otdel'] ?? 0;
|
||||
$status = null;
|
||||
Shop::$current = new Shop(Shop::GENERAL_SHOP);
|
||||
if (!empty($_GET['otdel'])) {
|
||||
if ($_GET['otdel'] !== 'sale') {
|
||||
Shop::$current->categoryType = $_GET['otdel'];
|
||||
} else {
|
||||
Shop::$current->categoryType = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['sellshop'])) {
|
||||
$status = ShopItem::sellItem($_POST['itemId'], User::$current, 1);
|
||||
ShopItem::sellItem($_POST['itemId'], User::$current, 1);
|
||||
}
|
||||
|
||||
if (!empty($_POST['buyshop'])) {
|
||||
$status = ShopItem::buyItem($_POST['itemId'], User::$current);
|
||||
}
|
||||
|
||||
$bank = new Bank(User::$current->getId());
|
||||
|
||||
switch ($shopCategoryTypeNumber) {
|
||||
default:
|
||||
$shopCategoryType = "Все товары";
|
||||
break;
|
||||
case Item::ITEM_TYPE_HELMET:
|
||||
$shopCategoryType = "Шлемы";
|
||||
break;
|
||||
case Item::ITEM_TYPE_ARMOR:
|
||||
$shopCategoryType = "Броня";
|
||||
break;
|
||||
case Item::ITEM_TYPE_LEGS:
|
||||
$shopCategoryType = "Поножи";
|
||||
break;
|
||||
case Item::ITEM_TYPE_BOOTS:
|
||||
$shopCategoryType = "Сапоги";
|
||||
break;
|
||||
case Item::ITEM_TYPE_GLOVES:
|
||||
$shopCategoryType = "Перчатки";
|
||||
break;
|
||||
case Item::ITEM_TYPE_WEAPON:
|
||||
$shopCategoryType = "Оружие";
|
||||
break;
|
||||
case Item::ITEM_TYPE_SHIELD:
|
||||
$shopCategoryType = "Щиты";
|
||||
break;
|
||||
case Item::ITEM_TYPE_BELT:
|
||||
$shopCategoryType = "Пояса";
|
||||
break;
|
||||
case Item::ITEM_TYPE_RING:
|
||||
$shopCategoryType = "Кольца";
|
||||
break;
|
||||
case Item::ITEM_TYPE_AMULET:
|
||||
$shopCategoryType = "Амулеты";
|
||||
break;
|
||||
case Item::ITEM_TYPE_CONSUMABLE:
|
||||
$shopCategoryType = "Расходники";
|
||||
break;
|
||||
case Item::ITEM_TYPE_OTHER:
|
||||
$shopCategoryType = "Разное";
|
||||
break;
|
||||
case 'sale':
|
||||
$shopCategoryType = "Предметы в инвентаре";
|
||||
$saleItems = true;
|
||||
break;
|
||||
}
|
||||
// MUST BE ARRAY!
|
||||
$iteminfo = [];
|
||||
if (!$saleItems) {
|
||||
$shopItems = DBPDO::$db->ofetchAll("select * from items inner join trade_offers on id = shop_item_id where shop_id = 1 and shop_item_quantity !=0");
|
||||
foreach ($shopItems as $shopItemObject) {
|
||||
$iteminfo[] = new ShopItem($shopItemObject, 'buyshop');
|
||||
}
|
||||
} else {
|
||||
$inventoryItems = DBPDO::$db->ofetchall("select * from inventory where on_sale = 0 and dressed_slot = 0 and durability > 0 and owner_id = ?", $user->getId());
|
||||
foreach ($inventoryItems as $inventoryItemObject) {
|
||||
$iteminfo[] = new ShopItem($inventoryItemObject, 'sellshop');
|
||||
}
|
||||
ShopItem::buyItem($_POST['itemId'], User::$current);
|
||||
}
|
||||
|
||||
Template::header('Магазин');
|
||||
?>
|
||||
<link href='/css/shop.css' rel='stylesheet'>
|
||||
<script src="js/main.js"></script>
|
||||
<style>
|
||||
a.waretype {
|
||||
margin: 2px 16px;
|
||||
padding: 6px;
|
||||
border: 1px silver solid;
|
||||
border-radius: 4px;
|
||||
background-color: #ccc;
|
||||
display: block;
|
||||
}
|
||||
|
||||
a.sell {
|
||||
background-color: #cdc;
|
||||
}
|
||||
|
||||
a.alltypes {
|
||||
background-color: #ccd;
|
||||
}
|
||||
|
||||
.status {
|
||||
color: darkgreen;
|
||||
background: #afa;
|
||||
}
|
||||
|
||||
table.shop {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
table.shop > tbody > tr > td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.shop > tbody > tr > td:nth-child(1) {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.shop > tbody > tr > td:nth-child(2) {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
table.shop table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 1px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
table.shop table tr {
|
||||
background-color: #C7C7C7;
|
||||
}
|
||||
|
||||
table.shop table td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
table.shop table tr:nth-child(even) {
|
||||
background-color: #D5D5D5;
|
||||
}
|
||||
|
||||
table.shop table td:nth-child(1) {
|
||||
width: 150px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.shop table td:nth-child(2) {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
h3 + div {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.shop strong span:last-child {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
hr + div {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
<h1>Государственный магазин</h1>
|
||||
<a href=# onclick=hrefToFrame('city.php?cp')> ← выйти на Центральную площадь</a>
|
||||
<div class="status"><?= $status ?></div>
|
||||
<div class="status"><?= ShopItem::$status ?></div>
|
||||
<table class="shop">
|
||||
<tr>
|
||||
<td>
|
||||
<h3><?= $shopCategoryType ?></h3>
|
||||
<?php if ($saleItems): ?>
|
||||
<h3><?= Shop::$current->getCategoryName() ?></h3>
|
||||
<?php if (Shop::$current->categoryType === -1): ?>
|
||||
<div>Вы можете продать ваши предметы за сущие копейки.</div>
|
||||
<?php endif; ?>
|
||||
<!--Магазин-->
|
||||
<table>
|
||||
<?php
|
||||
foreach ($iteminfo as $ii) {
|
||||
if ($ii->getItemType() != $shopCategoryTypeNumber && $shopCategoryTypeNumber != 'sale') {
|
||||
continue;
|
||||
}
|
||||
echo "<tr><td>";
|
||||
$ii->printImage();
|
||||
$ii->printControls();
|
||||
echo "<td>";
|
||||
$ii->printInfo();
|
||||
}
|
||||
?>
|
||||
<?= Shop::$current->getItemsList() ?>
|
||||
</table>
|
||||
<td>
|
||||
<strong>
|
||||
Масса всех вещей: <?= InventoryItem::getWeightData() ?> <br>
|
||||
Деньги: <?= $user->getMoney() ?> [Б:<?= $bank->getMoney() ?>].
|
||||
</strong>
|
||||
<div>
|
||||
<strong>
|
||||
Масса всех вещей: <?= InventoryItem::getWeightData() ?> <br>
|
||||
Деньги: <?= User::$current->getMoney() ?>.
|
||||
</strong>
|
||||
</div>
|
||||
<hr>
|
||||
<div>Отделы магазина</div>
|
||||
<a class="waretype" href="?otdel=6&rnd=<?= mt_rand() ?>">Оружие</a>
|
||||
<a class="waretype" href="?otdel=1&rnd=<?= mt_rand() ?>">Шлемы</a>
|
||||
<a class="waretype" href="?otdel=2&rnd=<?= mt_rand() ?>">Броня</a>
|
||||
<a class="waretype" href="?otdel=3&rnd=<?= mt_rand() ?>">Поножи</a>
|
||||
<a class="waretype" href="?otdel=4&rnd=<?= mt_rand() ?>">Сапоги</a>
|
||||
<a class="waretype" href="?otdel=5&rnd=<?= mt_rand() ?>">Перчатки</a>
|
||||
<a class="waretype" href="?otdel=7&rnd=<?= mt_rand() ?>">Щиты</a>
|
||||
<a class="waretype" href="?otdel=8&rnd=<?= mt_rand() ?>">Пояса</a>
|
||||
<a class="waretype" href="?otdel=9&rnd=<?= mt_rand() ?>">Кольца</a>
|
||||
<a class="waretype" href="?otdel=10&rnd=<?= mt_rand() ?>">Амулеты</a>
|
||||
<a class="waretype" href="?otdel=20&rnd=<?= mt_rand() ?>">Расходники</a>
|
||||
<a class="waretype" href="?otdel=50&rnd=<?= mt_rand() ?>">Разное</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_WEAPON ?>&rnd=<?= mt_rand() ?>">Оружие</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_HELMET ?>&rnd=<?= mt_rand() ?>">Шлемы</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_ARMOR ?>&rnd=<?= mt_rand() ?>">Броня</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_LEGS ?>&rnd=<?= mt_rand() ?>">Поножи</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_BOOTS ?>&rnd=<?= mt_rand() ?>">Сапоги</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_GLOVES ?>&rnd=<?= mt_rand() ?>">Перчатки</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_SHIELD ?>&rnd=<?= mt_rand() ?>">Щиты</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_BELT ?>&rnd=<?= mt_rand() ?>">Пояса</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_RING ?>&rnd=<?= mt_rand() ?>">Кольца</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_AMULET ?>&rnd=<?= mt_rand() ?>">Амулеты</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_CONSUMABLE ?>&rnd=<?= mt_rand() ?>">Расходники</a>
|
||||
<a class="waretype" href="?otdel=<?= Item::ITEM_TYPE_OTHER ?>&rnd=<?= mt_rand() ?>">Разное</a>
|
||||
<a class="waretype alltypes" href="?rnd=<?= mt_rand() ?>">Все товары</a>
|
||||
<a class="waretype sell" href="?otdel=sale&rnd=<?= mt_rand() ?>">Продать вещи</a>
|
||||
<div id="hint3" class="ahint"></div>
|
||||
<div>
|
||||
<small>Если у вас не хватит денег на покупку, деньги будут автоматически сняты с вашего банковского
|
||||
счёта
|
||||
с вычетом банковской комиссии за услуги.</small>
|
||||
</div>
|
||||
</table>
|
@ -6,17 +6,19 @@
|
||||
* One file to rule 'em all!
|
||||
*/
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
|
||||
require_once 'functions.php';
|
||||
if (!empty($_GET['teleport']) && $user->getAdmin() == 1) {
|
||||
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
|
||||
DBPDO::$db->execute('update users, online set users.room = 20, online.room = 20 where user_id = id and user_id = ?', User::$current->getId());
|
||||
}
|
||||
|
||||
# ORDEN PHP
|
||||
$_POST['use'] = $_POST['use'] ?? null;
|
||||
$_POST['use'] ??= null;
|
||||
if ($user->getAdmin()) {
|
||||
$abil = db::c()->query('SELECT 1 FROM users WHERE id = ?i', $user->getId())->fetch_assoc();
|
||||
$abil = DBPDO::$db->fetch('SELECT 1 FROM users WHERE id = ?i', $user->getId());
|
||||
//$abil = unserialize($abil['abil']);
|
||||
switch ($_POST['use']) {
|
||||
case "healing":
|
||||
|
Loading…
Reference in New Issue
Block a user