dev #41
@ -42,50 +42,6 @@ class DressedItems
|
|||||||
return $this->dressedItem;
|
return $this->dressedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBonuses(): array
|
|
||||||
{
|
|
||||||
$query = <<<SQL
|
|
||||||
SELECT SUM(add_strength) as sum_strength,
|
|
||||||
SUM(add_dexterity) as sum_dexterity,
|
|
||||||
SUM(add_intuition) as sum_intuition,
|
|
||||||
SUM(add_endurance) as sum_endurance,
|
|
||||||
SUM(add_intelligence) as sum_intelligence,
|
|
||||||
SUM(add_wisdom) as sum_wisdom,
|
|
||||||
SUM(add_accuracy) as sum_accuracy,
|
|
||||||
SUM(add_evasion) as sum_evasion,
|
|
||||||
SUM(add_criticals) as sum_criticals,
|
|
||||||
SUM(add_min_physical_damage) as sum_min_phys_damage,
|
|
||||||
SUM(add_max_physical_damage) as sum_max_phys_damage
|
|
||||||
FROM inventory WHERE owner_id = ? AND dressed_slot > 0
|
|
||||||
SQL;
|
|
||||||
return self::$db->fetch($query, $this->USERID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAccuracyBonus(): ?int
|
|
||||||
{
|
|
||||||
return self::getBonuses()['sum_accuracy'] ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEvasionBonus(): ?int
|
|
||||||
{
|
|
||||||
return self::getBonuses()['sum_evasion'] ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCriticalsBonus(): ?int
|
|
||||||
{
|
|
||||||
return self::getBonuses()['sum_criticals'] ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMinPhysDamage(): ?int
|
|
||||||
{
|
|
||||||
return self::getBonuses()['sum_min_phys_damage'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMaxPhysDamage(): ?int
|
|
||||||
{
|
|
||||||
return self::getBonuses()['sum_max_phys_damage'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Снимает с предмета статус одетого на персонажа в определённом слоте персонажа.
|
* Снимает с предмета статус одетого на персонажа в определённом слоте персонажа.
|
||||||
* @param $slot_id - номер слота.
|
* @param $slot_id - номер слота.
|
||||||
|
@ -177,22 +177,6 @@ class UserStats extends User
|
|||||||
return $this->maxMana;
|
return $this->maxMana;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getMinDamage(): int
|
|
||||||
{
|
|
||||||
return $this->minDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getMaxDamage(): int
|
|
||||||
{
|
|
||||||
return $this->maxDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -226,7 +210,12 @@ class UserStats extends User
|
|||||||
sum(greatest(intuition + (ifnull((select sum(add_intuition) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as intuition,
|
sum(greatest(intuition + (ifnull((select sum(add_intuition) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as intuition,
|
||||||
sum(greatest(endurance + (ifnull((select sum(add_endurance) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as endurance,
|
sum(greatest(endurance + (ifnull((select sum(add_endurance) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as endurance,
|
||||||
sum(greatest(intelligence + (ifnull((select sum(add_intelligence) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as intelligence,
|
sum(greatest(intelligence + (ifnull((select sum(add_intelligence) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as intelligence,
|
||||||
sum(greatest(wisdom + (ifnull((select sum(add_wisdom) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as wisdom
|
sum(greatest(wisdom + (ifnull((select sum(add_wisdom) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as wisdom,
|
||||||
|
ifnull((select sum(add_accuracy) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as accuracy,
|
||||||
|
ifnull((select sum(add_evasion) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as evasion,
|
||||||
|
ifnull((select sum(add_criticals) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as criticals,
|
||||||
|
sum(greatest($this->minDamage + (ifnull((select sum(add_min_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as min_physical_damage,
|
||||||
|
sum(greatest($this->maxDamage + (ifnull((select sum(add_max_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as max_physical_damage
|
||||||
from users where id = $this->id";
|
from users where id = $this->id";
|
||||||
return self::$db->ofetch($query);
|
return self::$db->ofetch($query);
|
||||||
}
|
}
|
||||||
|
11
main.php
11
main.php
@ -82,7 +82,6 @@ if ($edit) {
|
|||||||
// Подготавливаем отображение инфы и предметов.
|
// Подготавливаем отображение инфы и предметов.
|
||||||
$userInfo = new UserInfo($user->getId());
|
$userInfo = new UserInfo($user->getId());
|
||||||
$userStats = new UserStats($user->getId());
|
$userStats = new UserStats($user->getId());
|
||||||
$getItemsBonuses = new DressedItems($user->getId());
|
|
||||||
$data = \Battles\Database\DBPDO::INIT()->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId());
|
$data = \Battles\Database\DBPDO::INIT()->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId());
|
||||||
$iteminfo = [];
|
$iteminfo = [];
|
||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
@ -400,11 +399,11 @@ Template::header('Игра');
|
|||||||
<br>
|
<br>
|
||||||
Здоровье: <?= $userStats->getHealth() ?><br>
|
Здоровье: <?= $userStats->getHealth() ?><br>
|
||||||
Пыль: <?= $userStats->getMana() ?><br>
|
Пыль: <?= $userStats->getMana() ?><br>
|
||||||
Уворот: <?= $getItemsBonuses->getEvasionBonus() ?><br>
|
Уворот: <?= $userStats->getFullStats()->evasion ?><br>
|
||||||
Точность: <?= $getItemsBonuses->getAccuracyBonus() ?><br>
|
Точность: <?= $userStats->getFullStats()->accuracy ?><br>
|
||||||
Шанс крита: <?= $getItemsBonuses->getCriticalsBonus() ?><br>
|
Шанс крита: <?= $userStats->getFullStats()->criticals ?><br>
|
||||||
Урон: <?= $userStats->getMinDamage() + $getItemsBonuses->getMinPhysDamage() ?>
|
Урон: <?= $userStats->getFullStats()->min_physical_damage ?>
|
||||||
- <?= $userStats->getMaxDamage() + $getItemsBonuses->getMaxPhysDamage() ?> <br>
|
- <?= $userStats->getFullStats()->max_physical_damage ?> <br>
|
||||||
<br>
|
<br>
|
||||||
Защита от огня: ?? <br>
|
Защита от огня: ?? <br>
|
||||||
Защита от воды: ?? <br>
|
Защита от воды: ?? <br>
|
||||||
|
Loading…
Reference in New Issue
Block a user