WIP: Info class

This commit is contained in:
2024-01-06 17:30:34 +02:00
parent a2c658166d
commit 4a7535d67d
44 changed files with 1713 additions and 919 deletions
+31
View File
@@ -118,6 +118,37 @@ insert into eff_users
return true;
}
public static function addInjury($uid, $type, $lvl): void
{
$stat = rand(1, 3); // пока без духовности
$img = "eff_travma$type.gif";
if ($type == 1) {
$name = 'Легкая травма';
$timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов
$data = 'add_s' . $stat . '=-' . $lvl;
} elseif ($type == 2) {
$name = 'Средняя травма';
$timeEnd = rand(3, 5);// время травмы от 6 до 12 часов
$data = 'add_s' . $stat . '=-' . ($lvl * 2);
} elseif ($type == 3) {
$name = 'Тяжелая травма';
$timeEnd = rand(5, 7);// время травмы от 12 до 6 часов
$data = 'add_s' . $stat . '=-' . ($lvl * 3);
} else {
$name = 'Неизлечимая травма';
$timeEnd = 24;// время травмы от 24 часа
$data = 'add_s' . $stat . '=-' . ($lvl * 50);
}
$timeEnd *= 3600;
Db::sql(
"insert into eff_users (id_eff, uid, name, timeUse, data, img2, v1, timeace) values (4,?,?,unix_timestamp(),?,?,?,?)",
[$uid, $name, $data, $img, $type, $timeEnd]
);
self::addById($uid, 263);
}
public static function removeByEffectId(int $userId, int $effectId): void
{
Db::sql('delete from eff_users where id_eff = ? and uid = ?', [$effectId, $userId]);