В базу эффектов пишется пишется модификатор параметра персонажа. #1 #22

This commit is contained in:
lopar 2021-05-12 21:51:37 +03:00
parent 75a7b4125e
commit 73b1f134b2
1 changed files with 11 additions and 2 deletions

View File

@ -91,9 +91,18 @@ class User
}
public static function setUserEffect(int $userId, int $type, string $name, int $time): bool
/**
* @param int $userId
* @param int $type
* @param string $name
* @param int $time
* @param string|null $json_modifiers_list (str, dex, int, end, intel, wis).
* @return bool
*/
public static function setUserEffect(int $userId, int $type, string $name, int $time, string $json_modifiers_list = null): bool
{
return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time) VALUES (?,?,?,?)', [$userId, $type, $name, $time]);
$mods = json_decode($json_modifiers_list);
return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time, mod_strength, mod_dexterity, mod_intuition, mod_endurance, mod_intellect, mod_wisdom) VALUES (?,?,?,?,?,?,?,?,?,?)', [$userId, $type, $name, $time, $mods->str ?? null, $mods->dex ?? null, $mods->int ?? null, $mods->end ?? null, $mods->intel ?? null, $mods->wis ?? null]);
}
public static function removeUserEffect(int $userId, int $type): bool