WIP: removing User::class public array $items for Stat()::class.

This commit is contained in:
Ivor Barhansky 2024-01-08 03:33:20 +02:00
parent 4a7535d67d
commit 9652ee5c8e
22 changed files with 811 additions and 971 deletions

327
AI.php
View File

@ -101,26 +101,7 @@ var_dump((new ShopOtdel())->getGroups());
?>
</div>
</div>
<hr>
Совпадения по параметрам $user->info и $user->stats. Возможно, это ничего не значит, а может и дублирование.<br><br>
<?php
$i = 1;
$i2 = 1;
foreach ($user->info as $a => $b) {
if (isset($user->stats[$a])) {
echo "$i. info = stats: $a = $b<br>";
$i++;
}
}
echo '<br>';
foreach ($user->stats as $a2 => $b2) {
if (isset($user->info[$a2])) {
echo "$i2. stats = info: $a2 = $b2<br>";
$i2++;
}
}
?>
<br>
<div style="display: grid; grid-template-columns: auto auto;">
<div> Поля в базе users
@ -161,315 +142,9 @@ foreach ($user->stats as $a2 => $b2) {
</div>
</div>
<hr> Все возможные поля в $user->stats. Некоторые имена полей генерируются динамически на лету, поэтому соответствия имени нет. А каких-то, возможно просто не существует.<br><br>
<?php
$st['clanpos'] = 0;
$st['levels'] = 0;
$st['levels'] = 0;
$st['id'] = 0;
$st['login'] = 0;
$st['lvl'] = 0;
$st['hpNow'] = 0;
$st['hpAll'] = 0;
$st['mpNow'] = 0;
$st['mpAll'] = 0;
$st['zona'] = 0;
$st['zonb'] = 0;
$st['items'] = 0;
$st['effects'] = 0;
$st['reting'] = 0;
$st['vip'] = 0;
$st['items_img'] = 0;
$st['reting'] = 0;
$st['wp'] = 0;
$st['items'] = 0;
$st['reting'] = 0;
$st['art'] = 0;
$st['maks_itm'] = 0;
$st['zonb'] = 0;
$st['zona'] = 0;
$st['a'] = 0;
$st['mg'] = 0;
$st['s'] = 0;
$st['effects'] = 0;
$st['puti'] = 0;
$st['slvtm'] = 0;
$st['act'] = 0;
$st['noeffectbattle1'] = 0;
$st['items_img'] = 0;
$st['set_pog'] = 0;
$st['set_pog2'] = 0;
$st['act'] = 0;
$st['effects'] = 0;
$st['raztac'] = 0;
$st['set_natoe'] = 0;
$st['act'] = 0;
$st['hpAll'] = 0;
$st['s4'] = 0;
$st['mpAll'] = 0;
$st['m1'] = 0;
$st['s3'] = 0;
$st['m2'] = 0;
$st['s6'] = 0;
$st['s3'] = 0;
$st['m4'] = 0;
$st['s2'] = 0;
$st['m5'] = 0;
$st['za'] = 0;
$st['s4'] = 0;
$st['zm'] = 0;
$st['zaproc'] = 0;
$st['s5'] = 0;
$st['m19'] = 0;
$st['s3'] = 0;
$st['antm3'] = 0;
$st['s5'] = 0;
$st['m10'] = 0;
$st['m11'] = 0;
$st['m11a'] = 0;
$st['m8'] = 0;
$st['zona'] = 0;
$st['zonb'] = 0;
$st['pm'] = 0;
$st['a'] = 0;
$st['mg'] = 0;
$st['zm'] = 0;
$st['s5'] = 0;
$st['pm'] = 0;
$st['s5'] = 0;
$st['m11a'] = 0;
$st['pm'] = 0;
$st['a'] = 0;
$st['aall'] = 0;
$st['m2all'] = 0;
$st['mg'] = 0;
$st['m2all'] = 0;
$st['zm'] = 0;
$st['zma'] = 0;
$st['mib'] = 0;
$st['mab'] = 0;
$st['mg'] = 0;
$st['pm'] = 0;
$st['pa'] = 0;
$st['za'] = 0;
$st['mall'] = 0;
$st['mg'] = 0;
$st['mall'] = 0;
$st['m11'] = 0;
$st['pm'] = 0;
$st['m11'] = 0;
$st['m10'] = 0;
$st['pa'] = 0;
$st['m10'] = 0;
$st['za'] = 0;
$st['za'] = 0;
$st['za'] = 0;
$st['yzm'] = 0;
$st['yzma'] = 0;
$st['yza'] = 0;
$st['za'] = 0;
$st['hpVinos'] = 0;
$st['hpAll'] = 0;
$st['s4'] = 0;
$st['mpAll'] = 0;
$st['mpVinos'] = 0;
$st['s6'] = 0;
$st['hpProc'] = 0;
$st['hpAll'] = 0;
$st['mpProc'] = 0;
$st['hpNow'] = 0;
$st['hpAll'] = 0;
$st['hpNow'] = 0;
$st['hpAll'] = 0;
$st['mpNow'] = 0;
$st['mpAll'] = 0;
$st['mpNow'] = 0;
$st['mpAll'] = 0;
$st['zona'] = 0;
$st['zonb'] = 0;
$st['ozash'] = 0;
$st['ozmsh'] = 0;
$st['weapon1'] = 0;
$st['weapon2'] = 0;
$st['sheld1'] = 0;
$st['sv_'] = 0;
$st['sv_i'] = 0;
$st['dom'] = 0;
$st['prsu'] = 0;
$st['x'] = 0;
$st['y'] = 0;
$st['s'] = 0;
$st['reting'] = 0;
$st['reting'] = 0;
$st['maxves'] = 0;
$st['speed_dungeon'] = 0;
$st['speedhp'] = 0;
$st['exp'] = 0;
$st['reting'] = 0;
$st['reting'] = 0;
$st['btl_cof'] = 0;
$st['prckr'] = 0;
$st['btl_cof'] = 0;
$st['prckr'] = 0;
$st['btl_cof'] = 0;
$st['prckr'] = 0;
$st['prckr'] = 0;
$st['id'] = 0;
$st['hpAll'] = 0;
$st['hpAll'] = 0;
$st['mpAll'] = 0;
$st['mpAll'] = 0;
$st['this_animal'] = 0;
$st['this_animal'] = 0;
$st['hpAll'] = 0;
$st['mpAll'] = 0;
$st['hpAll'] = 0;
$st['mpAll'] = 0;
$st['add_'] = 0;
$st['add_'] = 0;
$st['add_'] = 0;
$st['s1'] = 0;
$st['s1'] = 0;
$st['m2'] = 0;
$st['s1'] = 0;
$st['s1'] = 0;
$st['pa2'] = 0;
$st['m2'] = 0;
$st['s1'] = 0;
$st['s1'] = 0;
$st['pa2'] = 0;
$st['m2'] = 0;
$st['s1'] = 0;
$st['s1'] = 0;
$st['pa2'] = 0;
$st['m7'] = 0;
$st['s1'] = 0;
$st['s1'] = 0;
$st['pa2'] = 0;
$st['m7'] = 0;
$st['s1'] = 0;
$st['pa2'] = 0;
$st['m7'] = 0;
$st['s2'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m4'] = 0;
$st['s2'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m2'] = 0;
$st['m4'] = 0;
$st['s2'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m2'] = 0;
$st['m4'] = 0;
$st['m15'] = 0;
$st['s2'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m2'] = 0;
$st['m4'] = 0;
$st['m15'] = 0;
$st['s2'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m2'] = 0;
$st['m4'] = 0;
$st['m15'] = 0;
$st['s2'] = 0;
$st['pa1'] = 0;
$st['m2'] = 0;
$st['m4'] = 0;
$st['m15'] = 0;
$st['s3'] = 0;
$st['s3'] = 0;
$st['pa4'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['s3'] = 0;
$st['s3'] = 0;
$st['pa4'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['s3'] = 0;
$st['s3'] = 0;
$st['pa4'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['m5'] = 0;
$st['s3'] = 0;
$st['s3'] = 0;
$st['pa4'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['m5'] = 0;
$st['s3'] = 0;
$st['s3'] = 0;
$st['pa4'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['m5'] = 0;
$st['m14'] = 0;
$st['m3'] = 0;
$st['m1'] = 0;
$st['m5'] = 0;
$st['m14'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['m19'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['m19'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['za'] = 0;
$st['zm'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['za'] = 0;
$st['zm'] = 0;
$st['s4'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['za'] = 0;
$st['zm'] = 0;
$st['s4'] = 0;
$st['hpAll'] = 0;
$st['za'] = 0;
$st['zm'] = 0;
$st['s5'] = 0;
$st['m11'] = 0;
$st['pzm'] = 0;
$st['s6'] = 0;
$st['mpAll'] = 0;
$st['speedmp'] = 0;
$st['s6'] = 0;
$st['pzm'] = 0;
$st['m10'] = 0;
$stnames = [];
foreach ($st as $k => $v) {
if (isset($user->is[$k])) {
$v = $user->is[$k];
}
$stnames[$k] = $v;
}
var_dump($stnames);
echo "<h5>Текущая таблица параметров</h5>";
foreach ($p as $prow) {
echo "{$prow['sys_name']}{$prow['name']}";

View File

@ -11,6 +11,7 @@ use Core\Config;
use Core\Db;
use DTO\BattlePriem;
use Helper\Conversion;
use Model\Constant\Stat;
use User\Effects;
use User\ItemsModel;
use User\Login;
@ -58,62 +59,7 @@ class Battle
/**Отображаем главное окно (1 - можно бить, 2 - ожидаем ход противника, 3 - Проиграли. Ожидаем завершения поединка)*/
public int $mainStatus = 1;
/**Информация о поединке
* array (size=51)
* 'id' => int 466012
* 'city' => string 'capitalcity' (length=11)
* 'time_start' => int 1704495486
* 'testfinish' => int 0
* 'players' => string '' (length=0)
* 'timeout' => int 60
* 'type' => int 0
* 'status' => int 0
* 'kulak' => int 0
* 'invis' => int 0
* 'noinc' => int 0
* 'travmChance' => int 0
* 'typeBattle' => int 0
* 'addExp' => float 0
* 'money' => float 0
* 'money3' => float 0
* 'time_over' => int 0
* 'team_win' => int -1
* 'dungeon' => string '0' (length=1)
* 'razdel' => int 5
* 'dn_id' => int 0
* 'x' => int 0
* 'y' => int 0
* 'fDate' => string '' (length=0)
* 'izlom' => int 0
* 'izlomLvl' => int 0
* 'izlomRound' => int 0
* 'start1' => int 1704495496
* 'start2' => int 1704495496
* 'izlomRoundSee' => int 0
* 'izlomObr' => int 0
* 'izlomObrNow' => int 0
* 'turnir' => int 0
* 'inTurnir' => int 0
* 'clone' => int 0
* 'players_c' => int 0
* 'fastfight' => int 0
* 'nobot' => null
* 'kingfight' => null
* 'arand' => null
* 'noatack' => null
* 'noeff' => null
* 'smert' => null
* 'noart' => null
* 'zarad' => int 0
* 'priz' => int 0
* 'otmorozok' => int 0
* 'otmorozok_use' => int 0
* 'hod' => int 0
* 'clan1' => int 0
* 'clan2' => int 0
* */
public array $info = [];
/** Информация о поединке.*/
public Info $i;
/**Информация о пользователях в этом бою*/
@ -172,7 +118,7 @@ class Battle
private Finish $finish;
public function __construct()
public function __construct(private Stat $statnames = new Stat())
{
ignore_user_abort(true);
$this->finish = new Finish($this);
@ -316,6 +262,13 @@ class Battle
public function initRefresh(User $user): bool
{
$this->i = new Info($user->info['battle']);
$this->hodID = Db::getValue('select id_hod from battle_logs where battle = ? order by id desc limit 1', [$this->i->id]);
if (!$this->hodID) {
$this->hodID = 0;
}
return !empty($this->i->id);
}
@ -528,7 +481,7 @@ class Battle
$ur['id'] != 0 && $this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1
) {
$nseef = 1;
if ($eff[$i]['v1'] == 'priem') {
if (isset($eff[$i]['v1']) && $eff[$i]['v1'] == 'priem') {
$eff[$i]['priem'] = Db::getRow('select * from priems where id = ?', [$eff[$i]['v2']]);
}
@ -587,22 +540,24 @@ class Battle
//Действие эффекта
$tr = '';
$ti = $u->items['add'];
$statBonusNames = $this->statnames->getBonusNames();
$statSysBonusNames = array_keys($statBonusNames);
$x = 0;
$ed = Conversion::dataStringToArray($eff[$i]['data']);
while ($x < count($ti)) {
$n = $ti[$x];
if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') {
while ($x < count($statSysBonusNames)) {
$n = $statSysBonusNames[$x];
if (isset($ed['add_' . $n]) && $n != 'pog') {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $u->is[$n] . ': ' . $z . $ed['add_' . $n];
$tr .= '<br>' . $statBonusNames[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
if ($ed['add_mib1'] != 0) {
if (isset($ed['add_mib1']) && $ed['add_mib1'] != 0) {
if ($ed['add_mab1'] != 0) {
$tr .= $armor1 . $ed['add_mib1'] . '-' . $ed['add_mab1'];
} else {
@ -613,7 +568,7 @@ class Battle
$tr .= $armor1 . $m1l;
}
}
if ($ed['add_mib2'] != 0) {
if (isset($ed['add_mib2']) && $ed['add_mib2'] != 0) {
if ($ed['add_mab2'] != 0) {
$tr .= $armor2 . $ed['add_mib2'] . '-' . $ed['add_mab2'];
} else {
@ -624,7 +579,7 @@ class Battle
$tr .= $armor2 . $m1l;
}
}
if ($ed['add_mib3'] != 0) {
if (isset($ed['add_mib3']) && $ed['add_mib3'] != 0) {
if ($ed['add_mab3'] != 0) {
$tr .= $armor3 . $ed['add_mib3'] . '-' . $ed['add_mab3'];
} else {
@ -635,7 +590,7 @@ class Battle
$tr .= $armor3 . $m1l;
}
}
if ($ed['add_mib4'] != 0) {
if (isset($ed['add_mib4']) && $ed['add_mib4'] != 0) {
if ($ed['add_mab4'] != 0) {
$tr .= $armor4 . $ed['add_mib4'] . '-' . $ed['add_mab4'];
} else {
@ -768,14 +723,14 @@ JS;
$td = Conversion::dataStringToArray($itm[$i]['data']);
$lvar = '';
if ($td['add_hpAll'] > 0) {
if (isset($td['add_hpAll']) && $td['add_hpAll'] > 0) {
$td['add_hpAll'] = '+' . $td['add_hpAll'];
$lvar .= '<br>Уровень жизни: ' . $td['add_hpAll'];
}
if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0 || isset($td['sv_yron_min']) && $td['sv_yron_min'] > 0) {
$lvar .= '<br>Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']);
}
if ($td['add_mab1'] > 0) {
if (isset($td['add_mab1']) && $td['add_mab1'] > 0) {
if ($td['add_mib1'] == $td['add_mab1']) {
$m1l = '+';
$lvar .= $armor1 . $m1l . (0 + $td['add_mab1']);
@ -783,7 +738,7 @@ JS;
$lvar .= $armor1 . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']);
}
}
if ($td['add_mab2'] > 0) {
if (isset($td['add_mab2']) && $td['add_mab2'] > 0) {
if ($td['add_mib2'] == $td['add_mab2']) {
$m1l = '+';
$lvar .= $armor2 . $m1l . (0 + $td['add_mab2']);
@ -791,7 +746,7 @@ JS;
$lvar .= $armor2 . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']);
}
}
if ($td['add_mab3'] > 0) {
if (isset($td['add_mab3']) && $td['add_mab3'] > 0) {
if ($td['add_mib3'] == $td['add_mab3']) {
$m1l = '+';
$lvar .= $armor3 . $m1l . (0 + $td['add_mab3']);
@ -799,7 +754,7 @@ JS;
$lvar .= $armor3 . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']);
}
}
if ($td['add_mab4'] > 0) {
if (isset($td['add_mab4']) && $td['add_mab4'] > 0) {
if ($td['add_mib4'] == $td['add_mab4']) {
$m1l = '+';
$lvar .= $armor4 . $m1l . (0 + $td['add_mab4']);
@ -807,8 +762,8 @@ JS;
$lvar .= $armor4 . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']);
}
}
if ($itm[$i]['iznosMAX'] > 0) {
if ($itm[$i]['iznosMAXi'] == 999999999) {
if (isset($itm[$i]['iznosMAX']) && $itm[$i]['iznosMAX'] > 0) {
if (isset($itm[$i]['iznosMAXi']) && $itm[$i]['iznosMAXi'] == 999999999) {
$lvar .= '<br>Долговечность: <span style="color: brown;">неразрушимо</span>';
} else {
$lvar .= '<br>Долговечность: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']);
@ -817,7 +772,7 @@ JS;
$ttl .= $lvar;
$ccv = '';
if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') {
if (isset($itm[$i]['magic_inci']) && $itm[$i]['magic_inci'] != '' || isset($itm[$i]['magic_inc']) && $itm[$i]['magic_inc'] != '') {
if ($itm[$i]['magic_inc'] == '') {
$itm[$i]['magic_inc'] = $itm[$i]['magic_inci'];
}
@ -1945,6 +1900,7 @@ JS;
$this->stats[$this->uids[$bot]]['pass'] != 'saintlucia'
) { //Тут проверка на бота saintlucia
$j = 0;
while ($j < count($this->users)) {
if ($this->i->razdel == 0) {
$tnbot = time() + rand(1, 1);
@ -1952,24 +1908,24 @@ JS;
$tnbot = time() + rand(1, 2);
}
if (
$this->users[$j]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timeGo'] < time() &&
$this->users[$j]['hpNow'] >= 1 &&
$this->users[$this->uids[$bot]]['hpNow'] >= 1 &&
$this->users[$j]['timego'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time() &&
$this->users[$j]['hpnow'] >= 1 &&
$this->users[$this->uids[$bot]]['hpnow'] >= 1 &&
$this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']
) {
if (
isset($this->users[$j]) &&
$this->stats[$j]['hpNow'] >= 1 &&
$this->stats[$this->uids[$bot]]['hpNow'] >= 1 &&
$this->stats[$j]['hpnow'] >= 1 &&
$this->stats[$this->uids[$bot]]['hpnow'] >= 1 &&
!isset($this->ga[$bot][$this->users[$j]['id']]) &&
!isset($this->ag[$bot][$this->users[$j]['id']]) &&
$this->users[$j]['id'] != $bot &&
$this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']
) {
if (
$this->users[$j]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timeGo'] < time()
$this->users[$j]['timego'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time()
) {
$this->botAtack($this->users[$j]['id'], $bot, 1);
mysql_query(
@ -1979,19 +1935,19 @@ JS;
} elseif (
isset($this->users[$i]) &&
$this->users[$i]['bot'] > 0 &&
$this->stats[$i]['hpNow'] >= 1 &&
$this->stats[$this->uids[$bot]]['hpNow'] >= 1 &&
$this->stats[$i]['hpnow'] >= 1 &&
$this->stats[$this->uids[$bot]]['hpnow'] >= 1 &&
$this->users[$i]['id'] != $bot &&
$this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']
) {
if (
$this->users[$j]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timeGo'] < time() &&
$this->users[$j]['timego'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time() &&
$this->botAct($bot)
) {
if (
!isset($this->ga[$bot][$this->users[$i]['id']]) &&
$this->users[$this->uids[$bot]]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time() &&
!isset($this->ag[$bot][$this->users[$i]['id']])
) {
$this->botAtack($this->users[$i]['id'], $bot, 1);
@ -2001,7 +1957,7 @@ JS;
} elseif (
!isset($this->ag[$bot][$this->users[$i]['id']]) &&
isset($this->ga[$bot][$this->users[$i]['id']]) &&
$this->users[$this->uids[$bot]]['timeGo'] < time()
$this->users[$this->uids[$bot]]['timego'] < time()
) {
$this->botAtack($bot, $this->users[$i]['id'], 1);
mysql_query(
@ -2012,10 +1968,10 @@ JS;
} else {
//Удары между ботами
if (
$this->users[$j]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timeGo'] < time() &&
$this->users[$j]['hpNow'] >= 1 &&
$this->users[$this->uids[$bot]]['hpNow'] >= 1
$this->users[$j]['timego'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time() &&
$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);
@ -2042,15 +1998,15 @@ JS;
$this->users[$j]['bot'] > 0
) {
if (
$this->users[$j]['timeGo'] < time() &&
$this->users[$this->uids[$bot]]['timeGo'] < time()
$this->users[$j]['timego'] < time() &&
$this->users[$this->uids[$bot]]['timego'] < time()
) {
$tnbot = time() + rand(3, 7);
if ($this->i->type == 329) { // тестовый бой
$tnbot = time() - 1;
}
$this->startAtack($this->ga[$bot][$this->users[$j]['id']]);
$this->users[$this->uids[$bot]]['timeGo'] = $tnbot;
$this->users[$this->uids[$bot]]['timego'] = $tnbot;
mysql_query(
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'
);
@ -2060,15 +2016,15 @@ JS;
$this->users[$j]['bot'] > 0
) {
if (
$this->users[$this->uids[$bot]]['timeGo'] < time() &&
$this->users[$j]['timeGo'] < time()
$this->users[$this->uids[$bot]]['timego'] < time() &&
$this->users[$j]['timego'] < time()
) {
$this->startAtack($this->ag[$bot][$this->users[$j]['id']]);
$tnbot = time() + rand(3, 7);
if ($this->i->type == 329) { // тестовый бой
$tnbot = time() - 1;
}
$this->users[$this->uids[$bot]]['timeGo'] = $tnbot;
$this->users[$this->uids[$bot]]['timego'] = $tnbot;
mysql_query(
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'
);
@ -2277,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);
@ -4447,6 +4403,7 @@ JS;
$this->add_log($mas);
$j++;
}
var_dump($at);
}
//Добавляем статистику + записываем в баттл_юзерс НР игроков
@ -4910,42 +4867,33 @@ JS;
}
//проверка блока (Визуальная)
public function battleInfo($id): array
{
$b = self::get($id);
if (!isset($b['id'])) {
return [];
}
$this->hodID = Db::getValue('select id_hod from battle_logs where battle = ? order by id desc limit 1', [$b['id']]);
$this->hodID = $this->hodID['id_hod'] ?? 0;
return $b;
}
//проверка блока
public function addAtack(): void
{
global $js;
if (!isset($_POST['atack'], $_POST['block'])) {
if ($_POST['atack'] === '0_0_0_0_0' || $_POST['block'] === '0') {
$this->e = 'Выберите зоны удара и блока';
return;
}
//atack: '3_2_0_0_0' (length=9)
//block: '5' (length=1)
$na = ['a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0]];
$a = explode('_', $_POST['atack']);
$na['id'] = time();
array_unshift($a, 0);
for ($i = 1; $i <= 5; $i++) {
if (!isset($a[$i - 1])) {
if (!isset($a[$i])) {
continue;
}
$a[$i - 1] = intval(round($a[$i - 1]));
if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) {
$na['a'][$i] = $a[$i - 1];
$a[$i] = intval(round($a[$i]));
if ($a[$i] >= 1 && $a[$i] <= 5) {
$na['a'][$i] = $a[$i];
} else {
$na['a'][$i] = 0;
}
@ -4995,7 +4943,7 @@ JS;
foreach ($usersInBattle as $user) {
//записываем данные
$this->fighters[] = new Fighter();
//$this->fighters[] = new Fighter();
$this->users[$i] = $user;
$this->uids[$user['id']] = $i;
@ -5007,7 +4955,7 @@ JS;
//записываем статы
$stats = new Stats($u);
$this->stats[$i] = $stats->getStats(btl_cache: $this->cached);
$this->stats[$i] = $stats->getStats(uid: $user['id'], btl_cache: $this->cached);
//Заносим старт
if ($this->i->getStart2() == 0) {
@ -5036,7 +4984,7 @@ JS;
}
// Бафф Зверя animal_bonus
$this->addAnimalBuff($i, $u);
$this->addAnimalBuff($i);
Db::sql(
'update stats set last_hp = 0, tactic1 = 0, tactic2 = 0, tactic3 = 0, tactic4 = 0, tactic5 = 0, tactic6 = 0, tactic7 = ? where id = ?',
@ -5220,7 +5168,7 @@ JS;
if ($this->users[$i]['lider'] == $this->i->id) {
$ldr = '<img width=24 height=15 title=Лидер&nbsp;группы src=//img.new-combats.tech/i/lead' . $this->users[$i]['team'] . '.gif \>';
}
$teams[$this->users[$i]['team']] .= ', ' . $ldr . '<span ' . $a1ms . ' class=\"CSSteam' . $this->users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . '</span><small> [' . floor(
$teams[$this->users[$i]['team']] .= ', ' . $ldr . '<span ' . $a1ms . ' class=\"CSSteam' . $this->users[$i]['team'] . '\" onClick=\"chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . '</span><small> [' . floor(
$this->stats[$i]['hpNow']
) . '/' . $this->stats[$i]['hpAll'] . ']</small>';
}
@ -5232,7 +5180,7 @@ JS;
while ($i < count($tms)) {
$teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', ');
if ($teams[$tms[$i]] != '') {
$teams[$tms[$i]] = '<img src=\"//img.new-combats.tech/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"top.chat.addto(\'team' . $tms[$i] . '\',\'private\'); return false;\"> ' . $teams[$tms[$i]];
$teams[$tms[$i]] = '<img src=\"//img.new-combats.tech/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"chat.addto(\'team' . $tms[$i] . '\',\'private\'); return false;\"> ' . $teams[$tms[$i]];
$ret .= $teams[$tms[$i]];
if (count($tms) > $i + 1) {
$ret .= ' <span class=\"CSSvs\">&nbsp; против &nbsp;</span> ';
@ -5250,10 +5198,9 @@ JS;
/**
* @param int $i
* @param User $u
* @return void
*/
private function addAnimalBuff(int $i, User $u): void
private function addAnimalBuff(int $i): void
{
if ($this->users[$i]['animal'] <= 0) {
return;
@ -5319,8 +5266,10 @@ JS;
$animalBonusData = Conversion::dataStringToArray($animalBonusDataString);
$bonusString = '';
$statBonusNames = $this->statnames->getBonusNames();
$statBonusSysNames = array_keys($statBonusNames);
foreach ($u->items['add'] as $itemBonusSysName) {
foreach ($statBonusSysNames as $itemBonusSysName) {
if (
!isset($animalBonusData['add_' . $itemBonusSysName]) ||
$animalBonusData['add_' . $itemBonusSysName] <= 0
@ -5333,7 +5282,7 @@ JS;
'mib2' => 'Броня корпуса: +' . $animalBonusData['add_' . $itemBonusSysName] . ', ',
'mib3' => 'Броня пояса: +' . $animalBonusData['add_' . $itemBonusSysName] . ', ',
'mib4' => 'Броня ног: +' . $animalBonusData['add_' . $itemBonusSysName] . ', ',
default => $u->is[$itemBonusSysName] . ': +' . $animalBonusData['add_' . $itemBonusSysName] . ', ',
default => $statBonusNames[$itemBonusSysName] . ': +' . $animalBonusData['add_' . $itemBonusSysName] . ', ',
};
}

View File

@ -2,20 +2,98 @@
namespace Battle;
use Helper\Math;
use User;
class Fighter
{
private int $id;
private string $obraz;
private string $login;
private string $login2;
private int $online;
private int $admin;
private string $align;
private int $clan;
private int $level;
private int $life;
private int $mana;
private int $maxlife;
private int $maxmana;
public function __construct() {}
private int $damage;
private int $damageMultiplier;
private int $critChance;
private int $critMultiplier;
private int $evadeChance;
private int $counterstrikeChance;
private int $parryChance;
private int $shieldblockChance;
private int $ignoreArmorChance;
private int $anticritChance;
private int $antievadeChance;
private int $defence;
private int $airdefence;
private int $waterdefence;
private int $firedefence;
private int $earthdefence;
private int $armor;
public function __construct(private readonly int $id, private readonly int $team) {
$u = User::start($id);
$this->obraz = $u->info['sex'] . DIRECTORY_SEPARATOR . $u->info['obraz'];
$this->login = $u->info['login'];
$this->level = $u->info['level'];
$this->life = $u->stats['hpNow'];
$this->mana = $u->stats['mpNow'];
$this->maxlife = $u->stats['hpAll'];
$this->maxmana = $u->stats['mpAll'];
$this->damage = 100500;
$this->armor = 35;
$this->damageMultiplier = $u->stats['m10'];
$this->critChance = $u->stats['m1'];
$this->critMultiplier = $u->stats['m3'];
$this->evadeChance = $u->stats['m4'];
$this->counterstrikeChance = $u->stats['m6'];
$this->parryChance = $u->stats['m7'];
$this->shieldblockChance = $u->stats['m8'];
$this->ignoreArmorChance = $u->stats['m9'];
$this->anticritChance = $u->stats['m2'];
$this->antievadeChance = $u->stats['m5'];
$this->defence = $u->stats['za']; // ой не та это защита, ой не та. ещё ж броня должна быть.
$this->airdefence = $u->stats['zm2'];
$this->waterdefence = $u->stats['zm3'];
$this->firedefence = $u->stats['zm1'];
$this->earthdefence = $u->stats['zm4'];
unset($u);
}
public function __toString(): string
{
$dmg = Math::addPercent($this->damage, $this->damageMultiplier);
return <<<RETURN
$this->login [$this->level] id:$this->id <br>
Здоровье: $this->life / $this->maxlife <br>
Мана: $this->mana / $this->maxmana <br>
<img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
Броня: $this->armor <br>
Крит: $this->critChance% <br>
Антикрит $this->anticritChance% <br>
Мощность крита $this->critMultiplier% <br>
Уровот $this->evadeChance% <br>
Антиуворот $this->antievadeChance% <br>
Контрудар $this->counterstrikeChance% <br>
Парирование $this->parryChance% <br>
Блок щитом $this->shieldblockChance% <br>
Игнор брони $this->ignoreArmorChance% <br>
Защита от урона $this->defence <br>
Зашита от огня $this->firedefence <br>
Защита от воды $this->waterdefence <br>
Защита от воздуха $this->airdefence <br>
Защита от земли $this->earthdefence <br><br>
Сражается за команду: $this->team
RETURN;
}
}
/*
/app/_incl_data/class/Battle.php:471:
@ -58,21 +136,6 @@ array (size=126)
'stopexp' => int 0
'real' => int 1
'stats' => string 's1=3|s2=3|s3=3|s4=250|rinv=40|m9=5|m6=10|s7="0"|a1=0|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0' (length=175)
's1' => int 0
's2' => int 0
's3' => int 0
's4' => int 0
's5' => int 0
's6' => int 0
's7' => int 0
'a1' => int 0
'a2' => int 0
'a3' => int 0
'a4' => int 0
'mg1' => int 0
'mg2' => int 0
'mg3' => int 0
'mg4' => int 0
'hpNow' => int 1132
'mpNow' => int 0
'enNow' => int 0

View File

@ -45,13 +45,13 @@ class Info
private int $playersCC;
private int $playersCC2;
public readonly int $fastfight;
public readonly int $nobot;
public readonly int $kingfight;
public readonly int $arand;
public readonly int $noatack;
public readonly int $noeff;
public readonly int $smert;
public readonly int $noart;
public readonly ?int $nobot;
public readonly ?int $kingfight;
public readonly ?int $arand;
public readonly ?int $noatack;
public readonly ?int $noeff;
public readonly ?int $smert;
public readonly ?int $noart;
public readonly int $zarad;
public readonly int $priz;
public readonly int $otmorozok;

View File

@ -1,6 +1,7 @@
<?php
use Helper\Conversion;
use Model\Constant\Stat;
class BotPriemLogic
{
@ -106,7 +107,7 @@ class BotPriemLogic
{
global $u;
$notr = 0;
$statnames = new Stat();
$tr = Conversion::dataStringToArray($pl['tr']);
$d2 = Conversion::dataStringToArray($pl['date2']);
@ -129,10 +130,13 @@ class BotPriemLogic
}
}
$statRequirementNames = $statnames->getRequirementNames();
$statSysRequirementNames = array_keys($statRequirementNames);
$x = 0;
$t = $u->items['tr'];
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($statSysRequirementNames)) {
$n = $statSysRequirementNames[$x];
if (isset($tr['tr_' . $n])) {
if ($n == 'lvl') {
if ($tr['tr_' . $n] > BotLogic::$bot['level']) {

View File

@ -7,6 +7,10 @@ use Enum\StatFilterCellName;
class Stat extends Constant
{
public readonly array $sysBonusNames;
public readonly array $sysRequirementNames;
public readonly array $bonusNames;
public readonly array $requirementNames;
public function __construct()
{
self::$tableName = 'const_stats';
@ -15,7 +19,9 @@ class Stat extends Constant
public function getBonusNames(): array
{
return $this->filterByCell(StatFilterCellName::Bonus);
$filtered = $this->filterByCell(StatFilterCellName::Bonus);
$this->sysBonusNames = array_keys($filtered);
return $filtered;
}
private function filterByCell(StatFilterCellName $cellName): array
@ -32,6 +38,29 @@ class Stat extends Constant
public function getRequirementNames(): array
{
return $this->filterByCell(StatFilterCellName::Requirement);
$filtered = $this->filterByCell(StatFilterCellName::Requirement);
$this->sysRequirementNames = array_keys($filtered);
return $filtered;
}
}
/**
* Создаёт и заполняет массивы bonusNames и sysBonusNames.
* @return void
*/
public function getBonus(): void
{
$this->bonusNames = $this->filterByCell(StatFilterCellName::Bonus);
$this->sysBonusNames = array_keys($this->bonusNames);
}
/**
* Создаёт и заполняет массивы requirementNames и sysRequirementNames.
* @return void
*/
public function getRequirement(): void
{
$this->requirementNames = $this->filterByCell(StatFilterCellName::Requirement);
$this->sysRequirementNames = array_keys($this->requirementNames);
}
}

View File

@ -4,6 +4,7 @@ use Core\Db;
use DarksLight2\Training\TrainingManager;
use Helper\Conversion;
use Helper\Math;
use Model\Constant\Stat;
use User\Effects;
/*
@ -37,11 +38,12 @@ class Priems
self::AIR => '#0af',
];
public function __construct()
public function __construct(private readonly Stat $statnames = new Stat())
{
global $btl;
$this->btl = $btl;
$this->u = User::start();
$this->statnames->getRequirement();
}
/** Набив Статики
@ -1433,9 +1435,8 @@ class Priems
}
$x = 0;
$t = $this->u->items['tr'];
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (isset($tr['tr_' . $n])) {
if ($n == 'lvl') {
if ($tr['tr_' . $n] > $this->u->info['level']) {
@ -2212,24 +2213,22 @@ class Priems
public function priemInfo($pl, $t, $id = false)
{
global $u, $c, $code, $btl;
global $btl;
$pz = explode('|', $this->u->info['priems_z']);
$tr = Conversion::dataStringToArray($pl['tr']);
$trs = '';
$x = 0;
$notr = 0;
$t = $this->u->items['tr'];
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (isset($tr['tr_' . $n])) {
if ($tr['tr_' . $n] > $this->u->stats[$n]) {
$trs .= '<font color=red>';
$notr++;
$trs .= '<span style="color: red">';
}
$trs .= '<br>• ';
$trs .= $this->u->is[$n] . ': ' . $tr['tr_' . $n];
$trs .= $this->statnames->requirementNames[$n] . ': ' . $tr['tr_' . $n];
if ($tr['tr_' . $n] > $this->u->stats[$n]) {
$trs .= '</font>';
$trs .= '</span>';
}
}
$x++;

View File

@ -6,6 +6,7 @@ use Core\Db;
use Helper\Conversion;
use JetBrains\PhpStorm\NoReturn;
use Model\ActionModel;
use Model\Constant\Stat;
use User\Effects;
use User\InfoBox;
use User\ItemsModel;
@ -562,6 +563,7 @@ class User
private InfoBox $infoBox;
private Reputation $reputation;
private Stats $userStats;
private Stat $statnames;
private function __construct(int $uid = 0)
{
@ -586,6 +588,8 @@ class User
$this->stats = $this->userStats->getStats($this->info);
$this->infoTasks();
$this->statnames->getBonus();
$this->statnames->getRequirement();
if (Core\Config::get('securetime') > 0) {
if (!defined('IP')) {
@ -910,7 +914,7 @@ class User
) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1'
)
);
$t = $this->items['tr'];
$x = 0;
$po = Conversion::dataStringToArray($o['tr']);
if ($o['itm'] > 0) {
@ -938,8 +942,8 @@ class User
$j++;
}
}
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (isset($po['tr_' . $n]) && $po['tr_' . $n] > $this->stats[$n]) {
$tr = false;
}
@ -969,7 +973,7 @@ class User
'SELECT `id`,`sex`,`tr`,`img`,`login`,`level`,`admin`,`align`,`clan`,`itm` FROM `obraz` WHERE `id` = "' . ((int)$_GET['obr_sel']) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1'
)
);
$t = $this->items['tr'];
$x = 0;
$po = Conversion::dataStringToArray($o['tr']);
if ($o['itm'] > 0) {
@ -1005,8 +1009,8 @@ class User
$this->error = 'Необходимы предметы: ' . $tritm;
}
}
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (isset($po['tr_' . $n]) && $po['tr_' . $n] > $this->stats[$n]) {
$tr = false;
$this->error = 'Недостаточно характеристик или параметров персонажа';
@ -2555,9 +2559,9 @@ class User
);
$j = 0;
$data_r = Conversion::dataStringToArray($ritm['data']);
while ($j < count($this->items['add'])) {
if (isset($data_r['add_' . $this->items['add'][$j]])) {
$data['add_' . $this->items['add'][$j]] -= $data_r['add_' . $this->items['add'][$j]];
while ($j < count($this->statnames->sysBonusNames)) {
if (isset($data_r['add_' . $this->statnames->sysBonusNames[$j]])) {
$data['add_' . $this->statnames->sysBonusNames[$j]] -= $data_r['add_' . $this->statnames->sysBonusNames[$j]];
}
$j++;
}
@ -2569,9 +2573,9 @@ class User
//Добавляем характеристики руны
$add = Conversion::dataStringToArray($rune['data']);
$i = 0;
while ($i < count($this->items['add'])) {
if (isset($add['add_' . $this->items['add'][$i]])) {
$data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
while ($i < count($this->statnames->sysBonusNames)) {
if (isset($add['add_' . $this->statnames->sysBonusNames[$i]])) {
$data['add_' . $this->statnames->sysBonusNames[$i]] += $add['add_' . $this->statnames->sysBonusNames[$i]];
}
$i++;
}
@ -2796,9 +2800,9 @@ class User
);
$j = 0;
$data_r = Conversion::dataStringToArray($ritm['data']);
while ($j < count($this->items['add'])) {
if (isset($data_r['add_' . $this->items['add'][$j]])) {
$pvr['rune'][$this->items['add'][$j]] = $data_r['add_' . $this->items['add'][$j]];
while ($j < count($this->statnames->sysBonusNames)) {
if (isset($data_r['add_' . $this->statnames->sysBonusNames[$j]])) {
$pvr['rune'][$this->statnames->sysBonusNames[$j]] = $data_r['add_' . $this->statnames->sysBonusNames[$j]];
}
$j++;
}
@ -2808,39 +2812,24 @@ class User
$data['add_hpAll'] -= $data['spell_st_val_hp'];
}
//$i = 0;
//while( $i < count($data)) {
if (!isset($data['spell_st_name'])) {
$delk = count($this->items['add']);
$this->items['add'][] = 'mib1';
$this->items['add'][] = 'mib2';
$this->items['add'][] = 'mib3';
$this->items['add'][] = 'mib4';
$this->items['add'][] = 'mab1';
$this->items['add'][] = 'mab2';
$this->items['add'][] = 'mab3';
$this->items['add'][] = 'mab4';
$j = 0;
while ($j < count($this->items['add'])) {
if (isset($data['add_' . $this->items['add'][$j]])) {
if ($data_l['add_' . $this->items['add'][$j]] != $data['add_' . $this->items['add'][$j]] - $pvr['rune'][$this->items['add'][$j]] - $pvr['podgon'][$this->items['add'][$j]]) {
//echo ''.$this->items['add'][$j].' -> '.$data_l['add_'.$this->items['add'][$j]].' / '.$data['add_'.$this->items['add'][$j]].'<br>';
if (!isset($data_l['add_' . $this->items['add'][$j]])) {
unset($data['add_' . $this->items['add'][$j]]);
} else {
$data['add_' . $this->items['add'][$j]] = $data_l['add_' . $this->items['add'][$j]];
}
while ($j < count($this->statnames->sysBonusNames)) {
if (
isset($data['add_' . $this->statnames->sysBonusNames[$j]]) &&
$data_l['add_' . $this->statnames->sysBonusNames[$j]] != $data['add_' . $this->statnames->sysBonusNames[$j]] - $pvr['rune'][$this->statnames->sysBonusNames[$j]] - $pvr['podgon'][$this->statnames->sysBonusNames[$j]]
) {
if (!isset($data_l['add_' . $this->statnames->sysBonusNames[$j]])) {
unset($data['add_' . $this->statnames->sysBonusNames[$j]]);
} else {
$data['add_' . $this->statnames->sysBonusNames[$j]] = $data_l['add_' . $this->statnames->sysBonusNames[$j]];
}
}
$j++;
}
$i = 0;
while ($i < 8) {
unset($this->items['add'][$delk + $i]);
$i++;
}
}
}
//Новая чарка
$i = 0;
$utp = explode(',', $add['onItemType']);
@ -2858,9 +2847,9 @@ class User
$tw = '';
}
$j = 0;
while ($j < count($this->items['add'])) {
if (isset($add[$tw . 'add' . $utp[$i] . '_' . $this->items['add'][$j]])) {
$rnda[count($rnda)] = $this->items['add'][$j];
while ($j < count($this->statnames->sysBonusNames)) {
if (isset($add[$tw . 'add' . $utp[$i] . '_' . $this->statnames->sysBonusNames[$j]])) {
$rnda[] = $this->statnames->sysBonusNames[$j];
}
$j++;
}
@ -3068,13 +3057,12 @@ class User
$data['upatack_id'] = $rune['item_id'];
$data['upatack_name'] = $rune['name'];
$data['upatack_lvl'] = $add['upatack'];
$data['upatack_lvl'] = $add['upatack'];
//Добавляем характеристики руны
$i = 0;
while ($i < count($this->items['add'])) {
if (isset($add['add_' . $this->items['add'][$i]])) {
$data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
while ($i < count($this->statnames->sysBonusNames)) {
if (isset($add['add_' . $this->statnames->sysBonusNames[$i]])) {
$data['add_' . $this->statnames->sysBonusNames[$i]] += $add['add_' . $this->statnames->sysBonusNames[$i]];
}
$i++;
}
@ -3653,72 +3641,66 @@ class User
$notr++;
}
$tr = '';
$t = $this->items['tr'];
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (!empty($po['tr_' . $n])) {
if ($n == 'sex') {
if ($this->info['sex'] != $po['tr_' . $n]) {
$tr .= '<font color="red">';
$tr .= '<span style="color: red;">';
$notr++;
}
} elseif ($po['tr_' . $n] > $this->stats[$n]) {
if ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
if ($po['tr_align_bs'] == '1') {
$pal = !($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2);
} elseif ($po['tr_align_bs'] == '3') {
$tar = !($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4);
}
}
if ($n == 'rep') {
$temp = explode('::', $po['tr_' . $n]);
if ($this->rep['rep' . $temp[1]] < $temp[0]) {
$tr .= '<font color="red">';
$tr .= '<span style="color: red;">';
$notr++;
}
unset($temp);
} elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
$tr .= '<font color="red">';
} elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
$tr .= '<span style="color: red;">';
$notr++;
} elseif ($n != 'align' && $n != 'align_bs' || floor(
$this->info['align']
) != $po['tr_' . $n]) {
$tr .= '<font color="red">';
$tr .= '<span style="color: red;">';
$notr++;
}
}
$tr .= '<br />• ';
if ($n == 'rep') {
$temp = explode('::', $po['tr_' . $n]);
$tr .= $this->is[$n] . ' ' . ucfirst(
$tr .= $this->statnames->requirementNames[$n] . ' ' . ucfirst(
str_replace('city', ' city', $temp[1])
) . ': ' . $temp[0];
unset($temp);
} elseif ($n != 'align' && $n != 'align_bs') {
if ($n == 'sex') {
if ($po['tr_' . $n] == 1) {
$tr .= $this->is[$n] . ': Женский';
$tr .= $this->statnames->requirementNames[$n] . ': Женский';
} else {
$tr .= $this->is[$n] . ': Мужской';
$tr .= $this->statnames->requirementNames[$n] . ': Мужской';
}
} else {
$tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
$tr .= $this->statnames->requirementNames[$n] . ': ' . $po['tr_' . $n];
}
} else {
$tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
$tr .= $this->statnames->requirementNames[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
}
if ($n == 'sex') {
if ($this->info['sex'] != $po['tr_' . $n]) {
$tr .= '</font>';
$tr .= '</span>';
}
} elseif ($po['tr_' . $n] > $this->stats[$n]) {
if ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
$tr .= '</font>';
if ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
$tr .= '</span>';
} elseif ($n != 'align' && $n != 'align_bs' || floor(
$this->info['align']
) != $po['tr_' . $n]) {
$tr .= '</font>';
$tr .= '</span>';
}
}
}
@ -3729,7 +3711,7 @@ class User
}
//<strong>Действует на:</strong>
$tr = '';
$t = $this->items['add'];
if (isset($po['mf_stats']) && $po['mf_stats'] > 0) {
$tr .= '<br>Свободные характеристики: ' . $po['mf_stats'];
}
@ -3741,19 +3723,19 @@ class User
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['add_' . $n], $this->is[$n])) {
while ($x < count($this->statnames->sysBonusNames)) {
$n = $this->statnames->sysBonusNames[$x];
if (isset($po['add_' . $n])) {
$z = '+';
if ($po['add_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
$tr .= '<br>• ' . $this->statnames->bonusNames[$n] . ': ' . $z . $po['add_' . $n];
if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && ($n == 's1' || $n == 's2' || $n == 's3' || $n == 's5')) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" width="11" height="11"></a>';
$tr .= ' <a href="/main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" alt=""></a>';
}
if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && ($n == 'm1' || $n == 'm2' || $n == 'm4' || $n == 'm5')) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" width="11" height="11"></a>';
$tr .= ' <a href="/main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" alt=""></a>';
}
}
$x++;
@ -3763,17 +3745,10 @@ class User
$bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
while ($i <= 4) {
if (isset($po['add_mab' . $i])) {
if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) {
$z = '+';
if ($po['add_mab' . $i] < 0) {
$z = '';
}
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
} else {
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
}
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=mib' . $i . '"><img src="' . Config::img(
$tr .= ' <a href="/main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=mib' . $i . '"><img src="' . Config::img(
) . '/i/up.gif" width="11" height="11"></a>';
}
}
@ -3785,22 +3760,11 @@ class User
}
//<strong>Свойства предмета:</strong>
$tr = '';
$t = $this->items['sv'];
if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
$tr .= '<br>• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['sv_' . $n])) {
$z = '+';
if ($po['sv_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
}
$x++;
}
if ($pl['2too'] == 1) {
$tr .= '<br>• Второе оружие';
}
@ -3810,20 +3774,16 @@ class User
if (isset($po['zonb'])) {
$tr .= '<br>• Зоны блокирования: ';
if ($po['zonb'] > 0) {
$x = 1;
while ($x <= $po['zonb']) {
$tr .= '+';
$x++;
}
$tr .= str_repeat('+', $po['zonb']);
} else {
$tr .= '—';
}
}
if ($tr != '') {
$is2 .= '<br><strong>Свойства предмета:</strong>' . $tr;
}
if ($notr == 0) {
$d[0] = 1;
if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
@ -4019,16 +3979,18 @@ class User
$i1c = 0;
$i2c = 0;
$i1e = Conversion::dataStringToArray($plc['data']);
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
while ($i1c < count($this->statnames->sysBonusNames)) {
if (isset($i1e[$this->statnames->sysBonusNames[$i1c]])) {
$i3c = $i1e[$this->statnames->sysBonusNames[$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
$com1['text'] .= '&nbsp; &nbsp; ' . $this->statnames->bonusNames[$this->statnames->sysBonusNames[$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
$com1['text'] .= $this->statnames->bonusNames[$this->statnames->sysBonusNames[$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
@ -4055,16 +4017,16 @@ class User
$i1c = 0;
$i2c = 0;
$i1e = Conversion::dataStringToArray($plc['data']);
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
while ($i1c < count($this->statnames->sysBonusNames)) {
if (isset($i1e[$this->statnames->sysBonusNames[$i1c]])) {
$i3c = $i1e[$this->statnames->sysBonusNames[$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
$com1['text'] .= '&nbsp; &nbsp; ' . $this->statnames->bonusNames[$this->statnames->sysBonusNames[$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
$com1['text'] .= $this->statnames->bonusNames[$this->statnames->sysBonusNames[$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
@ -4089,9 +4051,9 @@ class User
$ixi = 0;
while ($sm_pl = mysql_fetch_array($sm_sp)) {
if ($sm_pl['type'] == 0) {
$smt .= '<font class="date">' . date(
$smt .= '<span class="date">' . date(
'd.m.Y H:i', $sm_pl['time']
) . '</font> <strong>' . $sm_pl['login'] . '</strong>. ' . $sm_pl['text'] . '<br>';
) . '</span> <strong>' . $sm_pl['login'] . '</strong>. ' . $sm_pl['text'] . '<br>';
} else {
$smt .= $sm_pl['text'] . '<br>';
}
@ -4154,8 +4116,8 @@ class User
)
);
if (isset($plpo['id'])) {
$is2 .= ' <font color=grey>(Дар игрока <strong>' . $plpo['login'] . '</strong><a href="info/' . $plpo['id'] . '" target="_blank"><img src="' . Config::img(
) . '/i/inf_' . $plpo['cityreg'] . '.gif" width="9"></a>)</font>';
$is2 .= ' <span style="color: grey;">(Дар игрока <strong>' . $plpo['login'] . '</strong><a href="info/' . $plpo['id'] . '" target="_blank"><img src="' . Config::img(
) . '/i/inf_' . $plpo['cityreg'] . '.gif" width="9"></a>)</span>';
if ($plpo['login'] == $this->info['login']) {
if (isset($_GET['backmyitm'])) {
$pl['inOdet'] = 0;
@ -5106,8 +5068,6 @@ class User
[$u['id']]
);
$t = $this->items['tr'];
$x = 0;
$notr = 0;
@ -5140,8 +5100,8 @@ class User
}
$j++;
}
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysRequirementNames)) {
$n = $this->statnames->sysRequirementNames[$x];
if (isset($po['tr_' . $n]) && $n == 'sex') {
if ($po['tr_' . $n] != $this->info['sex']) {
$notr++;
@ -5889,7 +5849,7 @@ LIMIT 1'
private function trItem($po): int
{
$notr = 0;
foreach ($this->items['tr'] as $trn) {
foreach ($this->statnames->sysRequirementNames as $trn) {
if (!isset($po["tr_$trn"])) {
continue;
}

View File

@ -5,6 +5,7 @@ namespace User;
use Core\Config;
use Core\Db;
use Helper\Conversion;
use Model\Constant\Stat;
use User;
/**
@ -12,16 +13,11 @@ use User;
*/
class InfoBox
{
private User $user;
private array $info;
private array $is;
public function __construct(User $user)
public function __construct(private readonly User $user, private readonly Stat $statname = new Stat())
{
$this->user = $user;
$this->info = $user->info;
$this->is = $user->is;
}
public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
@ -116,7 +112,7 @@ class InfoBox
$lvar = $this->getInfoItemInfo($pl, $td);
if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
if (isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
} else {
$uimg = 'i/items/' . $pl['img'];
@ -160,6 +156,7 @@ class InfoBox
}
}
}
//Шлем,Венок
$wj1i = '';
$br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'' . Config::img() . '/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>';
@ -387,17 +384,17 @@ class InfoBox
//Действие эффекта
$tr = '';
$t = $this->user->items['add'];
$t = array_keys($this->statname->getBonusNames());
$x = 0;
$ed = Conversion::dataStringToArray($e['data']);
while ($x < count($t)) {
$n = $t[$x];
if (isset($ed['add_' . $n], $this->is[$n])) {
if (isset($ed['add_' . $n])) {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $this->is[$n] . ': ' . $z . $ed['add_' . $n];
$tr .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
@ -426,7 +423,7 @@ class InfoBox
//здоровье
$hptop = 0;
$lh = [0 => 'hp_none', 1 => 1];
$lh = [0 => 'hp_none'];
if ($sn['hpNow'] == 0 || $sn['hpAll'] == 0) {
$lh[1] = 0;
@ -444,8 +441,7 @@ class InfoBox
}
if ($sn['mpAll'] > 0) {
//мана
$lm = [0 => 'hp_none', 1 => 1];
$lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
$lm = ['hp_none', floor($sn['mpNow'] / $sn['mpAll'] * 120)];
if ($lm[1] > 0) {
$lm[0] = 'hp_mp';
}
@ -471,10 +467,10 @@ class InfoBox
$pb = '';
if ($u['banned'] > 0) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Персонаж заблокирован</strong></font></div>';
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Персонаж заблокирован</strong></div>';
}
if ($u['allLock'] > time()) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Временный запрет передач!</strong></font></div>';
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Временный запрет передач!</strong></div>';
}
$swm = 0; //свитки магии
@ -503,39 +499,39 @@ class InfoBox
if ($ssm > 0 && $i1 == 0) {
$witmg .= '<table style="padding-top:2px;padding-bottom:2px;" width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" height="60">' . $witm[59] . '</td>
<td width="60">' . $witm[60] . '</td>
<td width="60">' . $witm[61] . '</td>
<td width="60">' . $witm[62] . '</td>
</tr>
</table>';
<tr>
<td width="60" height="60">' . $witm[59] . '</td>
<td width="60">' . $witm[60] . '</td>
<td width="60">' . $witm[61] . '</td>
<td width="60">' . $witm[62] . '</td>
</tr>
</table>';
}
if ($swm > 0 && $i1 == 0) {
$witmg .= '<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="25">' . $witm[40] . '</td>
<td width="40">' . $witm[41] . '</td>
<td width="40">' . $witm[42] . '</td>
<td width="40">' . $witm[43] . '</td>
<td width="40">' . $witm[44] . '</td>
<td width="40">' . $witm[50] . '</td>
</tr>
<tr>
<td height="25">' . $witm[45] . '</td>
<td>' . $witm[46] . '</td>
<td>' . $witm[47] . '</td>
<td>' . $witm[48] . '</td>
<td>' . $witm[49] . '</td>
<td>' . $witm[51] . '</td>
</tr>
</table>';
<tr>
<td width="40" height="25">' . $witm[40] . '</td>
<td width="40">' . $witm[41] . '</td>
<td width="40">' . $witm[42] . '</td>
<td width="40">' . $witm[43] . '</td>
<td width="40">' . $witm[44] . '</td>
<td width="40">' . $witm[50] . '</td>
</tr>
<tr>
<td height="25">' . $witm[45] . '</td>
<td>' . $witm[46] . '</td>
<td>' . $witm[47] . '</td>
<td>' . $witm[48] . '</td>
<td>' . $witm[49] . '</td>
<td>' . $witm[51] . '</td>
</tr>
</table>';
}
$zag = '';
if ($u['zag'] != '' && $i1 == 1) {
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; opacity: 0.70; } </style>';
$zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="' . Config::img() . '/i/zag/' . $u['zag'] . '">';
@ -712,45 +708,28 @@ class InfoBox
$lvar .= '<br>Урон: ' . $po['sv_yron_min'] . '-' . $po['sv_yron_max'];
}
$t = $this->user->items['add'];
$t = array_keys($this->statname->getBonusNames());
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['add_' . $n], $this->is[$n])) {
if (isset($po['add_' . $n])) {
$z = '+';
if ($po['add_' . $n] < 0) {
$z = '';
}
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['add_' . $n];
}
$x++;
}
//
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['sv_' . $n])) {
$z = '+';
if ($po['sv_' . $n] < 0) {
$z = '';
}
if ($n != 'yron_min' && $n != 'yron_max') {
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
}
$lvar .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $po['add_' . $n];
}
$x++;
}
if (isset($pl['2h']) && $pl['2h'] == 1) {
$lvar .= '<br>• Двуручное оружие';
}
if (isset($po['zonb'])) {
$lvar .= '<br>Зоны блокирования: ';
if ($po['zonb'] > 0) {
$x = 1;
while ($x <= $po['zonb']) {
$lvar .= '+';
$x++;
}
$lvar .= str_repeat('+', $po['zonb']);
} else {
$lvar .= '—';
}
@ -772,7 +751,7 @@ class InfoBox
if (isset($pl['iznosMAX']) && $pl['iznosMAX'] > 0) {
$lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']);
$lvar .= '<br>Долговечность: ' . (int)($pl['iznosMAX'] - $pl['iznosNOW']);
}
if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) {

View File

@ -0,0 +1,58 @@
<?php
namespace User;
use Helper\Conversion;
use Model\Constant\Stat;
class Item
{
public readonly int $id;
public readonly int $type;
public readonly string $name;
public readonly string $img;
public int $inslot;
public int $inodet;
public readonly string $data;
public int $durability;
public function __construct(array $item)
{
[
'id' => $this->id,
'type' => $this->type,
'name' => $this->name,
'img' => $this->img,
'inslot' => $this->inslot,
'inOdet' => $this->inodet,
'data' => $this->data,
'iznosNOW' => $iNow,
'iznosMAX' => $iMax,
] = $item;
$this->durability = $iMax - $iNow;
$stat = new Stat();
$dataArr = Conversion::dataStringToArray(strtolower($this->data));
foreach (array_keys($stat->getBonusNames()) as $bonusName) {
if (!isset($dataArr["add_$bonusName"])) {
continue;
}
$this->{"add_$bonusName"} = $dataArr["add_$bonusName"];
}
}
}
// type, data, inOdet,
// item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
/*
'data' => string 'add_za1=5|add_m4=40|add_s2=1|add_s3=2|sv_yron_min=5|sv_yron_max=15|add_m5=30|add_m1=30|add_m9=15|complect=106|tya1=75|tya3=25|fromshop=1' (length=136)
'item_id' => int 6473
'useInBattle' => int 0
'btl_zd' => int 0
'magic_inci' => string '' (length=0)
'2h' => int 0
*/

View File

@ -195,7 +195,7 @@ class Stats
}
[$hnd1, $hnd2, $sht1, $oza, $ozm, $dom, $coms] = $this->addWearedItemsBonuses($u['id'], $st, $s_v, $baseStats);
[$hnd1, $hnd2, $sht1, $dom, $coms] = $this->addWearedItemsBonuses($u['id'], $st, $s_v, $baseStats);
$this->addMedalsBonuses($u['id'], $st);
@ -408,21 +408,9 @@ class Stats
$st['zonb']++;
}
if ($st['zona'] < 1) {
$st['zona'] = 1;
}
if ($st['zona'] > 5) {
$st['zona'] = 5;
}
if ($st['zonb'] < 1) {
$st['zonb'] = 1;
}
if ($st['zonb'] > 3) {
$st['zonb'] = 3;
}
$st['zona'] = Comparsion::minimax($st['zona'], 1, 5);
$st['zonb'] = Comparsion::minimax($st['zonb'], 1, 3);
$st['ozash'] = $oza;
$st['ozmsh'] = $ozm;
$st['weapon1'] = $hnd1;
$st['weapon2'] = $hnd2;
$st['sheld1'] = $sht1;
@ -500,6 +488,15 @@ class Stats
$st[$key] += $value;
}
/**
* Добавляет бонусы к статам игрока.
* Генерирует переменную User:class->stats['items'], где лежат одетые предметы.
* @param int $uid
* @param array $st
* @param array $s_v
* @param array $baseStats
* @return array
*/
private function addWearedItemsBonuses(int $uid, array &$st, array &$s_v, array $baseStats): array
{
//Характеристики от предметов //ТУТ tr_lvl
@ -518,33 +515,20 @@ class Stats
$coms = []; // комплекты
$dom = [];
$oza = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
4 => [0, 0],
]; //особенности защиты
$ozm = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
4 => [0, 0],
]; //особенности магии
$ozaozmtypes = [
1 => [1, 9,],//Слабая
2 => [20, 39,],//Нормальная
3 => [40, 69,],//Хорошая
4 => [10, 19,],//Посредственная
5 => [70, 89,],//Великолепная
];
$wi = new WearedItem(); // на замену User:class->stats['items']
$st['items_o'] = $wi;
foreach ($wearedItems as $wearedItem) {
// Генерируем всратую пепяку User:class->stats['wpXid'] > 0, которая показывает, что определённый слот
// чем-то занят. Странное решение.
$this->addKeyIfNotExist('wp' . $wearedItem['inOdet'] . 'id', $h, $st);
$st['items'][$h] = $wearedItem;
$h++;
$wi->add(new Item($wearedItem));
// Если в левой руке (3) предметы определённого типа, то рука занята оружием.
if ($wearedItem['inOdet'] == 3 &&
(($wearedItem['type'] >= 18 && $wearedItem['type'] <= 24) ||
$wearedItem['type'] == 26 ||
@ -552,6 +536,8 @@ class Stats
$wearedItem['type'] == 28)) {
$hnd1 = 1;
}
// Если в правой руке (14) предметы определённого типа, то рука занята оружием или щитом.
if ($wearedItem['inOdet'] == 14 &&
(($wearedItem['type'] >= 18 && $wearedItem['type'] <= 24) ||
$wearedItem['type'] == 26 ||
@ -562,44 +548,13 @@ class Stats
$sht1 = 1;
}
$data = Conversion::dataStringToArray($wearedItem['data']);
// Если в любом слоте что-то есть, повышается User:class->stats['reting'] за каждый слот
// Используется каким-то непонятным образом в хаотах.
if ($wearedItem['inOdet'] <= 18 && $wearedItem['inOdet'] > 0) {
$this->addKeyIfNotExist('reting', 1, $st);
}
# Пришлось зацикливать, уж больно однотипное.
# oza[X][0,1] = add_ozaX[0,1] + add_oza[0,1]
# ozm[X][0,1] = add_ozmX[0,1] + add_ozm[0,1]
for ($i = 1; $i <= 4; $i++) {
if (!isset($data["add_oza$i"])) {
continue;
}
if (isset($data['add_oza']) && in_array($data['add_oza'], range(1, 5))) {
$oza[$i][0] += $ozaozmtypes[$data['add_oza']][0];
$oza[$i][1] += $ozaozmtypes[$data['add_oza']][1];
}
if (isset($data['add_ozm']) && in_array($data['add_ozm'], range(1, 5))) {
$ozm[$i][0] += $ozaozmtypes[$data['add_ozm']][0];
$ozm[$i][1] += $ozaozmtypes[$data['add_ozm']][1];
} else {
$ozm[$i][0] += $ozaozmtypes[1][0];
$ozm[$i][1] += $ozaozmtypes[1][1];
}
if (in_array($data["add_oza$i"], range(1, 5))) {
$oza[$i][0] += $ozaozmtypes[$data["add_oza$i"]][0];
$oza[$i][1] += $ozaozmtypes[$data["add_oza$i"]][1];
}
if (isset($data["add_ozm$i"]) && in_array($data["add_ozm$i"], range(1, 5))) {
$ozm[$i][0] += $ozaozmtypes[$data["add_ozm$i"]][0];
$ozm[$i][1] += $ozaozmtypes[$data["add_ozm$i"]][1];
} else {
$ozm[$i][0] += $ozaozmtypes[1][0];
$ozm[$i][1] += $ozaozmtypes[1][1];
}
}
$data = Conversion::dataStringToArray($wearedItem['data']);
if (isset($data['art'])) {
$this->addKeyIfNotExist('art', $data['art'], $st);
}
@ -696,7 +651,7 @@ class Stats
}
}
}
return [$hnd1, $hnd2, $sht1, $oza, $ozm, $dom, $coms];
return [$hnd1, $hnd2, $sht1, $dom, $coms];
}
private function addMedalsBonuses(int $uid, array &$st): void

View File

@ -0,0 +1,34 @@
<?php
namespace User;
class WearedItem
{
private array $slot = [];
public function add(Item $item): void
{
$this->slot[$item->inslot] = $item;
}
public function exist(int $slot): bool
{
return array_key_exists($slot, $this->slot);
}
public function get(int $slot): Item
{
return $this->slot[$slot];
}
public function count(): int
{
return count($this->slot);
}
public function remove(int $slot): void
{
array_splice($this->slot, $slot, 1);
}
}

View File

@ -5,33 +5,33 @@ namespace User;
use Core\Db;
/**
* Непонятный кусок функции, который лежал внутри системы подсчёта бонусов к параметрам,
* при этом никак на это не влияя и ни с чем не взаимодействуя. Надо понять что его
* вызывает и выгнать его из User\Stats.
* Непонятный кусок функции, который лежал внутри системы подсчёта бонусов к параметрам,
* при этом никак на это не влияя и ни с чем не взаимодействуя. Надо понять что его
* вызывает и выгнать его из User\Stats.
*/
class WearedScrolls
{
public static function ScrollsChange(array &$u): void
{
//Замена свитков
//Замена свитков
if ($u['autospell'] == 0 || $u['battle'] != 0) {
return;
}
//проверяем свитки
//проверяем свитки
$sparr = [];
foreach (Db::getRows('select item_id, inOdet from items_users where inOdet between 40 and 50 and uid = ? order by item_id desc', [$u['id']]) as $scroll) {
$sparr[] = "{$scroll['item_id']} - {$scroll['inOdet']}";
}
$splink = implode(',', $sparr);
//Запоминаем новый комплект свитков
//Запоминаем новый комплект свитков
if ($u['autospell'] == 1) {
$u['autospell'] = $splink;
Db::sql('update users set autospell = ? where id = ?', [$splink, $u['id']]);
}
//Выдаем нужный свиток, если он есть в инвентаре
//Выдаем нужный свиток, если он есть в инвентаре
if ($u['autospell'] != $splink) {
$spe1 = explode(',', $splink);
$spe2 = explode(',', $u['autospell']);

View File

@ -3,6 +3,7 @@
const GAME = true;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
require_once $_SERVER['DOCUMENT_ROOT'] . '/_incl_data/autoload.php';
$u = User::start();
if (!$u->info['admin']) {
@ -20,18 +21,18 @@ while ($i < 100) {
?>
<!DOCTYPE html>
<html>
<html lang="ru">
<head>
<title>Тестирование ботов</title>
<script src="//img.new-combats.tech/js/Lite/gameEngine.js" type="text/javascript"></script>
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/ion.rangeSlider.js"></script>
<script type="text/javascript" src="js/title.js"></script>
<script src="/js/jquery-1.11.3.min.js"></script>
<script src="/js/ion.rangeSlider.js"></script>
<script type="text/javascript" src="/js/title.js"></script>
<link href="//img.new-combats.tech/css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/normalize.css"/>
<link rel="stylesheet" href="css/ion.rangeSlider.css"/>
<link rel="stylesheet" href="css/ion.rangeSlider.skinFlat.css"/>
<link rel="stylesheet" href="/css/normalize.css"/>
<link rel="stylesheet" href="/css/ion.rangeSlider.css"/>
<link rel="stylesheet" href="/css/ion.rangeSlider.skinFlat.css"/>
<style type="text/css">
h3 {
text-align: center;
@ -138,7 +139,7 @@ while ($i < 100) {
}
</style>
<link href="//img.new-combats.tech/css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script>
function eff(user, id) {
if ($('#e' + user + '_' + id).attr('class') == 'nprsl0') {
@ -152,8 +153,7 @@ while ($i < 100) {
</script>
</head>
<body bgcolor="#E2E0E0">
<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
</div>
<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"></div>
<div id="gi" class="gifin" style="display:none;"></div>
<H3>Создать тестовый бой</H3>
<br>
@ -207,55 +207,41 @@ while ($i < 100) {
);
//
mysql_query(
'INSERT INTO `battle_logs` (
`time`,`battle`,`id_hod`,`type`,`text`
) VALUES (
"' . time() . '","' . $logid . '","1","1","Часы показывали <b>' . date(
'd.m.Y H:i:s'
) . '</b>, когда <b>' . $user1['login'] . '</b> и <b>' . $user2['login'] . '</b> бросили вызов друг другу."
)'
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`type`,`text`) VALUES ("' . time() . '","' . $logid . '","1","1","Часы показывали <b>' . date('d.m.Y H:i:s') . '</b>, когда <b>' . $user1['login'] . '</b> и <b>' . $user2['login'] . '</b> бросили вызов друг другу.")'
);
//
//Эффекты
$i = 0;
while ($i < 1000) {
//
$efs = mysql_fetch_array(
mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $i . '" LIMIT 1')
);
$efs = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $i . '" LIMIT 1'));
if ($_POST['eu1_' . $efs['id2']] == 1) {
mysql_query(
'INSERT INTO `eff_users`
( `id_eff` , `uid` , `name` , `data` , `timeUse` ) VALUES (
"' . $efs['id2'] . '" , "' . $bot1 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time() . '"
)'
'INSERT INTO `eff_users` ( `id_eff` , `uid` , `name` , `data` , `timeUse` )
VALUES ("' . $efs['id2'] . '" , "' . $bot1 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time() . '")'
);
}
if ($_POST['eu2_' . $efs['id2']] == 1) {
mysql_query(
'INSERT INTO `eff_users`
( `id_eff` , `uid` , `name` , `data` , `timeUse` ) VALUES (
"' . $efs['id2'] . '" , "' . $bot2 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time() . '"
)'
'INSERT INTO `eff_users` ( `id_eff` , `uid` , `name` , `data` , `timeUse` )
VALUES ("' . $efs['id2'] . '" , "' . $bot2 . '" , "' . $efs['mname'] . '" , "' . $efs['mdata'] . '" , "' . time() . '")'
);
}
//
$i++;
}
//
function inuser_go_btl($id)
{
if (isset($id['id'])) {
file_get_contents(
'/jx/battle/refresh1.php?uid=' . $id['id'] . '&cron_core=' . md5(
$id['id'] . '_brfCOreW@!_' . $id['pass']
) . '&pass=' . $id['pass']
'/jx/battle/refresh1.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass']
);
}
}
$sp = mysql_query(
'SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = "-1" AND `time_over` = "0" AND `type` = 329 LIMIT 100'
'SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = -1 AND `time_over` = 0 AND `type` = 329 LIMIT 100'
);
while ($pl = mysql_fetch_array($sp)) {
$user1 = mysql_fetch_array(
@ -275,7 +261,7 @@ while ($i < 100) {
//
$ef1 = '';
$ef2 = '';
$sp = mysql_query('SELECT * FROM `eff_main` WHERE `mdata` != "" AND `actionTime` > 0 ORDER BY `mname` ASC');
$sp = mysql_query('SELECT * FROM `eff_main` WHERE `mdata` != \'\' AND `actionTime` > 0 ORDER BY `mname` ');
$i = 0;
while ($pl = mysql_fetch_array($sp)) {
$i++;
@ -283,17 +269,16 @@ while ($i < 100) {
//Действие эффекта
$ei = '';
$tr = '';
$t = $u->items['add'];
$x = 0;
$ed = Helper\Conversion::dataStringToArray($pl['mdata']);
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statnames->sysBonusNames)) {
$n = $this->statnames->sysBonusNames[$x];
if (isset($ed['add_' . $n], $u->is[$n])) {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
$tr .= '<br>' . $this->statnames->bonusNames[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}

21
inf.php
View File

@ -10,6 +10,7 @@ use Inf\Awards;
use Inf\LastNames;
use Inf\Twinks;
use Inf\Zodiac;
use Model\Constant\Stat;
use User\Effects;
if (!defined('GAME_VERSION')) {
@ -26,6 +27,7 @@ $c['inf'] = true;
include_once('_incl_data/class/__db_connect.php');
$u = User::start();
$bonusstatnames = (new Stat())->getBonusNames();
const LOWERCASE = 3;
const UPPERCASE = 1;
@ -346,27 +348,16 @@ if (isset($uer)) {
<div style="padding:5px;">
<small>
<?php
foreach ($u->items['add'] as $stat) {
foreach (array_keys($bonusstatnames) as $stat) {
if (empty($st[$stat]) || empty($u->is[$stat])) {
continue;
}
if ($st[$stat] > 0) {
$st[$stat] = '+' . $st[$stat];
}
if (in_array($u->is[$stat], [
'Защита от урона',
'Сила',
'Мастерство владения оружием',
'Мастерство владения магией огня',
'Уровень жизни (HP)',
'Мф. критического удара (%)',
'Мф. мощности магии огня',
'Регенерация здоровья (%)',
'Мф. мощности урона',
])) {
echo '<hr>';
}
echo '&bull; ' . $u->is[$stat] . ': ' . $st[$stat] . ' <br>';
echo '&bull; ' . $bonusstatnames[$stat] . ': ' . $st[$stat] . ' <br>';
}
?>
</small>

File diff suppressed because one or more lines are too long

View File

@ -314,6 +314,7 @@ function sleep(time) {
}
// Действите при выставлении хода и нажатии на Вперёд!
async function atack() {
if (top.slcbrc[3] == 1) autobattle();

View File

@ -490,11 +490,7 @@ if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) {
) ||
(
isset($_GET['zayvka']) &&
(
$_GET['r'] == 6 ||
$_GET['r'] == 7 ||
!isset($_GET['r'])
) &&
(!isset($_GET['r']) || $_GET['r'] == 6 || $_GET['r'] == 7) &&
$u->info['battle'] > 0
) &&
!isset($u->tfer['id'])

View File

@ -43,7 +43,11 @@ if (!isset($an['id'])) {
if ($n == 1) {
mysql_query('UPDATE `users_animal` SET `name` = "' . mysql_real_escape_string($nl) . '",`renameArrayKeys` = "1" WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $an['id'] . '" AND `delete` = "0" LIMIT 1');
mysql_query(
'UPDATE `users_animal` SET `name` = "' . mysql_real_escape_string(
$nl
) . '",`renameArrayKeys` = "1" WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $an['id'] . '" AND `delete` = "0" LIMIT 1'
);
$an['renameArrayKeys'] = 1;
echo '<font color="red">Вы успешно переименовали питомца в &quot;' . $nl . '&quot;</font>';
} else {
@ -91,7 +95,13 @@ if (!isset($an['id'])) {
}
if (isset($_GET['obj_corm'])) {
$corm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `im`.`type` = "49" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inTransfer` = "0" AND `iu`.`id` = "' . mysql_real_escape_string($_GET['obj_corm']) . '" LIMIT 1'));
$corm = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `im`.`type` = "49" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inTransfer` = "0" AND `iu`.`id` = "' . mysql_real_escape_string(
$_GET['obj_corm']
) . '" LIMIT 1'
)
);
if (isset($corm['id'])) {
//кормушка зверя
$see1 = 1;
@ -185,20 +195,21 @@ if (!isset($an['id'])) {
<?php
$ba = '';
$i = 0;
while ($i < count($u->items['add'])) {
if (isset($anl['add_' . $u->items['add'][$i]])) {
if ($u->items['add'][$i] == 'mib1') {
$ba .= '&bull; Броня головы: +' . $anl['add_' . $u->items['add'][$i]] . '<br>';
} elseif ($u->items['add'][$i] == 'mib2') {
$ba .= '&bull; Броня корпуса: +' . $anl['add_' . $u->items['add'][$i]] . '<br>';
} elseif ($u->items['add'][$i] == 'mib3') {
$ba .= '&bull; Броня пояса: +' . $anl['add_' . $u->items['add'][$i]] . '<br>';
} elseif ($u->items['add'][$i] == 'mib4') {
$ba .= '&bull; Броня ног: +' . $anl['add_' . $u->items['add'][$i]] . '<br>';
} elseif ($u->items['add'][$i] == 'mab1' || $u->items['add'][$i] == 'mab2' || $u->items['add'][$i] == 'mab3' || $u->items['add'][$i] == 'mab4') {
$statnames = new \Model\Constant\Stat();
$statnames->getBonus();
while ($i < count($statnames->sysBonusNames)) {
if (isset($anl['add_' . $statnames->sysBonusNames[$i]])) {
if ($statnames->sysBonusNames[$i] == 'mib1') {
$ba .= '&bull; Броня головы: +' . $anl['add_' . $statnames->sysBonusNames[$i]] . '<br>';
} elseif ($statnames->sysBonusNames[$i] == 'mib2') {
$ba .= '&bull; Броня корпуса: +' . $anl['add_' . $statnames->sysBonusNames[$i]] . '<br>';
} elseif ($statnames->sysBonusNames[$i] == 'mib3') {
$ba .= '&bull; Броня пояса: +' . $anl['add_' . $statnames->sysBonusNames[$i]] . '<br>';
} elseif ($statnames->sysBonusNames[$i] == 'mib4') {
$ba .= '&bull; Броня ног: +' . $anl['add_' . $statnames->sysBonusNames[$i]] . '<br>';
} else {
$ba .= '&bull; ' . $u->is[$u->items['add'][$i]] . ': +' . $anl['add_' . $u->items['add'][$i]] . '<br>';
$ba .= '&bull; ' . $statnames->bonusNames[$statnames->sysBonusNames[$i]] . ': +' . $anl['add_' . $statnames->sysBonusNames[$i]] . '<br>';
}
}
$i++;

View File

@ -1,16 +1,91 @@
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
use Core\Config;
use Core\Db;
use Helper\Conversion;
use Model\Constant\Stat;
if (!defined('GAME')) {
die();
}
/** @var User $u */
$shadows = Db::getRows(
"select * from obraz where
sex = ? and
level <= ? and
(login = '' or login = ?) and
(uid = 0 or uid = ?) and
(align = '0' or align = ?) and
(clan = 0 or clan = ?) order by level, img",
[$u->info['sex'], $u->info['level'], $u->info['login'], $u->info['id'], $u->info['align'], $u->info['clan']]
);
$statnames = new Stat();
$statnames->getRequirement();
$code = PassGen::intCode();
$imgsrc = Config::img();
$str2 = '';
foreach ($shadows as $shadow) {
$tr = true;
$str = '';
$data = Conversion::dataStringToArray($shadow['tr']);
if ($shadow['level'] > 0) {
$str .= "\r• Уровень персонажа: {$shadow['level']}";
}
if (!empty($shadow['itm'])) {
$needItems = [];
foreach (explode(',', $shadow['itm']) as $itemId) {
if ($itemId < 1) {
continue;
}
$item = Db::getRow('select item_id as id, name from items_users left join items_main on item_id = items_main.id where item_id = ? and inodet > 0 and inshop = 0 and uid = ?', [$itemId, $u->info['id']]);
if (!$item['id']) {
$tr = false;
}
$needItems[] = "«{$item['name']}»";
}
if (!empty($needItems)) {
$str .= "\r• Предметы: " . implode(', ', $needItems);
}
}
foreach ($statnames->sysRequirementNames as $srn) {
if (!isset($data['tr_' . $srn])) {
continue;
}
$str .= "\r$statnames->requirementNames[$srn]: " . $data['tr_' . $srn];
if ($data['tr_' . $srn] <= $u->stats[$srn]) {
continue;
}
$tr = false;
}
if ((!empty($shadow['tr']) || !empty($shadow['itm'])) && !$tr) {
continue;
}
if (!empty($str)) {
$str = "Требуется минимальное:$str";
}
$str2 .= <<<HTML
<a href="/main.php?inv=1&obr_sel={$shadow['id']}&rnd=$code">
<img class="obrsl1" title="$str" src="$imgsrc/obraz/{$shadow['sex']}/{$shadow['img']}" width="120" height="220" alt="">
</a>
HTML;
}
?>
<script>
const elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
<style>
.obrsl1 {
border: 1px solid #888;
@ -26,77 +101,21 @@ if (!defined('GAME')) {
margin-right: 1px;
}
</style>
<table width="100%" cellspacing="0" cellpadding="0">
<form method="post" action="/main.php?inv">
<tr>
<td valign="top" align="left"><img src="//img.new-combats.tech/i/1x1.gif" alt="" width="1" height="5"/><br/>
&nbsp;&nbsp;
</td>
<center><?= User::getLogin($u->info['id']) . '<br>'; ?></center>
<td valign="top" align="right">&nbsp;
<table style="width: 100%; border-spacing: 0;">
<caption><?= User::getLogin($u->info['id']) ?></caption>
<tr>
<td style="vertical-align: top; width: 1px; height: 5px; padding: 0;"></td>
<td style="vertical-align: top; text-align: right; padding: 0;">
<form method="post" action="/main.php?inv">
<input type="button" onClick="location.href='/main.php?obraz';" class="btn" value="Обновить"/>
<input type="submit" class="btn" name="edit" value="Вернуться"/>
<br>
<hr/>
<br/>
</td>
</tr>
</form>
</form>
<br>
<hr>
<br>
</td>
</tr>
<tr>
<td style="text-align:center; padding: 0;" colspan="2"><?= $str2 ?></td>
</tr>
</table>
<center>
<?php
$sp = mysql_query('SELECT * FROM `obraz` WHERE `sex` = "' . $u->info['sex'] . '" AND `level` <= "' . $u->info['level'] . '" AND (`login` = "" OR `login` = "' . $u->info['login'] . '") AND (`uid` = "" OR `uid` = "' . $u->info['id'] . '") AND (`align` = "0" OR `align` = "' . $u->info['align'] . '") AND (`clan` = "0" OR `clan` = "' . $u->info['clan'] . '") ORDER BY `level` ASC, `img` ASC');
while ($pl = mysql_fetch_array($sp)) {
$tr = true;
$trd = '';
$po = Helper\Conversion::dataStringToArray($pl['tr']);
$t = $u->items['tr'];
$x = 0;
if ($pl['level'] > 0) {
$trd .= "\r" . '&bull; Уровень персонажа: ' . $pl['level'] . '';
}
if ($pl['itm'] > 0) {
$pl['itm'] = explode(',', $pl['itm']);
$j = 0;
$tritm = '';
while ($j < count($pl['itm'])) {
$itm_id = $pl['itm'][$j];
if ($itm_id > 0) {
$itm_id = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm_id . '" LIMIT 1'));
$itm_id_true = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "' . $itm_id['id'] . '" AND
`delete` = 0 AND `inOdet` > 0 AND `inShop` = 0 AND `uid` = "' . $u->info['id'] . '"
LIMIT 1'));
if (!isset($itm_id_true['id'])) {
$tr = false;
}
if ($j > 0) {
$tritm .= ', ';
}
$tritm .= '&quot;' . $itm_id['name'] . '&quot;';
}
$j++;
}
if ($tritm != '') {
$trd .= "\r" . '&bull; Предметы: ' . $tritm . '';
}
}
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['tr_' . $n])) {
$trd .= "\r" . '&bull; ' . $u->is[$n] . ': ' . $po['tr_' . $n] . '';
if ($po['tr_' . $n] > $u->stats[$n]) {
$tr = false;
}
}
$x++;
}
if (($pl['tr'] == '' && $pl['itm'] == '') || $tr == true) {
if ($trd != '') {
$trd = 'Требуется минимальное:' . $trd;
}
echo '<a href="main.php?inv=1&obr_sel=' . $pl['id'] . '&rnd=' . $code . '"><img class="obrsl1" title="' . $trd . '" src="//img.new-combats.tech/i/obraz/' . $pl['sex'] . '/' . $pl['img'] . '" width="120" height="220" /></a> ';
}
}
?>
</center>

View File

@ -15,10 +15,11 @@ if ($u->info['inTurnir'] > 0 && $u->info['inUser'] == 0 && $u->info['room'] == 3
}
$zv = new FightRequest();
$r = $_GET['r'] ?? '';
// Турниры по умолчанию.
// 4-group,5-chaos,6-current,7-ended,10-tournament
$r = match ($_GET['r']) {
$r = match ($r) {
'4' => FightRequest::BATTLE_RAZDEL_GROUP,
'5' => FightRequest::BATTLE_RAZDEL_CHAOTIC,
'6' => FightRequest::BATTLE_RAZDEL_CURRENT,

View File

@ -87,7 +87,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
}
?>
var noErTmr;
var smnpty = <?=(0 + $u->info['smena'])?>;
var smnpty = <?= (int)$u->info['smena'] ?>;
setInterval('top.c.noEr = 0;', 1000);
function mbsum(event) {
@ -193,8 +193,8 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
<script type="text/javascript">
var login = '<?= $u->info['login']; ?>';
var za = <?= 0 + $u->stats['zona']; ?>;
var zb = <?= 0 + $u->stats['zonb']; ?>;
var za = <?= (int)$u->stats['zona']; ?>;
var zb = <?= (int)$u->stats['zonb']; ?>;
var level = <?= $u->info['level']; ?>;
function replaceAll(find, replace, str) {
@ -242,7 +242,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
var i = 0;
var j = {};
while (i != -1) {
if (vars[i] != undefined) {
if (vars[i]) {
j = explode('=', vars[i]);
data[j[0]] = j[1];
} else {
@ -253,8 +253,8 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
// 1.3
text = replaceAll('{tm1}', `<span class="date ${forYou}">${data['time1']}</span>`, text);
text = replaceAll('{u1}', `<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
text = replaceAll('{u2}', `<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
text = replaceAll('{u1}', `<span onClick="chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
text = replaceAll('{u2}', `<span onClick="chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
text = replaceAll('^^^^', '=', text);
text = replaceAll('{pr}', `<b>${data['prm']}</b>`, text);
@ -298,12 +298,12 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
i = 1;
while (i <= 21) {
//замена R - игрок 1
if (log_text[data['s1']] != undefined) {
if (log_text[data['s1']][i] != undefined) {
if (log_text[data['s1']]) {
if (log_text[data['s1']][i]) {
r = log_text[data['s1']][i];
k = 0;
while (k != -1) {
if (r[k] != undefined) {
if (r[k]) {
text = replaceAll(`{1x${i}x${k}}`, '' + r[k] + '', text);
} else {
k = -2;
@ -313,12 +313,12 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
}
}
//замена R - игрок 2
if (log_text[data['s2']] != undefined) {
if (log_text[data['s2']][i] != undefined) {
if (log_text[data['s2']]) {
if (log_text[data['s2']][i]) {
r = log_text[data['s2']][i];
k = 0;
while (k != -1) {
if (r[k] != undefined) {
if (r[k]) {
text = replaceAll(`{2x${i}x${k}}`, '' + r[k] + '', text);
} else {
k = -2;
@ -331,10 +331,10 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
}
//Повторная замена
text = replaceAll('{u1}', `<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
text = replaceAll('{u2}', `<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
text = replaceAll('{u1}', `<span onClick="chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
text = replaceAll('{u2}', `<span onClick="chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
if (data['prm'] != undefined) {
if (data['prm']) {
data['prm'] = replaceAll("rvnO", "=", data['prm']);
}
@ -394,30 +394,30 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
</td>
</tr>
<tr>
<div id="error" style="display:none;"></div>
<td>
<div id="error" style="display:none;"></div>
<div id="pers_magic" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
<td><img title="Пустой слот заклятия"
<td><img title="Пустой слот заклятия" alt=""
src="//img.new-combats.tech/i/items/w/w101.gif"/></td>
</tr>
</table>
@ -451,7 +451,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack1_1" class="crop"><a
onclick="change_radio(1,1,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_1_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -461,7 +461,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack2_1" class="crop"><a
onclick="change_radio(2,1,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_2_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -471,7 +471,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack3_1" class="crop"><a
onclick="change_radio(3,1,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_3_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -481,7 +481,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack4_1" class="crop"><a
onclick="change_radio(4,1,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_4_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -491,7 +491,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack5_1" class="crop"><a
onclick="change_radio(5,1,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_5_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -501,13 +501,12 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td onclick="select_atack(1,1);" style="cursor:default;"
align="left">удар в голову
</td>
<td width="3" style="cursor:default;"
onclick="select_atack(1,1);">&nbsp;
<td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;
</td>
<td>
<div id="zblock1_1" class="crop"><a
onclick="change_radio(1,1,'block',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="block_1_1"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -526,7 +525,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack1_2" class="crop"><a
onclick="change_radio(1,2,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_1_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -536,7 +535,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack2_2" class="crop"><a
onclick="change_radio(2,2,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_2_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -546,7 +545,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack3_2" class="crop"><a
onclick="change_radio(3,2,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_3_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -556,7 +555,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack4_2" class="crop"><a
onclick="change_radio(4,2,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_4_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -566,7 +565,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zatack5_2" class="crop"><a
onclick="change_radio(5,2,'atack',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="atack_5_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -582,7 +581,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<td>
<div id="zblock1_2" class="crop"><a
onclick="change_radio(1,2,'block',0);return false;"
href="#"><img style="display:block;"
href="#"><img style="display:block;" alt=""
id="block_1_2"
class="radio_off"
src="//img.new-combats.tech/i/misc/radio.gif"
@ -847,10 +846,14 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
type="hidden"/>
<input name="auto_battle" id="auto_battle"
type="hidden"/>
<button name="go_btn" type="button" id="go_btn"
<button name="go_btn"
type="button"
id="go_btn"
style="cursor:pointer;"
class="buttons inpBtl btnnew" onclick=""
disabled="disabled">Вперёд!!!
class="buttons inpBtl btnnew"
onclick=""
disabled="disabled">
Вперёд!!!
</button>
<button name="reflesh_btn" onClick="" type="button"
id="reflesh_btn"
@ -1067,11 +1070,15 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
<script>// файл батл мини js и этот тесно связаны, то что имеем в батл мини должны по логике иметь и здесь, но я не понимаю конечно прикола,ну мб потому что я тупой
function atackt() { // в душе не ебу что это
function atackt() {
// Вызывается при нажатии кнопки Вперёд! в бою.
// Делаем кнопку серой и убираем с неё функцию.
document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('go_btn').setAttribute("onclick", "");
document.getElementById('go_btn').setAttribute("disabled", "disabled");
// Бьём?
atack();
// Вызываем таймер серости.
timedCount();
}