This commit is contained in:
2024-02-10 03:12:05 +02:00
parent 7986d33ab6
commit 7c15294688
13 changed files with 389 additions and 403 deletions

View File

@@ -462,6 +462,7 @@ class Battle
$st = $this->stats[$this->uids[$id]];
$itm = $this->stats[$this->uids[$id]]['items'];
$eff = $this->stats[$this->uids[$id]]['effects'];
$i = 0;
$img = Config::img();
@@ -470,171 +471,175 @@ class Battle
$armor3 = '<br>Броня пояса: ';
$armor4 = '<br>Броня ног: ';
if ($u->info['seff'] < 1) {
# Передаётся в js, переносы строк всё ломают!
$ef = <<<HTML
if (empty($eff)) {
$ef = '';
} else {
if ($u->info['seff'] < 1) {
# Передаётся в js, переносы строк всё ломают!
$ef = <<<HTML
<div class="pimg" pog="0" col="0" stl="0" stt="Свернуть"><img src="$img/i/eff/effs_hide.gif" alt="" onclick="top.useMagicBattle('Свернуть',7777,'effs_show.gif',1,2);" onmouseover="top.hi(this,'<strong>Свернуть</strong>',event,3,1,1,1);" onmouseout="top.hic();" onmousedown="top.hic();"></div>
HTML;
while ($i != -1) {
$nseef = 0;
if (
$this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] &&
$ur['id'] != 0 && $this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1
) {
$nseef = 1;
if (isset($eff[$i]['v1']) && $eff[$i]['v1'] == 'priem') {
$eff[$i]['priem'] = Db::getRow('select * from priems where id = ?', [$eff[$i]['v2']]);
while ($i != -1) {
$nseef = 0;
if (
$this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] &&
$ur['id'] != 0 && $this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1
) {
$nseef = 1;
if (isset($eff[$i]['v1']) && $eff[$i]['v1'] == 'priem') {
$eff[$i]['priem'] = Db::getRow('select * from priems where id = ?', [$eff[$i]['v2']]);
}
if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) {
$nseef = 0;
}
}
if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) {
$nseef = 0;
}
}
if (isset($eff[$i]) && $eff[$i] != 'delete') {
if ($nseef == 0) {
$ei = '<strong><u>' . $eff[$i]['name'] . '</u></strong>';
if ($eff[$i]['x'] > 1) {
$ei .= ' x' . $eff[$i]['x'] . ' ';
}
$ei .= match ($eff[$i]['type1']) {
1, 2, 3, 4, 5, 6 => ' (Эликсир)',
7, 8, 9, 10, 16 => ' (Заклятие)',
14 => ' (Прием)',
15 => ' (Изучение)',
17 => ' (Проклятие)',
18, 19 => ' (Травма)',
20 => ' (Пристрастие)',
22 => ' (Ожидание)',
default => ' (Эффект)'
};
$ei .= '<br>';
$time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']);
if ($eff[$i]['timeAce'] == 0) {
$time_still += $eff[$i]['timeUse'];
}
$time_still -= time();
if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) {
if ($eff[$i]['type1'] != 13) {
$ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still);
if (isset($eff[$i]) && $eff[$i] != 'delete') {
if ($nseef == 0) {
$ei = '<strong><u>' . $eff[$i]['name'] . '</u></strong>';
if ($eff[$i]['x'] > 1) {
$ei .= ' x' . $eff[$i]['x'] . ' ';
}
} else {
if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) {
$ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still);
} elseif ($eff[$i]['hod'] >= 0) {
$ei .= 'Зарядов: ' . $eff[$i]['hod'];
$ei .= match ($eff[$i]['type1']) {
1, 2, 3, 4, 5, 6 => ' (Эликсир)',
7, 8, 9, 10, 16 => ' (Заклятие)',
14 => ' (Прием)',
15 => ' (Изучение)',
17 => ' (Проклятие)',
18, 19 => ' (Травма)',
20 => ' (Пристрастие)',
22 => ' (Ожидание)',
default => ' (Эффект)'
};
$ei .= '<br>';
$time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']);
if ($eff[$i]['timeAce'] == 0) {
$time_still += $eff[$i]['timeUse'];
}
}
if ($eff[$i]['user_use'] != '') {
$str = '<br>Автор: <strong>%s</strong>';
if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') {
$ei .= sprintf($str, $this->users[$this->uids[$eff[$i]['user_use']]]['login2']);
} elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
$ei .= sprintf($str, $this->users[$this->uids[$eff[$i]['user_use']]]['login']);
}
unset($str);
}
//Действие эффекта
$tr = '';
$x = 0;
$ed = Conversion::dataStringToArray($eff[$i]['data']);
while ($x < count($this->statnames->sysBonusNames)) {
$n = $this->statnames->sysBonusNames[$x];
if (isset($ed['add_' . $n]) && $n != 'pog') {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
$time_still -= time();
if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) {
if ($eff[$i]['type1'] != 13) {
$ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still);
}
$tr .= '<br>' . $this->statnames->bonusNames[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
if (isset($ed['add_mib1']) && $ed['add_mib1'] != 0) {
if ($ed['add_mab1'] != 0) {
$tr .= $armor1 . $ed['add_mib1'] . '-' . $ed['add_mab1'];
} else {
$m1l = $ed['add_mib1'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) {
$ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still);
} elseif ($eff[$i]['hod'] >= 0) {
$ei .= 'Зарядов: ' . $eff[$i]['hod'];
}
$tr .= $armor1 . $m1l;
}
}
if (isset($ed['add_mib2']) && $ed['add_mib2'] != 0) {
if ($ed['add_mab2'] != 0) {
$tr .= $armor2 . $ed['add_mib2'] . '-' . $ed['add_mab2'];
} else {
$m1l = $ed['add_mib2'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor2 . $m1l;
}
}
if (isset($ed['add_mib3']) && $ed['add_mib3'] != 0) {
if ($ed['add_mab3'] != 0) {
$tr .= $armor3 . $ed['add_mib3'] . '-' . $ed['add_mab3'];
} else {
$m1l = $ed['add_mib3'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor3 . $m1l;
}
}
if (isset($ed['add_mib4']) && $ed['add_mib4'] != 0) {
if ($ed['add_mab4'] != 0) {
$tr .= $armor4 . $ed['add_mib4'] . '-' . $ed['add_mab4'];
} else {
$m1l = $ed['add_mib4'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor4 . $m1l;
}
}
$efix = 0;
if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
$efix = $ed['add_pog2'];
}
if (isset($ed['add_pog'])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed['add_pog'] . '</strong> ед. урона';
}
if (isset($ed['add_pog2'])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed['add_pog2'] . '</strong> ед. урона <small>(' . $ed['add_pog2p'] . '%)</small>';
}
if ($eff[$i]['user_use'] != '') {
$str = '<br>Автор: <strong>%s</strong>';
if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') {
$ei .= sprintf($str, $this->users[$this->uids[$eff[$i]['user_use']]]['login2']);
} elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
$ei .= sprintf($str, $this->users[$this->uids[$eff[$i]['user_use']]]['login']);
}
unset($str);
}
if ($tr != '') {
$ei .= $tr;
}
if ($eff[$i]['info'] != '') {
$ei .= '<br><i>Информация:</i><br>' . $eff[$i]['info'];
}
//Действие эффекта
$tr = '';
$efcol = $eff[$i]['x'];
$efimg = $eff[$i]['img'];
$ef .= <<<HTML
$x = 0;
$ed = Conversion::dataStringToArray($eff[$i]['data']);
while ($x < count($this->statnames->sysBonusNames)) {
$n = $this->statnames->sysBonusNames[$x];
if (isset($ed['add_' . $n]) && $n != 'pog') {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $this->statnames->bonusNames[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
if (isset($ed['add_mib1']) && $ed['add_mib1'] != 0) {
if ($ed['add_mab1'] != 0) {
$tr .= $armor1 . $ed['add_mib1'] . '-' . $ed['add_mab1'];
} else {
$m1l = $ed['add_mib1'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor1 . $m1l;
}
}
if (isset($ed['add_mib2']) && $ed['add_mib2'] != 0) {
if ($ed['add_mab2'] != 0) {
$tr .= $armor2 . $ed['add_mib2'] . '-' . $ed['add_mab2'];
} else {
$m1l = $ed['add_mib2'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor2 . $m1l;
}
}
if (isset($ed['add_mib3']) && $ed['add_mib3'] != 0) {
if ($ed['add_mab3'] != 0) {
$tr .= $armor3 . $ed['add_mib3'] . '-' . $ed['add_mab3'];
} else {
$m1l = $ed['add_mib3'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor3 . $m1l;
}
}
if (isset($ed['add_mib4']) && $ed['add_mib4'] != 0) {
if ($ed['add_mab4'] != 0) {
$tr .= $armor4 . $ed['add_mib4'] . '-' . $ed['add_mab4'];
} else {
$m1l = $ed['add_mib4'];
if ($m1l > 0) {
$m1l = '+' . $m1l;
}
$tr .= $armor4 . $m1l;
}
}
$efix = 0;
if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
$efix = $ed['add_pog2'];
}
if (isset($ed['add_pog'])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed['add_pog'] . '</strong> ед. урона';
}
if (isset($ed['add_pog2'])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed['add_pog2'] . '</strong> ед. урона <small>(' . $ed['add_pog2p'] . '%)</small>';
}
if ($tr != '') {
$ei .= $tr;
}
if ($eff[$i]['info'] != '') {
$ei .= '<br><i>Информация:</i><br>' . $eff[$i]['info'];
}
$efcol = $eff[$i]['x'];
$efimg = $eff[$i]['img'];
$ef .= <<<HTML
<div class="pimg" pog="$efix" col="$efcol" stl="0" stt="$ei"><img src="$img/i/eff/$efimg" alt=""></div>
HTML;
unset($efix, $efcol, $efimg);
unset($efix, $efcol, $efimg);
}
} elseif ($eff[$i] != 'delete') {
$i = -2;
}
} elseif ($eff[$i] != 'delete') {
$i = -2;
$i++;
}
$i++;
}
} else {
$ef = <<<HTML
} else {
$ef = <<<HTML
<div class="pimg" pog="0" col="0" stl="0" stt="Развернуть">
<img src="$img/i/eff/effs_show.gif" alt=""
onclick="top.useMagicBattle('Развернуть',5555,'effs_hide.gif',1,2)"
@@ -643,8 +648,8 @@ class Battle
>
</div>
HTML;
}
}
$ca = '';
if ($ur['clan'] > 0) {
@@ -712,9 +717,9 @@ JS;
$i = 0;
if (is_array($itm)) {
while ($i < count($itm)) {
//
if (isset($st['items_img'][$tpImg[$itm[$i]['inOdet']]])) {
if (isset($tpImg[$itm[$i]['inOdet']], $st['items_img'][$tpImg[$itm[$i]['inOdet']]])) {
$itm[$i]['img'] = $st['items_img'][$tpImg[$itm[$i]['inOdet']]];
}
//генерируем предметы
@@ -782,7 +787,7 @@ JS;
}
$var1 = (int)$t;
$var2 = (int)$itm[$i]['uid'];
$var2 = (int)$id;
$var3 = (int)$itm[$i]['id'];
$var4 = (int)$itm[$i]['inOdet'];
$var5 = $itm[$i]['name'];
@@ -808,7 +813,6 @@ JS;
public function testUsersLive(): bool
{
$tl = 0;
for ($i = 0; $i < count($this->uids); $i++) {
if (empty($this->stats[$i]['id'])) {
continue;
@@ -1455,7 +1459,7 @@ JS;
*/
private function testExp($y, $s2): int
{
if ($s2['levels'] == 'undefined' || $this->users[$this->uids[$s2['id']]]['pass'] == 'saintlucia') {
if ($s2['levels'] == 'undefined' || $this->users[$this->uids[$s2['id']]]['bot'] > 0) {
return 0;
}
@@ -1860,16 +1864,17 @@ JS;
mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '"');
}
}
}
//тест удара
if ($this->uAtc['id'] > 0) {
if ($pl['out1'] == 0 && $pl['out2'] == 0) {
//Может разменяться только тот кто бил
if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) {
//тест удара
if ($this->uAtc['id'] > 0) {
if ($pl['out1'] == 0 && $pl['out2'] == 0) {
//Может разменяться только тот кто бил
if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) {
$this->addNewAtack($u);
}
} else {
$this->addNewAtack($u);
}
} else {
$this->addNewAtack($u);
}
}
@@ -1879,10 +1884,9 @@ JS;
if (
isset($bot) &&
$this->stats[$this->uids[$bot]]['hpNow'] >= 1 &&
$this->stats[$this->uids[$bot]]['pass'] != 'saintlucia'
$this->users[$this->uids[$bot]]['bot'] != 1
) { //Тут проверка на бота saintlucia
$j = 0;
while ($j < count($this->users)) {
if ($this->i->razdel == 0) {
$tnbot = time() + rand(1, 1);
@@ -1955,25 +1959,28 @@ JS;
$this->users[$j]['hpnow'] >= 1 &&
$this->users[$this->uids[$bot]]['hpnow'] >= 1
) {
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] =
rand(1, 5) . '' . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
if (isset($this->ga[$bot][$this->users[$j]['id']])) {
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] =
rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] =
rand(1, 5) . '' . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] =
rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
$this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
}
if (isset($this->ag[$bot][$this->users[$j]['id']])) {
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] =
rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] =
rand(1, 5) . '' . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] =
rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] =
rand(1, 5) . '' . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
$this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
}
if (
isset($this->ga[$bot][$this->users[$j]['id']]) &&
@@ -2022,7 +2029,16 @@ JS;
}
}
//Приемы которые используются моментально (в конце хода)
/**
* Массово встречается в подключаемых файлах приёмов.
* @param array $arr
* @return void
* @deprecated
*/
public function add_log(array $arr): void
{
Log::add($arr);
}
private function botAtack($uid, $pl, $tp): void
{
@@ -2217,7 +2233,7 @@ JS;
// Заносим в логи + записываем статистику боя
$this->addlogRazmen($id, $at);
var_dump($at);
//Запускаем магию предметов
$this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id);
$this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id);
@@ -3867,7 +3883,7 @@ JS;
Log::add($mas);
$j++;
}
var_dump($at);
}
//Добавляем статистику + записываем в баттл_юзерс НР игроков
@@ -4414,6 +4430,8 @@ JS;
return;
}
var_dump($_POST);
//atack: '3_2_0_0_0' (length=9)
//block: '5' (length=1)
@@ -4441,6 +4459,7 @@ JS;
}
$this->uAtc = $na;
$js .= 'testClearZone();';
var_dump($this->uAtc);
}
public function teamsTake(User $u): void
@@ -4769,6 +4788,7 @@ JS;
while ($i < count($this->uids)) {
if ($this->stats[$i]['hpNow'] > 0) {
if (!isset($teams[$this->users[$i]['team']])) {
$teams[$this->users[$i]['team']] = '';
$tms[$j] = $this->users[$i]['team'];
$j++;
}
@@ -4821,6 +4841,7 @@ JS;
$i++;
}
//генерируем команды
$i = 0;
while ($i < count($tms)) {