dev #41
@ -102,7 +102,7 @@ class User
|
|||||||
public static function setUserEffect(int $userId, int $type, string $name, int $time, string $json_modifiers_list = null): bool
|
public static function setUserEffect(int $userId, int $type, string $name, int $time, string $json_modifiers_list = null): bool
|
||||||
{
|
{
|
||||||
$mods = json_decode($json_modifiers_list);
|
$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]);
|
return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time, mod_strength, mod_dexterity, mod_intuition, mod_endurance, mod_intelligence, 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
|
public static function removeUserEffect(int $userId, int $type): bool
|
||||||
@ -460,4 +460,38 @@ class User
|
|||||||
{
|
{
|
||||||
self::$db->execute('update online set real_time = ? where user_id = ?', [time(), $this->getId()]);
|
self::$db->execute('update online set real_time = ? where user_id = ?', [time(), $this->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setInjury(int $type): bool
|
||||||
|
{
|
||||||
|
if (!in_array($type,[11,12,13,14])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$names1 = ['разбитый нос', 'сотрясение первой степени', 'потрепанные уши', 'прикушенный язык', 'перелом переносицы', 'растяжение ноги', 'растяжение руки', 'подбитый глаз', 'синяк под глазом', 'кровоточащее рассечение', 'отбитая «пятая точка»', 'заклинившая челюсть', 'выбитый зуб «мудрости»', 'косоглазие'];
|
||||||
|
$names2 = ['отбитые почки', 'вывих «вырезано цензурой»', 'сотрясение второй степени', 'оторванное ухо', 'вывих руки', 'оторванные уши', 'поврежденный позвоночник', 'поврежденный копчик', 'разрыв сухожилия', 'перелом ребра', 'перелом двух ребер', 'вывих ноги', 'сломанная челюсть'];
|
||||||
|
$names3 = ['пробитый череп', 'разрыв селезенки', 'смещение позвонков', 'открытый перелом руки', 'открытый перелом «вырезано цензурой»', 'излом носоглотки', 'непонятные, но множественные травмы', 'сильное внутреннее кровотечение', 'раздробленная коленная чашечка', 'перелом шеи', 'смещение позвонков', 'открытый перелом ключицы', 'перелом позвоночника', 'вывих позвоночника', 'сотрясение третьей степени'];
|
||||||
|
$param_names = ['str','dex','int','end','intel','wis',];
|
||||||
|
shuffle($param_names);
|
||||||
|
switch ($type) {
|
||||||
|
case 11:
|
||||||
|
shuffle($names1);
|
||||||
|
$name = UserEffects::$effectName[$type] . ': ' . $names1(0);
|
||||||
|
self::setUserEffect($this->id, $type, $name, strtotime('30min'), json_encode([$param_names(0) => -1]));
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
shuffle($names2);
|
||||||
|
$name = UserEffects::$effectName[$type] . ': ' . $names2(0);
|
||||||
|
self::setUserEffect($this->id, $type, $name, strtotime('3hours'), json_encode([$param_names(0) => mt_rand(-3,-1), $param_names(1) => mt_rand(-3,-1)]));
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
shuffle($names3);
|
||||||
|
$name = UserEffects::$effectName[$type] . ': ' . $names3(0);
|
||||||
|
self::setUserEffect($this->id, $type, $name, strtotime('12hours'), json_encode([$param_names(0) => mt_rand(-5,-1), $param_names(1) => mt_rand(-5,-1), $param_names(2) => mt_rand(-5,-1)]));
|
||||||
|
break;
|
||||||
|
default: //type 14
|
||||||
|
self::setUserEffect($this->id, $type, UserEffects::$effectName[$type], strtotime('1day'), json_encode([$param_names(0) => -10]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
@ -10,10 +10,10 @@ trait UserEffects
|
|||||||
4 => 'Заклятие хаоса',
|
4 => 'Заклятие хаоса',
|
||||||
5 => 'Заклятие обезличивания',
|
5 => 'Заклятие обезличивания',
|
||||||
10 => 'паралич',
|
10 => 'паралич',
|
||||||
11 => 'легкая травма',
|
11 => 'Легкая травма',
|
||||||
12 => 'средняя травма',
|
12 => 'Средняя травма',
|
||||||
13 => 'тяжёлая травма',
|
13 => 'Тяжёлая травма',
|
||||||
14 => 'неизлечимая травма',
|
14 => 'Неизлечимая травма',
|
||||||
20 => 'Проверка Паладинов',
|
20 => 'Проверка Паладинов',
|
||||||
21 => 'Сила нейтралитета',
|
21 => 'Сила нейтралитета',
|
||||||
22 => 'Защита от кулачного нападения',
|
22 => 'Защита от кулачного нападения',
|
||||||
|
@ -205,12 +205,12 @@ class UserStats extends User
|
|||||||
{
|
{
|
||||||
$query = "
|
$query = "
|
||||||
select
|
select
|
||||||
sum(greatest(strength + (ifnull((select sum(add_strength) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as strength,
|
sum(greatest(strength + (ifnull((select sum(add_strength) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_strength) from users_effects where owner_id = $this->id), 0)), 0)) as strength,
|
||||||
sum(greatest(dexterity + (ifnull((select sum(add_dexterity) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as dexterity,
|
sum(greatest(dexterity + (ifnull((select sum(add_dexterity) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_dexterity) from users_effects where owner_id = $this->id), 0)), 0)) as dexterity,
|
||||||
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)) + (ifnull((select sum(mod_intuition) from users_effects where 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)) + (ifnull((select sum(mod_endurance) from users_effects where 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)) + (ifnull((select sum(mod_intelligence) from users_effects where 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)) + (ifnull((select sum(mod_wisdom) from users_effects where 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_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_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,
|
ifnull((select sum(add_criticals) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as criticals,
|
||||||
|
Loading…
Reference in New Issue
Block a user