From 88aeb4a912de839aca12e4f96efabbcf74e04357 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Thu, 8 Feb 2024 14:55:44 +0200 Subject: [PATCH] WIP --- AI.php | 18 +++++---- _incl_data/class/Battle.php | 49 +++++++++++------------ _incl_data/class/User/Item.php | 71 ++++++++++++++++++++++++++++------ 3 files changed, 95 insertions(+), 43 deletions(-) diff --git a/AI.php b/AI.php index 3662764d..371dfc8d 100644 --- a/AI.php +++ b/AI.php @@ -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()); stats as $k => $v) { + if ($k === 'items_o') { + continue; + } if (isset($user->is[$k])) { $k .= " [{$user->is[$k]}]"; } else { $k = "$k"; } - echo "$rr. $k = $v
"; + $vv = is_array($v) ? 'array' : $v; + echo "$rr. $k
= $vv
"; $rr++; + if (is_array($v)) { foreach ($v as $k2 => $v2) { - echo "$k2 = $v2
"; + $vv2 = is_array($v2) ? 'array' : $v2; + echo "$k2 = $vv2
"; if (is_array($v2)) { foreach ($v2 as $k3 => $v3) { - echo "$k3 = $v3
"; + $vv3 = is_array($v2) ? 'array' : $v3; + echo "$k3 = $vv3
"; if ($k3 === 'data' && $v3 !== '[]') { $v3 .= '|add_mib2=43'; $itemData = Conversion::dataStringToArray($v3); diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index 20010da1..55bc7e9f 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -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 = 'users[$i]['team'] . '.gif \>'; + $ldr = 'users[$i]['team'] . '.gif>'; } $teams[$this->users[$i]['team']] .= ', ' . $ldr . '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'] . ' [' . 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]] = ' ' . $teams[$tms[$i]]; + $teams[$tms[$i]] = ' ' . $teams[$tms[$i]]; $ret .= $teams[$tms[$i]]; if (count($tms) > $i + 1) { $ret .= '   против   '; diff --git a/_incl_data/class/User/Item.php b/_incl_data/class/User/Item.php index 5421d90f..2b40e47e 100644 --- a/_incl_data/class/User/Item.php +++ b/_incl_data/class/User/Item.php @@ -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 -*/