Проверки при одевании предметов. fix #8

This commit is contained in:
lopar
2021-03-11 19:43:20 +02:00
parent cbccdd754f
commit f5b2b23582
2 changed files with 73 additions and 48 deletions
+13
View File
@@ -217,5 +217,18 @@ class UserStats extends User
return $this->legArmor;
}
public function getFullStats()
{
$query = "
select
sum(greatest(strength + (ifnull((select sum(add_strength) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allStrength,
sum(greatest(dexterity + (ifnull((select sum(add_dexterity) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allDexterity,
sum(greatest(intuition + (ifnull((select sum(add_intuition) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allIntuition,
sum(greatest(endurance + (ifnull((select sum(add_endurance) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allEndurance,
sum(greatest(intelligence + (ifnull((select sum(add_intelligence) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allIntelligence,
sum(greatest(wisdom + (ifnull((select sum(add_wisdom) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as allWisdom
from users where id = $this->id";
return self::$db->ofetch($query);
}
}