This commit is contained in:
Ivor Barhansky 2024-02-08 14:55:44 +02:00
parent 7dc27047b6
commit 88aeb4a912
3 changed files with 95 additions and 43 deletions

18
AI.php
View File

@ -15,11 +15,8 @@ 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();
$user = User::start();
$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'");
@ -63,21 +60,28 @@ var_dump((new ShopOtdel())->getGroups());
<?php
$rr = 1;
foreach ($user->stats as $k => $v) {
if ($k === 'items_o') {
continue;
}
if (isset($user->is[$k])) {
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]";
} else {
$k = "<span>$k";
}
echo "$rr. $k</span> = $v<br>";
$vv = is_array($v) ? 'array' : $v;
echo "$rr. $k</span> = $vv<br>";
$rr++;
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $v2</span><br>";
$vv2 = is_array($v2) ? 'array' : $v2;
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $vv2</span><br>";
if (is_array($v2)) {
foreach ($v2 as $k3 => $v3) {
echo "<span style='background-color: aliceblue; margin-left: 10px;'>$k3 = $v3</span><br>";
$vv3 = is_array($v2) ? 'array' : $v3;
echo "<span style='background-color: aliceblue; margin-left: 10px;'>$k3 = $vv3</span><br>";
if ($k3 === 'data' && $v3 !== '[]') {
$v3 .= '|add_mib2=43';
$itemData = Conversion::dataStringToArray($v3);

View File

@ -5132,30 +5132,31 @@ JS;
if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) {
$this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll'];
}
// Цветная метка тем, кто вылетел за таймаут в 15 минут?
$a1ms = '';
if (isset($this->ga[$this->users[$i]['id']][$you]) && $this->ga[$this->users[$i]['id']][$you]) {
$a1mc = '';
$ac = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1'
)
);
if (isset($ac) && $ac['time'] + $this->i->timeout - 15 < time()) {
$a1mc = 'color:red;';
}
$a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"';
} elseif (isset($this->ag[$this->users[$i]['id']][$you]) && $this->ag[$this->users[$i]['id']][$you]) {
$a1mc = '';
$ac = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1'
)
);
if (isset($ac) && $ac['time'] + $this->i->timeout - 15 < time()) {
$a1mc = 'color:green;';
}
$a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"';
$actcolor = '';
$actstyle = '';
$actid = 0;
if (!empty($this->ga[$this->users[$i]['id']][$you])) {
$actid = $this->ga[$this->users[$i]['id']][$you];
$actcolor = 'red';
$actstyle = 'underline';
} elseif (!empty($this->ag[$this->users[$i]['id']][$you])) {
$actid = $this->ag[$this->users[$i]['id']][$you];
$actcolor = 'green';
$actstyle = 'overline';
}
if (!empty($actid)) {
$ac = Db::getRow('select id, time from battle_act where id = ?', [$actid]);
if ($ac['id'] && $ac['time'] + $this->i->timeout - 15 < time()) {
$a1ms = " color: $actcolor;";
}
$a1ms = "style='text-decoration: $actstyle';$a1ms";
}
if ($this->users[$i]['login2'] == '') {
$this->users[$i]['login2'] = $this->users[$i]['login'];
}
@ -5165,7 +5166,7 @@ JS;
}
$ldr = '';
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 \>';
$ldr = '<img 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=\"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']
@ -5179,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=\"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\" 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> ';

View File

@ -16,6 +16,64 @@ class Item
public readonly string $data;
public int $durability;
public readonly int $add_a1;
public readonly int $add_a2;
public readonly int $add_a3;
public readonly int $add_a4;
public readonly int $add_a5;
public readonly int $add_aall;
public readonly int $add_hpall;
public readonly int $add_m1;
public readonly int $add_m10;
public readonly int $add_m11;
public readonly int $add_m14;
public readonly int $add_m15;
public readonly int $add_m18;
public readonly int $add_m19;
public readonly int $add_m2;
public readonly int $add_m3;
public readonly int $add_m4;
public readonly int $add_m5;
public readonly int $add_m6;
public readonly int $add_m7;
public readonly int $add_m8;
public readonly int $add_m9;
public readonly int $add_mall;
public readonly int $add_mg1;
public readonly int $add_mg2;
public readonly int $add_mg3;
public readonly int $add_mg4;
public readonly int $add_mg7;
public readonly int $add_mpall;
public readonly int $add_pa1;
public readonly int $add_pa2;
public readonly int $add_pa3;
public readonly int $add_pa4;
public readonly int $add_pm1;
public readonly int $add_pm2;
public readonly int $add_pm3;
public readonly int $add_pm4;
public readonly int $add_pm7;
public readonly int $add_s1;
public readonly int $add_s2;
public readonly int $add_s3;
public readonly int $add_s4;
public readonly int $add_s5;
public readonly int $add_s6;
public readonly int $add_s7;
public readonly int $add_za;
public readonly int $add_za1;
public readonly int $add_za2;
public readonly int $add_za3;
public readonly int $add_za4;
public readonly int $add_zm;
public readonly int $add_zm1;
public readonly int $add_zm2;
public readonly int $add_zm3;
public readonly int $add_zm4;
public readonly int $add_zona;
public readonly int $add_zonb;
public function __construct(array $item)
{
[
@ -35,6 +93,7 @@ class Item
$dataArr = Conversion::dataStringToArray(strtolower($this->data));
foreach ($stat->sysBonusNames as $bonusName) {
if (!isset($dataArr["add_$bonusName"])) {
$this->{"add_$bonusName"} = 0;
continue;
}
@ -45,15 +104,3 @@ class Item
}
// 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
*/