2022-05-31 12:44:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Battles\Admin;
|
|
|
|
|
|
|
|
use Battles\Database\Db;
|
|
|
|
|
|
|
|
class Item
|
|
|
|
{
|
|
|
|
public static function add(array $params): void
|
|
|
|
{
|
|
|
|
$query = 'insert into items (
|
2022-12-16 23:20:43 +00:00
|
|
|
name, item_type, durability,
|
|
|
|
need_strength, need_dexterity, need_intuition, need_endurance, need_intelligence, need_wisdom,
|
|
|
|
add_strength, add_dexterity, add_intuition, add_endurance, add_intelligence, add_wisdom,
|
|
|
|
add_accuracy, add_evasion, add_criticals, add_min_physical_damage, add_max_physical_damage,
|
|
|
|
image, weight)
|
2022-05-31 12:44:28 +00:00
|
|
|
values (
|
2022-12-16 23:20:43 +00:00
|
|
|
:name, :item_type, :durability,
|
|
|
|
:need_strength, :need_dexterity, :need_intuition, :need_endurance, :need_intelligence, :need_wisdom,
|
|
|
|
:add_strength, :add_dexterity, :add_intuition, :add_endurance, :add_intelligence, :add_wisdom,
|
|
|
|
:add_accuracy, :add_evasion, :add_criticals, :add_min_physical_damage, :add_max_physical_damage,
|
2022-05-31 12:44:28 +00:00
|
|
|
:image, :weight)';
|
|
|
|
$values = [
|
|
|
|
'name' => $params['name'] ?? uniqid(),
|
|
|
|
'item_type' => $params['item_type'],
|
|
|
|
'durability' => $params['durability'] ?? 1,
|
|
|
|
'need_strength' => $params['need_strength'] ?? 0,
|
|
|
|
'need_dexterity' => $params['need_dexterity'] ?? 0,
|
|
|
|
'need_intuition' => $params['need_intuition'] ?? 0,
|
|
|
|
'need_endurance' => $params['need_endurance'] ?? 0,
|
|
|
|
'need_intelligence' => $params['need_intelligence'] ?? 0,
|
|
|
|
'need_wisdom' => $params['need_wisdom'] ?? 0,
|
|
|
|
'add_strength' => $params['add_strength'] ?? 0,
|
|
|
|
'add_dexterity' => $params['add_dexterity'] ?? 0,
|
|
|
|
'add_intuition' => $params['add_intuition'] ?? 0,
|
|
|
|
'add_endurance' => $params['add_endurance'] ?? 0,
|
|
|
|
'add_intelligence' => $params['add_intelligence'] ?? 0,
|
|
|
|
'add_wisdom' => $params['add_wisdom'] ?? 0,
|
|
|
|
'add_accuracy' => $params['add_accuracy'] ?? 0,
|
|
|
|
'add_evasion' => $params['add_evasion'] ?? 0,
|
|
|
|
'add_criticals' => $params['add_criticals'] ?? 0,
|
|
|
|
'add_min_physical_damage' => $params['add_min_physical_damage'] ?? 0,
|
|
|
|
'add_max_physical_damage' => $params['add_max_physical_damage'] ?? 0,
|
|
|
|
'image' => $params['image'] ?? 'noitem.png',
|
|
|
|
'weight' => $params['weight'] ?? 1,
|
|
|
|
];
|
|
|
|
Db::getInstance()->execute($query, $values);
|
|
|
|
}
|
2022-12-16 23:20:43 +00:00
|
|
|
}
|