game/AI.php
2023-11-09 19:24:47 +02:00

486 lines
11 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Core\Db;
use Helper\Conversion;
use Item\Data\Bonuses;
use Item\Data\Properties;
use Item\Data\Requirements;
use Model\Constant\ShopOtdel;
ini_set('xdebug.var_display_max_depth', 10);
ini_set('xdebug.var_display_max_children', 256);
ini_set('xdebug.var_display_max_data', 1024);
if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
//const GAME = true;
$user = User::start();
//var_dump($user->info['testStats'], $user->info['testStats2']);
//exit();
$im = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'items_main'");
$iu = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'items_users'");
$u = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users'");
$s = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'stats'");
$p = Db::getRows('select * from const_stats');
var_dump((new ShopOtdel())->getGroups());
?>
<div style="display: grid; grid-template-columns: 50% 50%; word-wrap: break-word;">
<div>
<b><u>$user->[info]</u></b><br>
<?php
$rr = 1;
foreach ($user->info as $k => $v) {
if (isset($user->is[$k])) {
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]</span>";
}
if ($k == 'stats') {
echo 'stats = ARRAY<br>';
foreach (Conversion::dataStringToArray($v) as $dk => $dv) {
if (isset($user->is[$dk])) {
$dk .= " <span style='background-color: lightcyan;'>[{$user->is[$dk]}]</span>";
}
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$dk = $dv</span><br>";
}
$k = '';
$v = '';
}
echo "$rr. $k = $v<br>";
$rr++;
}
?>
</div>
<div>
<b><u>$user->[stats]</u></b><br>
<?php
$rr = 1;
foreach ($user->stats as $k => $v) {
if (isset($user->is[$k])) {
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]";
} else {
$k = "<span>$k";
}
echo "$rr. $k</span> = $v<br>";
$rr++;
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $v2</span><br>";
if (is_array($v2)) {
foreach ($v2 as $k3 => $v3) {
echo "<span style='background-color: aliceblue; margin-left: 10px;'>$k3 = $v3</span><br>";
if ($k3 === 'data' && $v3 !== '[]') {
$v3 .= '|add_mib2=43';
$itemData = Conversion::dataStringToArray($v3);
echo 'DATA TR_<br>';
foreach ((new Requirements($itemData))->get() as $k => $v) {
echo "$k = $v<br>";
}
echo 'DATA ADD_<br>';
foreach ((new Bonuses($itemData))->get() as $k => $v) {
echo "$k = $v<br>";
}
}
}
}
}
}
}
?>
</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
<?php var_dump($u); ?>
</div>
<div> Поля в базе stats
<?php var_dump($s); ?>
</div>
</div>
<div style="margin-top: 10px; background-color: aliceblue">Отдельно, уже согласованные параметры предметов, которые могут находиться исключительно в поле data</div>
<div style="display: grid; grid-template-columns: auto auto auto; background-color: aliceblue">
<div> sv_* (хотим убрать)
<?php var_dump(Properties::$names); ?>
</div>
</div>
<div style="display: grid; grid-template-columns: auto auto;">
<div> Поля в базе items_main
<?php var_dump($im); ?>
</div>
<div> Поля в базе items_users
<?php var_dump($iu); ?>
</div>
</div>
<hr>
<hr> Параметры игрока.<br><br>
<div style="display: grid; grid-template-columns: auto auto auto;">
<div> Заскриптованные
<?php var_dump($user->is); ?>
</div>
<div> Хотим оставить
</div>
<div> Хотим убрать
</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']}";
if ($prow['is_percentage']) {
echo " (%)";
}
if ($prow['is_requirement']) {
echo " <span style='background-color: lightpink;'>[требуется]</span> ";
}
if ($prow['is_bonus']) {
echo " <span style='background-color: lightgreen;'>[даёт]</span> ";
}
echo "<br>";
}