battles/classes/Battles/Models/User/Effects.php

37 lines
1.0 KiB
PHP
Raw Normal View History

<?php
# Date: 23.02.2022 (3:02)
namespace Battles\Models\User;
use Battles\Database\Db;
class Effects
{
2022-12-16 23:20:43 +00:00
public static function getStatMods(int $userId)
{
2022-12-16 23:20:43 +00:00
return Db::getInstance()->ofetch(
"select
sum(mod_strength) as effect_strength,
sum(mod_dexterity) as effect_dexterity,
sum(mod_intuition) as effect_intuition,
sum(mod_endurance) as effect_endurance,
sum(mod_intelligence) as effect_intelligence,
sum(mod_wisdom) as effect_wisdom
from
users_effects
where
owner_id = ?",
$userId
);
}
2022-12-16 23:20:43 +00:00
public static function getAll(int $userId): object
{
2022-12-16 23:20:43 +00:00
return Db::getInstance()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $userId);
}
2022-12-16 23:20:43 +00:00
public static function count(int $userId, int $type)
{
2022-12-16 23:20:43 +00:00
return Db::getInstance()->fetchColumn('select count(*) from users_effects where type = ? and owner_id = ?', [$type, $userId]);
}
2022-12-16 23:20:43 +00:00
}