WIP: перед введенимем класса Fighter.php

This commit is contained in:
2024-01-06 00:14:35 +02:00
parent 07f905ef64
commit a2c658166d
67 changed files with 5555 additions and 7135 deletions
+61 -53
View File
@@ -84,7 +84,7 @@ class Priems
$mpNow = $this->zeromax($btl->stats[$btl->uids[$uid]]['mpNow'], $btl->stats[$btl->uids[$uid]]['mpAll']);
if ($mpNow > 0) {
Db::sql(
'update stats set mpNow = ? where id = ?',
'update stats set mpnow = ? where id = ?',
[$btl->stats[$btl->uids[$uid]]['mpNow'], $uid]
);
}
@@ -113,7 +113,7 @@ class Priems
$u = $this->u; // Для присоедиянемых файлов.
$return_main = true;
$ue = Db::getRow(
'select * from users left join stats on (users.id = stats.id) where users.id = ? and battle = ? and hpNow > 0',
'select * from users left join stats on (users.id = stats.id) where users.id = ? and battle = ? and hpnow > 0',
[$eff['uid'], $btl->info['id']]
);
@@ -461,11 +461,11 @@ class Priems
/**
* Новая функция магического заклинания с приёма.
* Работает с числовыми приёмами в папке [priem].
* @param int $attackerId кто использует приём
* @param int $defenderId на кого использует приём
* @param float $damage базовый урон приёма
* @param string $damageType тип урона (стихия?) приходит строкой, и конвертируется функцией.
* @param bool $hasCritical флаг, что приём МОЖЕТ критовать
* @param int $attackerId кто использует приём
* @param int $defenderId на кого использует приём
* @param float $damage базовый урон приёма
* @param string $damageType тип урона (стихия?) приходит строкой, и конвертируется функцией.
* @param bool $hasCritical флаг, что приём МОЖЕТ критовать
* @return array [0|damage] int урон, [1|crit] bool был ли крит, [2|miss] bool был ли промах, [3|miss_type] int тип промаха (всегда = 2).
* @author Insallah
*/
@@ -781,8 +781,7 @@ class Priems
$krituet = true,
$heal = 0,
$namenew = null
)
{
) {
$trawm_off = false;
global $btl;
if ($namenew != null) {
@@ -961,7 +960,8 @@ class Priems
);
//заносим в лог боя
$vLog = 'time1=' . time() . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . '';
$vLog = 'time1=' . time(
) . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . '';
$mas1 = [
'time' => time(),
'battle' => $btl->info['id'],
@@ -1392,18 +1392,18 @@ class Priems
}
}
if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem']) && $btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem'] > 0 && $pl['nosh'] == 0) {
if ($btl->stats[$btl->uids[$this->u->info['id']]]['noshock_voda'] > 0 && substr(
$pl['img'], 0,
10
) == 'wis_water_') {
//вода
} else {
$notr++;
}
if (
isset($btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem']) &&
$btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem'] > 0 &&
$pl['nosh'] == 0 &&
($btl->stats[$btl->uids[$this->u->info['id']]]['noshock_voda'] <= 0 || !str_starts_with($pl['img'], 'wis_water_'))
) {
$notr++;
}
if ($pl['id'] == $btl->stats[$btl->uids[$this->u->info['id']]]['notuse_last_pr']) {
if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['notuse_last_pr']) &&
$pl['id'] == $btl->stats[$btl->uids[$this->u->info['id']]]['notuse_last_pr']) {
$notr++;
}
@@ -1423,7 +1423,7 @@ class Priems
if ($pl['xuse'] > 0) {
$xu = $this->u->testAction(
'`vars` = "use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '',
'`vars` = "use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'],
2
);
if ($xu[0] >= $pl['xuse']) {
@@ -1574,13 +1574,13 @@ class Priems
}
/**
* @param int $uid на кого кастуем
* @param int $pr id приема
* @param int $uid на кого кастуем
* @param int $pr id приема
* @param int|string $data дата, если -1, то добавляем дату3
* @param int $d2
* @param int $d2
* @param $tm
* @param int $h ход
* @param int $uu id юзера который использовал
* @param int $h ход
* @param int $uu id юзера который использовал
* @param $max
* @param $bj
* @param $tp
@@ -1609,8 +1609,7 @@ class Priems
$noupdatebtl = 0,
$noplus = 0,
$pname = null
)
{
) {
global $btl;
//$pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . (int)$pr));
$pl = Db::getRow('select * from priems where id = ?', [$pr]);
@@ -1664,7 +1663,7 @@ class Priems
unset($num);
}
if (!isset($num['id'])) {
$q = 'insert into eff_users (tr_life_user, bj, user_use, hod, v2, img2, id_eff, uid, name, data, overType, timeUse, v1) values (?,?,?,?,?,?,?,?,?,?,?,?,?)';
$q = 'insert into eff_users (tr_life_user, bj, user_use, hod, v2, img2, id_eff, uid, name, data, overtype, timeuse, v1) values (?,?,?,?,?,?,?,?,?,?,?,?,?)';
$image = !empty($pl['img']) ? $pl['img'] : $pl['id'];
$name = !empty($pname) ? $pname : $pl['name'];
$image .= '.gif';
@@ -1728,8 +1727,8 @@ class Priems
/** Получает строку data c шаблонной записью типа add_m11=2*{lvl1} и конвертирует в реальную строку.
* <br>Шаблон: <br>lvl1 = $uid[level] <br>ts5 = $uid[s5] <br>mpAll = $uid[mpAll]
* @param string $pl строка в формате data
* @param int $uid пользователь, параметры которого используются для подставки в шаблон.
* @param string $pl строка в формате data
* @param int $uid пользователь, параметры которого используются для подставки в шаблон.
* @return string строка в формате data с развёрнутыми шаблонами.
*/
public function redate($pl, $uid)
@@ -1740,13 +1739,13 @@ class Priems
$e = explode('|', $pl);
while ($i < count($e)) {
$f = explode('=', $e[$i]);
// $f[1] = $this->getdr(
// $f[1], [0 => 'lvl1', 1 => 'ts5', 2 => 'mpAll'], [
// 0 => $btl->users[$btl->uids[$uid]]['level'],
// 1 => $btl->stats[$btl->uids[$uid]]['s5'],
// 2 => $btl->stats[$btl->uids[$uid]]['mpAll'],
// ]
// );
// $f[1] = $this->getdr(
// $f[1], [0 => 'lvl1', 1 => 'ts5', 2 => 'mpAll'], [
// 0 => $btl->users[$btl->uids[$uid]]['level'],
// 1 => $btl->stats[$btl->uids[$uid]]['s5'],
// 2 => $btl->stats[$btl->uids[$uid]]['mpAll'],
// ]
// );
$f[1] = $this->getDynamicInfo($f[1]);
if ($f[0] != '' && $f[1] != '') {
$e[$i] = implode('=', $f);
@@ -1977,7 +1976,8 @@ class Priems
} else {
//бьем противника с пропуском хода
mysql_query(
'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->info['id'] . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time() . '","1","1","2")'
'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->info['id'] . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time(
) . '","1","1","2")'
);
}
}
@@ -2081,9 +2081,11 @@ class Priems
);
if ($upd) {
TrainingManager::getInstance()
->addPoint('my_user_fourth_quest', function (TrainingManager $manager) {
$manager->store();
});
->addPoint(
'my_user_fourth_quest', function (TrainingManager $manager) {
$manager->store();
}
);
$this->u->info['priems'] = $p;
}
} else {
@@ -2097,12 +2099,16 @@ class Priems
public function getTechniquesInfo(?int $id = null): array
{
if (isset($id)) {
return Db::getRow('SELECT * FROM techniques_categories LEFT JOIN priems ON techniques_categories.technique_id = priems.id
WHERE priems.level <= ? AND priems.activ > 0 AND priems.id = ? ORDER BY priems.img,priems.level', [User::start()->info['level'], $id]);
return Db::getRow(
'select * from techniques_categories left join priems on techniques_categories.technique_id = priems.id
where priems.level <= ? and priems.activ > 0 and priems.id = ? order by priems.img,priems.level', [User::start()->info['level'], $id]
);
}
return Db::getRows('SELECT * FROM techniques_categories LEFT JOIN priems ON techniques_categories.technique_id = priems.id
WHERE priems.level <= ? AND priems.activ > 0 ORDER BY priems.img,priems.level', [User::start()->info['level']]);
return Db::getRows(
'select * from techniques_categories left join priems on techniques_categories.technique_id = priems.id
where priems.level <= ? and priems.activ > 0 order by priems.img,priems.level', [User::start()->info['level']]
);
}
public function seeMy($t)
@@ -2294,7 +2300,9 @@ class Priems
echo
<<< HTML
<a href="javascript:void(0)" onclick="location.href='main.php?skills=1&rz=4&use_priem=$priem[id]';">
<img class="pwq$priem[category_id] pwqall" onMouseOver="top.popup(this, '(#$priem[id]) <b>$priem[name]</b><Br>{$this->priemInfo($priem, 1)[0]}');" onMouseOut="top.hic();" onMouseDown="top.hic();" style="display:none;margin-top:2px; $cl margin-left:1px;" src="//img.new-combats.tech/i/eff/$priem[img].gif" width="40" height="25" />
<img class="pwq$priem[category_id] pwqall" onMouseOver="top.popup(this, '(#$priem[id]) <b>$priem[name]</b><Br>{$this->priemInfo(
$priem, 1
)[0]}');" onMouseOut="top.hic();" onMouseDown="top.hic();" style="display:none;margin-top:2px; $cl margin-left:1px;" src="//img.new-combats.tech/i/eff/$priem[img].gif" width="40" height="25" />
</a>
HTML;
}
@@ -2358,7 +2366,7 @@ class Priems
$btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow'];
Db::sql('update stats set hpNow = ? where id = ?', [$btl->stats[$btl->uids[$u1]]['hpNow'], $u1]);
Db::sql('update stats set hpnow = ? where id = ?', [$btl->stats[$btl->uids[$u1]]['hpNow'], $u1]);
$color = $this->logColor[self::FIRE];
$prv['text'] = '{u2} утратил здоровье от &quot;{pr}&quot; ';
@@ -2444,7 +2452,7 @@ class Priems
$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $this->ue['hpNow'];
Db::sql('update stats set hpNow = ? where id = ?', [$this->ue['hpNow'], $this->ue['id']]);
Db::sql('update stats set hpnow = ? where id = ?', [$this->ue['hpNow'], $this->ue['id']]);
if ($isMiss) {
$color = $this->logColor['miss'];
@@ -2623,7 +2631,7 @@ class Priems
$uu = $pl['id'] === 260 ? '' : $this->u->info['id'];
Db::sql(
'insert into eff_users (hod, v1, v2, img2, id_eff, uid, name, data, overType, timeUse, user_use) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
'insert into eff_users (hod, v1, v2, img2, id_eff, uid, name, data, overtype, timeuse, user_use) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
[$hd1, 'priem', $pl['id'], $pl['img'] . '.gif', 22, $uid, $pl['name'], $data, 0, $tm, $uu]
);
@@ -2724,7 +2732,7 @@ class Priems
* Конечный damage после множителей делится на 5 и пишется в БД (atgm=).
* Файлы: 33, 56, 57, 58, 59, 60.
* @param $id
* @param array $pl массив значений из БД priems.
* @param array $pl массив значений из БД priems.
* @param Battle $btl
* @return void
*/
@@ -2756,7 +2764,7 @@ class Priems
* Если есть одинаковые статы из них выбирается случайный.
* Файл:267, приём 268. Понимай как хочешь.
* @param $id
* @param array $pl
* @param array $pl
* @param Battle $btl
* @return void
*/
@@ -2765,7 +2773,7 @@ class Priems
$q = 'select stats as data from stats where id = ?
union all select stats as data from test_bot where id = ?
union all select data from eff_users where `delete` = 0 and uid = ?
union all select data from items_users where inOdet > 0 and `delete` = 0 and uid = ?';
union all select data from items_users where inodet > 0 and `delete` = 0 and uid = ?';
$datas = Db::getColumn($q, array_fill(0, 3, $this->ue['id']));
$stats = array_fill_keys(['s1', 's2', 's3', 's5', 's6'], 0);
foreach ($datas as $data) {