Delete page 'Старая функция выдачи и снятия травм'
parent
d5fb2e8091
commit
0eb7dc08d0
@ -1,169 +0,0 @@
|
||||
```PHP
|
||||
//ставим травму
|
||||
function settravma($id, $type, $time = 86400, $kill = false)
|
||||
{
|
||||
$user = mysql_fetch_array(mysql_query("SELECT `align`, `level` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
|
||||
if ((($user['align'] == 2 && mt_rand(1, 100) > 20) && !$kill) || ($user['level'] == 0)) {
|
||||
return false;
|
||||
} else {
|
||||
$travmalist = ["разбитый нос", "сотрясение первой степени", "потрепанные уши", "прикушенный язык", "перелом переносицы", "растяжение ноги", "растяжение руки", "подбитый глаз", "синяк под глазом", "кровоточащее рассечение", "отбитая «пятая точка»", "заклинившая челюсть", "выбитый зуб «мудрости»", "косоглазие"];
|
||||
$travmalist2 = ["отбитые почки", "вывих «вырезано цензурой»", "сотрясение второй степени", "оторванное ухо", "вывих руки", "оторванные уши", "поврежденный позвоночник", "отбитые почки", "поврежденный копчик", "разрыв сухожилия", "перелом ребра", "перелом двух ребер", "вывих ноги", "сломанная челюсть"];
|
||||
$travmalist3 = ["пробитый череп", "разрыв селезенки", "смещение позвонков", "открытый перелом руки", "открытый перелом «вырезано цензурой»", "излом носоглотки", "непонятные, но множественные травмы", "сильное внутреннее кровотечение", "раздробленная коленная чашечка", "перелом шеи", "смещение позвонков", "открытый перелом ключицы", "перелом позвоночника", "вывих позвоночника", "сотрясение третьей степени"];
|
||||
$owntravma = mysql_fetch_array(mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `hp` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13) ORDER BY `type` DESC LIMIT 1"));
|
||||
if ($type != 0 && $type != 100) {
|
||||
$owntravma['type'] = $type;
|
||||
} elseif ($type != 0 && $type == 100 && $owntravma['type'] == 0) {
|
||||
$type = mt_rand(1, 100);
|
||||
if ($type < 10) {
|
||||
$owntravma['type'] = 25;
|
||||
} elseif ($type < 60) {
|
||||
$owntravma['type'] = "set";
|
||||
} elseif ($type < 85) {
|
||||
$owntravma['type'] = 11;
|
||||
} else {
|
||||
$owntravma['type'] = 12;
|
||||
}
|
||||
} elseif ($owntravma['type'] == 0) {
|
||||
$tr = mt_rand(1, 3);
|
||||
switch ($tr) {
|
||||
case 1:
|
||||
$owntravma['type'] = 0;
|
||||
break;
|
||||
case 2:
|
||||
$owntravma['type'] = 11;
|
||||
break;
|
||||
case 3:
|
||||
$owntravma['type'] = 12;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($owntravma['type']) {
|
||||
|
||||
case 20:
|
||||
$st = mt_rand(0, 2);
|
||||
$zz = mt_rand(1, 3);
|
||||
$s = 0;
|
||||
$l = 0;
|
||||
$i = 0;
|
||||
switch ($zz) {
|
||||
case 1:
|
||||
$s = ($user['level'] + $st) * 3;
|
||||
break;
|
||||
case 2:
|
||||
$l = ($user['level'] + $st) * 3;
|
||||
break;
|
||||
case 3:
|
||||
$i = ($user['level'] + $st) * 3;
|
||||
break;
|
||||
}
|
||||
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
|
||||
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма "" . $trv . ""', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
|
||||
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
|
||||
return $trv;
|
||||
break;
|
||||
|
||||
default:
|
||||
$st = mt_rand(0, 2);
|
||||
$zz = mt_rand(1, 3);
|
||||
$s = 0;
|
||||
$l = 0;
|
||||
$i = 0;
|
||||
switch ($zz) {
|
||||
case 1:
|
||||
$s = $user['level'] + $st;
|
||||
break;
|
||||
case 2:
|
||||
$l = $user['level'] + $st;
|
||||
break;
|
||||
case 3:
|
||||
$i = $user['level'] + $st;
|
||||
break;
|
||||
}
|
||||
$trv = $travmalist[mt_rand(0, count($travmalist) - 1)];
|
||||
$time = 60 * 60 * mt_rand(1, 5);
|
||||
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма "" . $trv . ""', " . (time() + $time) . ", '11', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
|
||||
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
|
||||
return $trv;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
$zz = mt_rand(1, 3);
|
||||
$s = 0;
|
||||
$l = 0;
|
||||
$i = 0;
|
||||
switch ($zz) {
|
||||
case 1:
|
||||
$s = ($user['level']) * 2;
|
||||
break;
|
||||
case 2:
|
||||
$l = ($user['level']) * 2;
|
||||
break;
|
||||
case 3:
|
||||
$i = ($user['level']) * 2;
|
||||
break;
|
||||
}
|
||||
$trv = $travmalist2[mt_rand(0, count($travmalist2) - 1)];
|
||||
$time = 60 * 60 * mt_rand(5, 15);
|
||||
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма "" . $trv . ""', " . (time() + $time) . ", '12', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
|
||||
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
|
||||
return $trv;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
$zz = mt_rand(1, 3);
|
||||
$s = 0;
|
||||
$l = 0;
|
||||
$i = 0;
|
||||
switch ($zz) {
|
||||
case 1:
|
||||
$s = ($user['level']) * 3;
|
||||
break;
|
||||
case 2:
|
||||
$l = ($user['level']) * 3;
|
||||
break;
|
||||
case 3:
|
||||
$i = ($user['level']) * 3;
|
||||
break;
|
||||
}
|
||||
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
|
||||
$time = 60 * 60 * mt_rand(15, 24);
|
||||
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма "" . $trv . ""', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
|
||||
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
|
||||
return $trv;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
$zz = mt_rand(1, 3);
|
||||
$s = 0;
|
||||
$l = 0;
|
||||
$i = 0;
|
||||
switch ($zz) {
|
||||
case 1:
|
||||
$s = ($user['level']) * 3;
|
||||
break;
|
||||
case 2:
|
||||
$l = ($user['level']) * 3;
|
||||
break;
|
||||
case 3:
|
||||
$i = ($user['level']) * 3;
|
||||
break;
|
||||
}
|
||||
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
|
||||
$time = 60 * 60 * mt_rand(25, 26);
|
||||
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма "" . $trv . ""', " . (time() + $time) . ", '14', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
|
||||
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
|
||||
return $trv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deltravma($id)
|
||||
{
|
||||
$owntravmadb = db::c()->query('SELECT id FROM effects WHERE (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14) AND id = ?i', $id);
|
||||
while ($owntravma = $owntravmadb->fetch_assoc_array()) {
|
||||
db::c()->query('DELETE FROM `effects` WHERE `id` = ?i', $owntravma['id']);
|
||||
}
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user