From def933dca46de0f216448cac286114e4e17b316e Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Thu, 2 Nov 2023 15:57:39 +0200 Subject: [PATCH] refactor --- AI.php | 224 -- _incl_data/class/Achievements.php | 31 +- _incl_data/class/Admin/Monster.php | 135 + _incl_data/class/Battle.php | 1853 +++++------ _incl_data/class/Clan/ClanInfo.php | 8 +- _incl_data/class/ComissionShop.php | 189 +- _incl_data/class/Delo.php | 37 +- _incl_data/class/Filter.php | 4 +- _incl_data/class/Helper/Conversion.php | 9 +- _incl_data/class/Inf/Awards.php | 145 + _incl_data/class/Inf/LastNames.php | 38 + _incl_data/class/Inf/Status.php | 38 + _incl_data/class/Inf/Twinks.php | 39 + _incl_data/class/Inf/Zodiac.php | 68 + _incl_data/class/Item.php | 43 +- _incl_data/class/Item/Data/Bonuses.php | 4 +- _incl_data/class/Item/Data/Properties.php | 2 +- _incl_data/class/Item/Data/Requirements.php | 2 +- _incl_data/class/Magic/addmoney.php | 79 +- _incl_data/class/Magic/sunduk_new.php | 26 +- _incl_data/class/Model/ActionModel.php | 59 +- _incl_data/class/User.php | 3217 ++++--------------- _incl_data/class/User/Effects.php | 17 +- _incl_data/class/User/InfoBox.php | 791 +++++ _incl_data/class/User/ItemsModel.php | 107 +- _incl_data/class/User/Parameters.php | 97 + _incl_data/class/User/Register.php | 83 +- _incl_data/class/User/Reputation.php | 18 +- _incl_data/class/User/Stats.php | 685 ++-- _incl_data/crons/bot_calls.php | 21 +- adminion/testing.php | 13 +- buttons.php | 3 +- inf.php | 3209 ++++++------------ js/btl_mini.js | 794 ++--- js/title.js | 2 +- jx/battle/log_text.php | 28 +- jx/battle/refresh.php | 500 ++- jx/battle/refresh1.php | 489 ++- modules_data/btl_.php | 164 +- modules_data/btl_bac.php | 632 ---- modules_data/location/btl_.php | 1159 ------- modules_data/location/commision2.php | 28 +- modules_data/location/dungeon_enter.php | 16 - modules_data/location/house_belaun.php | 2738 ++++++++-------- modules_data/location/objaga.php | 1834 ++++++----- modules_data/location/remont.php | 81 - modules_data/location/room_hostel.php | 1441 +++++---- modules_data/location/shop_.php | 1 - modules_data/moder/teleport.php | 88 +- modules_data/stats_inv.php | 4 +- online.php | 2 + 51 files changed, 8866 insertions(+), 12429 deletions(-) delete mode 100644 AI.php create mode 100644 _incl_data/class/Admin/Monster.php create mode 100644 _incl_data/class/Inf/Awards.php create mode 100644 _incl_data/class/Inf/LastNames.php create mode 100644 _incl_data/class/Inf/Status.php create mode 100644 _incl_data/class/Inf/Twinks.php create mode 100644 _incl_data/class/Inf/Zodiac.php create mode 100644 _incl_data/class/User/InfoBox.php create mode 100644 _incl_data/class/User/Parameters.php delete mode 100644 modules_data/btl_bac.php delete mode 100644 modules_data/location/btl_.php diff --git a/AI.php b/AI.php deleted file mode 100644 index 7ed3bbc6..00000000 --- a/AI.php +++ /dev/null @@ -1,224 +0,0 @@ -" . $pl['email']; - } -} elseif (isset($_GET['bk1'])) { - define('GAME', true); - - - - include('_incl_data/__config.php'); - include('_incl_data/class/__db_connect.php'); - $u = User::start(); - - $ins = 'Вещи БК-1:
'; - $sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1'); - while ($pl = mysql_fetch_array($sp)) { - - $po = mysql_fetch_array( - mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1') - ); - $po = ConversionHelper::dataStringToArray($po['data']); - - if (!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) { - $po['add_minAtack'] = $po['sv_minAtack']; - $po['add_maxAtack'] = $po['sv_maxAtack']; - } - - $ins .= 'INSERT INTO `items_main` ( - `id`, `name`, `img`, `art`, `type`, `inslot`, `use_magic`, `price`, `price2`, `iznosMAXi`, `massa`, `tr_level`, `tr_s1`, `tr_s2`, `tr_s3`, `tr_s4`, `tr_s5`, `tr_s6`, `add_s1`, `add_s2`, `add_s3`, `add_s4`, `add_s5`, `add_s6`, `add_hp`, `add_mp`, `add_m1`, `add_m2`, `add_m3`, `add_m4`, `add_b1`, `add_b2`, `add_b3`, `add_b4`, `add_attack_min`, `add_attack_max` - ,`tr_a1`,`tr_a2`,`tr_a3`,`tr_a4`,`tr_mg1`,`tr_mg2`,`tr_mg3`,`tr_mg4`,`tr_mg5`,`tr_mg6`,`tr_mg7` - ,`add_a1`,`add_a2`,`add_a3`,`add_a4`,`add_mg1`,`add_mg2`,`add_mg3`,`add_mg4`,`add_mg5`,`add_mg6`,`add_mg7` - ) VALUES '; - $ins .= '( - NULL, - "' . $pl['name'] . '", - "' . $pl['img'] . '", - "' . (0 + round($po['art'])) . '", - "' . $pl['type'] . '", - "' . $pl['inslot'] . '", - "", - "' . $pl['price1'] . '", - "' . $pl['price2'] . '", - "' . $pl['iznosMAXi'] . '", - "' . $pl['massa'] . '", - "' . (0 + round($po['tr_lvl'])) . '", - "' . (0 + round($po['tr_s1'])) . '", - "' . (0 + round($po['tr_s2'])) . '", - "' . (0 + round($po['tr_s3'])) . '", - "' . (0 + round($po['tr_s4'])) . '", - "' . (0 + round($po['tr_s5'])) . '", - "' . (0 + round($po['tr_s6'])) . '", - "' . (0 + round($po['add_s1'])) . '", - "' . (0 + round($po['add_s2'])) . '", - "' . (0 + round($po['add_s3'])) . '", - "' . (0 + round($po['add_s4'])) . '", - "' . (0 + round($po['add_s5'])) . '", - "' . (0 + round($po['add_s6'])) . '", - "' . (0 + round($po['add_hpAll'])) . '", - "' . (0 + round($po['add_mpAll'])) . '", - "' . (0 + round($po['add_m1'])) . '", - "' . (0 + round($po['add_m2'])) . '", - "' . (0 + round($po['add_m3'])) . '", - "' . (0 + round($po['add_m4'])) . '", - "' . (0 + round($po['add_mib1'])) . '", - "' . (0 + round($po['add_mib2'])) . '", - "' . (0 + round($po['add_mib3'])) . '", - "' . (0 + round($po['add_mib4'])) . '", - "' . (0 + round($po['add_minAtack'])) . '", - "' . (0 + round($po['add_maxAtack'])) . '", - "' . (0 + round($po['tr_a1'])) . '", - "' . (0 + round($po['tr_a2'])) . '", - "' . (0 + round($po['tr_a3'])) . '", - "' . (0 + round($po['tr_a4'])) . '", - "' . (0 + round($po['tr_mg1'])) . '", - "' . (0 + round($po['tr_mg2'])) . '", - "' . (0 + round($po['tr_mg3'])) . '", - "' . (0 + round($po['tr_mg4'])) . '", - "' . (0 + round($po['tr_mg5'])) . '", - "' . (0 + round($po['tr_mg6'])) . '", - "' . (0 + round($po['tr_mg7'])) . '", - "' . (0 + round($po['add_a1'])) . '", - "' . (0 + round($po['add_a2'])) . '", - "' . (0 + round($po['add_a3'])) . '", - "' . (0 + round($po['add_a4'])) . '", - "' . (0 + round($po['add_mg1'])) . '", - "' . (0 + round($po['add_mg2'])) . '", - "' . (0 + round($po['add_mg3'])) . '", - "' . (0 + round($po['add_mg4'])) . '", - "' . (0 + round($po['add_mg5'])) . '", - "' . (0 + round($po['add_mg6'])) . '", - "' . (0 + round($po['add_mg7'])) . '" - );'; - $ins .= "\n" . '
'; - } - - echo $ins; - - die(); -} - -if (isset($_GET['test'])) { - $i = 3; - - - function yrn($sila) - { - return 2 + $_GET['test'] + $sila - round($sila / 5); - } - - - while ($i <= 100) { - echo ' '; - echo $i . ' = ' . yrn($i); - echo ''; - $i++; - } - - die(); -} - -if (!isset($_GET['robot']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get( - ) != '' && UserIp::get() != '31.131.116.166') { - die(UserIp::get() . '
' . $_SERVER['SERVER_ADDR']); -} - - -const GAME = true; - - - -include('_incl_data/__config.php'); -include('_incl_data/class/__db_connect.php'); - -$count = [0, 0, 0, 0, 0, 0]; - -function inuser_go_btl($id) -{ - if (isset($id['id'])) { - file_get_contents( - '/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5( - $id['id'] . '_brfCOreW@!_' . $id['pass'] - ) . '&pass=' . $id['pass'] - ); - } -} - -$sp = mysql_query( - 'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200' -); - -$btltest = []; - -while ($pl = mysql_fetch_array($sp)) { - - $i++; - - if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) { - - $btltest[$pl['battle']]++; - - if ($pl['timereg'] == 0) { - mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } else { - User::setOnline($pl['id']); - } - - if ($pl['bot'] == 0) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - - User::setOnline($pl['id']); - - BotLogic::start($pl['id']); - - } else { - - if ($pl['zv'] > 0) { - BotLogic::start($pl['id']); - } - - if ($pl['timereg'] == 0) { - mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } else { - User::setOnline($pl['id']); - } - - if ($pl['bot'] == 0) { - mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - User::setOnline($pl['id']); - - echo '*'; - } - echo '+'; - echo '[' . $pl['login'] . '] -> Действие: ' . $pl['ipreg'] . ' , ожидаем: ' . ($pl['timeMain'] - time( - )) . ' сек., заявка: ' . $pl['zv'] . ', поединок: ' . $pl['battle'] . ''; - echo '
'; -} diff --git a/_incl_data/class/Achievements.php b/_incl_data/class/Achievements.php index a0338e7b..646e54f1 100644 --- a/_incl_data/class/Achievements.php +++ b/_incl_data/class/Achievements.php @@ -8,7 +8,7 @@ use User\ItemsModel; class Achievements { private User $user; - private $info; + private array $info; private array $data = [ 'zb' => [ 'questname' => 'Ежедн.Задания', @@ -99,7 +99,7 @@ class Achievements public function __construct(User $user) { $this->user = $user; - $this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]); + $this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]) ?: []; } //fixme: сюда иногда приходит (NULL, NULL). @@ -165,7 +165,7 @@ class Achievements return $string; } - private function calculateCurrent($check = null) + private function calculateCurrent($check = null): void { $this->info['bs'] = $this->user->info['win_bs']; foreach ($this->info as $k => $v) { @@ -187,17 +187,18 @@ class Achievements $this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]); for ($i = 1; $i <= 5; $i++) { - if ($this->info[$k] >= $this->data[$k]['check'][$i]) { - $this->info["klas$k"] = $i; - if ($i === 5) { - # На 5 ранге должно отдавать максимум. - $this->info["klasP$k"] = 100; - } else { - $this->info["klasP$k"] = Math::get100Percentage( - $this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i], - $this->info[$k] - $this->data[$k]['check'][$i] - ); - } + if ($this->info[$k] < $this->data[$k]['check'][$i]) { + continue; + } + $this->info["klas$k"] = $i; + if ($i === 5) { + # На 5 ранге должно отдавать максимум. + $this->info["klasP$k"] = 100; + } else { + $this->info["klasP$k"] = Math::get100Percentage( + $this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i], + $this->info[$k] - $this->data[$k]['check'][$i] + ); } } } @@ -225,7 +226,7 @@ class Achievements public function getInfo(?int $uid = null) { if (!is_null($uid)) { - $this->info = Db::getRow('select * from users_achiv where id = ?', [$uid]); + $this->info = Db::getRow('select * from users_achiv where id = ?', [$uid]) ?: []; } $this->calculateCurrent(); return $this->info; diff --git a/_incl_data/class/Admin/Monster.php b/_incl_data/class/Admin/Monster.php new file mode 100644 index 00000000..cd3ca1a0 --- /dev/null +++ b/_incl_data/class/Admin/Monster.php @@ -0,0 +1,135 @@ +info = Db::getRow('select * from aaa_monsters where uid = ?', [$monsterid]); + if ($_SERVER['REQUEST_METHOD'] === OAUTH_HTTP_METHOD_POST) { + $this->save(); + } + } + + private function save(): void + { + $params['uid'] = $this->info['uid']; + $params['start_room'] = (int)$_POST['bot_sroom']; + + $params['start_day'] = (int)$_POST['bot_sday']; + $params['start_dd'] = (int)$_POST['bot_sdd']; + $params['start_mm'] = (int)$_POST['bot_smm']; + $params['start_hh'] = (int)$_POST['bot_shh']; + $params['start_min'] = (int)$_POST['bot_smin']; + + $params['back_day'] = (int)$_POST['bot_bday']; + $params['back_dd'] = (int)$_POST['bot_bdd']; + $params['back_mm'] = (int)$_POST['bot_bmm']; + $params['back_hh'] = (int)$_POST['bot_bhh']; + $params['back_min'] = (int)$_POST['bot_bmin']; + + $params['start_text'] = $_POST['bot_stext']; + $params['back_text'] = $_POST['bot_btext']; + $params['win_text'] = $_POST['bot_wintext']; + $params['lose_text'] = $_POST['bot_losetext']; + $params['nich_text'] = $_POST['bot_nichtext']; + + $params['win_back'] = $_POST['bot_winback']; + $params['time_restart'] = $_POST['bot_trs']; + + $params['win_itm'] = $_POST['bot_winitm']; + $params['win_money1'] = $_POST['bot_winmoney1']; + $params['win_money2'] = $_POST['bot_winmoney2']; + $params['win_exp'] = $_POST['bot_winexp']; + $params['win_eff'] = $_POST['bot_wineff']; + $params['win_ico'] = $_POST['bot_winico']; + + $params['lose_itm'] = $_POST['bot_loseitm']; + $params['lose_money'] = $_POST['bot_losemoney1']; + $params['lose_money2'] = $_POST['bot_losemoney2']; + $params['lose_exp'] = $_POST['bot_loseexp']; + $params['lose_eff'] = $_POST['bot_loseeff']; + $params['lose_ico'] = $_POST['bot_loseico']; + + if (!isset( + $params['uid'], + $params['start_room'], + $params['start_day'], + $params['back_day'], + $params['start_dd'], + $params['start_mm'], + $params['start_hh'], + $params['start_min'], + $params['back_min'], + $params['back_dd'], + $params['back_mm'], + $params['back_hh'], + $params['start_text'], + $params['back_text'], + $params['win_text'], + $params['lose_text'], + $params['nich_text'], + $params['win_money1'], + $params['win_money2'], + $params['lose_money'], + $params['lose_money2'], + $params['win_exp'], + $params['lose_exp'], + $params['win_itm'], + $params['lose_itm'], + $params['win_eff'], + $params['lose_eff'], + $params['win_ico'], + $params['lose_ico'], + $params['win_back'], + $params['time_restart'] + )) { + return; + } + Db::sql('replace into aaa_monsters + (uid, start_room, start_day, back_day, start_dd, start_mm, start_hh, start_min, + back_min, back_dd, back_mm, back_hh, start_text, back_text, win_text, lose_text, + nich_text, win_money1, win_money2, lose_money, lose_money2, win_exp, lose_exp, + win_itm, lose_itm, win_eff, lose_eff, win_ico, lose_ico, win_back, time_restart) + values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [ + $params['uid'], + $params['start_room'], + $params['start_day'], + $params['back_day'], + $params['start_dd'], + $params['start_mm'], + $params['start_hh'], + $params['start_min'], + $params['back_min'], + $params['back_dd'], + $params['back_mm'], + $params['back_hh'], + $params['start_text'], + $params['back_text'], + $params['win_text'], + $params['lose_text'], + $params['nich_text'], + $params['win_money1'], + $params['win_money2'], + $params['lose_money'], + $params['lose_money2'], + $params['win_exp'], + $params['lose_exp'], + $params['win_itm'], + $params['lose_itm'], + $params['win_eff'], + $params['lose_eff'], + $params['win_ico'], + $params['lose_ico'], + $params['win_back'], + $params['time_restart'], + ]); + + echo 'Новые данные были успешно сохранены!'; + } +} diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index 2a46a616..95d5cc53 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -286,6 +286,10 @@ class Battle public array $bots = []; // ID ботов public array $iBots = []; // i бота public array $stnZb = []; + + /** Выбранные зоны атаки и блока. + * @var array + */ public array $uAtc = [ 'id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], @@ -443,10 +447,10 @@ class Battle $this->stats[$this->uids[$uid]]['last_hp'] = -$hp; Db::sql( 'update stats set last_hp = ?, tactic7 = ? where id = ?', [ - $this->users[$this->uids[$uid]]['last_hp'], - $this->users[$this->uids[$uid]]['tactic7'], - $uid, - ] + $this->users[$this->uids[$uid]]['last_hp'], + $this->users[$this->uids[$uid]]['tactic7'], + $uid, + ] ); } @@ -494,28 +498,24 @@ class Battle { //Получаем приемы и смотрим когда какой действует foreach ($this->stats[$this->uids[$u2]]['effects'] as $effect) { - if ( - isset($effect) && - $effect['id_eff'] == 22 && - $effect['v1'] == 'priem' && - ( - $effect['v2'] == 140 || - $effect['v2'] == 211 || - $effect['v2'] == 45 - ) + if (!isset($effect) || + $effect['id_eff'] != 22 || + $effect['v1'] != 'priem' || + $effect['v2'] != 140 && $effect['v2'] != 211 && $effect['v2'] != 45 ) { - //Приемы от которых урон = 1 , то есть выдаем 0 - $hp['y'] = -1; - $hp['r'] = 1; - $hp['k'] = 2; - $hp['m_y'] = 1; - $hp['m_k'] = 2; + continue; } + //Приемы от которых урон = 1 , то есть выдаем 0 + $hp['y'] = -1; + $hp['r'] = 1; + $hp['k'] = 2; + $hp['m_y'] = 1; + $hp['m_k'] = 2; } return $hp; } - public function takeYronNow($uid, $y) + public function takeYronNow($uid, $y): void { global $u; if (!is_numeric($y) || !is_numeric($uid)) { @@ -556,7 +556,14 @@ class Battle $ef = ''; $i = 0; if ($u->info['seff'] < 1) { - $ef .= '
Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
'; + $ef .= '
+ Свернуть\',event,3,1,1,1,\'\');\" + onmouseout=\"top.hic();\" + onmousedown=\"top.hic();\"> +
'; while ($i != -1) { $nseef = 0; @@ -607,14 +614,13 @@ class Battle $time_still -= time(); if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) { if ($eff[$i]['type1'] != 13) { - - $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; + $ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still); } } else { if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) { - $ei .= 'Осталось: ' . $u->timeOut($time_still) . ''; + $ei .= 'Осталось: ' . Conversion::secondsToTimeout($time_still); } elseif ($eff[$i]['hod'] >= 0) { - $ei .= 'Зарядов: ' . $eff[$i]['hod'] . ''; + $ei .= 'Зарядов: ' . $eff[$i]['hod']; } } @@ -1323,8 +1329,7 @@ class Battle //конец излома $this->finishBattle($tml, $tmv, null); $fin1 = mysql_query( - 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time( - ) . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")' + 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")' ); } else { $this->info['izlomRound'] = $iz['round']; @@ -1378,15 +1383,13 @@ class Battle $this->finishBattle($tml, $tmv, null); if ($this->info['izlom'] > 0) { $fin1 = mysql_query( - 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time( - ) . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")' + 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")' ); } } if (isset($fin1)) { mysql_query( - 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '","Касание Хаоса","nofastfinisheff=1","' . time( - ) . '")' + 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '","Касание Хаоса","nofastfinisheff=1","' . time() . '")' ); $cmsg = new ChatMessage(); $cmsg->setCity($u->info['city']); @@ -1404,8 +1407,7 @@ class Battle $i01++; } mysql_query( - 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time( - ) . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")' + 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")' ); unset($fin1); } @@ -1426,29 +1428,9 @@ class Battle //Поглощение урона - private function get_chanse($percent): bool + private function get_chanse(int $percent): bool { - if ($percent >= 100) { - $percent = 100; - } elseif ($percent == 0) { - $percent = 0; - } - return $this->dodge(1, $percent); - } - - private function dodge($a, $b): bool - { - $i = 0; - $arr = []; //массив для записи уникальных случайных чисел - while ($i < ($b - $a)) { - while (in_array($rand, $arr)) { - $rand = mt_rand(1, 100); - } - $arr[] = $rand; - $i++; - } - $n = mt_rand(1, 100); - return (bool)array_search($n, $arr); + return rand(0, 100) <= $percent; } //Поглощение урона @@ -1479,7 +1461,7 @@ class Battle mysql_query( 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES (unix_timestamp(), "' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $mass['text'] . '","' . $mass['vars'] . '","' . $mass['type'] . '")' ); - if (rand(2, 10) == 10) { + if ($this->get_chanse(12)) { $this->get_comment(); } } @@ -1612,27 +1594,23 @@ class Battle '<вырезано цензурой> после боя я этих <вырезано цензурой> обоих в <вырезано цензурой> и <вырезано цензурой>', '<вырезано цензурой> каратисты фиговы', ]; - if (rand(1, 12) === 1) { - $txt = '{tm1} Комментатор: ' . $boycom[rand(0, count($boycom) - 1)] . ''; - $vLog = 'time1=' . time(); - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => $txt, - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $this->add_log($mas1); - } else { - return false; - } - return true; + $txt = '{tm1} Комментатор: ' . $boycom[rand(0, count($boycom) - 1)] . ''; + + $vLog = 'time1=' . time(); + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => $txt, + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + $this->add_log($mas1); } //Игрок1 наносит удар Игрок2 @@ -1712,8 +1690,7 @@ class Battle $vtvl = ''; $relu = 0; while ($i < count($this->users)) { - $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time( - ) . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; + $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) { $vtvl .= '' . $this->users[$i]['login'] . ', '; } @@ -2179,8 +2156,7 @@ class Battle 'UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); mysql_query( - 'UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time( - ) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' + 'UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); } elseif ($this->users[$i]['bot'] > 0) { @@ -2189,8 +2165,7 @@ class Battle 'UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); mysql_query( - 'UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time( - ) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' + 'UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); } @@ -2403,8 +2378,7 @@ class Battle } } mysql_query( - 'UPDATE `dungeon_bots` SET `delete` = "' . time( - ) . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" ' + 'UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" ' ); } else { //выкидываем всех игроков в клетку RESTART @@ -3041,17 +3015,14 @@ class Battle } if ($this->users[$i]['battle_yron'] > 0) { mysql_query( - 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '","Право на подвиг","pravonapodvig=1","' . time( - ) . '")' + 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '","Право на подвиг","pravonapodvig=1","' . time() . '")' ); } mysql_query( - 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time( - ) - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")' + 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")' ); mysql_query( - 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time( - ) . '")' + 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")' ); $ritem = rand(1, 1000); if ($ritem == 555) { @@ -3119,8 +3090,7 @@ class Battle 'UPDATE `rep` SET `rep3` = `rep3` + "' . $rzbvo . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); mysql_query( - 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time( - ) . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")' + 'INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")' ); } } @@ -3299,8 +3269,7 @@ class Battle ); //удаляем все предметы которые пропадают после выхода из пещеры mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time( - ) . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")' + 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")' ); if ($this->users[$i]['login'] != '') { if ($this->users[$i]['sex'] == 0) { @@ -3373,8 +3342,7 @@ class Battle } mysql_query( - 'UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time( - ) . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' + 'UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1' ); if ($this->info['turnir'] == 0) { //пишем в чат @@ -3479,12 +3447,10 @@ class Battle } $timeEnd *= 3600; mysql_query( - 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time( - ) . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $v1 . '")' + 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $v1 . '")' ); mysql_query( - 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time( - ) . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")' + 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")' ); } @@ -3978,90 +3944,6 @@ class Battle //Расчет блока щитом игроков - /** Осторожно! Подключаются файлы!!! - * @param $pl - * @param $u1 - * @param $t - * @param $u2 - * @param $rznm - * @param $k2nm - * @param $yrn - * @param $yrnt - * @return void - */ - public function delPriem( - $pl, - $u1, - $t = 1, - $u2 = false, - $rznm = 'Очиститься Кровью', - $k2nm = null, - $yrn = null, - $yrnt = null - ) { - global $u, $priem; - if (!isset($pl['priem']['id']) || isset($this->del_val['eff'][$pl['priem']['id']])) { - return; - } - if ($pl['x'] > 1) { - $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; - } - if ($pl['timeUse'] == 77) { - //завершаем прием - mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; - if (isset($u2['id'])) { - $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; - } - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - if ($t == 4) { - $mas1['id_hod']++; - $t = 2; - } - if ($t == 1) { - $mas1['id_hod']++; - if ($pl['priem']['file'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { - require('priems/' . $pl['priem']['file'] . '.php'); - } - } elseif ($pl['priem']['file3'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { - require('priems/' . $pl['priem']['file3'] . '.php'); - } - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; - $this->del_val['eff'][$pl['priem']['id']] = true; - } - } elseif ($t == 2) { - $mas1['text'] = '{tm1} У персонажа {u1} закончилось действие магии "' . $pl['name'] . '".'; - } elseif ($t == 99) { - $mas1['text'] = '{u1} Снял эфект "' . $pl['name'] . '" с помощью ' . $rznm . ' .'; - } else { - if ($t == 100) { - $mas1['id_hod']++; - } - $mas1['text'] = '{tm1} Закончилось действие эффекта "' . $pl['name'] . '" для {u1}.'; - } - if ($pl['priem']['id'] != 24) { - $this->add_log($mas1); - } - $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); - } - - //Расчет контрудара игроков - public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm) { $vLog = 'prm=' . $prm . '||time1=' . $tm . '||time2=' . $tm . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2']; @@ -4076,7 +3958,8 @@ class Battle $this->add_log($mas); } - //Добавляем статистику + //Расчет контрудара игроков + /** Осторожно! Подключаются файлы!!! * Трогать очень осторожно. Этот шайтан как-то проверяет приёмы на враге * и рассчитывает урон учитывая и эти приёмы тоже. @@ -4138,7 +4021,7 @@ class Battle $pr_momental_this = $u2; require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); $yron = $fx_moment($u2, $u1, $j, $yron, $profil); - unset(${'fx_moment'}); + unset($fx_moment); } } $j++; @@ -4156,7 +4039,7 @@ class Battle if (isset($fx_moment)) { $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog); } - unset(${'fx_moment'}); + unset($fx_moment); } } $j++; @@ -4174,7 +4057,7 @@ class Battle if (isset($fx_moment_seven)) { $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog); } - unset(${'fx_moment_seven'}); + unset($fx_moment_seven); } } if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 180) { @@ -4197,7 +4080,7 @@ class Battle if (isset($fx_moment)) { $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); } - unset(${'fx_moment'}); + unset($fx_moment); } } if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { @@ -4209,7 +4092,7 @@ class Battle if (isset($fx_moment)) { $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); } - unset(${'fx_moment'}); + unset($fx_moment); } } $j++; @@ -4224,6 +4107,8 @@ class Battle return $yron; } + //Добавляем статистику + public function priemYronSave($u1, $u2, $yron, $type) { //$type 0 - урон , 1 - хил @@ -4299,8 +4184,6 @@ class Battle ); } - //Добавляем статистику ударов - public function testUserInfoBattle($uid) { global $u; @@ -4327,7 +4210,7 @@ class Battle } } - //Добавляем размены в лог + //Добавляем статистику ударов /** * Расчет опыта @@ -4380,7 +4263,7 @@ class Battle return (int)round($addExp); } - //Добавляем в лог действия приема + //Добавляем размены в лог public function addNewStat($stat) { @@ -4430,7 +4313,8 @@ class Battle } } - //Считаем контру + //Добавляем в лог действия приема + public function lookLog(): string { global $u; @@ -4511,8 +4395,8 @@ class Battle return $js; } + //Считаем контру - //Расчитываем статы для конкретной зоны атаки public function lookmLog(): string { global $u; @@ -4598,7 +4482,9 @@ class Battle return $js; } - //Считаем урон + + //Расчитываем статы для конкретной зоны атаки + public function weaponAt22($item, $st): array { $min = 0; @@ -4612,8 +4498,7 @@ class Battle return [$min, $max]; } - - //Добавляем новую статистику игрока + //Считаем урон public function autoSmena() { @@ -4676,7 +4561,8 @@ class Battle } } - //Проверяем приемы + + //Добавляем новую статистику игрока public function smena($uid, $auto = false, $lastdie = false) { @@ -4714,7 +4600,7 @@ class Battle } } - //Приемы которые используются моментально + //Проверяем приемы public function testActions() { @@ -4816,8 +4702,7 @@ class Battle } } 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) { + 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->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] = rand( 1, 5 ) . '' . rand( @@ -4883,7 +4768,7 @@ class Battle } } - //Приемы которые используются моментально (в конце хода) + //Приемы которые используются моментально private function botAtack($uid, $pl, $tp) { @@ -4945,7 +4830,7 @@ class Battle } } - //Используем приемы + //Приемы которые используются моментально (в конце хода) public function startAtack($id) { @@ -4953,373 +4838,434 @@ class Battle $this->prlog = []; $this->inport_user = 0; - if (isset($this->atacks[$id]) && $this->atacks[$id]['lock'] == 0) { - //Прием разгадать тактику - $i = 1; - $j = 2; - while ($i <= 2) { - $untac = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 217 AND `uid` = "' . $this->atacks[$id]['uid' . $i] . '" AND `delete` = 0 LIMIT 1' - ) + if (!isset($this->atacks[$id]) || $this->atacks[$id]['lock'] != 0) { + return; + } + //Прием разгадать тактику + $i = 1; + $j = 2; + while ($i <= 2) { + $untac = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 217 AND `uid` = "' . $this->atacks[$id]['uid' . $i] . '" AND `delete` = 0 LIMIT 1' + ) + ); + $agrs = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 211 AND `uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `delete` = 0 LIMIT 1' + ) + ); + if (isset($untac['id']) && !isset($agrs['id'])) { + $pvr['sp'] = mysql_query( + 'SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" + and v2 not in (29, 30, 31, 32, 36, 49, 85, 86, 87, 88, 89, 90, 139, 174, 175, 176, 177, 178, 179, 187, 188, 191, 201, 206, 207, 208, 209, 210, 211, 217, 220, 222, 226, + 227, 228, 229, 233, 236, 238, 245, 248, 249, 256, 258, 261, 262, 263, 269, 270, 276, 277, 284, 285, 324, 332, 333, 334, 335) + AND `name` NOT LIKE "%Иммунитет%" + LIMIT 30' ); - $agrs = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 211 AND `uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `delete` = 0 LIMIT 1' - ) - ); - if (isset($untac['id']) && !isset($agrs['id'])) { - $pvr['sp'] = mysql_query( - 'SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" - and v2 not in (29, 30, 31, 32, 36, 49, 85, 86, 87, 88, 89, 90, 139, 174, 175, 176, 177, 178, 179, 187, 188, 191, 201, 206, 207, 208, 209, 210, 211, 217, 220, 222, 226, - 227, 228, 229, 233, 236, 238, 245, 248, 249, 256, 258, 261, 262, 263, 269, 270, 276, 277, 284, 285, 324, 332, 333, 334, 335) - AND `name` NOT LIKE "%Иммунитет%" - LIMIT 30' + while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { + $pvr['pl']['priem'] = mysql_fetch_array( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1') ); - while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { - $pvr['pl']['priem'] = mysql_fetch_array( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1') - ); - if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { - $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); - } + if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { + $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); } } - $j--; - $i++; } + $j--; + $i++; + } - //Восстановление манны 1% за ход - if ($this->atacks[$id]['out1'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor( - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana'] - ); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor( - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana'] - ); - } - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; - } - // - if ($this->atacks[$id]['out2'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor( - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana'] - ); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor( - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana'] - ); - } - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; - } - - //Антистаты - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round( - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] + //Восстановление манны 1% за ход + if ($this->atacks[$id]['out1'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor( + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana'] + ); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor( + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana'] ); } - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round( - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; + } + // + if ($this->atacks[$id]['out2'] == 0) { + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor( + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana'] + ); + } else { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor( + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana'] ); } + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; + } - //Расчет количества блоков и противников - $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + //Антистаты + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round( + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] + ); + } + if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round( + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] + ); + } - //Запускаем магию предметов - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + //Расчет количества блоков и противников + $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - // Получаем приемы игроков - $this->priemsRazmen($id, $at); - $this->priemsRazmenMoment($id, $at); - $this->priemsRazmen($id, $at); + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - $at = $this->newRazmen($id); + // Получаем приемы игроков + $this->priemsRazmen($id, $at); + $this->priemsRazmenMoment($id, $at); + $this->priemsRazmen($id, $at); - // Тестируем какие еще могут быть варианты при ударе - // Уворот, парирование, крит, пробить блок, блок щитом - // Блок щитом (если есть щит, конечно) + $at = $this->newRazmen($id); - $at = $this->mf2Razmen($at); //крит - $at = $this->mf3Razmen($id, $at, $v); //парирование - $at = $this->mf4Razmen($id, $at, $v); //блок щитом + // Тестируем какие еще могут быть варианты при ударе + // Уворот, парирование, крит, пробить блок, блок щитом + // Блок щитом (если есть щит, конечно) - $at = $this->mf1Razmen($id, $at, $v); //уворот - $at = $this->mf5Razmen($id, $at, $v); //контрудар + $at = $this->mf2Razmen($at); //крит + $at = $this->mf3Razmen($id, $at, $v); //парирование + $at = $this->mf4Razmen($id, $at, $v); //блок щитом - $at = $this->yronRazmen($id, $at); //расчет урона + $at = $this->mf1Razmen($id, $at, $v); //уворот + $at = $this->mf5Razmen($id, $at, $v); //контрудар - // Проверяем приемы - // Получаем приемы игроков - $at = $this->priemsTestRazmen($id, $at); - // Собираем размен (пересчитываем и расчитываем урон и т.д) - $at = $this->priemsRestartRazmen($id, $at); //Повторная проверка приемов (если требуется) + $at = $this->yronRazmen($id, $at); //расчет урона - //Минусуем поглощенный урон - if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); + // Проверяем приемы + // Получаем приемы игроков + $at = $this->priemsTestRazmen($id, $at); + // Собираем размен (пересчитываем и расчитываем урон и т.д) + $at = $this->priemsRestartRazmen($id, $at); //Повторная проверка приемов (если требуется) + + //Минусуем поглощенный урон + if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); + } + if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { + $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); + } + + // Обновляем НР и добавляем тактики + $at = $this->updateHealth($id, $at); + + // Заносим в логи + записываем статистику боя + $this->addlogRazmen($id, $at); + + //Запускаем магию предметов + $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); + $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); + + //Возращаем зоны блока + $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); + //обновляем задержки приемов + $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); + $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); + $prmos = []; + $i5 = 0; + + while ($i5 < 51) { + if (isset($zd1[$i5]) && $zd1[$i5] > 0) { + //Если приемы не требуют ход + $zd1[$i5] -= 1; + } else { + $zd1[$i5] = 0; } - if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); + if (isset($zd2[$i5]) && $zd2[$i5] > 0) { + //Если приемы не требуют ход + $zd2[$i5] -= 1; + } else { + $zd2[$i5] = 0; } + $i5++; + } + unset($prmos); - // Обновляем НР и добавляем тактики - $at = $this->updateHealth($id, $at); + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } - // Заносим в логи + записываем статистику боя - $this->addlogRazmen($id, $at); + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } - //Запускаем магию предметов - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - - //Возращаем зоны блока - $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - //обновляем задержки приемов - $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); - $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); - $prmos = []; - $i5 = 0; - - while ($i5 < 51) { - if (isset($zd1[$i5]) && $zd1[$i5] > 0) { - //Если приемы не требуют ход - $zd1[$i5] -= 1; - } else { - $zd1[$i5] = 0; - } - if (isset($zd2[$i5]) && $zd2[$i5] > 0) { - //Если приемы не требуют ход - $zd2[$i5] -= 1; - } else { - $zd2[$i5] = 0; - } - $i5++; + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); + if ($this->atacks[$id]['uid1'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd1); + } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { + $u->info['priems_z'] = implode('|', $zd2); + } + //Проверяем тактики + $i = 1; + while ($i <= 6) { + if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; } - unset($prmos); - - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; + } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { + $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; } + $i++; + } + //Обновляем задержки предметов + mysql_query( + 'UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100' + ); + mysql_query( + 'UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2' + ); - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } + //Обновляем задержки пирожков + mysql_query( + 'UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + ); + mysql_query( + 'UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + ); - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); - if ($this->atacks[$id]['uid1'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd1); - } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd2); - } - //Проверяем тактики - $i = 1; - while ($i <= 6) { - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; - } - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; - } - $i++; - } - //Обновляем задержки предметов - mysql_query( - 'UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100' - ); - mysql_query( - 'UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2' - ); + //Тактики + mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - //Обновляем задержки пирожков - mysql_query( - 'UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' - ); - mysql_query( - 'UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' - ); + //Обновляем задержки пирожков + mysql_query( + 'UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + ); + mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - //Тактики - mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + //Обновляем данные в battle_users + mysql_query( + 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" + WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + ); + //Восстановление манны 25% от мудрости за ход - //Обновляем задержки пирожков - mysql_query( - 'UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $this->save_stats( + $this->yhod_user( + $this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] + ) ); - mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - - //Обновляем данные в battle_users - mysql_query( - 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $this->save_stats( + $this->yhod_user( + $this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] + ) ); - mysql_query( - 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' - ); - //Восстановление манны 25% от мудрости за ход - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $this->save_stats( - $this->yhod_user( - $this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] - ) - ); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $this->save_stats( - $this->yhod_user( - $this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] - ) - ); - } - mysql_query( - 'UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' - ); - mysql_query( - 'UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' - ); - $this->priemsRazmenMomentEnd($id, $at); - //Минусуем заряд приема \ эффекта - $j = 1; - while ($j <= 2) { - $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; - $i = 0; - while ($i < count($eff)) { - if (isset($eff[$i])) { - if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { - $eff[$i]['hod']--; - $eff[$i]['priem'] = mysql_fetch_array( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') + } + mysql_query( + 'UPDATE `stats` SET + + `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '", + `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] . '", + `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] . '", + `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic2'] . '", + `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic3'] . '", + `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic4'] . '", + `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic5'] . '", + `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic6'] . '", + `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic7'] . '", + + `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] . '", + `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'] . '", + `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['last_hp'] . '", + `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_exp'] . '", + `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] . '" + + WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `stats` SET + + `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '", + `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] . '", + `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic1'] . '", + `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic2'] . '", + `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic3'] . '", + `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic4'] . '", + `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic5'] . '", + `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic6'] . '", + `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic7'] . '", + + `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] . '", + `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] . '", + `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['last_hp'] . '", + `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_exp'] . '", + `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] . '" + + WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + ); + $this->priemsRazmenMomentEnd($id, $at); + //Минусуем заряд приема \ эффекта + $j = 1; + while ($j <= 2) { + $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; + $i = 0; + while ($i < count($eff)) { + if (isset($eff[$i])) { + if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { + $eff[$i]['hod']--; + $eff[$i]['priem'] = mysql_fetch_array( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') + ); + if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana( + $eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) ); - if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { - //Отнимаем ману у того кто кастовал - $priem->minMana( - $eff[$i]['user_use'], - round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) - ); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - } + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; } - if (strripos($eff[$i]['data'], 'minprocmanahod')) { - $pvr = [ - 'x1' => 0, - 'x2' => 0, - 'i' => 0, - 'uid' => $eff[$i]['uid'], - 'color' => '', - 'color2' => '', - 'effx' => '', - 'x' => $eff[$i]['name'], - ]; - $pvr['d'] = explode('|', $eff[$i]['data']); - while ($pvr['i'] < count($pvr['d'])) { - if (isset($pvr['d'][$pvr['i']])) { - $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); - if ($pvr['d1'][0] == 'minprocmanahod') { - $pvr['d1'] = explode('x', $pvr['d1'][1]); - $pvr['x1'] = $pvr['d1'][0]; - $pvr['x2'] = $pvr['d1'][1]; - } + } + if (strripos($eff[$i]['data'], 'minprocmanahod')) { + $pvr = [ + 'x1' => 0, + 'x2' => 0, + 'i' => 0, + 'uid' => $eff[$i]['uid'], + 'color' => '', + 'color2' => '', + 'effx' => '', + 'x' => $eff[$i]['name'], + ]; + $pvr['d'] = explode('|', $eff[$i]['data']); + while ($pvr['i'] < count($pvr['d'])) { + if (isset($pvr['d'][$pvr['i']])) { + $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); + if ($pvr['d1'][0] == 'minprocmanahod') { + $pvr['d1'] = explode('x', $pvr['d1'][1]); + $pvr['x1'] = $pvr['d1'][0]; + $pvr['x2'] = $pvr['d1'][1]; } - $pvr['i']++; } - - $pvr['mp'] = round( - $this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand( - $pvr['x1'], - $pvr['x2'] - ) - ); - $pvr['mpSee'] = 0; - $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); - $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; - $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; - - if ($pvr['mpTr'] > 0) { - //Требуется хилл - if ($pvr['mpTr'] < $pvr['mp']) { - $pvr['mp'] = $pvr['mpTr']; - } - $pvr['mpSee'] = '+' . $pvr['mp']; - $pvr['mpNow'] += $pvr['mp']; - } - if ($pvr['mpNow'] > $pvr['mpAll']) { - $pvr['mpNow'] = $pvr['mpAll']; - } elseif ($pvr['mpNow'] < 0) { - $pvr['mpNow'] = 0; - } - if ($pvr['mpSee'] == 0) { - $pvr['mpSee'] = '--'; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - $btl->users[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - mysql_query( - 'UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] . '" WHERE `id` = "' . $pvr['uid'] . '" LIMIT 1' - ); - - $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex'], null); - $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' на ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (Мана)'; - $this->priemAddLog( - $id, 1, 2, $pvr['uid'], 0, - '' . $pvr['x'] . '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); + $pvr['i']++; } + $pvr['mp'] = round( + $this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand( + $pvr['x1'], + $pvr['x2'] + ) + ); + $pvr['mpSee'] = 0; + $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); + $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; + $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; + + if ($pvr['mpTr'] > 0) { + //Требуется хилл + if ($pvr['mpTr'] < $pvr['mp']) { + $pvr['mp'] = $pvr['mpTr']; + } + $pvr['mpSee'] = '+' . $pvr['mp']; + $pvr['mpNow'] += $pvr['mp']; + } + if ($pvr['mpNow'] > $pvr['mpAll']) { + $pvr['mpNow'] = $pvr['mpAll']; + } elseif ($pvr['mpNow'] < 0) { + $pvr['mpNow'] = 0; + } + if ($pvr['mpSee'] == 0) { + $pvr['mpSee'] = '--'; + } + + $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + $btl->users[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; + mysql_query( + 'UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] . '" WHERE `id` = "' . $pvr['uid'] . '" LIMIT 1' + ); + + $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex'], null); + $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' на ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (Мана)'; + $this->priemAddLog( + $id, 1, 2, $pvr['uid'], 0, + '' . $pvr['x'] . '', + $pvr['text2'], + ($this->hodID + 0) + ); + unset($pvr); + } + + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['hod'] > 0) { + $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; + mysql_query( + 'UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1' + ); + } else { + //удаляем прием + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem( + $eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], + 3, $this->atacks[$id]['uid' . $jn] + ); + } + } + } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { + $eff[$i]['priem'] = mysql_fetch_array( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') + ); + $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); + } else { + $eff[$i]['priem'] = mysql_fetch_array( + mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') + ); + if (isset($eff[$i]['priem']['minmana']) && round( + $eff[$i]['priem']['minmana'] * $eff[$i]['x'] + ) != 0) { + //Отнимаем ману у того кто кастовал + $priem->minMana( + $eff[$i]['user_use'], + round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) + ); + if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { + $eff[$i]['hod'] = 0; + if (isset($this->rehodeff[$eff[$i]['id']])) { + $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; + } + if ($eff[$i]['v2'] > 0) { + if ($j == 1) { + $jn = 2; + } else { + $jn = 1; + } + $this->delPriem( + $eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn] + ); + } + } + } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && Config::get('effz') > 0) { + $eff[$i]['hod']--; if (isset($this->rehodeff[$eff[$i]['id']])) { $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; } @@ -5337,135 +5283,159 @@ class Battle $jn = 1; } $this->delPriem( - $eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], - 3, $this->atacks[$id]['uid' . $jn] + $eff[$i], + $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, + $this->atacks[$id]['uid' . $jn] ); } } - } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { - $eff[$i]['priem'] = mysql_fetch_array( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') - ); - $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); - } else { - $eff[$i]['priem'] = mysql_fetch_array( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1') - ); - if (isset($eff[$i]['priem']['minmana']) && round( - $eff[$i]['priem']['minmana'] * $eff[$i]['x'] - ) != 0) { - //Отнимаем ману у того кто кастовал - $priem->minMana( - $eff[$i]['user_use'], - round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) - ); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem( - $eff[$i], - $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, - $this->atacks[$id]['uid' . $jn] - ); - } - } - } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && Config::get('effz') > 0) { - $eff[$i]['hod']--; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['hod'] > 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; - mysql_query( - 'UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1' - ); - } else { - //удаляем прием - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem( - $eff[$i], - $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, - $this->atacks[$id]['uid' . $jn] - ); - } - } - } } } - $i++; } - $j++; + $i++; } - //Проверяем - if (Config::get('propsk_die') > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - $cn1 = mysql_fetch_array( - mysql_query( - 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' - ) - ); - $cn2 = mysql_fetch_array( - mysql_query( - 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' - ) - ); - if ($cn1[0] > 3) { - $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; - $this->priemAddLog( - $id, 1, 2, $this->atacks[$id]['uid1'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query( - 'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' - ); - } - if ($cn2[0] > Config::get('propsk_die')) { - $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; - $this->priemAddLog( - $id, 1, 2, $this->atacks[$id]['uid2'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query( - 'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' - ); - } - } - // - //Обновляем текущего противника - if ($u->info['id'] == $this->atacks[$id]['uid1']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; - } - if ($u->info['id'] == $this->atacks[$id]['uid2']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } - //Удаляем размен из базы //ТУТ возможен лаг удаления - mysql_query( - 'DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR - ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )' - ); - unset($old_s1, $old_s2); - unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->atacks[$id]); - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1'); - + $j++; } + //Проверяем + if (Config::get('propsk_die') > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + $cn1 = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + ) + ); + $cn2 = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + ) + ); + if ($cn1[0] > 3) { + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog( + $id, 1, 2, $this->atacks[$id]['uid1'], 0, '', + $pvr['text2'], + ($this->hodID + 0) + ); + unset($pvr); + mysql_query( + 'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + ); + } + if ($cn2[0] > Config::get('propsk_die')) { + $pvr['text2'] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.'; + $this->priemAddLog( + $id, 1, 2, $this->atacks[$id]['uid2'], 0, '', + $pvr['text2'], + ($this->hodID + 0) + ); + unset($pvr); + mysql_query( + 'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + ); + } + } + // + //Обновляем текущего противника + if ($u->info['id'] == $this->atacks[$id]['uid1']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; + } + if ($u->info['id'] == $this->atacks[$id]['uid2']) { + $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; + } + //Удаляем размен из базы //ТУТ возможен лаг удаления + mysql_query( + 'DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR + ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )' + ); + unset($old_s1, $old_s2); + unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); + unset($this->atacks[$id]); + mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1'); + } + + //Используем приемы + + /** Осторожно! Подключаются файлы!!! + * @param $pl + * @param $u1 + * @param $t + * @param $u2 + * @param $rznm + * @param $k2nm + * @param $yrn + * @param $yrnt + * @return void + */ + public function delPriem( + $pl, + $u1, + $t = 1, + $u2 = false, + $rznm = 'Очиститься Кровью', + $k2nm = null, + $yrn = null, + $yrnt = null + ) + { + global $u, $priem; + if (!isset($pl['priem']['id']) || isset($this->del_val['eff'][$pl['priem']['id']])) { + return; + } + if ($pl['x'] > 1) { + $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; + } + if ($pl['timeUse'] == 77) { + //завершаем прием + mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; + if (isset($u2['id'])) { + $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; + } + $mas1 = [ + 'time' => time(), + 'battle' => $this->info['id'], + 'id_hod' => $this->hodID, + 'text' => '', + 'vars' => $vLog, + 'zona1' => '', + 'zonb1' => '', + 'zona2' => '', + 'zonb2' => '', + 'type' => '1', + ]; + if ($t == 4) { + $mas1['id_hod']++; + $t = 2; + } + if ($t == 1) { + $mas1['id_hod']++; + if ($pl['priem']['file'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { + require('priems/' . $pl['priem']['file'] . '.php'); + } + } elseif ($pl['priem']['file3'] != '0') { + if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { + require('priems/' . $pl['priem']['file3'] . '.php'); + } + } else { + $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '".'; + $this->del_val['eff'][$pl['priem']['id']] = true; + } + } elseif ($t == 2) { + $mas1['text'] = '{tm1} У персонажа {u1} закончилось действие магии "' . $pl['name'] . '".'; + } elseif ($t == 99) { + $mas1['text'] = '{u1} Снял эфект "' . $pl['name'] . '" с помощью ' . $rznm . ' .'; + } else { + if ($t == 100) { + $mas1['id_hod']++; + } + $mas1['text'] = '{tm1} Закончилось действие эффекта "' . $pl['name'] . '" для {u1}.'; + } + if ($pl['priem']['id'] != 24) { + $this->add_log($mas1); + } + $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); } //Повторная проверка приемов @@ -5631,13 +5601,13 @@ class Battle if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if (!isset($at['p']['p_cast'])) { $at['p'] = $at; @@ -5655,7 +5625,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); $this->stats[$this->uids[$u2]]['nopryh']--; } } @@ -5673,7 +5643,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -5691,7 +5661,7 @@ class Battle if (isset($fx_priem)) { $at = $fx_priem($id, $at, $u1, $j); } - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -5707,7 +5677,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -5723,7 +5693,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -5823,6 +5793,12 @@ class Battle return $r; } + /** Критический размен + * @param $at + * @param $pat + * @param $rjd + * @return array|false|mixed + */ private function mf2Razmen($at, $pat = false, $rjd = 0) { if ($pat) { @@ -5832,16 +5808,27 @@ class Battle unset($pat); } + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } //Расчет крита Атакующего (u1) по Цели (u2) @@ -5967,7 +5954,7 @@ class Battle return $r; } - private function mfs(int $type, array $mf): int + private function mfs(int $type, array|int $mf): int { $rval = 0; switch ($type) { @@ -6090,6 +6077,14 @@ class Battle //Сохранение данные + /** Парирование размен + * @param $id + * @param $at + * @param $v + * @param $pat + * @param $rjd + * @return array|false|mixed + */ private function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0) { if ($pat) { @@ -6099,18 +6094,29 @@ class Battle unset($pat); } + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } //Расчет парирования Цели (u2) от Атакующего (u1) @@ -6168,18 +6174,29 @@ class Battle unset($pat); } + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) { //Расчет блока щитом Цели (u2) от Атакующего (u1) @@ -6221,18 +6238,29 @@ class Battle unset($pat); } + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } //Расчет уворота Цели (u2) от Атакующего (u1) @@ -6306,18 +6334,29 @@ class Battle { $rjd = 0; + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } //Расчет контрудара Цели (u2) по Атакующему (u1) @@ -6427,12 +6466,12 @@ class Battle while ($i <= 2) { if ($i == 1) { $a = 1; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } $j = 0; @@ -6512,84 +6551,6 @@ class Battle } - //Расчет урона от оружия - - public function weaponTx($item) - { - $itm = Conversion::dataStringToArray($item['data']); - $t[0]['z'] = 0; - $t[0]['t'] = 0; - //колящий урон - $t[1]['z'] = round(0 + $itm['tya1']); - $t[1]['t'] = 1; - //рубящий урон - $t[2]['z'] = round(0 + $itm['tya2']); - $t[2]['t'] = 2; - //дробящий урон - $t[3]['z'] = round(0 + $itm['tya3']); - $t[3]['t'] = 3; - //режущий урон - $t[4]['z'] = round(0 + $itm['tya4']); - $t[4]['t'] = 4; - //урон огня - $t[5]['z'] = round(0 + $itm['tym1']); - $t[5]['t'] = 5; - //урон воздуха - $t[6]['z'] = round(0 + $itm['tym2']); - $t[6]['t'] = 6; - //урон воды - $t[7]['z'] = round(0 + $itm['tym3']); - $t[7]['t'] = 7; - //урон земли - $t[8]['z'] = round(0 + $itm['tym4']); - $t[8]['t'] = 8; - //урон света - $t[9]['z'] = round(0 + $itm['tym5']); - $t[9]['t'] = 9; - //урон тьмы - $t[10]['z'] = round(0 + $itm['tym6']); - $t[10]['t'] = 10; - //урон серой магией - $t[11]['z'] = round(0 + $itm['tym7']); - $t[11]['t'] = 11; - - $tpt = $t[0]['z']; - $tpmin = $t[0]; - $tpmax = $t[0]; - $i = 1; - $ii = 0; - - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmax = $t[$i]; - $ii = $i; - } - $i++; - } - $t[$ii]['z'] = 0; - - $tpt = $t[0]['z']; - $i = 1; - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmin = $t[$i]; - } - $i++; - } - - $setclass = rand(1, 100); - - if ($setclass > $tpmax['z']) { - $tp = $tpmin['t']; - } else { - $tp = $tpmax['t']; - } - - return $tp; - } - //Расчет урона от оружия public function yronGetrazmen($uid1, $uid2, $wp): array @@ -6767,6 +6728,84 @@ class Battle return $r; } + //Расчет урона от оружия + + public function weaponTx($item) + { + $itm = Conversion::dataStringToArray($item['data']); + $t[0]['z'] = 0; + $t[0]['t'] = 0; + //колящий урон + $t[1]['z'] = round(0 + $itm['tya1']); + $t[1]['t'] = 1; + //рубящий урон + $t[2]['z'] = round(0 + $itm['tya2']); + $t[2]['t'] = 2; + //дробящий урон + $t[3]['z'] = round(0 + $itm['tya3']); + $t[3]['t'] = 3; + //режущий урон + $t[4]['z'] = round(0 + $itm['tya4']); + $t[4]['t'] = 4; + //урон огня + $t[5]['z'] = round(0 + $itm['tym1']); + $t[5]['t'] = 5; + //урон воздуха + $t[6]['z'] = round(0 + $itm['tym2']); + $t[6]['t'] = 6; + //урон воды + $t[7]['z'] = round(0 + $itm['tym3']); + $t[7]['t'] = 7; + //урон земли + $t[8]['z'] = round(0 + $itm['tym4']); + $t[8]['t'] = 8; + //урон света + $t[9]['z'] = round(0 + $itm['tym5']); + $t[9]['t'] = 9; + //урон тьмы + $t[10]['z'] = round(0 + $itm['tym6']); + $t[10]['t'] = 10; + //урон серой магией + $t[11]['z'] = round(0 + $itm['tym7']); + $t[11]['t'] = 11; + + $tpt = $t[0]['z']; + $tpmin = $t[0]; + $tpmax = $t[0]; + $i = 1; + $ii = 0; + + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmax = $t[$i]; + $ii = $i; + } + $i++; + } + $t[$ii]['z'] = 0; + + $tpt = $t[0]['z']; + $i = 1; + while ($i <= 11) { + if ($t[$i]['z'] > $tpt) { + $tpt = $t[$i]['z']; + $tpmin = $t[$i]; + } + $i++; + } + + $setclass = rand(1, 100); + + if ($setclass > $tpmax['z']) { + $tp = $tpmin['t']; + } else { + $tp = $tpmax['t']; + } + + return $tp; + } + //Расчет защиты @@ -6781,7 +6820,8 @@ class Battle int $weapom_min = 0, int $weapom_max = 0, int $wp_type = 0, - ): array { + ): array + { $level = $st1['lvl']; $power_krit = round($st1['m3']); @@ -6991,13 +7031,13 @@ class Battle if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if (!isset($at['p']['p_cast'])) { @@ -7018,7 +7058,7 @@ class Battle $pr_used_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7035,7 +7075,7 @@ class Battle $pr_used_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); $this->stats[$this->uids[$u2]]['nopryh']--; } } @@ -7052,7 +7092,7 @@ class Battle $pr_used_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7070,7 +7110,7 @@ class Battle if (isset($fx_priem)) { $at = $fx_priem($id, $at, $u1, $j); } - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7088,7 +7128,7 @@ class Battle if (isset($fx_priem)) { $at = $fx_priem($id, $at, $u1, $j); } - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7106,7 +7146,7 @@ class Battle if (isset($fx_priem)) { $at = $fx_priem($id, $at, $u1, $j); } - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7119,13 +7159,13 @@ class Battle if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if (!isset($at['p']['p_cast'])) { @@ -7143,7 +7183,7 @@ class Battle $pr_used_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7159,7 +7199,7 @@ class Battle $pr_used_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7196,13 +7236,13 @@ class Battle if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if (!isset($at['p']['p_cast'])) { @@ -7221,7 +7261,7 @@ class Battle $pr_tested_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); $this->stats[$this->uids[$u2]]['nopryh']--; } } @@ -7238,7 +7278,7 @@ class Battle $pr_tested_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7253,7 +7293,7 @@ class Battle $pr_tested_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7268,7 +7308,7 @@ class Battle $pr_tested_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7283,7 +7323,7 @@ class Battle $pr_tested_this = $u1; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7298,7 +7338,7 @@ class Battle $pr_tested_this = $u2; require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7313,7 +7353,7 @@ class Battle $pr_tested_this = $u2; require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -7428,18 +7468,29 @@ class Battle private function updateHealth($id, $at): array { + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; + + if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { + $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); + } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { + $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); + } + $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } //Рассчет дополнительных тактик @@ -7711,16 +7762,16 @@ class Battle Db::sql( 'update stats set last_hp = ?, tactic6 = ?, battle_yron = ?, battle_exp = ? where id = ?', [ - $this->users[$this->uids[$id1]]['last_hp'], - $this->users[$this->uids[$id1]]['tactic6'], - $this->users[$this->uids[$id1]]['battle_yron'], - $this->users[$this->uids[$id1]]['battle_exp'], - (int)$id1, - ] + $this->users[$this->uids[$id1]]['last_hp'], + $this->users[$this->uids[$id1]]['tactic6'], + $this->users[$this->uids[$id1]]['battle_yron'], + $this->users[$this->uids[$id1]]['battle_exp'], + (int)$id1, + ] ); $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; - $this->clearСache($id1); + $this->clearCache($id1); $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; if ($id1 == $u->info['id']) { $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; @@ -7735,7 +7786,7 @@ class Battle } } - private function clearСache($uid): void + private function clearCache($uid): void { if ($uid > 0 && !isset($this->uclearc[$uid])) { $this->uclearc[$uid] = true; @@ -7788,19 +7839,21 @@ class Battle ], ]; + $uid1 = $this->atacks[$id]['uid1']; + $uid2 = $this->atacks[$id]['uid2']; $i = 1; while ($i <= 2) { if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if ($this->stats[$this->uids[$u1]]['yhod'] <= 0 && $this->stats[$this->uids[$u2]]['yhod'] > 0) { @@ -7847,8 +7900,7 @@ class Battle $mas['text'] .= '{u1} пропустил свой ход.'; //Проверка сброс туманок mysql_query( - 'UPDATE `eff_users` SET `delete` = "' . time( - ) . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1' + 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1' ); } } @@ -8356,13 +8408,13 @@ class Battle if ($i == 1) { $a = 1; $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; + $u1 = $uid1; + $u2 = $uid2; } else { $a = 2; $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; + $u1 = $uid2; + $u2 = $uid1; } if (!isset($at['p']['p_cast'])) { $at['p'] = $at; @@ -8380,7 +8432,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); $this->stats[$this->uids[$u2]]['nopryh']--; } } @@ -8398,7 +8450,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -8415,7 +8467,7 @@ class Battle require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); if (isset($fx_priem)) { $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } } @@ -8426,13 +8478,13 @@ class Battle while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) { if (file_exists( - '../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php' - )) { + '../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php' + )) { $pr_used_this = $u1; $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -8448,7 +8500,7 @@ class Battle $pr_moment = true; require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); + unset($fx_priem); } } $j++; @@ -8463,59 +8515,60 @@ class Battle private function addNewAtack() { global $u; - if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) { + if (isset($this->ga[$u->info['id']][$u->info['enemy']])) { + return; + } + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] <= 0) { + $this->e = 'Для вас поединок закончен, ожидайте пока завершат другие...'; + return; + } + $us = $this->stats[$this->uids[$u->info['id']]]; + $i = 1; + $no = 0; - $us = $this->stats[$this->uids[$u->info['id']]]; - $i = 1; - $no = 0; - - while ($i <= $us['zona']) { - if ($this->uAtc['a'][$i] == 0) { - $no = 1; - } - $i++; - } - - if ($this->uAtc['b'] == 0) { - $no = 1; - } - - if ($no == 0) { - //наносим удар - if ($u->info['enemy'] > 0) { - if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { - //наносим новый удар - $a = $this->uAtc['a'][1] . $this->uAtc['a'][2] . $this->uAtc['a'][3] . $this->uAtc['a'][4] . $this->uAtc['a'][5]; - $b = $this->uAtc['b']; - mysql_query( - 'DELETE FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((`uid2` = "' . $u->info['id'] . '" AND `uid1` = "' . $u->info['enemy'] . '") OR (`uid1` = "' . $u->info['id'] . '" AND `uid2` = "' . $u->info['enemy'] . '")) LIMIT 2' - ); - $d = mysql_query( - 'INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time( - ) . '","' . $u->info['id'] . '","' . $u->info['enemy'] . '","' . $a . '","' . $b . '")' - ); - if (!$d) { - $this->e = 'Не удалось нанести удар по противнику...'; - } else { - $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); - } - } + while ($i <= $us['zona']) { + if ($this->uAtc['a'][$i] == 0) { + $no = 1; + } + $i++; + } + if ($this->uAtc['b'] == 0) { + $no = 1; + } + if ($no != 0) { + $this->e = 'Выберите зоны удара и блока'; + } else { + //наносим удар + if ($u->info['enemy'] > 0) { + if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { + if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { + //наносим новый удар + $a = $this->uAtc['a'][1] . $this->uAtc['a'][2] . $this->uAtc['a'][3] . $this->uAtc['a'][4] . $this->uAtc['a'][5]; + $b = $this->uAtc['b']; + mysql_query( + 'DELETE FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((`uid2` = "' . $u->info['id'] . '" AND `uid1` = "' . $u->info['enemy'] . '") OR (`uid1` = "' . $u->info['id'] . '" AND `uid2` = "' . $u->info['enemy'] . '")) LIMIT 2' + ); + $d = mysql_query( + 'INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $u->info['id'] . '","' . $u->info['enemy'] . '","' . $a . '","' . $b . '")' + ); + if (!$d) { + $this->e = 'Не удалось нанести удар по противнику...'; } else { - //отвечаем на удар противника - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1 && isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) { - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; - $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); - } + $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); } } } else { - $this->e = 'Выберите зоны удара и блока'; + //отвечаем на удар противника + if ( + $this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && + $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1 + && isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']) + ) { + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . $this->uAtc['a'][3] . $this->uAtc['a'][4] . $this->uAtc['a'][5]; + $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; + $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); + } } - } else { - $this->e = 'Для вас поединок закончен, ожидайте пока завершат другие...'; } } } @@ -8541,22 +8594,17 @@ class Battle public function battleInfo($id) { - $b = mysql_fetch_array( - mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1') - ); - if (isset($b['id'])) { - $this->hodID = mysql_fetch_array( - mysql_query( - 'SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $b['id'] . '" ORDER BY `id` DESC LIMIT 1' - ) - ); - $this->hodID = $this->hodID['id_hod'] ?? 0; - return $b; - } else { + $b = Db::getRow('select * from battle where id = ?', [$id]); + if (!isset($b['id'])) { return false; } + + $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() @@ -8804,6 +8852,7 @@ class Battle ); if (!isset($mybu['id'])) { //Пустое значение статистики для данного персонажа за текущий бой + $this->addstatuser($pl['id']); } $i++; @@ -8870,29 +8919,29 @@ class Battle } } - private function addstatuser($id) + private function addstatuser($uid): void { - if ($id > 0) { - $uid = $id; - $id = $this->uids[$uid]; - mysql_query( - 'INSERT INTO `battle_users` - ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` ) - VALUES - ( - "' . $this->info['id'] . '", - "' . $uid . '", - "' . time() . '","' . $this->users[$id]['login'] . '", - "' . $this->users[$id]['level'] . '", - "' . $this->users[$id]['align'] . '", - "' . $this->users[$id]['clan'] . '", - "' . $this->stats[$id]['hpAll'] . '", - "' . $this->stats[$id]['hp'] . '", - "' . $this->stats[$id]['hpNow'] . '", - "' . $this->users[$id]['team'] . '" - )' - ); + if ($uid <= 0) { + return; } + + $id = $this->uids[$uid]; + + if (empty($this->stats[$id]['hp'])) { + $this->stats[$id]['hp'] = $this->stats[$id]['hpNow']; + } + Db::sql('insert into battle_users (battle,uid,time_enter,login,level,align,clan,hpAll,hp,hpStart,team) values (?,?,unix_timestamp(),?,?,?,?,?,?,?,?)', + [ + $this->info['id'], + $uid, + $this->users[$id]['login'], + $this->users[$id]['align'], + $this->users[$id]['clan'], + $this->stats[$id]['hpAll'], + $this->stats[$id]['hp'], + $this->stats[$id]['hpNow'], + $this->users[$id]['team'], + ]); } public function testZonbVis() diff --git a/_incl_data/class/Clan/ClanInfo.php b/_incl_data/class/Clan/ClanInfo.php index dac2d717..04a62792 100644 --- a/_incl_data/class/Clan/ClanInfo.php +++ b/_incl_data/class/Clan/ClanInfo.php @@ -13,6 +13,12 @@ class ClanInfo public static function getNameById(int $id): string { - Db::getValue('select name from clan where id = ?', [$id]); + $clan = self::getById($id); + return !empty($clan['name']) ? $clan['name'] : ''; + } + + public static function getById(int $id): array + { + return Db::getRow('select * from clan where id = ? and status = 1', [$id]) ?: []; } } diff --git a/_incl_data/class/ComissionShop.php b/_incl_data/class/ComissionShop.php index ddf6a3da..6812b489 100644 --- a/_incl_data/class/ComissionShop.php +++ b/_incl_data/class/ComissionShop.php @@ -1,77 +1,36 @@ 19, + 3 => 20, + 4 => 21, + 5 => 22, + 6 => 15, + 7 => 12, + 8 => 4, + 9 => 5, + 10 => 6, + 11 => 1, + 12 => 3, + 13 => 8, + 14 => 14, + 15 => 13, + 16 => 9, + 17 => 10, + 18 => 11, + 19 => 29, + 20 => 30, + 1050 => 1050, + default => 18, + }; if ($typeOtdel != 1050) { if ($preview == "full") { $cl = mysql_query( @@ -572,4 +531,96 @@ ORDER BY `1price`ASC , inGroupCount DESC' echo 'Прилавок магазина пуст'; } } + + public function buyItem(int $iid, User $u): string + { + $irow = Db::getRow('select items_users.id, uid, 1price, inGroup, inShop, data, item_id, login, items_main.name, price1 + from items_users + left join users on users.id = uid + left join items_main on items_main.id = item_id + where items_users.id = ? and inShop = 30', [$iid]); + + $price = $irow['1price']; + if (!isset($irow['id']) || !isset($iid) || $irow['inShop'] != 30) { + $r = 'Предмет не найден на прилавке'; + } else { + if ($price > $u->info['money']) { + $r = 'У вас недостаточно денег (не хватает ' . ($price - $u->info['money']) . ' кр.)'; + } else { + $u->addKr(-$price); + $u->addKr($price, $irow['uid']); + + $col = $u->itemsX($iid); + if ($col > 1) { + Db::sql('update items_users set uid = ?, inGroup = inGroup + 1000, 1price = ?, lastUPD = unix_timestamp(), inShop = 0 + where inShop = 30 and inOdet = 0 and item_id = ? and uid = ? and inGroup = ? limit ?', + [$u->info['id'], $irow['price1'], $irow['item_id'], $irow['uid'], $irow['inGroup'], $col]); + $irow['name'] .= "(x$col)"; + } else { + Db::sql('update items_users set uid = ?, 1price = ?, lastUPD = unix_timestamp(), inShop = 0 + where id = ? and uid = ? and inOdet = 0', + [$iid, $irow['uid']]); + } + + Delo::add(1, 'comShop', $u->info['id'], "Купил предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.", $price); + Delo::add(1, 'comShop', $irow['uid'], "Продал предмет «{$irow['name']}» игроку {$irow['login']} за $price кр."); + + $r = "Вы купили предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.
Предмет успешно добавлен в инвентарь."; + } + } + return '
' . $r . '
'; + } + + public function rent($action, int $iid, int $price, User $u) + { + if ($action == "Сдать в магазин" && $price > 0) { + $ChImtem = mysql_fetch_array( + mysql_query( + 'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1' + ) + ); + $ChSudba = Conversion::dataStringToArray($ChImtem['data']); + if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) { + if (isset($ChImtem['inGroup']) && $ChImtem['inGroup'] > 0) { + $col = $u->itemsX($ChImtem['id']); + if ($col > 1) { + mysql_query( + 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . '' + ); + } else { + mysql_query( + 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' + ); + } + } else { + mysql_query( + 'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' + ); + } + } + } elseif ($action == "Забрать") { + $i = mysql_fetch_array( + mysql_query( + 'SELECT `im`.`price1`, +`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1' + ) + ); + if (isset($i['inGroup']) and $i['inGroup'] > 0) { + $col = $u->itemsX($i['id']); + if ($col > 1) { + mysql_query( + 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . '' + ); + } else { + mysql_query( + 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' + ); + } + } else { + mysql_query( + 'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1' + ); + } + } + } } \ No newline at end of file diff --git a/_incl_data/class/Delo.php b/_incl_data/class/Delo.php index 27e6fa93..4bf816f8 100644 --- a/_incl_data/class/Delo.php +++ b/_incl_data/class/Delo.php @@ -7,20 +7,39 @@ class Delo { /** * Запись в личное дело персонажа. - * @param int $uid - * @param string $dop - * @param string $text - * @param string $from - * @param float $moneyOut - * @param int $type + * @param int $uid кому пишется + * @param string $text текст + * @param string $from отправитель записи + * @param float $moneyOut количество денег снятых с игрока + * @param int $type цифровой тип лога (??) * @return void */ - public static function add(int $type, string $from, int $uid, string $text, float $moneyOut = 0, string $dop = '') + public static function add(int $type, string $from, int $uid, string $text, float $moneyOut = 0): void { - $sql = 'insert into users_delo (uid, dop, time, city, text, login, `delete`, no_right, ip, moneyOut, type) values (?,?,unix_timestamp(),?,?,?,0,?,?,?,?)'; + $sql = 'insert into users_delo (uid, time, text, login, `delete`, no_right, ip, moneyOut, type) values (?,unix_timestamp(),?,?,0,?,?,?,?)'; Db::sql($sql, [ - $uid, $dop, 'capitalcity', $text, $from, '', UserIp::get(), $moneyOut, $type, + $uid, $text, $from, '', UserIp::get(), $moneyOut, $type, ]); } + + public static function printPublicModerationStatus(int $userid): void + { + $status = Db::getValue('select text from users_delo where uid = ? and hb != 0 order by id desc limit 1', [$userid]); + if (!$status) { + return; + } + + echo << + Сообщение от модераторов:
+ $status + + HTML; + } + + public static function getAllByUserId(int $userid): array + { + return Db::getRows('select time, text from users_delo where uid = ? and type = 0 order by id desc', [$userid]); + } } diff --git a/_incl_data/class/Filter.php b/_incl_data/class/Filter.php index 91ac857d..6af9337e 100644 --- a/_incl_data/class/Filter.php +++ b/_incl_data/class/Filter.php @@ -32,7 +32,7 @@ class Filter if ($add > 0) { $on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid` = "' . $uid . '" LIMIT 1')); - if (isset($on['id'])) { + if (isset($on['uid'])) { $mt = 0; $lst = time(); if (date('d', $on['lastUp']) != date('d', $lst)) { @@ -42,7 +42,7 @@ class Filter } $add = $on['time_all'] + $add; mysql_query( - 'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `id` = "' . $on['id'] . '" LIMIT 1' + 'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `uid` = "' . $on['uid'] . '" LIMIT 1' ); } } diff --git a/_incl_data/class/Helper/Conversion.php b/_incl_data/class/Helper/Conversion.php index 110b22d2..709e91e5 100644 --- a/_incl_data/class/Helper/Conversion.php +++ b/_incl_data/class/Helper/Conversion.php @@ -1,6 +1,9 @@ 1, b=>2, c=>3]. @@ -9,6 +12,8 @@ class Conversion */ public static function dataStringToArray(string $dataString): array { + $dataString = str_replace('||', '|', $dataString); // любители забивать руками параметры и задваивать разделители. + if (mb_substr($dataString, -1) === '|') { $dataString = rtrim($dataString, '|'); } @@ -31,10 +36,10 @@ class Conversion * @param int|string $seconds * @return string */ - public static function secondsToTimeout($seconds): string + public static function secondsToTimeout(int|string $seconds): string { $seconds = (int)$seconds; - $time = new \DateTime(); + $time = new DateTime(); $time->setTimestamp($seconds); $sec = intval($time->format('s')); $min = intval($time->format('i')); diff --git a/_incl_data/class/Inf/Awards.php b/_incl_data/class/Inf/Awards.php new file mode 100644 index 00000000..f375520e --- /dev/null +++ b/_incl_data/class/Inf/Awards.php @@ -0,0 +1,145 @@ + 'Рыцарь первого круга', + 2 => 'Рыцарь второго круга', + 3 => 'Рыцарь третьего круга', + ]; + private const SCHOLAR = [ + 1 => 'Посвящённый первого круга', + 2 => 'Посвящённый второго круга', + 3 => 'Посвящённый третьего круга', + ]; + private const IZLOM = [ + 1 => 'Аттестованный боец', + 2 => 'Опытный боец', + 3 => 'Ветеран', + 4 => 'Генерал', + ]; + private const DUNGEON_NAME = [ + 'repdreamscity' => 'Водосток', + 'repizlom' => 'Излом Хаоса', + 'rep1' => 'Храм Знаний', + ]; + private array $awards = []; + + public function __construct(int $userid) + { + $reputations = Db::getRow('select * from rep where id = ?', [$userid]) ?: []; + $customAwards = Db::getRows('select text, img from users_ico where uid = ? and (endTime = 0 or endTime > unix_timestamp())', [$userid]); + + foreach ($customAwards as $award) { + $this->awards[] = ['', $award['text'], $award['img']]; + } + + if (!empty($reputations)) { + $this->addDungeonAwards($reputations); + } + } + + private function addDungeonAwards(mixed $reputations): void + { + match (true) { + $reputations['repdreamscity'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[3], 'i/ico/ric_kanal3.gif'], + $reputations['repdreamscity'] > 4999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[2], 'i/ico/ric_kanal2.gif'], + $reputations['repdreamscity'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[1], 'i/ico/ric_kanal1.gif'], + default => '', + }; + + match (true) { + $reputations['rep1'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[3], 'znrune_3.gif'], + $reputations['rep1'] > 999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[2], 'znrune_2.gif'], + $reputations['rep1'] > 99 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[1], 'znrune_1.gif'], + default => '', + }; + + match (true) { + $reputations['repizlom'] > 24999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[4], 'iz_zn_ver10_4.gif'], + $reputations['repizlom'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[3], 'iz_zn_ver10_3.gif'], + $reputations['repizlom'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[2], 'iz_zn_ver10_2.gif'], + $reputations['repizlom'] > 99 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[1], 'iz_zn_ver10_1.gif'], + default => '', + }; + + match (true) { + $reputations['repcapitalcity'] > 24999 => $this->awards[] = ['Capital city', self::KNIGHT[2], 'zn1_2.gif'], + $reputations['repcapitalcity'] > 9999 => $this->awards[] = ['Capital city', self::KNIGHT[1], 'zn1_1.gif'], + default => '', + }; + + match (true) { + $reputations['repangelscity'] > 24999 => $this->awards[] = ['Angels city', self::KNIGHT[2], 'zn2_2.gif'], + $reputations['repangelscity'] > 9999 => $this->awards[] = ['Angels city', self::KNIGHT[1], 'zn2_1.gif'], + default => '', + }; + + match (true) { + $reputations['repdemonscity'] > 24999 => $this->awards[] = ['Demons city', self::KNIGHT[2], 'zn3_2.gif'], + $reputations['repdemonscity'] > 9999 => $this->awards[] = ['Demons city', self::KNIGHT[1], 'zn3_1.gif'], + default => '', + }; + + match (true) { + $reputations['repdevilscity'] > 24999 => $this->awards[] = ['Devils city', self::KNIGHT[2], 'zn4_2.gif'], + $reputations['repdevilscity'] > 9999 => $this->awards[] = ['Devils city', self::KNIGHT[1], 'zn4_1.gif'], + default => '', + }; + + match (true) { + $reputations['repsuncity'] > 24999 => $this->awards[] = ['Sun city', self::KNIGHT[2], 'zn5_2.gif'], + $reputations['repsuncity'] > 9999 => $this->awards[] = ['Sun city', self::KNIGHT[1], 'zn5_1.gif'], + default => '', + }; + + match (true) { + $reputations['repsandcity'] > 24999 => $this->awards[] = ['Sand city', self::KNIGHT[2], 'zn7_2.gif'], + $reputations['repsandcity'] > 9999 => $this->awards[] = ['Sand city', self::KNIGHT[1], 'zn7_1.gif'], + default => '', + }; + + match (true) { + $reputations['repemeraldscity'] > 24999 => $this->awards[] = ['Emeralds city', self::KNIGHT[2], 'zn6_2.gif'], + $reputations['repemeraldscity'] > 9999 => $this->awards[] = ['Emeralds city', self::KNIGHT[1], 'zn6_1.gif'], + default => '', + }; + + match (true) { + $reputations['repmooncity'] > 24999 => $this->awards[] = ['Moon city', self::KNIGHT[2], 'zn9_2.gif'], + $reputations['repmooncity'] > 9999 => $this->awards[] = ['Moon city', self::KNIGHT[1], 'zn9_1.gif'], + default => '', + }; + + match (true) { + $reputations['repabandonedplain'] > 9999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[2], '1_gora.gif'], + $reputations['repabandonedplain'] > 999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[1], '2_gora.gif'], + default => '', + }; + } + + public function addCustom(string $name, string $description, string $image): void + { + $this->awards[] = [$name, $description, $image]; + } + + public function print(): void + { + foreach ($this->awards as $award) { + $img = Config::img() . DIRECTORY_SEPARATOR . $award[2]; + if (!empty($award[0])) { + $award[1] = "$award[0]
$award[1]"; + } + echo << + HTML; + } + } + + +} diff --git a/_incl_data/class/Inf/LastNames.php b/_incl_data/class/Inf/LastNames.php new file mode 100644 index 00000000..18dc7e3e --- /dev/null +++ b/_incl_data/class/Inf/LastNames.php @@ -0,0 +1,38 @@ +setTimestamp($name['time']); + $this->lastnames[] = "«{$name['login']}» до " . $dt->format('d.m.Y H:i'); + } + } + + public function print(): void + { + echo $this->get(); + } + + private function get(): string + { + if (empty($this->lastnames)) { + return ''; + } + return 'История имен:
' . implode('
', $this->lastnames); + } +} diff --git a/_incl_data/class/Inf/Status.php b/_incl_data/class/Inf/Status.php new file mode 100644 index 00000000..ec18f2a3 --- /dev/null +++ b/_incl_data/class/Inf/Status.php @@ -0,0 +1,38 @@ +$text"; + + if (!empty($img)) { + $text = '' . $text . ' ' . $text; + } + + $this->statuses[] = "
$text
"; // обёртка для центрирования картинки с текстом + } + + public function print(): void + { + if (empty($this->statuses)) { + return; + } + + echo '
' . implode('
', $this->statuses) . '
'; + } +} \ No newline at end of file diff --git a/_incl_data/class/Inf/Twinks.php b/_incl_data/class/Inf/Twinks.php new file mode 100644 index 00000000..bb350409 --- /dev/null +++ b/_incl_data/class/Inf/Twinks.php @@ -0,0 +1,39 @@ +' . $str . ''; + } + $this->twinks[] = $str; + } + } + + public function print(): void + { + echo $this->get(); + } + + private function get(): string + { + if (empty($this->twinks)) { + return ''; + } + return 'Другие образы: ' . implode(', ', $this->twinks) . '
'; + } +} diff --git a/_incl_data/class/Inf/Zodiac.php b/_incl_data/class/Inf/Zodiac.php new file mode 100644 index 00000000..2f512366 --- /dev/null +++ b/_incl_data/class/Inf/Zodiac.php @@ -0,0 +1,68 @@ + 'Овен', + 2 => 'Телец', + 3 => 'Близнецы', + 4 => 'Рак', + 5 => 'Лев', + 6 => 'Дева', + 7 => 'Весы', + 8 => 'Скорпион', + 9 => 'Стрелец', + 10 => 'Козерог', + 11 => 'Водолей', + 12 => 'Рыбы', + ]; + private int $day = 0; + private int $month = 0; + + public function __construct(string $date) + { + [$d, $m, $y] = explode('.', $date); + if (!checkdate($d, $m, $y)) { + return; + } + $this->day = (int)$d; + $this->month = (int)$m; + } + + public function getImageLink(): string + { + if (empty($this->getName())) { + return '#'; + } + $id = array_flip(self::ZODIAC); + return Config::img() . '/i/zodiac/' . $id[$this->getName()] . '.gif'; + } + + public function getName(): string + { + if (empty($this->day) || empty($this->month)) { + return ''; + } + $z = [ + 1 => self::ZODIAC[10], + self::ZODIAC[11], + self::ZODIAC[12], + self::ZODIAC[1], + self::ZODIAC[2], + self::ZODIAC[3], + self::ZODIAC[4], + self::ZODIAC[5], + self::ZODIAC[6], + self::ZODIAC[7], + self::ZODIAC[8], + self::ZODIAC[9], + self::ZODIAC[10], + ]; + $lastDay = [1 => 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19]; + return $this->day > $lastDay[$this->month] ? $z[$this->month + 1] : $z[$this->month]; + } +} diff --git a/_incl_data/class/Item.php b/_incl_data/class/Item.php index b9c79b8c..33d00ab5 100644 --- a/_incl_data/class/Item.php +++ b/_incl_data/class/Item.php @@ -1,10 +1,11 @@ 'Пол', 'align' => 'Склонность', 'lvl' => 'Уровень', @@ -77,7 +78,17 @@ class Item 'm15' => 'Мф. абс. увертывания (%)', 'm18' => 'Мф. абс. блока щитом (%)', - // deprecated + 'mib1' => 'Броня головы минимум', + 'mab1' => 'Броня головы максимум', + 'mib2' => 'Броня груди и живота минимум', + 'mab2' => 'Броня груди и живота максимум', + 'mib3' => 'Броня пояса минимум', + 'mab3' => 'Броня пояса максимум', + 'mib4' => 'Броня ног минимум', + 'mab4' => 'Броня ног максимум', + ]; + + public static array $parameterNameDeprecated = [ 'acestar' => 'Следующий каст будет критическим', 'more_awards' => 'Повышеная награда %', 'align_bs' => 'Служитель закона', @@ -175,17 +186,37 @@ class Item 'silvers' => 'Silver Premium Account', ]; + public static function test(string $data) + { + $t = self::parseDataString($data); + $r = []; + $b = []; + foreach ($t['tr'] as $k => $v) { + if (isset(self::$parameterName[explode('_', $k)[1]])) { + $k = "($k) " . self::$parameterName[explode('_', $k)[1]]; + } + $r[$k] = $v; + } + foreach ($t['add'] as $k2 => $v2) { + if (isset(self::$parameterName[explode('_', $k2)[1]])) { + $k2 = "($k2) " . self::$parameterName[explode('_', $k2)[1]]; + } + $b[$k2] = $v2; + } + return ['tr' => $r, 'add' => $b,]; + } + public static function parseDataString(string $data) { - $a = ConversionHelper::dataStringToArray($data); + $a = Conversion::dataStringToArray($data); $sex = ['Мужской', 'Женский']; $requirements = []; $bonuses = []; foreach ($a as $k => $v) { - if (strpos($k, 'tr_')) { + if (str_starts_with($k, 'tr_')) { $requirements[$k] = $v; } - if (strpos($k, 'add_')) { + if (str_starts_with($k, 'add_')) { $bonuses[$k] = $v; } if (isset($requirements['tr_sex'])) { diff --git a/_incl_data/class/Item/Data/Bonuses.php b/_incl_data/class/Item/Data/Bonuses.php index 42891ed2..758cc573 100644 --- a/_incl_data/class/Item/Data/Bonuses.php +++ b/_incl_data/class/Item/Data/Bonuses.php @@ -4,7 +4,7 @@ namespace Item\Data; class Bonuses { - private static array $names = [ + public static array $names = [ 'hpAll' => 'Уровень жизни (HP)', 'mpAll' => 'Уровень маны', 's1' => 'Сила', @@ -110,7 +110,7 @@ class Bonuses return $this->result; } - public function addZonb() + public function addZonb(): void { if (isset($this->result[self::$names['zonb']])) { $this->result[self::$names['zonb']]++; diff --git a/_incl_data/class/Item/Data/Properties.php b/_incl_data/class/Item/Data/Properties.php index 2fe882f7..59814002 100644 --- a/_incl_data/class/Item/Data/Properties.php +++ b/_incl_data/class/Item/Data/Properties.php @@ -4,7 +4,7 @@ namespace Item\Data; class Properties { - private static array $names = [ + public static array $names = [ 'damage' => 'Урон', ]; private array $result = []; diff --git a/_incl_data/class/Item/Data/Requirements.php b/_incl_data/class/Item/Data/Requirements.php index 6bf123be..1fad1c89 100644 --- a/_incl_data/class/Item/Data/Requirements.php +++ b/_incl_data/class/Item/Data/Requirements.php @@ -4,7 +4,7 @@ namespace Item\Data; class Requirements { - private static array $names = [ + public static array $names = [ 'sex' => 'Пол', 'lvl' => 'Уровень', 's1' => 'Сила', diff --git a/_incl_data/class/Magic/addmoney.php b/_incl_data/class/Magic/addmoney.php index 4f410755..7af5a3f4 100644 --- a/_incl_data/class/Magic/addmoney.php +++ b/_incl_data/class/Magic/addmoney.php @@ -1,54 +1,33 @@ info['align'] != 2 ) { - if( $itm['4price'] > 0 ) { - $u->info['money4'] += $itm['4price']; - mysql_query('UPDATE `users` SET `money4` = `money4` + "'.$itm['4price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif( $itm['2price'] > 0 ) { - $u->info['money2'] += $itm['2price']; - mysql_query('UPDATE `users` SET `money2` = `money2` + "'.$itm['2price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif( $itm['1price'] > 0 ) { - $u->info['money'] += $itm['1price']; - mysql_query('UPDATE `users` SET `money` = `money` + "'.$itm['1price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif( $itm['price4'] > 0 ) { - $u->info['money4'] += $itm['price4']; - mysql_query('UPDATE `users` SET `money4` = `money4` + "'.$itm['price4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif( $itm['price2'] > 0 ) { - $u->info['money2'] += $itm['price2']; - mysql_query('UPDATE `users` SET `money2` = `money2` + "'.$itm['price2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - }elseif( $itm['price1'] > 0 ) { - $u->info['money'] += $itm['price1']; - mysql_query('UPDATE `users` SET `money` = `money` + "'.$itm['price1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - // - if( $itm['4price'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$u->zuby($itm['4price'],1).''; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }elseif( $itm['2price'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$itm['2price'].' екр.'; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }elseif( $itm['1price'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$itm['1price'].' кр.'; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }elseif( $itm['price4'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$u->zuby($itm['price4'],1).''; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }elseif( $itm['price2'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$itm['price2'].' екр.'; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }elseif( $itm['price1'] > 0 ) { - $u->error = 'Вы успешно обналичили чек на '.$itm['price1'].' кр.'; - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - }else{ - $u->error = 'Баговый чек! Напишите Администрации!'; - } - }else{ - $u->error = 'Хаосники не могут обналичивать чек!'; - } +if ($itm['magic_inci'] != 'addmoney') { + return; +} +if ($itm['2price'] > 0) { + $u->addEkr($itm['2price']); +} elseif ($itm['1price'] > 0) { + $u->addKr($itm['1price']); +} elseif ($itm['price2'] > 0) { + $u->addEkr($itm['price2']); +} elseif ($itm['price1'] > 0) { + $u->addKr($itm['price1']); +} +// +if ($itm['2price'] > 0) { + $u->error = 'Вы успешно обналичили чек на ' . $itm['2price'] . ' екр.'; + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); +} elseif ($itm['1price'] > 0) { + $u->error = 'Вы успешно обналичили чек на ' . $itm['1price'] . ' кр.'; + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); +} elseif ($itm['price2'] > 0) { + $u->error = 'Вы успешно обналичили чек на ' . $itm['price2'] . ' екр.'; + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); +} elseif ($itm['price1'] > 0) { + $u->error = 'Вы успешно обналичили чек на ' . $itm['price1'] . ' кр.'; + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); +} else { + $u->error = 'Баговый чек! Напишите Администрации!'; } -?> \ No newline at end of file diff --git a/_incl_data/class/Magic/sunduk_new.php b/_incl_data/class/Magic/sunduk_new.php index 110ef3e6..6f97f343 100644 --- a/_incl_data/class/Magic/sunduk_new.php +++ b/_incl_data/class/Magic/sunduk_new.php @@ -3,7 +3,6 @@ if (!defined('GAME')) { die(); } -$add_zb = 0; $add_nas = 0; $refer = mysql_fetch_array( @@ -19,7 +18,6 @@ function setMentorGiftStatus($id) { if ($tr['var_id'] == 1) { // Набор [0] - $add_zb = 5; $add_nas = 1; //Накидка @@ -40,7 +38,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 2) { // Набор [1] - $add_zb = 10; $add_nas = 1; //Рубаха 3209 @@ -65,7 +62,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 3) { // Набор [2] - $add_zb = 20; $add_nas = 1; //Перчатки 3211 @@ -90,7 +86,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 4) { // Набор [3] - $add_zb = 30; $add_nas = 1; //Сапоги 3213 @@ -119,7 +114,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 5) { // Набор [4] - $add_zb = 40; $add_nas = 1; //Серьги 3216 @@ -152,7 +146,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 6) { // Набор [5] - $add_zb = 50; $add_nas = 1; //Броня 4002 @@ -188,7 +181,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 7) { // Набор [6] - $add_zb = 60; $add_nas = 2; //Учебник воспитанника 4004 @@ -213,7 +205,6 @@ if ($tr['var_id'] == 1) { } elseif ($tr['var_id'] == 8) { // Набор [7] - $add_zb = 70; $add_nas = 3; //Учебник воспитанника 4004 @@ -251,21 +242,6 @@ if ($tr['var_id'] == 1) { } -if ($add_zb > 0 && $this->info['level'] < 8) { - $this->info['money4'] += $add_zb; - mysql_query( - 'UPDATE `users` SET `money4` = "' . $this->info['money4'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); - - $cmsg = new ChatMessage(); - $cmsg->setTo($this->info['login']); - $cmsg->setType(6); - $cmsg->setText( - "В "Снабжение воспитанника" Вы обнаружили зубы: " . $this->zuby($add_zb, 1) . "." - ); - (new Chat())->sendMsg($cmsg); -} - if ($add_nas > 0 && $this->info['level'] < 8 && isset($refer['id'])) { $ino = 0; while ($ino < $add_nas) { @@ -282,4 +258,4 @@ if ($add_nas > 0 && $this->info['level'] < 8 && isset($refer['id'])) { (new Chat())->sendMsg($cmsg); } -unset($i3, $add_zb, $refer, $add_nas); +unset($i3, $refer, $add_nas); diff --git a/_incl_data/class/Model/ActionModel.php b/_incl_data/class/Model/ActionModel.php index 3682eb84..461b9630 100644 --- a/_incl_data/class/Model/ActionModel.php +++ b/_incl_data/class/Model/ActionModel.php @@ -14,6 +14,31 @@ class ActionModel $this->uid = $uid; } + public static function new(array $user, string $vals, string $vars, int $time = 0) + { + if (!$time) { + $time = time(); + } + Db::sql( + 'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)', + [ + $user['id'], + $time, + $user['city'], + $user['room'], + $vars, + UserIp::get(), + $vals, + '', + ] + ); + } + + public static function getAll(string $filter = ''): array + { + return Db::getRows('select * from actions'); + } + public function getByVals(string $vals) { return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]); @@ -40,30 +65,18 @@ class ActionModel Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]); } - public static function new(array $user, string $vals, string $vars, int $time = 0) + + /*protected function testAction($filter, $tp): array { - if (!$time) { - $time = time(); + if ($tp == 1) { + $query = 'select * from actions where ' . $filter; + } elseif ($tp == 2) { + $query = 'select count(*) from actions where ' . $filter; + } else { + return []; } - Db::sql( - 'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)', - [ - $user['id'], - $time, - $user['city'], - $user['room'], - $vars, - UserIp::get(), - $vals, - '', - ] - ); - } - - public static function getAll(string $filter = ''): array - { - return Db::getRows('select * from actions'); - } - + $arr = mysql_fetch_array(mysql_query($query)); + return !empty($arr) ? $arr : []; + }*/ } \ No newline at end of file diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index b1b9754c..77424a97 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -4,8 +4,12 @@ use Core\Config; use Core\Database; use Core\Db; use Helper\Conversion; +use JetBrains\PhpStorm\NoReturn; use Model\ActionModel; +use User\Effects; +use User\InfoBox; use User\ItemsModel; +use User\Reputation; use User\Stats; class User @@ -580,6 +584,9 @@ class User public array $rep; public $tfer; public $stats; + private InfoBox $infoBox; + private Reputation $reputation; + private Stats $userStats; private function __construct() { @@ -657,20 +664,9 @@ class User $this->info['login2'] = ''; } - $this->rep = mysql_fetch_array( - mysql_query( - 'SELECT - `add_slot`,`nu_sandcity`,`n_sandcity`, - `dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`, - `repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`, - `n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`, - `nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`, - `rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`, - (`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep, - (`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep - FROM `rep` WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ) - ); + $this->reputation = new Reputation($this->info['id']); + $this->rep = $this->reputation->get(); + if ($this->info['login2'] != '' && $this->info['zv'] == 0 && $this->info['battle'] == 0) { $this->info['login2'] = ''; @@ -763,62 +759,52 @@ class User //Кидаем передачу if (isset($_POST['trnLogin'], $_GET['transfer']) && $this->info['battle'] == 0) { - if ($this->info['align'] == 2 && $this->info['admin'] == 0) { - $this->error = 'Хаосники не могут передавать предметы другим персонажам'; - } else { - $t = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`login`,`login2`,`pass`,`pass2`,`emailconfirmation`,`securetime`,`online`,`ip`,`ipreg`,`joinIP`,`admin`,`city`,`room`,`banned`,`auth`,`align`,`mod_zvanie`,`clan`,`nextMsg`,`molch1`,`molch2`,`molch3`,`level`,`money`,`battle`,`cityreg`,`invBlock`,`invBlockCode`,`zag`,`a1`,`q1`,`mail`,`name`,`bithday`,`sex`,`hobby`,`chatColor`,`timereg`,`add_smiles`,`obraz`,`win`,`lose`,`nich`,`host`,`info_delete`,`dateEnter`,`afk`,`dnd`,`timeMain`,`clan_prava`,`addpr`,`marry`,`invis`,`bot_id`,`haos`,`host_reg`,`inUser`,`jail`,`animal`,`vip`,`catch`,`frg`,`no_ip`,`type_pers`,`bot_room` FROM `users` WHERE `login` = "' . mysql_real_escape_string( - $_POST['trnLogin'] - ) . '" AND `city` = "' . $this->info['city'] . '" LIMIT 1' - ) - ); - if (isset($t['id'])) { - if ($this->info['login'] == $t['login']) { - $this->error = 'Вы не можете передать самому себе'; - } elseif ($t['battle'] > 0) { - $this->error = 'Персонаж находится в бою'; - } elseif ($t['align'] == 2 && $this->info['admin'] == 0) { - $this->error = 'Вы не можете передавать предметы хаосникам'; - } elseif ($t['room'] != $this->info['room']) { - $this->error = 'Вы должны находится в одной комнате с персонажем'; + $t = self::getInfo($_POST['trnLogin']); + + if (isset($t['id'])) { + if ($this->info['login'] == $t['login']) { + $this->error = 'Вы не можете передать самому себе'; + } elseif ($t['battle'] > 0) { + $this->error = 'Персонаж находится в бою'; + } elseif ($t['room'] != $this->info['room']) { + $this->error = 'Вы должны находится в одной комнате с персонажем'; + } else { + //создаем передачу + $tt = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1' + ) + ); + if (isset($tt['id'])) { + $this->error = 'Вы уже находитесь в передаче'; } else { - //создаем передачу $tt = mysql_fetch_array( mysql_query( - 'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1' + 'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $t['id'] . '" OR `uid2` = "' . $t['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '")) ORDER BY `id` DESC LIMIT 1' ) ); if (isset($tt['id'])) { - $this->error = 'Вы уже находитесь в передаче'; + $this->error = 'Персонаж уже проводит сделку'; } else { - $tt = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $t['id'] . '" OR `uid2` = "' . $t['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '")) ORDER BY `id` DESC LIMIT 1' - ) + $ins = mysql_query( + 'INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time() . '","' . mysql_real_escape_string( + htmlspecialchars($_POST['textarea'], null) + ) . '","' . time() . '")' ); - if (isset($tt['id'])) { - $this->error = 'Персонаж уже проводит сделку'; - } else { - $ins = mysql_query( - 'INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time() . '","' . mysql_real_escape_string( - htmlspecialchars($_POST['textarea'], null) - ) . '","' . time() . '")' + if ($ins) { + $this->addAction( + time(), + 'trasfer_' . $this->info['city'] . '_' . $this->info['room'] . '_' . $t['id'] . '', + $this->info['login'] ); - if ($ins) { - $this->addAction( - time(), - 'trasfer_' . $this->info['city'] . '_' . $this->info['room'] . '_' . $t['id'] . '', - $this->info['login'] - ); - } } } } - } else { - $this->error = 'Персонаж не найден в этом городе'; } + } else { + $this->error = 'Персонаж не найден'; } + } //Выделяем передачи @@ -897,33 +883,17 @@ class User //Одеваем боевой комплект if (isset($_GET['usec1']) && $this->info['battle'] == 0) { - $cmp = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`uid`,`type`,`val`,`name`,`time`,`delete` FROM `save_com` WHERE `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `id` = "' . mysql_real_escape_string( - $_GET['usec1'] - ) . '" LIMIT 1' - ) - ); - if (isset($cmp['id'])) { + $cmp = Db::getValue('select val from save_com where uid = ? and id = ?', [$this->info['id'], (int)$_GET['usec1']]); + if ($cmp) { //снимаем все вещи - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '"'); + Db::sql('update items_users set inOdet = 0 where uid = ?', [$this->info['id']]); //одеваем вещи, если они не удалены - $cm = Conversion::dataStringToArray($cmp['val']); - $i = 1; - while ($i <= 250) { - if (isset($cm[$i])) { - mysql_query( - 'UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` = "' . $i . '"' - ); - mysql_query( - 'UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . ((int)$cm[$i]) . '" AND `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `inShop` = "0"' - ); - } - $i++; + $cm = Conversion::dataStringToArray($cmp); + foreach ($cm as $slot => $itemid) { + Db::sql('update items_users set inOdet = ? where id = ? and uid = ? and inShop = 0', [(int)$slot, (int)$itemid, $this->info['id']]); } + } - - unset($cmp, $cm); } @@ -933,9 +903,11 @@ class User ) ); + $this->stats = $this->getStats($this->info['id'], 0); + if (!isset($_GET['obt_sel']) && $this->info['battle'] == 0 && $this->info['obraz'] != '0.gif') { //Проверяем текущий образ - $this->stats = $this->getStats($this->info['id'], 0); + $tr = true; $o = mysql_fetch_array( mysql_query( @@ -997,7 +969,6 @@ class User ); if (!isset($sm['id'])) { if (isset($_GET['obr_sel'])) { - $this->stats = $this->getStats($this->info['id'], 0); $tr = true; $o = mysql_fetch_array( mysql_query( @@ -1092,19 +1063,22 @@ class User $this->allActionsStart(); } elseif (isset($this->info['id'])) { + $this->room = mysql_fetch_array( mysql_query( 'SELECT `id`,`extdlg`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee`,`roomAjax` FROM `room` WHERE `id` = "' . $this->info['room'] . '" LIMIT 1' ) ); } + + $this->infoBox = new InfoBox($this); } - /** + /** Выборка из user+stats+room по id или login. * @param int|string $user * @return array */ - public static function getInfo($user): array + public static function getInfo(int|string $user): array { $cell = is_numeric($user) ? 'id' : 'login'; $query = 'select @@ -1116,7 +1090,8 @@ class User users.clan as clan, stats.timeGo as timeGo, users.name as name, - stats.lider as lider + stats.lider as lider, + room.name as room_name from users left join stats on users.id = stats.id left join room on users.room = room.id @@ -1131,7 +1106,9 @@ class User return; } - $this->getStats($this->info); // Бля, а вдруг? + $this->userStats = new Stats($this); + //$this->getStats($this->info); // Бля, а вдруг? + $this->stats = $this->userStats->getStats($this->info); $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]); if (!isset($this->info['achiv']['id'])) { @@ -1188,7 +1165,7 @@ class User public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array { $result = new Stats($this); - return $result->getStats($uid, $i1, $res, $reimg, $btl_cache, $minimal); + return $result->getStats($uid, $i1, $res, $reimg, $btl_cache); } public function getUserInfoById($id) @@ -1196,16 +1173,18 @@ class User return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]); } - public function testAction($filter, $tp) + public function testAction($filter, $tp): array { if ($tp == 1) { $query = 'select * from actions where ' . $filter; } elseif ($tp == 2) { $query = 'select count(*) from actions where ' . $filter; + } else { + return []; } + $arr = mysql_fetch_array(mysql_query($query)); - $stmt = mysql_query($query); - return $stmt ? mysql_fetch_array($stmt) : []; + return !empty($arr) ? $arr : []; } //Удаление определенного типа предметов @@ -1418,12 +1397,9 @@ class User { $r = 1; if (floor($an) > 0) { - $a = Db::getValue( - 'select align from users_align where uid = ? and (`delete` = 0 or `delete` > unix_timestamp())', - [$uid] - ); + $a = Db::getValue('select align from users_align where uid = ?', [$uid]); - if (floor((float)$a['align']) != $an) { + if (floor((float)$a) != $an) { $r = 0; } } @@ -1522,56 +1498,36 @@ class User return Conversion::secondsToTimeout($ttm); } - public function insertAlign($an, $uid) + public function insertAlign($an, $uid): void { - if ($an > 0) { - mysql_query( - 'UPDATE `users_align` SET `delete` = "' . (time() + 1) . '" WHERE `uid` = "' . mysql_real_escape_string( - $uid - ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"' - ); - mysql_query( - 'INSERT INTO `users_align` (`uid`,`time`,`delete`,`align`) VALUES ( - "' . mysql_real_escape_string($uid) . '","' . time() . '","0","' . mysql_real_escape_string( - floor($an) - ) . '" - ) ' - ); + if ($an <= 0) { + return; } + Db::sql('replace into users_align (uid, time, align) VALUES (?,unix_timestamp(),?)', [$uid, floor($an)]); + } - public function deleteAlign($an, $uid) + public function deleteAlign($an, $uid): void { - if ($an > 0) { - mysql_query( - 'UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string( - $uid - ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"' - ); + if ($an <= 0) { + return; } + Db::sql('delete from users_align where uid = ? and align = ?', [$uid, floor($an)]); + } - public function repobmen($id, $type) + public function repobmen(int $id, $type): string { //echo 'обмен'; - $pl = mysql_fetch_array( - mysql_query( - 'SELECT `im`.*, -`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;' - ) - ); + $pl = ItemsModel::getOwnedItemById($this->info['id'], $id); $po = Conversion::dataStringToArray($pl['data']); if ((!isset($po['frompisher']) || $po['tr_lvl'] < 4) && $pl['type'] != 31) { $e = 'Не удалось обменять предмет на репутацию.'; } else { $e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.'; - mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' - ); - $this->rep['repcapitalcity'] += 1; - mysql_query( - 'UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); + + ItemsModel::delete($pl['id']); + $this->rep['repcapitalcity'] = $this->reputation->addRep('repcapitalcity', 1); } return $e; } @@ -1988,6 +1944,7 @@ class User return $plid; } + public function microLogin(int $id, int $t = 1, int $nnz = 1): string { if ($t !== 1) { @@ -2205,19 +2162,11 @@ class User * @return int|mixed|string * @deprecated use ItemsModel::addItem() */ - public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null) + public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null): mixed { return ItemsModel::addItem($id, $uid, $md, $dn, $mxiznos, $nosudba, $plavka); } - public function addKr($amount, $uid = 0) - { - if ($uid === 0) { - $uid = $this->info['id']; - } - Db::sql('update users set money = money + ? where id = ?', [$amount, $uid]); - } - public function newAct($test): bool { $r = true; @@ -2237,187 +2186,14 @@ class User return $r; } - public function buyItemCommison($sid, $item, $iid = null): string - { - global $sid; - $sid = mysql_real_escape_string($sid); - $itme = mysql_real_escape_string($item); - $iid = mysql_real_escape_string($iid); - $i2 = mysql_fetch_array( - mysql_query( - 'SELECT `iu`.`uid`, `iu`.`id`, `iu`.`uid`, `iu`.`1price`, `iu`.inGroup, `iu`.`data`, `iu`.`inShop`, `iu`.`item_id`, `u`.`login` as login FROM `items_users` as `iu` LEFT JOIN `users` as `u` ON `u`.id=`iu`.uid WHERE `iu`.`id` = ' . $iid . ' AND `iu`.`inShop` = 30 LIMIT 1' - ) - ); - $i1 = mysql_fetch_array( - mysql_query('SELECT `name`,`price1` FROM `items_main` WHERE `id` = ' . $i2['item_id'] . ' LIMIT 1') - ); - $price = $i2['1price']; - if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) { - if ($price > $this->info['money']) { - $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)'; - } else { - $UpdMoney = mysql_query( - 'UPDATE `users` SET `money` = "' . mysql_real_escape_string( - round($this->info['money'] - $price, 2) - ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); - if ($UpdMoney) { - $this->info['money'] -= $price; - $UpMoney2 = mysql_query( - 'UPDATE `users` SET `money` = `money` + ' . $price . ' WHERE `id` = ' . $i2['uid'] . ' LIMIT 1' - ); - $col = $this->itemsX($iid); - if ($col > 1) { - $UpItems = mysql_query( - 'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `inGroup` = `inGroup`+1000, `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `inShop` = 30 AND `inOdet` = "0"AND `item_id`="' . $i2['item_id'] . '" AND `uid`="' . $i2['uid'] . '" AND `inGroup` = "' . $i2['inGroup'] . '" LIMIT ' . $col . '' - ); - } else { - $UpItems = mysql_query( - 'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" AND `uid`="' . $i2['uid'] . '" LIMIT 1' - ); - } - //Вставляем функцию передачи кредитов владельцу предмета - if ($UpItems) { - //Записываем в личное дело что предмет получен - $r = 'Вы приобрели предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" за ' . $price . ' кр.
Предмет успешно добавлен в инвентарь.'; - $ld = $this->addDelo( - 1, $this->info['id'], - '"ComissShop.' . $this->info['city'] . '": Приобрел предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] в коммисионном магазине за ' . $price . ' кр. [Продавец: ' . ($i2['login'] != '' ? '' . $i2['login'] . '' : '(' . $i2['uid'] . ')') . ']', - time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', $price, 0 - ); - $u2s = mysql_fetch_array( - mysql_query('SELECT * FROM `users` WHERE `id` = "' . $i2['uid'] . '" LIMIT 1') - ); - $ld = $this->addDelo( - 1, $u2s['id'], - '"ComissShop.' . $this->info['city'] . '": Продал предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] через коммисионный магазине за ' . $price . ' кр. [Покупатель: ' . $this->info['login'] . ']', - time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price - ); - } else { - //Записываем в личное дело что предмет не получен - $r = 'Вам не удалось приобрести "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
Приносим свои извинения за неудобства.'; - $ld = $this->addDelo( - 1, $this->info['id'], - '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: ' . $price . ' кр.', - time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0 - ); - if (!$ld) { - echo '
Ошибка, невозможно добавить запись в /db/usersDelo/!
'; - } - } - } else { - $r = 'Вам не удалось приобрести предмет...'; - } - } - } else { - $r = 'Предмет не найден на прилавке'; - } - return '
' . $r . '
'; - } - - public function itemsX($id, $uid = null, $item_id = null) - { - - $item = mysql_fetch_array( - mysql_query( - 'SELECT `iu`.`id`, -`iu`.`item_id`, -`iu`.`uid`, -`iu`.`inGroup`, -`iu`.`inShop` FROM `items_users` AS `iu` WHERE `iu`.`delete` = "0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1 ' - ) - ); - if ($item['inGroup'] == 0) { - $grp = ' LIMIT 1'; - } else { - $grp = ' LIMIT 1000'; - } - $r = mysql_num_rows( - mysql_query( - 'SELECT `iu`.`id` FROM `items_users` AS `iu` WHERE `iu`.`inShop` = "' . $item['inShop'] . '" AND `iu`.`item_id` = "' . $item['item_id'] . '" AND `iu`.`uid` = "' . ($item['uid']) . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . ($item['inGroup']) . '" ' . $grp . ' ' - ) - ); - unset($item); - return $r; - } - - /* - * $iid Уникальный id прдемета и одновремено флаг что - * покупка из комка. - */ - - /** - * @param $type - * @param $uid - * @param $txt - * @param @deprecated $tm - * @param @deprecated $ct - * @param $frm - * @param $mo - * @param @deprecated $mi - * @param $vvv - * @return bool - * @deprecated использовать Delo::add(). - */ - public function addDelo($type, $uid, $txt, $tm, $ct, $frm, $mo, $mi, $vvv = false): bool - { - $dop = $vvv ?: ''; - Delo::add($type, $frm, $uid, $txt, $mo, $dop); - return true; - } - - public function commisonRent($action, $iid, $price = null) - { - if ($action == "Сдать в магазин" && isset($iid) && $price > 0) { - $ChImtem = mysql_fetch_array( - mysql_query( - 'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1' - ) - ); - $ChSudba = Conversion::dataStringToArray($ChImtem['data']); - if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) { - if (isset($ChImtem['inGroup']) and $ChImtem['inGroup'] > 0) { - $col = $this->itemsX($ChImtem['id']); - if ($col > 1) { - mysql_query( - 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . '' - ); - } else { - mysql_query( - 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - mysql_query( - 'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } - } elseif ($action == "Забрать" && isset($iid)) { - $i = mysql_fetch_array( - mysql_query( - 'SELECT `im`.`price1`, -`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1' - ) - ); - if (isset($i['inGroup']) and $i['inGroup'] > 0) { - $col = $this->itemsX($i['id']); - if ($col > 1) { - mysql_query( - 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . '' - ); - } else { - mysql_query( - 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - mysql_query( - 'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1' - ); - } + public function addKr($amount, $uid = 0): void + { + if ($uid === 0) { + $uid = $this->info['id']; + $this->info['money'] += $amount; } + Db::sql('update users set money = money + ? where id = ?', [$amount, $uid]); } public function bronFx($br): string @@ -2437,661 +2213,214 @@ class User return $r; } - public function price($vl) + /* + * $iid Уникальный id прдемета и одновремено флаг что + * покупка из комка. + */ + + public function price($vl): string { if ($vl == round($vl)) { $vl = $vl . '.00'; } $vl = explode('.', $vl); - $vl = $vl[0] . '.' . $vl[1] . ''; - return $vl; + return $vl[0] . '.' . $vl[1] . ''; } - public function __clone() + #[NoReturn] public function __clone() { trigger_error('Дублирование не допускается.', E_USER_ERROR); } - public function freeStatsMod($id, $s, $uid) + public function freeStatsMod($id, $s, $uid): void { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' - ) - ); - if (isset($itm['id'])) { - $po = Conversion::dataStringToArray($itm['data']); + $itm = Db::getValue('select data from items_users where id = ? and uid = ? and inShop = 0 and inOdet = 0', [$id, $uid]); - //статы - if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5') { - if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && isset($po['add_' . $_GET['mf']])) { - $po['mf_stats'] = (int)$po['mf_stats']; - $po['mf_stats'] -= 1; - $po['add_' . $_GET['mf']] += 1; - - $po = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' - ); - } - } elseif ($_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') { - if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && isset($po['add_' . $_GET['mf']])) { - $po['mf_mod'] = (int)$po['mf_mod']; - $po['mf_mod'] -= 1; - $po['add_' . $_GET['mf']] += 1; - - $po = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' - ); - } - } elseif ($_GET['mf'] == 'mib1' || $_GET['mf'] == 'mib2' || $_GET['mf'] == 'mib3' || $_GET['mf'] == 'mib4') { - $s = $_GET['mf']; - $s = str_replace('mib', '', $s); - $s = (int)$s; - if (isset($po['mf_mib']) && $po['mf_mib'] > 0 && (isset($po['add_mib' . $s]) || isset($po['add_mab' . $s]))) { - $po['mf_mib'] = (int)$po['mf_mib']; - $po['mf_mib'] -= 1; - if (isset($po['add_mab' . $s])) { - $po['add_mab' . $s] += 1; - } - if (isset($po['add_mib' . $s])) { - $po['add_mib' . $s] += 1; - } - - $po = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' - ); - } - } - } - } - - public function freeStatsItem($id, $s, $uid) - { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' - ) - ); - if (isset($itm['id']) && ($s == 1 || $s == 2 || $s == 3 || $s == 5)) { - $po = Conversion::dataStringToArray($itm['data']); - if (isset($po['free_stats']) && $po['free_stats'] > 0) { - $s = (int)$s; - if ($s >= 1 || $s <= 3 || $s == 5) { - $po['free_stats'] = (int)$po['free_stats']; - $po['free_stats'] -= 1; - $po['add_s' . $s] += 1; - } - } - $po = Conversion::arrayToDataString($po); - - mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - } - - public function freeStats2Item($id, $s, $uid, $tp) - { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' - ) - ); - if (isset($itm['id'])) { - $po = Conversion::dataStringToArray($itm['data']); - if ($itm['so'] > 0) { - $s = (int)$s; - if ($tp == 1) { - //статы - if ($s == 1 || $s == 2 || $s == 3 || $s == 5) { - if (10 + 25 * $po['add_s' . $s] <= $itm['so'] && $itm['so'] > 0) { - $itm['so'] -= 10 + 25 * $po['add_s' . $s]; - $po['add_s' . $s]++; - $this->error = 'Характеристика улучшена...'; - } else { - $this->error = 'Не хватает очков развития...'; - } - } - } elseif ($tp == 2) { - //мф - if ($s > 0 && $s < 13) { - $s2 = 0; - if ($s == 9 || $s == 12) { - if ($s == 9) { - $s = 'm10'; - } elseif ($s == 12) { - $s = 'zm'; - } - $s2 = 4 + 4 * $po['add_' . $s]; - } else { - if ($s == 1) { - $s = 'm1'; - } elseif ($s == 2) { - $s = 'm2'; - } elseif ($s == 3) { - $s = 'm4'; - } elseif ($s == 4) { - $s = 'm5'; - } elseif ($s == 5) { - $s = 'mab1'; - } elseif ($s == 6) { - $s = 'mab2'; - } elseif ($s == 7) { - $s = 'mab3'; - } elseif ($s == 8) { - $s = 'mab4'; - } elseif ($s == 10) { - $s = 'za'; - } elseif ($s == 11) { - $s = 'm11a'; - } - $s2 = 5 + 5 * $po['add_' . $s]; - } - - if (4 + 4 * $po['add_' . $s] <= $itm['so'] && $itm['so'] > 0) { - $itm['so'] -= $s2; - if ($s == 'mab1') { - $po['add_mib1']++; - } elseif ($s == 'mab2') { - $po['add_mib2']++; - } elseif ($s == 'mab3') { - $po['add_mib3']++; - } elseif ($s == 'mab4') { - $po['add_mib4']++; - } - $po['add_' . $s]++; - } else { - $this->error = 'Не хватает очков развития...'; - } - } - } - } - $po = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $po . '",`so` = "' . $itm['so'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' - ); - } - } - - public function obj_addItem($id) - { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, -`iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1' - ) - ); - if ($this->info['transfers'] < 1) { - $this->error = 'На сегодня лимит передач исчерпан.'; - } elseif (isset($itm['id'])) { - if (isset($itm['inGroup']) and $itm['inGroup'] > 0) { - $col = $this->itemsX($itm['id']); - if ($col > 1) { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 1 WHERE `item_id`="' . $itm['item_id'] . '" AND `inShop` != "30" AND `uid`="' . $itm['uid'] . '" AND `inGroup` = "' . $itm['inGroup'] . '" LIMIT ' . $col . '' - ); - } else { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $itm['id'] . '" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $id . '" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - $this->error = 'Предмет не найден в рюкзаке'; - } - } - - public function obj_takeItem($id) - { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, -`iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` -FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1' - ) - ); - if ($this->info['transfers'] < 1) { - $this->error = 'На сегодня лимит передач исчерпан.'; - } elseif (isset($itm['id'])) { - if (isset($itm['inGroup']) && $itm['inGroup'] > 0) { - $col = $this->itemsX($itm['id']); - if ($col > 1) { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND ( `id` = "' . $itm['id'] . '" OR `inGroup` = "' . $itm['inGroup'] . '") AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } else { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $itm['id'] . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - $upd = mysql_query( - 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $id . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" ' - ); - } - } else { - $this->error = 'Предмет не найден в сундуке'; - } - } - - //Сверяем требования предмета для его использования - - public function itemsSmSave($id, $s, $uid) - { - $itm = mysql_fetch_array( - mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' - ) - ); - if (!isset($itm['id'])) { + if (!isset($itm)) { return; } - $s = (int)$s; + $po = Conversion::dataStringToArray($itm); + + //статы + if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5') { + if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && isset($po['add_' . $_GET['mf']])) { + $po['mf_stats'] = (int)$po['mf_stats']; + $po['mf_stats'] -= 1; + $po['add_' . $_GET['mf']] += 1; + + + } + } elseif ($_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') { + if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && isset($po['add_' . $_GET['mf']])) { + $po['mf_mod'] = (int)$po['mf_mod']; + $po['mf_mod'] -= 1; + $po['add_' . $_GET['mf']] += 1; + } + } elseif ($_GET['mf'] == 'mib1' || $_GET['mf'] == 'mib2' || $_GET['mf'] == 'mib3' || $_GET['mf'] == 'mib4') { + $s = $_GET['mf']; + $s = str_replace('mib', '', $s); + $s = (int)$s; + if (isset($po['mf_mib']) && $po['mf_mib'] > 0 && (isset($po['add_mib' . $s]) || isset($po['add_mab' . $s]))) { + $po['mf_mib'] = (int)$po['mf_mib']; + $po['mf_mib'] -= 1; + if (isset($po['add_mab' . $s])) { + $po['add_mab' . $s] += 1; + } + if (isset($po['add_mib' . $s])) { + $po['add_mib' . $s] += 1; + } + + Db::sql('update items_users set data = ? where id = ?', [Conversion::arrayToDataString($po), $id]); + } + } + + if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5' || + $_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') { + Db::sql('update items_users set data = ? where id = ?', [Conversion::arrayToDataString($po), $id]); + } + } + + public function freeStatsItem(int $id, int $s, int $uid): void + { + $itm = Db::getValue('select data from items_users where id = ? and uid = ? and inShop = 0 and inOdet = 0', [$id, $uid]); + if (!$itm || $s != 1 && $s != 2 && $s != 3 && $s != 5) { + return; + } + + $po = Conversion::dataStringToArray($itm); + if (isset($po['free_stats']) && $po['free_stats'] > 0) { + $po['free_stats'] = (int)$po['free_stats']; + $po['free_stats'] -= 1; + $po['add_s' . $s] += 1; + } + $po = Conversion::arrayToDataString($po); + Db::sql('update items_users set data = ? where id = ?', [$po, $id]); + } + + public function freeStats2Item(int $id, int $s, int $uid, int $tp): void + { + $itm = Db::getRow('select id, data, so from items_users where id = ? and uid = ? and inShop = 0 and inOdet = 0', [$id, $uid]); + if (!isset($itm['id']) || $itm['so'] <= 0) { + return; + } + $po = Conversion::dataStringToArray($itm['data']); + + if ($tp == 1) { + //статы + if ($s == 1 || $s == 2 || $s == 3 || $s == 5) { + if (10 + 25 * $po['add_s' . $s] <= $itm['so']) { + $itm['so'] -= 10 + 25 * $po['add_s' . $s]; + $po['add_s' . $s]++; + $this->error = 'Характеристика улучшена...'; + } else { + $this->error = 'Не хватает очков развития...'; + } + } + } elseif ($tp == 2) { + //мф + if ($s > 0 && $s < 13) { + if ($s == 1) { + $s = 'm1'; + } elseif ($s == 2) { + $s = 'm2'; + } elseif ($s == 3) { + $s = 'm4'; + } elseif ($s == 4) { + $s = 'm5'; + } elseif ($s == 5) { + $s = 'mab1'; + } elseif ($s == 6) { + $s = 'mab2'; + } elseif ($s == 7) { + $s = 'mab3'; + } elseif ($s == 8) { + $s = 'mab4'; + } elseif ($s == 9) { + $s = 'm10'; + } elseif ($s == 10) { + $s = 'za'; + } elseif ($s == 11) { + $s = 'm11a'; + } elseif ($s == 12) { + $s = 'zm'; + } + + $s2 = $s == 9 || $s == 12 ? 4 + 4 * $po['add_' . $s] : 5 + 5 * $po['add_' . $s]; + + if (4 + 4 * $po['add_' . $s] <= $itm['so']) { + $itm['so'] -= $s2; + if ($s == 'mab1') { + $po['add_mib1']++; + } elseif ($s == 'mab2') { + $po['add_mib2']++; + } elseif ($s == 'mab3') { + $po['add_mib3']++; + } elseif ($s == 'mab4') { + $po['add_mib4']++; + } + $po['add_' . $s]++; + } else { + $this->error = 'Не хватает очков развития...'; + } + } + } + Db::sql('update items_users set data = ?, so = ? where id = ?', [Conversion::arrayToDataString($po), $itm['so'], $id]); + } + + public function obj_addItem(int $id): void + { + $itm = Db::getRow('select id, inGroup, item_id, uid from items_users where uid = ? and inOdet = 0 and inShop = 0 and id = ?', [$this->info['id'], $id]); + if ($this->info['transfers'] < 1) { + $this->error = 'На сегодня лимит передач исчерпан.'; + return; + } elseif (!isset($itm['id'])) { + $this->error = 'Предмет не найден в рюкзаке'; + return; + } + if ($itm['inGroup'] > 0 && $this->itemsX($id) > 1) { + Db::sql('update items_users set inshop = 1 where inShop != 30 and uid = ? and item_id = ? and inGroup = ?', [$this->info['id'], $itm['item_id'], $itm['inGroup']]); + } else { + Db::sql('update items_users set inshop = 1 where inShop != 30 and uid = ? and id = ? and inOdet = 0', [$this->info['id'], $id]); + } + } + + public function itemsX(int $id, $uid = null, $item_id = null): bool|int + { + //fixme какая-то дичь тут. + $item = Db::getRow('select uid, item_id, inGroup, inShop from items_users where id = ?', [$id]); + return Db::getValue('select count(id) from items_users where inShop = ? and item_id = ? and uid = ? and inGroup = ?', + [$item['inShop'], $item['item_id'], $item['uid'], $item['ingroup']]); + } + + public function obj_takeItem($id): void + { + $itm = Db::getRow('select id, inGroup from items_users where id = ? and uid = ? and inOdet = 0 and inShop = 0'); + if ($this->info['transfers'] < 1) { + $this->error = 'На сегодня лимит передач исчерпан.'; + return; + } elseif (!isset($itm['id'])) { + $this->error = 'Предмет не найден в сундуке'; + return; + } + if ($itm['inGroup'] > 0 && $this->itemsX($id) > 1) { + Db::sql('update items_users set inshop = 0 where inShop != 30 and uid = ? and (id = ? or inGroup = ?) and inOdet = 0', [$this->info['id'], $id, $itm['inGroup']]); + } else { + Db::sql('update items_users set inshop = 0 where inShop != 30 and uid = ? and id = ? and inOdet = 0', [$this->info['id'], $id]); + } + } + + public function itemsSmSave(int $id, int $s, int $uid): void + { + $itm = Db::getValue('select data from items_users where id = ? and uid = ? and inShop = 0 and inOdet = 0', [$id, $uid]); + if (!$itm) { + return; + } + $po = Conversion::dataStringToArray($itm['data']); if (isset($po['sudba']) && $po['sudba'] == '0') { return; } + if (isset($po['sm_skill']) && $s > 100) { $mx2 = 1; $mx1 = 0; @@ -3126,13 +2455,12 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } - $po = Conversion::arrayToDataString($po); - mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - - unset($mx1, $mx2, $mx3, $po); + Db::sql('update items_users set data = ? where id = ?', [Conversion::arrayToDataString($po), $id]); } - public function runeItem($id, $name = 0, $ruid = 0) + //Сверяем требования предмета для его использования + + public function runeItem($id, $name = 0, $ruid = 0): void { if ($id == null) { if ($ruid < 1 && isset($_GET['use_rune'])) { @@ -4825,7 +4153,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` - +
' . $smt . '
'; @@ -5184,7 +4512,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is1 .= 'Добавить'; } elseif ($type == 5) { //передача - $is1 .= 'подарить
передать
(налог: 1 кр.)'; + $is1 .= 'подарить
передать
(налог: 1 кр.)'; } elseif ($type == 12) { //передача почта $skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2); @@ -5231,21 +4559,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is1 .= 'Ремонт 10 ед. за ' . $r2 . ' кр.
'; } $is1 .= 'Полный ремонт за ' . $r3 . ' кр.'; - if (Config::get('zuby') == true) { - if ($this->info['level'] < 8) { - $is1 .= '
Ремонт 1 ед. за ' . $this->zuby( - $r1 - ) . '
'; - if ($pl['iznosNOW'] >= 10) { - $is1 .= 'Ремонт 10 ед. за ' . $this->zuby( - $r2 - ) . '
'; - } - $is1 .= 'Полный ремонт за ' . $this->zuby( - $r3 - ) . '
'; - } - } + } elseif ($type == 3) { $is1 .= ''; } elseif ($type == 2) { @@ -5403,7 +4717,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is1 .= '
'; } if (($pl['type'] != 37 || !isset($po['item_inbox']) || $po['item_inbox'] == 0) && $pl['item_id'] != 10038 && $pl['item_id'] != 10039 && $pl['item_id'] != 10040) { - $is1 .= 'исп-ть'; + $is1 .= 'исп-ть'"; } } @@ -5432,10 +4746,14 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $is1 .= ''; } if ($this->itemsX($pl['id']) > 1) { - $is1 .= ' ' . $script; + $tbl = ' +
+ Разделить предмет ' . $pl['name'] . '?
'; + $link = '/main.php?inv=1otdel=' . (int)$_GET['otdel'] . '&unstack=' . $pl['id'] . '&rnd=' . $code; + + $onclickStr = sprintf("top.unstack('%d','%s','%s',1,'%s','%d'); return false;", $pl['id'], $pl['img'], $pl['name'], $tbl, (int)$_GET['otdel']); + + $is1 = ""; } } if (isset($po['toclan'])) { @@ -5471,22 +4789,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return $rt; } - public function floordec($zahl, $decimals = 2) + private function floordec($zahl, $decimals = 2): float|int { return floor($zahl * pow(10, $decimals)) / pow(10, $decimals); } - /** - * @param $v - * @param $t - * @return string - * @deprecated - */ - public function zuby($v, $t = 0): string - { - return ''; - } - private function shopSaleM($val, $itm): float { $procs = [ @@ -5532,10 +4839,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return round(($val / 100 * (100 - $proc)), 2); } - public function round2($v) + public function round2($v): float|string { $v = explode('.', $v); - $v = doubleval($v[0] . '.' . $v[1][0] . '' . $v[1][1]); + $v = doubleval($v[0] . '.' . $v[1][0] . $v[1][1]); $f = explode('.', $v); if (!isset($f[1])) { $v = $v . '.00'; @@ -5548,22 +4855,28 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return round((Config::get('shop_type2') / 100), 2); } - public function testBattle($id) + /** + * @param $type + * @param $uid + * @param $txt + * @param @deprecated $tm + * @param @deprecated $ct + * @param $frm + * @param $mo + * @param @deprecated $mi + * @param false $vvv + * @return bool + * @deprecated использовать Delo::add(). + */ + public function addDelo($type, $uid, $txt, $tm, $ct, $frm, $mo, $mi, false $vvv = false): bool { - $r = true; - if ($id == 0) { - $r = false; - } else { - $btla = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1' - ) - ); - if (isset($btla['id']) && $btla['team_win'] > -1) { - $r = false; - } - } - return $r; + Delo::add($type, $frm, $uid, $txt, $mo); + return true; + } + + public function testBattle($id): bool + { + return !($id == 0 || Db::getValue('select count(*) from battle where id = ? and team_win > -1', [$id]) > 0); } public function stack($id) @@ -5782,20 +5095,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } } - private function stackGroupCheck($uid, $group, $item) + private function stackGroupCheck($uid, $group, $item): int { // Находит неиспользованный ID группы предметов. $g = 0; $i = 0; - do { + do { //fixme ужасный цикл, ужасный запрос. $i++; - $gr = mysql_fetch_array( - mysql_query( - 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` - WHERE `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $i . '" AND `iu`.item_id="' . $item . '" - LIMIT 1' - ) - ); - if (empty($gr['inGroup'])) { + $gr = Db::getValue('select inGroup from items_users where uid = ? and inGroup = ? and item_id = ?', [$uid, $i, $item]); + + if (empty($gr)) { $g = 1; } } while ($g == 0); @@ -5804,262 +5112,142 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` public function testItems($uid, $sn, $dt) { - $st = false; - $rt = false; if ($uid != $this->info['id']) { - $u = mysql_fetch_array( - mysql_query( - 'SELECT `u`.`align`,`u`.`align2`,`u`.`battle`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`, - `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity` - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string( - $uid - ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1' - ) - ); + $u = self::getInfo($uid); if ($sn == 0) { - $sn = $this->getStats($uid, $i1); + $sn = $this->getStats($uid); } } else { $u = $this->info; if (isset($this->stats['hpAll'])) { $sn = $this->stats; } elseif ($sn == 0) { - $sn = $this->getStats($uid, $i1); + $sn = $this->getStats($uid); } } - if (isset($u['id'])) { - $snIt = 0; - //Проверяем одетые вещи и вещи с сроком годности - $cl = mysql_query( - 'SELECT - `iu`.`id` AS `iduid`, - `iu`.`time_sleep`, -`im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`iu`.`inOdet`!="0" OR `iu`.`data` LIKE "%srok%" OR `iu`.`data` LIKE "%vip_sale%" OR `iu`.`data` LIKE "%sudba=1%" OR ( `iu`.`data` LIKE "%zazuby=%" AND `iu`.`data` NOT LIKE "%srok=%" ) OR `iu`.`iznosNOW` > 0 OR `im`.`srok` > 0 OR (`iu`.`timeOver`<' . time() . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")' - ); - while ($itm = mysql_fetch_array($cl)) { - $po = []; - $po = Conversion::dataStringToArray($itm['data']); - $po['lvl'] = $u['level']; - //проверяем требования - $t = $this->items['tr']; - $x = 0; - $notr = 0; - $j = 1; - while ($j <= 4) { - if (!isset($po['tr_s' . $j]) && $itm['type'] != 26) { - $po['tr_s' . $j] = 0; - } - $j++; + + if (!isset($u['id'])) { + return 0; + } + $snIt = 0; + + //Проверяем одетые вещи и вещи с сроком годности + $cl = Db::getRow("select + items_main.id, + items_users.id as iduid, + data, + type, + price2, + 2price, + srok, + item_id, + time_create, + time_sleep, + timeOver, + name, + overType, + inOdet, + iznosNOW, + iznosMAX, + iznosMAXi + from items_users + left join items_main on items_main.id = item_id + where + ( + inOdet != 0 or + data like '%srok%' or + data like '%vip_sale%' or + data like '%sudba=1%' or + iznosNOW > 0 or + srok > 0 or + (timeOver !=0 and timeOver < unix_timestamp()) + ) and uid = ?", + [$u['id']]); + + foreach ($cl as $itm) { + $po = Conversion::dataStringToArray($itm['data']); + $po['lvl'] = $u['level']; + //проверяем требования + $t = $this->items['tr']; + $x = 0; + $notr = 0; + $j = 1; + while ($j <= 4) { + if (!isset($po['tr_s' . $j]) && $itm['type'] != 26) { + $po['tr_s' . $j] = 0; } - while ($x < count($t)) { - $n = $t[$x]; - if (isset($po['tr_' . $n]) && $n == 'sex') { - if ($po['tr_' . $n] != $this->info['sex']) { - $notr++; - } - } elseif (isset($po['tr_' . $n])) { - if ($po['tr_' . $n] > $this->stats[$n] && $n != 'align' && $n != 'align_bs') { - $notr++; - } - } - $x++; - } - if ($this->info['twink'] > 0) { - //Не дороже 100 екр. - if ($itm['price2'] > 1 || $itm['2price'] > 1) { + $j++; + } + while ($x < count($t)) { + $n = $t[$x]; + if (isset($po['tr_' . $n]) && $n == 'sex') { + if ($po['tr_' . $n] != $this->info['sex']) { $notr++; } - //Нельзя руны + чарки - if (isset($po['rune']) && $po['rune'] > 0) { - $notr++; - } - if (isset($po['spell_id']) && $po['spell_id'] > 0) { + } elseif (isset($po['tr_' . $n])) { + if ($po['tr_' . $n] > $this->stats[$n] && $n != 'align' && $n != 'align_bs') { $notr++; } } - if (isset($po['sudba']) && $po['sudba'] == 1) { - $po['sudba'] = $u['login']; - $itm['data'] = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1' - ); - } - if (isset($po['zazuby']) && !isset($po['srok']) && ($itm['type'] == 29 || $itm['type'] == 30 || $itm['type'] == 36 || $itm['type'] == 49 || $itm['type'] == 46 || $itm['type'] == 34)) { - //Предметы за зубы со сроком годности - $po['srok'] = 86400 * 7; - $itm['data'] = Conversion::arrayToDataString($po); - mysql_query( - 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1' - ); - } - if (isset($po['srok']) && $po['srok'] > 0) { - $itm['srok'] = $po['srok']; - } - if (isset($po['vip_sale']) && $sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) { - if ($itm['item_id'] == 4704) { - $po['musor2'] = 4708; - } - $this->isport( - $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], - $itm['name'], $po['zazuby'] - ); + $x++; + } + if ($this->info['twink'] > 0) { + //Не дороже 100 екр. + if ($itm['price2'] > 1 || $itm['2price'] > 1) { $notr++; } - if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) { + //Нельзя руны + чарки + if (isset($po['rune']) && $po['rune'] > 0) { $notr++; } - if ($notr > 0 && $itm['inOdet'] != 0) { - //снимаем предмет + if (isset($po['spell_id']) && $po['spell_id'] > 0) { + $notr++; + } + } + if (isset($po['sudba']) && $po['sudba'] == 1) { + $po['sudba'] = $u['login']; + Db::sql('update items_users set data = ? where id = ? and uid = ?', [Conversion::arrayToDataString($po), $itm['iduid'], $u['id']]); + } + + if (isset($po['srok']) && $po['srok'] > 0) { + $itm['srok'] = $po['srok']; + } + if (isset($po['vip_sale']) && $sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) { + if ($itm['item_id'] == 4704) { + $po['musor2'] = 4708; + } + ItemsModel::itemDecay($itm['id'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], $itm['name']); + $notr++; + } + if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) { + $notr++; + } + if ($notr > 0 && $itm['inOdet'] != 0) { + //снимаем предмет + $this->snatItem($itm['id'], $u['id']); + $snIt++; + } + //проверяем срок годности + if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999 && isset($po['musor']) && $po['musor'] > 0) { + //предмет сломался + $this->itemDestroy($itm['id'], $u['id'], (int)$po['musor']); + } + if ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0 && $itm['time_sleep'] == 0) { + if ($itm['inOdet'] != 0) { $this->snatItem($itm['id'], $u['id']); $snIt++; } - //проверяем срок годности - if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) { - //предмет сломался - if (isset($po['musor'])) { - if ($po['musor'] > 0) { - $this->recr($itm['id'], $itm['type'], $u['id'], (int)$po['musor']); - } - } - } - if ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0 && $itm['time_sleep'] == 0) { - if ($itm['inOdet'] != 0) { - $this->snatItem($itm['id'], $u['id']); - $snIt++; - } - //удаляем предмет - if ($itm['item_id'] == 4704) { - $po['musor2'] = 4708; - } - $this->isport( - $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], - $itm['name'], $po['zazuby'] - ); - } elseif ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0) { - echo 'test'; + //удаляем предмет + if ($itm['item_id'] == 4704) { + $po['musor2'] = 4708; } + ItemsModel::itemDecay($itm['id'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], $itm['name']); } - - if ($snIt > 0) { - $this->testItems($uid, $sn, 1); - } elseif ($dt == 0) { - return -2; - } - } else { - return 0; } - } - - public function isport($it, $t, $tp, $uid, $id2, $type, $name, $zub) - { - if ($id2 == 4708) { - $tp = 1; - } - if ($it != 0) { - if ($uid != 0) { - $uid2 = 'AND `uid`="' . $uid . '"'; - } else { - $uid2 = ''; - } - $upd = mysql_query( - 'UPDATE `items_users` SET `delete`="' . time() . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1' - ); - if ($upd) { - $upd = mysql_query( - 'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time() . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . '' - ); - $this->addDelo( - 2, $uid, - '"System.inventory": Предмет ' . $name . ' [itm:' . $it . '] был испорчен.', - time(), $this->info['city'], 'System.inventory', 0, 0 - ); - if ($tp != 0) { - //Добавляем испорченый предмет в инвентарь, в зависимости от типа - $zzba = ''; - if ($zub > 0) { - $zzba = '|zazuby=1'; - } - $po = Conversion::dataStringToArray($this->stats['items'][$i]['data']); - if ($id2 > 0) { - if ($id2 == 4708) { - $this->addItem($id2, $uid, '|notransfer=1|nosale=1' . $zzba); - } else { - $this->addItem($id2, $uid, '|noodet=1' . $zzba); - } - } else { - if ($type == 30) { - //испорченный эликсир - $this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba); - } - } - } - } + if ($snIt > 0) { + $this->testItems($uid, $sn, 1); + } elseif ($dt == 0) { + return -2; } } @@ -6068,10 +5256,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (empty($id)) { return 0; } - $au = "select count(*) from items_users where id = $id and inOdet != 0 and `delete` = 0"; - $au .= $uid > 0 ? " and uid = $uid" : ''; - $itm = Db::getValue($au); - if (empty($itm)) { + + $sql = 'select count(*) from items_users where id = ? and inOdet != 0'; + $args = [$id]; + if ($uid > 0) { + $sql .= ' and uid = ?'; + $args[] = $uid; + } + + if (empty(Db::getValue($sql, $args))) { return 0; } Db::sql('update items_users set lastUPD = unix_timestamp(), inOdet = 0 where id = ?', [$id]); @@ -6082,62 +5275,53 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return 1; } - public function recr($id, $tp, $uid, $id2) + private function itemDestroy(int $id, int $uid = 0, int $id2 = 0): void { - if ($id != 0) { - if ($uid != 0) { - $uid2 = 'AND `uid`="' . $uid . '"'; - } else { - $uid2 = ''; - } - $upd = mysql_query( - 'UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1' - ); - if ($upd) { - $this->addDelo( - 2, $uid, - '"System.inventory": Предмет [itm:' . $it . '] был сломан.', - time(), $this->info['city'], 'System.inventory', 0, 0 - ); - if ($id2 > 1) { - //Добавляем пустую бутылку - $this->addItem($id2, $uid, 'noodet=1|noremont=1'); - } - } + if ($id == 0) { + return; } + $sql = 'delete from items_users where id = ?'; + $args = [$id]; + if ($uid > 0) { + $sql .= ' and uid = ?'; + $args[] = $uid; + } + + Db::sql($sql, $args); + + Delo::add(2, 'system.inventory', $uid, "Предмет [id:$id] был сломан."); + if ($id2 > 1) { + //Добавляем пустую бутылку + ItemsModel::addItem($id2, $uid, 'noodet=1|noremont=1'); + } + } - public function btlMagicList() + public function btlMagicList(): string { - $i = 1; - $sv = []; - while ($i <= 10) { - $sv[$i] = ''; - $i++; - } - $i = 0; - while ($i < count($this->stats['items'])) { - if ($this->stats['items'][$i]['inslot'] == 40 || $this->stats['items'][$i]['inslot'] == 51) { - if ($this->stats['items'][$i]['useInBattle'] == 0 || $this->stats['items'][$i]['btl_zd'] > 0 || $this->stats['items'][$i]['iznosNOW'] >= $this->stats['items'][$i]['iznosMAX'] || $this->stats['items'][$i]['magic_inci'] == '' || $this->stats['items'][$i]['magic_inci'] == '0') { - $vl = ' class="nopriemuse"'; - } else { - $po = Conversion::dataStringToArray($this->stats['items'][$i]['data']); - if ($po['useOnLogin'] == 1) { - $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,1,\'\',\'' . $this->stats['items'][$i]['useInBattle'] . '\');'; - } else { - $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,2);'; - } - $vl = 'style="cursor:pointer" onclick="' . $useUrl . '"'; - } - $sv[$this->stats['items'][$i]['inOdet'] - 39] = ''; + $sv = array_fill(1, 10, ''); + + foreach ($this->stats['items'] as $stat) { + if (!in_array($stat['inslot'], [40, 51])) { + continue; } - $i++; + if (empty($stat['useInBattle']) || $stat['btl_zd'] > 0 || $stat['iznosNOW'] >= $stat['iznosMAX'] || empty($stat['magic_inci'])) { + $vl = ' class="nopriemuse"'; + } else { + $po = Conversion::dataStringToArray($stat['data']); + if ($po['useOnLogin'] == 1) { + $jsvars = "'{$stat['name']}','{$stat['id']}','{$stat['img']}',1,1,'','{$stat['useInBattle']}'"; + } else { + $jsvars = "'{$stat['name']}','{$stat['id']}','{$stat['img']}',1,2"; + } + $vl = 'style="cursor:pointer" onclick="top.useMagicBattle(' . $jsvars . ')"'; + } + $iznos = "Долговечность: {$stat['iznosNOW']} / {$stat['iznosMAX']}"; + $img = Config::img() . '/i/items/' . $stat['img']; + $sv[$stat['inOdet'] - 39] = ""; } - $r = '' . + + $r = '
' . '' . '' . '' . @@ -6156,1238 +5340,120 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return str_replace('"', '\"', $r); } + /** Отрисовка коробочки персонажа с логином. */ public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array { - global $code; - - $st = false; - $rt = false; - $type_info = 1; - if ($uid != $this->info['id']) { - $u = mysql_fetch_array( - mysql_query( - 'SELECT `u`.`inTurnir`,`u`.`allLock`,`u`.`battle`,`u`.`zag`,`u`.`banned`,`u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`u`.`vip`, - `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity` - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string( - $uid - ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1' - ) - ); - if ($sn == 0) { - $sn = $this->getStats($uid, $i1); - } - } else { - $u = $this->info; - if (isset($this->stats['hpAll'])) { - $sn = $this->stats; - } elseif ($sn == 0) { - $sn = $this->getStats($uid, $i1); - } + if (empty($this->infoBox)) { + $this->infoBox = new InfoBox($this); //fixme почему-то не дружит с конструктором. } - - $tp_img = [ - 1 => 4, - 2 => 5, - 14 => 6, - 3 => 7, - 5 => 8, - 7 => 9, - 17 => 10, - 16 => 11, - 13 => 12, - 10 => 13, - 9 => 14, - 8 => 15, - 11 => 17, //кольцо 2 - 12 => 18, //кольцо 3 - ]; - - if (isset($u['id'], $u['stats'])) { - $rt = [0 => '', 1 => []]; - $st = []; - $st['id'] = $u['id']; - $st['login'] = $u['login']; - $st['lvl'] = $u['level']; - - //Характеристики от предметов и их изображение - $witm = []; - $witm[1] = ''; - $witm[2] = ''; - $witm[3] = ''; - $witm[4] = ''; - $witm[7] = ''; - $witm[8] = ''; - $witm[9] = ''; - $witm[10] = ''; - $witm[11] = ''; - $witm[12] = ''; - $witm[13] = ''; - $witm[14] = ''; - $witm[16] = ''; - $witm[17] = ''; - //40-52 слот под магию - $witm[53] = ''; - $witm[54] = ''; - $witm[55] = ''; - $witm[56] = ''; - $witm[57] = ''; - $witm[58] = ''; - $cl = mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0"' - ); - $wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false]; - $b1 = '
'; - - while ($pl = mysql_fetch_array($cl)) { - $td = Conversion::dataStringToArray($pl['data']); - - if (isset($td['modif'])) { - $pl['name'] = $pl['name'] . ' (мф)'; - } - - if (isset($td['upatack_lvl'])) { - $pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl']; - } - - if (isset($td['mod_lvl'])) { - $pl['name'] = $pl['name'] . ' ' . $mx . ' [' . $td['mod_lvl'] . ']'; - } - - if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) { - $wj[$pl['inOdet']] = $pl; - } - - $pl['name'] = $this->nameItemMf($pl, $td); - - $lvar = $this->getInfoItemInfo($pl); - - 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'] . ''; - } - - $witm[$pl['inOdet']] = ''; - - if ($i1 == 1) { - $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; - } else { - if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) { - $useUrl = ''; - if ($pl['magic_inc'] == '') { - $pl['magic_inc'] = $pl['magic_inci']; - } - if ($pl['magic_inc'] && $pl['type'] == 30) { - //используем эликсир - $pldate = '
' . $sv[1] . '' . $sv[2] . '
"' . $pl['name'] . '"
Использовать сейчас?
'; - $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; - } elseif ($pl['magic_inc'] && $pl['type'] == 29) { - //используем заклятие - //на персонажа - if (isset($td['useOnLogin'])) { - $inv1 = ''; - if (isset($_GET['inv'])) { - $inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&'; - } - $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');'; - } else { - //просто использование (на селя, либо без указания предмета\логина) - $pldate = '
"' . $pl['name'] . '"
Использовать сейчас?
'; - $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; - } - } - $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; - } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) { - //варежки - $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; - } else { - $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; - } - } - } - //Шлем,Венок - $wj1i = ''; - $br = '
'; - if ($wj[1]) { - if (!empty($wj[52])) { - $wj1i .= $br; - } - $td = []; - $td = Conversion::dataStringToArray($wj[1]['data']); - $wj[1]['name'] = $this->nameItemMf($wj[1], $td); - $wj1i .= '' . $wj[1]['name'] . ''; - $wj1i .= $this->getInfoItemInfo($wj[1]); - } - if (!empty($wj[52])) { - $td = Conversion::dataStringToArray($wj[52]['data']); - $wj[52]['name'] = $this->nameItemMf($wj[52], $td); - - - $wj1i = '' . $wj[52]['name'] . '' . $wj1i; - $wj1i .= $this->getInfoItemInfo($wj[52]); - $wj[1]['img'] = $wj[52]['img']; - $wj[1]['id'] = $wj[52]['id']; - $wj[1]['inRazdel'] = $wj[52]['inRazdel']; - } - //Рубаха,Броня,Плащ - - $wj4i = ''; - if ($wj[6]) { - $td = []; - $td = Conversion::dataStringToArray($wj[6]['data']); - $wj[6]['name'] = $this->nameItemMf($wj[6], $td); - $wj4i .= '' . $wj[6]['name'] . ''; - - $wj4i .= $this->getInfoItemInfo($wj[6]); - if ($wj[5] || $wj[4]) { - $wj4i .= $br; - } - } - if ($wj[5]) { - $wj4idd = $wj[5]['item_id']; - $td = []; - $td = Conversion::dataStringToArray($wj[5]['data']); - $wj[5]['name'] = $this->nameItemMf($wj[5], $td); - $wj4i .= '' . $wj[5]['name'] . ''; - - $wj4i .= $this->getInfoItemInfo($wj[5]); - if ($wj[4]) { - $wj4i .= $br; - } - } - if ($wj[4]) { - $td = []; - $td = Conversion::dataStringToArray($wj[4]['data']); - $wj[4]['name'] = $this->nameItemMf($wj[4], $td); - $wj4i .= '' . $wj[4]['name'] . ''; - - $wj4i .= $this->getInfoItemInfo($wj[4]); - } - - if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) { - if ($wj[5]) { - $wj[4]['img'] = $wj[5]['img']; - $wj[4]['id'] = $wj[5]['id']; - $wj[4]['inRazdel'] = $wj[5]['inRazdel']; - } - } else { - if ($wj[6]) { - $wj[4]['img'] = $wj[6]['img']; - $wj[4]['id'] = $wj[6]['id']; - $wj[4]['inRazdel'] = $wj[6]['inRazdel']; - } elseif ($wj[5]) { - $wj[4]['img'] = $wj[5]['img']; - $wj[4]['id'] = $wj[5]['id']; - $wj[4]['inRazdel'] = $wj[5]['inRazdel']; - } - } - if ($wj[1] || $wj[2]) { - if (isset($sn['items_img'][$tp_img[1]])) { - $uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]]; - } else { - $uimg = 'i/items/' . $wj[1]['img'] . ''; - } - $witm[1] = ''; - if ($i1 == 1) { - $witm[1] = '' . $witm[1] . ''; - } else { - $witm[1] = '' . $witm[1] . ''; - } - } - if ($wj[4] || $wj[5] || $wj[6]) { - if (isset($sn['items_img'][$tp_img[5]])) { - $uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]]; - } else { - $uimg = 'i/items/' . $wj[4]['img'] . ''; - } - $witm[4] = ''; - if ($i1 == 1) { - if ($wj4idd > 0 && isset($wj[4]['item_id'])) { - $wj[4]['item_id'] = $wj4idd; - } - $witm[4] = '' . $witm[4] . ''; - } else { - $witm[4] = '' . $witm[4] . ''; - } - } - /*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/ - $nmmsgl1 = 0; - if ($u['align'] >= 1 && $u['align'] < 2) { - $nmmsgl1 = 1; - } elseif ($u['align'] >= 3 && $u['align'] < 4) { - $nmmsgl1 = 3; - } elseif ($u['align'] >= 7 && $u['align'] < 8) { - $nmmsgl1 = 7; - } elseif ($u['align'] >= 50 && $u['align'] < 50) { - $nmmsgl1 = 60; - } - if ($u['admin'] > 0) { - $nmmsgl1 = 60; - } - $anan = [ - 1 => 'cat', - 2 => 'owl', - 3 => 'wisp', - 4 => 'demon', - 5 => 'dog', - 6 => 'pig', - 7 => 'dragon', - ]; - $anan2 = [ - 1 => 'Кот', - 2 => 'Сова', - 3 => 'Светляк', - 4 => 'Чертяка', - 5 => 'Пёс', - 6 => 'Свин', - 7 => 'Дракон', - ]; - $anml = ''; - if ($u['animal'] > 0) { - $an = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1' - ) - ); - if (isset($an['id'])) { - $petimg = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1' - ) - ); - if (isset($petimg['id'])) { - $anml = ''; - } else { - $anml = ''; - } - } - } - unset($anan); - - if (isset($sn['items_img'][2])) { - $msl = ''; - } else { - if ($anml == '') { - $msl = ''; - } else { - $msl = $anml; - } - } - unset($nmmsgl1); - $jf = ''; - $oi = ''; - if ($i1 != 1) { - $jf = 'main'; - $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"'; - $msl = ' - - - - - - - - - - -
' . $witm[53] . '' . $witm[55] . '' . $witm[54] . '
' . $witm[56] . '' . $witm[57] . '' . $witm[58] . '
'; - } - $hpmp = ''; - $eff = ''; - //-------- генерируем эффекты - $efs = mysql_query( - 'SELECT - `eu`.`id`, -`eu`.`id_eff`, -`eu`.`uid`, -`eu`.`tr_life_user`, -`eu`.`name`, -`eu`.`data`, -`eu`.`overType`, -`eu`.`timeUse`, -`eu`.`timeAce`, -`eu`.`user_use`, -`eu`.`delete`, -`eu`.`v1`, -`eu`.`v2`, -`eu`.`img2`, -`eu`.`x`, -`eu`.`hod`, -`eu`.`bj`, -`eu`.`sleeptime`, -`eu`.`no_Ace`, - `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` - FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string( - $u['id'] - ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC' - ); - while ($e = mysql_fetch_array($efs)) { - $esee = 1; - if ($e['see'] == 0 && $i1 == 1) { - $esee = 0; - } - if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) { - $esee = 0; - } - if ($e['see'] == 3 && $i1 == 0) { - $esee = 0; - } - if ($e['img'] == '') { - $esee = 0; - } - - if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) { - $ei = '' . $e['name'] . ''; - if ($e['type1'] > 0 && $e['type1'] < 7) { - $ei .= ' (Эликсир)'; - } elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) { - $ei .= ' (Заклятие)'; - } elseif ($e['type1'] == 14) { - $ei .= ' (Прием)'; - } elseif ($e['type1'] == 15) { - $ei .= ' (Изучение)'; - } elseif ($e['type1'] == 17) { - $ei .= ' (Проклятие)'; - } elseif ($e['type1'] == 18 || $e['type1'] == 19) { - $ei .= ' (Травма)'; - } elseif ($e['type1'] == 20) { - $ei .= ' (Пристрастие)'; - } elseif ($e['type1'] == 22) { - $ei .= ' (Ожидание)'; - } else { - $ei .= ' (Эффект)'; - } - $ei .= '
'; - - if ($e['type1'] != 13 && $e['timeUse'] != 77) { - $out = ''; - $time_still = ($e['timeUse'] + $e['timeAce'] + $e['actionTime']) - time(); - $tmp = floor($time_still / 2592000); - $id = 0; - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " мес. "; - } - $time_still = $time_still - $tmp * 2592000; - } - $tmp = floor($time_still / 604800); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " нед. "; - } - $time_still = $time_still - $tmp * 604800; - } - $tmp = floor($time_still / 86400); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " дн. "; - } - $time_still = $time_still - $tmp * 86400; - } - $tmp = floor($time_still / 3600); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " ч. "; - } - $time_still = $time_still - $tmp * 3600; - } - $tmp = floor($time_still / 60); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " мин. "; - } - } - if ($out == '') { - $out = $time_still . ' сек.'; - } - $ei .= 'Осталось: ' . $out . ''; - } - - //Действие эффекта - $tr = ''; - $t = $this->items['add']; - $x = 0; - $ed = Conversion::dataStringToArray($e['data']); - while ($x < count($t)) { - $n = $t[$x]; - if (isset($ed['add_' . $n], $this->is[$n])) { - $z = ''; - if ($ed['add_' . $n] > 0) { - $z = '+'; - } - $tr .= '
' . $this->is[$n] . ': ' . $z . '' . $ed['add_' . $n]; - } - $x++; - } - if ($tr != '') { - $ei .= $tr; - } - if ($e['info'] != '') { - $ei .= '
Информация:
' . $e['info']; - } - if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') { - $e['img'] = $e['img2']; - } - if ($e['type1'] == 18 || $e['type1'] == 19) { - $e['img'] = $e['img2']; - } - $eff .= ''; - } elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) { - //удаляем эффект - $ed = Conversion::dataStringToArray($e['data']); - if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) { - $this->endEffect($e['id'], $u); - } - } - } - - //здоровье - - $hptop = 0; - $lh = [0 => 'hp_none', 1 => 1]; - $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120); - if ($lh[1] > 0) { - $lh[0] = 'hp_1'; - } - if ($lh[1] > 32) { - $lh[0] = 'hp_2'; - } - if ($lh[1] > 65) { - $lh[0] = 'hp_3'; - } - if ($sn['mpAll'] > 0) { - //мана - $lm = [0 => 'hp_none', 1 => 1]; - $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120); - if ($lm[1] > 0) { - $lm[0] = 'hp_mp'; - } - $hpmp .= '
' . floor( - $sn['mpNow'] - ) . '/' . (0 + $sn['mpAll']) . '
-
-
-
'; - } else { - $hptop = 5; - } - $hpmp = '
' . floor( - $sn['hpNow'] - ) . '/' . (0 + $sn['hpAll']) . '
-
-
-
' . $hpmp; - //Собираем НР и МР - $hpmp = '
' . $hpmp . '
'; - - - $lgn = '' . $u['login'] . ' [' . $u['level'] . ']'; - if ($u['clan'] != 0) { - $pc = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id`="' . $u['clan'] . '" LIMIT 1' - ) - ); - $pc['img'] = $pc['name_mini'] . '.gif'; - $lgn = '' . $lgn; - } - if ($u['align2'] > 0) { - $lgn = '' . $lgn; - } - if ($u['align'] > 0) { - $lgn = '' . $lgn; - } - $pb = ''; - if ($u['banned'] > 0) { - $pb .= '
Персонаж заблокирован
'; - } - if ($u['allLock'] > time()) { - $pb .= '
Временный запрет передач!
'; - } - - $swm = 0; //свитки магии - $l = 40; - while ($l <= 52) { - if (isset($witm[$l])) { - $swm++; - } else { - $witm[$l] = ''; - } - $l++; - } - - $ssm = 0; //слоты сумки - $l = 59; - while ($l <= 62) { - if (isset($witm[$l])) { - $ssm++; - } else { - $witm[$l] = ''; - } - $l++; - } - - $witmg = ''; - - if ($ssm > 0 && $i1 == 0) { - $witmg .= ' - - - - - - -
' . $witm[59] . '' . $witm[60] . '' . $witm[61] . '' . $witm[62] . '
'; - } - - if ($swm > 0 && $i1 == 0) { - $witmg .= ' - - - - - - - - - - - - - - - - - -
' . $witm[40] . '' . $witm[41] . '' . $witm[42] . '' . $witm[43] . '' . $witm[44] . '' . $witm[50] . '
' . $witm[45] . '' . $witm[46] . '' . $witm[47] . '' . $witm[48] . '' . $witm[49] . '' . $witm[51] . '
'; - } - $zag = ''; - if ($u['zag'] != '' && $i1 == 1) { - $rt[0] .= ''; - - $zag = ''; - - $j2 = 0; - while ($j2 <= 17) { - $witm[$j2] = '
' . $witm[$j2] . '
'; - $j2++; - } - } - - if ($pb != '') { - $pb = '
' . $pb . '
'; - } - $rt[0] .= '
' . $lgn . '
' . $pb . ' -
- - - - - - -
- - - - - - - - - - - - - - - - -
' . $zag . '' . $witm[1] . '
' . $witm[2] . '
' . $witm[3] . '
' . $witm[4] . '
' . $witm[7] . '
-
- - - - - - - - - - -
- - ' . $hpmp . ' - -
'; - if ($zag == '') { - if ($i1 == 0) { - if (!isset($_GET['inv'])) { - $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; - } else { - $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; - } - } else { - $o = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string( - $this->info['obraz'] - ) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1' - ) - ); - $invg = [0 => '/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов']; - } - $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . ''; - if (isset($sn['items_img'][1])) { - $uobr = 'rimg/r' . $sn['items_img'][1]; - } - $rt[0] .= '
- -
-
' . $eff . '
' . $anml . ' -
'; - } else { - if ($i1 == 0) { - if (!isset($_GET['inv'])) { - $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; - } else { - $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; - } - } else { - $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов']; - } - $rt[0] .= '
- -
-
' . $eff . '
' . $anml . ' -
'; - } - - unset($invg); - - $rt[0] .= '
' . $msl . '
-
- - - - - - - - - - - - - - - - - - - - - - -
' . $witm[8] . '
' . $witm[9] . '
- - - - - -
' . $witm[10] . '' . $witm[11] . '' . $witm[12] . '
' . $witm[13] . '
' . $witm[14] . '
' . $witm[16] . '
' . $witm[17] . '
-
' . $witmg . '
'; - - - if ($i1 == 0 && $u['battle'] == 0) { - $rt[0] .= ''; - } - if ($ivv == 0 && $i1 == 0) { - $rt[0] .= $this->info_remont(); - } - } - return $rt; + return $this->infoBox->getInfoPers($uid, $i1, $sn, $ivv); } - public function nameItemMf($pl, $po) + + public function endEffect($id, $u): int { - $r = $pl['name']; - if (isset($po['icos'])) { - $r = '' . $pl['name'] . '  ' . $po['icos'] . ' '; - } - //if( $this->info['admin'] > 0 ) { - if (isset($po['rune']) && $po['rune'] > 0) { - $rnc = explode(' ', $po['rune_name']); - if ($rnc[0] == 'Игнис') { - $rnc = '#9b5d40'; - } elseif ($rnc[0] == 'Аква') { - $rnc = '#3a2b64'; - } elseif ($rnc[0] == 'Аура') { - $rnc = '#20a3b0'; - } elseif ($rnc[0] == 'Тера') { - $rnc = '#4c7718'; - } else { - $rnc = '#4c4c4c'; - } - $r .= '
Руна: ' . $po['rune_name'] . ''; - unset($rnc); - } - if (isset($po['spell'])) { - $rnc = explode(' ', $po['spell_name']); - if ($rnc[2] == '[0]') { - $rnc = '#282828'; - } elseif ($rnc[2] == '[1]') { - $rnc = '#624542'; - } elseif ($rnc[2] == '[2]') { - $rnc = '#77090b'; - } elseif ($rnc[2] == '[3]') { - $rnc = '#d99800'; - } else { - $rnc = '#d99800'; - } - $r .= '
' . $po['spell_name'] . ''; - unset($rnc); - } - return $r; - } + $e = Db::getRow('select id, uid, id_eff, name, sleeptime, data, type1 from eff_users left join eff_main on id_eff = id2 where id = ? and deactiveTime < unix_timestamp()', [$id]); - public function getInfoItemInfo($pl): string - { - $lvar = ''; - $td = Conversion::dataStringToArray($pl['data']); - - if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) { - $lvar .= '
Урон: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . ''; - } - if (isset($td['add_mab1']) && $td['add_mab1'] > 0) { - if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab1'] < 0) { - $m1l = ''; - } - $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; - } else { - $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; - } - } - // - $t = $this->items['add']; - $x = 0; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($td['add_' . $n], $this->is[$n])) { - $z = '+'; - if ($td['add_' . $n] < 0) { - $z = ''; - } - $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['add_' . $n]; - } - $x++; - } - // - $x = 0; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($td['sv_' . $n])) { - $z = '+'; - if ($td['sv_' . $n] < 0) { - $z = ''; - } - if ($n != 'yron_min' && $n != 'yron_max') { - $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['sv_' . $n]; - } - } - $x++; - } - if ($pl['2h'] == 1) { - $lvar .= '
• Двуручное оружие'; - } - if (isset($po['zonb'])) { - $lvar .= '
Зоны блокирования: '; - if ($lvar['zonb'] > 0) { - $x = 1; - while ($x <= $td['zonb']) { - $lvar .= '+'; - $x++; - } - } else { - $lvar .= '—'; - } - } - - // - if (isset($td['add_mab2']) && $td['add_mab2'] > 0) { - if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab2'] < 0) { - $m1l = ''; - } - $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; - } else { - $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; - } - } - if (isset($td['add_mab3']) && $td['add_mab3'] > 0) { - if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab3'] < 0) { - $m1l = ''; - } - $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; - } else { - $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; - } - } - if (isset($td['add_mab4']) && $td['add_mab4'] > 0) { - if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab4'] < 0) { - $m1l = ''; - } - $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; - } else { - $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; - } - } - if ($pl['iznosMAX'] > 0) { - $lvar .= '
Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']); - } - - if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) { - $lvar .= '
Задержка использования: ' . Conversion::secondsToTimeout($po['battleUseZd']); - } - - if (isset($td['gravi'])) { - $lvar .= '
"' . $td['gravi'] . '"'; - } - - return $lvar; - } - - public function endEffect($id, $u, $test = null): int - { - if (!$test) { - $test = 0; - } - - $e = mysql_fetch_array( - mysql_query( - 'SELECT - `eu`.`id`, -`eu`.`tr_life_user`, -`eu`.`id_eff`, -`eu`.`uid`, -`eu`.`name`, -`eu`.`data`, -`eu`.`overType`, -`eu`.`timeUse`, -`eu`.`timeAce`, -`eu`.`user_use`, -`eu`.`delete`, -`eu`.`v1`, -`eu`.`v2`, -`eu`.`img2`, -`eu`.`x`, -`eu`.`hod`, -`eu`.`bj`, -`eu`.`sleeptime`, -`eu`.`no_Ace`, - `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` - FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`id`="' . mysql_real_escape_string( - $id - ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '"' - ) - ); - - if (isset($e['id'])) { - $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1); - if ($e['id_eff'] == 2) { - //Проверка - $ev = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string( - str_replace('Изучение: ', '', $e['name']) - ) . '" LIMIT 1' - ) - ); - $et = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `actions` WHERE `uid` = "' . $e['uid'] . '" AND `vars` LIKE "%read%" AND `vals` = "' . $ev['id'] . '" LIMIT 1' - ) - ); - if (isset($et['id'])) { - if ($et['time'] < time()) { - $et = false; - } else { - $et = true; - } - } else { - $et = false; - } - } else { - $et = false; - } - if (!$et && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') { - $upd = mysql_query( - 'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1' - ); - if ($upd) { - $po = Conversion::dataStringToArray($e['data']); - if (isset($po['finish_file'])) { - if (file_exists('_incl_data/class/Magic/' . $po['finish_file'] . '.php')) { - require('_incl_data/class/Magic/' . $po['finish_file'] . '.php'); - } else { - $this->error2 = '!File not exists "cgi-bin/magic.pl?use_' . $po['finish_file'] . '".'; - } - } - if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) { - $text = "Закончилось действие эффекта «{$e['name']}»"; - $cmsg = new ChatMessage(); - $cmsg->setCity($u['city']); - $cmsg->setRoom($u['room']); - $cmsg->setTo($u['login']); - $cmsg->setText($text); - $cmsg->setType(6); - (new Chat())->sendMsg($cmsg); - - if ($u['battle'] > 0) { - $lastHOD = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $u['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1' - ) - ); - if (isset($lastHOD['id'])) { - $id_hod = $lastHOD['id_hod']; - if ($lastHOD['type'] != 6) { - $id_hod++; - } - mysql_query( - 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' у персонажа {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")' - ); - } - } - } - return 1; - } else { - return 0; - } - } else { - return 0; - } - } else { + if (!isset($e['id'])) { return 0; } + + $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1); + + if ($e['id_eff'] == 2) { + //Проверка + $et = Db::getRow("select id, time from actions where uid = ? and vars like '%read%' and vals = (select id from items_main where name = ? limit 1)", + [$e['uid'], str_replace('Изучение: ', '', $e['name'])]); + + $et = isset($et['id']) && $et['time'] >= time(); + } else { + $et = false; + } + + if ($et || $e['sleeptime'] != 0 || $sleep['vars'] == 'sleep') { + return 0; + } + + Effects::removeById($e['uid'], $e['id']); + + $po = Conversion::dataStringToArray($e['data']); + if (isset($po['finish_file']) && file_exists('_incl_data/class/Magic/' . $po['finish_file'] . '.php')) { + require_once '_incl_data/class/Magic/' . $po['finish_file'] . '.php'; + } + if (isset($u['id']) && ($e['type1'] < 11 || $e['type1'] > 16 && $e['type1'] < 23) && $e['noch'] == 0) { + $text = "Закончилось действие эффекта «{$e['name']}»"; + $cmsg = new ChatMessage(); + $cmsg->setRoom($u['room']); + $cmsg->setTo($u['login']); + $cmsg->setText($text); + $cmsg->setType(6); + (new Chat())->sendMsg($cmsg); + + if ($u['battle'] > 0) { + $lastHOD = Db::getValue('select if(type != 6, id_hod + 1, id_hod) as id_hod from battle_logs where battle = ? order by id_hod desc limit 1', [$u['battle']]); + if (!empty($lastHOD)) { + Db::sql("insert into battle_logs (time, battle, id_hod, text, vars, zona1, zonb1, zona2, zonb2, type) values (unix_timestamp(),?,?,?,?,'','','','',6)", + [$u['battle'], $lastHOD, "{tm1}$text у игрока {u1}", "login1={$u['login']}||t1={$u['team']}||time=" . time()]); + } + } + } + return 1; } public function info_remont(): string { $r = ''; - $sp = mysql_query( - 'SELECT `im`.`name`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX` - FROM `items_users` AS `iu` - LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) - WHERE - `iu`.`uid` = ' . ($this->info['id']) . ' AND - `iu`.`delete` = 0 AND - `iu`.`inShop` = 0 AND - `iu`.`inOdet` > 0 AND - `iu`.`inOdet` < 18 - LIMIT 18' - ); - while ($pl = mysql_fetch_array($sp)) { + $sp = Db::getRows('select iznosNOW, iznosMAX, name from items_users left join items_main on item_id = items_main.id where uid = ? and inShop = 0 and inOdet between 1 and 18 limit 18', + [$this->info['id']]); + foreach ($sp as $pl) { if ($pl['iznosNOW'] <= ceil($pl['iznosMAX'] * 0.80)) { continue; } $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '] требуется ремонт
'; } - return '
' . $r . '
'; + return '
' . $r . '
'; } public function snatItemAll(int $uid): int { - $upd = mysql_query( - 'UPDATE `items_users` SET `lastUPD`= unix_timestamp(),`inOdet`=0 WHERE `uid`=' . $uid . ' AND `inOdet`!= 0 AND `delete`= 0 LIMIT 100' - ); - return $upd ? 1 : 0; + if ($uid < 1) { + return 0; + } + Db::sql('update items_users set lastUPD = unix_timestamp(), inOdet = 0 where inOdet != 0 and uid = ?', [$uid]); + return 1; } public function odetItem(int $id, int $uid) { - if ($uid != 0) { - $au = 'AND `iu`.`uid` = "' . $uid . '"'; - } else { - $au = ''; - } + $sql = "select items_users.id, data, 2price, inGroup, gift, gtxt1, `group`, price2, name, type, inslot, 2too, 2h + from items_users + left join items_main on item_id = items_main.id + where items_users.id = ? and inOdet = 0 and inShop = 0"; + $args = [$id]; + + if ($uid) { + $sql .= ' and items_users.uid = ?'; + $args[] = $uid; + } + $itm = Db::getRow($sql, $args); + unset($sql, $args); - $itm = mysql_fetch_array( - mysql_query( - 'SELECT - `im`.`id`, -`im`.`name`, -`im`.`img`, -`im`.`type`, -`im`.`inslot`, -`im`.`2h`, -`im`.`2too`, -`im`.`iznosMAXi`, -`im`.`inRazdel`, -`im`.`price1`, -`im`.`price2`, -`im`.`pricerep`, -`im`.`magic_chance`, -`im`.`info`, -`im`.`massa`, -`im`.`level`, -`im`.`magic_inci`, -`im`.`overTypei`, -`im`.`group`, -`im`.`group_max`, -`im`.`geni`, -`im`.`ts`, -`im`.`srok`, -`im`.`class`, -`im`.`class_point`, -`im`.`anti_class`, -`im`.`anti_class_point`, -`im`.`max_text`, -`im`.`useInBattle`, -`im`.`lbtl`, -`im`.`lvl_itm`, -`im`.`lvl_exp`, -`im`.`lvl_aexp`, - `iu`.`id`, -`iu`.`item_id`, -`iu`.`1price`, -`iu`.`2price`, -`iu`.`uid`, -`iu`.`use_text`, -`iu`.`data`, -`iu`.`inOdet`, -`iu`.`inShop`, -`iu`.`delete`, -`iu`.`iznosNOW`, -`iu`.`iznosMAX`, -`iu`.`gift`, -`iu`.`gtxt1`, -`iu`.`gtxt2`, -`iu`.`kolvo`, -`iu`.`geniration`, -`iu`.`magic_inc`, -`iu`.`maidin`, -`iu`.`lastUPD`, -`iu`.`timeOver`, -`iu`.`overType`, -`iu`.`secret_id`, -`iu`.`time_create`, -`iu`.`time_sleep`, -`iu`.`inGroup`, -`iu`.`dn_delete`, -`iu`.`inTransfer`, -`iu`.`post_delivery`, -`iu`.`lbtl_`, -`iu`.`bexp`, -`iu`.`so`, -`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`=' . $id . ' AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1' - ) - ); if (isset($itm['id'])) { if ($itm['group'] == 1 && $this->itemsX($itm['id']) > 1) { $this->unstack($itm['id'], 1); } - $tr = Conversion::dataStringToArray($itm['data']); $notr = $this->trItem($tr); $msb = ''; - if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) { - $test = mysql_fetch_array( - mysql_query( - 'SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` > 0 AND `delete` = 0 AND `data` LIKE "%maks_itm_one=' . $tr['maks_itm_one'] . '%" LIMIT 1' - ) - ); - if (isset($test['id'])) { - $this->error = 'Возможное использование максимум одного предмета!'; - $notr++; - } + if ( + isset($tr['maks_itm_one']) && + $tr['maks_itm_one'] > 0 && + Db::getValue('select true from items_users where uid = ? and inOdet > 0 and data like ? limit 1', [$this->info['id'], "%maks_itm_one={$tr['maks_itm_one']}%"]) + ) { + $this->error = 'Возможное использование максимум одного предмета!'; + $notr++; } if ($this->info['twink'] > 0) { //Не дороже 100 екр. @@ -7431,21 +5497,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($notr > 0) { //Не хватает характеристик или не совпадают условия - if (isset($tr['open']) && isset($_GET['open'])) { - $this->error = 'Вы не можете открыть данный предмет'; - } else { - $this->error = 'Нельзя одеть больше одного предмета данного типа'; - } + $this->error = isset($tr['open']) && isset($_GET['open']) ? 'Вы не можете открыть данный предмет' : 'Нельзя одеть больше одного предмета данного типа'; return 0; } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) { $io = ''; if ($itm['inGroup'] > 0) { - mysql_query( - 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' - ); + Db::sql('update items_users set lastUPD = unix_timestamp(), inGroup = 0 where id = ?', [$itm['id']]); } if (file_exists('_incl_data/class/Magic/' . $tr['items_in_file'] . '.php')) { - require('_incl_data/class/Magic/' . $tr['items_in_file'] . '.php'); + require_once '_incl_data/class/Magic/' . $tr['items_in_file'] . '.php'; if (!isset($no_open_itm)) { $this->deleteItem($itm['id'], $this->info['id']); $this->error = 'Вы успешно открыли "' . $itm['name'] . '":
' . $io . '...'; @@ -7464,13 +5524,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if ($itm['type'] == 37) { //Распаковываем упаковку - $itmin = mysql_fetch_array( - mysql_query('SELECT * FROM `items_users` WHERE `id` = "' . $tr['item_inbox'] . '" LIMIT 1') - ); - $itmmn = mysql_fetch_array( - mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $itmin['item_id'] . '" LIMIT 1') - ); + $itmin = Db::getRow('select * from items_users where id = ?', [$tr['item_inbox']]); + $itmmn = Db::getRow('select * from items_main where id = ?', [$itmin['item_id']]); // + if ($itm['gift'] == '' || $itm['gift'] == '0') { $this->error = 'Предмет должен быть подарен, прежде чем его открывать!'; } elseif (!isset($itmin['id'])) { @@ -7484,39 +5541,25 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $this->error = 'Не удалось открыть подарок. Содержимое испорчено.'; } elseif ($itmin['item_id'] == 4868) { //Летучая мышь - mysql_query( - 'UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); + Db::sql('update stats set hpNow = 1, mpNow = 1 where id = ?', [$this->info['id']]); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); $this->error = 'Вы потеряли все HP...'; } elseif ($itmin['item_id'] == 4870) { //Минута молчания - if ($this->info['molch1'] > time()) { - $this->info['molch1'] += 3600; - } else { - $this->info['molch1'] = time() + 3600; - } - mysql_query( - 'UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); + Db::sql('update users set molch1 = if(molch1 > unix_timestamp(), molch1 + 3600, unix_timestamp() + 3600) where id = ?', [$this->info['id']]); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); $this->error = 'Вы оказались под действие заклятия молчания...'; } elseif ($itmin['item_id'] == 4873) { //Крысиный яд - $a = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1' - ) - ); + + $a = Db::getValue('select name from users_animal where uid = ? and id = ? and pet_in_cage = 0', [$this->info['id'], $this->info['animal']]); $this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itmin['id'], $this->info['id']); - if (isset($a['id'])) { - $this->error = 'Ваш зверь "' . $a['name'] . '" странно позеленел...'; - mysql_query( - 'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1' - ); + if ($a) { + $this->error = 'Ваш зверь "' . $a . '" странно позеленел...'; + Db::sql('update users_animal set eda = 0, yad = unix_timestamp() + 7 * 86400 where id = ?', [$this->info['animal']]); } else { $this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)'; } @@ -7633,7 +5676,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` if (isset($s['id'])) { $j = 1; while ($j <= $x) { - $pid = $this->addItem($s['id'], $this->info['id']); + $pid = ItemsModel::addItem($s['id'], $this->info['id']); if ($pid > 0) { mysql_query( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' @@ -7872,7 +5915,7 @@ LIMIT 1' } } - public function trItem($po) + private function trItem($po) { $tr = ''; $t = $this->items['tr']; @@ -7927,57 +5970,55 @@ LIMIT 1' $col = $this->itemsX($itm['id']); if ($col > 1) { if ($col <= $coldel) { - $upd = mysql_query( + mysql_query( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1' ); } - $upd = mysql_query( + mysql_query( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel ); } else { //Удаляем целиком - $upd = mysql_query( + mysql_query( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1' ); - $upd = mysql_query( + mysql_query( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col ); } } - if ($upd) { - if (isset($_GET['deleteall7'])) { - $st = Conversion::dataStringToArray($itm['data']); - $whr = ''; - if (isset($st['frompisher'])) { - $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"'; - } - $col = mysql_fetch_array( - mysql_query( - 'SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr - ) - ); - $col = $col[0]; - mysql_query( - 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr - ); - $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены'; - $this->addDelo( - 1, $uid, - '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(), - $this->info['city'], 'System.inventory', 0, 0 - ); - } else { - $this->error = 'Предмет "' . $itm['name'] . '" выброшен'; - $this->addDelo( - 1, $uid, - '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.', - time(), $this->info['city'], 'System.inventory', 0, 0 - ); + + if (isset($_GET['deleteall7'])) { + $st = Conversion::dataStringToArray($itm['data']); + $whr = ''; + if (isset($st['frompisher'])) { + $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"'; } - return 1; + $col = mysql_fetch_array( + mysql_query( + 'SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr + ) + ); + $col = $col[0]; + mysql_query( + 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr + ); + $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены'; + $this->addDelo( + 1, $uid, + '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(), + $this->info['city'], 'System.inventory', 0, 0 + ); } else { - return 0; + $this->error = 'Предмет "' . $itm['name'] . '" выброшен'; + $this->addDelo( + 1, $uid, + '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.', + time(), $this->info['city'], 'System.inventory', 0, 0 + ); } + return 1; + } else { $this->error = 'Предмет не найден в вашем рюкзаке'; } @@ -7993,7 +6034,7 @@ LIMIT 1' //upexpdate if ($this->info['upexpdate'] == 0) { $this->info['upexpdate'] = time(); - Db::sql('update stats set upexpdate = unix_timestamp() where id = ?)', [$this->info['id']]); + Db::sql('update stats set upexpdate = unix_timestamp() where id = ?', [$this->info['id']]); } elseif (time() >= ($this->info['upexpdate'] + 400 * 60 * 60 * 24)) { $this->info['upexpdate'] = time(); $this->info['expstopu'] = $this->info['expstopu'] + 1; @@ -8135,7 +6176,6 @@ LIMIT 1' $cmsg = new ChatMessage(); $cmsg->setRoom($this->info['room']); - $cmsg->setCity($this->info['city']); $cmsg->setTo($rlog['login']); $cmsg->setType(6); @@ -8250,7 +6290,6 @@ LIMIT 1' $chat = new Chat(); $cmsg = new ChatMessage(); $cmsg->setRoom($this->info['room']); - $cmsg->setCity($this->info['city']); $cmsg->setType(6); if ($this->info['level'] == 4 || $this->info['level'] == 8) { @@ -8362,10 +6401,11 @@ LIMIT 1' //получаем уровень - public function addEkr($amount, $uid = 0) + public function addEkr($amount, $uid = 0): void { if ($uid === 0) { $uid = $this->info['id']; + $this->info['money2'] += $amount; } Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]); } @@ -8375,7 +6415,7 @@ LIMIT 1' return number_format($v, 2, '.', ' '); } - public function addVoinstvennost($amount, $uid = 0) + public function addVoinstvennost($amount, $uid = 0): void { if ($uid === 0) { $uid = $this->info['id']; @@ -8384,8 +6424,6 @@ LIMIT 1' } /** - * Эта функция сломана! Формулы hp и mp в любых условиях выдают числа около 1000 за раз, в результате - * любое восстановление - практически моментальное. 12.07.2022 Инс. * @param $uid * @param $st * @param $i1 @@ -8394,7 +6432,7 @@ LIMIT 1' public function regen($uid, $st, $i1): array { if ($uid != $this->info['id']) { - $where = is_numeric($uid) ? "`u`.`id` = $uid" : "`u`.`login` = $uid"; + $where = is_numeric($uid) ? "users.id = $uid" : "login = $uid"; $u = Db::getRow("select battle, stats.* from users left join stats on users.id = stats.id where $where"); if (!isset($st['hpAll'])) { $st = $this->getStats($uid, $i1); @@ -8408,8 +6446,8 @@ LIMIT 1' return [0, 0]; } - $sth = $u['minHP']; //Стандартное время восстановления в минутах HP - $stm = $u['minMP']; //Стандартное время восстановления в минутах MP + $sth = $u['minHP'] ?: 300; //Стандартное время восстановления в минутах HP + $stm = $u['minMP'] ?: 300; //Стандартное время восстановления в минутах MP if (empty($st['speedhp'])) { $st['speedhp'] = 0; } @@ -8528,7 +6566,7 @@ LIMIT 1' return $r; } - public function rem_itm_cl($user, $cl, $type) + public function rem_itm_cl($user, $cl, $type): void { $itms = mysql_query( 'SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")' @@ -8547,7 +6585,7 @@ LIMIT 1' } unset($po['toclan']); $pl['data'] = Conversion::arrayToDataString($po); - $col = $this->itemsX(((int)$pl['id'])); + $col = $this->itemsX((int)$pl['id']); $it_n = mysql_fetch_array( mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"') ); @@ -8572,21 +6610,6 @@ LIMIT 1' } } - public function roomInfo($id, $short = false): array - { - $select = $short ? ' `id`, `name`, `code`, `city`, `timeGO`, `level`,`roomGo` ' : ' * '; - $roomInfo = mysql_fetch_array( - mysql_query('SELECT ' . $select . ' FROM `room` WHERE `id` = "' . $id . '" LIMIT 1') - ); - if ($roomInfo['roomGo']) { - $roomInfo['roomGo'] = explode(',', $roomInfo['roomGo']); - } - if ($roomInfo['level']) { - $roomInfo['level'] = explode('-', $roomInfo['level']); - } - return $roomInfo; - } - public function isModerator(): bool { return $this->isAdmin() || $this->info['align'] > 3 && $this->info['align'] < 4; diff --git a/_incl_data/class/User/Effects.php b/_incl_data/class/User/Effects.php index 4819045d..022cb8d7 100644 --- a/_incl_data/class/User/Effects.php +++ b/_incl_data/class/User/Effects.php @@ -7,7 +7,7 @@ use Model\Effect; class Effects { - public static function addCustom(array $values) + public static function addCustom(array $values): void { $sql = ' insert into eff_users @@ -92,6 +92,7 @@ insert into eff_users /** Дать игроку эффект. * @param int $uid id игрока * @param int $id id эффекта + * @param bool $ignoreLimits * @return bool */ public static function addById(int $uid, int $id, bool $ignoreLimits = false): bool @@ -129,7 +130,7 @@ insert into eff_users public static function hasInjury(int $uid): bool { - return Db::getValue('select count(*) from eff_users where id_eff in (4,5) and `delete` = 0 and uid = ?', [$uid]) > 0; + return Db::getValue('select count(*) from eff_users where id_eff in (4,5,6) and `delete` = 0 and uid = ?', [$uid]) > 0; } public static function hasAddiction(int $addictionId, int $uid): bool // пристрастие @@ -157,7 +158,7 @@ insert into eff_users return Db::getValue('select count(*) from eff_users where id_eff in (479, 480, 481) and `delete` = 0 and uid = ?', [$targetId]) > 0; } - public static function giveAttackImmunity(int $userId) + public static function giveAttackImmunity(int $userId): void { Db::sql("insert into eff_users (no_Ace, id_eff, overType, uid, name, data, timeUse) values (1,479,112,?,'Защита от нападения','zashitatk=1',unix_timestamp())", [$userId]); } @@ -175,4 +176,14 @@ insert into eff_users values (22,?,'Спасение','add_spasenie=1',101,77,?,'priem',324,'preservation.gif','спасение',1)", [$id, $id]); } + + public static function getActive(int $userId): array + { + return Db::getRows('select * from eff_users where uid = ?', [$userId]); + } + + public static function getAllInjuries(int $uid): array + { + return Db::getRows('select * from eff_users where uid = ? and id_eff in (4,5,6) order by id_eff', [$uid]); + } } diff --git a/_incl_data/class/User/InfoBox.php b/_incl_data/class/User/InfoBox.php new file mode 100644 index 00000000..d48bb5fd --- /dev/null +++ b/_incl_data/class/User/InfoBox.php @@ -0,0 +1,791 @@ +user = $user; + $this->info = $user->info; + $this->is = $user->is; + } + + public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array + { + global $code; + + $st = false; + $rt = []; + $type_info = 1; + if ($uid != $this->info['id']) { + $u = User::getInfo($uid); + + if ($sn == 0) { + $sn = $this->user->getStats($uid, $i1); + } + } else { + $u = $this->info; + if (isset($this->user->stats['hpAll'])) { + $sn = $this->user->stats; + } elseif ($sn == 0) { + $sn = $this->user->getStats($uid, $i1); + } + } + + $tp_img = [ + 1 => 4, + 2 => 5, + 14 => 6, + 3 => 7, + 5 => 8, + 7 => 9, + 17 => 10, + 16 => 11, + 13 => 12, + 10 => 13, + 9 => 14, + 8 => 15, + 11 => 17, //кольцо 2 + 12 => 18, //кольцо 3 + ]; + + if (isset($u['id'], $u['stats'])) { + $rt = [0 => '', 1 => []]; + $st = []; + $st['id'] = $u['id']; + $st['login'] = $u['login']; + $st['lvl'] = $u['level']; + + //Характеристики от предметов и их изображение + $witm = []; + $witm[1] = ''; + $witm[2] = ''; + $witm[3] = ''; + $witm[4] = ''; + $witm[7] = ''; + $witm[8] = ''; + $witm[9] = ''; + $witm[10] = ''; + $witm[11] = ''; + $witm[12] = ''; + $witm[13] = ''; + $witm[14] = ''; + $witm[16] = ''; + $witm[17] = ''; + //40-52 слот под магию + $witm[53] = ''; + $witm[54] = ''; + $witm[55] = ''; + $witm[56] = ''; + $witm[57] = ''; + $witm[58] = ''; + $wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false]; + + $cl = Db::getRows('select items_users.id, name, img, type, inRazdel, info, level, magic_inci, class, item_id, uid, data, inOdet, magic_inc, overType + from items_users left join items_main on items_main.id = item_id where inOdet > 0 and uid = ?', [$u['id']]); + + + foreach ($cl as $pl) { + $td = Conversion::dataStringToArray($pl['data']); + + if (isset($td['modif'])) { + $pl['name'] = $pl['name'] . ' (мф)'; + } + + if (isset($td['upatack_lvl'])) { + $pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl']; + } + + if (isset($td['mod_lvl'])) { + $pl['name'] = $pl['name'] . ' [' . $td['mod_lvl'] . ']'; + } + + if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) { + $wj[$pl['inOdet']] = $pl; + } + + $pl['name'] = $this->nameItemMf($pl, $td); + + $lvar = $this->getInfoItemInfo($pl, $td); + + 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']; + } + + $witm[$pl['inOdet']] = ''; + + if ($i1 == 1) { + $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; + } else { + if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) { + $useUrl = ''; + if ($pl['magic_inc'] == '') { + $pl['magic_inc'] = $pl['magic_inci']; + } + if ($pl['magic_inc'] && $pl['type'] == 30) { + //используем эликсир + $pldate = '
"' . $pl['name'] . '"
Использовать сейчас?
'; + $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; + } elseif ($pl['magic_inc'] && $pl['type'] == 29) { + //используем заклятие + //на персонажа + if (isset($td['useOnLogin'])) { + $inv1 = ''; + if (isset($_GET['inv'])) { + $inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&'; + } + $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');'; + } else { + //просто использование (на селя, либо без указания предмета\логина) + $pldate = '
"' . $pl['name'] . '"
Использовать сейчас?
'; + $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');'; + } + } + $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; + } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) { + //варежки + $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; + } else { + $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . ''; + } + } + } + //Шлем,Венок + $wj1i = ''; + $br = '
'; + if ($wj[1]) { + if (!empty($wj[52])) { + $wj1i .= $br; + } + $td = Conversion::dataStringToArray($wj[1]['data']); + $wj[1]['name'] = $this->nameItemMf($wj[1], $td); + $wj1i .= '' . $wj[1]['name'] . ''; + $wj1i .= $this->getInfoItemInfo($wj[1], $td); + } + if (!empty($wj[52])) { + $td = Conversion::dataStringToArray($wj[52]['data']); + $wj[52]['name'] = $this->nameItemMf($wj[52], $td); + + + $wj1i = '' . $wj[52]['name'] . '' . $wj1i; + $wj1i .= $this->getInfoItemInfo($wj[52], $td); + $wj[1]['img'] = $wj[52]['img']; + $wj[1]['id'] = $wj[52]['id']; + $wj[1]['inRazdel'] = $wj[52]['inRazdel']; + } + //Рубаха,Броня,Плащ + + $wj4i = ''; + if ($wj[6]) { + $td = Conversion::dataStringToArray($wj[6]['data']); + $wj[6]['name'] = $this->nameItemMf($wj[6], $td); + $wj4i .= '' . $wj[6]['name'] . ''; + + $wj4i .= $this->getInfoItemInfo($wj[6], $td); + if ($wj[5] || $wj[4]) { + $wj4i .= $br; + } + } + if ($wj[5]) { + $wj4idd = $wj[5]['item_id']; + $td = Conversion::dataStringToArray($wj[5]['data']); + $wj[5]['name'] = $this->nameItemMf($wj[5], $td); + $wj4i .= '' . $wj[5]['name'] . ''; + + $wj4i .= $this->getInfoItemInfo($wj[5], $td); + if ($wj[4]) { + $wj4i .= $br; + } + } + if ($wj[4]) { + $td = []; + $td = Conversion::dataStringToArray($wj[4]['data']); + $wj[4]['name'] = $this->nameItemMf($wj[4], $td); + $wj4i .= '' . $wj[4]['name'] . ''; + + $wj4i .= $this->getInfoItemInfo($wj[4], $td); + } + + if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) { + if ($wj[5]) { + $wj[4]['img'] = $wj[5]['img']; + $wj[4]['id'] = $wj[5]['id']; + $wj[4]['inRazdel'] = $wj[5]['inRazdel']; + } + } else { + if ($wj[6]) { + $wj[4]['img'] = $wj[6]['img']; + $wj[4]['id'] = $wj[6]['id']; + $wj[4]['inRazdel'] = $wj[6]['inRazdel']; + } elseif ($wj[5]) { + $wj[4]['img'] = $wj[5]['img']; + $wj[4]['id'] = $wj[5]['id']; + $wj[4]['inRazdel'] = $wj[5]['inRazdel']; + } + } + if ($wj[1] || $wj[2]) { + if (isset($sn['items_img'][$tp_img[1]])) { + $uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]]; + } else { + $uimg = 'i/items/' . $wj[1]['img']; + } + $witm[1] = ''; + if ($i1 == 1) { + $witm[1] = '' . $witm[1] . ''; + } else { + $witm[1] = '' . $witm[1] . ''; + } + } + if ($wj[4] || $wj[5] || $wj[6]) { + if (isset($sn['items_img'][$tp_img[5]])) { + $uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]]; + } else { + $uimg = 'i/items/' . $wj[4]['img']; + } + $witm[4] = ''; + if ($i1 == 1) { + if ($wj4idd > 0 && isset($wj[4]['item_id'])) { + $wj[4]['item_id'] = $wj4idd; + } + $witm[4] = '' . $witm[4] . ''; + } else { + $witm[4] = '' . $witm[4] . ''; + } + } + /*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/ + $nmmsgl1 = 0; + if ($u['align'] >= 1 && $u['align'] < 2) { + $nmmsgl1 = 1; + } elseif ($u['align'] >= 3 && $u['align'] < 4) { + $nmmsgl1 = 3; + } elseif ($u['align'] >= 7 && $u['align'] < 8) { + $nmmsgl1 = 7; + } elseif ($u['align'] >= 50 || $u['admin'] > 0) { + $nmmsgl1 = 60; + } + + $anan = [ + 1 => 'cat', + 2 => 'owl', + 3 => 'wisp', + 4 => 'demon', + 5 => 'dog', + 6 => 'pig', + 7 => 'dragon', + ]; + $anan2 = [ + 1 => 'Кот', + 2 => 'Сова', + 3 => 'Светляк', + 4 => 'Чертяка', + 5 => 'Пёс', + 6 => 'Свин', + 7 => 'Дракон', + ]; + $anml = ''; + if ($u['animal'] > 0) { + $an = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1' + ) + ); + if (isset($an['id'])) { + $petimg = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1' + ) + ); + if (isset($petimg['id'])) { + $anml = ''; + } else { + $anml = ''; + } + } + } + + + if (isset($sn['items_img'][2])) { + $msl = ''; + } else { + if ($anml == '') { + $msl = ''; + } else { + $msl = $anml; + } + } + + $oi = ''; + if ($i1 != 1) { + $jf = 'main'; + $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"'; + $msl = ' + + + + + + + + + + +
' . $witm[53] . '' . $witm[55] . '' . $witm[54] . '
' . $witm[56] . '' . $witm[57] . '' . $witm[58] . '
'; + } + $hpmp = ''; + $eff = ''; + //-------- генерируем эффекты + + $efs = Db::getRows('select id, uid, img, img2, timeUse, timeAce, info, name, data, type1, see, actionTime + from eff_users left join eff_main on id_eff = id2 where uid = ? and deactiveTime < unix_timestamp() order by deactiveTime desc, timeUse', + [$u['id']]); + + foreach ($efs as $e) { + $esee = 1; + if ($e['see'] == 0 && $i1 == 1) { + $esee = 0; + } + if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) { + $esee = 0; + } + if ($e['see'] == 3 && $i1 == 0) { + $esee = 0; + } + if ($e['img'] == '') { + $esee = 0; + } + + if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) { + $ei = '' . $e['name'] . ''; + + match (true) { + $e['type1'] > 0 && $e['type1'] < 7 => $ei .= ' (Эликсир)', + $e['type1'] > 6 && $e['type1'] < 11 || $e['type1'] == 16 => $ei .= ' (Заклятие)', + $e['type1'] == 14 => $ei .= ' (Прием)', + $e['type1'] == 15 => $ei .= ' (Изучение)', + $e['type1'] == 17 => $ei .= ' (Проклятие)', + $e['type1'] == 18 || $e['type1'] == 19 => $ei .= ' (Травма)', + $e['type1'] == 20 => $ei .= ' (Пристрастие)', + $e['type1'] == 22 => $ei .= ' (Ожидание)', + default => $ei .= ' (Эффект)', + }; + + + $ei .= '
'; + + if ($e['type1'] != 13 && $e['timeUse'] != 77) { + $ei .= 'Осталось: ' . Conversion::secondsToTimeout($e['timeUse'] + $e['timeAce'] + $e['actionTime'] - time()); + } + + //Действие эффекта + $tr = ''; + $t = $this->user->items['add']; + $x = 0; + $ed = Conversion::dataStringToArray($e['data']); + while ($x < count($t)) { + $n = $t[$x]; + if (isset($ed['add_' . $n], $this->is[$n])) { + $z = ''; + if ($ed['add_' . $n] > 0) { + $z = '+'; + } + $tr .= '
' . $this->is[$n] . ': ' . $z . $ed['add_' . $n]; + } + $x++; + } + if ($tr != '') { + $ei .= $tr; + } + if ($e['info'] != '') { + $ei .= '
Информация:
' . $e['info']; + } + if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') { + $e['img'] = $e['img2']; + } + if ($e['type1'] == 18 || $e['type1'] == 19) { + $e['img'] = $e['img2']; + } + $eff .= ''; + } elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) { + //удаляем эффект + $ed = Conversion::dataStringToArray($e['data']); + if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) { + $this->user->endEffect($e['id'], $u); + } + } + } + + //здоровье + + $hptop = 0; + $lh = [0 => 'hp_none', 1 => 1]; + $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120); + if ($lh[1] > 0) { + $lh[0] = 'hp_1'; + } + if ($lh[1] > 32) { + $lh[0] = 'hp_2'; + } + if ($lh[1] > 65) { + $lh[0] = 'hp_3'; + } + if ($sn['mpAll'] > 0) { + //мана + $lm = [0 => 'hp_none', 1 => 1]; + $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120); + if ($lm[1] > 0) { + $lm[0] = 'hp_mp'; + } + $hpmp .= '
' . + floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
+
+ +
+
+
+
'; + } else { + $hptop = 5; + } + $hpmp = '
' . floor( + $sn['hpNow'] + ) . '/' . (0 + $sn['hpAll']) . '
+
+
+
' . $hpmp; + //Собираем НР и МР + $hpmp = "
$hpmp
"; + + $pb = ''; + if ($u['banned'] > 0) { + $pb .= '
Персонаж заблокирован
'; + } + if ($u['allLock'] > time()) { + $pb .= '
Временный запрет передач!
'; + } + + $swm = 0; //свитки магии + $l = 40; + while ($l <= 52) { + if (isset($witm[$l])) { + $swm++; + } else { + $witm[$l] = ''; + } + $l++; + } + + $ssm = 0; //слоты сумки + $l = 59; + while ($l <= 62) { + if (isset($witm[$l])) { + $ssm++; + } else { + $witm[$l] = ''; + } + $l++; + } + + $witmg = ''; + + if ($ssm > 0 && $i1 == 0) { + $witmg .= ' + + + + + + +
' . $witm[59] . '' . $witm[60] . '' . $witm[61] . '' . $witm[62] . '
'; + } + + if ($swm > 0 && $i1 == 0) { + $witmg .= ' + + + + + + + + + + + + + + + + + +
' . $witm[40] . '' . $witm[41] . '' . $witm[42] . '' . $witm[43] . '' . $witm[44] . '' . $witm[50] . '
' . $witm[45] . '' . $witm[46] . '' . $witm[47] . '' . $witm[48] . '' . $witm[49] . '' . $witm[51] . '
'; + } + $zag = ''; + if ($u['zag'] != '' && $i1 == 1) { + $rt[0] .= ''; + + $zag = ''; + + $j2 = 0; + while ($j2 <= 17) { + $witm[$j2] = '
' . $witm[$j2] . '
'; + $j2++; + } + } + + if ($pb != '') { + $pb = '
' . $pb . '
'; + } + $rt[0] .= '
' . $this->user->microLogin2($u) . '
' . $pb . ' +
+ + + + + + +
+ + + + + + + + + + + + + + + + +
' . $zag . $witm[1] . '
' . $witm[2] . '
' . $witm[3] . '
' . $witm[4] . '
' . $witm[7] . '
+
+ + + + + + + + + + +
+ + ' . $hpmp . ' + +
'; + if ($zag == '') { + if ($i1 == 0) { + if (!isset($_GET['inv'])) { + $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; + } else { + $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; + } + } else { + $o = mysql_fetch_array( + mysql_query( + 'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string( + $this->info['obraz'] + ) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1' + ) + ); + $invg = [0 => '/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов']; + } + $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz']; + if (isset($sn['items_img'][1])) { + $uobr = 'rimg/r' . $sn['items_img'][1]; + } + $rt[0] .= '
+ +
+
' . $eff . '
' . $anml . ' +
'; + } else { + if ($i1 == 0) { + if (!isset($_GET['inv'])) { + $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак']; + } else { + $invg = [0 => 'main.php?skills=1', 1 => 'Умения']; + } + } else { + $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов']; + } + $rt[0] .= '
+ +
+
' . $eff . '
' . $anml . ' +
'; + } + + unset($invg); + + $rt[0] .= '
' . $msl . '
+
+ + + + + + + + + + + + + + + + + + + + + + +
' . $witm[8] . '
' . $witm[9] . '
+ + + + + +
' . $witm[10] . '' . $witm[11] . '' . $witm[12] . '
' . $witm[13] . '
' . $witm[14] . '
' . $witm[16] . '
' . $witm[17] . '
+
' . $witmg . '
'; + + + if ($i1 == 0 && $u['battle'] == 0) { + $rt[0] .= ''; + } + if ($ivv == 0 && $i1 == 0) { + $rt[0] .= $this->user->info_remont(); + } + } + return $rt; + } + + private function nameItemMf($pl, $po) + { + $r = $pl['name']; + if (isset($po['icos'])) { + $r = "{$pl['name']}  {$po['icos']} "; + } + + if (!empty($po['rune']) && $po['rune'] > 0) { + $r .= "
Руна: {$po['rune_name']}"; + } + if (isset($po['spell'])) { + $rnc = match (explode(' ', $po['spell_name'])[2]) { + '[0]' => '#282828', + '[1]' => '#624542', + '[2]' => '#77090b', + default => '#d99800', + }; + $r .= "
Руна: {$po['spell_name']}"; + } + return $r; + } + + + private function getInfoItemInfo($pl, $po): string + { + + $lvar = ''; + + if (isset($po['sv_yron_max']) && $po['sv_yron_max'] > 0) { + $lvar .= '
Урон: ' . $po['sv_yron_min'] . '-' . $po['sv_yron_max']; + } + + $t = $this->user->items['add']; + $x = 0; + while ($x < count($t)) { + $n = $t[$x]; + if (isset($po['add_' . $n], $this->is[$n])) { + $z = '+'; + if ($po['add_' . $n] < 0) { + $z = ''; + } + $lvar .= '
' . $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 .= '
' . $this->is[$n] . ': ' . $z . $po['sv_' . $n]; + } + } + $x++; + } + if ($pl['2h'] == 1) { + $lvar .= '
• Двуручное оружие'; + } + if (isset($po['zonb'])) { + $lvar .= '
Зоны блокирования: '; + if ($po['zonb'] > 0) { + $x = 1; + while ($x <= $po['zonb']) { + $lvar .= '+'; + $x++; + } + } else { + $lvar .= '—'; + } + } + + // + if (isset($po['add_mib1'], $po['add_mab1']) && $po['add_mib1'] > 0 && $po['add_mib1'] <= $po['add_mab1']) { + $lvar .= '
Броня головы: ' . (int)$po['add_mib1'] . '-' . (int)$po['add_mab1']; + } + if (isset($po['add_mib2'], $po['add_mab2']) && $po['add_mib2'] > 0 && $po['add_mib2'] <= $po['add_mab2']) { + $lvar .= '
Броня корпуса: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2']; + } + if (isset($po['add_mib3'], $po['add_mab3']) && $po['add_mib3'] > 0 && $po['add_mib3'] <= $po['add_mab3']) { + $lvar .= '
Броня пояса: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2']; + } + if (isset($po['add_mib4'], $po['add_mab4']) && $po['add_mib4'] > 0 && $po['add_mib4'] <= $po['add_mab4']) { + $lvar .= '
Броня ног: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2']; + } + + + if ($pl['iznosMAX'] > 0) { + $lvar .= '
Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']); + } + + if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) { + $lvar .= '
Задержка использования: ' . Conversion::secondsToTimeout($po['battleUseZd']); + } + + if (isset($po['gravi'])) { + $lvar .= '
"' . $po['gravi'] . '"'; + } + + return $lvar; + } + +} diff --git a/_incl_data/class/User/ItemsModel.php b/_incl_data/class/User/ItemsModel.php index b98ce13a..f98a9a06 100644 --- a/_incl_data/class/User/ItemsModel.php +++ b/_incl_data/class/User/ItemsModel.php @@ -55,10 +55,10 @@ class ItemsModel * @param int $coldel количество предметов. * @return void */ - public static function deleteItemsById(int $id, int $coldel = 1) + public static function deleteItemsById(int $id, int $coldel = 1): void { Db::sql( - 'update items_users set `delete` = unix_timestamp() + 'delete from items_users where id in (select id from items_users where item_id = ? and uid = ? and (`delete` = 0 or `delete` = 1000) order by inGroup desc limit ?)', [$id, User::start()->info['id'], $coldel] ); @@ -78,6 +78,83 @@ class ItemsModel ]; } + /** Выбор предмета в инвентаре. + * @param int $itemId + * @param int $ownerId + * @return array + */ + public static function getOwnedItemById(int $itemId, int $ownerId): array + { + return Db::getRow('select * from items_users left join items_main on item_id = items_main.id + where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]); + } + + public static function delete(int $id): void + { + Db::sql('delete from items_users where id = ?', [$id]); + } + + public static function getDressedEkrTotalPrice($uid) + { + return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]); + } + + public static function getWearedItems(int $userId): array + { + return Db::getRows('select * from items_users where inOdet > 0 and uid = ?', [$userId]); + } + + /** Порча предмета + * @param $it + * @param $tp + * @param $uid + * @param $id2 + * @param $type + * @param $name + * @return void + */ + public static function itemDecay($it, $tp, $uid, $id2, $type, $name): void + { + if ($it == 0) { + return; + } + if ($id2 == 4708) { + $tp = 1; + } + + $sql = 'delete from items_users where id = ?'; + $sql2 = 'update items_users set inGroup = 0, timeOver = unix_timestamp() where inGroup = ?'; + $args = [$it]; + if ($uid != 0) { + $sql .= 'and uid = ?'; + $sql2 .= 'and uid = ?'; + $args[] = $uid; + } + Db::sql($sql, $args); + Db::sql($sql2, $args); + + Delo::add(2, 'system.inventory', $uid, "Предмет $name [id:$it] был испорчен."); + + if ($tp == 0) { + return; + } + + //Добавляем испорченый предмет в инвентарь, в зависимости от типа + + if ($id2 > 0) { + $moddata = '|noodet=1'; + if ($id2 == 4708) { + $moddata = '|notransfer=1|nosale=1'; + } + ItemsModel::addItem($id2, $uid, $moddata); + } elseif ($type == 30) { + //испорченный эликсир + $id2 = 4036; + $moddata = "|renameadd=$name|noodet=1"; + ItemsModel::addItem($id2, $uid, $moddata); + } + } + public static function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null) { $user = User::start(); @@ -134,30 +211,4 @@ class ItemsModel } return $rt; } - - /** Выбор предмета в инвентаре. - * @param int $itemId - * @param int $ownerId - * @return array - */ - public static function getOwnedItemById(int $itemId, int $ownerId): array - { - return Db::getRow('select * from items_users left join items_main on item_id = items_main.id - where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]); - } - - public static function delete(int $id) - { - Db::sql('delete from items_users where id = ?', [$id]); - } - - public static function getDressedEkrTotalPrice($uid) - { - return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]); - } - - public static function getWearedItems(int $userId): array - { - return Db::getRows('select * from items_users where inOdet > 0 and uid = ?', [$userId]); - } } \ No newline at end of file diff --git a/_incl_data/class/User/Parameters.php b/_incl_data/class/User/Parameters.php new file mode 100644 index 00000000..eecfe2c0 --- /dev/null +++ b/_incl_data/class/User/Parameters.php @@ -0,0 +1,97 @@ + 'Спасение после смерти', + 'puti' => 'Запрет перемещения', + 'align' => 'Склонность', + 'hpAll' => 'Уровень жизни (HP)', + 'mpAll' => 'Уровень маны (МP)', + 'sex' => 'Пол', + 'lvl' => 'Уровень', + 's1' => 'Сила', + 's2' => 'Ловкость', + 's3' => 'Интуиция', + 's4' => 'Выносливость', + 's5' => 'Интеллект', + 's6' => 'Мудрость', + 's7' => 'Духовность', + 'm1' => 'Мф. критического удара (%)', + 'm2' => 'Мф. против критического удара (%)', + 'm3' => 'Мф. мощности крит. удара (%)', + 'm4' => 'Мф. увертывания (%)', + 'm5' => 'Мф. против увертывания (%)', + 'm6' => 'Мф. контрудара (%)', + 'm7' => 'Мф. парирования (%)', + 'm8' => 'Мф. блока щитом (%)', + 'm9' => 'Мф. удара сквозь броню (%)', + 'm14' => 'Мф. абс. критического удара (%)', + 'm15' => 'Мф. абс. увертывания (%)', + 'm18' => 'Мф. абс. блока щитом (%)', + 'm19' => 'Мф. абс. магический промах (%)', + 'a1' => 'Мастерство владения ножами, кинжалами', + 'a2' => 'Мастерство владения топорами, секирами', + 'a3' => 'Мастерство владения дубинами, молотами', + 'a4' => 'Мастерство владения мечами', + 'a5' => 'Мастерство владения магическими посохами', + 'aall' => 'Мастерство владения оружием', + 'mall' => 'Мастерство владения магией стихий', + 'mg1' => 'Мастерство владения магией огня', + 'mg2' => 'Мастерство владения магией воздуха', + 'mg3' => 'Мастерство владения магией воды', + 'mg4' => 'Мастерство владения магией земли', + 'mg7' => 'Мастерство владения серой магией', + 'minAtack' => 'Минимальный урон бота в пещере', + 'maxAtack' => 'Максимальный урон бота в пещере', + 'm10' => 'Мф. мощности урона', + 'm11' => 'Мф. мощности магии стихий', + 'pa1' => 'Мф. мощности колющего урона', + 'pa2' => 'Мф. мощности рубящего урона', + 'pa3' => 'Мф. мощности дробящего урона', + 'pa4' => 'Мф. мощности режущего урона', + 'pm1' => 'Мф. мощности магии огня', + 'pm2' => 'Мф. мощности магии воздуха', + 'pm3' => 'Мф. мощности магии воды', + 'pm4' => 'Мф. мощности магии земли', + 'pm7' => 'Мф. мощности серой магии', + 'za' => 'Защита от урона', + 'zm' => 'Защита от магии стихий', + 'magic_cast' => 'Дополнительный каст за ход', + 'min_heal_proc' => 'Эффект лечения (%)', + 'notravma' => 'Защита от травм', + 'yron_min' => 'Минимальный урон', + 'yron_max' => 'Максимальный урон', + 'speedhp' => 'Регенерация здоровья (%)', + 'speedmp' => 'Регенерация маны (%)', + 'tya1' => 'Колющие атаки', + 'tya2' => 'Рубящие атаки', + 'tya3' => 'Дробящие атаки', + 'tya4' => 'Режущие атаки', + 'tym1' => 'Огненные атаки', + 'mg2static_points' => 'Уровень заряда (Воздух)', + 'tym2' => 'Электрические атаки', + 'tym3' => 'Ледяные атаки', + 'tym4' => 'Земляные атаки', + 'tym7' => 'Серые атаки', + 'min_use_mp' => 'Уменьшает расход маны', + 'pog' => 'Поглощение урона (прием)', + 'pog2' => 'Поглощение урона (прием)', + 'pog2p' => 'Процент поглощение урона (прием)', + 'pog2mp' => 'Цена поглощение урона (прием)', + 'maxves' => 'Увеличивает рюкзак', + 'antm3' => 'Мф. против мощности крита', + 'repair_z' => 'Бесплатное извлечение заточек', + 'repair_r' => 'Бесплатное извлечение рун', + 'rep' => 'Репутация Рыцаря', + 'repair_discount' => 'Скидка на ремонт вещей', + 'hpVinos' => 'Бонус жизни', + 'gold' => 'Благодать Ангела', + 'speed_dungeon' => 'Скорость передвижения по подземельям', + 'zona' => 'Дополнительная зона атаки', + ]; + + public static array $parameterNameDeprecated = []; +} \ No newline at end of file diff --git a/_incl_data/class/User/Register.php b/_incl_data/class/User/Register.php index 8be2c02f..205bc11e 100644 --- a/_incl_data/class/User/Register.php +++ b/_incl_data/class/User/Register.php @@ -64,43 +64,6 @@ class Register 'Милосердие', 'Справедливость', 'Искушение', 'Вознесение', ]; - - public function hasMixedLatCur(string $txt): bool - { - $en = preg_match("/^(([0-9A-z -])+)$/iu", $txt); - $ru = preg_match("/^([а-яёіїє\s\d]*)$/iu", $txt); - return ($ru && $en) || (!$ru && !$en); - } - - public function hasGoodLogin(string $login): bool - { - $isRestricted = in_array($login, $this->restrictedLogins); - $isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]); - //Бывшие в употреблении логины. Дичь, но ладно. - $wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]); - $login = str_replace(' ', ' ', $login); - if (mb_strlen($login) > 20) { - $this->error = 'Логин должен содержать не более 20 символов.'; - } - if (mb_strlen($login) < 4) { - $this->error = 'Логин должен содержать не менее 4 символов.'; - } - if ($this->hasMixedLatCur($login)) { - $this->error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.'; - } - if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) { - $this->error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).'; - } - if (!empty($this->error)) { - $this->error .= '
Пример правильного никнейма: Петя Убиватор, Коля, xalop.
Пример неправильного никнейма: )))), kolя)=-/.'; - } - if ($isRegistered || $wasRegistered || $isRestricted) { - $this->error = 'Логин ' . $login . ' уже занят, выберите другой.'; - } - - return !$this->error; - } - public function hasGoodEmail(string $email): bool { $isRegistered = Db::getValue('select count(*) from users where mail = ?', [$email]); @@ -167,7 +130,7 @@ class Register ] ); $uid = Db::lastInsertId(); - trigger_error('Db::lastInsertId= ' . $uid); + //trigger_error('Db::lastInsertId= ' . $uid); $_SESSION['uid'] = $uid; $this->setCookies($login); $this->setStatsItemsEffects($uid); @@ -176,7 +139,43 @@ class Register return $uid; } - private function setCookies($login) + public function hasGoodLogin(string $login): bool + { + $isRestricted = in_array($login, $this->restrictedLogins); + $isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]); + //Бывшие в употреблении логины. Дичь, но ладно. + $wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]); + $login = str_replace(' ', ' ', $login); + if (mb_strlen($login) > 20) { + $this->error = 'Логин должен содержать не более 20 символов.'; + } + if (mb_strlen($login) < 4) { + $this->error = 'Логин должен содержать не менее 4 символов.'; + } + if ($this->hasMixedLatCur($login)) { + $this->error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.'; + } + if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) { + $this->error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).'; + } + if (!empty($this->error)) { + $this->error .= '
Пример правильного никнейма: Петя Убиватор, Коля, xalop.
Пример неправильного никнейма: )))), kolя)=-/.'; + } + if ($isRegistered || $wasRegistered || $isRestricted) { + $this->error = 'Логин ' . $login . ' уже занят, выберите другой.'; + } + + return !$this->error; + } + + public function hasMixedLatCur(string $txt): bool + { + $en = preg_match("/^(([0-9A-z -])+)$/iu", $txt); + $ru = preg_match("/^([а-яёіїє\s\d]*)$/iu", $txt); + return ($ru && $en) || (!$ru && !$en); + } + + private function setCookies($login): void { setcookie('login', 1, 1, '/', Config::get('host'), true); setcookie('registrationModal', 1, 1, '/', Config::get('host'), true); @@ -184,7 +183,7 @@ class Register setcookie('registrationModal', 'true', strtotime('+7 days'), '/', Config::get('host'), true); } - private function setStatsItemsEffects($uid) + private function setStatsItemsEffects($uid): void { if ($_SESSION['ref'] === 1) { $this->classBonuses[$this->class]['items'][] = 4811; @@ -203,7 +202,7 @@ class Register $itemId = ItemsModel::addItem($item, $uid); Db::sql( 'update items_users - set `1price` = (select price_1 from items_main where items_main.item_id = ? and sid = 1) + set `1price` = (select price1 from items_main where id = ?) where id = ?', [$item, $itemId] ); @@ -213,7 +212,7 @@ class Register } - private function addEffects(int $uid, int ...$eids) + private function addEffects(int $uid, int ...$eids): void { $in = implode(',', $eids); $q = diff --git a/_incl_data/class/User/Reputation.php b/_incl_data/class/User/Reputation.php index 5212e7e2..fc68be69 100644 --- a/_incl_data/class/User/Reputation.php +++ b/_incl_data/class/User/Reputation.php @@ -7,23 +7,25 @@ use Core\Db; class Reputation { private array $r; + private int $uid; public function __construct(int $userid) { + $this->uid = $userid; $this->r = Db::getRow( 'select *, (repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep, (nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep - from rep where id = ?', [$userid] + from rep where id = ?', [$this->uid] ); if (empty($this->r)) { - Db::sql('insert into rep (id) value (?)', [$userid]); + Db::sql('insert into rep (id) value (?)', [$this->uid]); $this->r = Db::getRow( 'select *, (repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep, (nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep - from rep where id = ?', [$userid] + from rep where id = ?', [$this->uid] ); } } @@ -32,4 +34,14 @@ class Reputation { return $this->r; } + + public function addRep(string $dungeonName, int $value): int + { + if (!isset($this->r[$dungeonName]) || $value <= 0) { + return 0; + } + $this->r[$dungeonName] += $value; + Db::sql("update rep set $dungeonName = ? where id = ?", [$value, $this->uid]); + return $this->r[$dungeonName]; + } } \ No newline at end of file diff --git a/_incl_data/class/User/Stats.php b/_incl_data/class/User/Stats.php index 6888be00..5b503759 100644 --- a/_incl_data/class/User/Stats.php +++ b/_incl_data/class/User/Stats.php @@ -2,10 +2,10 @@ namespace User; +use Core\Config; use Core\Db; use Helper\Conversion; use Item\Data\Bonuses; -use Item\Data\Bonuses as ItemBonuses; use User; class Stats @@ -118,27 +118,26 @@ class Stats /** * Присваиваем только разрешенные значения. */ - private static function a(&$array, string $key, $value): array + private static function a(&$array, string $key, $value): void { if (!in_array($key, array_keys(Bonuses::getBonusSystemNames()))) { - return []; + return; } $array[$key] = $value; - return $array; } - public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array + public function getStats(int|array|null $uid = null, $i1 = 0, $res = 0, $reimg = false, $btl_cache = false): array { - - if (is_array($uid)) { - $u = $uid; - } elseif ($uid != $this->u->info['id'] || $res == 1) { + if (empty($uid) || $uid == $this->u->info['id'] && $res != 1) { + //$u = $this->u->info; $u = User::getInfo($uid); + } elseif (is_array($uid)) { + $u = $uid; } else { - $u = $this->u->info; + $u = User::getInfo($uid); } - if (!isset($u['id'], $u['stats'])) { + if (!isset($u['id'])) { return []; } @@ -182,7 +181,7 @@ class Stats } else { $st['levels'] = 'undefined'; } - $st2 = []; + $st['id'] = $u['id']; $st['login'] = $u['login']; $st['lvl'] = $u['level']; @@ -207,6 +206,8 @@ class Stats } unset($stats); + $baseStats = $st; + //Шаблонные картинки if ($this->u->info['id'] === $u['id'] || $reimg) { $itemsImages = Db::getRows('select * from items_img where uid = ? and img_id != 0', [$u['id']]); @@ -228,7 +229,7 @@ class Stats item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h` from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$u['id']]); - $ia = ItemBonuses::getBonusSystemNames(); + $ia = Bonuses::getBonusSystemNames(); $h = 0; $hnd1 = 0; $hnd2 = 0; @@ -485,8 +486,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $i9 = 1; $i39[0] = 1; while ($i9 <= 7) { - $st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9]; - $st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9]; + $st['a' . $i9] = $st['a' . $i9] - $baseStats['a' . $i9] + $reitm[$i]['add_a' . $i9]; + $st['mg' . $i9] = $st['mg' . $i9] - $baseStats['mg' . $i9] + $reitm[$i]['add_mg' . $i9]; $i9++; } } elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) { @@ -494,7 +495,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $i9 = 1; $i39[1] = 1; while ($i9 <= 12) { - $st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9]; + $st['s' . $i9] = $st['s' . $i9] - $baseStats['s' . $i9] + $reitm[$i]['add_s' . $i9]; $i9++; } } elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) { @@ -505,36 +506,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $i++; } } - - //Харки от иконок - $efs = mysql_query( - 'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string( - $u['id'] - ) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)' - ); - while ($e = mysql_fetch_array($efs)) { - $sts = Conversion::dataStringToArray($e['bonus']); - $i = 0; - while ($i < count($ia)) { - if (isset($ia[$i])) { - if (!isset($sti[$ia[$i]])) { - $sti[$ia[$i]] = 0; - } - if (!isset($sts['add_' . $ia[$i]])) { - $sts['add_' . $ia[$i]] = 0; - } - - $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]); - - if (!isset($st[$ia[$i]])) { - $st[$ia[$i]] = 0; - } - // - $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]); - } - $i++; - } - } + $st = $this->addMedalsBonuses($u['id'], $st); $noeffectbattle = false; if ($u['battle'] > 0) { @@ -866,7 +838,10 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $st['act'] = 1; } } - }//Характеристики от статов + } + + + //Характеристики от статов if (!isset($st['hpAll'])) { $st['hpAll'] = 0; } @@ -977,7 +952,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet != } $i++; } - }//Бонусы статов + } + //Замена свитков if ($u['autospell'] != 0 && $u['battle'] == 0) { //проверяем свитки @@ -1026,231 +1002,12 @@ from items_users left join items_main on items_main.id = item_id where inOdet != [$i, $spe2g[$i], $u['id']]); } } - }//Бонусы статов - //ТУТ - //сила - if ($st['s1'] > 24 && $st['s1'] < 50) { - $st['m2'] += 15; } - if ($st['s1'] > 49 && $st['s1'] < 75) { - $st['pa2'] += 2; - $st['m2'] += 35; - } - if ($st['s1'] > 74 && $st['s1'] < 100) { - $st['pa2'] += 5; - $st['m2'] += 50; - } - if ($st['s1'] > 99 && $st['s1'] < 125) { - $st['pa2'] += 8; - $st['m2'] += 80; - } - if ($st['s1'] > 124 && $st['s1'] < 150) { - $st['pa2'] += 12; - $st['m2'] += 105; - } - if ($st['s1'] > 149 && $st['s1'] < 175) { - $st['pa2'] += 17; - $st['m7'] += 2; - } - if ($st['s1'] > 174 && $st['s1'] < 200) { - $st['pa2'] += 23; - $st['m7'] += 5; - } - if ($st['s1'] > 199) { - $st['pa2'] += 30; - $st['m7'] += 7; - } - if ($st['s2'] > 24 && $st['s2'] < 50) { - $st['pa1'] += 2; - $st['m4'] += 35; - } - if ($st['s2'] > 49 && $st['s2'] < 75) { - $st['pa1'] += 5; - $st['m2'] += 40; - $st['m4'] += 75; - } - if ($st['s2'] > 74 && $st['s2'] < 100) { - $st['pa1'] += 8; - $st['m2'] += 65; - $st['m4'] += 90; - } - if ($st['s2'] > 99 && $st['s2'] < 125) { - $st['pa1'] += 12; - $st['m2'] += 75; - $st['m4'] += 105; - } - if ($st['s2'] > 124 && $st['s2'] < 150) { - $st['pa1'] += 17; - $st['m2'] += 85; - $st['m4'] += 105; - $st['m15'] += 1; - } - if ($st['s2'] > 149 && $st['s2'] < 175) { - $st['pa1'] += 20; - $st['m2'] += 110; - $st['m4'] += 115; - $st['m15'] += 2; - } - if ($st['s2'] > 174 && $st['s2'] < 200) { - $st['pa1'] += 23; - $st['m2'] += 145; - $st['m4'] += 145; - $st['m15'] += 3; - } - if ($st['s2'] > 199) { - $st['pa1'] += 30; - $st['m2'] += 165; - $st['m4'] += 165; - $st['m15'] += 5; - }//интуиция - if ($st['s3'] > 24 && $st['s3'] < 50) { - $st['pa4'] += 2; - $st['m3'] += 2; - $st['m1'] += 25; - } - if ($st['s3'] > 49 && $st['s3'] < 75) { - $st['pa4'] += 5; - $st['m3'] += 5; - $st['m1'] += 55; - } - if ($st['s3'] > 74 && $st['s3'] < 100) { - $st['pa4'] += 8; - $st['m3'] += 10; - $st['m1'] += 75; - $st['m5'] += 25; - } - if ($st['s3'] > 99 && $st['s3'] < 125) { - $st['pa4'] += 12; - $st['m3'] += 15; - $st['m1'] += 105; - $st['m5'] += 35; - } - if ($st['s3'] > 124 && $st['s3'] < 150) { - $st['pa4'] += 17; - $st['m3'] += 20; - $st['m1'] += 125; - $st['m5'] += 45; - $st['m14'] += 1; - } - if ($st['s3'] > 149 && $st['s3'] < 175) { - $st['pa4'] += 20; - $st['m3'] += 30; - $st['m1'] += 145; - $st['m5'] += 50; - $st['m14'] += 2; - } - if ($st['s3'] > 174 && $st['s3'] < 200) { - $st['pa4'] += 23; - $st['m3'] += 35; - $st['m1'] += 165; - $st['m5'] += 55; - $st['m14'] += 3; - } - if ($st['s3'] > 199) { - $st['pa4'] += 30; - $st['m3'] += 40; - $st['m1'] += 185; - $st['m5'] += 65; - $st['m14'] += 5; - }//выносливость - if ($st['s4'] > 0) { - $st['hpAll'] += 30; - } - if ($st['s4'] > 24 && $st['s4'] < 50) { - $st['hpAll'] += 50; - } - if ($st['s4'] > 49 && $st['s4'] < 75) { - $st['hpAll'] += 100; - } - if ($st['s4'] > 74 && $st['s4'] < 100) { - $st['hpAll'] += 175; - $st['m19'] += 2; - } - if ($st['s4'] > 99 && $st['s4'] < 125) { - $st['hpAll'] += 250; - $st['m19'] += 4; - } - if ($st['s4'] > 124 && $st['s4'] < 150) { - $st['hpAll'] += 400; - $st['za'] += 25; - $st['zm'] += 25; - } - if ($st['s4'] > 149 && $st['s4'] < 175) { - $st['hpAll'] += 450; - $st['za'] += 50; - $st['zm'] += 50; - } - if ($st['s4'] > 174 && $st['s4'] < 200) { - $st['hpAll'] += 600; - $st['za'] += 100; - $st['zm'] += 100; - } - if ($st['s4'] > 199) { - $st['hpAll'] += 850; - $st['za'] += 125; - $st['zm'] += 125; - }//интелект - if ($st['s5'] > 24 && $st['s5'] < 50) { - $st['m11'] += 10; - } - if ($st['s5'] > 49 && $st['s5'] < 75) { - $st['m11'] += 15; - } - if ($st['s5'] > 74 && $st['s5'] < 100) { - $st['m11'] += 20; - } - if ($st['s5'] > 99 && $st['s5'] < 125) { - $st['m11'] += 25; - } - if ($st['s5'] > 124 && $st['s5'] < 150) { - $st['m11'] += 35; - } - if ($st['s5'] > 149 && $st['s5'] < 175) { - $st['m11'] += 50; - } - if ($st['s5'] > 174) { - $st['m11'] += 65; - $st['pzm'] += 2; - } - if ($st['s5'] > 199) { - $st['pzm'] += 5; - }//мудрость - if ($st['s6'] > 24 && $st['s6'] < 50) { - $st['mpAll'] += 150; - $st['speedmp'] += 100; - } - if ($st['s6'] > 49 && $st['s6'] < 75) { - $st['mpAll'] += 200; - $st['speedmp'] += 200; - } - if ($st['s6'] > 74 && $st['s6'] < 100) { - $st['mpAll'] += 250; - $st['speedmp'] += 350; - } - if ($st['s6'] > 99 && $st['s6'] < 125) { - $st['mpAll'] += 350; - $st['speedmp'] += 500; - } - if ($st['s6'] > 124 && $st['s6'] < 150) { - $st['mpAll'] += 500; - $st['speedmp'] += 500; - $st['pzm'] += 2; - } - if ($st['s6'] > 149 && $st['s6'] < 175) { - $st['mpAll'] += 700; - $st['speedmp'] += 600; - $st['pzm'] += 3; - } - if ($st['s6'] > 174 && $st['s6'] < 200) { - $st['mpAll'] += 900; - $st['speedmp'] += 700; - $st['pzm'] += 5; - } - if ($st['s6'] > 199) { - $st['mpAll'] += 900; - $st['speedmp'] += 700; - $st['pzm'] += 7; - }//если второе оружие одето + + //Бонусы статов + $this->addStatBonuses($st); + + //если второе оружие одето if ($hnd2 == 1 && $hnd1 == 1) { $st['zona']++; } @@ -1399,75 +1156,16 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $st['reting'] = 1 + ceil($st['reting']); - if ($st['vip'] > 0) { //$u - $st['antm3'] += 20; - $st['zaproc'] += 5; - $st['zmproc'] += 5; - $st['m10'] += 20; - $st['pzm'] += 5; - } - //Бонус от медалей - $rep1 = mysql_fetch_array( - mysql_query( - 'SELECT - `add_slot`,`nu_sandcity`,`n_sandcity`, - `dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`, - `repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`, - `n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`, - `nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`, - `rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`, - (`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep, - (`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1' - ) - ); + $this->addDungeonsBonuses($u['id'], $st); - if ($u['referals'] >= 3000) { - $st['speedhp'] += 50; - $st['speedmp'] += 50; - $st['antm3'] += 25; - $st['m10'] += 15; - $st['m11'] += 15; - $st['speed_dungeon'] += 25; - $st['hpAll'] += 250; - }//Водосток - if ($rep1['repdreamscity'] >= 24999) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//излом - if ($rep1['repizlom'] == 9999) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Бездна - if ($rep1['repangelscity'] == 25000) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Катакомбы - if ($rep1['repdemonscity'] == 25000) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Грибница - if ($rep1['repdemonscity'] == 25000) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Пещера тысячи проклятий - if ($rep1['repcapitalcity'] == 25000) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Санд - if ($rep1['repsandcity'] == 25000) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Гора легиона - if ($rep1['repabandonedplain'] == 24999) { - $st['m10'] += 10; - $st['pzm'] += 1; - }//Добавочный подьем для игроков + + //Добавочный подьем для игроков $st['maxves'] += 500; if ($u['admin'] > 0) { // ускоренная регенерация и пробег по подземелью - $st['speed_dungeon'] = 10000; - $st['speedhp'] = 10000; + $st['speed_dungeon'] = 1000; + $st['speedhp'] = 1000; if ($u['battle']) { Db::sql("update stats set tactic1 = tactic2 = tactic3 = tactic4 = tactic5 = tactic6 = tactic7 = 25, @@ -1501,28 +1199,323 @@ from items_users left join items_main on items_main.id = item_id where inOdet != $rt = []; if ($i1 == 1) { $rt[0] = $st; - $rt[1] = $st2; //родные статы + $rt[1] = $baseStats; //родные статы } else { $rt = $st; } if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) { - mysql_query( - 'UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1' - ); + Db::sql('update stats set hpAll = ?, mpAll = ? where id = ?', [$st['hpAll'], $st['mpAll'], $u['id']]); } if ($btl_cache) { $dataca = [ 'st' => $st, - 'st2' => $st2, + 'st2' => $baseStats, ]; $dataca = json_encode($dataca); - mysql_query( - 'INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string( - $dataca - ) . '","' . time() . '")' - ); + Db::sql('insert into battle_cache (battle, uid, time, data) values (?,?,unix_timestamp(),?)', [$u['battle'], $u['id'], $dataca]); } return $rt; } + + private function addMedalsBonuses(int $uid, array &$st): array + { + //Харки от иконок + + $efs = Db::getColumn('select bonus from users_ico where uid = ? and (endTime > unix_timestamp() or endTime = 0)', [$uid]); + foreach ($efs as $data) { + $sts = Conversion::dataStringToArray($data); + foreach ($sts as $paramName => $value) { + //todo убедиться, что не могут прилететь параметры, которых нет в словарей бонусов предметов + if (!str_contains(implode(',', Bonuses::getBonusSystemNames()), 'add_' . $paramName)) { // есть ли параметр в разрешенных? + continue; + } + if (empty($st['add_' . $paramName])) { + $st['add_' . $paramName] = 0; + } + $st['add_' . $paramName] += (int)$value; + } + } + return $st; + } + + private function addStatBonuses(array &$st): void + { + $this->addStrengthBonuses($st); + $this->addDexterityBonuses($st); + $this->addIntuitionBonuses($st); + $this->addEnduranceBonuses($st); + $this->addIntelligenceBonuses($st); + $this->addWisdomBonuses($st); + } + + private function addStrengthBonuses(array &$st): void + { + if ($st['s1'] > 24 && $st['s1'] < 50) { + $st['m2'] += 15; + } + if ($st['s1'] > 49 && $st['s1'] < 75) { + $st['pa2'] += 2; + $st['m2'] += 35; + } + if ($st['s1'] > 74 && $st['s1'] < 100) { + $st['pa2'] += 5; + $st['m2'] += 50; + } + if ($st['s1'] > 99 && $st['s1'] < 125) { + $st['pa2'] += 8; + $st['m2'] += 80; + } + if ($st['s1'] > 124 && $st['s1'] < 150) { + $st['pa2'] += 12; + $st['m2'] += 105; + } + if ($st['s1'] > 149 && $st['s1'] < 175) { + $st['pa2'] += 17; + $st['m7'] += 2; + } + if ($st['s1'] > 174 && $st['s1'] < 200) { + $st['pa2'] += 23; + $st['m7'] += 5; + } + if ($st['s1'] > 199) { + $st['pa2'] += 30; + $st['m7'] += 7; + } + } + + private function addDexterityBonuses(array &$st): void + { + if ($st['s2'] > 24 && $st['s2'] < 50) { + $st['pa1'] += 2; + $st['m4'] += 35; + } + if ($st['s2'] > 49 && $st['s2'] < 75) { + $st['pa1'] += 5; + $st['m2'] += 40; + $st['m4'] += 75; + } + if ($st['s2'] > 74 && $st['s2'] < 100) { + $st['pa1'] += 8; + $st['m2'] += 65; + $st['m4'] += 90; + } + if ($st['s2'] > 99 && $st['s2'] < 125) { + $st['pa1'] += 12; + $st['m2'] += 75; + $st['m4'] += 105; + } + if ($st['s2'] > 124 && $st['s2'] < 150) { + $st['pa1'] += 17; + $st['m2'] += 85; + $st['m4'] += 105; + $st['m15'] += 1; + } + if ($st['s2'] > 149 && $st['s2'] < 175) { + $st['pa1'] += 20; + $st['m2'] += 110; + $st['m4'] += 115; + $st['m15'] += 2; + } + if ($st['s2'] > 174 && $st['s2'] < 200) { + $st['pa1'] += 23; + $st['m2'] += 145; + $st['m4'] += 145; + $st['m15'] += 3; + } + if ($st['s2'] > 199) { + $st['pa1'] += 30; + $st['m2'] += 165; + $st['m4'] += 165; + $st['m15'] += 5; + + } + } + + private function addIntuitionBonuses(array &$st): void + { + //интуиция + if ($st['s3'] > 24 && $st['s3'] < 50) { + $st['pa4'] += 2; + $st['m3'] += 2; + $st['m1'] += 25; + } + if ($st['s3'] > 49 && $st['s3'] < 75) { + $st['pa4'] += 5; + $st['m3'] += 5; + $st['m1'] += 55; + } + if ($st['s3'] > 74 && $st['s3'] < 100) { + $st['pa4'] += 8; + $st['m3'] += 10; + $st['m1'] += 75; + $st['m5'] += 25; + } + if ($st['s3'] > 99 && $st['s3'] < 125) { + $st['pa4'] += 12; + $st['m3'] += 15; + $st['m1'] += 105; + $st['m5'] += 35; + } + if ($st['s3'] > 124 && $st['s3'] < 150) { + $st['pa4'] += 17; + $st['m3'] += 20; + $st['m1'] += 125; + $st['m5'] += 45; + $st['m14'] += 1; + } + if ($st['s3'] > 149 && $st['s3'] < 175) { + $st['pa4'] += 20; + $st['m3'] += 30; + $st['m1'] += 145; + $st['m5'] += 50; + $st['m14'] += 2; + } + if ($st['s3'] > 174 && $st['s3'] < 200) { + $st['pa4'] += 23; + $st['m3'] += 35; + $st['m1'] += 165; + $st['m5'] += 55; + $st['m14'] += 3; + } + if ($st['s3'] > 199) { + $st['pa4'] += 30; + $st['m3'] += 40; + $st['m1'] += 185; + $st['m5'] += 65; + $st['m14'] += 5; + } + } + + private function addEnduranceBonuses(array &$st): void + { + //выносливость + if ($st['s4'] > 0) { + $st['hpAll'] += 30; + } + if ($st['s4'] > 24 && $st['s4'] < 50) { + $st['hpAll'] += 50; + } + if ($st['s4'] > 49 && $st['s4'] < 75) { + $st['hpAll'] += 100; + } + if ($st['s4'] > 74 && $st['s4'] < 100) { + $st['hpAll'] += 175; + $st['m19'] += 2; + } + if ($st['s4'] > 99 && $st['s4'] < 125) { + $st['hpAll'] += 250; + $st['m19'] += 4; + } + if ($st['s4'] > 124 && $st['s4'] < 150) { + $st['hpAll'] += 400; + $st['za'] += 25; + $st['zm'] += 25; + } + if ($st['s4'] > 149 && $st['s4'] < 175) { + $st['hpAll'] += 450; + $st['za'] += 50; + $st['zm'] += 50; + } + if ($st['s4'] > 174 && $st['s4'] < 200) { + $st['hpAll'] += 600; + $st['za'] += 100; + $st['zm'] += 100; + } + if ($st['s4'] > 199) { + $st['hpAll'] += 850; + $st['za'] += 125; + $st['zm'] += 125; + } + } + + private function addIntelligenceBonuses(array &$st): void + { +//интелект + if ($st['s5'] > 24 && $st['s5'] < 50) { + $st['m11'] += 10; + } + if ($st['s5'] > 49 && $st['s5'] < 75) { + $st['m11'] += 15; + } + if ($st['s5'] > 74 && $st['s5'] < 100) { + $st['m11'] += 20; + } + if ($st['s5'] > 99 && $st['s5'] < 125) { + $st['m11'] += 25; + } + if ($st['s5'] > 124 && $st['s5'] < 150) { + $st['m11'] += 35; + } + if ($st['s5'] > 149 && $st['s5'] < 175) { + $st['m11'] += 50; + } + if ($st['s5'] > 174) { + $st['m11'] += 65; + $st['pzm'] += 2; + } + if ($st['s5'] > 199) { + $st['pzm'] += 5; + } + } + + private function addWisdomBonuses(array &$st): void + { +//мудрость + if ($st['s6'] > 24 && $st['s6'] < 50) { + $st['mpAll'] += 150; + $st['speedmp'] += 100; + } + if ($st['s6'] > 49 && $st['s6'] < 75) { + $st['mpAll'] += 200; + $st['speedmp'] += 200; + } + if ($st['s6'] > 74 && $st['s6'] < 100) { + $st['mpAll'] += 250; + $st['speedmp'] += 350; + } + if ($st['s6'] > 99 && $st['s6'] < 125) { + $st['mpAll'] += 350; + $st['speedmp'] += 500; + } + if ($st['s6'] > 124 && $st['s6'] < 150) { + $st['mpAll'] += 500; + $st['speedmp'] += 500; + $st['pzm'] += 2; + } + if ($st['s6'] > 149 && $st['s6'] < 175) { + $st['mpAll'] += 700; + $st['speedmp'] += 600; + $st['pzm'] += 3; + } + if ($st['s6'] > 174 && $st['s6'] < 200) { + $st['mpAll'] += 900; + $st['speedmp'] += 700; + $st['pzm'] += 5; + } + if ($st['s6'] > 199) { + $st['mpAll'] += 900; + $st['speedmp'] += 700; + $st['pzm'] += 7; + } + } + + private function addDungeonsBonuses(int $id, array &$st): void + { + $finishedDungeons = Db::getValue('select + if(repcapitalcity > 24999, 1, 0) + + if(repdemonscity > 24999, 1, 0) + + if(repangelscity > 24999, 1, 0) + + if(repdevilscity > 24999, 1, 0) + + if(repmooncity > 24999, 1, 0) + + if(repsuncity > 24999, 1, 0) + + if(repsandcity > 24999, 1, 0) + + if(repemeraldscity > 24999, 1, 0) + + if(repizlom > 24999, 1, 0) + + 0 as finished from rep where id = ?', [$id]); + + //Бонус за количество полностью вырытых пещер. + $st['m10'] += 10 * $finishedDungeons; + $st['pzm'] += $finishedDungeons; + } } diff --git a/_incl_data/crons/bot_calls.php b/_incl_data/crons/bot_calls.php index dbc605e1..3e9b0743 100644 --- a/_incl_data/crons/bot_calls.php +++ b/_incl_data/crons/bot_calls.php @@ -4,7 +4,7 @@ * Вызов ботов в игровые комнаты. * * Запуск раз в минуту. -*/ + */ use Core\Db; @@ -24,22 +24,9 @@ function makeLogin(int $id, string $login, int $level): string function testMonster(array $mon): bool // ЧТО ТЫ БЛЯТЬ ТАКОЕ? ЧТО ТЫ ПРОВЕРЯЕШЬ? КАК ТЫ РАБОТАЕШЬ? { return - ( - $mon['back_day'] === -1 || - ( - $mon['back_day'] === 7 || - $mon['back_day'] === idate('w') - ) && - $mon['back_day'] === 7 - ) && - ( - $mon['back_dd'] === -1 || - $mon['back_dd'] === idate('j') - ) && - ( - $mon['back_mm'] === -1 || - $mon['back_mm'] === idate('n') - ) && + ($mon['back_day'] === -1 || $mon['back_day'] === idate('w') || idate('w') === 7) && + ($mon['back_dd'] === -1 || $mon['back_dd'] === idate('j')) && + ($mon['back_mm'] === -1 || $mon['back_mm'] === idate('n')) && ( $mon['back_hh'] === -1 || $mon['back_hh'] === idate('H') && diff --git a/adminion/testing.php b/adminion/testing.php index 10b046ad..11241789 100644 --- a/adminion/testing.php +++ b/adminion/testing.php @@ -155,7 +155,7 @@ while ($i < 100) { -

Создать тестовый бой (Записать icq персу и скрыть: 17768719)

+

Создать тестовый бой



@@ -247,7 +247,7 @@ while ($i < 100) { { if (isset($id['id'])) { file_get_contents( - '/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5( + '/jx/battle/refresh1.php?uid=' . $id['id'] . '&cron_core=' . md5( $id['id'] . '_brfCOreW@!_' . $id['pass'] ) . '&pass=' . $id['pass'] ); @@ -305,18 +305,13 @@ while ($i < 100) { } // $ef = ''; - $ef1 .= '' . $ef . ''; - $ef2 .= '' . $ef . ''; + $ef1 .= '' . $ef . ''; + $ef2 .= '' . $ef . ''; } // $dv = ''; $da = ''; $dv .= ''; $da = ''; ?> diff --git a/buttons.php b/buttons.php index a92d916d..9f681381 100644 --- a/buttons.php +++ b/buttons.php @@ -82,7 +82,8 @@ if (!isset($_COOKIE['d1c'])) { isRegistered() ? "const clanImage = '" . Images::getSrc($userclan->getLogo()) . "';" : 'let clanImage;' ?> - const c = { + // Нихуясебе! Это суперглобальный объект, который тянется во все файлы и все яваскриты. let\const не использовать! + var c = { noEr: 0, noErTmr: 0, url: '', diff --git a/inf.php b/inf.php index 194066f3..5426c4f9 100644 --- a/inf.php +++ b/inf.php @@ -1,9 +1,16 @@ 0 => $inf = User::getInfo($_GET['id']), + !empty($_GET['login']) && $_GET['login'] !== 'delete' => $inf = User::getInfo($_GET['login']), + !empty($uplogin) && $uplogin !== 'delete' => $inf = User::getInfo($uplogin), +}; -$utf8Login = ''; -$utf8Login2 = ''; - - -$utf8Login = $uplogin; - -$utf8Login2 = $_GET['login']; - - -if ($uplogin != 'delete' && $utf8Login != 'delete' && $utf8Login2 != 'delete') { - $inf = mysql_fetch_array( - mysql_query( - 'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE ((`u`.`login`="' . mysql_real_escape_string( - $_GET['login'] - ) . '" OR `u`.`login`="' . mysql_real_escape_string( - $utf8Login2 - ) . '" OR `u`.`login`="' . mysql_real_escape_string( - $utf8Login - ) . '" OR `u`.`login`="' . mysql_real_escape_string($uplogin) . '") ) LIMIT 1' - ) - ); - if (!isset($inf['id'])) { - $inf = mysql_fetch_array( - mysql_query( - 'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE (`u`.`id`="' . mysql_real_escape_string( - $_GET['id'] - ) . '" OR `u`.`id`="' . mysql_real_escape_string($uplogin) . '") LIMIT 1' - ) - ); - } - if ($inf['login'] == 'delete' || $inf['login'] == 'DELETE') { - unset($inf); - } else { - if ($inf['info_delete'] > 1 && $inf['info_delete'] < time()) { - $inf['info_delete'] = 0; - mysql_query('UPDATE `users` SET `info_delete` = 0 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); - } - } -} -if (!isset($inf['id'])) { +if (empty($inf) || $inf['login'] == 'delete' || $inf['login'] == 'DELETE') { unset($inf); } else { + if ($inf['info_delete'] > 1 && $inf['info_delete'] < time()) { + $inf['info_delete'] = 0; + Db::sql('update users set info_delete = 0 where id = ?', [$inf['id']]); + } +} - if (isset($_GET['restartmonster']) && $u->info['admin'] > 0) { - mysql_query( - 'UPDATE `stats` SET `res_x` = 0 WHERE `id` = "' . mysql_real_escape_string($inf['id']) . '" LIMIT 1' - ); - $inf['res_x'] = 0; - } - if ($inf['haos'] > 1) { - //снимаем хаос - if ($inf['haos'] < time()) { - $inf['align'] = 0; - mysql_query('UPDATE `users` SET `align` = "0",`haos` = "0" WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); - } - } - if ($u->info['admin'] > 0) { - if (isset($_GET['wipe']) && $u->newAct($_GET['sd4']) == true) { - $upd = mysql_query('UPDATE `stats` SET `wipe` = "1" WHERE `id` = "' . $inf['id'] . '" LIMIT 1'); - if ($upd) { - $uer = 'Сброс характеристик прошел успешно
'; - } else { - $uer = 'Ошибка сброса...
'; - } - } - } - if (($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0) { - if (isset($_GET['molchMax']) && $u->newAct($_GET['sd4']) == true) { - $upd = mysql_query( - 'UPDATE `users` SET `molch3` = "' . $inf['molch1'] . '" WHERE `id` = "' . $inf['id'] . '" LIMIT 1' - ); - if ($upd) { - $uer = 'Все прошло успешно...
'; - } else { - $uer = 'Ошибка...
'; - } - } - } +if (isset($_GET['restartmonster']) && $u->isAdmin()) { //что ты такое?? + Db::sql('update stats set res_x = 0 where id = ?', [$inf['id']]); + $inf['res_x'] = 0; +} + +if ($u->isAdmin() && isset($_GET['wipe']) && $u->newAct($_GET['sd4'])) { + Db::sql('update stats set wipe = 1 where id = ?', [$inf['id']]); + $uer = 'Сброс характеристик прошел успешно
'; } if ($inf['room'] == 303 && $u->info['admin'] == 0) { @@ -200,207 +74,42 @@ if (!isset($inf['id'])) { die('Ошибка. Персонаж не найден.'); } -if ($u->info['align'] > 1 && $u->info['align'] < 2) { +$zodiac = new Zodiac($inf['bithday']); -} elseif ($u->info['align'] > 3 && $u->info['align'] < 4) { - -} elseif ($inf['redirect'] != '0' && $u->info['admin'] == 0 && $u->info['id'] != $inf['id']) { - header('location: ' . $inf['redirect']); - die(); -} - - -function zodiak($d, $m, $y) -{ - $dr = $d; - switch ($m) { - case '03': - $zodiac_id = 12; - if ($dr > 20) { - $zodiac_id = 1; - } - break; - case '04': - $zodiac_id = 1; - if ($dr > 19) { - $zodiac_id = 2; - } - break; - case '05': - $zodiac_id = 2; - if ($dr > 20) { - $zodiac_id = 3; - } - break; - case '06': - $zodiac_id = 3; - if ($dr > 21) { - $zodiac_id = 4; - } - break; - case '07': - $zodiac_id = 4; - if ($dr > 22) { - $zodiac_id = 5; - } - break; - case '08': - $zodiac_id = 5; - if ($dr > 22) { - $zodiac_id = 6; - } - break; - case '09': - $zodiac_id = 6; - if ($dr > 22) { - $zodiac_id = 7; - } - break; - case '10': - $zodiac_id = 7; - if ($dr > 22) { - $zodiac_id = 8; - } - break; - case '11': - $zodiac_id = 8; - if ($dr > 21) { - $zodiac_id = 9; - } - break; - case '12': - $zodiac_id = 9; - if ($dr > 21) { - $zodiac_id = 10; - } - break; - case '01': - $zodiac_id = 10; - if ($dr > 19) { - $zodiac_id = 11; - } - break; - case '02': - $zodiac_id = 11; - if ($dr > 18) { - $zodiac_id = 12; - } - break; - } - return $zodiac_id; -} - -$id_zodiak = null; -$bday = explode('.', $inf['bithday']); -if (isset($bday[0], $bday[1], $bday[2])) { - $id_zodiak = zodiak($bday[0], $bday[1], $bday[2]); -} - -if ($id_zodiak == null) { - $id_zodiak = 1; -} - -$name_zodiak = [1 => 'Овен', 2 => 'Телец', 3 => 'Близнецы', 4 => 'Рак', 5 => 'Лев', 6 => 'Дева', 7 => 'Весы', 8 => 'Скорпион', 9 => 'Стрелец', 10 => 'Козерог', 11 => 'Водолей', 12 => 'Рыбы']; -$name_zodiak = $name_zodiak[$id_zodiak]; - -function statInfo($s) +function statInfo($s): string { global $st, $st2; - $st[$s] = 0 + $st[$s]; - $st2[$s] = 0 + $st2[$s]; - if ($st[$s] != $st2[$s]) { + + if (isset($st[$s])) { + $st[$s] = (int)$st[$s]; + } else { + $st[$s] = 0; + } + + if (isset($st2[$s])) { + $st2[$s] = (int)$st2[$s]; + } else { + $st2[$s] = 0; + } + + if ($st[$s] == $st2[$s]) { + return '' . $st[$s] . ''; + } else { $s1 = '+'; if ($st2[$s] > $st[$s]) { $s1 = '-'; } - $cl = [ - -2 => "#550000", - -1 => "#990000", - 0 => "#000000", - 33 => "#004000", - 34 => "#006000", - 35 => "#006100", - 36 => "#006200", - 37 => "#006300", - 38 => "#006400", - 39 => "#006500", - 40 => "#006600", - 41 => "#006700", - 42 => "#006800", - 43 => "#006900", - 44 => "#006A00", - 45 => "#006B00", - 46 => "#006C00", - 47 => "#006D00", - 48 => "#006E00", - 49 => "#006F00", - 50 => "#007000", - 51 => "#007100", - 52 => "#007100", - 53 => "#007200", - 54 => "#007300", - 55 => "#007400", - 56 => "#007500", - 57 => "#007600", - 58 => "#007700", - 59 => "#007800", - 60 => "#007900", - 61 => "#007A00", - 62 => "#007B00", - 63 => "#007C00", - 64 => "#007D00", - 65 => "#007E00", - 66 => "#007F00", - 67 => "#008000", - 68 => "#008100", - 69 => "#008200", - 70 => "#008300", - 71 => "#008400", - 72 => "#008500", - 73 => "#008600", - 74 => "#008700", - 75 => "#008700", - 76 => "#008800", - 77 => "#008900", - 78 => "#008A00", - 79 => "#008B00", - 80 => "#008C00", - 81 => "#008D00", - 82 => "#008E00", - 83 => "#008F00", - 84 => "#009000", - 85 => "#009100", - 86 => "#009200", - 87 => "#009300", - 88 => "#009400", - 89 => "#009500", - 90 => "#009600", - 91 => "#009700", - 92 => "#009800", - 93 => "#009900", - 94 => "#009A00", - 95 => "#009B00", - 96 => "#009C00", - 97 => "#009D00", - 98 => "#009E00", - 99 => "#009F00", - 100 => "#00A000", - ]; + $colours = ['black', 'darkred', 'darkgreen', 'green']; - - //$cl = array(0=>'#003C00',1=>'green',2=>'#0DAC0D',3=>'#752415',4=>''); - $si = 4; + $si = 0; if ($s1 == '-') { - $si = 0; + $si = 2; } $t = $st[$s]; $j = $st[$s] - $st2[$s]; $t = $t - $j; if ($j > 0) { - if ($t == 0) { - $t = 1; - } if ($t == 0) { $t = 1; } @@ -409,46 +118,31 @@ function statInfo($s) $d = 100; } if ($d < 33) { - $si = 0; + $si = 2; } elseif ($d > 100) { - $si = 100; + $si = 3; } } elseif ($j < 0) { - $si = 3; + $si = 1; } - if ($st[$s] < -0) { - $si = -1; - } elseif ($st[$s] <= round($st2[$s])) { - $si = -2; + if ($st[$s] < 0 || $st[$s] <= round($st2[$s])) { + $si = 1; } - echo '' . $st[$s] . ' (' . $st2[$s] . ' ' . $s1 . ' ' . abs( - $st[$s] - $st2[$s] - ) . ')'; - } else { - echo '' . $st[$s] . ''; + + return '' . $st[$s] . ' (' . $st2[$s] . ' ' . $s1 . ' ' . abs($st[$s] - $st2[$s]) . ')'; } } -$room = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `id`="' . $inf['room'] . '" LIMIT 1')); - -if ($inf['clan'] > 0) { - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="' . $inf['clan'] . '" LIMIT 1')); -} +$room['name'] = $inf['room_name']; $nopal = false; -if ($u->info['align'] < $inf['align'] && $inf['align'] > 1 && $inf['align'] < 2 && $u->info['admin'] == 0) { - $nopal = true; -} elseif ($u->info['admin'] == 0 && $inf['admin'] > 0) { +if (!$u->isAdmin() && $inf['admin'] > 0) { $nopal = true; } -if ($u->info['admin'] == 0) { - $nopal = true; -} - -if ($inf['inTurnir'] > 0 && ($u->info['inTurnir'] == $inf['inTurnir'] || $u->info['admin'] > 0)) { +if ($inf['inTurnir'] > 0 && ($u->info['inTurnir'] == $inf['inTurnir'] || $u->isAdmin())) { $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $inf['inTurnir'] . '" LIMIT 1')); if (isset($bs['id']) && ($bs['users'] <= 2 || $bs['type_btl'] == 1)) { $bs_rm = mysql_fetch_array( @@ -462,301 +156,49 @@ if ($inf['inTurnir'] > 0 && ($u->info['inTurnir'] == $inf['inTurnir'] || $u->inf } } +$st = []; +$st2 = []; +$st = $u->getStats($inf['id'], 1, 0, true); +$st2 = $st[1]; +$st = $st[0]; + +$rgd = $u->regen($inf['id'], $st, 1); +$us = $u->getInfoPers($inf['id'], 1, $st); + +if (isset($bs['id']) && $bs['type_btl'] == 2 && ($u->info['x'] != $inf['x'] || $u->info['y'] != $inf['y'])) { + $us[0] = '
Информация скрыта,
Вы в разных комнатах.
'; +} + +if ($inf['align'] == 9) { + $st['hpNow'] = $st['hpNow'] / ($st['hpAll'] / 100); + $st['hpAll'] = '100%'; + $rgd[0] = '0.28'; +} + ?> - + - Информация о <?= $inf['login']; ?> - - + - + + - + } + - - + + ' . $uer . '
'; + echo '
' . $uer . '

'; } ?> - - - - -
- - - - -
-
getStats($inf['id'], 1, 0, true); - $st2 = $st[1]; - $st = $st[0]; +
+
- $rgd = $u->regen($inf['id'], $st, 1); - $us = $u->getInfoPers($inf['id'], 1, $st); - if (isset($bs['id']) && $bs['type_btl'] == 2 && ($u->info['x'] != $inf['x'] || $u->info['y'] != $inf['y'])) { - $us[0] = '








Информация скрыта,
Вы в разных комнатах.






'; - } - if ($us != false) { - echo $us[0]; - } else { - echo 'information is lost.'; - } ?>
- -
-
- +
+ ' ?> +
+ +
+
+ + + time() - 520 && $inf['banned'] == 0 && $inf['invis'] != 1 && $inf['invis'] < time()) { + echo 'Персонаж сейчас находится в клубе.
"' . $room['name'] . '"'; + } else { + echo 'Персонаж не в клубе'; + + if ($inf['online'] == 0) { + $inf['online'] = $inf['timeREG']; + } + if (date('Y', $inf['online']) == date('Y')) { + echo ', но был тут:
' . date('d.m.Y H:i', $inf['online']) . + 'Время сервера' . + '
(' . Conversion::secondsToTimeout(time() - $inf['online']) . ' назад)'; + } + } + if ($inf['inUser'] > 0 && $inf['id'] != 12059) { + echo '
Персонаж вселился в бота'; + } + if ($inf['battle'] > 0 && $battleid) { + echo '
Персонаж сейчас в поединке'; + } + } else { + if ($inf['res_x'] - time() > 0) { + echo '
Появится через ' . Conversion::secondsToTimeout($inf['res_x'] - time()) . '
'; + } else { + echo '
Появится в ближайшее время...
'; + } + } + //Эффект админ + if ($u->isAdmin()) { + function effAdm($pl): string + { + if ($pl['v1'] != 'priem') { + $eff = Db::getRow('select img, actionTime from eff_main where id2 = ?', [$pl['id_eff']]); + $pl['img2'] = $eff['img']; + $pl['name'] .= "\r" . 'Действует еще ' . Conversion::secondsToTimeout($pl['timeUse'] - time() + $eff['actionTime']); + } + + return ''; + } + + if (isset($_GET['cancel_eff'])) { + Effects::removeByEffectId($inf['id'], (int)$_GET['cancel_eff']); + die(''); + } + + $eff_adm = ''; + foreach (Effects::getActive($inf['id']) as $effect) { + $eff_adm .= effAdm($effect); + } + + if (!empty($eff_adm)) { + echo '
Эффекты на персонаже:
' . $eff_adm . '
'; + } + ?> +
+ +
- - - -
- info['admin'] > 0) { - $nodell = Db::getRow('select id, inUser from users where login = ? order by id limit 1', [$inf['login']]); - $sp = Db::getRows('select id from users where login = ? and id != ?', [$inf['login'], $inf['id']]); - $nolog = ''; - foreach ($sp as $pl) { - if (isset($_GET['del_copy']) && $_GET['del_copy'] == $pl['id']) { - if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { - Db::sql('update users set login = ? where id = ?', ['DELETE', $pl['id']]); - } - } else { - $nolog .= '
' . $u->microLogin($pl['id'], 1); - if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { - $nolog .= ' (персонажа можно удалить)'; - } - if ($pl['id'] == $nodell['id']) { - $nolog .= ' (основной персонаж)'; - } - $nolog .= '
'; - } - } - - if (!empty($nolog)) { - echo 'Копии персонажа:' . $nolog . ''; - } - - } - ?> -
- Сила:
- Ловкость:
- Интуиция:
- Выносливость:
- Интеллект:
- Мудрость:
- 9 || $st['s7'] != 0) { ?> - Духовность:
- - 11 || $st['s8'] != 0) { ?> - Воля:
- - 14 || $st['s9'] != 0) { ?> - Свобода духа:
- - 19 || $st['s10'] != 0) { ?> - Божественность:
- - 0) { ?> - Энергия:
- - Рейтинг сегодня:
-
-
-
- Уровень:
- - Побед: ' . number_format( - $inf['win'], 0, ",", " " - ) . ''; - } ?>
- Поражений:
- Ничьих:
- 0) { - $pc = Db::getRow('select * from clan where id = ?', [$inf['clan']]); - - if (isset($pc['id'])) { - $pc['img'] = $pc['name_mini'] . '.gif'; - if ($inf['clan_prava'] == 'glava') { - $inf['mod_zvanie'] = '- Глава клана'; - } elseif ($inf['mod_zvanie'] != '') { - $inf['mod_zvanie'] = '- ' . htmlspecialchars($inf['mod_zvanie'], null); - $inf['mod_zvanie'] = str_replace('<b>', '', $inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</b>', '', $inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('<u>', '', $inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</u>', '', $inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('<i>', '', $inf['mod_zvanie']); - $inf['mod_zvanie'] = str_replace('</i>', '', $inf['mod_zvanie']); - } - echo 'Клан: ' . $pc['name'] . ' ' . $inf['mod_zvanie'] . '
'; - } - } - - if (!empty($inf['admin'])) { - echo 'Администратор
'; - } else { - if ($inf['pass'] == 'saintlucia' && $u->info['admin'] > 0) { - echo 'Неигровой персонаж
'; - } - if ($inf['align'] > 1 && $inf['align'] < 2 || $inf['align'] > 3 && $inf['align'] < 4) { - echo 'Модератор
'; - } - if ($inf['align'] == 50) { - echo 'Алхимик'; - if (!empty($inf['mod_zvanie'])) { - echo ' - ' . $inf['mod_zvanie']; - } - echo '
'; - } - echo 'День рождения персонажа: '; - if (empty($inf['timereg'])) { - echo 'До начала времен...'; - } else { - echo date('d.m.Y H:i', $inf['timereg']); - } - echo '
'; - if ($inf['palpro'] > time()) { - echo 'Персонаж чист перед законом: до ' . date('d.m.Y H:i', $inf['palpro']); - } - } - if ($inf['redirect'] != '0' && ($u->info['admin'] > 0 || $u->info['id'] == $inf['id'])) { - echo 'Редирект: ' . htmlspecialchars($inf['redirect']) . '
'; - } - - $twk = ''; - $sp = mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "' . $inf['id'] . '"'); - while ($pl = mysql_fetch_array($sp)) { - if ($pl['twink'] != 0) { - if ($twk != '') { - $twk .= ', '; - } - if ($inf['twink'] == $pl['twink']) { - $twk .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; - } else { - $twk .= '' . $pl['login'] . ' [' . $pl['level'] . ']'; - } - } - } - if ($twk != '') { - echo 'Другие образы: ' . $twk . '
'; - } - - //История имен - $names = ''; - $sp = mysql_query('SELECT * FROM `lastnames` WHERE `uid` = "' . $inf['id'] . '" ORDER BY `time` DESC'); - $i = 0; - while ($pl = mysql_fetch_array($sp)) { - if ($i > 0) { - $names .= '                      '; - } - $names .= '\'' . $pl['login'] . '\' до ' . date( - 'd.m.Y H:i', $pl['time'] - ) . '
'; - $i++; - } - if ($names != '') { - echo 'История имен: ' . $names; - } - $algnt = mysql_fetch_array( - mysql_query( - 'SELECT * FROM `users_align` WHERE `uid` = "' . $inf['id'] . '" AND (`delete` = 0 OR `delete` > "' . time() . '") LIMIT 1' - ) - ); - if (isset($algnt['id'])) { - if ($algnt['align'] == 1) { - echo '
Выбранная сторона: Свет'; - if ($algnt['delete'] > 0) { - echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; - } - echo '
'; - } elseif ($algnt['align'] == 3) { - echo '
Выбранная сторона: Тьма'; - if ($algnt['delete'] > 0) { - echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; - } - echo '
'; - } elseif ($algnt['align'] == 7) { - echo '
Выбранная сторона: Нейтрал'; - if ($algnt['delete'] > 0) { - echo ' (до ' . date('d.m.Y H:i', $algnt['delete']) . ')'; - } - echo '
'; - } - } - if ($st['silver'] > 0) { - echo '
'; - echo 'Благословление Ангелов: '; - echo '
'; - } - if ($inf['win_t'] > 0) { - ?> -
- Побед в турнирах: -
- Поражений в турнирах:
- -
-
-
+ + + +
+
+ Показать модификаторы +
+
+ + +
+ + isAdmin()) { + $nodell = Db::getRow('select id, inUser from users where login = ? order by id limit 1', [$inf['login']]); + $sp = Db::getRows('select id from users where login = ? and id != ?', [$inf['login'], $inf['id']]); + $nolog = ''; + foreach ($sp as $pl) { + if (isset($_GET['del_copy']) && $_GET['del_copy'] == $pl['id']) { + if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { + Db::sql('update users set login = ? where id = ?', ['DELETE', $pl['id']]); + } + } else { + $nolog .= '
' . $u->microLogin($pl['id'], 1); + if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) { + $nolog .= ' (персонажа можно удалить)'; + } + if ($pl['id'] == $nodell['id']) { + $nolog .= ' (основной персонаж)'; + } + $nolog .= '
'; + } + } + + if (!empty($nolog)) { + echo 'Копии персонажа:' . $nolog . ''; + } + + } + ?> +
+ Сила:
+ Ловкость:
+ Интуиция:
+ Выносливость:
+ Интеллект:
+ Мудрость:
+ 9 || $st['s7'] != 0) { ?> + Духовность:
+ + Рейтинг сегодня:
+
+
+
+ Уровень:
+ - + Побед: + ' . $inf['win'] . ''; ?>
+ Поражений:
+ Ничьих:
+ 0) { + $pc = ClanInfo::getById($inf['clan']); + + if (isset($pc['id'])) { + if ($inf['clan_prava'] == 'glava') { + $inf['mod_zvanie'] = '- Глава клана'; + } elseif (!empty($inf['mod_zvanie'])) { + $inf['mod_zvanie'] = '- ' . htmlspecialchars($inf['mod_zvanie'], null); + $inf['mod_zvanie'] = str_replace('<b>', '', $inf['mod_zvanie']); + $inf['mod_zvanie'] = str_replace('</b>', '', $inf['mod_zvanie']); + $inf['mod_zvanie'] = str_replace('<u>', '', $inf['mod_zvanie']); + $inf['mod_zvanie'] = str_replace('</u>', '', $inf['mod_zvanie']); + $inf['mod_zvanie'] = str_replace('<i>', '', $inf['mod_zvanie']); + $inf['mod_zvanie'] = str_replace('</i>', '', $inf['mod_zvanie']); + } + echo 'Клан: ' . $pc['name'] . ' ' . $inf['mod_zvanie'] . '
'; + } elseif ($u->isAdmin()) { + echo 'Подана заявка на регистрацию клана или ошибка в базе кланов.'; + } + } + + $accountStatus = new class { + public static function print(bool $condition, string $type, string $color, string $status = ''): void + { + if (!$condition) { + return; + } + echo "$type"; + if (!empty($status)) { + echo " - $status"; + } + echo '
'; + } + }; + + $accountStatus::print(!empty($inf['admin']), 'Администратор', 'green'); + $accountStatus::print($inf['pass'] === 'saintlucia' && $u->isAdmin(), 'NPC', 'dimgray'); + $accountStatus::print( + ($inf['align'] > 1 && $inf['align'] < 2 || $inf['align'] > 3 && $inf['align'] < 4) && empty($inf['admin']), + 'Модератор', + 'green', + $inf['mod_zvanie']); + $accountStatus::print($inf['align'] === 50, 'Алхимик', 'orange', $inf['mod_zvanie']); + + echo 'День рождения персонажа: '; + if (empty($inf['timereg'])) { + echo 'До начала времен...'; + } else { + echo date('d.m.Y', $inf['timereg']); + } + echo '
'; + + $twinks = new Twinks($inf['id'], $inf['twink']); + $lastnames = new LastNames($inf['id']); + $ai = new Achievements($u); + $awards = new Awards($inf['id']); + $status = new \Inf\Status(); + + $achievements = ''; + foreach ($ai->getTypes() as $type) { + $i = $ai->getInfo($inf['id']); + if (empty($i[$type])) { + continue; + } + $achievements .= + '
' . + '
' . $i['name' . $type] . '
' . + '
Ранг ' . $i['klas' . $type] . ' :
' . + ' ' . $i['name' . $type] . ' ' . + '
'; + } + + if ($inf['align'] == 50) { + $awards->addCustom('Официальный дилер', 'Имеет право вести коммерческую деятельность.', 'alchemy1.gif'); + } + + if ($inf['vip'] === 1) { + $awards->addCustom('За помощь в развитии проекта.', '', 'vip2.gif'); + } + + if (!empty($inf['marry'])) { + $partner = Db::getValue('select login from users where id = ?', [$inf['marry']]); + if ($partner) { + $awards->addCustom('Семейные узы', "В счастливом браке с $partner.", 'i/i_marry.gif'); + } + } + + //сам себя наебал, condition не заменяет isset, а вот ?? null это уже чисто костыль, который будет тут висеть пока не придёт ясность как формируется $st + $status->add($inf['jail'] > time(), 'В заточении', $inf['jail'], 'i/jail.gif'); + $status->add(!empty($st['puti']), 'Не может передвигаться', $st['puti'] ?? null, 'i/items/chains.gif'); + $status->add($inf['molch1'] > time(), 'Не может общаться в чате', $inf['molch1'], 'i/sleeps' . $inf['sex'] . '.gif'); + $status->add($inf['molch2'] > time(), 'Не может общаться на форуме', $inf['molch2'], 'i/fsleeps' . $inf['sex'] . '.gif'); + $status->add($inf['clan_delay'] > time(), 'Не может вступать в кланы', $inf['clan_delay']); + $status->add($inf['info_delete'] > time() || $inf['info_delete'] === 1, 'Профиль скрыт', $inf['info_delete'], 'stopinfo.png'); + + foreach (Effects::getAllInjuries($inf['id']) as $injury) { + $status->add(true, 'Травма: «' . $injury['name'] . '»', $injury['timeUse'] + $injury['timeAce'], 'i/jail.gif'); + } + + $twinks->print(); + $lastnames->print(); + ?> +
+
+ + + print(); + $status->print(); + + if (!empty($achievements)) { + echo << +
+ Достижения персонажа: +
+
$achievements
+
+ HTML; + } + + if ($inf['banned'] > 0 || $inf['jail'] > time()) { + Delo::printPublicModerationStatus($inf['id']); + } + + //подарки (это какой-то сферический пиздец в вакууме!) + if ($inf['info_delete'] < time() && $inf['info_delete'] != 1 || $u->isModerator()) { + $gs = ['', '', '']; + $i = 0; + $ij1 = 1; + $ij2 = 1; + + $q1 = "select * from items_users left join items_main on items_main.id = items_users.item_id + where uid = ? and gift != '' order by items_users.id desc"; + $presentsList1 = Db::getRows($q1, [$inf['id']]); + + foreach ($presentsList1 as $pl) { + if (stristr($pl['data'], 'gift_id')) { + $po = Conversion::dataStringToArray($pl['data']); + $pl_gift = $po['gift_id']; + if ($pl_gift > 0) { + $pl_gift = Db::getRow('select name, img from users_gifts where id = ?', [$pl_gift]); + if ($pl_gift) { + //Именной подарок + $pl['name'] = $pl_gift['name']; + $pl['img'] = $pl_gift['img']; + } + } + } + //подарки + if ($pl['gift'] == 1) { + $pl['gift2'] = 'Невидимка'; + } else { + $pl['gift2'] = $pl['gift']; + } + $gs[0] .= ''; + $ij1++; + } + + $q2 = "select * from items_users left join items_main on items_main.id = items_users.item_id + where uid = ? and gift != '' and inOdet = 0 and (type in (63,37) or data like '%|giftsee=2%') order by items_users.id desc"; + $presentsList2 = Db::getRows($q2, [$inf['id']]); + + foreach ($presentsList2 as $pl) { + if ($pl['gift'] == 1) { + $pl['gift2'] = 'Невидимка'; + } else { + $pl['gift2'] = $pl['gift']; + } + $gs[1] .= ''; + $ij2++; + } + + if (!empty($gs[0]) || !empty($gs[1])) { + echo '

' . + '
' . + '
Подарки:

' . $gs[0] . + '
' . + $gs[1] . + '
'; + + $q3 = "select count(items_users.id) from items_users left join items_main on items_main.id = items_users.item_id + where (type in (28,63,38,64,37) or data like '%|giftsee=1' or data like '%|giftsee=2%') and uid = ? and gift != '' and inOdet = 0"; + $ij4 = Db::getValue($q3, [$inf['id']]); + + if ($ij1 + $ij2 + 1 < $ij4) { + if (!isset($_GET['maxgift'])) { + echo 'Нажмите сюда, чтобы увидеть все подарки...'; + } else { + echo 'Нажмите сюда, чтобы скрыть подарки'; + } + } + } + } + + if ($inf['align'] == '9' && $u->isAdmin()) { + if (isset($_GET['emonster'])) { + $monster = new Monster($inf['id']); + + ?> + Параметры монстра:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Место появления (id комнаты): + +   +
Время ожидания после поражения бота: + мин. +
Исчезнет после своей победы: +
+
+
Появляется, + ДН + + Д + + + М + + Ч + + Мин + +
Исчезает,    ДН + + Д + + + М + + Ч + + Мин +
+
+
Текст появления (Логин бота {b}, Логины игроков {u}):
Текст исчезновения:
Текст победы игрока:
Текст поражения игрока:
Текст ничьей:
+
+ Награда (победа игрока):
Кр.:
Екр.:
Опыт (За 100% НР монстра):
Предметы (id@kolvo@data, ...):
Эффект:
Подвиги:
+
+ Награда (поражение игрока):
Кр.:
Екр.:
Опыт:
Предметы:
Эффект:
Подвиги:
+
+ +
+

+
+
+
+ Скрыть +
+
+ +
+
+ Настройка монстра +
+
'; + } + //темные делишки :D + if ($inf['align'] != 9 && $u->isModerator() && !$nopal) { + $m = []; + $mults = Db::getRows('select * from mults where (uid = ? or uid2 = ?) and uid != 0 and uid2 != 0', [$inf['id'], $inf['id']]); + foreach ($mults as $mult) { + $usr = $inf['id'] === $mult['uid'] ? $mult['uid2'] : $mult['uid']; + if (empty($usr) || $usr === $inf['id']) { + continue; } + + $m[] = $u->microLogin($usr, 1, 0); } - $sp = mysql_query( - 'SELECT * FROM `users_ico` WHERE `uid` = "' . $inf['id'] . '" AND (`endTime` = 0 OR `endTime` > ' . time() . ') LIMIT 100' - ); - while ($pl = mysql_fetch_array($sp)) { - $stlico = ''; - - if ($pl['type'] == 2) { - $stlico .= 'width:37px;height:37xp;padding:2px;'; - } - - if ($stlico != '') { - $stlico = 'style="' . $stlico . '"'; - } - $icon = ' '; - - if ($pl['href'] != '#' && $pl['href'] != '') { - $ico[$pl['type']] .= '' . $icon . ''; - } else { - $ico[$pl['type']] .= $icon; + echo '
За игроком замечены следующие темные делишки:
'; + if (!isset($_GET['mod_inf'])) { + echo 'Показать личное дело'; + } else { + //Личное дело персонажа + foreach (Delo::getAllByUserId($inf['id']) as $logstr) { + echo date('d.m.Y H:i:s', $logstr['time']) . ' ' . $logstr['text'] . '
'; } + echo 'Скрыть личное дело'; } - unset($icon); + echo '

'; + //Информация для паладинов\тарманов\ангелов - if ($inf['vip'] == 1) { - $ico[1] .= ' '; + if ((int)$inf['host_reg'] >= 1) { + $inf['ref'] = $u->microLogin((int)$inf['host_reg']); + } else { + $inf['ref'] = '--'; + } + if (!isset($inf['ipReg'])) { + $inf['ipReg'] = '--'; } - //сильвер - if ($st['silver'] > 0) { - $ico[1] .= ' '; + echo '
Секретно!
'; + echo 'День рождения: ' . $inf['bithday'] . '
'; + echo date('Последний вход: d.m.Y H:i', $inf['online']) . '
'; + echo '
'; + echo 'Персонажа пригласили: ' . $inf['ref'] . '
' . + 'IP при регистрации: ' . $inf['ipReg'] . '
'; + + echo 'Текущий IP: ' . $inf['ip'] . '
Последние входы:
'; + $auth = Db::getRows('select ip, time from logs_auth where uid = ? and type = 1 order by id desc', [$inf['id']]); + foreach ($auth as $a) { + $date = date(': d.m.Y H:i', $a['time']); + echo "{$a['ip']}$date
"; } - $irep = mysql_fetch_array( - mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $inf['id'] . '" LIMIT 1') - ); - if (isset($irep['id'])) { - //Водосток - if ($irep['repdreamscity'] > 9999) { - $ico[1] .= ''; - } elseif ($irep['repdreamscity'] > 4999) { - $ico[1] .= ''; - } elseif ($irep['repdreamscity'] > 999) { - $ico[1] .= ''; - } - - //Храм знаний - if ($irep['rep1'] > 9999) { - $ico[1] .= ''; - } elseif ($irep['rep1'] > 999) { - $ico[1] .= ''; - } elseif ($irep['rep1'] > 99) { - $ico[1] .= ''; - } - - //Излом хаоса - if ($irep['repizlom'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repizlom'] > 9999) { - $ico[1] .= ''; - } elseif ($irep['repizlom'] > 999) { - $ico[1] .= ''; - } elseif ($irep['repizlom'] > 99) { - $ico[1] .= ''; - } - - //capitalcity - if ($irep['repcapitalcity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repcapitalcity'] > 9999) { - $ico[1] .= ''; - } - - //angelscity - if ($irep['repangelscity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repangelscity'] > 9999) { - $ico[1] .= ''; - } - - //demonscity - if ($irep['repdemonscity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repdemonscity'] > 9999) { - $ico[1] .= ''; - } - - //devilscity - if ($irep['repdevilscity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repdevilscity'] > 9999) { - $ico[1] .= ''; - } - - //suncity - if ($irep['repsuncity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repsuncity'] > 9999) { - $ico[1] .= ''; - } - //Гора легиона (сука как она меня заебала) by R - if ($irep['repabandonedplain'] > 9999) { - $ico[1] .= ''; - } elseif ($irep['repabandonedplain'] > 999) { - $ico[1] .= ''; - } - - //emeraldscity - if ($irep['repemeraldscity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repemeraldscity'] > 9999) { - $ico[1] .= ''; - } - - //sandcity - if ($irep['repsandcity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repsandcity'] > 9999) { - $ico[1] .= ''; - } - - //mooncity - if ($irep['repmooncity'] > 24999) { - $ico[1] .= ''; - } elseif ($irep['repmooncity'] > 9999) { - $ico[1] .= ''; - } - if ($inf['referals'] >= 3000) // значок за рефов - { - $ico[1] .= ''; - } elseif ($inf['referals'] > 1500) { - $ico[1] .= ''; - } elseif ($inf['referals'] > 600) { - $ico[1] .= ''; - } + if (!empty($m)) { + echo 'Другие ники этого бойца: ' . implode(', ', $m) . '
'; } - if ($inf['banned'] == 0) { - $ai = new Achievements($u); - $ico[3] .= '
'; + $refusers = []; + $invitedByUser = Db::getRows('select ip, ipreg, online, timereg from users where host_reg = ? order by timereg desc', [$inf['id']]); + foreach ($invitedByUser as $refuser) { + $refusers[] = date('Дата регистрации: d.m.Y H:i', $refuser['timereg']) . + DIRECTORY_SEPARATOR . + date('Был тут: d.m.Y H:i ', $refuser['online']) . + $u->microLogin($inf['id']) . + "({$refuser['ip']}, {$refuser['ipreg']})"; + } - foreach ($ai->getTypes() as $type) { - $tmp_1 = $ai->getInfo($inf['id']); - if (!empty($tmp_1[$type])) { - $ico[3] .= '
' . $tmp_1['name' . $type] . '
Ранг ' . $tmp_1['klas' . $type] . ' :
' . $tmp_1['name' . $type] . '
'; - } + if (!empty($refusers)) { + echo '
Рефералы бойца:
' . implode('
', $refusers) . '
'; + } + + if ($u->isAdmin()) { + $mls = Db::getValue('select count(*) from users_rbk where email = ?', [$inf['mail']]) > 0; + $online = Db::getRow('select time_all, time_today from online where uid = ?', [$inf['id']]); + + echo '
'; + echo 'Комната: ' . $inf['room'] . '
'; + echo 'E-mail: ' . $inf['mail']; + if ($mls) { + echo ' (рассылка)'; } - - $ico[3] .= '
'; - } - - - function timeOut($ttm, $travm = false) - { - if (!$travm) { - $out = ''; - $time_still = $ttm; - $tmp = floor($time_still / 2592000); - $id = 0; - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " мес. "; - } - $time_still = $time_still - $tmp * 2592000; - } - $tmp = floor($time_still / 604800); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " нед. "; - } - $time_still = $time_still - $tmp * 604800; - } - $tmp = floor($time_still / 86400); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " дн. "; - } - $time_still = $time_still - $tmp * 86400; - } - $tmp = floor($time_still / 3600); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " ч. "; - } - $time_still = $time_still - $tmp * 3600; - } - $tmp = floor($time_still / 60); - if ($tmp > 0) { - $id++; - if ($id < 3) { - $out .= $tmp . " мин. "; - } - } - if ($out == '') { - if ($time_still < 0) { - $time_still = 0; - } - $out = $time_still . ' сек.'; - } - } - return $out; - } - - if ($ico[1] != '') { - echo $ico[1]; - } - - echo ''; - if ($inf['jail'] > time()) { - echo '
Персонаж находится в заточении еще ' . timeOut( - $inf['jail'] - time() - ) . ' '; - } - if (isset($st['puti'])) { - echo '
Персонаж не может передвигаться еще ' . timeOut( - $st['puti'] - time() - ) . ' '; - } - if ($inf['molch1'] > time()) { - echo '
На персонажа наложено заклятие молчания. Будет молчать еще ' . timeOut( - $inf['molch1'] - time() - ) . ' '; - } - if ($inf['molch2'] > time()) { - echo '
На персонажа наложено заклятие молчания на форуме. Будет молчать еще ' . timeOut( - $inf['molch2'] - time() - ) . ' '; - } - if ($inf['clan_delay'] > time()) { - echo '
У персонажа запрет на вступление в кланы ещё: ' . timeOut( - $inf['clan_delay'] - time() - ) . ' '; - } - if ($inf['info_delete'] > time() || $inf['info_delete'] == 1) { - echo '
На персонажа наложено заклятие обезличивания.'; - if ($inf['info_delete'] > 1) { - echo ' Будет обезличен еще ' . timeOut($inf['info_delete'] - time()) . ''; - } - } - - //Если у персонажа есть травмы, физ. и маг. травмы - $sp = mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $inf['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6' - ); - while ($pl = mysql_fetch_array($sp)) { - echo '
У персонажа - "' . $pl['name'] . '" еще ' . $u->timeOut( - $pl['timeUse'] - time() + $pl['timeAce'] - ); - } - - //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек. - $nn = 0; - while ($nn < count($st['effects'])) { - if ($st['effects'][$nn]['id_eff'] == 5) { - $osl = mysql_fetch_array( - mysql_query( - 'SELECT `id2`,`actionTime` FROM `eff_main` WHERE `id2` = "5" LIMIT 1' - ) - ); - echo '
Персонаж ослаблен из-за смерти в бою, еще ' . timeOut( - $st['effects'][$nn]['timeUse'] + $st['effects'][$nn]['timeAce'] + $osl['actionTime'] - time() - ) . ' '; - $nn = count($st['effects']) + 1; - } - $nn++; - } - - echo '
'; - - if (!empty($ico[3])) { - echo '
Достижения персонажа:
' . $ico[3] . '
'; - } - unset($ico); - - if ( - ( - $inf['align'] >= 2 && - $inf['align'] < 3 && - ( - $inf['haos'] > time() || - $inf['haos'] == 1 - ) - ) || - $inf['banned'] > 0 || - $inf['jail'] > time()) { - $to = ''; - if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time() || $inf['haos'] == 1)) { - $to = 'хаос'; - } - if ($inf['banned'] > 0) { - if ($to = '') { - $to = 'блок'; - } else { - $to = $to . '/блок'; - } - } - $fm = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`hb`,`text` FROM `users_delo` WHERE `uid` = "' . $inf['id'] . '" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1' - ) - ); - echo '
'; - if (isset($fm['id'])) { - $from = 'паладинов'; - if ($fm['hb'] == 2) { - $from = 'Ангелов'; - } elseif ($fm['hb'] == 3) { - $from = 'тарманов'; - } - echo 'Сообщение от модераторов:
'; - echo '' . $fm['text'] . '
'; - } - if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time() || $inf['haos'] == 1)) { - if ($inf['haos'] == 1) { - echo 'Хаос бессрочно.'; - } else { - echo 'Хаос еще ' . timeOut($inf['haos'] - time()) . ''; - } + echo '   &   ' . $inf['send'] . '
'; + echo "

"; + if (isset($online['time_all'], $online['time_today'])) { + echo 'Время в онлайне (всего): ' . Conversion::secondsToTimeout($online['time_all']) . + '
Время в онлайне (сегодня): ' . Conversion::secondsToTimeout($online['time_today']) . '
'; } echo '
'; } - //подарки - if (($inf['info_delete'] < time() && $inf['info_delete'] != 1) || ($u->info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0 || $u->info['nadmin'] > 0)) { - $gs = ['', '', '']; - $glim = 1000; - $i = 0; - $ij1 = 1; + $donatedEkr = Db::getValue('select sum(ekr) from pay_operation where uid = ? and good > 1', [$inf['id']]) ?: 0; - /* from WHERE - * ( - `im`.`type` = "38" OR - `im`.`type` = "64" OR - `iu`.`data` LIKE "%|giftsee=1%" - ) AND `iu`.`inOdet` = "0" - * */ - $sp = mysql_query( - 'SELECT `im`.*,`iu`.* -FROM `items_users` AS `iu` - LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) -WHERE - `iu`.`uid` = "' . $inf['id'] . '" AND - `iu`.`gift` != "" AND - `iu`.`delete` = "0" - ORDER BY `iu`.`id` DESC LIMIT ' . $glim - ); - while ($pl = mysql_fetch_array($sp)) { - if (stristr($pl['data'], 'gift_id')) { - $po = Conversion::dataStringToArray($pl['data']); - $pl_gift = $po['gift_id']; - if ($pl_gift > 0) { - $pl_gift = mysql_fetch_array( - mysql_query( - 'SELECT `name`,`img`,`id` FROM `users_gifts` WHERE `id` = "' . mysql_real_escape_string( - $pl_gift - ) . '" LIMIT 1' - ) - ); - if (isset($pl_gift['id'])) { - //Именной подарок - $pl['name'] = $pl_gift['name']; - $pl['img'] = $pl_gift['img']; - } - } - } - //подарки - if ($pl['gift'] == 1) { - $pl['gift2'] = 'Невидимка'; - } else { - $pl['gift2'] = $pl['gift']; - } - $gs[0] .= ''; - $ij1++; - } - $ij2 = 1; - $sp = mysql_query( - 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "63" OR `im`.`type` = "37" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim - ); - while ($pl = mysql_fetch_array($sp)) { - if ($pl['gift'] == 1) { - $pl['gift2'] = 'Невидимка'; - } else { - $pl['gift2'] = $pl['gift']; - } - $gs[1] .= ''; - $ij2++; - } - $ij3 = 1; + echo "Опыт: {$inf['exp']}
" . + "Нераспределённые статы: {$inf['ability']}
" . + "Кредиты: {$inf['money']}
" . + "ЕвроКредиты: {$inf['money2']}
" . + "
Куплено: $donatedEkr екр."; - if ($gs[0] != '' || $gs[1] != '') { - echo '

Подарки:

' . $gs[0] . '
' . $gs[1] . '
'; - $ij4 = mysql_fetch_array( - mysql_query( - 'SELECT COUNT(`iu`.`id`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = 28 OR `im`.`type` = 63 OR `im`.`type` = 38 OR `im`.`type` = 64 OR `im`.`type` = 37 OR `iu`.`data` LIKE "%|giftsee=1%" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" LIMIT 1' - ) - ); - $ij4 = $ij4[0]; - if ($ij1 + $ij2 + $ij3 < $ij4) { - if (!isset($_GET['maxgift'])) { - echo 'Нажмите сюда, чтобы увидеть все подарки...'; - } else { - echo 'Нажмите сюда, чтобы скрыть подарки'; - } - } - } - - } - if ($inf['no_ip'] == 'trupojor' && $u->info['admin'] > 0) { - if (isset($_GET['emonster'])) { - - $monster = mysql_fetch_array( - mysql_query( - 'SELECT * FROM `aaa_monsters` WHERE `uid` = "' . mysql_real_escape_string( - $inf['id'] - ) . '" LIMIT 1' - ) - ); - - if (isset($_POST['bot_sroom'])) { - $monster['start_room'] = (int)$_POST['bot_sroom']; - - $monster['start_day'] = (int)$_POST['bot_sday']; - $monster['start_dd'] = (int)$_POST['bot_sdd']; - $monster['start_mm'] = (int)$_POST['bot_smm']; - $monster['start_hh'] = (int)$_POST['bot_shh']; - $monster['start_min'] = (int)$_POST['bot_smin']; - - $monster['back_day'] = (int)$_POST['bot_bday']; - $monster['back_dd'] = (int)$_POST['bot_bdd']; - $monster['back_mm'] = (int)$_POST['bot_bmm']; - $monster['back_hh'] = (int)$_POST['bot_bhh']; - $monster['back_min'] = (int)$_POST['bot_bmin']; - - $monster['start_text'] = $_POST['bot_stext']; - $monster['back_text'] = $_POST['bot_btext']; - $monster['win_text'] = $_POST['bot_wintext']; - $monster['lose_text'] = $_POST['bot_losetext']; - $monster['nich_text'] = $_POST['bot_nichtext']; - - $monster['win_back'] = $_POST['bot_winback']; - $monster['time_restart'] = $_POST['bot_trs']; - - $monster['win_itm'] = $_POST['bot_winitm']; - $monster['win_money1'] = $_POST['bot_winmoney1']; - $monster['win_money2'] = $_POST['bot_winmoney2']; - $monster['win_exp'] = $_POST['bot_winexp']; - $monster['win_eff'] = $_POST['bot_wineff']; - $monster['win_ico'] = $_POST['bot_winico']; - - $monster['lose_itm'] = $_POST['bot_loseitm']; - $monster['lose_money1'] = $_POST['bot_losemoney1']; - $monster['lose_money2'] = $_POST['bot_losemoney2']; - $monster['lose_exp'] = $_POST['bot_loseexp']; - $monster['lose_eff'] = $_POST['bot_loseeff']; - $monster['lose_ico'] = $_POST['bot_loseico']; - - if (!isset($monster['id'])) { - mysql_query( - 'INSERT INTO `aaa_monsters` ( - `uid`,`start_room`,`start_day`,`back_day`,`start_dd`,`start_mm`,`start_hh`,`start_min`,`back_min`,`back_dd`,`back_mm`,`back_hh`, - `start_text`,`back_text`,`win_text`,`lose_text`,`win_money1`,`win_money2`,`lose_money`,`lose_money2`,`win_exp`,`lose_exp`,`win_itm`, - `lose_itm`,`win_eff`,`lose_eff`,`win_ico`,`lose_ico`,`win_back`,`time_restart`,`nich_text` - ) VALUES ( - "' . mysql_real_escape_string($inf['id']) . '", - "' . mysql_real_escape_string($monster['start_room']) . '", - "' . mysql_real_escape_string($monster['start_day']) . '", - "' . mysql_real_escape_string($monster['back_day']) . '", - "' . mysql_real_escape_string($monster['start_dd']) . '", - "' . mysql_real_escape_string($monster['start_mm']) . '", - "' . mysql_real_escape_string($monster['start_hh']) . '", - "' . mysql_real_escape_string($monster['start_min']) . '", - "' . mysql_real_escape_string($monster['back_min']) . '", - "' . mysql_real_escape_string($monster['back_dd']) . '", - "' . mysql_real_escape_string($monster['back_mm']) . '", - "' . mysql_real_escape_string($monster['back_hh']) . '", - "' . mysql_real_escape_string($monster['start_text']) . '", - "' . mysql_real_escape_string($monster['back_text']) . '", - "' . mysql_real_escape_string($monster['win_text']) . '", - "' . mysql_real_escape_string($monster['lose_text']) . '", - "' . mysql_real_escape_string($monster['win_money1']) . '", - "' . mysql_real_escape_string($monster['win_money2']) . '", - "' . mysql_real_escape_string($monster['lose_money']) . '", - "' . mysql_real_escape_string($monster['lose_money2']) . '", - "' . mysql_real_escape_string($monster['win_exp']) . '", - "' . mysql_real_escape_string($monster['lose_exp']) . '", - "' . mysql_real_escape_string($monster['win_itm']) . '", - "' . mysql_real_escape_string($monster['lose_itm']) . '", - "' . mysql_real_escape_string($monster['win_eff']) . '", - "' . mysql_real_escape_string($monster['lose_eff']) . '", - "' . mysql_real_escape_string($monster['win_ico']) . '", - "' . mysql_real_escape_string($monster['lose_ico']) . '", - "' . mysql_real_escape_string($monster['win_back']) . '", - "' . mysql_real_escape_string($monster['time_restart']) . '", - "' . mysql_real_escape_string($monster['nich_text']) . '" - ) ' - ); - } else { - mysql_query( - 'UPDATE `aaa_monsters` SET - `uid` = "' . mysql_real_escape_string($inf['id']) . '", - `start_room` = "' . mysql_real_escape_string($monster['start_room']) . '", - `start_day` = "' . mysql_real_escape_string($monster['start_day']) . '", - `back_day` = "' . mysql_real_escape_string($monster['back_day']) . '", - `start_dd` = "' . mysql_real_escape_string($monster['start_dd']) . '", - `start_mm` = "' . mysql_real_escape_string($monster['start_mm']) . '", - `start_hh` = "' . mysql_real_escape_string($monster['start_hh']) . '", - `start_min` = "' . mysql_real_escape_string($monster['start_min']) . '", - `back_min` = "' . mysql_real_escape_string($monster['back_min']) . '", - `back_dd` = "' . mysql_real_escape_string($monster['back_dd']) . '", - `back_mm` = "' . mysql_real_escape_string($monster['back_mm']) . '", - `back_hh` = "' . mysql_real_escape_string($monster['back_hh']) . '", - `start_text` = "' . mysql_real_escape_string($monster['start_text']) . '", - `back_text` = "' . mysql_real_escape_string($monster['back_text']) . '", - `win_text` = "' . mysql_real_escape_string($monster['win_text']) . '", - `lose_text` = "' . mysql_real_escape_string($monster['lose_text']) . '", - `win_money1` = "' . mysql_real_escape_string($monster['win_money1']) . '", - `win_money2` = "' . mysql_real_escape_string($monster['win_money2']) . '", - `lose_money` = "' . mysql_real_escape_string($monster['lose_money']) . '", - `lose_money2` = "' . mysql_real_escape_string($monster['lose_money2']) . '", - `win_exp` = "' . mysql_real_escape_string($monster['win_exp']) . '", - `lose_exp` = "' . mysql_real_escape_string($monster['lose_exp']) . '", - `win_itm` = "' . mysql_real_escape_string($monster['win_itm']) . '", - `lose_itm` = "' . mysql_real_escape_string($monster['lose_itm']) . '", - `win_eff` = "' . mysql_real_escape_string($monster['win_eff']) . '", - `lose_eff` = "' . mysql_real_escape_string($monster['lose_eff']) . '", - `win_ico` = "' . mysql_real_escape_string($monster['win_ico']) . '", - `lose_ico` = "' . mysql_real_escape_string($monster['lose_ico']) . '", - `win_back` = "' . mysql_real_escape_string($monster['win_back']) . '", - `time_restart` = "' . mysql_real_escape_string($monster['time_restart']) . '", - `nich_text` = "' . mysql_real_escape_string($monster['nich_text']) . '" - WHERE `id` = "' . mysql_real_escape_string($monster['id']) . '" LIMIT 1' - ); - } - - echo 'Новые данные были успешно сохранены!'; - } - - ?> - Параметры монстра:
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Место появления (id комнаты): - -   -
Время ожидания после поражения бота: мин. -
Исчезнет после своей победы: -
-
-
Появляется, - ДН - - Д - - - М - - Ч - - Мин - -
Исчезает,    ДН - - Д - - - М - - Ч - - Мин -
-
-
Текст появления (Логин бота {b}, Логины игроков {u}):
Текст исчезновения:
Текст победы игрока:
Текст поражения игрока:
Текст ничьей:
-
- Награда (победа игрока):
Кр.:
Екр.:
Опыт (За 100% НР монстра):
Предметы (id@kolvo@data, ...):
Эффект:
Подвиги:
-
- Награда (поражение игрока):
Кр.:
Екр.:
Опыт:
Предметы:
Эффект:
Подвиги:
-
- -
-

-
-
-
- Скрыть -
-
- -
-
- Настройка монстра -
-
- info['align'] >= 1.1 && $u->info['align'] <= 1.99 && $inf['admin'] < 1) || - ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $inf['admin'] < 1) || - $u->info['admin'] > 0 || - $u->info['nadmin'] > 0 - ) - ) { - $mults = ''; - $bIP = []; - - $spl = mysql_query( - 'SELECT * FROM `mults` WHERE (`uid` = "' . $inf['id'] . '" OR `uid2` = "' . $inf['id'] . '") AND `uid`!="0" AND `uid2`!="0" and id != "2495806"' - ); - while ($pls = mysql_fetch_array($spl)) { - $usr = $pls['uid']; - if ($usr == $inf['id']) { - $usr = $pls['uid2']; - } - if ($usr != $inf['id']) { - $si = Db::getRow('select id, admin, online from users where id = ? and login != ?', [$usr, 'delete']); - if (isset($si['id'])) { - if ($si['admin'] == 0) { - if ($si['online'] > time() - 520) { - $mults .= '' . $u->microLogin($si['id'], 1) . ', '; - } else { - $mults .= $u->microLogin($si['id'], 1) . ', '; - } - } - } - } - } - - - if (!$nopal && ($u->info['admin'] != 0 || $inf['admin'] == 0)) { - echo '
За игроком замечены следующие темные делишки:
'; - if (!isset($_GET['mod_inf'])) { - echo 'Показать личное дело'; - } else { - //Личное дело персонажа - $logs = Db::getRows('select * from users_delo where uid = ? and type = 0 order by id desc', [$inf['id']]); //limit 21 ? - foreach ($logs as $logstr) { - echo date('d.m.Y H:i:s', $logstr['time']) . ' ' . $logstr['text'] . '
'; - } - echo 'Скрыть личное дело'; - } - echo '

'; - //Информация для паладинов\тарманов\ангелов - if ( - ($u->info['align'] >= 1.4 && $u->info['align'] <= 1.99 && $u->info['align'] != 1.6 && $u->info['align'] != 1.75 && $inf['admin'] < 1) || - ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $u->info['align'] != 3.06 && $inf['admin'] < 1) || - $u->info['admin'] > 0 - ) { - if ((int)$inf['host_reg'] >= 1) { - $inf['ref'] = $u->microLogin((int)$inf['host_reg'], 1); - } else { - $inf['ref'] = '--'; - } - if (!isset($inf['ipReg'])) { - $inf['ipReg'] = '--'; - } - echo '
Секретно!
'; - echo 'День рождения: ' . $inf['bithday'] . '
'; - if ($inf['vip'] == 1) { - echo 'VIP персонаж
'; - } - - if ($u->info['admin'] > 0) { - echo 'Комната: ' . $inf['room'] . '
'; - echo ''; - $mls = Db::getValue('select count(*) from users_rbk where email = ? limit 1', [$inf['mail']]); - if (isset($mls)) { - echo 'E-mail: ' . $inf['mail'] . ' (РАССЫЛКА)'; - } else { - echo 'E-mail: ' . $inf['mail']; - } - echo '   &   ' . $inf['send'] . '
'; - echo '
'; - } else { - echo '
'; - } - if ($inf['no_ip'] != 0) { - $inf['ipReg'] = $inf['no_ip']; - $inf['ip'] = $inf['no_ip']; - } - echo 'Персонажа пригласили: ' . $inf['ref'] . - '
Последний раз заходил в клуб: ' . date('d.m.Y H:i', $inf['online']) . '
' . - $pr['login'] . 'IP при регистрации: ' . $inf['ipReg'] . '
'; - if ($inf['no_ip'] == '' || $u->info['admin'] > 0) { - echo 'IP последние: ' . $inf['ip'] . ''; - $auth = mysql_query( - 'SELECT * FROM `logs_auth` WHERE `uid`="' . $inf['id'] . '" AND `type`="1" ORDER by `id` DESC LIMIT 10' - ); - $country = ''; - while ($auth_w = mysql_fetch_array($auth)) { - echo '
' . $auth_w['ip'] . ' (' . date( - 'd.m.Y H:i', $auth_w['time'] - ) . ')'; - } - } else { - echo 'IP последние: ' . $inf['no_ip'] . ''; - } - - if ((empty($inf['no_ip']) || $u->info['admin'] > 0) && !empty($mults) && $inf['admin'] == 0) { - $mults = trim($mults, ', '); - echo 'Другие ники этого бойца: ' . $mults . '
'; - } - - $referalos = ''; - $rfs = 0; - - $sp = mysql_query( - 'SELECT `id`,`login`,`ip`,`ipreg`,`timereg`,`online` FROM `users` WHERE `host_reg` = "' . $inf['id'] . '" ORDER BY `timereg` DESC' - ); - while ($pl = mysql_fetch_array($sp)) { - $referalos .= '
Дата рег.: ' . date( - 'd.m.Y H:i', $pl['timereg'] - ) . ' / Был тут: ' . date( - 'd.m.Y H:i', $pl['online'] - ) . '   ' . $u->microLogin( - $pl['id'], 1 - ) . ' ( ' . $pl['ip'] . ' , ' . $pl['ipreg'] . ' )'; - $rfs++; - } - - if ($referalos == '') { - $referalos = 'Отсутствуют'; - } - echo '
Рефералы бойца:' . $referalos . '
'; - if ($u->info['admin'] > 0) { - echo 'Доп. возможности: сбросить характеристики
'; - $on1 = mysql_fetch_array( - mysql_query( - 'SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1' - ) - ); - echo 'Время в онлайне (всего): ' . timeOut( - $on1['time_all'] - ) . '
Время в онлайне (сегодня): ' . timeOut( - $on1['time_today'] - ) . '
'; - } - if ($inf['molch3'] < time() && $inf['molch1'] > time()) { - echo 'Запретить персонажу отправлять сообщения с молчанкой
'; - } - - echo 'Опыт: ' . $inf['exp'] . - '
Число неиспользованных UP-ов: ' . $inf['ability'] . - '
Кредитов: ' . $inf['money'] . - '
ЕвроКредитов: ' . $inf['money2']; - $bmn1 = 0; - $bmn2 = 0; - - $pk = mysql_fetch_array( - mysql_query( - 'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $inf['id'] . '" AND `good` > 0 LIMIT 1' - ) - ); - echo '
Персонаж покупал еврокредиты  Сумма : ' . $pk[0] . ' ЕКР
'; - - if ($u->info['admin'] > 0 && $inf['admin'] > 0) { - echo '
admin: ' . $inf['admin'] . ''; - } - - echo '
'; - } - } - } - ?> -
-
- - - - -
- -

- - = 0) { ?> - - 1 && $inf['align'] < 2) { ?> - /' target='_blank'> - -
- /' target='_blank'> - Орден Света - = 3.01 && $inf['align'] <= 3.99) { ?> - /'> - -
- /' target='_blank'>Армада - = 2 && $inf['align'] < 3) { ?> - /'> - -
- /' target='_blank'> - Цитадель Хаоса - - - - -
- Новости
- -
-
-
-
-info['align'] > 1 && $u->info['align'] < 2) { - $moder = 1; -} -if ($u->info['align'] > 3 && $u->info['align'] < 4) { - $moder = 2; -} -if ($inf['info_delete'] != 0) { - ?> -

Персонаж обезличен 1) { - echo 'до ' . date('d.m.Y H:i', $inf['info_delete']) . '.'; - } else { - echo '.'; - } ?>

- info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0) { - echo '
'; - } -} -if ($inf['info_delete'] == 0 || (($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0)) -{ -?> -
-
-

Анкетные данные

- '; + } ?> - Имя:
- Пол: -
- - Увлечения / хобби:
- ', $inf['hobby']); - } - if ($inf['info_delete'] != 0) { - echo '
'; - } - } - echo '

' . $c['counters_noFrm'] . '
'; - ?> +
+ +
+ + <?= $zodiac->getName() ?>
+ + + + +
+
+ + isModerator()): ?> +
+
+

Анкетные данные

+ + Имя:
+ + Пол: +
+ + Увлечения / хобби:
+ ', $inf['hobby']) ?> + +
+ + +
diff --git a/js/btl_mini.js b/js/btl_mini.js index e68ad1f3..ecb66a8e 100644 --- a/js/btl_mini.js +++ b/js/btl_mini.js @@ -1,5 +1,5 @@ top.goSit(1); -var zas = new Array(); +var zas = []; var priem_use = 0; var magic_use = 0; var use_on_pers = 'none'; @@ -7,13 +7,13 @@ var smena_login = 'none'; var leader_login = 'none'; var leader_type = 1; - zas[1] = 0; - zas[2] = 0; - zas[3] = 0; - zas[4] = 0; - zas[5] = 0; -var zbs = new Array(); - zbs[1] = 0; +zas[1] = 0; +zas[2] = 0; +zas[3] = 0; +zas[4] = 0; +zas[5] = 0; +var zbs = []; +zbs[1] = 0; var sel_atack = 1; var nos = 0; var noconnect = 5; @@ -27,482 +27,506 @@ function magic_div(id, name, img, title) { } function testClearZone() { - if (top.slcbrc[4] == 0) { - all_radio_off(); - } + if (top.slcbrc[4] == 0) { + all_radio_off(); + } } async function usepriem(id, t, img) { - if (t == 1) { - irn++; - await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,usepriem:id,useon:use_on_pers},function(data){$("#ref").html(data);}); - use_on_pers = 'none'; top.goSit(1); - return - } - return alert('Not found'); + if (t == 1) { + irn++; + await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`, { + idlog: top.id_log, + usepriem: id, + useon: use_on_pers + }, function (data) { + $("#ref").html(data); + }); + use_on_pers = 'none'; + top.goSit(1); + return + } + return alert('Not found'); } async function useitem(id, t, use_item_on) { - if (t == 1) { - irn++; - if( top.c.noEr == 0 ) { - top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000); - await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,useitem:id,useitemon:use_item_on},function(data){$("#ref").html(data);}); - } - return top.goSit(1); - } - return alert('Not found'); + if (t == 1) { + irn++; + if (top.c.noEr == 0) { + top.c.noEr = 1; + clearTimeout(top.c.noErTmr); + top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); + await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`, { + idlog: top.id_log, + useitem: id, + useitemon: use_item_on + }, function (data) { + $("#ref").html(data); + }); + } + return top.goSit(1); + } + return alert('Not found'); } function volna(id) { - document.getElementById('volna').innerHTML = `Волна: ${id}`; + document.getElementById('volna').innerHTML = `Волна: ${id}`; } -function change_radioKeys(id,cper) { - var z = 0, t = 0, k = 0; - var i = 1, j = 1; - while(i <= za) { - j = 1; jo = 0; - while(j <= 5) { - var radio = document.getElementById(`atack_${i}_${j}`); - if (radio != undefined) { - if (radio.className != null && radio.className == "radio_on") jo++; - } - j++; - } - if (jo == 0 && z == 0) { - z = i; - t = 'atack'; - } - i++; - } +function change_radioKeys(id, cper) { + var z = 0, t = 0, k = 0; + var i = 1, j = 1; + while (i <= za) { + j = 1; + jo = 0; + while (j <= 5) { + var radio = document.getElementById(`atack_${i}_${j}`); + if (radio != undefined) { + if (radio.className != null && radio.className == "radio_on") jo++; + } + j++; + } + if (jo == 0 && z == 0) { + z = i; + t = 'atack'; + } + i++; + } - if( z == 0 ) { - var i = 1, jo = 0; - while(i <= 5) { - var radio = document.getElementById(`block_1_${i}`); - if(radio != undefined) { - if(radio.className != null && radio.className == "radio_on") jo++; - } - i++; - } - if (jo == 0 && z == 0) { - z = 1; - t = 'block'; - } - } - - if ((z == 0 || id == 0) && cper == false) { - all_radio_off(); - refleshPoints(); - } - - if(z > 0) { - if(id == 0) { - //автовыставление - } - else change_radio(z,id,t,1) - } + if (z == 0) { + var i = 1, jo = 0; + while (i <= 5) { + var radio = document.getElementById(`block_1_${i}`); + if (radio != undefined) { + if (radio.className != null && radio.className == "radio_on") jo++; + } + i++; + } + if (jo == 0 && z == 0) { + z = 1; + t = 'block'; + } + } + + if ((z == 0 || id == 0) && cper == false) { + all_radio_off(); + refleshPoints(); + } + + if (z > 0) { + if (id == 0) { + //автовыставление + } else change_radio(z, id, t, 1) + } } function change_radio(id, zone, type, r) { - radio_off(id, zone, type); - var radio = document.getElementById(`${type}_${id}_${zone}`); + radio_off(id, zone, type); + var radio = document.getElementById(`${type}_${id}_${zone}`); - if (radio.className == "radio_on" && r == 0) { - radio.className = "radio_off"; - if (type == 'atack') zas[id] = 0; - else zbs[id] = 0; - } else { - radio.className = "radio_on"; - if (type == 'atack') zas[id] = zone; - else zbs[id] = zone; - } - refleshPoints(); + if (radio.className == "radio_on" && r == 0) { + radio.className = "radio_off"; + if (type == 'atack') zas[id] = 0; + else zbs[id] = 0; + } else { + radio.className = "radio_on"; + if (type == 'atack') zas[id] = zone; + else zbs[id] = zone; + } + refleshPoints(); } function tactic(id, value) { - document.getElementById(`tac${id}`).innerHTML = value; + document.getElementById(`tac${id}`).innerHTML = value; } function refleshPoints() { - clearZone(); - var i = 5; - while (i >= 1) { - if (zas[i] == 0) lineAtack(i); - i--; - } - if (zbs[1] == 0) lineBlock(); + clearZone(); + var i = 5; + while (i >= 1) { + if (zas[i] == 0) lineAtack(i); + i--; + } + if (zbs[1] == 0) lineBlock(); } function lineAtack(id) { - nos++; - var j = 1; - while (j <= 5) { - document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes'; - j++; - } + nos++; + var j = 1; + while (j <= 5) { + document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes'; + j++; + } } function lineBlock() { - nos++; - var j = 1; - while (j <= 5) { - document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes'; - j++; - } + nos++; + var j = 1; + while (j <= 5) { + document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes'; + j++; + } } function clearZone() { - nos = 0; - var i = 1; - while (i <= 5) { - var j = 1; - while (j <= 5) { - document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no'; - j++; - } - i++; - } - var i = 1; - while (i <= 5) { - document.getElementById(`zblock1_${i}`).className = 'zoneCh_no'; - i++; - } + nos = 0; + var i = 1; + while (i <= 5) { + var j = 1; + while (j <= 5) { + document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no'; + j++; + } + i++; + } + var i = 1; + while (i <= 5) { + document.getElementById(`zblock1_${i}`).className = 'zoneCh_no'; + i++; + } } function select_atack(id, r) { - var i = 5; - while (i >= 1) { - if (zas[i] == 0) { - if (i <= za) sel_atack = i - } - i--; - } - if (sel_atack > za) sel_atack = 1; + var i = 5; + while (i >= 1) { + if (zas[i] == 0) { + if (i <= za) sel_atack = i + } + i--; + } + if (sel_atack > za) sel_atack = 1; - change_radio(sel_atack, id, 'atack', r); - sel_atack++; + change_radio(sel_atack, id, 'atack', r); + sel_atack++; } function radio_off(id, zone, type) { - var i = 1; - while (i <= 5) { - if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) { - document.getElementById(`${type}_${id}_${i}`).className = "radio_off"; - if (type == 'atack') zas[id] = 0; - else zbs[id] = 0; - } - i++; - } + var i = 1; + while (i <= 5) { + if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) { + document.getElementById(`${type}_${id}_${i}`).className = "radio_off"; + if (type == 'atack') zas[id] = 0; + else zbs[id] = 0; + } + i++; + } } + function all_radio_off() { - var i = 1; - while (i <= 5) { - var j = 1; - while (j <= 5) { - document.getElementById(`atack_${j}_${i}`).className = "radio_off"; - j++; - } - document.getElementById(`block_1_${i}`).className = "radio_off"; - zas[i] = 0; - i++; - } - zbs[1] = 0; + var i = 1; + while (i <= 5) { + var j = 1; + while (j <= 5) { + document.getElementById(`atack_${j}_${i}`).className = "radio_off"; + j++; + } + document.getElementById(`block_1_${i}`).className = "radio_off"; + zas[i] = 0; + i++; + } + zbs[1] = 0; } + function genZoneBlock() { - var i = 1; - while (i <= 5) { - var j = 1; - while (j <= 3) { - if (j == zb) { - document.getElementById(`txtb${i}_${j}`).style.display = ''; - } else { - document.getElementById(`txtb${i}_${j}`).style.display = 'none'; - } - j++; - } - i++; - } + var i = 1; + while (i <= 5) { + var j = 1; + while (j <= 3) { + if (j == zb) { + document.getElementById(`txtb${i}_${j}`).style.display = ''; + } else { + document.getElementById(`txtb${i}_${j}`).style.display = 'none'; + } + j++; + } + i++; + } } function genZoneAtack() { - var i = 1; - while (i <= 5) { - var j = 1; - while (j <= 5) { - if (i <= za) { - document.getElementById(`zatack${i}_${j}`).style.display = ''; - } else { - document.getElementById(`zatack${i}_${j}`).style.display = 'none'; - } - j++; - } - i++; - } + var i = 1; + while (i <= 5) { + var j = 1; + while (j <= 5) { + if (i <= za) { + document.getElementById(`zatack${i}_${j}`).style.display = ''; + } else { + document.getElementById(`zatack${i}_${j}`).style.display = 'none'; + } + j++; + } + i++; + } } -// function nocon() { -// if (connect == 0) { -// if (noconnect < 0) { -// //document.getElementById('ref').innerHTML = '
Подождите, идет инициализация...
'; -// //g_iCount = 45; -// } -// } -// } - function genteam(team) { - document.getElementById('teams').innerHTML = team; + document.getElementById('teams').innerHTML = team; } var t057 = null; var battle_end = 0; async function reflesh(bl) { - irn++; + irn++; - if (battleFinishData != -1) mainstatus(0); + if (battleFinishData != -1) mainstatus(0); - if ((battle_end == 0 || bl != null) && battleFinishData == -1) { - if (top.c.noEr == 0) { - top.c.noEr = 1; - clearTimeout(top.c.noErTmr); - top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); - await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, { - id: 'reflesh', - idlog: top.id_log, - idpr: priem_use, - mgid: magic_use, - useon: use_on_pers, - smn: smena_login, - ldrl: leader_login, - ldrt: leader_type - }, function (data) { - $("#ref").html(data); - }); - } - if (g_iCount != 45) g_iCount = 45; - } + if ((battle_end == 0 || bl != null) && battleFinishData == -1) { + if (top.c.noEr == 0) { + top.c.noEr = 1; + clearTimeout(top.c.noErTmr); + top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); + await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, { + id: 'reflesh', + idlog: top.id_log, + idpr: priem_use, + mgid: magic_use, + useon: use_on_pers, + smn: smena_login, + ldrl: leader_login, + ldrt: leader_type + }, function (data) { + $("#ref").html(data); + }); + } + if (g_iCount != 45) g_iCount = 45; + } } function autobattle() { - var i = 1; - while (i <= za) { - if (zas[i] == 0 || top.slcbrc[4] == 1) { - zas[i] = Math.floor(Math.random(5) * 5 + 1); - change_radio(i, zas[i], 'atack', 1); - } - i++; - } - if (zbs[1] == 0 || top.slcbrc[4] == 1) { - zbs[1] = Math.floor(Math.random(5) * 5 + 1); - change_radio(1, zbs[1], 'block', 1); - } + var i = 1; + while (i <= za) { + if (zas[i] == 0 || top.slcbrc[4] == 1) { + zas[i] = Math.floor(Math.random(5) * 5 + 1); + change_radio(i, zas[i], 'atack', 1); + } + i++; + } + if (zbs[1] == 0 || top.slcbrc[4] == 1) { + zbs[1] = Math.floor(Math.random(5) * 5 + 1); + change_radio(1, zbs[1], 'block', 1); + } } // sleep time expects milliseconds function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); + return new Promise((resolve) => setTimeout(resolve, time)); } async function atack() { - if (top.slcbrc[3] == 1) autobattle(); - - var ago = `${zas[1]}_${zas[2]}_${zas[3]}_${zas[4]}_${zas[5]}`; - var bgo = zbs[1]; - - irn++; - if( top.c.noEr == 0 ) { - top.c.noEr = 1; - clearTimeout(top.c.noErTmr); - top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000); - await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`,{atack:ago,block:bgo,idlog:top.id_log,idpr:priem_use,mgid:magic_use,useon:use_on_pers,smn:smena_login,ldrl:leader_login,ldrt:leader_type},function(data){$("#ref").html(data);}); - } + if (top.slcbrc[3] == 1) autobattle(); + + var ago = `${zas[1]}_${zas[2]}_${zas[3]}_${zas[4]}_${zas[5]}`; + var bgo = zbs[1]; + + irn++; + if (top.c.noEr == 0) { + top.c.noEr = 1; + clearTimeout(top.c.noErTmr); + top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); + await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, { + atack: ago, + block: bgo, + idlog: top.id_log, + idpr: priem_use, + mgid: magic_use, + useon: use_on_pers, + smn: smena_login, + ldrl: leader_login, + ldrt: leader_type + }, function (data) { + $("#ref").html(data); + }); + } } -var g_iCount = new Number(); +var g_iCount = Number(); var g_iCount = 45; var tmr0057 = null; // 1.1 function startCountdown() { - if (tmr0057 != null) clearTimeout(tmr0057); - if ((g_iCount - 1) >= 0) { - g_iCount -= 1; - return tmr0057 = setTimeout('startCountdown()', 1000); - } - reflesh(); - return tmr0057 = setTimeout('startCountdown()', 1000); + if (tmr0057 != null) clearTimeout(tmr0057); + if ((g_iCount - 1) >= 0) { + g_iCount -= 1; + return tmr0057 = setTimeout('startCountdown()', 1000); + } + reflesh(); + return tmr0057 = setTimeout('startCountdown()', 1000); } var img_battle = ``; function mainstatus(id) { - if (smnpty <= 0) { - $('#btn_down_img2').css({'display': 'none'}); - } else { - $('#btn_down_img2').css({'display': ''}); - $('#btn_down_img2').attr('title', `Смена противника (${smnpty})`); - } - if (battleFinishData != -1) { // хуй знает че такое - document.getElementById('mainpanel2').style.display = ''; // 4 - document.getElementById('go_btn').style.display = 'none'; // 4 - document.getElementById('mainpanel').style.display = 'none'; // 4 - document.getElementById('mainpanel222').style.display = 'none'; // 4 - document.getElementById('reflesh_btn').style.display = 'none'; // 3 - document.getElementById('back_menu_down').style.display = ''; // 2 + if (smnpty <= 0) { + $('#btn_down_img2').css({'display': 'none'}); + } else { + $('#btn_down_img2').css({'display': ''}); + $('#btn_down_img2').attr('title', `Смена противника (${smnpty})`); + } + if (battleFinishData != -1) { // хуй знает че такое + document.getElementById('mainpanel2').style.display = ''; // 4 + document.getElementById('go_btn').style.display = 'none'; // 4 + document.getElementById('mainpanel').style.display = 'none'; // 4 + document.getElementById('mainpanel222').style.display = 'none'; // 4 + document.getElementById('reflesh_btn').style.display = 'none'; // 3 + document.getElementById('back_menu_down').style.display = ''; // 2 - document.getElementById('btn_down_img1').style.display = ''; // 2 - document.getElementById('btn_down_img2').style.display = 'none'; // 2 + document.getElementById('btn_down_img1').style.display = ''; // 2 + document.getElementById('btn_down_img2').style.display = 'none'; // 2 - document.getElementById("ref").innerHTML = `
${battleFinishData}
`; - rand_img(); - document.getElementById("player2").innerHTML = `
${img_battle}
`; - document.getElementById('player2_login').style.display = 'none'; - } else if (id == 1) //Можно ударить противника ( доступный удар ) - { - document.getElementById('mainpanel').style.display = ''; // 4 - document.getElementById('player2_login').style.display = ''; - document.getElementById('mainpanel222').style.display = ''; // 4 - document.getElementById('mainpanel2').style.display = 'none'; // 4 - document.getElementById('go_btn').style.display = ''; // 4 - document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();"); - document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2"); - document.getElementById('go_btn').setAttribute("onclick", "atackt();"); + document.getElementById("ref").innerHTML = `
${battleFinishData}
`; + rand_img(); + document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById('player2_login').style.display = 'none'; + } else if (id == 1) //Можно ударить противника ( доступный удар ) + { + document.getElementById('mainpanel').style.display = ''; // 4 + document.getElementById('player2_login').style.display = ''; + document.getElementById('mainpanel222').style.display = ''; // 4 + document.getElementById('mainpanel2').style.display = 'none'; // 4 + document.getElementById('go_btn').style.display = ''; // 4 + document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();"); + document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2"); + document.getElementById('go_btn').setAttribute("onclick", "atackt();"); - if (document.getElementById('reflesh_btn') != undefined) { - document.getElementById('reflesh_btn').style.display = 'none'; - } - } else if (id == 2) //Ожидаем хода противника ( обновить ) - { - document.getElementById('mainpanel').style.display = 'none'; // 4 - document.getElementById('mainpanel222').style.display = 'none'; // 4 - document.getElementById('mainpanel2').style.display = ''; // 4 - document.getElementById('go_btn').style.display = 'none'; // 4 - document.getElementById('reflesh_btn').style.display = ''; // 3 - rand_img(); - document.getElementById("player2").innerHTML = `
${img_battle}
`; - document.getElementById('player2_login').style.display = 'none'; - document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();"); - document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2"); - document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();"); - } else if (id == 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка ) - { - document.getElementById('mainpanel2').style.display = ''; // 4 - document.getElementById('go_btn').style.display = 'none'; // 4 - document.getElementById('mainpanel').style.display = 'none'; // 4 - document.getElementById('mainpanel222').style.display = 'none'; // 4 - document.getElementById('back_menu_down').style.display = 'none'; // 2 - document.getElementById('reflesh_btn').style.display = ''; // 3 - document.getElementById('reflesh_btn').setAttribute("class", "buttons inpBtl btnnew"); + if (document.getElementById('reflesh_btn') != undefined) { + document.getElementById('reflesh_btn').style.display = 'none'; + } + } else if (id == 2) //Ожидаем хода противника ( обновить ) + { + document.getElementById('mainpanel').style.display = 'none'; // 4 + document.getElementById('mainpanel222').style.display = 'none'; // 4 + document.getElementById('mainpanel2').style.display = ''; // 4 + document.getElementById('go_btn').style.display = 'none'; // 4 + document.getElementById('reflesh_btn').style.display = ''; // 3 + rand_img(); + document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById('player2_login').style.display = 'none'; + document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();"); + document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2"); + document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();"); + } else if (id == 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка ) + { + document.getElementById('mainpanel2').style.display = ''; // 4 + document.getElementById('go_btn').style.display = 'none'; // 4 + document.getElementById('mainpanel').style.display = 'none'; // 4 + document.getElementById('mainpanel222').style.display = 'none'; // 4 + document.getElementById('back_menu_down').style.display = 'none'; // 2 + document.getElementById('reflesh_btn').style.display = ''; // 3 + document.getElementById('reflesh_btn').setAttribute("class", "buttons inpBtl btnnew"); - // - document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();"); + // + document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();"); - document.getElementById('btn_down_img1').style.display = ''; // 2 - document.getElementById('btn_down_img2').style.display = 'none'; // 2 + document.getElementById('btn_down_img1').style.display = ''; // 2 + document.getElementById('btn_down_img2').style.display = 'none'; // 2 - document.getElementById("ref").innerHTML = "Вы повержены. Ожидайте пока поединок завершат другие бойцы..."; - document.getElementById("player2").innerHTML = `
${img_battle}
`; - document.getElementById('player2_login').style.display = 'none'; - } - if (document.getElementById('mainpanel').style.display == '') { - document.getElementById('mainpanel2').style.display = 'none'; - } - top.goSit(1); + document.getElementById("ref").innerHTML = "Вы повержены. Ожидайте пока поединок завершат другие бойцы..."; + document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById('player2_login').style.display = 'none'; + } + if (document.getElementById('mainpanel').style.display == '') { + document.getElementById('mainpanel2').style.display = 'none'; + } + top.goSit(1); } + function rand_img() { - if (level < 4) { - img_battle = ``; - return - } - img_battle = ``; + if (level < 4) { + img_battle = ``; + return + } + img_battle = ``; } var fstlh = 0; var lsti = 0; -var lsthd = new Array(); -var id_log_ar = new Array(); +var lsthd = []; +var id_log_ar = []; var id_log; var type_log = top.type_log; + function add_log(id, foryou, text, hod_id, my, last_hod, vars) { - if (top.des == 1) type_log = 0 - else type_log = 1; + if (top.des == 1) type_log = 0 + else type_log = 1; - if (type_log == 1) { - chsee = 'chsee2'; - if (my == 1) chsee = 'chsee3' - //if(id_log_ar[id]!=id) - //{ - text = looklogrep(text, vars); - id_log_ar[id] = id; - id_log = id; - // if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) { - if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { - if (fstlh == 0) fstlh = hod_id - lsthd[lsti] = hod_id; - lsti++; - $(top.frames['main'].document.getElementById('battle_logg')).prepend(`
`); - } else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) { - top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `
`; - } + if (type_log == 1) { + chsee = 'chsee2'; + if (my == 1) chsee = 'chsee3' + //if(id_log_ar[id]!=id) + //{ + text = looklogrep(text, vars); + id_log_ar[id] = id; + id_log = id; + // if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) { + if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { + if (fstlh == 0) fstlh = hod_id + lsthd[lsti] = hod_id; + lsti++; + $(top.frames['main'].document.getElementById('battle_logg')).prepend(`
`); + } else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) { + top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `
`; + } - if (!top.frames['main'].document.getElementById(`log_id_${id}`)) { - $(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); - } - //} - if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) { - top.rmve(`#battle_log_${hod_id - 25}`); - } - return - } - chsee = 'chsee2'; - if (my == 1) chsee = 'chsee3' - text = looklogrep(text, vars); - id_log_ar[id] = id; - id_log = id; - if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { - if (fstlh == 0) { - fstlh = hod_id; - } - lsthd[lsti] = hod_id; - lsti++; - $(top.document.getElementById('battle_logg')).prepend(`
`); - } else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) { - top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `
`; - } - if (!top.document.getElementById(`log_id_${id}`)) { - $(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); - } - if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) { - top.rmve(`#battle_log_${hod_id - 7}`); - } + if (!top.frames['main'].document.getElementById(`log_id_${id}`)) { + $(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); + } + //} + if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) { + top.rmve(`#battle_log_${hod_id - 25}`); + } + return + } + chsee = 'chsee2'; + if (my == 1) chsee = 'chsee3' + text = looklogrep(text, vars); + id_log_ar[id] = id; + id_log = id; + if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { + if (fstlh == 0) { + fstlh = hod_id; + } + lsthd[lsti] = hod_id; + lsti++; + $(top.document.getElementById('battle_logg')).prepend(`
`); + } else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) { + top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `
`; + } + if (!top.document.getElementById(`log_id_${id}`)) { + $(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); + } + if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) { + top.rmve(`#battle_log_${hod_id - 7}`); + } } + //-- Мой лог-------------------------------- //------------------------------------------- function add_mlog(id, foryou, text, hod_id, my, last_hod, vars) { - chsee = 'chsee7'; - text = looklogrep(text, vars); - id_log_ar[id] = id; - id_log = id; - if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) { - $(top.document.getElementById('battle_mlogg')).prepend(`
`); + chsee = 'chsee7'; + text = looklogrep(text, vars); + id_log_ar[id] = id; + id_log = id; + if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) { + $(top.document.getElementById('battle_mlogg')).prepend(`
`); - } else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) { - top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `
`; - } + } else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) { + top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `
`; + } - if (!top.document.getElementById(`mlog_id_${id}`)) { - $(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`${text}
`); + if (!top.document.getElementById(`mlog_id_${id}`)) { + $(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`${text}
`); - } - if (top.document.getElementById(`battle_mlog_${hod_id-14}`) != undefined) { - top.rmve(`#battle_mlog_${hod_id-14}`); - } + } + if (top.document.getElementById(`battle_mlog_${hod_id - 14}`) != undefined) { + top.rmve(`#battle_mlog_${hod_id - 14}`); + } } + //------------------------------------------- @@ -523,7 +547,7 @@ function defPosition(event) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY; } - return {x:x, y:y}; + return {x: x, y: y}; } function initMove(div, event) { @@ -535,7 +559,7 @@ function initMove(div, event) { moveState = true; } -document.onmouseup = function() { +document.onmouseup = function () { moveState = false; } @@ -545,17 +569,17 @@ function moveHandler(div, event) { var event = event || window.event; if (moveState) { div.style.left = divX0 + defPosition(event).x - x0; - div.style.top = divY0 + defPosition(event).y - y0; + div.style.top = divY0 + defPosition(event).y - y0; } } function usePriem(id) { - priem_use = id; - if (id != 0) reflesh() + priem_use = id; + if (id != 0) reflesh() } //document.onkeydown=key; function key() { - //window.status=event.keyCode; - //if(event.keyCode==13){ atack(); } + //window.status=event.keyCode; + //if(event.keyCode==13){ atack(); } } \ No newline at end of file diff --git a/js/title.js b/js/title.js index b883329f..45e68932 100644 --- a/js/title.js +++ b/js/title.js @@ -74,7 +74,7 @@ function popup(element, content, width = 230) { }); } -function hi(el, txt, e, tp, st, sm, fm, css) { +function hi(el, txt, e, tp, st, sm, fm, css = '') { if (!e) e = window.event; top.xyfmn = [el, txt, e, tp, st, sm, fm, css]; var x = e.pageX, y = e.pageY; diff --git a/jx/battle/log_text.php b/jx/battle/log_text.php index b8be855a..66e4bea5 100644 --- a/jx/battle/log_text.php +++ b/jx/battle/log_text.php @@ -1,7 +1,7 @@ от перен $log_text[0][20][5] = '{u1} пытался превратить {u2} в табуретку при помощи заклинания "{pr}"... но ничего не вышло'; //Текст приемов (муж) (магические) (на себя) -$log_text[0][21][0] = '{u1}, победив страх, решил поразить всех и наколдовал "{pr}"'; -$log_text[0][21][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал "{pr}"'; +$log_text[0][21][0] = '{u1}, победив страх, решил поразить всех и наколдовал "{pr}"'; +$log_text[0][21][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал "{pr}"'; $log_text[0][21][2] = '{u1} нарисовав вокруг себя несколько рун, призвал заклятье "{pr}"'; $log_text[0][21][3] = '{u1} догадавшись, что пришло время показать себя, произнес заклятье "{pr}"'; $log_text[0][21][4] = '{u1} с испугу произнес, первое пришедшее на ум, заклятье "{pr}"'; @@ -416,8 +411,8 @@ $log_text[0][21][5] = '{u1} впал в транс и начал бормота $log_text[0][21][6] = '{u1} очнулся от медитации, и призвал заклятье "{pr}"'; //Текст приемов (жен) (магические) (урон) -$log_text[1][19][0] = '{u1}, победив страх, решила поразить {u2} заклятьем "{pr}"'; -$log_text[1][19][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}" на {u2}'; +$log_text[1][19][0] = '{u1}, победив страх, решила поразить {u2} заклятьем "{pr}"'; +$log_text[1][19][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}" на {u2}'; $log_text[1][19][2] = '{u1} нарисовав вокруг себя несколько рун, призвала заклятье "{pr}" на {u2}'; $log_text[1][19][3] = '{u1} догадавшись, что пришло время показать себя, произнесла заклятье "{pr}" на {u2}'; $log_text[1][19][4] = '{u1} с испугу произнесла, первое пришедшее на ум, заклятье "{pr}" на {u2}'; @@ -433,12 +428,11 @@ $log_text[1][20][4] = '{u1} <вырезано цензурой> от перен $log_text[1][20][5] = '{u1} пыталась превратить {u2} в табуретку при помощи заклинания "{pr}"... но ничего не вышло'; //Текст приемов (жен) (магические) (на себя) -$log_text[1][21][0] = '{u1}, победив страх, решила поразить всех и наколдовала "{pr}"'; -$log_text[1][21][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}"'; +$log_text[1][21][0] = '{u1}, победив страх, решила поразить всех и наколдовала "{pr}"'; +$log_text[1][21][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}"'; $log_text[1][21][2] = '{u1} нарисовав вокруг себя несколько рун, призвала заклятье "{pr}"'; $log_text[1][21][3] = '{u1} догадавшись, что пришло время показать себя, произнесла заклятье "{pr}"'; $log_text[1][21][4] = '{u1} с испугу произнесла, первое пришедшее на ум, заклятье "{pr}"'; $log_text[1][21][5] = '{u1} впала в транс и начала бормотать заклятие "{pr}"'; $log_text[1][21][6] = '{u1} очнулась от медитации, и призвала заклятье "{pr}"'; -?> \ No newline at end of file diff --git a/jx/battle/refresh.php b/jx/battle/refresh.php index ad824b27..73036641 100644 --- a/jx/battle/refresh.php +++ b/jx/battle/refresh.php @@ -1,52 +1,35 @@ debug($t, true); } -if (isset($_GET['cron_core'])) { - +if (isset($_GET['cron_core'])) { // что ты такое? $id = [ 'id' => $_GET['uid'], 'pass' => $_GET['pass'], ]; if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) { - $uzr = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string( - $id['id'] - ) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1' - ) - ); - if (isset($uzr['id'])) { - $CRON_CORE = true; - $_COOKIE['login'] = $uzr['login']; - //$_COOKIE['pass'] = $uzr['pass']; - $_POST['id'] = 'reflesh'; - } - unset($uzr); + + $CRON_CORE = true; + $_COOKIE['login'] = User::getLoginById($id['id']); + $_POST['id'] = 'reflesh'; } } @@ -58,241 +41,236 @@ if (!isset($CRON_CORE)) { header('Pragma: no-cache'); } -if (($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) && (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem']))) { +if ( + $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' && !isset($CRON_CORE) || + !isset($_POST['atack'], $_POST['block']) && (!isset($_POST['id']) || $_POST['id'] != 'reflesh') && !isset($_POST['usepriem']) && !isset($_POST['useitem']) +) { + return; +} - unset($tm); - $js = ''; - $u = User::start(); - $magic = new Magic(); - $priem = new Priems(); - - if ($u->info['battle'] == 0) { - $btl_last = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' - ) - ); - if (isset($btl_last['id']) && $u->info['battle'] == 0) { - echo ''; - $u->info['battle'] = $btl_last['id']; - $u->info['battle_lsto'] = true; - mysql_query( - 'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); - echo ''; - } - } - - if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) { - die($c['exit']); - } - - function json_fix_cyr($json_str) - { - return $json_str; - } - - $u->stats = $u->getStats($u->info['id'], 0); - - if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) { - mysql_query( - "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( - ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" - ); - } - - $btl = new Battle(); - require_once('log_text.php'); - $btl->is = $u->is; - $btl->items = $u->items; - $btl->info = $btl->battleInfo($u->info['battle']); - if (!isset($btl->info['id'])) { - if ($u->info['battle'] == -1) { - //завершаем поединок - $upd = mysql_query( - 'UPDATE `users` SET `battle` = "0",`online` = "' . time( - ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - if (!$upd) { - if (!isset($CRON_CORE)) { - die('Ошибка завершения поединка.'); - } - } else { - echo ''; - } - } else { - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'); - if (!isset($CRON_CORE)) { - die(''); - } - } - } else { - //получаем массив с игроками в бою - $btl->teamsTake(); - - if (isset($_POST['useitem']) && $btl->testUsersLive()) { - $magic->useItems((int)$_POST['useitem']); - if ($u->error != '') { - echo '
' . $u->error . '
'; - } - } - - //заносим удары,приемы,эффекты и т.д. - //удар - if (isset($_POST['atack']) && isset($_POST['block'])) { - $btl->addAtack(); - } - //прием - if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) { - $priem->pruse($_POST['usepriem']); - } - //используем заклятие / пирожки - - - //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) - $btl->testActions(); - //авто-смена противника, либо просто смена противника - if ($u->stats['hpNow'] >= 1) { - //ручная смена - if (isset($_POST['smn']) && $_POST['smn'] != 'none') { - /* ---------------- */ - $uidz = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( - $_POST['smn'] - ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' - ) - ); - if ($uidz['inUser'] > 0) { - $uidz['id'] = $uidz['inUser']; - } - $rsm = $btl->smena($uidz['id'], false); - if ($rsm != 1) { - echo '
' . $rsm . '
'; - } - unset($rsm); - $js .= 'smena_login = \'none\';'; - } - //авто-смена - if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - $btl->autoSmena(); - } - } else { - $btl->mainStatus = 3; - } - - //получаем данные о поединке - - //получаем данные о логе боя - - //Если бой сыгран - завершаем - if (!isset($_POST['usepriem'])) { - $btl->testFinish(); - } - if ($btl->info['team_win'] == -1) { - $js .= $btl->genTeams($u->info['id']); - } else { - $btl->mainStatus = 3; - $btl->e = $u->btl_txt; - } - - if ($btl->info['id'] == $u->info['lider']) { - $js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();'; - } else { - $js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();'; - } - - if (!isset($CRON_CORE)) { - $js .= $btl->myInfo($u->info['id'], 1); - //выводим данные - if ($btl->e != '') { - echo '
' . $btl->e . '
'; - } - if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - if ($u->info['hpNow'] >= 1) { - $btl->mainStatus = 2; - } - } else { - if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { - $js .= $btl->myInfo($u->info['enemy'], 2); - } - } - if ($btl->info['izlom'] > 0) { - $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; - } - $i = 1; - while ($i <= 7) { - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; - } - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; - } - $i++; - } - $atk1 = 0; - $rsys = ''; - if ($rsys != '') { - $js .= $rsys; - } - unset($rsys); - if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { - $atk1 = 1; - } - } - - $rehtml = ''; - if (!isset($CRON_CORE)) { - $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; - $jslog = $btl->lookmLog(); - $jslog .= $btl->lookLog(); - if ($jslog != '') { - $js = $jslog . $js; - } - unset($jslog); - - $tmr = round(($btl->info['timeout'] / 60), 2); - - - $dtxtn = ''; - - $rehtml .= ''; - - echo($rehtml); - - if ($btl->cached) { - $btl->clear_cache_start(); - } - - unset($atk1); - } - echo ''; +unset($tm); +$js = ''; +$u = User::start(); +$magic = new Magic(); +$priem = new Priems(); +if ($u->info['battle'] == 0) { + $btlLastId = Db::getValue('select id from battle_users where uid = ? and finish = 0 limit 1', [$u->info['id']]); + if ($btlLastId) { + echo ""; + $u->info['battle'] = $btlLastId; + $u->info['battle_lsto'] = true; + Db::sql("update stats set battle_text = '', last_b = 0 where id = ?", [$u->info['id']]); + Db::sql('update battle_users set finish = 1 where uid = ?', [$u->info['id']]); + echo ''; } } + +if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) { + die(Config::get('exit')); +} + +$u->stats = $u->getStats($u->info['id']); + +if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) { + Db::sql('update users set online = unix_timestamp(), timeMain = unix_timestamp() where id = ?', [$u->info['id']]); +} + +$error = fn(string $str): string => '
' . $str . '
'; + +$btl = new Battle(); +require_once('log_text.php'); +$btl->is = $u->is; +$btl->items = $u->items; +$btl->info = $btl->battleInfo($u->info['battle']); + +if (!isset($btl->info['id'])) { + if ($u->info['battle'] == -1) { + //завершаем поединок + Db::sql('update users set battle = 0, online = unix_timestamp() where id = ?', [$u->info['id']]); + exit(''); + } else { + Db::sql('update users set battle = 0 where battle = ?', [$u->info['battle']]); + if (!isset($CRON_CORE)) { + exit(''); + } + } +} else { + //получаем массив с игроками в бою + $btl->teamsTake(); + + if (isset($_POST['useitem']) && $btl->testUsersLive()) { + $magic->useItems((int)$_POST['useitem']); + if ($u->error != '') { + echo $error($u->error); + } + } + + //заносим удары,приемы,эффекты и т.д. + //удар + if (isset($_POST['atack']) && isset($_POST['block'])) { + $btl->addAtack(); + } + + //прием + if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) { + $priem->pruse($_POST['usepriem']); + } + + //используем заклятие / пирожки + //не используем? О_о + + + //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) + $btl->testActions(); + + //авто-смена противника, либо просто смена противника + if ($u->stats['hpNow'] < 1) { + $btl->mainStatus = 3; + } else { + //ручная смена + if (isset($_POST['smn']) && $_POST['smn'] != 'none') { + /* ---------------- */ + $uidz = Db::getValue('select if(inUser > 0, inUser, id) as id from users where login = ? and battle = ?', [$_POST['smn'], $u->info['battle']]); + + $rsm = $btl->smena($uidz); + if ($rsm != 1) { + echo $error($rsm); + } + unset($rsm); + $js .= 'smena_login = \'none\';'; + } + + //авто-смена + if ( + $u->info['enemy'] == 0 || + $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || + isset($btl->ga[$u->info['id']][$u->info['enemy']]) + ) { + $btl->autoSmena(); + } + } + + //получаем данные о поединке + + //получаем данные о логе боя + + //Если бой сыгран - завершаем + if (!isset($_POST['usepriem'])) { + $btl->testFinish(); + } + + if ($btl->info['team_win'] == -1) { + $js .= $btl->genTeams($u->info['id']); + } else { + $btl->mainStatus = 3; + $btl->e = $u->btl_txt; + } + + if ($btl->info['id'] == $u->info['lider']) { + $js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();'; + } else { + $js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();'; + } + + if (!isset($CRON_CORE)) { + $js .= $btl->myInfo($u->info['id'], 1); + + //выводим данные + if ($btl->e != '') { + echo $error($btl->e); + } + + if ( + isset($btl->ga[$u->info['id']][$u->info['enemy']]) && + $u->info['hpNow'] >= 1 + ) { + $btl->mainStatus = 2; + } elseif ( + $u->info['enemy'] != 0 && + $btl->info['team_win'] == -1 && + $u->info['hpNow'] >= 1 + ) { + $js .= $btl->myInfo($u->info['enemy'], 2); + } + + if ($btl->info['izlom'] > 0) { + $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + } + + $i = 1; + while ($i <= 7) { + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; + } + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; + } + $i++; + } + + + $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; + $jslog = $btl->lookmLog() . $btl->lookLog(); + if ($jslog != '') { + $js = $jslog . $js; + } + unset($jslog); + + $atk1 = isset($btl->ga[$u->info['enemy']][$u->info['id']]) ? 1 : 0; + $nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']); + $expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']); + $tmr = round(($btl->info['timeout'] / 60), 2); + $persMagic = $u->btlMagicList(); + $za = (int)$btl->stats[$btl->uids[$u->info['id']]]['zona']; + $zb = (int)$btl->testZonbVis(); + $tactic1 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic1']; + $tactic2 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic2']; + $tactic3 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic3']; + $tactic4 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic4']; + $tactic5 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic5']; + $tactic6 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic6']; + $tactic7 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic7']; + $smnpty = (int)$u->info['smena']; + $mainstatus = $btl->mainStatus; + $ggcode = PassGen::new(); + + echo << + eatk = $atk1; + $('#nabito').html('$nabito'); + $('#expmaybe').html('$expmaybe'); + $('#timer_out').html('$tmr'); + $('#pers_magic').html('$persMagic'); + g_iCount = 30; + noconnect = 15; + connect = 1; + $('#go_btn').show(); + $('#reflesh_btn').show(); + za = '$za'; genZoneAtack(); + zb = '$zb'; genZoneBlock(); + refleshPoints(); + tactic(1,'$tactic1'); + tactic(2,'$tactic2'); + tactic(3,'$tactic3'); + tactic(4,'$tactic4'); + tactic(5,'$tactic5'); + tactic(6,'$tactic6'); + smnpty='$smnpty'; + mainstatus('$mainstatus') + tactic(7,'$tactic7'); + smena_alls = '0'; + ggcode='$ggcode'; + $js + +HTML; + + if ($btl->cached) { + $btl->clear_cache_start(); + } + + unset($atk1); + } + echo ''; + +} diff --git a/jx/battle/refresh1.php b/jx/battle/refresh1.php index 34b1d50d..cce2fcda 100644 --- a/jx/battle/refresh1.php +++ b/jx/battle/refresh1.php @@ -8,254 +8,251 @@ function e($t) $_POST['id'] = 'reflesh'; // -if (isset($_POST['atack'], $_POST['block']) || isset($_POST['usepriem']) || isset($_POST['useitem'])) { +if (!isset($_POST['atack'], $_POST['block']) && !isset($_POST['usepriem']) && !isset($_POST['useitem'])) { + return; +} +session_start(); +$tm = microtime(); +$tm = explode(' ', $tm); +$tm = $tm[0] + $tm[1]; - session_start(); - $tm = microtime(); - $tm = explode(' ', $tm); - $tm = $tm[0] + $tm[1]; +unset($tm); +$js = ''; - unset($tm); - $js = ''; - - if ($u->info['battle'] == 0) { - $btl_last = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' - ) +if ($u->info['battle'] == 0) { + $btl_last = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' + ) + ); + if (isset($btl_last['id']) && $u->info['battle'] == 0) { + echo ''; + $u->info['battle'] = $btl_last['id']; + $u->info['battle_lsto'] = true; + mysql_query( + 'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); - if (isset($btl_last['id']) && $u->info['battle'] == 0) { - echo ''; - $u->info['battle'] = $btl_last['id']; - $u->info['battle_lsto'] = true; - mysql_query( - 'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); - echo ''; - } - } - - if (!isset($CRON_CORE)) { - if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP'])) { - die($c['exit']); - } - } - - function json_fix_cyr($json_str) - { - return $json_str; - } - - - if (!isset($CRON_CORE)) { - if ($u->info['online'] < time() - 30) { - mysql_query( - "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time( - ) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" - ); - } - } - - $btl->is = $u->is; - $btl->items = $u->items; - $btl->info = $btl->battleInfo($u->info['battle']); - - if (!isset($btl->info['id'])) { - if ($u->info['battle'] == -1) { - //завершаем поединок - $upd = mysql_query( - 'UPDATE `users` SET `battle` = "0",`online` = "' . time( - ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - if (!$upd) { - if (!isset($CRON_CORE)) { - die('Ошибка завершения поединка.'); - } - } else { - echo ''; - } - } else { - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'); - if (!isset($CRON_CORE)) { - die(''); - } - } - } else { - //получаем массив с игроками в бою - $btl->teamsTake(); - - if (isset($_POST['useitem']) && $btl->testUsersLive() == true) { - $magic->useItems((int)$_POST['useitem']); - if ($u->error != '') { - echo '
' . $u->error . '
'; - } - } - - //заносим удары,приемы,эффекты и т.д. - //удар - if (isset($_POST['atack']) && isset($_POST['block'])) { - $btl->addAtack(); - } - //прием - if (isset($_POST['usepriem']) && $btl->testUsersLive() == true) { - $priem->pruse($_POST['usepriem']); - } - //используем заклятие / пирожки - - - //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) - $btl->testActions(); - //авто-смена противника, либо просто смена противника - if ($u->stats['hpNow'] >= 1) { - //ручная смена - if (isset($_POST['smn']) && $_POST['smn'] != 'none') { - /* ---------------- */ - $uidz = mysql_fetch_array( - mysql_query( - 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( - $_POST['smn'] - ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' - ) - ); - if ($uidz['inUser'] > 0) { - $uidz['id'] = $uidz['inUser']; - } - $rsm = $btl->smena($uidz['id'], false); - if ($rsm != 1) { - echo '
' . $rsm . '
'; - } - unset($rsm); - $js .= 'smena_login = \'none\';'; - } - //авто-смена - if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - $btl->autoSmena(); - } - } else { - $btl->mainStatus = 3; - } - //получаем данные о поединке - - //получаем данные о логе боя - - //Если бой сыгран - завершаем - if (!isset($_POST['usepriem'])) { - $btl->testFinish(); - } - if ($btl->info['team_win'] == -1) { - $js .= $btl->genTeams($u->info['id']); - } else { - $btl->mainStatus = 3; - $btl->e = $u->btl_txt; - } - - if (!isset($CRON_CORE)) { - $js .= $btl->myInfo($u->info['id'], 1); - //выводим данные - if ($btl->e != '') { - echo '
' . $btl->e . '
'; - } - if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { - if ($u->info['hpNow'] >= 1) { - $btl->mainStatus = 2; - } - } else { - if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { - $js .= $btl->myInfo($u->info['enemy'], 2); - } - } - if ($btl->info['izlom'] > 0) { - $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; - } - $i = 1; - while ($i <= 7) { - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; - } - if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { - $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; - } - $i++; - } - $atk1 = 0; - if (!isset($CRON_CORE)) { - $rsys = ''; - } - if ($rsys != '') { - $js .= $rsys; - } - unset($rsys); - if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { - $atk1 = 1; - } - } - - $rehtml = ''; - if (!isset($CRON_CORE)) { - $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; - $jslog = $btl->lookmLog(); - $jslog .= $btl->lookLog(); - if ($jslog != '') { - $js .= 'top.btlclearlog();' . $jslog; - } - unset($jslog); - //} - $rehtml .= ''; - - echo($rehtml); - - if ($btl->cached == true) { - $btl->clear_cache_start(); - } - - unset($atk1); - } - echo ''; + mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); + echo ''; } } -?> \ No newline at end of file + +if (!isset($CRON_CORE)) { + if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP'])) { + die($c['exit']); + } +} + +function json_fix_cyr($json_str) +{ + return $json_str; +} + + +if (!isset($CRON_CORE)) { + if ($u->info['online'] < time() - 30) { + mysql_query( + "UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1" + ); + } +} + +$btl->is = $u->is; +$btl->items = $u->items; +$btl->info = $btl->battleInfo($u->info['battle']); + +if (!isset($btl->info['id'])) { + if ($u->info['battle'] == -1) { + //завершаем поединок + $upd = mysql_query( + 'UPDATE `users` SET `battle` = "0",`online` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + if (!$upd) { + if (!isset($CRON_CORE)) { + die('Ошибка завершения поединка.'); + } + } else { + echo ''; + } + } else { + mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'); + if (!isset($CRON_CORE)) { + die(''); + } + } +} else { + //получаем массив с игроками в бою + $btl->teamsTake(); + + if (isset($_POST['useitem']) && $btl->testUsersLive() == true) { + $magic->useItems((int)$_POST['useitem']); + if ($u->error != '') { + echo '
' . $u->error . '
'; + } + } + + //заносим удары,приемы,эффекты и т.д. + //удар + if (isset($_POST['atack']) && isset($_POST['block'])) { + $btl->addAtack(); + } + //прием + if (isset($_POST['usepriem']) && $btl->testUsersLive() == true) { + $priem->pruse($_POST['usepriem']); + } + //используем заклятие / пирожки + + + //проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием) + $btl->testActions(); + //авто-смена противника, либо просто смена противника + if ($u->stats['hpNow'] >= 1) { + //ручная смена + if (isset($_POST['smn']) && $_POST['smn'] != 'none') { + /* ---------------- */ + $uidz = mysql_fetch_array( + mysql_query( + 'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string( + $_POST['smn'] + ) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1' + ) + ); + if ($uidz['inUser'] > 0) { + $uidz['id'] = $uidz['inUser']; + } + $rsm = $btl->smena($uidz['id'], false); + if ($rsm != 1) { + echo '
' . $rsm . '
'; + } + unset($rsm); + $js .= 'smena_login = \'none\';'; + } + //авто-смена + if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + $btl->autoSmena(); + } + } else { + $btl->mainStatus = 3; + } + //получаем данные о поединке + + //получаем данные о логе боя + + //Если бой сыгран - завершаем + if (!isset($_POST['usepriem'])) { + $btl->testFinish(); + } + if ($btl->info['team_win'] == -1) { + $js .= $btl->genTeams($u->info['id']); + } else { + $btl->mainStatus = 3; + $btl->e = $u->btl_txt; + } + + if (!isset($CRON_CORE)) { + $js .= $btl->myInfo($u->info['id'], 1); + //выводим данные + if ($btl->e != '') { + echo '
' . $btl->e . '
'; + } + if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) { + if ($u->info['hpNow'] >= 1) { + $btl->mainStatus = 2; + } + } else { + if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { + $js .= $btl->myInfo($u->info['enemy'], 2); + } + } + if ($btl->info['izlom'] > 0) { + $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + } + $i = 1; + while ($i <= 7) { + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0; + } + if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) { + $btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25; + } + $i++; + } + $atk1 = 0; + if (!isset($CRON_CORE)) { + $rsys = ''; + } + if ($rsys != '') { + $js .= $rsys; + } + unset($rsys); + if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) { + $atk1 = 1; + } + } + + $rehtml = ''; + if (!isset($CRON_CORE)) { + $js .= '$("#priems").html("' . $priem->seeMy(2) . '");'; + $jslog = $btl->lookmLog(); + $jslog .= $btl->lookLog(); + if ($jslog != '') { + $js .= 'top.btlclearlog();' . $jslog; + } + unset($jslog); + //} + $rehtml .= ''; + + echo($rehtml); + + if ($btl->cached == true) { + $btl->clear_cache_start(); + } + + unset($atk1); + } + echo ''; +} diff --git a/modules_data/btl_.php b/modules_data/btl_.php index 5a72ab59..4c8e9f9b 100644 --- a/modules_data/btl_.php +++ b/modules_data/btl_.php @@ -1,22 +1,16 @@ info['battle'] == 0) { $u->info['battle'] = $btl_last['battle']; } @@ -25,49 +19,73 @@ if ($u->info['battle'] == 0 || isset($_GET['bend'])) { die(''); } -$thisBattle = mysql_fetch_array( - mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" LIMIT 1') -); +$thisBattle = Db::getRow('select * from battle where id = ?', [$u->info['battle']]); +$allprice = Db::getValue('select sum(price1) from battle_users where battle = ?', [$u->info['battle']]); -$allprice = mysql_fetch_array( - mysql_query( - 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $u->info['battle'] . '" GROUP BY `uid` LIMIT 1' - ) -); -$allprice = $allprice[0]; -function typeBattle($x) +function typeBattle($x): array { - $r = [0, 0, 'Поединок', 'Кровавый Поединок']; - if ($x >= 50000 && $x < 100000) { - $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; - } elseif ($x < 500000) { - $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; - } elseif ($x < 1000000) { - $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; - } elseif ($x < 2500000) { - $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; - } elseif ($x >= 5000000) { - $r = [150, 150, 'Судный День', 'Судный День']; + return match (true) { + $x >= 5000000 => [150, 150, 'Судный День', 'Судный День'], + $x >= 2500000 => [100, 125, 'Эпохальная Битва', 'Кровавое Побоище'], + $x >= 1000000 => [75, 100, 'Историческая Битва', 'Кровавая Сеча'], + $x >= 500000 => [50, 75, 'Величайшая Битва', 'Кровавая Резня'], + $x >= 100000 => [25, 50, 'Великая Битва', 'Кровавая Битва'], + default => [0, 0, 'Поединок', 'Кровавый Поединок'], + }; +} + +function finish(User $u): void +{ + if (!isset($_GET['finish'])) { + return; } - return $r; + Db::sql("update stats set battle_text = '', last_b = 0 where id = ?, $u->info['id'"); + Db::sql('update battle_users set finish = 1 where uid = ?', [$u->info['id']]); + header('location: main.php'); + die(); +} + +function convert($from, $to, $var) +{ + if (is_array($var)) { + $new = []; + foreach ($var as $key => $val) { + $new[convert($from, $to, $key)] = convert($from, $to, $val); + } + $var = $new; + } else { + if (is_string($var)) { + $var = iconv($from, $to, $var); + } + } + return $var; +} + +function normJsonStr($str) +{ + return preg_replace_callback( + '/\\\u([a-f0-9]{4})/i', + function ($m) { + return chr(hexdec($m[1]) - 1072 + 224); + }, + $str + ); } $allprice = typeBattle($allprice); + if ($thisBattle['smert'] == 1) { $allprice = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; } - -echo ''; ?> - - + + + '; info['battle'] == 0 || $u->info['battle'] == $btl_last['battle'])) { echo 'var battleFinishData = "' . $u->info['battle_text'] . '";'; - if (isset($_GET['finish'])) { - mysql_query( - 'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"'); - header('location: main.php'); - die(); - } + finish($u); } else { echo 'var battleFinishData = -1;'; } @@ -185,7 +196,7 @@ echo ''; }
- + '; }); - + '; return string.toString().split(delimiter.toString()); } - $val) { - $new[convert($from, $to, $key)] = convert($from, $to, $val); - } - $var = $new; - } else { - if (is_string($var)) { - $var = iconv($from, $to, $var); - } - } - return $var; - } - function normJsonStr($str) - { - return preg_replace_callback( - '/\\\u([a-f0-9]{4})/i', - function ($m) {return chr(hexdec($m[1]) - 1072 + 224);}, - $str - ); - //deprecaded -// return preg_replace_callback( -// '/\\\u([a-f0-9]{4})/i', -// create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), -// $str -// ); - } - ?> - var log_text = ; var youlogin = "info['login']?>"; @@ -387,7 +366,7 @@ echo ''; } - +
-
- - - - - - -
-
-
- - - - - - -
- - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - -
-
- - - -
-
- - - - - - -
Атака
-
Защита
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
удар в голову 
 блок головы
-
 блок головы и груди
-
 блок головы, груди и живота
удар в грудь 
 блок груди
-
 блок груди и живота
-
 блок груди, живота и пояса
удар в живот 
 блок живота
-
 блок живота и пояса
-
 блок живота, пояса и ног
удар в пояс(пах) 
 блок пояса
-
 блок пояса и ног
-
 блок пояса, ног и головы
удар по ногам 
 блок ног
-
 блок ног и головы
-
 блок ног, головы и груди
-
-
- - - - - - - - - - - - - - - - - - - - - -
   - - - - - - - - - info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;" style="cursor:pointer;"onclick="top.leaderFight();" id="btn_down_img3" style="cursor:pointer;" title="Передать флаг" src="//img.new-combats.tech/i/ico_change_leader1.gif" width="16" height="19" />
 
-
- info['level'] == 0) { ?>
-
Просто нажмите Вперёд!!! чтобы сделать рандомный удар

- -
- info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0"> - - - - - - - - - -
info['tactic1']; ?> info['tactic2']; ?> info['tactic3']; ?> info['tactic4']; ?> info['tactic5']; ?> info['tactic6']); ?> info['tactic7']<0){ $u->info['tactic7'] = 0; } - echo 0+$u->info['tactic7']; ?>
-
-
- - - - - - - -
-
-
-
-
-
- - - - - - -
  -
-
- На данный момент вами нанесено урона:  info['battle_yron']); ?> HP .
- - (Опыт: +info['battle_exp']); ?> ед., Без учета процентов) - -
-
Лог боя »»
- (Бой идет с таймаутом NaN мин.)
-
- - - - - - -
 
Полную версию лога боя смотрите здесь »»

 
-
- - - - -
diff --git a/modules_data/location/btl_.php b/modules_data/location/btl_.php deleted file mode 100644 index 97d17314..00000000 --- a/modules_data/location/btl_.php +++ /dev/null @@ -1,1159 +0,0 @@ -info['battle'] == 0) { - $u->info['battle'] = $btl_last['battle']; -} - -if ($u->info['battle'] == 0 || isset($_GET['bend'])) { - die(''); -} - -$thisBattle = mysql_fetch_array( - mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" LIMIT 1') -); - -$allprice = mysql_fetch_array( - mysql_query( - 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $u->info['battle'] . '" GROUP BY `uid` LIMIT 1' - ) -); -$allprice = $allprice[0]; -function typeBattle($x) -{ - $r = [0, 0, 'Поединок', 'Кровавый Поединок']; - if ($x < 50000) { - //Обычный бой - } elseif ($x >= 50000 && $x < 100000) { - $r = [25, 50, 'Великая Битва', 'Кровавая Битва']; - } elseif ($x < 500000) { - $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня']; - } elseif ($x < 1000000) { - $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча']; - } elseif ($x < 2500000) { - $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище']; - } elseif ($x >= 5000000) { - $r = [150, 150, 'Судный День', 'Судный День']; - } - return $r; -} - -$allprice = typeBattle($allprice); -if ($thisBattle['smert'] == 1) { - $allprice = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; -} - -echo ''; -?> - - - -
- - - - - - -
- -
- - - - - - -
-
-
-
-
-
- - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - -
-
-
- - - - -
-
- - - - - - -
-
Атака
-
-
-
-
-
Защита
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
-
-
удар в голову -   - -
-
-
 блок головы
-
 блок головы и груди
-
 блок головы, груди и - живота -
-
-
-
-
-
-
-
-
-
-
-
удар в грудь -   - -
-
-
 блок груди
-
 блок груди и живота
-
 блок груди, живота и пояса -
-
-
-
-
-
-
-
-
-
-
-
удар в живот -   - -
-
-
 блок живота
-
 блок живота и пояса
-
 блок живота, пояса и ног -
-
-
-
-
-
-
-
-
-
-
-
удар в пояс(пах) -   - -
-
-
 блок пояса
-
 блок пояса и ног
-
 блок пояса, ног и головы -
-
-
-
-
-
-
-
-
-
-
-
удар по ногам -   - -
-
-
 блок ног
-
 блок ног и головы
-
 блок ног, головы и груди -
-
-
-
- - - - - - - - - - - - - - - - - - - - -
  - - - -   - - - - - - - info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;" - style="cursor:pointer;" onclick="top.leaderFight();" id="btn_down_img3" - style="cursor:pointer;" - title="Передать флаг" - src="//img.new-combats.tech/i/ico_change_leader1.gif" - width="16" height="19"/> -
 
-
-
- info['level'] == 0) { ?> -
-
Просто нажмите - Вперёд!!! чтобы сделать рандомный - удар
-
- -
-
-
- info['level'] < 2) { - echo ' style="display:none;" '; - } ?> border="0" cellspacing="0" cellpadding="0"> - - - - - - - - - -
info['tactic1']; ?> info['tactic2']; ?> info['tactic3']; ?> info['tactic4']; ?> info['tactic5']; ?> info['tactic6']); ?> - info['tactic7'] < 0) { - $u->info['tactic7'] = 0; - } - echo 0 + $u->info['tactic7']; ?>
-
-
- - - - - - - -
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - -
  -
-
- На данный момент вами нанесено урона:  info['battle_yron']); ?> HP .
- - (Опыт: +info['battle_exp']); ?> ед., Без учета процентов) - -
-
-
-
Лог боя »»
- (Бой идет с таймаутом NaN мин.) -
-
-
- - - - - - -
  -
-
Полную версию лога боя смотрите здесь »»
-
 
-
- - - - -
diff --git a/modules_data/location/commision2.php b/modules_data/location/commision2.php index 76fbb95a..f9e22ea1 100644 --- a/modules_data/location/commision2.php +++ b/modules_data/location/commision2.php @@ -3,6 +3,8 @@ if (!defined('GAME')) { die(); } +/** @var User $u */ + $comshop = new ComissionShop(); if ($u->room['file'] == 'commision2') { @@ -26,21 +28,15 @@ if ($u->room['file'] == 'commision2') { if (!isset($_GET['otdel'])) { $_GET['otdel'] = 1; } - $sid = 1; + $error = ''; # Выполнение функции покупки предмета if (isset($_GET['buy'])) { if ($u->info['allLock'] > time()) { - $re = '
Вам запрещается пользоваться данным магазином до ' . date( - 'd.m.y H:i', $u->info['allLock'] - ) . '
'; - } elseif ($u->info['align'] == 2 || $u->info['haos'] > time()) { - $re = '
Хаосникам запрещается пользоваться данным магазином
'; - /* }elseif($u->info['palpro'] < time()) { //Проверка - $re = '
Для покупки в комиссионном нужно пройти проверку на чистоту
';*/ - } elseif ($u->newAct($_GET['sd4']) == true) { - $re = $u->buyItemCommison($sid, (int)$_GET['itemid'], (int)$_GET['buy']); + $re = '
Вам запрещается пользоваться данным магазином до ' . date('d.m.y H:i', $u->info['allLock']) . '
'; + } elseif ($u->newAct($_GET['sd4'])) { + $re = $comshop->buyItem((int)$_GET['buy'], $u); } else { $re = 'Вы уверены что хотите купить этот предмет?'; } @@ -52,9 +48,7 @@ if ($u->room['file'] == 'commision2') { */ //ТУТ комок здача - if ($u->info['align'] == 2 || $u->info['haos'] > time()) { - $re = '
Хаосникам запрещается пользоваться данным магазином
'; - } elseif (isset($_POST['PresTR'])) { + if (isset($_POST['PresTR'])) { $itemid = mysql_fetch_array( mysql_query( 'SELECT `inGroup`, `item_id` , `uid` FROM `items_users` WHERE `id` = "' . $_POST['iid'] . '" LIMIT 1' @@ -75,12 +69,12 @@ if ($u->room['file'] == 'commision2') { $itemkt['min'] = $itemkt['min'] * $itemcount['total']; $itemkt['max'] = $itemkt['max'] * $itemcount['total']; if ($_POST['summTR'] >= $itemkt['min'] && $_POST['summTR'] <= $itemkt['max']) { - $u->commisonRent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']); + $comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u); } else { $re = '
Не удалось сдать предмет его цена может быть мин: ' . $itemkt['min'] . 'кр. макс: ' . $itemkt['max'] . 'кр. кол-во: ' . $itemcount['total'] . '
'; } } else { - $u->commisonRent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']); + $comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u); } } @@ -195,7 +189,7 @@ if ($u->room['file'] == 'commision2') { * Выводим все вещи продоваемые в комке * В режиме предварительного просмотра */ - $comshop->commisionShop($sid, "preview"); + $comshop->commisionShop('preview'); } elseif ($_GET['toRent'] == 1) { /* @@ -236,7 +230,7 @@ if ($u->room['file'] == 'commision2') { * продоваемых в комке по определенному * выбранному айтему */ - $comshop->commisionShop($sid); + $comshop->commisionShop(); } ?> diff --git a/modules_data/location/dungeon_enter.php b/modules_data/location/dungeon_enter.php index 7d67383a..3796f306 100644 --- a/modules_data/location/dungeon_enter.php +++ b/modules_data/location/dungeon_enter.php @@ -8,19 +8,6 @@ if($u->room['file']=='dungeon_enter') { $dungeonGo = 1; // По умолчанию, мы идем в пещеру. $dungeon = mysql_fetch_assoc( mysql_query('SELECT `id` as room, city, `dungeon_room` as d_room, city, `shop`, `dungeon_id` as id, `dungeon_name` as name, quest FROM `dungeon_room` WHERE `id`="'.$u->room['id'].'" LIMIT 1') ); -if( $dungeon['id'] == 104 && isset($_GET['freego'])) { - if( $u->info['level'] > 7 ) { - - }elseif( $u->info['money4'] < $u->info['level'] * 5 ) { - echo '
Недостаточно зубов, необходимо '.$u->zuby( ($u->info['level'] * 5) ,1).'
'; - }else{ - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` >= '.(time()-60*60*2).' LIMIT 1'); - $u->info['money4'] -= $u->info['level'] * 5; - mysql_query('UPDATE `users` SET `money4` = "'.$u->info['money4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo '
Вы успешно сняли задержку на поход за '.$u->zuby( ($u->info['level'] * 5) ,1).'
'; - } -} - if(isset($_GET['rz']) && $dungeon['quest'] == 1) $roomSection = 1; // Получаем Задание else $roomSection = 0; // Собираем группу для похода //if( $u->info['admin'] > 0 ) var_info($dungeon); @@ -951,9 +938,6 @@ onclick="if (confirm('Сдать все чеки ( шт.) наход } }else{ echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: '.$u->timeOut(60*60*2-time()+$dungeon_timeout['time']).'
Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;)'; - if( $dungeon['id'] == 104 ) { - echo '
Вы можете посетить подземелье без ожидания: '; - } } } } diff --git a/modules_data/location/house_belaun.php b/modules_data/location/house_belaun.php index c0b081df..33d361d7 100644 --- a/modules_data/location/house_belaun.php +++ b/modules_data/location/house_belaun.php @@ -1,1375 +1,1475 @@ room['file'] == 'house_belaun' ) { - $notify = array('type' => '', 'text' => ''); // Ошибки или Уведомления здесь! - $action = ''; - $mode = ''; - $create_party = array( - 'name' => $_POST['dungeon_name'], - 'difficulty' => $_POST['dungeon_difficulty'], - 'password' => $_POST['dungeon_password'], - 'comment' => $_POST['dungeon_comment'] - ); +if (!defined('GAME')) die(); +if ($u->room['file'] == 'house_belaun') { + $notify = ['type' => '', 'text' => '']; // Ошибки или Уведомления здесь! + $action = ''; + $mode = ''; + $create_party = [ + 'name' => $_POST['dungeon_name'], + 'difficulty' => $_POST['dungeon_difficulty'], + 'password' => $_POST['dungeon_password'], + 'comment' => $_POST['dungeon_comment'], + ]; - if( isset($_GET['action']) ) { - $action = $_GET['action']; - if( isset($_GET['mode']) ) { - $mode = $_GET['mode']; - } - } - if($create_party['name'] != ''){ - // Создаем поход в пещеру. - } + if (isset($_GET['action'])) { + $action = $_GET['action']; + if (isset($_GET['mode'])) { + $mode = $_GET['mode']; + } + } + if ($create_party['name'] != '') { + // Создаем поход в пещеру. + } } ?> - - -
-
-

room['name']; ?>

-
- -
-'.$notify['text'].'
'; - if($action == "dialog") { + .house_belaun .Content { + background-color: rgba(0, 0, 0, 0.05); + width: 100%; + min-height: 260px; + border: 1px solid #a6a6a6; + } - } - if($action == "quest") { + .notification { + height: 42px; + box-sizing: border-box; + padding: 12px 15px 0px 15px; + } - } - if($action == "party" && $mode == '') { - //Генерируем список групп - $dungeonGroupList = ''; - $sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `delete` = "0" AND `time` > "'.(time()-60*60*2).'"'); - while( $pl = mysql_fetch_array( $sp ) ){ - $dungeonGroupList .= '
'; - if( $u->info['dn'] == 0 ) $dungeonGroupList .= ''; - $dungeonGroupList .= ''.date('H:i',$pl['time']).' '; - $dungeonGroupList .= ' '; + .notification.alert { + color: #ef3c39; + border-left: 4px solid #ef3c39; + border-bottom: 1px solid #a6a6a6; + } - $pus = ''; //группа - $su = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="'.$pl['id'].'" LIMIT '.($pl['team_max']+1).''); - while( $pu = mysql_fetch_array( $su ) ) { - $pus .= ''.$pu['login'].' ['.$pu['level'].']'; - $pus .= ', '; - } - $pus = trim( $pus, ', ' ); + .notification.success { + color: #2e6717; + border-left: 4px solid #2e6717; + border-bottom: 1px solid #a6a6a6; + } - $dungeonGroupList .= $pus; unset($pus); + .Content { + padding: 25px; + } - if( $pl['pass'] != '' && $u->info['dn'] == 0 ) $dungeonGroupList .= ' '; + .box:after, .box:before { + clear: both; + content: ""; + display: table; + } - if( $pl['com'] != '' ) { - $dl = ''; - // Если модератор, даем возможность удалять комментарий к походу. - $moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "'.$u->info['align'].'" LIMIT 1')); - if( ( $moder['boi'] == 1 || $u->info['admin'] > 0 ) && $pl['dcom'] == 0 ){ - $dl .= ' (удалить комментарий)'; - if( isset( $_GET['delcom'] ) && $_GET['delcom'] == $pl['id'] && $u->newAct( $_GET['key'] ) == true ) { - mysql_query('UPDATE `dungeon_zv` SET `dcom` = "'.$u->info['id'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - $pl['dcom'] = $u->info['id']; - } - } - $pl['com'] = htmlspecialchars($pl['com'],NULL); - if( $pl['dcom'] > 0 ) { - $dl = ' комментарий удален модератором'; - } - if( $pl['dcom'] > 0 ) { - if( $moder['boi'] == 1 || $u->info['admin'] > 0 ) { - $pl['com'] = ''.$pl['com'].''; - } else { - $pl['com'] = ''; - } - } - $dungeonGroupList .= ' | '.$pl['com'].''.$dl.''; - } - $dungeonGroupList .= '
'; - } - var_info($dungeonGroupList); - } - if($action == "party" && $mode == 'create') { -?> -
-
-
Куда вы хотите направиться?
-
-
- -
Пещера Тысячи Проклятий
-
Пещера Тысячи Проклятий
Бездна
Катакомбы
-
+ .box { + width: 330px; + border-left: 1px solid #595959; + } -
- -
Сложность:
Нормальная
-
Легкая
Нормальная
Сложная
-
+ .box .body { + padding: 12px; + border-top: 1px solid #595959; + } -
-
Пароль:
-
-
-
-
-
-
-
-
- -
- + .box .heading { + border-top: 1px solid #595959; + padding: 12px 12px; + } + .box .button { + border: 1px solid #595959; + border-left: 0px; + } + + .box input[type=submit] { + cursor: pointer; + } + + .box .button input { + background-color: transparent; + width: 100%; + height: 40px; + border: 0px; + font-size: 13px; + color: #444444; + margin: 0px; + display: inline-block; + } + + .select { + margin-bottom: 12px; + position: relative; + width: 100%; + box-sizing: border-box; + } + + .selected { + display: table; + border: 1px solid #a6a6a6; + height: 34px; + width: 100%; + box-sizing: border-box; + } + + .select.in .options { + display: table; + } + + .select.in .arrow { + background-image: url('//img.new-combats.tech/i/select-arrow-up.png'); + } + + .selected .opt1 { + display: table-cell; + padding: 0px 5px; + box-sizing: border-box; + background-color: #d4d4d4; + text-align: center; + vertical-align: middle; + border-right: 1px solid #a6a6a6; + } + + .selected div.opt2 { + display: table-cell; + vertical-align: middle; + padding: 0px 10px 0px 13px; + background-color: #eeeeee; + letter-spacing: 0px; + text-align: left; + font-size: 13px; + line-height: 14px; + width: 90%; + } + + .selected div.opt2i { + display: table-cell; + } + + .selected div.opt2i > input { + display: block; + vertical-align: middle; + padding: 0px 8px; + background-color: #eeeeee; + letter-spacing: 0px; + color: #222222; + text-align: left; + height: 100%; + border: 0px; + margin: 0px; + outline: 0; + font-size: 14px; + box-sizing: border-box; + line-height: 32px; + width: 100%; + } + + .selected .arrow { + border-left: 1px solid #a6a6a6; + display: table-cell; + width: 34px; + min-width: 34px; + box-sizing: border-box; + background-color: #d4d4d4; + vertical-align: middle; + transition: all 0.3s ease; + cursor: pointer; + background-image: url('//img.new-combats.tech/i/select-arrow-down.png'); + background-repeat: no-repeat; + background-position: center; + } + + .selected .key:hover { + background-image: url('//img.new-combats.tech/i/key-hover.gif'); + } + + .selected .key { + border-left: 1px solid #a6a6a6; + display: table-cell; + width: 34px; + min-width: 34px; + box-sizing: border-box; + background-color: #d4d4d4; + vertical-align: middle; + transition: all 0.2s ease; + cursor: pointer; + background-image: url('//img.new-combats.tech/i/key.gif'); + background-repeat: no-repeat; + background-position: center; + } + + .select .options { + background-color: #eeeeee; + border: 1px solid #a6a6a6; + margin-top: -1px; + width: 100%; + z-index: 2; + display: table; + display: none; + position: absolute; + box-sizing: border-box; + top: 100%; + } + + .select .option + .option .opt1, + .select .option + .option .opt2 { + border-top: 1px solid #a6a6a6; + } + + .select .option { + width: 100%; + cursor: pointer; + box-sizing: border-box; + display: table-row; + } + + .select .option .opt1 { + display: table-cell; + text-align: center; + padding: 10px 2px; + } + + .select .option .opt2 { + display: table-cell; + text-align: left; + padding: 10px 5px; + } + + +
+
+

room['name']; ?>

+
+ +
+ ' . $notify['text'] . '
'; + if ($action == "dialog") { + + } + if ($action == "quest") { + + } + if ($action == "party" && $mode == '') { + //Генерируем список групп + $dungeonGroupList = ''; + $sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `delete` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '"'); + while ($pl = mysql_fetch_array($sp)) { + $dungeonGroupList .= '
'; + if ($u->info['dn'] == 0) $dungeonGroupList .= ''; + $dungeonGroupList .= '' . date('H:i', $pl['time']) . ' '; + $dungeonGroupList .= ' '; + + $pus = ''; //группа + $su = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $pl['id'] . '" LIMIT ' . ($pl['team_max'] + 1) . ''); + while ($pu = mysql_fetch_array($su)) { + $pus .= '' . $pu['login'] . ' [' . $pu['level'] . ']'; + $pus .= ', '; + } + $pus = trim($pus, ', '); + + $dungeonGroupList .= $pus; + unset($pus); + + if ($pl['pass'] != '' && $u->info['dn'] == 0) $dungeonGroupList .= ' '; + + if ($pl['com'] != '') { + $dl = ''; + // Если модератор, даем возможность удалять комментарий к походу. + $moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); + if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) { + $dl .= ' (удалить комментарий)'; + if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $u->newAct($_GET['key']) == true) { + mysql_query('UPDATE `dungeon_zv` SET `dcom` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $pl['dcom'] = $u->info['id']; + } + } + $pl['com'] = htmlspecialchars($pl['com'], null); + if ($pl['dcom'] > 0) { + $dl = ' комментарий удален модератором'; + } + if ($pl['dcom'] > 0) { + if ($moder['boi'] == 1 || $u->info['admin'] > 0) { + $pl['com'] = '' . $pl['com'] . ''; + } else { + $pl['com'] = ''; + } + } + $dungeonGroupList .= ' | ' . $pl['com'] . '' . $dl . ''; + } + $dungeonGroupList .= '
'; + } + var_info($dungeonGroupList); + } + if ($action == "party" && $mode == 'create') { + ?> +
+
+
Куда вы хотите направиться?
+
+
+ +
+
+
Пещера Тысячи Проклятий
+
+
+
+
+
+
Пещера Тысячи Проклятий
+
+
+
+
Бездна
+
+
+
+
Катакомбы
+
+
+
+ +
+ +
+
Сложность:
+
Нормальная
+
+
+
+
+
Легкая
+
+
+
Нормальная
+
+
+
Сложная
+
+
+
+ +
+
+
Пароль:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ room['file']=='house_belaun' && false) { +if ($u->room['file'] == 'house_belaun' && false) { - $error = ''; // Собираем ошибки. - $dungeonGroupList = ''; // Сюда помещаем список Групп. - $dungeonGo = 1; // По умолчанию, мы идем в пещеру. - $dungeon = mysql_fetch_assoc( mysql_query('SELECT `id` as room, city, `dungeon_room` as d_room, city, `shop`, `dungeon_id` as id, `dungeon_name` as name, quest FROM `dungeon_room` WHERE `id`="'.$u->room['id'].'" LIMIT 1') ); + $error = ''; // Собираем ошибки. + $dungeonGroupList = ''; // Сюда помещаем список Групп. + $dungeonGo = 1; // По умолчанию, мы идем в пещеру. + $dungeon = mysql_fetch_assoc(mysql_query('SELECT `id` as room, city, `dungeon_room` as d_room, city, `shop`, `dungeon_id` as id, `dungeon_name` as name, quest FROM `dungeon_room` WHERE `id`="' . $u->room['id'] . '" LIMIT 1')); -$dunname = array( - 12 => array('capitalcity','Пещера Тысячи Проклятий'), - 101 => array('angelscity','Бездна'), - //3 => array('demonscity','Катакомбы'), - //105 => array('sandcity','Пещеры Мглы'), - //108 => array('emeraldscity','Потерянный вход'), - //10 => array('suncity','Грибница'), - //106 => array('devilscity','Туманные Низины') -); + $dunname = [ + 12 => ['capitalcity', 'Пещера Тысячи Проклятий'], + 101 => ['angelscity', 'Бездна'], + //3 => array('demonscity','Катакомбы'), + //105 => array('sandcity','Пещеры Мглы'), + //108 => array('emeraldscity','Потерянный вход'), + //10 => array('suncity','Грибница'), + //106 => array('devilscity','Туманные Низины') + ]; -if( $dungeon['id'] == 104 && isset($_GET['freego'])) { - if( $u->info['level'] > 7 ) { - - }elseif( $u->info['money4'] < $u->info['level'] * 5 ) { - echo '
Недостаточно зубов, необходимо '.$u->zuby( ($u->info['level'] * 5) ,1).'
'; - }else{ - mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` >= '.(time()-60*60*2).' LIMIT 1'); - $u->info['money4'] -= $u->info['level'] * 5; - mysql_query('UPDATE `users` SET `money4` = "'.$u->info['money4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo '
Вы успешно сняли задержку на поход за '.$u->zuby( ($u->info['level'] * 5) ,1).'
'; - } -} - -if(isset($_GET['rz']) && $dungeon['quest'] == 1) $roomSection = 1; // Получаем Задание - else $roomSection = 0; // Собираем группу для похода + if (isset($_GET['rz']) && $dungeon['quest'] == 1) $roomSection = 1; // Получаем Задание + else $roomSection = 0; // Собираем группу для похода //if( $u->info['admin'] > 0 ) var_info($dungeon); -$all_dungeon = mysql_query('SELECT `city` FROM `dungeon_room` WHERE `city` IS NOT NULL AND `active`=1 '); -while( $t = mysql_fetch_array($all_dungeon) ) { $dungeon['list'][] = $t['city']; } -unset($all_dungeon); - -if( $u->info['dn'] > 0 ) { - $zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `id`="'.$u->info['dn'].'" AND `delete` = "0" LIMIT 1')); - if(!isset($zv['id'])){ - mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['dn'] = 0; - } -} + $all_dungeon = mysql_query('SELECT `city` FROM `dungeon_room` WHERE `city` IS NOT NULL AND `active`=1 '); + while ($t = mysql_fetch_array($all_dungeon)) { + $dungeon['list'][] = $t['city']; + } + unset($all_dungeon); -$dungeon_timeout = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` > '.(time()-60*60*2).' LIMIT 1',1); + if ($u->info['dn'] > 0) { + $zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `id`="' . $u->info['dn'] . '" AND `delete` = "0" LIMIT 1')); + if (!isset($zv['id'])) { + mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['dn'] = 0; + } + } -if($u->info['admin']>0) unset($dungeon_timeout); // $dungeon_timeout - задержка на посещение пещеры. -if(isset($dungeon_timeout['id'])) // Кто-то передумал и не пойдет в пещеру, так-как уже там был. -{ - $dungeonGo = 0; - if(isset($_GET['start'])){ - $error = 'До следующего похода осталось еще: '.$u->timeOut(60*60*2-time()+$dungeon_timeout['time']); - } -} + $dungeon_timeout = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "psh0" AND `time` > ' . (time() - 60 * 60 * 2) . ' LIMIT 1', 1); -if( isset( $_GET['start'] ) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1 ) { - $ig = 1; - if( $ig > 0 ){ //перемещаем игроков в пещеру - //$u->addAction(time(),'psh'.$dun,''); - - // - $ins = mysql_query('INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`) - VALUES ("'.$zv['city'].'","'.$zv['uid'].'","'.$zv['dun'].'","'.$dunname[$zv['dun']][1].'","'.time().'")'); - if($ins){ - $zid = mysql_insert_id(); - mysql_query('UPDATE `dungeon_zv` SET `delete` = "'.time().'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - //обновляем пользователей - $su = mysql_query('SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="'.$zv['id'].'" /*LIMIT '.($zv['team_max']+1).'*/'); - $ids = ''; - - $map_locs = array(); - $spm2 = mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id_dng` = "'.$zv['dun'].'"'); - while( $plm2 = mysql_fetch_array( $spm2 ) ) { - $map_locs[] = array($plm2['x'],$plm2['y']); - } - unset( $spm2 , $plm2 ); - - $pxd = 0; - while( $pu = mysql_fetch_array($su) ) { - $pxd++; - $ids .= ' `id` = "'.$pu['id'].'" OR'; - if( $u->stats['silver'] >= 3 ) { - $u->addAction( ( time() - ((60*60*2)/100*30) ) ,'psh0',$pu['id'],$pu['id']); - }else{ - $u->addAction(time(),'psh0',$pu['id'],$pu['id']); - } - //Добавляем квестовые обьекты для персонажей - $sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `room` = '.$dungeon['room'].' AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100'); - while($pl2 = mysql_fetch_array($sp)){ - $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.(str_replace('start_quest','',$pl2['vars'])).'" AND `line` = "'.$dungeon['id'].'" LIMIT 1')); - if( isset($pl['id']) ) { - $act = explode(',',$pl['act_date']); - $i = 0; - while( $i < count($act) ) { - $act_date = explode(':|:',$act[$i]); - foreach($act_date as $key=>$val){ - $val = explode(':=:',$val); - $actdate[$val[0]] = $val[1]; - } - //Сбор ресурсов - if( isset($actdate['tk_itm']) && $actdate['tk_itm'] != '' ) { - $xr2 = explode('=',$actdate['tk_itm']); - if( $xr2[2] == 0 ) { - if( isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY']) ) { - $actdate['tk_itm_fromY'] = (integer)$actdate['tk_itm_fromY']; - $actdate['tk_itm_toY'] = (integer)$actdate['tk_itm_toY']; - } - $ml_arr = array(); - foreach($map_locs as $ml){ // tk_itm_fromY tk_itm_toY - отсеиваем позицию для дропа предметов. - if( (isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) OR (!isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) ) { - if( $ml[1] > $actdate['tk_itm_fromY'] && $actdate['tk_itm_toY'] > $ml[1] )$ml_arr[] = $ml; - elseif( !isset($actdate['tk_itm_fromY']) && $actdate['tk_itm_toY'] > $ml[1] ) $ml_arr[] = $ml; - } else $ml_arr[] = $ml; - } - if( isset($ml_arr) && count($ml_arr) == 0 ) $ml_arr = $map_locs; - //Добавляем обьект для юзера - $j = 0; - while( $j < $xr2[1] ){ - $cord = $ml_arr[rand(0,count($ml_arr)-1)]; - if( $cord[0] != 0 || $cord[1] != 0 ) { - mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES ( - "'.$zid.'","'.$u->info['id'].'","'.$xr2[0].'","'.time().'","'.$cord[0].'","'.$cord[1].'","'.$u->info['id'].'","'.$pl['id'].'" + if ($u->info['admin'] > 0) unset($dungeon_timeout); // $dungeon_timeout - задержка на посещение пещеры. + if (isset($dungeon_timeout['id'])) // Кто-то передумал и не пойдет в пещеру, так-как уже там был. + { + $dungeonGo = 0; + if (isset($_GET['start'])) { + $error = 'До следующего похода осталось еще: ' . $u->timeOut(60 * 60 * 2 - time() + $dungeon_timeout['time']); + } + } + + if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) { + $ig = 1; + if ($ig > 0) { //перемещаем игроков в пещеру + //$u->addAction(time(),'psh'.$dun,''); + + // + $ins = mysql_query('INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`) + VALUES ("' . $zv['city'] . '","' . $zv['uid'] . '","' . $zv['dun'] . '","' . $dunname[$zv['dun']][1] . '","' . time() . '")'); + if ($ins) { + $zid = mysql_insert_id(); + mysql_query('UPDATE `dungeon_zv` SET `delete` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + //обновляем пользователей + $su = mysql_query('SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $zv['id'] . '" /*LIMIT ' . ($zv['team_max'] + 1) . '*/'); + $ids = ''; + + $map_locs = []; + $spm2 = mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id_dng` = "' . $zv['dun'] . '"'); + while ($plm2 = mysql_fetch_array($spm2)) { + $map_locs[] = [$plm2['x'], $plm2['y']]; + } + unset($spm2, $plm2); + + $pxd = 0; + while ($pu = mysql_fetch_array($su)) { + $pxd++; + $ids .= ' `id` = "' . $pu['id'] . '" OR'; + if ($u->stats['silver'] >= 3) { + $u->addAction((time() - ((60 * 60 * 2) / 100 * 30)), 'psh0', $pu['id'], $pu['id']); + } else { + $u->addAction(time(), 'psh0', $pu['id'], $pu['id']); + } + //Добавляем квестовые обьекты для персонажей + $sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `room` = ' . $dungeon['room'] . ' AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100'); + while ($pl2 = mysql_fetch_array($sp)) { + $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" AND `line` = "' . $dungeon['id'] . '" LIMIT 1')); + if (isset($pl['id'])) { + $act = explode(',', $pl['act_date']); + $i = 0; + while ($i < count($act)) { + $act_date = explode(':|:', $act[$i]); + foreach ($act_date as $key => $val) { + $val = explode(':=:', $val); + $actdate[$val[0]] = $val[1]; + } + //Сбор ресурсов + if (isset($actdate['tk_itm']) && $actdate['tk_itm'] != '') { + $xr2 = explode('=', $actdate['tk_itm']); + if ($xr2[2] == 0) { + if (isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) { + $actdate['tk_itm_fromY'] = (integer)$actdate['tk_itm_fromY']; + $actdate['tk_itm_toY'] = (integer)$actdate['tk_itm_toY']; + } + $ml_arr = []; + foreach ($map_locs as $ml) { // tk_itm_fromY tk_itm_toY - отсеиваем позицию для дропа предметов. + if ((isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) or (!isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY']))) { + if ($ml[1] > $actdate['tk_itm_fromY'] && $actdate['tk_itm_toY'] > $ml[1]) $ml_arr[] = $ml; + elseif (!isset($actdate['tk_itm_fromY']) && $actdate['tk_itm_toY'] > $ml[1]) $ml_arr[] = $ml; + } else $ml_arr[] = $ml; + } + if (isset($ml_arr) && count($ml_arr) == 0) $ml_arr = $map_locs; + //Добавляем обьект для юзера + $j = 0; + while ($j < $xr2[1]) { + $cord = $ml_arr[rand(0, count($ml_arr) - 1)]; + if ($cord[0] != 0 || $cord[1] != 0) { + mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES ( + "' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time() . '","' . $cord[0] . '","' . $cord[1] . '","' . $u->info['id'] . '","' . $pl['id'] . '" )'); - } - $j++; - } - }else{ - //Предмет находится в конкретном месте - mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES ( - "'.$zid.'","'.$u->info['id'].'","'.$xr2[0].'","'.time().'","'.$xr2[2].'","'.$xr2[3].'","'.$u->info['id'].'","'.$pl['id'].'" + } + $j++; + } + } else { + //Предмет находится в конкретном месте + mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES ( + "' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time() . '","' . $xr2[2] . '","' . $xr2[3] . '","' . $u->info['id'] . '","' . $pl['id'] . '" )'); - } - } - $i++; - } - } - } - - } - $ids = rtrim($ids,'OR'); - $snew = 1; - $upd1 = mysql_query('UPDATE `stats` SET `s`="'.$snew.'",`res_s`="1",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "'.$zid.'" WHERE '.$ids.' LIMIT '.($zv['team_max']+1).''); - if( $upd1 ){ - $upd2 = mysql_query('UPDATE `users` SET `room` = "405" WHERE '.$ids.' LIMIT '.($zv['team_max']+1).''); - //Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id'] - //Добавляем ботов - $vls = ''; - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "'.$zv['dun'].'"'); - while( $pl = mysql_fetch_array( $sp ) ) { - if( $pl['id_bot'] == 0 && $pl['bot_group'] !=''){ - $bots = explode( ',', $pl['bot_group'] ); - $pl['id_bot'] = (int)$bots[rand(0, count($bots)-1 )]; - } - if( $pl['id_bot'] > 0 )$vls .= '("'.$zid.'","'.$pl['id_bot'].'","'.$pl['colvo'].'","'.$pl['items'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['dialog'].'","'.$pl['items'].'","'.$pl['go_bot'].'","'.$pl['noatack'].'"),'; - unset($bots); - } - $vls = rtrim($vls,','); - $ins1 = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`,`noatack`) VALUES '.$vls.''); - //Добавляем обьекты - $vls = ''; - $sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "'.$zv['dun'].'"'); - while($pl = mysql_fetch_array($sp)) - { - $vls .= '("'.$zid.'","'.$pl['name'].'","'.$pl['img'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['action'].'","'.$pl['type'].'","'.$pl['w'].'","'.$pl['h'].'","'.$pl['s'].'","'.$pl['s2'].'","'.$pl['os1'].'","'.$pl['os2'].'","'.$pl['os3'].'","'.$pl['os4'].'","'.$pl['type2'].'","'.$pl['top'].'","'.$pl['left'].'","'.$pl['date'].'"),'; - } - //Добавление обьектов (день святого валентина) - if( floor(date('m')) == 2 && floor(date('d')) >= 7 ) { - if( floor(date('m')) == 2 && floor(date('d')) >= 14 ) { - //Появляются мобы которые принимают цветы - $vlsbts = ''; - $ins1bts = NULL; - if( $zv['dun'] == 1 ) { - //4 уровня (КАНАЛИЗАЦИЯ) - $vlsbts .='("'.$zid.'","410","1","","-5","3","8","0","0"),'; - //4-7 уровня - $vlsbts .='("'.$zid.'","413","1","","8","46","9","0","0"),'; - }elseif( $zv['dun'] == 12 ) { - //(ПТП) - //4-7 уровня - $vlsbts .='("'.$zid.'","413","1","","-3","18","9","0","0"),'; - //4-9 уровня - $vlsbts .='("'.$zid.'","414","1","","-2","29","10","0","0"),'; - }elseif( $zv['dun'] == 3 ) { - //(КАТАКОМБЫ) - //4-7 уровня - $vlsbts .='("'.$zid.'","413","1","","15","8","9","0","0"),'; - //4-9 уровня - $vlsbts .='("'.$zid.'","414","1","","3","35","10","0","0"),'; - }elseif( $zv['dun'] == 101 ) { - //(бездна) - //4-7 уровня - $vlsbts .='("'.$zid.'","413","1","","-2","21","9","0","0"),'; - //4-9 уровня - $vlsbts .='("'.$zid.'","414","1","","2","43","10","0","0"),'; - } - - if( $vlsbts != '' ) { - $vlsbts = rtrim($vlsbts,','); - $ins1bts = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`) VALUES '.$vlsbts.''); - } - unset($vlsbts,$ins1bts); - } - //Раскидываем предметы по пещере (Блёклый подземник) - $dcords = array(); - $c_sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$zv['dun'].'"'); - while( $c_pl = mysql_fetch_array($c_sp)) { - $dcords[] = array($c_pl['x'],$c_pl['y']); - } - $fcords = array(); - $i = 1; - while($i <= $pxd) { - $j = rand(1,10); - while( $j >= 0 ) { - $rndxy = rand(0,count($dcords)-1); - $rndx = $dcords[$rndxy][0]; - $rndy = $dcords[$rndxy][1]; - $fcords[$rndx][$rndy] = true; - unset($dcords[$rndxy]); - $vls .= '("'.$zid.'","Блеклый подземник","vbig1.gif","'.$rndx.'","'.$rndy.'","fileact:vbig1","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; - $j--; - } - $i++; - } - //Раскидываем предметы по пещере (Черепичный подземник) - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "'.$zv['dun'].'"'); - $test = array(); - $dcords2 = array(); - $dcords3 = array(); - while( $pl = mysql_fetch_array( $sp ) ) { - if(!isset($test[$pl['id_bot']])) { - $test[$pl['id_bot']] = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.$pl['id_bot'].'" LIMIT 1')); - } - if( isset($test[$pl['id_bot']]['id']) && $test[$pl['id_bot']] != 2 ) { - if( $test[$pl['id_bot']]['level'] > 6 ) { - $dcords2[] = array($pl['x'],$pl['y']); - } - if( $test[$pl['id_bot']]['level'] >= 8 && $test[$pl['id_bot']]['align'] == 9 ) { - $dcords3[] = array($pl['x'],$pl['y']); - } - }else{ - $test[$pl['id_bot']] = 2; - } - } - $i = 1; - while($i <= $pxd) { - $j = rand(1,5); - while( $j >= 0 ) { - $rndxy = rand(0,count($dcords2)-1); - $rndx = $dcords2[$rndxy][0]; - $rndy = $dcords2[$rndxy][1]; - if(!isset($fcords[$rndx][$rndy]) && isset($dcords2[$rndxy][0])) { - $fcords[$rndx][$rndy] = true; - unset($dcords2[$rndxy]); - $vls .= '("'.$zid.'","Черепичный подземник","vbig2.gif","'.$rndx.'","'.$rndy.'","fileact:vbig2","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; - } - $j--; - } - $i++; - } - $i = 1; - while($i <= $pxd) { - $j = rand(1,2); - while( $j >= 0 ) { - $rndxy = rand(0,count($dcords3)-1); - $rndx = $dcords3[$rndxy][0]; - $rndy = $dcords3[$rndxy][1]; - if(!isset($fcords[$rndx][$rndy]) && isset($dcords3[$rndxy][0])) { - $fcords[$rndx][$rndy] = true; - unset($dcords3[$rndxy]); - $vls .= '("'.$zid.'","Кровавый подземник","vbig3.gif","'.$rndx.'","'.$rndy.'","fileact:vbig3","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; - } - $j--; - } - $i++; - } - unset($test); - } - // - $vls = rtrim($vls,','); - if( $vls != '' ) { - $ins2 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES '.$vls.''); - } else { - $ins2 = true; - } - if( $upd2 && $ins1 && $ins2 ){ - die(''); - } else { - $error = 'Ошибка перехода в подземелье...'; - } - } else { - $error = 'Ошибка перехода в подземелье...'; - } - } else { - $error = 'Ошибка перехода в подземелье...'; - } - } -} elseif( isset( $_POST['go'] , $_POST['goid'] ) && $dungeonGo == 1 ) { - if(!isset($zv['id'])) { - $zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `id`="'.mysql_real_escape_string($_POST['goid']).'" AND `delete` = "0" LIMIT 1')); - if( isset( $zv['id'] ) && $u->info['dn'] == 0) { - if( $zv['pass'] != '' && $_POST['pass_com'] != $zv['pass'] ) { - $error = 'Вы ввели неправильный пароль'; - } elseif( $u->info['level'] > 7 && $zv['dun'] != 1 ){ - $row = 0; - if( 5 > $row ) { - $upd = mysql_query('UPDATE `stats` SET `dn` = "'.$zv['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if( !$upd ){ - $error = 'Не удалось вступить в эту группу'; - unset($zv); - } else { - $u->info['dn'] = $zv['id']; - } - } else { - $error = 'В группе нет места'; - unset($zv); - } - } elseif( $zv['dun'] == 1 ){ - //Канализация - $row_max = 5; - if( $u->info['level'] == 4 ) { - $row_max = 4; - }elseif( $u->info['level'] == 5 ) { - $row_max = 3; - }elseif( $u->info['level'] == 6 ) { - $row_max = 2; - }elseif( $u->info['level'] >= 7 ) { - $row_max = 1; - } - $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "'.$zv['id'].'" LIMIT 1')); - $row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "'.$zv['id'].'" LIMIT 1')); - $row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row1['id'].'" LIMIT 1')); - $row = $row[0]; - if( $row2['level'] != $u->info['level'] ) { - $error = 'Вы не подходите по уровню'; - }elseif( $row_max > $row ) { - $upd = mysql_query('UPDATE `stats` SET `dn` = "'.$zv['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if( !$upd ){ - $error = 'Не удалось вступить в эту группу'; - unset($zv); - } else { - $u->info['dn'] = $zv['id']; - } - } else { - $error = 'В группе нет места'; - unset($zv); - } - } elseif( $u->info['level'] < 4 && $zv['dun'] == 104 ){ - //Шахты - $row_max = 3; - if( $u->info['level'] > 3 ) { - $row_max = 1; - } - $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "'.$zv['id'].'" LIMIT 1')); - $row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "'.$zv['id'].'" LIMIT 1')); - $row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row1['id'].'" LIMIT 1')); - $row = $row[0]; - if( $row2['level'] != $u->info['level'] && $u->info['level'] > 3 ) { - $error = 'Вы не подходите по уровню'; - }elseif( $row_max > $row ) { - $upd = mysql_query('UPDATE `stats` SET `dn` = "'.$zv['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if( !$upd ){ - $error = 'Не удалось вступить в эту группу'; - unset($zv); - } else { - $u->info['dn'] = $zv['id']; - } - } else { - $error = 'В группе для вас нет места'; - unset($zv); - } - } else { - $error = 'Вы не подходите по уровню'; - unset($zv); - } - } else { - $error = 'Заявка не найдена'; - } - } else { - $error = 'Вы уже находитесь в группе'; - } -} elseif( isset( $_POST['leave'] ) && isset( $zv['id'] ) && $dungeonGo == 1 ) { - if( $zv['uid'] == $u->info['id'] ) { - //ставим в группу нового руководителя - $ld = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dn` = "'.$zv['id'].'" AND `id` != "'.$u->info['id'].'" LIMIT 1')); - if( isset($ld['id']) ){ - $zv['uid'] = $ld['id']; - mysql_query('UPDATE `dungeon_zv` SET `uid` = "'.$zv['uid'].'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['dn'] = 0; - unset($zv); - } else { - //удаляем группу целиком - mysql_query('UPDATE `dungeon_zv` SET `delete` = "'.time().'" WHERE `id` = "'.$zv['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['dn'] = 0; - unset($zv); - } - } else { - //просто выходим с группы - mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['dn'] = 0; - unset($zv); - } -} elseif( isset($_POST['add']) && $u->info['level'] > 1 && $dungeonGo == 1 ) { - if( $u->info['dn'] == 0 ) { - $dun5 = $dungeon['id']; - // - if(isset($_POST['rpmg1'])) { - if($_POST['rpmg1']==2) { - $dun5 = 101; //Бездна - }elseif($_POST['rpmg1']==3) { - $dun5 = 105; //Пещера Мглы - }elseif($_POST['rpmg1']==4) { - $dun5 = 3; //Катакомбы - }elseif($_POST['rpmg1']==5) { - $dun5 = 108; //Потерянный вход - }elseif($_POST['rpmg1']==6) { - $dun5 = 10; //Грибница - }elseif($_POST['rpmg1']==7) { - $dun5 = 12; //Низины - }else{ - $dun5 = 12; //ПТП - } - }else{ - $dun5 = 12; //ПТП - } - // - $ins = mysql_query('INSERT INTO `dungeon_zv` + } + } + $i++; + } + } + } + + } + $ids = rtrim($ids, 'OR'); + $snew = 1; + $upd1 = mysql_query('UPDATE `stats` SET `s`="' . $snew . '",`res_s`="1",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "' . $zid . '" WHERE ' . $ids . ' LIMIT ' . ($zv['team_max'] + 1) . ''); + if ($upd1) { + $upd2 = mysql_query('UPDATE `users` SET `room` = "405" WHERE ' . $ids . ' LIMIT ' . ($zv['team_max'] + 1) . ''); + //Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id'] + //Добавляем ботов + $vls = ''; + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "' . $zv['dun'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['id_bot'] == 0 && $pl['bot_group'] != '') { + $bots = explode(',', $pl['bot_group']); + $pl['id_bot'] = (int)$bots[rand(0, count($bots) - 1)]; + } + if ($pl['id_bot'] > 0) $vls .= '("' . $zid . '","' . $pl['id_bot'] . '","' . $pl['colvo'] . '","' . $pl['items'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['dialog'] . '","' . $pl['items'] . '","' . $pl['go_bot'] . '","' . $pl['noatack'] . '"),'; + unset($bots); + } + $vls = rtrim($vls, ','); + $ins1 = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`,`noatack`) VALUES ' . $vls . ''); + //Добавляем обьекты + $vls = ''; + $sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "' . $zv['dun'] . '"'); + while ($pl = mysql_fetch_array($sp)) { + $vls .= '("' . $zid . '","' . $pl['name'] . '","' . $pl['img'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['action'] . '","' . $pl['type'] . '","' . $pl['w'] . '","' . $pl['h'] . '","' . $pl['s'] . '","' . $pl['s2'] . '","' . $pl['os1'] . '","' . $pl['os2'] . '","' . $pl['os3'] . '","' . $pl['os4'] . '","' . $pl['type2'] . '","' . $pl['top'] . '","' . $pl['left'] . '","' . $pl['date'] . '"),'; + } + //Добавление обьектов (день святого валентина) + if (floor(date('m')) == 2 && floor(date('d')) >= 7) { + if (floor(date('m')) == 2 && floor(date('d')) >= 14) { + //Появляются мобы которые принимают цветы + $vlsbts = ''; + $ins1bts = null; + if ($zv['dun'] == 1) { + //4 уровня (КАНАЛИЗАЦИЯ) + $vlsbts .= '("' . $zid . '","410","1","","-5","3","8","0","0"),'; + //4-7 уровня + $vlsbts .= '("' . $zid . '","413","1","","8","46","9","0","0"),'; + } elseif ($zv['dun'] == 12) { + //(ПТП) + //4-7 уровня + $vlsbts .= '("' . $zid . '","413","1","","-3","18","9","0","0"),'; + //4-9 уровня + $vlsbts .= '("' . $zid . '","414","1","","-2","29","10","0","0"),'; + } elseif ($zv['dun'] == 3) { + //(КАТАКОМБЫ) + //4-7 уровня + $vlsbts .= '("' . $zid . '","413","1","","15","8","9","0","0"),'; + //4-9 уровня + $vlsbts .= '("' . $zid . '","414","1","","3","35","10","0","0"),'; + } elseif ($zv['dun'] == 101) { + //(бездна) + //4-7 уровня + $vlsbts .= '("' . $zid . '","413","1","","-2","21","9","0","0"),'; + //4-9 уровня + $vlsbts .= '("' . $zid . '","414","1","","2","43","10","0","0"),'; + } + + if ($vlsbts != '') { + $vlsbts = rtrim($vlsbts, ','); + $ins1bts = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`) VALUES ' . $vlsbts . ''); + } + unset($vlsbts, $ins1bts); + } + //Раскидываем предметы по пещере (Блёклый подземник) + $dcords = []; + $c_sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $zv['dun'] . '"'); + while ($c_pl = mysql_fetch_array($c_sp)) { + $dcords[] = [$c_pl['x'], $c_pl['y']]; + } + $fcords = []; + $i = 1; + while ($i <= $pxd) { + $j = rand(1, 10); + while ($j >= 0) { + $rndxy = rand(0, count($dcords) - 1); + $rndx = $dcords[$rndxy][0]; + $rndy = $dcords[$rndxy][1]; + $fcords[$rndx][$rndy] = true; + unset($dcords[$rndxy]); + $vls .= '("' . $zid . '","Блеклый подземник","vbig1.gif","' . $rndx . '","' . $rndy . '","fileact:vbig1","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; + $j--; + } + $i++; + } + //Раскидываем предметы по пещере (Черепичный подземник) + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "' . $zv['dun'] . '"'); + $test = []; + $dcords2 = []; + $dcords3 = []; + while ($pl = mysql_fetch_array($sp)) { + if (!isset($test[$pl['id_bot']])) { + $test[$pl['id_bot']] = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $pl['id_bot'] . '" LIMIT 1')); + } + if (isset($test[$pl['id_bot']]['id']) && $test[$pl['id_bot']] != 2) { + if ($test[$pl['id_bot']]['level'] > 6) { + $dcords2[] = [$pl['x'], $pl['y']]; + } + if ($test[$pl['id_bot']]['level'] >= 8 && $test[$pl['id_bot']]['align'] == 9) { + $dcords3[] = [$pl['x'], $pl['y']]; + } + } else { + $test[$pl['id_bot']] = 2; + } + } + $i = 1; + while ($i <= $pxd) { + $j = rand(1, 5); + while ($j >= 0) { + $rndxy = rand(0, count($dcords2) - 1); + $rndx = $dcords2[$rndxy][0]; + $rndy = $dcords2[$rndxy][1]; + if (!isset($fcords[$rndx][$rndy]) && isset($dcords2[$rndxy][0])) { + $fcords[$rndx][$rndy] = true; + unset($dcords2[$rndxy]); + $vls .= '("' . $zid . '","Черепичный подземник","vbig2.gif","' . $rndx . '","' . $rndy . '","fileact:vbig2","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; + } + $j--; + } + $i++; + } + $i = 1; + while ($i <= $pxd) { + $j = rand(1, 2); + while ($j >= 0) { + $rndxy = rand(0, count($dcords3) - 1); + $rndx = $dcords3[$rndxy][0]; + $rndy = $dcords3[$rndxy][1]; + if (!isset($fcords[$rndx][$rndy]) && isset($dcords3[$rndxy][0])) { + $fcords[$rndx][$rndy] = true; + unset($dcords3[$rndxy]); + $vls .= '("' . $zid . '","Кровавый подземник","vbig3.gif","' . $rndx . '","' . $rndy . '","fileact:vbig3","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),'; + } + $j--; + } + $i++; + } + unset($test); + } + // + $vls = rtrim($vls, ','); + if ($vls != '') { + $ins2 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES ' . $vls . ''); + } else { + $ins2 = true; + } + if ($upd2 && $ins1 && $ins2) { + die(''); + } else { + $error = 'Ошибка перехода в подземелье...'; + } + } else { + $error = 'Ошибка перехода в подземелье...'; + } + } else { + $error = 'Ошибка перехода в подземелье...'; + } + } + } elseif (isset($_POST['go'], $_POST['goid']) && $dungeonGo == 1) { + if (!isset($zv['id'])) { + $zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `id`="' . mysql_real_escape_string($_POST['goid']) . '" AND `delete` = "0" LIMIT 1')); + if (isset($zv['id']) && $u->info['dn'] == 0) { + if ($zv['pass'] != '' && $_POST['pass_com'] != $zv['pass']) { + $error = 'Вы ввели неправильный пароль'; + } elseif ($u->info['level'] > 7 && $zv['dun'] != 1) { + $row = 0; + if (5 > $row) { + $upd = mysql_query('UPDATE `stats` SET `dn` = "' . $zv['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if (!$upd) { + $error = 'Не удалось вступить в эту группу'; + unset($zv); + } else { + $u->info['dn'] = $zv['id']; + } + } else { + $error = 'В группе нет места'; + unset($zv); + } + } elseif ($zv['dun'] == 1) { + //Канализация + $row_max = 5; + if ($u->info['level'] == 4) { + $row_max = 4; + } elseif ($u->info['level'] == 5) { + $row_max = 3; + } elseif ($u->info['level'] == 6) { + $row_max = 2; + } elseif ($u->info['level'] >= 7) { + $row_max = 1; + } + $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1')); + $row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1')); + $row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row1['id'] . '" LIMIT 1')); + $row = $row[0]; + if ($row2['level'] != $u->info['level']) { + $error = 'Вы не подходите по уровню'; + } elseif ($row_max > $row) { + $upd = mysql_query('UPDATE `stats` SET `dn` = "' . $zv['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if (!$upd) { + $error = 'Не удалось вступить в эту группу'; + unset($zv); + } else { + $u->info['dn'] = $zv['id']; + } + } else { + $error = 'В группе нет места'; + unset($zv); + } + } elseif ($u->info['level'] < 4 && $zv['dun'] == 104) { + //Шахты + $row_max = 3; + if ($u->info['level'] > 3) { + $row_max = 1; + } + $row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1')); + $row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1')); + $row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row1['id'] . '" LIMIT 1')); + $row = $row[0]; + if ($row2['level'] != $u->info['level'] && $u->info['level'] > 3) { + $error = 'Вы не подходите по уровню'; + } elseif ($row_max > $row) { + $upd = mysql_query('UPDATE `stats` SET `dn` = "' . $zv['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if (!$upd) { + $error = 'Не удалось вступить в эту группу'; + unset($zv); + } else { + $u->info['dn'] = $zv['id']; + } + } else { + $error = 'В группе для вас нет места'; + unset($zv); + } + } else { + $error = 'Вы не подходите по уровню'; + unset($zv); + } + } else { + $error = 'Заявка не найдена'; + } + } else { + $error = 'Вы уже находитесь в группе'; + } + } elseif (isset($_POST['leave']) && isset($zv['id']) && $dungeonGo == 1) { + if ($zv['uid'] == $u->info['id']) { + //ставим в группу нового руководителя + $ld = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dn` = "' . $zv['id'] . '" AND `id` != "' . $u->info['id'] . '" LIMIT 1')); + if (isset($ld['id'])) { + $zv['uid'] = $ld['id']; + mysql_query('UPDATE `dungeon_zv` SET `uid` = "' . $zv['uid'] . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['dn'] = 0; + unset($zv); + } else { + //удаляем группу целиком + mysql_query('UPDATE `dungeon_zv` SET `delete` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['dn'] = 0; + unset($zv); + } + } else { + //просто выходим с группы + mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['dn'] = 0; + unset($zv); + } + } elseif (isset($_POST['add']) && $u->info['level'] > 1 && $dungeonGo == 1) { + if ($u->info['dn'] == 0) { + $dun5 = $dungeon['id']; + // + if (isset($_POST['rpmg1'])) { + if ($_POST['rpmg1'] == 2) { + $dun5 = 101; //Бездна + } elseif ($_POST['rpmg1'] == 3) { + $dun5 = 105; //Пещера Мглы + } elseif ($_POST['rpmg1'] == 4) { + $dun5 = 3; //Катакомбы + } elseif ($_POST['rpmg1'] == 5) { + $dun5 = 108; //Потерянный вход + } elseif ($_POST['rpmg1'] == 6) { + $dun5 = 10; //Грибница + } elseif ($_POST['rpmg1'] == 7) { + $dun5 = 12; //Низины + } else { + $dun5 = 12; //ПТП + } + } else { + $dun5 = 12; //ПТП + } + // + $ins = mysql_query('INSERT INTO `dungeon_zv` (`city`,`time`,`uid`,`dun`,`pass`,`com`,`lvlmin`,`lvlmax`,`team_max`) VALUES - ("all","'.time().'","'.$u->info['id'].'","'.$dun5.'", - "'.mysql_real_escape_string($_POST['pass']).'", - "'.mysql_real_escape_string($_POST['text']).'", + ("all","' . time() . '","' . $u->info['id'] . '","' . $dun5 . '", + "' . mysql_real_escape_string($_POST['pass']) . '", + "' . mysql_real_escape_string($_POST['text']) . '", "8", "21", "5")'); - if( $ins ) { - $u->info['dn'] = mysql_insert_id(); - $zv['id'] = $u->info['dn']; - $zv['uid'] = $u->info['id']; - mysql_query('UPDATE `stats` SET `dn` = "'.$u->info['dn'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $error = 'Вы успешно создали группу'; - } else { - $error = 'Не удалось создать группу'; - } - } else { - $error = 'Вы уже находитесь в группе'; - } -} + if ($ins) { + $u->info['dn'] = mysql_insert_id(); + $zv['id'] = $u->info['dn']; + $zv['uid'] = $u->info['id']; + mysql_query('UPDATE `stats` SET `dn` = "' . $u->info['dn'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $error = 'Вы успешно создали группу'; + } else { + $error = 'Не удалось создать группу'; + } + } else { + $error = 'Вы уже находитесь в группе'; + } + } //Генерируем список групп -$sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `delete` = "0" AND `time` > "'.(time()-60*60*2).'"'); -while( $pl = mysql_fetch_array( $sp ) ){ - $dungeonGroupList .= '
'; - if( $u->info['dn'] == 0 ) $dungeonGroupList .= ''; - $dungeonGroupList .= ''.date('H:i',$pl['time']).' '; - - $dungeonGroupList .= ' '; - - $pus = ''; //группа - $su = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="'.$pl['id'].'" LIMIT '.($pl['team_max']+1).''); - while( $pu = mysql_fetch_array( $su ) ) { - $pus .= ''.$pu['login'].' ['.$pu['level'].']'; - $pus .= ', '; - } - $pus = trim( $pus, ', ' ); - - $dungeonGroupList .= $pus; unset($pus); - - if( $pl['pass'] != '' && $u->info['dn'] == 0 ) $dungeonGroupList .= ' '; - - if( $pl['com'] != '' ) { - $dl = ''; - // Если модератор, даем возможность удалять комментарий к походу. - $moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "'.$u->info['align'].'" LIMIT 1')); - if( ( $moder['boi'] == 1 || $u->info['admin'] > 0 ) && $pl['dcom'] == 0 ){ - $dl .= ' (удалить комментарий)'; - if( isset( $_GET['delcom'] ) && $_GET['delcom'] == $pl['id'] && $u->newAct( $_GET['key'] ) == true ) { - mysql_query('UPDATE `dungeon_zv` SET `dcom` = "'.$u->info['id'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - $pl['dcom'] = $u->info['id']; - } - } - $pl['com'] = htmlspecialchars($pl['com'],NULL); - if( $pl['dcom'] > 0 ) { - $dl = ' комментарий удален модератором'; - } - if( $pl['dcom'] > 0 ) { - if( $moder['boi'] == 1 || $u->info['admin'] > 0 ) { - $pl['com'] = ''.$pl['com'].''; - } else { - $pl['com'] = ''; - } - } - $dungeonGroupList .= ' | '.$pl['com'].''.$dl.''; - } - $dungeonGroupList .= '
'; -} -?> - - - - - - -
-

room['name']; ?>

-
- + $sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `delete` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '"'); + while ($pl = mysql_fetch_array($sp)) { + $dungeonGroupList .= '
'; + if ($u->info['dn'] == 0) $dungeonGroupList .= ''; + $dungeonGroupList .= '' . date('H:i', $pl['time']) . ' '; + + $dungeonGroupList .= ' '; + + $pus = ''; //группа + $su = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $pl['id'] . '" LIMIT ' . ($pl['team_max'] + 1) . ''); + while ($pu = mysql_fetch_array($su)) { + $pus .= '' . $pu['login'] . ' [' . $pu['level'] . ']'; + $pus .= ', '; + } + $pus = trim($pus, ', '); + + $dungeonGroupList .= $pus; + unset($pus); + + if ($pl['pass'] != '' && $u->info['dn'] == 0) $dungeonGroupList .= ' '; + + if ($pl['com'] != '') { + $dl = ''; + // Если модератор, даем возможность удалять комментарий к походу. + $moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); + if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) { + $dl .= ' (удалить комментарий)'; + if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $u->newAct($_GET['key']) == true) { + mysql_query('UPDATE `dungeon_zv` SET `dcom` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + $pl['dcom'] = $u->info['id']; + } + } + $pl['com'] = htmlspecialchars($pl['com'], null); + if ($pl['dcom'] > 0) { + $dl = ' комментарий удален модератором'; + } + if ($pl['dcom'] > 0) { + if ($moder['boi'] == 1 || $u->info['admin'] > 0) { + $pl['com'] = '' . $pl['com'] . ''; + } else { + $pl['com'] = ''; + } + } + $dungeonGroupList .= ' | ' . $pl['com'] . '' . $dl . ''; + } + $dungeonGroupList .= '
'; + } + ?> + +
- - + + -
  - - - - - -
- - - - - - -
- - - - - 0 ) { - $shop = mysql_fetch_array( mysql_query('SELECT `id` as shop_id, `code` FROM `room` WHERE `id` = "'.$dungeon['shop'].'" LIMIT 1') ); - if( isset($shop['code']) ){?> - - - - - -
info['city']=='fallenearth'){ - echo "Темный Портал"; - } elseif($u->info['city']=='abandonedplain'){ - echo "Центральная площадь"; - } elseif($u->info['room']==188){ - echo "Зал воинов"; - } elseif($u->info['room']==393){ - echo "Зал воинов 2"; - } elseif($u->info['room']==372){ - echo "Большая парковая улица"; - } elseif($u->info['room']==395){ - echo "Зал воинов"; - } elseif($u->info['room']==397){ - echo "Зал воинов 2"; - } elseif($u->info['room']==242){ - echo "Страшилкина улица"; - } elseif($u->info['room']==321){ - echo "Большая торговая улица"; - } else { - echo "Магический Портал"; - } - ?>
Рыцарский магазин
-
- -
+
+

room['name']; ?>

+
+
+
+ + + + + +
  + + + + + +
+ + + + + + +
+ + + + + + 0) { + $shop = mysql_fetch_array(mysql_query('SELECT `id` as shop_id, `code` FROM `room` WHERE `id` = "' . $dungeon['shop'] . '" LIMIT 1')); + if (isset($shop['code'])) { + ?> + + + + + +
info['city'] == 'fallenearth') { + echo "Темный Портал"; + } elseif ($u->info['city'] == 'abandonedplain') { + echo "Центральная площадь"; + } elseif ($u->info['room'] == 188) { + echo "Зал воинов"; + } elseif ($u->info['room'] == 393) { + echo "Зал воинов 2"; + } elseif ($u->info['room'] == 372) { + echo "Большая парковая улица"; + } elseif ($u->info['room'] == 395) { + echo "Зал воинов"; + } elseif ($u->info['room'] == 397) { + echo "Зал воинов 2"; + } elseif ($u->info['room'] == 242) { + echo "Страшилкина улица"; + } elseif ($u->info['room'] == 321) { + echo "Большая торговая улица"; + } else { + echo "Магический Портал"; + } + ?>
Рыцарский магазин
+
+
+ +
+
+
-
- -
-

- -
- -

-
- -
-

- - -
- - -

-
- -'.$error.'
'; + + +
+

+ +
+ +

+
+ +
+

+ + +
+ + +

+
+ + ' . $error . '
'; //отображаем -if( $dungeonGroupList == '' ) { - $dungeonGroupList = ''; -} else { - if( !isset( $zv['id'] ) || $u->info['dn'] == 0 ){ - if($dungeonGo==1 || $u->info['dn'] == 0 ){ - $pr = ''; - } - $dungeonGroupList = '
'.$pr.'
'.$dungeonGroupList.''.$pr.'
'; - } - $dungeonGroupList .= '
'; -} + if ($dungeonGroupList == '') { + $dungeonGroupList = ''; + } else { + if (!isset($zv['id']) || $u->info['dn'] == 0) { + if ($dungeonGo == 1 || $u->info['dn'] == 0) { + $pr = ''; + } + $dungeonGroupList = '
' . $pr . '
' . $dungeonGroupList . '' . $pr . '
'; + } + $dungeonGroupList .= '
'; + } -if( $roomSection == 0 ) { echo $dungeonGroupList; } -if( $roomSection == 1 ) { - # endQuest завершаем задание по нажатию. - if( isset( $_GET['endQuest'] ) && $_GET['endQuest'] != '' ){ - $action = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = '.$u->info['id'].' AND `id`="'.$_GET['endQuest'].'" AND `vals` = "go" LIMIT 1')); - $quest = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.str_replace('start_quest','',$action['vars']).'" LIMIT 1')); - if( $q->questCheckEnd($quest)==1 ){ - $q->questSuccesEnd($quest, $action); - } - } -?> -
-
-testAction('`uid` = "'.$u->info['id'].'" AND `room` = "'.$u->info['room'].'" AND `time` >= '.(time()-60*60*24).' AND `vars` = "psh_qt_'.$dungeon['city'].'" LIMIT 1',1); - $qc=0; // Quest Count - //Генерируем список текущих квестов - $sp = mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "'.$u->info['id'].'" LIMIT 100'); - while( $pl = mysql_fetch_array( $sp ) ) { - if($pl['room'] == $u->info['room']){ - $pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.str_replace('start_quest','',$pl['vars']).'" LIMIT 1')); - if( $q->questCheckEnd($pq)==1 ) $qsee2 = ''; else $qsee2 = ''; - - $qsee .= ' - - '.$pq['name'].' -
'.$pq['info'].'
'.$q->info($pq).''.$qsee2.'
+ if ($roomSection == 0) { + echo $dungeonGroupList; + } + if ($roomSection == 1) { + # endQuest завершаем задание по нажатию. + if (isset($_GET['endQuest']) && $_GET['endQuest'] != '') { + $action = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = ' . $u->info['id'] . ' AND `id`="' . $_GET['endQuest'] . '" AND `vals` = "go" LIMIT 1')); + $quest = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $action['vars']) . '" LIMIT 1')); + if ($q->questCheckEnd($quest) == 1) { + $q->questSuccesEnd($quest, $action); + } + } + ?> +
+ + testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_' . $dungeon['city'] . '" LIMIT 1', 1); + $qc = 0; // Quest Count + //Генерируем список текущих квестов + $sp = mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 100'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['room'] == $u->info['room']) { + $pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $pl['vars']) . '" LIMIT 1')); + if ($q->questCheckEnd($pq) == 1) $qsee2 = ''; else $qsee2 = ''; + + $qsee .= ' + + ' . $pq['name'] . ' +
' . $pq['info'] . '
' . $q->info($pq) . '' . $qsee2 . '

'; - - # - - $qc++; - } - } - - if( isset( $_GET['add_quest'] ) && $qc == 0 ) { - if( isset( $hgo['id'] ) ) { - echo 'Нельзя получать задания чаще одного раза в сутки
'; - } else { - $sp = mysql_query('SELECT * FROM `quests` WHERE `line` = '.$dungeon['id'].''); - $dq_add = array(); - while( $pl = mysql_fetch_array( $sp ) ) { - if( $u->rep['rep'.$dungeon['city']] == 9999 ) { - //квет, рыцарского задания - if( $pl['kin'] == 1 ) { - $dq_add = array( 0 => $pl ); - } - } elseif( $u->rep['rep'.$dungeon['city']] == 24999 ) { - //квет, рыцарского задания - if( $pl['kin'] == 2 ) { - $dq_add = array( 0 => $pl ); - } - } else { - if( $pl['kin'] == 0 ) { - $dq_add[count($dq_add)] = $pl; - } - } - } - $dq_add = $q->onlyOnceQuest($dq_add, $u->info['id']); - $dq_add = $dq_add[rand(0,count($dq_add)-1)]; - - - if( $q->testGood($dq_add) == 1 && $dq_add > 0 ) { - $q->startq_dn($dq_add['id']); - echo 'Вы успешно получили новое задание "'.$dq_add['name'].'".
'; - $u->addAction(time(),'psh_qt_'.$dungeon['city'],$dq_add['id']); - } else { - if ( $u->rep['rep'.$dungeon['city']] == 9999 ) { - //квест, рыцарского задания - echo 'Вы уже получили задание на достижение титула рыцаря!
'; - } elseif( $u->rep['rep'.$dungeon['city']] >= 24999 ) { - //квест, рыцарского задания - echo 'Вы завершили квестовую линию, ожидайте новых заданий!
'; - } else { - echo 'Не удалось получить задание "'.$dq_add['name'].'". Попробуйте еще...
'; - } - } - unset( $dq_add ); - } - } elseif( isset( $_GET['add_quest'] ) && $qc > 0 ) { - echo 'Что-то пошло не так... осторожнее..


'; - } - if( $qsee == '' ) { - $qsee = 'К сожалению у вас нет ни одного задания

'; - } -?> -
-
- Текущие задания: - - + + # + + $qc++; + } + } + + if (isset($_GET['add_quest']) && $qc == 0) { + if (isset($hgo['id'])) { + echo 'Нельзя получать задания чаще одного раза в сутки
'; + } else { + $sp = mysql_query('SELECT * FROM `quests` WHERE `line` = ' . $dungeon['id'] . ''); + $dq_add = []; + while ($pl = mysql_fetch_array($sp)) { + if ($u->rep['rep' . $dungeon['city']] == 9999) { + //квет, рыцарского задания + if ($pl['kin'] == 1) { + $dq_add = [0 => $pl]; + } + } elseif ($u->rep['rep' . $dungeon['city']] == 24999) { + //квет, рыцарского задания + if ($pl['kin'] == 2) { + $dq_add = [0 => $pl]; + } + } else { + if ($pl['kin'] == 0) { + $dq_add[count($dq_add)] = $pl; + } + } + } + $dq_add = $q->onlyOnceQuest($dq_add, $u->info['id']); + $dq_add = $dq_add[rand(0, count($dq_add) - 1)]; + + + if ($q->testGood($dq_add) == 1 && $dq_add > 0) { + $q->startq_dn($dq_add['id']); + echo 'Вы успешно получили новое задание "' . $dq_add['name'] . '".
'; + $u->addAction(time(), 'psh_qt_' . $dungeon['city'], $dq_add['id']); + } else { + if ($u->rep['rep' . $dungeon['city']] == 9999) { + //квест, рыцарского задания + echo 'Вы уже получили задание на достижение титула рыцаря!
'; + } elseif ($u->rep['rep' . $dungeon['city']] >= 24999) { + //квест, рыцарского задания + echo 'Вы завершили квестовую линию, ожидайте новых заданий!
'; + } else { + echo 'Не удалось получить задание "' . $dq_add['name'] . '". Попробуйте еще...
'; + } + } + unset($dq_add); + } + } elseif (isset($_GET['add_quest']) && $qc > 0) { + echo 'Что-то пошло не так... осторожнее..


'; + } + if ($qsee == '') { + $qsee = 'К сожалению у вас нет ни одного задания

'; + } + ?> +
+
+ Текущие задания: + + 0 ){ - echo 'Вы еще не справились с текущим заданием.'; - } elseif( !isset( $hgo['id'] ) && $qc == 0 ) { - ?> -
- - '.date('d.m.Y H:i',$hgo['time']+60*60*24).' ( Через '.$u->timeOut($hgo['time']+60*60*24-time()).' )'; - } - ?> + if ($qc > 0) { + echo 'Вы еще не справились с текущим заданием.'; + } elseif (!isset($hgo['id']) && $qc == 0) { + ?> +
+ + ' . date('d.m.Y H:i', $hgo['time'] + 60 * 60 * 24) . ' ( Через ' . $u->timeOut($hgo['time'] + 60 * 60 * 24 - time()) . ' )'; + } + ?>
-
- -
- rep['add_stats']*100); - $cur_price = array('price'=>0); - if( 25 - $u->rep['add_stats'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price ) { // Характеристики! - foreach( $dungeon['list'] as $key => $val ) { - if( !( $cur_price['price'] >= $price ) ) { - $cur_price['price'] += $cur = ( $price > ($cur_price['price'] + ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) ) ? ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) : ( ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) - (( ( $price - $cur_price['price'] ) - ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) )*-1))); - $cur_price['nu_'.$val] = $cur; - } - } - if( $price == $cur_price['price'] ) { - foreach( $dungeon['list'] as $key => $val ) { - if( isset( $cur_price['nu_'.$val] ) && isset( $u->rep['nu_'.$val] ) && $rt == 1 ) { - $u->rep['nu_'.$val] += $cur_price['nu_'.$val]; - $r = mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($r) $rt = 1; else $rt = 0; - } - } - if($rt==1){ - $u->info['ability'] += 1; $u->rep['add_stats'] += 1; - mysql_query('UPDATE `rep` SET `add_stats` = "'.$u->rep['add_stats'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `ability` = "'.$u->info['ability'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo 'Вы успешно приобрели 1 способность за '.$price.' ед. награды
'; - } else { - echo 'Ничего не получилось...
'; - } - } else echo 'Недостаточно репутации.'; - } else { - echo 'Ничего не получилось...
'; - } - } elseif( $_GET['buy1'] == 2 ) { // Умения! - $price = 10000; - $cur_price = array('price'=>0); - if(10-$u->rep['add_skills']>0 && $u->rep['allrep']-$u->rep['allnurep'] >= $price ) { // Умения! - foreach($dungeon['list'] as $key=>$val){ - if( !( $cur_price['price'] >= $price ) ) { - $cur_price['price'] += $cur = ( $price > ($cur_price['price'] + ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) ) ? ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) : ( ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) - (( ( $price - $cur_price['price'] ) - ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) )*-1))); - $cur_price['nu_'.$val] = $cur; - } - } - if( $price == $cur_price['price'] ) { - foreach( $dungeon['list'] as $key => $val ) { - if( isset( $cur_price['nu_'.$val] ) && isset( $u->rep['nu_'.$val] ) && $rt == 1 ) { - $u->rep['nu_'.$val] += $cur_price['nu_'.$val]; - $r = mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($r) $rt = 1; else $rt = 0; - } - } - if($rt==1){ - $u->info['skills'] += 1; $u->rep['add_skills'] += 1; - mysql_query('UPDATE `rep` SET `add_skills` = "'.$u->rep['add_skills'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `skills` = "'.$u->info['skills'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo 'Вы успешно приобрели 1 умение за '.$price.' ед. награды
'; - } else { - echo 'Ничего не получилось...
'; - } - } else echo 'Недостаточно репутации.'; - } else { - echo 'Ничего не получилось...
'; - } - } elseif( $_GET['buy1'] == 3 ) { // Кредиты - $price = 100; - $cur_price = array('price'=>0); - if( $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Покупаем кредиты - foreach($dungeon['list'] as $key=>$val){ - if( !( $cur_price['price'] >= $price ) ) { - $cur_price['price'] += $cur = ( $price > ($cur_price['price'] + ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) ) ? ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) : ( ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) - (( ( $price - $cur_price['price'] ) - ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) )*-1))); - $cur_price['nu_'.$val] = $cur; - } - } - if( $price == $cur_price['price'] ) { - foreach( $dungeon['list'] as $key => $val ) { - if( isset( $cur_price['nu_'.$val] ) && isset( $u->rep['nu_'.$val] ) && $rt == 1 ) { - $u->rep['nu_'.$val] += $cur_price['nu_'.$val]; - $r = mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($r) $rt = 1; else $rt = 0; - } - } - if($rt==1){ - $u->info['money'] += 10; $u->rep['add_money'] += 10; - mysql_query('UPDATE `rep` SET `add_money` = "'.$u->rep['add_money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo 'Вы успешно приобрели 10 кр. за '.$price.' ед. награды
'; - } else { - echo 'Ничего не получилось...
'; - } - } else echo 'Недостаточно репутации.'; - }else{ - echo 'Ничего не получилось...
'; - } - } elseif( $_GET['buy1'] == 4 ) { // Особенности - $price = 3000; - $cur_price = array('price'=>0); - if( 5 - $u->rep['add_skills2'] > 0 && $u->rep['allrep']-$u->rep['allnurep'] >= $price ) { // Особенности - foreach($dungeon['list'] as $key=>$val){ - if( !( $cur_price['price'] >= $price ) ) { - $cur_price['price'] += $cur = ( $price > ($cur_price['price'] + ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) ) ? ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) : ( ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) - (( ( $price - $cur_price['price'] ) - ( $u->rep['rep'.$val] - $u->rep['nu_'.$val] ) )*-1))); - $cur_price['nu_'.$val] = $cur; - } - } - if( $price == $cur_price['price'] ) { - foreach( $dungeon['list'] as $key => $val ) { - if( isset( $cur_price['nu_'.$val] ) && isset( $u->rep['nu_'.$val] ) && $rt == 1 ) { - $u->rep['nu_'.$val] += $cur_price['nu_'.$val]; - $r = mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if($r) $rt = 1; else $rt = 0; - } - } - if($rt==1){ - $u->info['sskills'] += 1; $u->rep['add_skills2'] += 1; - mysql_query('UPDATE `rep` SET `add_skills2` = "'.$u->rep['add_skills2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `sskills` = "'.$u->info['sskills'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo 'Вы успешно приобрели 1 особенность за '.$price.' ед. награды
'; - } else { - echo 'Ничего не получилось...
'; - } - } else echo 'Недостаточно репутации.'; - - } else { - echo 'Ничего не получилось...
'; - } - } - } - ?> -
- Награда: rep['allrep']-$u->rep['allnurep'])-$cur_price['price'] : ($u->rep['allrep']-$u->rep['allnurep']) );?> - ед. - - - - - - - - - - - - - - - - - - - - - -
Способность (еще rep['add_stats'])?>)за rep['add_stats']*100);?> ед.
Умение (еще rep['add_skills'])?>)за 10000 ед.
Деньги (10 кр.)за 100 ед.
Особенность (еще rep['add_skills2'])?>)за 3000 ед.
-
- info['id'].'" LIMIT 1000')); - if(isset($_GET['buy777']) && $chk[0]>0) { - ?> -
-

+

+ +
+ rep['add_stats'] * 100); + $cur_price = ['price' => 0]; + if (25 - $u->rep['add_stats'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Характеристики! + foreach ($dungeon['list'] as $key => $val) { + if (!($cur_price['price'] >= $price)) { + $cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1))); + $cur_price['nu_' . $val] = $cur; + } + } + if ($price == $cur_price['price']) { + foreach ($dungeon['list'] as $key => $val) { + if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) { + $u->rep['nu_' . $val] += $cur_price['nu_' . $val]; + $r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($r) $rt = 1; else $rt = 0; + } + } + if ($rt == 1) { + $u->info['ability'] += 1; + $u->rep['add_stats'] += 1; + mysql_query('UPDATE `rep` SET `add_stats` = "' . $u->rep['add_stats'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `ability` = "' . $u->info['ability'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + echo 'Вы успешно приобрели 1 способность за ' . $price . ' ед. награды
'; + } else { + echo 'Ничего не получилось...
'; + } + } else echo 'Недостаточно репутации.'; + } else { + echo 'Ничего не получилось...
'; + } + } elseif ($_GET['buy1'] == 2) { // Умения! + $price = 10000; + $cur_price = ['price' => 0]; + if (10 - $u->rep['add_skills'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Умения! + foreach ($dungeon['list'] as $key => $val) { + if (!($cur_price['price'] >= $price)) { + $cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1))); + $cur_price['nu_' . $val] = $cur; + } + } + if ($price == $cur_price['price']) { + foreach ($dungeon['list'] as $key => $val) { + if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) { + $u->rep['nu_' . $val] += $cur_price['nu_' . $val]; + $r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($r) $rt = 1; else $rt = 0; + } + } + if ($rt == 1) { + $u->info['skills'] += 1; + $u->rep['add_skills'] += 1; + mysql_query('UPDATE `rep` SET `add_skills` = "' . $u->rep['add_skills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `skills` = "' . $u->info['skills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + echo 'Вы успешно приобрели 1 умение за ' . $price . ' ед. награды
'; + } else { + echo 'Ничего не получилось...
'; + } + } else echo 'Недостаточно репутации.'; + } else { + echo 'Ничего не получилось...
'; + } + } elseif ($_GET['buy1'] == 3) { // Кредиты + $price = 100; + $cur_price = ['price' => 0]; + if ($u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Покупаем кредиты + foreach ($dungeon['list'] as $key => $val) { + if (!($cur_price['price'] >= $price)) { + $cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1))); + $cur_price['nu_' . $val] = $cur; + } + } + if ($price == $cur_price['price']) { + foreach ($dungeon['list'] as $key => $val) { + if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) { + $u->rep['nu_' . $val] += $cur_price['nu_' . $val]; + $r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($r) $rt = 1; else $rt = 0; + } + } + if ($rt == 1) { + $u->info['money'] += 10; + $u->rep['add_money'] += 10; + mysql_query('UPDATE `rep` SET `add_money` = "' . $u->rep['add_money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + echo 'Вы успешно приобрели 10 кр. за ' . $price . ' ед. награды
'; + } else { + echo 'Ничего не получилось...
'; + } + } else echo 'Недостаточно репутации.'; + } else { + echo 'Ничего не получилось...
'; + } + } elseif ($_GET['buy1'] == 4) { // Особенности + $price = 3000; + $cur_price = ['price' => 0]; + if (5 - $u->rep['add_skills2'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Особенности + foreach ($dungeon['list'] as $key => $val) { + if (!($cur_price['price'] >= $price)) { + $cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1))); + $cur_price['nu_' . $val] = $cur; + } + } + if ($price == $cur_price['price']) { + foreach ($dungeon['list'] as $key => $val) { + if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) { + $u->rep['nu_' . $val] += $cur_price['nu_' . $val]; + $r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($r) $rt = 1; else $rt = 0; + } + } + if ($rt == 1) { + $u->info['sskills'] += 1; + $u->rep['add_skills2'] += 1; + mysql_query('UPDATE `rep` SET `add_skills2` = "' . $u->rep['add_skills2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `stats` SET `sskills` = "' . $u->info['sskills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + echo 'Вы успешно приобрели 1 особенность за ' . $price . ' ед. награды
'; + } else { + echo 'Ничего не получилось...
'; + } + } else echo 'Недостаточно репутации.'; + + } else { + echo 'Ничего не получилось...
'; + } + } + } + ?> +
+ Награда: rep['allrep'] - $u->rep['allnurep']) - $cur_price['price'] : ($u->rep['allrep'] - $u->rep['allnurep'])); ?> + ед. + + + + + + + + + + + + + + + + + + + + + +
Способность (еще rep['add_stats']) ?>)за rep['add_stats'] * 100); ?> ед. +
Умение (еще rep['add_skills']) ?>)за 10000 ед. +
Деньги (10 кр.)за 100 ед. +
Особенность (еще rep['add_skills2']) ?>)за 3000 ед. +
+
+ info['id'] . '" LIMIT 1000')); + if (isset($_GET['buy777']) && $chk[0] > 0) { + ?> +
+

info['id'].'" LIMIT 1000'); - while($chk_pl = mysql_fetch_array($chk_cl)) { - if(mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$chk_pl['id'].'" LIMIT 1')); - { - $x++; $prc += $chk_pl['price1']; - } - } - $u->info['money'] += $prc; - mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - echo 'Вы успешно сдали чеки в количестве '.$x.' шт. на сумму '.$prc.' кр.
'; - $chk[0] = 0; - ?> + $chk_cl = mysql_query('SELECT `u`.`id`,`m`.`price1` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `u`.`item_id` = `m`.`id` WHERE `m`.`type` = "61" AND `u`.`delete` = "0" AND `u`.`inOdet` = "0" AND `u`.`inShop` = "0" AND `u`.`inTransfer` = "0" AND `u`.`uid` = "' . $u->info['id'] . '" LIMIT 1000'); + while ($chk_pl = mysql_fetch_array($chk_cl)) { + if (mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $chk_pl['id'] . '" LIMIT 1')) ; + { + $x++; + $prc += $chk_pl['price1']; + } + } + $u->info['money'] += $prc; + mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + echo 'Вы успешно сдали чеки в количестве ' . $x . ' шт. на сумму ' . $prc . ' кр.
'; + $chk[0] = 0; + ?>

-
0) { - ?> - - -
- - $val){ - //if( $u->rep['rep'.$val] > 0 ) { - echo ' - - + 0) { + ?> + + +
+
Репутация в '.ucfirst(str_replace('city',' city',$val)).':'.$u->rep['rep'.$val].' ед.
+ $val) { + //if( $u->rep['rep'.$val] > 0 ) { + echo ' + + '; - //} - } - ?> -
Репутация в ' . ucfirst(str_replace('city', ' city', $val)) . ':' . $u->rep['rep' . $val] . ' ед.
- Текущая репутация: -
-
-info['dn']==0){ - ?> - - - - -
-
-
- Группа - Выберите пещеру:
-
- - (Ведутся работы)
- -
- -
- -
- - -
- - - -

- Комментарий - -
- Пароль - -
- -  
-
-
-
- info['id']){ - $psh_start = '  '; - } - echo '
+ //} + } + ?> + + Текущая репутация: + +
+ info['dn'] == 0) { + ?> + + + + +
+ +
+ Группа + Выберите пещеру: +
+
+ + (Ведутся работы)
+ +
+ +
+ +
+ + +
+ + + +
+
+ Комментарий + +
+ Пароль + +
+ +  
+
+ +
+ info['id']) { + $psh_start = '  '; + } + echo '
Группа - '.$psh_start.' + ' . $psh_start . '
'; - } - } - }else{ - echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: '.$u->timeOut(60*60*2-time()+$dungeon_timeout['time']).'
Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;)'; - if( $dungeon['id'] == 104 ) { - echo '
Вы можете посетить подземелье без ожидания: '; - } - } - } + } + } + } else { + echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: ' . $u->timeOut(60 * 60 * 2 - time() + $dungeon_timeout['time']) . '
Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;)'; + } + } } -?> + diff --git a/modules_data/location/objaga.php b/modules_data/location/objaga.php index d3542029..4360ebdd 100644 --- a/modules_data/location/objaga.php +++ b/modules_data/location/objaga.php @@ -1,886 +1,1088 @@ info['admin'] > 0){ - include 'room_hostel.php'; -}else { - -session_start(); -$_SESSION['objaga'] = 'load '; - -if( $u->info['admin'] > 0 ) { - $user_new_pers = true; -}else{ - $user_new_pers = false; +if (!defined('GAME')) { + die(); } +if ($u->info['admin'] > 0) { + include 'room_hostel.php'; +} else { -$objaga = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';")); + session_start(); + $_SESSION['objaga'] = 'load '; -$ar_lvl=0; -$sleep_mod=0; -$ar['base']=1; -$ar['advanced']=2; -$ar['advanced2']=3; -if($objaga){$test_arenda=1;$ar_lvl=$ar[$objaga['type']];}else{$test_arenda=0;} + if ($u->info['admin'] > 0) { + $user_new_pers = true; + } else { + $user_new_pers = false; + } + + $objaga = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';")); + + $ar_lvl = 0; + $sleep_mod = 0; + $ar['base'] = 1; + $ar['advanced'] = 2; + $ar['advanced2'] = 3; + if ($objaga) { + $test_arenda = 1; + $ar_lvl = $ar[$objaga['type']]; + } else { + $test_arenda = 0; + } #---пара проверок ;) -if(isset($objaga['id'])) { - $sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1',1); - if( $sleep[0] > 0 ) { - if( $u->info['room'] != 217 && $u->info['room'] != 218 && $u->info['room'] != 219 ) { - mysql_query('UPDATE `users` SET `room` = 217 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->info['room'] = 217; - } - } -} -if($u->info['clan']=='0'){$u->info['clan']='';} -if(!$objaga){$level=1;$nazv="Общежитие";}else{$level=2;$nazv="Общежитие"; - if(isset($_GET['obj_add'])){ - $u->obj_addItem($_GET['obj_add']); - }elseif(isset($_GET['obj_take'])){ - $u->obj_takeItem($_GET['obj_take']); - } -} -if($u->info['room']=='217' /*&& $objaga['type']=='base'*/){$level=3;$nazv="Общ. Этаж 1";}//else{$err = 'Вы ничего не арендуете на этом этаже

';$nazv="Общ. Этаж 1";} -if($u->info['room']=='218' /*&& $objaga['type']!='base'*/){$level=3;$nazv="Общ. Этаж 2";} -if($u->info['room']=='219' /*&& $objaga['type']!='base'*/){$level=3;$nazv="Общ. Этаж 3";} + if (isset($objaga['id'])) { + $sleep = $u->testAction('`vars` = "sleep" AND `uid` = "' . $u->info['id'] . '" LIMIT 1', 1); + if ($sleep[0] > 0) { + if ($u->info['room'] != 217 && $u->info['room'] != 218 && $u->info['room'] != 219) { + mysql_query('UPDATE `users` SET `room` = 217 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['room'] = 217; + } + } + } + if ($u->info['clan'] == '0') { + $u->info['clan'] = ''; + } + if (!$objaga) { + $level = 1; + $nazv = "Общежитие"; + } else { + $level = 2; + $nazv = "Общежитие"; + if (isset($_GET['obj_add'])) { + $u->obj_addItem($_GET['obj_add']); + } elseif (isset($_GET['obj_take'])) { + $u->obj_takeItem($_GET['obj_take']); + } + } + if ($u->info['room'] == '217' /*&& $objaga['type']=='base'*/) { + $level = 3; + $nazv = "Общ. Этаж 1"; + }//else{$err = 'Вы ничего не арендуете на этом этаже

';$nazv="Общ. Этаж 1";} + if ($u->info['room'] == '218' /*&& $objaga['type']!='base'*/) { + $level = 3; + $nazv = "Общ. Этаж 2"; + } + if ($u->info['room'] == '219' /*&& $objaga['type']!='base'*/) { + $level = 3; + $nazv = "Общ. Этаж 3"; + } #---аренда помещений -if($_GET['arenda']=="base") { - if($u->info['money']>=1) { - mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('".mysql_real_escape_string($u->info['id'])."','".mysql_real_escape_string($_GET['arenda'])."','".time()."','".(time()+604800)."','1','1')"); - mysql_query("UPDATE `users` SET `money` = `money`-1 WHERE `id` = '".mysql_real_escape_string($u->info['id'])."';"); - $level = 2; - $u->info['money']-=1; - $objaga['balance']=1; - $objaga['endtime']=time()+604800; - $err = "Вы арендовали 'Койку в общежитии' за 1 кр.

"; - $ar_lvl=1; - }else{ - $err = 'У вас недостаточно денег

'; - } -} -if($_GET['arenda']=="advanced") { - if($u->info['money']>=3) { - mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('".mysql_real_escape_string($u->info['id'])."','".mysql_real_escape_string($_GET['arenda'])."','".time()."','".(time()+604800)."','3','3')"); - mysql_query("UPDATE `users` SET `money` = `money`-3 WHERE `id` = '".mysql_real_escape_string($u->info['id'])."';"); - $level = 2; - $u->info['money']-=3; - $objaga['balance']=3; - $objaga['endtime']=time()+604800; - $err = "Вы арендовали 'Койку с тумбочкой' за 3 кр.

"; - $ar_lvl=2; - }else{ - $err = 'У вас недостаточно денег

'; - } -} -if($_GET['arenda']=="advanced2") { - if($u->info['money']>=10) { - mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('".mysql_real_escape_string($u->info['id'])."','".mysql_real_escape_string($_GET['arenda'])."','".time()."','".(time()+604800)."','10','10')"); - mysql_query("UPDATE `users` SET `money` = `money`-10 WHERE `id` = '".mysql_real_escape_string($u->info['id'])."';"); - $level = 2; - $u->info['money']-=10; - $objaga['balance']=10; - $objaga['endtime']=time()+604800; - $err = "Вы арендовали 'Койку со шкафом' за 10 кр.

"; - $ar_lvl=3; - }else{ - $err = 'У вас недостаточно денег

'; - } -} + if ($_GET['arenda'] == "base") { + if ($u->info['money'] >= 1) { + mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('" . mysql_real_escape_string($u->info['id']) . "','" . mysql_real_escape_string($_GET['arenda']) . "','" . time() . "','" . (time() + 604800) . "','1','1')"); + mysql_query("UPDATE `users` SET `money` = `money`-1 WHERE `id` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $level = 2; + $u->info['money'] -= 1; + $objaga['balance'] = 1; + $objaga['endtime'] = time() + 604800; + $err = "Вы арендовали 'Койку в общежитии' за 1 кр.

"; + $ar_lvl = 1; + } else { + $err = 'У вас недостаточно денег

'; + } + } + if ($_GET['arenda'] == "advanced") { + if ($u->info['money'] >= 3) { + mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('" . mysql_real_escape_string($u->info['id']) . "','" . mysql_real_escape_string($_GET['arenda']) . "','" . time() . "','" . (time() + 604800) . "','3','3')"); + mysql_query("UPDATE `users` SET `money` = `money`-3 WHERE `id` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $level = 2; + $u->info['money'] -= 3; + $objaga['balance'] = 3; + $objaga['endtime'] = time() + 604800; + $err = "Вы арендовали 'Койку с тумбочкой' за 3 кр.

"; + $ar_lvl = 2; + } else { + $err = 'У вас недостаточно денег

'; + } + } + if ($_GET['arenda'] == "advanced2") { + if ($u->info['money'] >= 10) { + mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('" . mysql_real_escape_string($u->info['id']) . "','" . mysql_real_escape_string($_GET['arenda']) . "','" . time() . "','" . (time() + 604800) . "','10','10')"); + mysql_query("UPDATE `users` SET `money` = `money`-10 WHERE `id` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $level = 2; + $u->info['money'] -= 10; + $objaga['balance'] = 10; + $objaga['endtime'] = time() + 604800; + $err = "Вы арендовали 'Койку со шкафом' за 10 кр.

"; + $ar_lvl = 3; + } else { + $err = 'У вас недостаточно денег

'; + } + } #---Сменить аренду -if($_GET['changelist']==1 && $objaga['id']>0) { -$level=4; -} -if($_GET['changearenda']=="base" && $objaga['id']>0) { - if($objaga['balance']>=2) { - $endtime = time() + (($objaga['balance']-1)/1)*604800; - //$endtime = time() + 604800; - mysql_query("UPDATE `house` SET `starttime` = ".time().", `endtime` = ".$endtime.", `type` = 'base', `weekcost` = '1' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Смена арендуемого помещения произведена успешно

'; - $objaga['type']="base"; - $objaga['endtime'] = $endtime; - }else{ - $cam = 2-$objaga['balance']; - $err = 'На балансе не хватает '.$cam.' кр. для смены арендуемого помещения

'; - } -} -if($_GET['changearenda']=="advanced" && $objaga['id']>0) { - if($objaga['balance']>=6) { - $endtime = time() + (($objaga['balance']-3)/3)*604800; - //$endtime = time() + 604800; - mysql_query("UPDATE `house` SET `starttime` = ".time().", `endtime` = ".$endtime.", `type` = 'advanced', `weekcost` = '3' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Смена арендуемого помещения произведена успешно

'; - $objaga['type']="advanced"; - $objaga['endtime'] = $endtime; - }else{ - $cam = 6-$objaga['balance']; - $err = 'На балансе не хватает '.$cam.' кр. для смены арендуемого помещения

'; - } -} -if($_GET['changearenda']=="advanced2" && $objaga['id']>0) { - if($objaga['balance']>=20) { - $endtime = time() + (($objaga['balance']-10)/10)*604800; - //$endtime = time() + 604800; - mysql_query("UPDATE `house` SET `starttime` = ".time().", `endtime` = ".$endtime.", `type` = 'advanced2', `weekcost` = '10' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Смена арендуемого помещения произведена успешно

'; - $objaga['type']="advanced2"; - $objaga['endtime'] = $endtime; - }else{ - $cam = 20-$objaga['balance']; - $err = 'На балансе не хватает '.$cam.' кр. для смены арендуемого помещения

'; - } -} + if ($_GET['changelist'] == 1 && $objaga['id'] > 0) { + $level = 4; + } + if ($_GET['changearenda'] == "base" && $objaga['id'] > 0) { + if ($objaga['balance'] >= 2) { + $endtime = time() + (($objaga['balance'] - 1) / 1) * 604800; + //$endtime = time() + 604800; + mysql_query("UPDATE `house` SET `starttime` = " . time() . ", `endtime` = " . $endtime . ", `type` = 'base', `weekcost` = '1' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Смена арендуемого помещения произведена успешно

'; + $objaga['type'] = "base"; + $objaga['endtime'] = $endtime; + } else { + $cam = 2 - $objaga['balance']; + $err = 'На балансе не хватает ' . $cam . ' кр. для смены арендуемого помещения

'; + } + } + if ($_GET['changearenda'] == "advanced" && $objaga['id'] > 0) { + if ($objaga['balance'] >= 6) { + $endtime = time() + (($objaga['balance'] - 3) / 3) * 604800; + //$endtime = time() + 604800; + mysql_query("UPDATE `house` SET `starttime` = " . time() . ", `endtime` = " . $endtime . ", `type` = 'advanced', `weekcost` = '3' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Смена арендуемого помещения произведена успешно

'; + $objaga['type'] = "advanced"; + $objaga['endtime'] = $endtime; + } else { + $cam = 6 - $objaga['balance']; + $err = 'На балансе не хватает ' . $cam . ' кр. для смены арендуемого помещения

'; + } + } + if ($_GET['changearenda'] == "advanced2" && $objaga['id'] > 0) { + if ($objaga['balance'] >= 20) { + $endtime = time() + (($objaga['balance'] - 10) / 10) * 604800; + //$endtime = time() + 604800; + mysql_query("UPDATE `house` SET `starttime` = " . time() . ", `endtime` = " . $endtime . ", `type` = 'advanced2', `weekcost` = '10' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Смена арендуемого помещения произведена успешно

'; + $objaga['type'] = "advanced2"; + $objaga['endtime'] = $endtime; + } else { + $cam = 20 - $objaga['balance']; + $err = 'На балансе не хватает ' . $cam . ' кр. для смены арендуемого помещения

'; + } + } #---возможности комнаты которую арендовали -if($objaga['type']=="base"){ - $name = "Койку в общежитии"; - $maxbox = "25"; - $max_p_box = "50"; -} -if($objaga['type']=="advanced"){ - $name = "Койку с тумбочкой"; - $maxbox = "40"; - $max_p_box = "150"; -} -if($objaga['type']=="advanced2"){ - $name = "Койку со шкафом"; - $maxbox = "70"; - $max_p_box = "200"; -} + if ($objaga['type'] == "base") { + $name = "Койку в общежитии"; + $maxbox = "25"; + $max_p_box = "50"; + } + if ($objaga['type'] == "advanced") { + $name = "Койку с тумбочкой"; + $maxbox = "40"; + $max_p_box = "150"; + } + if ($objaga['type'] == "advanced2") { + $name = "Койку со шкафом"; + $maxbox = "70"; + $max_p_box = "200"; + } -if(!isset($objaga['type']) && $u->info['room']!='214') { - $u->info['room'] = 214; - mysql_query('UPDATE `users` SET `room` = "'.$u->info['room'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - die('(Обновите экран)'); -} + if (!isset($objaga['type']) && $u->info['room'] != '214') { + $u->info['room'] = 214; + mysql_query('UPDATE `users` SET `room` = "' . $u->info['room'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + die('(Обновите экран)'); + } #---Прекращаем аренду -if($_GET['closearenda']==1) { - mysql_query("UPDATE `items_users` SET `inShop` = '0' WHERE `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `inShop` = '1';"); - mysql_query("DELETE FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Вы отказались арендовать "'.$name.'"

'; - $level=1; -} + if ($_GET['closearenda'] == 1) { + mysql_query("UPDATE `items_users` SET `inShop` = '0' WHERE `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `inShop` = '1';"); + mysql_query("DELETE FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Вы отказались арендовать "' . $name . '"

'; + $level = 1; + } #---Продлить аренду -if($_POST['payarenda']) { - if($_POST['payarenda']>=1) { - if($u->info['money']>0 && (int)$_POST['payarenda']>0 && ((int)$_POST['payarenda']<=$u->info['money'])) { - $paytime = ($_POST['payarenda']/$objaga['weekcost'])*604800; - mysql_query("UPDATE `house`,`users` SET `house`.`endtime` = `house`.`endtime`+'".$paytime."', `house`.`balance` = `house`.`balance`+'".mysql_real_escape_string($_POST['payarenda'])."',`users`.`money`=`users`.`money`-'".mysql_real_escape_string($_POST['payarenda'])."' WHERE `house`.`owner` = `users`.`id` AND `house`.`owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Вы положили на счет '.htmlspecialchars($_POST['payarenda'],NULL).'.00 кр.

'; - $u->info['money'] -=$_POST['payarenda']; - $objaga['balance'] +=$_POST['payarenda']; - $objaga['endtime'] += $paytime; - }else{ - $err = 'У вас недостаточно денег

'; - } - }else{ - $err = 'Минимальная сумма: 1кр.

'; - } -} + if ($_POST['payarenda']) { + if ($_POST['payarenda'] >= 1) { + if ($u->info['money'] > 0 && (int)$_POST['payarenda'] > 0 && ((int)$_POST['payarenda'] <= $u->info['money'])) { + $paytime = ($_POST['payarenda'] / $objaga['weekcost']) * 604800; + mysql_query("UPDATE `house`,`users` SET `house`.`endtime` = `house`.`endtime`+'" . $paytime . "', `house`.`balance` = `house`.`balance`+'" . mysql_real_escape_string($_POST['payarenda']) . "',`users`.`money`=`users`.`money`-'" . mysql_real_escape_string($_POST['payarenda']) . "' WHERE `house`.`owner` = `users`.`id` AND `house`.`owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Вы положили на счет ' . htmlspecialchars($_POST['payarenda'], null) . '.00 кр.

'; + $u->info['money'] -= $_POST['payarenda']; + $objaga['balance'] += $_POST['payarenda']; + $objaga['endtime'] += $paytime; + } else { + $err = 'У вас недостаточно денег

'; + } + } else { + $err = 'Минимальная сумма: 1кр.

'; + } + } #---обновляем баланс -$balance=round(($objaga['weekcost']*(floor(($objaga['endtime']-time())/24/3600)))/7, 2); -mysql_query("UPDATE `house` SET `balance` = '".$balance."' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); -$objaga['balance'] = $balance; + $balance = round(($objaga['weekcost'] * (floor(($objaga['endtime'] - time()) / 24 / 3600))) / 7, 2); + mysql_query("UPDATE `house` SET `balance` = '" . $balance . "' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $objaga['balance'] = $balance; #---Остаток аренды -if($objaga['id']>0) { - if(time()<$objaga['endtime']) { - $showdate = ''.date("d.m.y H:i",$objaga['endtime']).' (баланс '.$objaga['balance'].' кр.)'; - }else{ - $showdate = ''.date("d.m.y H:i",$objaga['endtime']).' (баланс '.$objaga['balance'].' кр.)'; - $level=2; - } -} + if ($objaga['id'] > 0) { + if (time() < $objaga['endtime']) { + $showdate = '' . date("d.m.y H:i", $objaga['endtime']) . ' (баланс ' . $objaga['balance'] . ' кр.)'; + } else { + $showdate = '' . date("d.m.y H:i", $objaga['endtime']) . ' (баланс ' . $objaga['balance'] . ' кр.)'; + $level = 2; + } + } #---Переключатель комнат - if(isset($sleep['id'])) {$_GET['room']=4;$sleep_mod=1;}#---Если спим, то никуда не выбратся - if(!$_GET['room'] and $test_arenda==1) {$_GET['room'] = 1;} #---Комната (если ничего не выбрано) - if($_GET['room']==1 and $test_arenda==1) {$room = 1;} #---Комната - if($_GET['room']==2 and $test_arenda==1) {$room = 2;} #---Сундук - if($_GET['room']==6 and $test_arenda==1) {$room = 6;} #---Сувениры - if($_GET['room']==3 and $test_arenda==1) {$room = 3;} #---Животные - if($_GET['room']==4 and $test_arenda==1) {$room = 4;} #---Сон - if($_GET['room']==7 and $test_arenda==1) {$room = 7;} #---Персонажи + if (isset($sleep['id'])) { + $_GET['room'] = 4; + $sleep_mod = 1; + }#---Если спим, то никуда не выбратся + if (!$_GET['room'] and $test_arenda == 1) { + $_GET['room'] = 1; + } #---Комната (если ничего не выбрано) + if ($_GET['room'] == 1 and $test_arenda == 1) { + $room = 1; + } #---Комната + if ($_GET['room'] == 2 and $test_arenda == 1) { + $room = 2; + } #---Сундук + if ($_GET['room'] == 6 and $test_arenda == 1) { + $room = 6; + } #---Сувениры + if ($_GET['room'] == 3 and $test_arenda == 1) { + $room = 3; + } #---Животные + if ($_GET['room'] == 4 and $test_arenda == 1) { + $room = 4; + } #---Сон + if ($_GET['room'] == 7 and $test_arenda == 1) { + $room = 7; + } #---Персонажи #---Записи -if($_POST['savenotes']) { - $_POST['notes'] = str_replace(" \\n","\n",$_POST['notes']); - $simbolcount = strlen($_POST['notes']); - if($simbolcount>10000) { - $err = "Слишком много текста... такое не сохранить.

"; - }else{ - mysql_query("UPDATE `house` SET `notes` = '".mysql_real_escape_string($_POST['notes'])."' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $objaga['notes'] = $_POST['notes']; - $err = "Сохранено (".$simbolcount.")

"; - } -} + if ($_POST['savenotes']) { + $_POST['notes'] = str_replace(" \\n", "\n", $_POST['notes']); + $simbolcount = strlen($_POST['notes']); + if ($simbolcount > 10000) { + $err = "Слишком много текста... такое не сохранить.

"; + } else { + mysql_query("UPDATE `house` SET `notes` = '" . mysql_real_escape_string($_POST['notes']) . "' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $objaga['notes'] = $_POST['notes']; + $err = "Сохранено (" . $simbolcount . ")

"; + } + } #---Сон -if(isset($_GET['to_sleep']) && $sleep['vars'] != 'sleep'){ - mysql_query("UPDATE `eff_users` SET `sleeptime`=".time().",`deactiveLast` = ( `deactiveTime` - ".time()." ) WHERE `uid`='".mysql_real_escape_string($u->info['id'])."' AND `no_Ace` = 0 AND `delete` = 0"); - mysql_query('UPDATE `items_users` SET `time_sleep` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - $u->addAction(time(),'sleep',$u->info['city']); - $sleep['vars']='sleep'; - $sleep_mod=1; -}elseif(isset($_GET['to_awake']) && $sleep['vars'] == 'sleep'){ + if (isset($_GET['to_sleep']) && $sleep['vars'] != 'sleep') { + mysql_query("UPDATE `eff_users` SET `sleeptime`=" . time() . ",`deactiveLast` = ( `deactiveTime` - " . time() . " ) WHERE `uid`='" . mysql_real_escape_string($u->info['id']) . "' AND `no_Ace` = 0 AND `delete` = 0"); + mysql_query('UPDATE `items_users` SET `time_sleep` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); + $u->addAction(time(), 'sleep', $u->info['city']); + $sleep['vars'] = 'sleep'; + $sleep_mod = 1; + } elseif (isset($_GET['to_awake']) && $sleep['vars'] == 'sleep') { - $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "'.$u->info['id'].'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - while( $pl = mysql_fetch_array($sp) ) { - $tm_add = time() - $pl['time_sleep']; - mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "'.($pl['time_create'] + $tm_add).'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } + $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); + while ($pl = mysql_fetch_array($sp)) { + $tm_add = time() - $pl['time_sleep']; + mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "' . ($pl['time_create'] + $tm_add) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } - $sp = mysql_query('SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "'.$u->info['id'].'" ORDER BY `timeUse` DESC'); - while($pl = mysql_fetch_array($sp)) { - //$timeUsen=$pl['deactiveTime']+(time()-$pl['sleeptime']); - mysql_query("UPDATE `eff_users` SET `deactiveTime` = ".(time()+$pl['deactiveLast'])." WHERE `id`='".$pl['id']."' "); - } + $sp = mysql_query('SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "' . $u->info['id'] . '" ORDER BY `timeUse` DESC'); + while ($pl = mysql_fetch_array($sp)) { + //$timeUsen=$pl['deactiveTime']+(time()-$pl['sleeptime']); + mysql_query("UPDATE `eff_users` SET `deactiveTime` = " . (time() + $pl['deactiveLast']) . " WHERE `id`='" . $pl['id'] . "' "); + } - $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="'.mysql_real_escape_string($u->info['id']).'" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); - while($pl = mysql_fetch_array($sp)) { - $timeUsen=time()-($pl['sleeptime']-$pl['timeUse']); - mysql_query("UPDATE `eff_users` SET `timeUse`='".$timeUsen."',`sleeptime`='0',`delete`='0' WHERE `id`='".$pl['id']."' "); - } - - //mysql_query("UPDATE `eff_users` SET `timeUse`=(".time()."-`sleeptime`),`sleeptime`='' WHERE `uid`='".mysql_real_escape_string($u->info['id'])."' AND `id_eff`>=1 AND `id_eff`<=28 AND `id_eff`!=2 AND `id_eff`!=3 AND `id_eff`!=4 AND `id_eff`!=5 AND `id_eff`!=6 AND `id_eff`!=24 AND `sleeptime`>0"); - mysql_query('UPDATE `actions` SET `vars` = "unsleep" WHERE `id` = "'.$sleep['id'].'" LIMIT 1'); - $sleep['vars']='unsleep'; - $sleep_mod=0; -} + $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="' . mysql_real_escape_string($u->info['id']) . '" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); + while ($pl = mysql_fetch_array($sp)) { + $timeUsen = time() - ($pl['sleeptime'] - $pl['timeUse']); + mysql_query("UPDATE `eff_users` SET `timeUse`='" . $timeUsen . "',`sleeptime`='0',`delete`='0' WHERE `id`='" . $pl['id'] . "' "); + } + + //mysql_query("UPDATE `eff_users` SET `timeUse`=(".time()."-`sleeptime`),`sleeptime`='' WHERE `uid`='".mysql_real_escape_string($u->info['id'])."' AND `id_eff`>=1 AND `id_eff`<=28 AND `id_eff`!=2 AND `id_eff`!=3 AND `id_eff`!=4 AND `id_eff`!=5 AND `id_eff`!=6 AND `id_eff`!=24 AND `sleeptime`>0"); + mysql_query('UPDATE `actions` SET `vars` = "unsleep" WHERE `id` = "' . $sleep['id'] . '" LIMIT 1'); + $sleep['vars'] = 'unsleep'; + $sleep_mod = 0; + } #---Животные -/*if($_GET['pet_id']<0) { - $id = str_replace("-", "",$_GET['pet_id']); - $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."'")); - if(!$cageid) {$petcage=1;}else{ - $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."'")); - if(!$cageid) { - $petcage=2; - }else{ - $petcage=0; - } - } - if( $petcage > 0 ) { - mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '".$petcage."' WHERE `pet_in_cage` = '0' AND `id` = '".mysql_real_escape_string($id)."'"); - mysql_query("UPDATE `users` SET `animal` = '0' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); - }else{ - $err = 'Все слоты зверя заняты!

'; - } -} -if($_GET['pet_id']>0) { - if($u->info['animal']==0) { - mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '0' WHERE (`pet_in_cage` = '1' OR `pet_in_cage` = '2') AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); - mysql_query("UPDATE `users` SET `animal` = '".mysql_real_escape_string($_GET['pet_id'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); - }else{ - $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `id` = '".mysql_real_escape_string($id)."'")); - mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '".$cageid['pet_in_cage']."' WHERE `pet_in_cage` = '0' AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); - mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '0' WHERE (`pet_in_cage` = '1' OR `pet_in_cage` = '2') AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); - mysql_query("UPDATE `users` SET `animal` = '".mysql_real_escape_string($_GET['pet_id'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); - //$err = 'У Вас уже есть зверь ;)

'; - } -}*/ -$pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); -if( $pet['id'] != $u->info['animal'] ) { - $u->info['animal'] = $pet['id']; - mysql_query('UPDATE `users` SET `animal` = "'.$pet['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); -} -if( isset($_GET['pet_id']) ) { - $id = (int)$_GET['pet_id']; - if( $_GET['pet_id'] < 0 ) { - $id = -$id; - //Помещаем зверя в общагу - $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `id` = '".mysql_real_escape_string($id)."' LIMIT 1")); - if( isset($cageid['id']) ) { - $cageid1 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1")); - if( isset($cageid1['id']) ) { - $cageid2 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1")); - if( isset($cageid2['id']) ) { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid2['id'].'" LIMIT 1'); - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - }else{ - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "1" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - $err = 'Вы успешно поместили "'.$cageid['name'].'" в общежитие!

'; - }else{ - $err = 'Зверь не найден в инвентаре!

'; - } - }else{ - //Забираем зверя из общаги - $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` > '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `id` = '".mysql_real_escape_string($id)."' LIMIT 1")); - if( isset($cageid['id']) ) { - if( $u->info['animal'] > 0 ) { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "'.$cageid['pet_in_cage'].'" WHERE `id` = "'.$u->info['animal'].'" LIMIT 1'); - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - }else{ - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - $err = 'Вы успешно забрали "'.$cageid['name'].'" из общежитие!

'; - }else{ - $err = 'Зверь не найден в общежитии!

'; - } - } -} -$pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); -if( $pet['id'] != $u->info['animal'] ) { - mysql_query('UPDATE `users` SET `animal` = "'.$pet['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); -} -$cage1 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); -$cage2 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); + /*if($_GET['pet_id']<0) { + $id = str_replace("-", "",$_GET['pet_id']); + $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."'")); + if(!$cageid) {$petcage=1;}else{ + $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."'")); + if(!$cageid) { + $petcage=2; + }else{ + $petcage=0; + } + } + if( $petcage > 0 ) { + mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '".$petcage."' WHERE `pet_in_cage` = '0' AND `id` = '".mysql_real_escape_string($id)."'"); + mysql_query("UPDATE `users` SET `animal` = '0' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); + }else{ + $err = 'Все слоты зверя заняты!

'; + } + } + if($_GET['pet_id']>0) { + if($u->info['animal']==0) { + mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '0' WHERE (`pet_in_cage` = '1' OR `pet_in_cage` = '2') AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); + mysql_query("UPDATE `users` SET `animal` = '".mysql_real_escape_string($_GET['pet_id'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); + }else{ + $cageid = mysql_fetch_array(mysql_query("SELECT `pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `id` = '".mysql_real_escape_string($id)."'")); + mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '".$cageid['pet_in_cage']."' WHERE `pet_in_cage` = '0' AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); + mysql_query("UPDATE `users_animal` SET `pet_in_cage` = '0' WHERE (`pet_in_cage` = '1' OR `pet_in_cage` = '2') AND `id` = '".mysql_real_escape_string($_GET['pet_id'])."'"); + mysql_query("UPDATE `users` SET `animal` = '".mysql_real_escape_string($_GET['pet_id'])."' WHERE `id` = '".mysql_real_escape_string($u->info['id'])."'"); + //$err = 'У Вас уже есть зверь ;)

'; + } + }*/ + $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + if ($pet['id'] != $u->info['animal']) { + $u->info['animal'] = $pet['id']; + mysql_query('UPDATE `users` SET `animal` = "' . $pet['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + if (isset($_GET['pet_id'])) { + $id = (int)$_GET['pet_id']; + if ($_GET['pet_id'] < 0) { + $id = -$id; + //Помещаем зверя в общагу + $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1")); + if (isset($cageid['id'])) { + $cageid1 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' LIMIT 1")); + if (isset($cageid1['id'])) { + $cageid2 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' LIMIT 1")); + if (isset($cageid2['id'])) { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid2['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "1" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + $err = 'Вы успешно поместили "' . $cageid['name'] . '" в общежитие!

'; + } else { + $err = 'Зверь не найден в инвентаре!

'; + } + } else { + //Забираем зверя из общаги + $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` > '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1")); + if (isset($cageid['id'])) { + if ($u->info['animal'] > 0) { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "' . $cageid['pet_in_cage'] . '" WHERE `id` = "' . $u->info['animal'] . '" LIMIT 1'); + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + $err = 'Вы успешно забрали "' . $cageid['name'] . '" из общежитие!

'; + } else { + $err = 'Зверь не найден в общежитии!

'; + } + } + } + $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + if ($pet['id'] != $u->info['animal']) { + mysql_query('UPDATE `users` SET `animal` = "' . $pet['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + $cage1 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + $cage2 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); #------------------ #---Спим/бодрствуем - if($sleep['vars']=='sleep'){ - $div = "
"; - $status = "спите"; - $link = "awake"; - $button = "Проснуться"; - $div1 = "
"; - }else{ - $status = "бодрствуете"; - $link = "sleep"; - $button = "Уснуть"; - } + if ($sleep['vars'] == 'sleep') { + $div = "
"; + $status = "спите"; + $link = "awake"; + $button = "Проснуться"; + $div1 = "
"; + } else { + $status = "бодрствуете"; + $link = "sleep"; + $button = "Уснуть"; + } #---Переходы по комнатам -if($objaga['type']=="base" && $_GET['loc']=='1.180.0.218') { -$err = "У вас нет на это прав.

"; -} + if ($objaga['type'] == "base" && $_GET['loc'] == '1.180.0.218') { + $err = "У вас нет на это прав.

"; + } -if( isset($_GET['changearenda']) ) { - header('location: main.php'); - die(); -} + if (isset($_GET['changearenda'])) { + header('location: main.php'); + die(); + } -?> - - - - - -
-error!=''){ echo ''.$u->error.'
'; } ?> -
- - -
      
- - - - -
 Правила: Нет нападениям. Нет телепортации. Нет передаче предметов. Нет использованию магии и распитию эликсиров.
Комендант

-Арендовать Койку в общежитии
-Цена: 1 кр. + 1 кр. в неделю.
+ ?> + + + + + +
+ error != '') { + echo '' . $u->error . '
'; + } ?> + + + Сменить помещение + '; + } + ?> + -
+ + + + + + +
     +   +
+ + + + + + + + +
 Правила: Нет нападениям. Нет телепортации. Нет передаче предметов. Нет использованию магии и распитию эликсиров.
Комендант

+ Арендовать Койку в общежитии
+ Цена: 1 кр. + 1 кр. в неделю.
- • Размер сундука: 25 вещей
-• Сувениры: 50 шт.
- • Койка
-Арендовать Арендовать за zuby(5,1)?> + • Размер сундука: 25 вещей
+ • Сувениры: 50 шт.
+ • Койка
+ Арендовать -
-Арендовать Койку с тумбочкой
-Цена: 3 кр. + 3 кр. в неделю.
+
+ Арендовать Койку с тумбочкой
+ Цена: 3 кр. + 3 кр. в неделю.
- • Размер сундука: 40 вещей
-• Сувениры: 150 шт.
- • Койка
+ • Размер сундука: 40 вещей
+ • Сувениры: 150 шт.
+ • Койка
-Арендовать Арендовать за zuby(15,1)?> + Арендовать -
+
-Арендовать Койку со шкафом
-Цена: 10 кр. + 10 кр. в неделю.
+ Арендовать Койку со шкафом
+ Цена: 10 кр. + 10 кр. в неделю.
- • Размер сундука: 70 вещей
-• Сувениры: 200 шт.
- • Мест для животных: 2
- • Койка
+ • Размер сундука: 70 вещей
+ • Сувениры: 200 шт.
+ • Мест для животных: 2
+ • Койка
-Арендовать Арендовать за zuby(50,1)?> + Арендовать -
- - - -
Правила: Нет нападениям. Нет телепортации. Нет передаче предметов. Нет использованию магии и распитию эликсиров.
Комендант

+
+ + + + + + + +
Правила: Нет нападениям. Нет телепортации. Нет передаче предметов. Нет использованию магии и распитию эликсиров.
Комендант

-Вы арендовали
-Начало аренды:
-Оплачено до:
-Цена в неделю: кр.
+ Вы арендовали
+ Начало аренды:
+ Оплачено до:
+ Цена в неделю: кр.
- • Размер сундука: вещей
- • Сувениры: шт.
-';}?> - • Койка
+  • Размер сундука: вещей
+  • Сувениры: шт.
+ '; + } ?> +  • Койка
+ +
+ Прекратить аренду
+ + При отмене аренды, все вещи из сундука переносятся в ваш инвентарь.
+ Ваши животные передаются вам. Если у вас уже есть другое животное, то выпускаются на волю.
+ Остаток средств не возвращается.
+ Если вы должны оплатить аренду, то ваш долг удваивается и вы не сможете воспользоваться арендой, пока не оплатите долг.
+
+ Сменить аренду
+ + Для смены аренды на вашем балансе должна быть необходимая сумма.
+ Смена аренды, оплаченной зубами на кредитную аренду запрещена.
+ Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.
+
+ + Вы находитесь в своей комнате. Первое, что вы видите - записная книжка.
+ Вы можете оставить нужные вам записи общим объемом не более 10000 символов. +
+ + + -Прекратить аренду
- -При отмене аренды, все вещи из сундука переносятся в ваш инвентарь.
-Ваши животные передаются вам. Если у вас уже есть другое животное, то выпускаются на волю.
-Остаток средств не возвращается.
-Если вы должны оплатить аренду, то ваш долг удваивается и вы не сможете воспользоваться арендой, пока не оплатите долг.
-
-Сменить аренду
- -Для смены аренды на вашем балансе должна быть необходимая сумма.
-Смена аренды, оплаченной зубами на кредитную аренду запрещена.
-Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.
-
- -Вы находитесь в своей комнате. Первое, что вы видите - записная книжка.
-Вы можете оставить нужные вам записи общим объемом не более 10000 символов. -
- - -info['admin'] > 0 ) { // для админа - - $chest = $u->genInv(7,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); - $invertory = $u->genInv(8,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); -?> - - Сундук: / , передач: info['transfers']?>

- - - - - - - - - -
 В сундуке В рюкзаке
id="chest_null"> ПУСТО
id="invertory_null"> ПУСТО
-genInv(10,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); - ?> -Сувениры: / , передач: info['transfers']?>

- - - - -
 На сохраненииВ рюкзаке
- -genInv(10,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); -if($itmAll[0]==0) -{ - echo ''; -}else{ - echo $itmAll[2]; -} -?> -
ПУСТО
-
- -genInv(9,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); -if($itmAll[0]==0) -{ - echo ''; -}else{ - echo $itmAll[2]; -} -?> -
ПУСТО
-
- + $chest = $u->genInv(7, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); + $invertory = $u->genInv(8, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); + ?> + + Сундук: / , передач: info['transfers'] ?>

+ + + + + + + + + +
 В сундуке В рюкзаке
+
id="chest_null"> ПУСТО +
+ + +
+
+
id="invertory_null"> ПУСТО +
+ + +
+
+ + genInv(10, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); + ?> + Сувениры: / , передач: info['transfers'] ?>

+ + + + + + + + +
 На сохраненииВ рюкзаке
+ + genInv(10, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); + if ($itmAll[0] == 0) { + echo ''; + } else { + echo $itmAll[2]; + } + ?> +
ПУСТО
+
+ + genInv(9, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); + if ($itmAll[0] == 0) { + echo ''; + } else { + echo $itmAll[2]; + } + ?> +
ПУСТО
+
+ + +

Работа с персонажами

+ info['id'] . '" AND `twink` = "' . $u->info['twink'] . '" LIMIT 1')); + if (!isset($p_now['id'])) { + mysql_query('INSERT INTO `users_twink` ( `uid`,`twink`,`login`,`level`,`exp`,`upLevel`,`stats`,`time`,`ability`,`skills`,`sskills`,`nskills`,`priems`,`obraz`,`win`,`lose`,`nich` ) VALUES ( - "'.$u->info['id'].'","0","'.$u->info['login'].'","'.$u->info['level'].'", - "'.$u->info['exp'].'","'.$u->info['upLevel'].'","'.$u->info['stats'].'","'.time.'", - "'.$u->info['ability'].'","'.$u->info['skills'].'","'.$u->info['sskills'].'","'.$u->info['nskills'].'","'.$u->info['priems'].'", - "'.$u->info['obraz'].'","'.$u->info['win'].'","'.$u->info['lose'].'","'.$u->info['nich'].'" + "' . $u->info['id'] . '","0","' . $u->info['login'] . '","' . $u->info['level'] . '", + "' . $u->info['exp'] . '","' . $u->info['upLevel'] . '","' . $u->info['stats'] . '","' . time . '", + "' . $u->info['ability'] . '","' . $u->info['skills'] . '","' . $u->info['sskills'] . '","' . $u->info['nskills'] . '","' . $u->info['priems'] . '", + "' . $u->info['obraz'] . '","' . $u->info['win'] . '","' . $u->info['lose'] . '","' . $u->info['nich'] . '" ) '); - $p_now = mysql_fetch_array(mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "'.$u->info['id'].'" AND `twink` = "'.$u->info['twink'].'" LIMIT 1')); -}else{ - //Обновляем текущие данные - $p_now['login'] = $u->info['login']; - $p_now['level'] = $u->info['level']; - $p_now['exp'] = $u->info['exp']; - $p_now['upLevel'] = $u->info['upLevel']; - $p_now['stats'] = $u->info['stats']; - $p_now['time'] = time(); - $p_now['ability'] = $u->info['ability']; - $p_now['skills'] = $u->info['skills']; - $p_now['sskills'] = $u->info['sskills']; - $p_now['nskills'] = $u->info['nskills']; - $p_now['priems'] = $u->info['priems']; - $p_now['obraz'] = $u->info['obraz']; - $p_now['win'] = $u->info['win']; - $p_now['lose'] = $u->info['lose']; - $p_now['nich'] = $u->info['nich']; - $p_now['stopexp'] = $u->info['stopexp']; - mysql_query('UPDATE `users_twink` SET - `login` = "'.$u->info['login'].'", - `level` = "'.$u->info['level'].'", - `exp` = "'.$u->info['exp'].'", - `upLevel` = "'.$u->info['upLevel'].'", - `stats` = "'.$u->info['stats'].'", - `time` = "'.$u->info['time'].'", - `ability` = "'.$u->info['ability'].'", - `skills` = "'.$u->info['skills'].'", - `sskills` = "'.$u->info['sskills'].'", - `nskills` = "'.$u->info['nskills'].'", - `priems` = "'.$u->info['priems'].'", - `obraz` = "'.$u->info['obraz'].'", - `win` = "'.$u->info['win'].'", - `lose` = "'.$u->info['lose'].'", - `nich` = "'.$u->info['nich'].'", - `stopexp` = "'.$u->info['stopexp'].'" - WHERE `id` = "'.$p_now['id'].'" LIMIT 1'); -} -if(isset($_GET['change_pers'])) { - $p_sel = mysql_fetch_array(mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['change_pers']).'" LIMIT 1')); - if(isset($p_sel['id']) && $p_sel['id'] != $p_now['id']) { - //Заходим на персонажа - mysql_query('UPDATE `users` SET - `level` = "'.$p_sel['level'].'", - `obraz` = "'.$p_sel['obraz'].'", - `twink` = "'.$p_sel['twink'].'", - `win` = "'.$p_sel['win'].'", - `lose` = "'.$p_sel['lose'].'", - `nich` = "'.$p_sel['nich'].'", - `stopexp` = "'.$p_sel['stopexp'].'" - WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET - `upLevel` = "'.$p_sel['upLevel'].'", - `stats` = "'.$p_sel['stats'].'", - `ability` = "'.$p_sel['ability'].'", - `skills` = "'.$p_sel['skills'].'", - `sskills` = "'.$p_sel['sskills'].'", - `nskills` = "'.$p_sel['nskills'].'", - `priems` = "'.$p_sel['priems'].'", - `exp` = "'.$p_sel['exp'].'" - WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - if( $p_sel['twink'] > 0 ) { - //Возвращаем предметы с основного персонажа - mysql_query('UPDATE `items_users` SET `uid` = "-91'.$u->info['id'].'" WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `uid` = "'.$u->info['id'].'" WHERE `uid` = "-92'.$u->info['id'].'" LIMIT 1'); - }else{ - //Возвращаем вещи с твинка - mysql_query('UPDATE `items_users` SET `uid` = "-92'.$u->info['id'].'" WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `uid` = "'.$u->info['id'].'" WHERE `uid` = "-91'.$u->info['id'].'" LIMIT 1'); - } - // - mysql_query('UPDATE `items_users` SET `uid` = "'.$u->info['id'].'" WHERE (`uid` = "-91'.$u->info['id'].'" OR `uid` = "-92'.$u->info['id'].'") AND `inShop` = 1'); - if( $u->info['admin'] > 0 ) { - die('UPDATE `items_users` SET `uid` = "'.$u->info['id'].'" WHERE (`uid` = "-91'.$u->info['id'].'" OR `uid` = "-92'.$u->info['id'].'") AND `inShop` = 1'); - } - // - die(''); - }else{ - echo 'Персонаж не может быть выбран
'; - } -}elseif(isset($_GET['add_new_chars']) && $user_new_pers == true ) { - $p_count = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users_twink` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1')); - $p_count = $p_count[0]; - if( $p_count > 9 ) { - echo 'Вы не можете создавать более десяти персонажей
'; - }else{ - mysql_query('INSERT INTO `users_twink` ( + $p_now = mysql_fetch_array(mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "' . $u->info['id'] . '" AND `twink` = "' . $u->info['twink'] . '" LIMIT 1')); + } else { + //Обновляем текущие данные + $p_now['login'] = $u->info['login']; + $p_now['level'] = $u->info['level']; + $p_now['exp'] = $u->info['exp']; + $p_now['upLevel'] = $u->info['upLevel']; + $p_now['stats'] = $u->info['stats']; + $p_now['time'] = time(); + $p_now['ability'] = $u->info['ability']; + $p_now['skills'] = $u->info['skills']; + $p_now['sskills'] = $u->info['sskills']; + $p_now['nskills'] = $u->info['nskills']; + $p_now['priems'] = $u->info['priems']; + $p_now['obraz'] = $u->info['obraz']; + $p_now['win'] = $u->info['win']; + $p_now['lose'] = $u->info['lose']; + $p_now['nich'] = $u->info['nich']; + $p_now['stopexp'] = $u->info['stopexp']; + mysql_query('UPDATE `users_twink` SET + `login` = "' . $u->info['login'] . '", + `level` = "' . $u->info['level'] . '", + `exp` = "' . $u->info['exp'] . '", + `upLevel` = "' . $u->info['upLevel'] . '", + `stats` = "' . $u->info['stats'] . '", + `time` = "' . $u->info['time'] . '", + `ability` = "' . $u->info['ability'] . '", + `skills` = "' . $u->info['skills'] . '", + `sskills` = "' . $u->info['sskills'] . '", + `nskills` = "' . $u->info['nskills'] . '", + `priems` = "' . $u->info['priems'] . '", + `obraz` = "' . $u->info['obraz'] . '", + `win` = "' . $u->info['win'] . '", + `lose` = "' . $u->info['lose'] . '", + `nich` = "' . $u->info['nich'] . '", + `stopexp` = "' . $u->info['stopexp'] . '" + WHERE `id` = "' . $p_now['id'] . '" LIMIT 1'); + } + if (isset($_GET['change_pers'])) { + $p_sel = mysql_fetch_array(mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string($_GET['change_pers']) . '" LIMIT 1')); + if (isset($p_sel['id']) && $p_sel['id'] != $p_now['id']) { + //Заходим на персонажа + mysql_query('UPDATE `users` SET + `level` = "' . $p_sel['level'] . '", + `obraz` = "' . $p_sel['obraz'] . '", + `twink` = "' . $p_sel['twink'] . '", + `win` = "' . $p_sel['win'] . '", + `lose` = "' . $p_sel['lose'] . '", + `nich` = "' . $p_sel['nich'] . '", + `stopexp` = "' . $p_sel['stopexp'] . '" + WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + // + mysql_query('UPDATE `stats` SET + `upLevel` = "' . $p_sel['upLevel'] . '", + `stats` = "' . $p_sel['stats'] . '", + `ability` = "' . $p_sel['ability'] . '", + `skills` = "' . $p_sel['skills'] . '", + `sskills` = "' . $p_sel['sskills'] . '", + `nskills` = "' . $p_sel['nskills'] . '", + `priems` = "' . $p_sel['priems'] . '", + `exp` = "' . $p_sel['exp'] . '" + WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + // + if ($p_sel['twink'] > 0) { + //Возвращаем предметы с основного персонажа + mysql_query('UPDATE `items_users` SET `uid` = "-91' . $u->info['id'] . '" WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '" WHERE `uid` = "-92' . $u->info['id'] . '" LIMIT 1'); + } else { + //Возвращаем вещи с твинка + mysql_query('UPDATE `items_users` SET `uid` = "-92' . $u->info['id'] . '" WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '" WHERE `uid` = "-91' . $u->info['id'] . '" LIMIT 1'); + } + // + mysql_query('UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '" WHERE (`uid` = "-91' . $u->info['id'] . '" OR `uid` = "-92' . $u->info['id'] . '") AND `inShop` = 1'); + if ($u->info['admin'] > 0) { + die('UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '" WHERE (`uid` = "-91' . $u->info['id'] . '" OR `uid` = "-92' . $u->info['id'] . '") AND `inShop` = 1'); + } + // + die(''); + } else { + echo 'Персонаж не может быть выбран
'; + } + } elseif (isset($_GET['add_new_chars']) && $user_new_pers == true) { + $p_count = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users_twink` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1')); + $p_count = $p_count[0]; + if ($p_count > 9) { + echo 'Вы не можете создавать более десяти персонажей
'; + } else { + mysql_query('INSERT INTO `users_twink` ( `uid`,`twink`,`login`,`level`,`exp`,`upLevel`,`stats`,`time`,`ability`,`skills`,`sskills`,`nskills`,`priems`,`obraz`,`stopexp` ) VALUES ( - "'.$u->info['id'].'","'.$p_count.'","'.$u->info['login'].'","4", - "2500","22","s1=3|s2=3|s3=3|s4=7|rinv=40|m9=5|m6=10","'.time.'", + "' . $u->info['id'] . '","' . $p_count . '","' . $u->info['login'] . '","4", + "2500","22","s1=3|s2=3|s3=3|s4=7|rinv=40|m9=5|m6=10","' . time . '", "34","5","4","5","0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0", "0.gif","0" ) '); - } -} -$sp = mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "'.$u->info['id'].'"'); -$r = ''; -while( $pl = mysql_fetch_array($sp) ) { - if( $pl['id'] != $p_now['id'] ) { - $r .= ''; - } - $r .= '
'; - $r .= '
'.$pl['login'].' ['.$pl['level'].']
'; - $r .= '
'; - if( $pl['id'] != $p_now['id'] ) { - $r .= '
'; - } -} -if( $user_new_pers == true ) { - $r .= '
'; - $r .= ''; - $r .= '
'; -} -echo $r; -?> + } + } + $sp = mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "' . $u->info['id'] . '"'); + $r = ''; + while ($pl = mysql_fetch_array($sp)) { + if ($pl['id'] != $p_now['id']) { + $r .= ''; + } + $r .= '
'; + $r .= '
' . $pl['login'] . ' [' . $pl['level'] . ']
'; + $r .= '
'; + if ($pl['id'] != $p_now['id']) { + $r .= '
'; + } + } + if ($user_new_pers == true) { + $r .= '
'; + $r .= ''; + $r .= '
'; + } + echo $r; + ?> - - - +
+ + + + + +
- -'.$cage1['name'].' ['.$cage1['level'].'] -'; -}else{ -echo' - - +
свободно
+ + ' . $cage1['name'] . ' [' . $cage1['level'] . '] +'; + } else { + echo ' -'.$cage2['name'].' ['.$cage2['level'].'] -'; -}else{ -echo' + ' . $cage2['name'] . ' [' . $cage2['level'] . '] +'; + } else { + echo ' -
свободно
'; -} -?>
свободно
+ } + ?> +
свободно
'; -} -?>
-
  -свободно + } + ?> +
+
  + свободно '; -}else{ -echo''.$pet['name'].' ['.$pet['level'].'] -'; -}?> - -
- -Вы можете заснуть, забыв о внешнем мире.
-Во время сна все временные эффекты на вас приостанавливаются. Это касается как, например, эликсиров, так и травм.
-Сон не влияет на состояние предметов с ограниченным сроком существования

- -Состояние: Вы
-Во время сна нельзя перемещаться.
'; -} -?> -
- - - -Вы можете сменить арендуемое помещение:

- -Для смены аренды на вашем балансе должна быть необходимая сумма.
-Смена аренды, оплаченной зубами на кредитную аренду запрещена.
-Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.
-
- -
-Арендовать Койку в общежитии
-Цена: 1 кр. + 1 кр. в неделю.
+ } else { + echo '' . $pet['name'] . ' [' . $pet['level'] . '] +'; + } ?> + +
+ + Вы можете заснуть, забыв о внешнем мире.
+ Во время сна все временные эффекты на вас приостанавливаются. Это касается как, например, эликсиров, так и травм.
+ Сон не влияет на состояние предметов с ограниченным сроком существования

+ + Состояние: Вы
+ Во время сна нельзя перемещаться.
'; + } + ?> +
+ + + + Вы можете сменить арендуемое помещение:

+ + Для смены аренды на вашем балансе должна быть необходимая сумма.
+ Смена аренды, оплаченной зубами на кредитную аренду запрещена.
+ Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.
+
+ +
+ Арендовать Койку в общежитии
+ Цена: 1 кр. + 1 кр. в неделю.
- • Размер сундука: 25 вещей
-• Сувениры: 50 шт.
- • Койка
- -Сменить помещение - -
-Арендовать Койку с тумбочкой
-Цена: 3 кр. + 3 кр. в неделю.
+ • Размер сундука: 25 вещей
+ • Сувениры: 50 шт.
+ • Койка
- • Размер сундука: 40 вещей
-• Сувениры: 150 шт.
- • Койка
+ Сменить помещение + +
+ Арендовать Койку с тумбочкой
+ Цена: 3 кр. + 3 кр. в неделю.
+ + • Размер сундука: 40 вещей
+ • Сувениры: 150 шт.
+ • Койка
-Сменить помещение - -
-Арендовать Койку со шкафом
-Цена: 10 кр. + 10 кр. в неделю.
+ Сменить помещение + +
+ Арендовать Койку со шкафом
+ Цена: 10 кр. + 10 кр. в неделю.
- • Размер сундука: 70 вещей
-• Сувениры: 200 шт.
- • Мест для животных: 2
- • Койка
+ • Размер сундука: 70 вещей
+ • Сувениры: 200 шт.
+ • Мест для животных: 2
+ • Койка
-Сменить помещение -'; -} -?> -
- + + +
  - - - + +
+ + + + - + + +
  + + + - -
- - - + + + - - - - -
- -info['room'] == 214 && $sleep_mod == 0) { ?> - - - - -=1){?> - - - - - -info['room']=='217' and $ar_lvl>=1 and $sleep_mod==0) { ?> - - - - -info['room']=='217' and $ar_lvl>=2 and $sleep_mod==0){ -?> - - - - - -info['room']=='218' and $ar_lvl>=2 and $sleep_mod==0){?> - - - - -info['room']=='218' and $ar_lvl>=3 and $sleep_mod==0){ -?> - - - - -info['room']=='219' and $ar_lvl>=3 and !isset($sleep['id'])){ -?> - - - - - -
Страшилкина Улица
Общ. Этаж 1
Общежитие
Общ. Этаж 2
Общ. Этаж 1
Общ. Этаж 3
Общ. Этаж 2
-
- -
- - -
- -Деньги: info['money'];?> кр.

-info['room']=="214"){?> -Аренда - +
+ + info['room'] == 214 && $sleep_mod == 0) { ?> + + + + + = 1) { + ?> + + + + + + info['room'] == '217' and $ar_lvl >= 1 and $sleep_mod == 0) { ?> + + + + + info['room'] == '217' and $ar_lvl >= 2 and $sleep_mod == 0) { + ?> + + + + + + info['room'] == '218' and $ar_lvl >= 2 and $sleep_mod == 0) { ?> + + + + + info['room'] == '218' and $ar_lvl >= 3 and $sleep_mod == 0) { + ?> + + + + + info['room'] == '219' and $ar_lvl >= 3 and !isset($sleep['id'])) { + ?> + + + + + +
Страшилкина Улица
Общ. Этаж 1
Общежитие
Общ. Этаж 2
Общ. Этаж 1
Общ. Этаж 3
Общ. Этаж 2
+
+ +
+ + +
+ + Деньги: info['money']; ?> кр.

+ info['room'] == "214") { ?> + Аренда + 'Комната',2=>'Сундук',3=>'Сувениры',4=>'Животные',5=>'Сон'); - if($_GET['room']!=1){echo"Комната";}else{echo"Комната";}?>
-Сундук";}else{echo"Сундук";}?>
-Сувениры";}else{echo"Сувениры";}?>
-Персонажи";}else{echo"Персонажи";}?>
-Животные
";}else{echo"Животные
";} -}?> -Сон";}else{echo"Сон";}?> - -Комната"; + } else { + echo "Комната"; + } ?>
+ Сундук"; + } else { + echo "Сундук"; + } ?>
+ Сувениры"; + } else { + echo "Сувениры"; + } ?>
+ Персонажи"; + } else { + echo "Персонажи"; + } ?>
+ Животные
"; + } else { + echo "Животные
"; + } + } ?> + Сон"; + } else { + echo "Сон"; + } ?> + + \ No newline at end of file diff --git a/modules_data/location/remont.php b/modules_data/location/remont.php index 2c304fcb..b87cc30e 100644 --- a/modules_data/location/remont.php +++ b/modules_data/location/remont.php @@ -599,87 +599,6 @@ if (isset($_GET['upgrade']) && true == false) { } else { $re2 = 'Предмет подходящий для ремонта не найден в инвентаре'; } -} elseif (isset($_GET['remonz'])) { - $t = 1; - if ($_GET['t'] == 2) { - $t = 2; - } elseif ($_GET['t'] == 3) { - $t = 3; - } - $ir = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`iznosNOW` >= 1 AND `iu`.`id` = "' . mysql_real_escape_string((int)$_GET['remonz']) . '" LIMIT 1')); - - $rem_price = round($ir['price1'] * 0.1 / 100, 2);//цена ремонта за 1ед поломки - $rem_all = round($ir['price1'] * $ir['iznosNOW'] * 0.1 / 100, 2);//цена ремонта full - if ($rem_price < 0.01) { - $rem_price = 0.01; - } //кэп поможет - - if (isset($ir['id'])) { - $po = Conversion::dataStringToArray($ir['data']); - if (isset($po['noremont'])) { - $re2 = 'Предмет не подлежит ремонту в этой мастерской.'; - } else { - - if ($ir['1price'] > 0) { - $po['zazuby'] = $ir['1price']; - } else { - $po['zazuby'] = $ir['price1']; - } - $po['nosale'] = 1; - - if ($t == 1) { - $rem_cell = $rem_price; - $t = 0; - $rm = 1; - $re2 .= ' 1 ед.'; - } elseif ($t == 2) { - $t = 0; - $rm = 10; - $rem_cell = $rem_price * 10; - $re2 .= ' 10 ед.'; - } elseif ($t == 3) { - $rem_cell = $rem_all; - $t = 0; - $rm = $ir['iznosNOW']; - $re2 .= $rm . ' ед.'; - } - if ($rem_cell > $u->info['money4']) { - $re2 = 'У вас недостаточно зубов для ремонта.'; - } else { - if ($rm > $ir['iznosNOW']) { - $rm = $ir['iznosNOW']; - } - $ir['iznosNOW'] -= $rm; - if ($ir['iznosNOW'] < 0) { - $ir['iznosNOW'] = 0; - } - $u->info['money4'] -= $rem_cell; - $upd = mysql_query('UPDATE `users` SET `money4` = "' . $u->info['money4'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - if ($upd) { - $il = $ir['iznosMAX']; - if (rand(0, 100) <= 25) { - $ir['iznosMAX'] -= 1; - } - if ($ir['iznosMAX'] < 1) { - $ir['iznosMAX'] = 1; - } - $po = Conversion::arrayToDataString($po); - mysql_query('UPDATE `items_users` SET `data` = "' . $po . '",`iznosNOW` = "' . $ir['iznosNOW'] . '",`iznosMAX` = "' . $ir['iznosMAX'] . '" WHERE `id` = "' . $ir['id'] . '" LIMIT 1'); - $re2 = 'Удачно произведен ремонт ' . $re2 . ' предмета "' . $ir['name'] . '" за ' . $u->zuby($rem_cell, 1) . '.'; - $dop = 0; - if (ceil($il) > ceil($ir['iznosMAX'])) { - $re2 .= '
К сожалению, максимальная долговечность предмета из-за ремонта уменьшилась.'; - $dop = 1; - } - $u->addDelo(2, $u->info['id'], '"System.remont": Предмет "' . $ir['name'] . '" [itm:' . $ir['id'] . '] был отремонтирован, максимальная долговечность уменьшилась: ' . $dop . ' (' . $rm . ' ед. за ' . $t . ' зубов.).', time(), $u->info['city'], 'System.remont', 0, 0); - } else { - $re2 = 'Что-то здесь не так...'; - } - } - } - } else { - $re2 = 'Предмет подходящий для ремонта не найден в инвентаре'; - } } elseif (isset($_GET['upgradelvl'])) { $ir = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . mysql_real_escape_string((int)$_GET['upgradelvl']) . '" LIMIT 1')); if (isset($ir['id'])) { diff --git a/modules_data/location/room_hostel.php b/modules_data/location/room_hostel.php index 2b250dd8..b7717809 100644 --- a/modules_data/location/room_hostel.php +++ b/modules_data/location/room_hostel.php @@ -1,326 +1,327 @@ array( - 'type' => 999, - 'room' => 214 - ), - 'none' => array( - 'type' => 0, - 'room' => 214, - 'name' => 'Общежитие', - 'stage' => 'холл', - 'price' => 0, - 'partition' => '' - ), - 'base' => array( - 'type' => 1, - 't_name' => 'Койка в общежитии', - 't_names' => 'Койку в общежитии', - 'room' => 217, - 'name' => 'Общ. Этаж 1', - 'stage' => 'на 1 этаже', - 'price' => 1, - 'tariff' => array('items'=>25, 'souvenirs'=>50, 'animal'=>0), - 'partition' => array(1=>'Комната',2=>'Хранилище',4=>'Сон') - ), - 'advanced' => array( - 'type' => 2, - 't_name' => 'Койка с тумбочкой', - 't_names' => 'Койку с тумбочкой', - 'room' => 218, - 'name' => 'Общ. Этаж 2', - 'stage' => 'на 2 этаже', - 'price' => 3, - 'tariff' => array('items'=>50, 'souvenirs'=>150, 'animal'=>0), - 'partition' => array(1=>'Комната',2=>'Хранилище',4=>'Сон') - ), - 'advanced2' => array( - 'type' => 3, - 't_name' => 'Койка со шкафом', - 't_names' => 'Койку со шкафом', - 'room' => 219, - 'name' => 'Общ. Этаж 3', - 'stage' => 'на 3 этаже', - 'price' => 10, - 'tariff' => array('items'=>70, 'souvenirs'=>200, 'animal'=>2), - 'partition' => array(1=>'Комната',2=>'Хранилище',4=>'Сон') - ) -); -$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1', 1); +$hostel_option = [ + 'changelist' => [ + 'type' => 999, + 'room' => 214, + ], + 'none' => [ + 'type' => 0, + 'room' => 214, + 'name' => 'Общежитие', + 'stage' => 'холл', + 'price' => 0, + 'partition' => '', + ], + 'base' => [ + 'type' => 1, + 't_name' => 'Койка в общежитии', + 't_names' => 'Койку в общежитии', + 'room' => 217, + 'name' => 'Общ. Этаж 1', + 'stage' => 'на 1 этаже', + 'price' => 1, + 'tariff' => ['items' => 25, 'souvenirs' => 50, 'animal' => 0], + 'partition' => [1 => 'Комната', 2 => 'Хранилище', 4 => 'Сон'], + ], + 'advanced' => [ + 'type' => 2, + 't_name' => 'Койка с тумбочкой', + 't_names' => 'Койку с тумбочкой', + 'room' => 218, + 'name' => 'Общ. Этаж 2', + 'stage' => 'на 2 этаже', + 'price' => 3, + 'tariff' => ['items' => 50, 'souvenirs' => 150, 'animal' => 0], + 'partition' => [1 => 'Комната', 2 => 'Хранилище', 4 => 'Сон'], + ], + 'advanced2' => [ + 'type' => 3, + 't_name' => 'Койка со шкафом', + 't_names' => 'Койку со шкафом', + 'room' => 219, + 'name' => 'Общ. Этаж 3', + 'stage' => 'на 3 этаже', + 'price' => 10, + 'tariff' => ['items' => 70, 'souvenirs' => 200, 'animal' => 2], + 'partition' => [1 => 'Комната', 2 => 'Хранилище', 4 => 'Сон'], + ], +]; +$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "' . $u->info['id'] . '" LIMIT 1', 1); -if( isset($sleep) AND $sleep[0]==0 AND ( isset($_GET['ajaxHostel']) AND $_GET['ajaxHostel'] == 1 OR isset($_GET['ajax']) AND $_GET['ajax'] == 1) ){ - $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';")); +if (isset($sleep) and $sleep[0] == 0 and (isset($_GET['ajaxHostel']) and $_GET['ajaxHostel'] == 1 or isset($_GET['ajax']) and $_GET['ajax'] == 1)) { + $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';")); - if($hostel['partition'] == 2){ - if( isset($_GET['obj_add']) ){ - if($hostel['category'] == 1){ - $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); - $max = $hostel_option[$hostel['type']]['tariff']['items']; - } elseif( $hostel['category'] == 2) { - $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); - $max = $hostel_option[$hostel['type']]['tariff']['souvenirs']; - } - if( (int)$count < (int)$max ) { - $u->obj_addItem($_GET['obj_add']); - } else { - exit('error'); - } - }elseif(isset($_GET['obj_take'])){ - $u->obj_takeItem($_GET['obj_take']); - } - } - die('ajaxHostel'); -} elseif( isset($sleep) AND $sleep[0]==0 AND isset($_GET['room']) AND $_GET['room'] !='' AND (int)$_GET['room']>0 AND (int)$_GET['room']<10 AND !isset($_GET['to_sleep']) AND !isset($_GET['to_awake']) ){ - mysql_query('UPDATE `house` SET `partition` = "'.mysql_real_escape_string((int)$_GET['room']).'" WHERE `owner` = "'.mysql_real_escape_string($u->info['id']).'" LIMIT 1'); -} elseif( isset($sleep) AND $sleep[0]==0 AND isset($_GET['category']) AND $_GET['category'] !='' AND (int)$_GET['category']>0 AND (int)$_GET['category']<10 ){ - mysql_query('UPDATE `house` SET `category` = "'.mysql_real_escape_string((int)$_GET['category']).'" WHERE `owner` = "'.mysql_real_escape_string($u->info['id']).'" LIMIT 1'); -} elseif( isset($_GET['to_sleep']) && $_GET['to_sleep'] == '1' && $sleep['vars'] != 'sleep' ){ - changeSleep(1); -} elseif( isset($_GET['to_awake']) && $sleep['vars'] == 'sleep' ){ - changeSleep(2); + if ($hostel['partition'] == 2) { + if (isset($_GET['obj_add'])) { + if ($hostel['category'] == 1) { + $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); + $max = $hostel_option[$hostel['type']]['tariff']['items']; + } elseif ($hostel['category'] == 2) { + $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); + $max = $hostel_option[$hostel['type']]['tariff']['souvenirs']; + } + if ((int)$count < (int)$max) { + $u->obj_addItem($_GET['obj_add']); + } else { + exit('error'); + } + } elseif (isset($_GET['obj_take'])) { + $u->obj_takeItem($_GET['obj_take']); + } + } + die('ajaxHostel'); +} elseif (isset($sleep) and $sleep[0] == 0 and isset($_GET['room']) and $_GET['room'] != '' and (int)$_GET['room'] > 0 and (int)$_GET['room'] < 10 and !isset($_GET['to_sleep']) and !isset($_GET['to_awake'])) { + mysql_query('UPDATE `house` SET `partition` = "' . mysql_real_escape_string((int)$_GET['room']) . '" WHERE `owner` = "' . mysql_real_escape_string($u->info['id']) . '" LIMIT 1'); +} elseif (isset($sleep) and $sleep[0] == 0 and isset($_GET['category']) and $_GET['category'] != '' and (int)$_GET['category'] > 0 and (int)$_GET['category'] < 10) { + mysql_query('UPDATE `house` SET `category` = "' . mysql_real_escape_string((int)$_GET['category']) . '" WHERE `owner` = "' . mysql_real_escape_string($u->info['id']) . '" LIMIT 1'); +} elseif (isset($_GET['to_sleep']) && $_GET['to_sleep'] == '1' && $sleep['vars'] != 'sleep') { + changeSleep(1); +} elseif (isset($_GET['to_awake']) && $sleep['vars'] == 'sleep') { + changeSleep(2); } -if( isset($sleep_mod) and !isset($sleep['id'])){ - $sleep_mod = 0; -} elseif( isset($sleep_mod) and isset($sleep['id'])){ - $sleep_mod = 1; +if (isset($sleep_mod) and !isset($sleep['id'])) { + $sleep_mod = 0; +} elseif (isset($sleep_mod) and isset($sleep['id'])) { + $sleep_mod = 1; } -$hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';")); -if( $sleep['vars'] == 'sleep' AND isset($hostel) && $hostel_option[$hostel['type']]['room'] != $u->room['id'] && $u->room['id'] != 214 ) changeSleep(2); // Если человек спит в неположенном месте, просыпаемся!!! -if( isset($_POST['savenotes']) AND $hostel['partition'] == '1' ) { - saveNote(); +$hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';")); +if ($sleep['vars'] == 'sleep' and isset($hostel) && $hostel_option[$hostel['type']]['room'] != $u->room['id'] && $u->room['id'] != 214) changeSleep(2); // Если человек спит в неположенном месте, просыпаемся!!! +if (isset($_POST['savenotes']) and $hostel['partition'] == '1') { + saveNote(); } -if( isset($hostel) ) { #---обновляем баланс - $hostel['balance'] = round(($hostel['weekcost']*(floor(($hostel['endtime']-time())/24/3600)))/7, 2); - mysql_query("UPDATE `house` SET `balance` = '".$hostel['balance']."' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); +if (isset($hostel)) { #---обновляем баланс + $hostel['balance'] = round(($hostel['weekcost'] * (floor(($hostel['endtime'] - time()) / 24 / 3600))) / 7, 2); + mysql_query("UPDATE `house` SET `balance` = '" . $hostel['balance'] . "' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); } -$result = array('filter'=>'', 'content'=>'', 'additional'=>''); +$result = ['filter' => '', 'content' => '', 'additional' => '']; -function updateHostel(){ - global $hostel, $hostel_option,$u, $err; - if( $hostel['action'] == 'changearenda' ){ - if($hostel['balance'] >= ($hostel_option[$_GET['changearenda']]['price']*2) ) { - $endtime = time() + (($hostel['balance']-$hostel_option[$_GET['changearenda']]['price'])/$hostel_option[$_GET['changearenda']]['price'])*604800; - mysql_query("UPDATE `house` SET `starttime` = ".time().", `endtime` = ".$endtime.", `type` = '".mysql_real_escape_string($_GET['changearenda'])."', `weekcost` = '".$hostel_option[mysql_real_escape_string($_GET['changearenda'])]['price']."' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Смена арендуемого помещения произведена успешно'; - $hostel['type']=$_GET['changearenda']; - $hostel['endtime'] = $endtime; - }else{ - $err = 'На балансе не хватает '.( ($hostel_option[$_GET['changearenda']]['price']*2)-$hostel['balance'] ).' кр. для смены арендуемого помещения'; - } - unset($hostel['action']); - } elseif( $hostel['action'] == 'newarenda' ){ - if(isset($_GET['azb']) && $u->info['level'] > 7 ) { - $err = 'Вы не можете расплачиваться зубами, у вас слишком высокий уровень

'; - }elseif($u->info['money4'] < $hostel_option[$_GET['arenda']]['price']*5 && isset($_GET['azb'])) { - $err = 'У вас недостаточно зубов

'; - }elseif($u->info['money']>=$hostel_option[$_GET['arenda']]['price'] || isset($_GET['azb'])) { - mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('".mysql_real_escape_string($u->info['id'])."','".mysql_real_escape_string($_GET['arenda'])."','".time()."','".(time()+604800)."','".$hostel_option[$_GET['arenda']]['price']."','".$hostel_option[$_GET['arenda']]['price']."')"); - if(isset($_GET['azb'])) { - mysql_query("UPDATE `users` SET `money4` = `money4`-".($hostel_option[$_GET['arenda']]['price']*5)." WHERE `id` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = "Вы арендовали '".$hostel_option[$_GET['arenda']]['t_names']."' за ".$u->zuby($hostel_option[$_GET['arenda']]['price']*5,1).".

"; - }else{ - mysql_query("UPDATE `users` SET `money` = `money`-".$hostel_option[$_GET['arenda']]['price']." WHERE `id` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = "Вы арендовали '".$hostel_option[$_GET['arenda']]['t_names']."' за ".$hostel_option[$_GET['arenda']]['price']." кр.

"; - } - }else{ - if(isset($_GET['azb'])) { - $err = 'У вас недостаточно зубов

'; - }else{ - $err = 'У вас недостаточно денег

'; - } - } - $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';")); - } -} -function changeSleep($sleep_action){ - global $hostel, $hostel_option, $u, $sleep, $sleep_mod; - if( $sleep_action == 1 ){ - // - mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("'.$u->info['id'].'","'.time().'","1")'); - // - mysql_query("UPDATE `eff_users` SET `sleeptime`=".time().",`deactiveLast` = ( `deactiveTime` - ".time()." ) WHERE `uid`='".mysql_real_escape_string($u->info['id'])."' AND `no_Ace` = 0 AND `delete` = 0"); - mysql_query('UPDATE `items_users` SET `time_sleep` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - $u->addAction(time(),'sleep',$u->info['city']); - $sleep['vars']='sleep'; - $sleep_mod=1; - } elseif( $sleep_action == 2 ){ - // - mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("'.$u->info['id'].'","'.time().'","2")'); - // - ini_set('display_errors','on'); - $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "'.$u->info['id'].'" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); - while( $pl = mysql_fetch_array($sp) ) { - $tm_add = time() - $pl['time_sleep']; - mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "'.($pl['time_create'] + $tm_add).'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - } - $sp = mysql_query('SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "'.$u->info['id'].'" ORDER BY `timeUse` DESC'); - while($pl = mysql_fetch_array($sp)) { - mysql_query("UPDATE `eff_users` SET `deactiveTime` = ".(time()+$pl['deactiveLast'])." WHERE `id`='".$pl['id']."' "); - } - $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="'.mysql_real_escape_string($u->info['id']).'" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); - while($pl = mysql_fetch_array($sp)) { - $timeUsen = time()-($pl['sleeptime']-$pl['timeUse']); - mysql_query("UPDATE `eff_users` SET `timeUse`='".$timeUsen."',`sleeptime`='0' WHERE `id`='".$pl['id']."' "); - } - mysql_query('UPDATE `actions` SET `vars` = "unsleep",`val` = "'.time().'" WHERE `id` = "'.$sleep['id'].'" LIMIT 1'); - $sleep['vars']='unsleep'; - $sleep_mod=0; - ini_set('display_errors','Off'); - } - $sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1', 1); +function updateHostel() +{ + global $hostel, $hostel_option, $u, $err; + if ($hostel['action'] == 'changearenda') { + if ($hostel['balance'] >= ($hostel_option[$_GET['changearenda']]['price'] * 2)) { + $endtime = time() + (($hostel['balance'] - $hostel_option[$_GET['changearenda']]['price']) / $hostel_option[$_GET['changearenda']]['price']) * 604800; + mysql_query("UPDATE `house` SET `starttime` = " . time() . ", `endtime` = " . $endtime . ", `type` = '" . mysql_real_escape_string($_GET['changearenda']) . "', `weekcost` = '" . $hostel_option[mysql_real_escape_string($_GET['changearenda'])]['price'] . "' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Смена арендуемого помещения произведена успешно'; + $hostel['type'] = $_GET['changearenda']; + $hostel['endtime'] = $endtime; + } else { + $err = 'На балансе не хватает ' . (($hostel_option[$_GET['changearenda']]['price'] * 2) - $hostel['balance']) . ' кр. для смены арендуемого помещения'; + } + unset($hostel['action']); + } elseif ($hostel['action'] == 'newarenda') { + if (isset($_GET['azb']) && $u->info['level'] > 7) { + $err = 'Вы не можете расплачиваться зубами, у вас слишком высокий уровень

'; + } elseif ($u->info['money4'] < $hostel_option[$_GET['arenda']]['price'] * 5 && isset($_GET['azb'])) { + $err = 'У вас недостаточно зубов

'; + } elseif ($u->info['money'] >= $hostel_option[$_GET['arenda']]['price'] || isset($_GET['azb'])) { + mysql_query("INSERT INTO `house`(`owner`,`type`,`starttime`,`endtime`,`balance`,`weekcost`) VALUES ('" . mysql_real_escape_string($u->info['id']) . "','" . mysql_real_escape_string($_GET['arenda']) . "','" . time() . "','" . (time() + 604800) . "','" . $hostel_option[$_GET['arenda']]['price'] . "','" . $hostel_option[$_GET['arenda']]['price'] . "')"); + mysql_query("UPDATE `users` SET `money` = `money`-" . $hostel_option[$_GET['arenda']]['price'] . " WHERE `id` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = "Вы арендовали '" . $hostel_option[$_GET['arenda']]['t_names'] . "' за " . $hostel_option[$_GET['arenda']]['price'] . " кр.

"; + } else { + $err = 'У вас недостаточно денег

'; + } + $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';")); + } } -function changePets(){ - global $hostel, $hostel_option, $u, $cage1, $cage2, $pet; - $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); - if( $pet['id'] != $u->info['animal'] ) { - $u->info['animal'] = $pet['id']; - mysql_query('UPDATE `users` SET `animal` = "'.$pet['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - if( isset($_GET['pet_id']) ) { - $id = (int)$_GET['pet_id']; - if( $_GET['pet_id'] < 0 ) { - $id = -$id; - //Помещаем зверя в общагу - $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `id` = '".mysql_real_escape_string($id)."' LIMIT 1")); - if( isset($cageid['id']) ) { - $cageid1 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1")); - if( isset($cageid1['id']) ) { - $cageid2 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1")); - if( isset($cageid2['id']) ) { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid2['id'].'" LIMIT 1'); - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } else { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - } else { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "1" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - $u->error = 'Вы успешно поместили "'.$cageid['name'].'" в общежития!'; - } else { - $u->error = 'Зверь не найден в инвентаре!'; - } - } else { - //Забираем зверя из общаги - $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` > '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `id` = '".mysql_real_escape_string($id)."' LIMIT 1")); - if( isset($cageid['id']) ) { - if( $u->info['animal'] > 0 ) { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "'.$cageid['pet_in_cage'].'" WHERE `id` = "'.$u->info['animal'].'" LIMIT 1'); - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } else { - mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "'.$cageid['id'].'" LIMIT 1'); - } - $u->error = 'Вы успешно забрали "'.$cageid['name'].'" из общежития!'; - } else { - $u->error = 'Зверь не найден в общежитии!'; - } - } - } - $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); - if( $pet['id'] != $u->info['animal'] ) { - mysql_query('UPDATE `users` SET `animal` = "'.$pet['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - $cage1 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); - $cage2 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `delete` = 0 LIMIT 1;")); - return array('pet' => $pet, 'cage1' => $cage1, 'cage2' => $cage2); +function changeSleep($sleep_action) +{ + global $hostel, $hostel_option, $u, $sleep, $sleep_mod; + if ($sleep_action == 1) { + // + mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $u->info['id'] . '","' . time() . '","1")'); + // + mysql_query("UPDATE `eff_users` SET `sleeptime`=" . time() . ",`deactiveLast` = ( `deactiveTime` - " . time() . " ) WHERE `uid`='" . mysql_real_escape_string($u->info['id']) . "' AND `no_Ace` = 0 AND `delete` = 0"); + mysql_query('UPDATE `items_users` SET `time_sleep` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); + $u->addAction(time(), 'sleep', $u->info['city']); + $sleep['vars'] = 'sleep'; + $sleep_mod = 1; + } elseif ($sleep_action == 2) { + // + mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $u->info['id'] . '","' . time() . '","2")'); + // + ini_set('display_errors', 'on'); + $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); + while ($pl = mysql_fetch_array($sp)) { + $tm_add = time() - $pl['time_sleep']; + mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "' . ($pl['time_create'] + $tm_add) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); + } + $sp = mysql_query('SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "' . $u->info['id'] . '" ORDER BY `timeUse` DESC'); + while ($pl = mysql_fetch_array($sp)) { + mysql_query("UPDATE `eff_users` SET `deactiveTime` = " . (time() + $pl['deactiveLast']) . " WHERE `id`='" . $pl['id'] . "' "); + } + $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="' . mysql_real_escape_string($u->info['id']) . '" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); + while ($pl = mysql_fetch_array($sp)) { + $timeUsen = time() - ($pl['sleeptime'] - $pl['timeUse']); + mysql_query("UPDATE `eff_users` SET `timeUse`='" . $timeUsen . "',`sleeptime`='0' WHERE `id`='" . $pl['id'] . "' "); + } + mysql_query('UPDATE `actions` SET `vars` = "unsleep",`val` = "' . time() . '" WHERE `id` = "' . $sleep['id'] . '" LIMIT 1'); + $sleep['vars'] = 'unsleep'; + $sleep_mod = 0; + ini_set('display_errors', 'Off'); + } + $sleep = $u->testAction('`vars` = "sleep" AND `uid` = "' . $u->info['id'] . '" LIMIT 1', 1); } -function saveNote() { - global $hostel, $hostel_option, $u; - $_POST['notes'] = str_replace(" \\n","\n",$_POST['notes']); - $simbolcount = strlen($_POST['notes']); - if($simbolcount>10000) { - $err = "Слишком много текста... такое не сохранить.

"; - } else { - mysql_query("UPDATE `house` SET `notes` = '".mysql_real_escape_string($_POST['notes'])."' WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $hostel['notes'] = $_POST['notes']; - $err = "Сохранено (".$simbolcount.")

"; - } - $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';")); +function changePets() +{ + global $hostel, $hostel_option, $u, $cage1, $cage2, $pet; + $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + if ($pet['id'] != $u->info['animal']) { + $u->info['animal'] = $pet['id']; + mysql_query('UPDATE `users` SET `animal` = "' . $pet['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + if (isset($_GET['pet_id'])) { + $id = (int)$_GET['pet_id']; + if ($_GET['pet_id'] < 0) { + $id = -$id; + //Помещаем зверя в общагу + $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1")); + if (isset($cageid['id'])) { + $cageid1 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' LIMIT 1")); + if (isset($cageid1['id'])) { + $cageid2 = mysql_fetch_array(mysql_query("SELECT `id` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' LIMIT 1")); + if (isset($cageid2['id'])) { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid2['id'] . '" LIMIT 1'); + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "2" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "1" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + $u->error = 'Вы успешно поместили "' . $cageid['name'] . '" в общежития!'; + } else { + $u->error = 'Зверь не найден в инвентаре!'; + } + } else { + //Забираем зверя из общаги + $cageid = mysql_fetch_array(mysql_query("SELECT `id`,`name`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` > '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1")); + if (isset($cageid['id'])) { + if ($u->info['animal'] > 0) { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "' . $cageid['pet_in_cage'] . '" WHERE `id` = "' . $u->info['animal'] . '" LIMIT 1'); + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } else { + mysql_query('UPDATE `users_animal` SET `pet_in_cage` = "0" WHERE `id` = "' . $cageid['id'] . '" LIMIT 1'); + } + $u->error = 'Вы успешно забрали "' . $cageid['name'] . '" из общежития!'; + } else { + $u->error = 'Зверь не найден в общежитии!'; + } + } + } + $pet = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz` FROM `users_animal` WHERE `pet_in_cage` = '0' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + if ($pet['id'] != $u->info['animal']) { + mysql_query('UPDATE `users` SET `animal` = "' . $pet['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + } + $cage1 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '1' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + $cage2 = mysql_fetch_array(mysql_query("SELECT `id`, `sex`, `name`, `level`, `obraz`,`pet_in_cage` FROM `users_animal` WHERE `pet_in_cage` = '2' AND `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `delete` = 0 LIMIT 1;")); + return ['pet' => $pet, 'cage1' => $cage1, 'cage2' => $cage2]; } -function hostel($id){ - global $hostel, $hostel_option, $u, $err; - $filter = ' +function saveNote() +{ + global $hostel, $hostel_option, $u; + $_POST['notes'] = str_replace(" \\n", "\n", $_POST['notes']); + $simbolcount = strlen($_POST['notes']); + if ($simbolcount > 10000) { + $err = "Слишком много текста... такое не сохранить.

"; + } else { + mysql_query("UPDATE `house` SET `notes` = '" . mysql_real_escape_string($_POST['notes']) . "' WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $hostel['notes'] = $_POST['notes']; + $err = "Сохранено (" . $simbolcount . ")

"; + } + $hostel = mysql_fetch_array(mysql_query("SELECT * FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';")); +} + +function hostel($id) +{ + global $hostel, $hostel_option, $u, $err; + $filter = '
 Правила: Нет нападениям. Нет телепортации. Нет передаче предметов. Нет использованию магии и распитию эликсиров.
Комендант
'; - $content = ''; - $additional = ''; - - if($hostel['action'] == 'changelist'){ # смена аренды - $content = "Вы можете сменить арендуемое помещение:

Для смены аренды на вашем балансе должна быть необходимая сумма.
Смена аренды, оплаченной зубами на кредитную аренду запрещена.
Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.

".( $hostel['type'] != "base" ? "
Арендовать Койку в общежитии
Цена: 1 кр. + 1 кр. в неделю.

• Размер сундука: 25 вещей
• Сувениры: 50 шт.
• Койка

info['id']."\" onClick=\"return confirm('Вы уверены, что хотите заплатить 1 кр. за смену помещения?')\">Сменить помещение" : '').( $hostel['type'] != "advanced" ? "
Арендовать Койку с тумбочкой
Цена: 3 кр. + 3 кр. в неделю.

• Размер сундука: 40 вещей
• Сувениры: 150 шт.
• Койка

info['id']."\" onClick=\"return confirm('Вы уверены, что хотите заплатить 3 кр. за смену помещения?')\">Сменить помещение" : '').( $hostel['type'] != "advanced2" ? "
Арендовать Койку со шкафом
Цена: 10 кр. + 10 кр. в неделю.

• Размер сундука: 70 вещей
• Сувениры: 200 шт.
• Койка

info['id']."\" onClick=\"return confirm('Вы уверены, что хотите заплатить 10 кр. за смену помещения?')\">Сменить помещение" : '').'
 '; - } elseif($id == 0){ # новая аренда - $content = '
Койка в общежитии
Цена: 1 кр. + 1 кр. в неделю.

• Размер сундука: 25 вещей
• Сувениры: 50 шт.
• Койка

Арендовать'.$azuby[0].'

Койка с тумбочкой
Цена: 3 кр. + 3 кр. в неделю.

• Размер сундука: 40 вещей
• Сувениры: 150 шт.
• Койка

Арендовать'.$azuby[1].'

Койка со шкафом
Цена: 10 кр. + 10 кр. в неделю.

• Размер сундука: 70 вещей
• Сувениры: 200 шт.
• Койка

Арендовать'.$azuby[2].'
'; - } else { # текущее состояние аренды - $content = "Вы арендовали «".$hostel_option[$hostel['type']]['t_name']."» ".$hostel_option[$hostel['type']]['stage']."
Начало аренды: ".date('d.m.y H:i',$hostel['starttime'])."
Оплачено до: ".date("d.m.y H:i",$hostel['endtime']).' (баланс '.$hostel['balance'].' кр.)'." - ',0, '')\" style=\"cursor:pointer\">"; - - if( $u->info['level'] < 8 ) { - $content .= "   Оплатить за зубы (Цена в неделю: ".$u->zuby($hostel['weekcost']*5,1)."): ',0, '')\" style=\"cursor:pointer\">"; - } - - $content .= "
Цена в неделю: ".$hostel['weekcost']." кр.
 • Размер сундука: ".$hostel_option[$hostel['type']]['tariff']['items']." вещей
 • Сувениры: ".$hostel_option[$hostel['type']]['tariff']['souvenirs']." шт.
".($hostel_option[$hostel['type']]['tariff']['animal']>0 ? ' • Мест для животных: '.$hostel_option[$hostel['type']]['tariff']['animal'].'
' : '' )."  • Койка

info['id']."\" onClick=\"return confirm('Вы уверены, что хотите прекратить аренду?')\">Прекратить аренду
При отмене аренды, все вещи из сундука переносятся в ваш инвентарь.
Ваши животные передаются вам. Если у вас уже есть другое животное, то выпускаются на волю.
Остаток средств не возвращается.
Если вы должны оплатить аренду, то ваш долг удваивается и вы не сможете воспользоваться арендой, пока не оплатите долг.

info['id']."\">Сменить аренду"; - if( $u->info['level'] < 8 ) { - $content .= ' (Только за кр.)'; - } - $content .= "
Для смены аренды на вашем балансе должна быть необходимая сумма.
Смена аренды, оплаченной зубами на кредитную аренду запрещена.
Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.

"; - } - return array('filter'=>$filter, 'content'=>$content, 'additional'=>$additional); + $content = ''; + $additional = ''; + + if ($hostel['action'] == 'changelist') { # смена аренды + $content = "Вы можете сменить арендуемое помещение:

Для смены аренды на вашем балансе должна быть необходимая сумма.
Смена аренды, оплаченной зубами на кредитную аренду запрещена.
Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.

" . ($hostel['type'] != "base" ? "
Арендовать Койку в общежитии
Цена: 1 кр. + 1 кр. в неделю.

• Размер сундука: 25 вещей
• Сувениры: 50 шт.
• Койка

info['id'] . "\" onClick=\"return confirm('Вы уверены, что хотите заплатить 1 кр. за смену помещения?')\">Сменить помещение" : '') . ($hostel['type'] != "advanced" ? "
Арендовать Койку с тумбочкой
Цена: 3 кр. + 3 кр. в неделю.

• Размер сундука: 40 вещей
• Сувениры: 150 шт.
• Койка

info['id'] . "\" onClick=\"return confirm('Вы уверены, что хотите заплатить 3 кр. за смену помещения?')\">Сменить помещение" : '') . ($hostel['type'] != "advanced2" ? "
Арендовать Койку со шкафом
Цена: 10 кр. + 10 кр. в неделю.

• Размер сундука: 70 вещей
• Сувениры: 200 шт.
• Койка

info['id'] . "\" onClick=\"return confirm('Вы уверены, что хотите заплатить 10 кр. за смену помещения?')\">Сменить помещение" : '') . '
 '; + } elseif ($id == 0) { # новая аренда + $content = '
Койка в общежитии
Цена: 1 кр. + 1 кр. в неделю.

• Размер сундука: 25 вещей
• Сувениры: 50 шт.
• Койка

Арендовать' . $azuby[0] . '

Койка с тумбочкой
Цена: 3 кр. + 3 кр. в неделю.

• Размер сундука: 40 вещей
• Сувениры: 150 шт.
• Койка

Арендовать' . $azuby[1] . '

Койка со шкафом
Цена: 10 кр. + 10 кр. в неделю.

• Размер сундука: 70 вещей
• Сувениры: 200 шт.
• Койка

Арендовать' . $azuby[2] . '
'; + } else { # текущее состояние аренды + $content = "Вы арендовали «" . $hostel_option[$hostel['type']]['t_name'] . "» " . $hostel_option[$hostel['type']]['stage'] . "
Начало аренды: " . date('d.m.y H:i', $hostel['starttime']) . "
Оплачено до: " . date("d.m.y H:i", $hostel['endtime']) . ' (баланс ' . $hostel['balance'] . ' кр.)' . " + ',0, '')\" style=\"cursor:pointer\">"; + + $content .= "
Цена в неделю: " . $hostel['weekcost'] . " кр.
 • Размер сундука: " . $hostel_option[$hostel['type']]['tariff']['items'] . " вещей
 • Сувениры: " . $hostel_option[$hostel['type']]['tariff']['souvenirs'] . " шт.
" . ($hostel_option[$hostel['type']]['tariff']['animal'] > 0 ? ' • Мест для животных: ' . $hostel_option[$hostel['type']]['tariff']['animal'] . '
' : '') . "  • Койка

info['id'] . "\" onClick=\"return confirm('Вы уверены, что хотите прекратить аренду?')\">Прекратить аренду
При отмене аренды, все вещи из сундука переносятся в ваш инвентарь.
Ваши животные передаются вам. Если у вас уже есть другое животное, то выпускаются на волю.
Остаток средств не возвращается.
Если вы должны оплатить аренду, то ваш долг удваивается и вы не сможете воспользоваться арендой, пока не оплатите долг.

info['id'] . "\">Сменить аренду"; + if ($u->info['level'] < 8) { + $content .= ' (Только за кр.)'; + } + $content .= "
Для смены аренды на вашем балансе должна быть необходимая сумма.
Смена аренды, оплаченной зубами на кредитную аренду запрещена.
Количество вещей, сувениров и животных на вашем складе не должно превышать допустимое значение для выбранного арендуемого помещения.

"; + } + return ['filter' => $filter, 'content' => $content, 'additional' => $additional]; } -function partition($pid){ - global $hostel, $hostel_option, $u, $sleep, $category, $user_new_pers; - $filter = ''; - $content = ''; - $additional = ''; - if( $hostel['partition'] == 0 OR $hostel['partition'] =='') $hostel['partition'] = 4; - # $hostel_option[$pid]['type'] - инфа о тарифе - if( $hostel['partition'] == 1){ # Комната - $content = 'Вы находитесь в своей комнате. Первое, что вы видите - записная книжка.
+function partition($pid) +{ + global $hostel, $hostel_option, $u, $sleep, $category, $user_new_pers; + $filter = ''; + $content = ''; + $additional = ''; + if ($hostel['partition'] == 0 or $hostel['partition'] == '') $hostel['partition'] = 4; + # $hostel_option[$pid]['type'] - инфа о тарифе + if ($hostel['partition'] == 1) { # Комната + $content = 'Вы находитесь в своей комнате. Первое, что вы видите - записная книжка.
Вы можете оставить нужные вам записи общим объемом не более 10000 символов. -
+
'; - //ТУТ проснуться в комноте 1 - if ($sleep['vars'] == 'sleep') - {$filter = ' - - -
'.( $sleep['vars'] == 'sleep' ? "
" : '').'Состояние: Вы '.( $sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете').''.( $sleep['vars'] == 'sleep' ? "
" : '').'
'.( $sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть').'
';} - - } else if( $hostel['partition'] == 2){ # Хранилище - - $text2 = 'В рюкзаке'; - if( $hostel['category'] == 1 ){ - $text1 = 'В сундуке'; - $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); - $chest = $u->genInv(7,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); - $inventory = $u->genInv(8,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); - } elseif( $hostel['category'] == 2 ){ - $text1 = 'В сохранении'; - $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); - $chest = $u->genInv(10,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); - $inventory = $u->genInv(9,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); - } - $additional = ' - - + //ТУТ проснуться в комноте 1 + if ($sleep['vars'] == 'sleep') { + $filter = '
Сундук '.( $hostel['category'] == 1 ? '['.$count.'/'.$hostel_option[$hostel['type']]['tariff']['items'].']' : '' ).' Сувениры '.( $hostel['category'] == 2 ? '['.$count.'/'.$hostel_option[$hostel['type']]['tariff']['souvenirs'].']' : '' ).'
+ + +
' . ($sleep['vars'] == 'sleep' ? "
" : '') . 'Состояние: Вы ' . ($sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете') . '' . ($sleep['vars'] == 'sleep' ? "
" : '') . '
' . ($sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть') . '
'; + } + + } elseif ($hostel['partition'] == 2) { # Хранилище + + $text2 = 'В рюкзаке'; + if ($hostel['category'] == 1) { + $text1 = 'В сундуке'; + $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` = "" AND `iu`.`gtxt1` = "" AND `iu`.`gtxt2` = "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); + $chest = $u->genInv(7, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); + $inventory = $u->genInv(8, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`type` != "28" AND `im`.`type` != "38" AND `im`.`type` != "39" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); + } elseif ($hostel['category'] == 2) { + $text1 = 'В сохранении'; + $count = mysql_num_rows(mysql_query('SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT `iu`.`item_id` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.inGroup=0 AND `iu`.`inShop` = "1" AND `iu`.`gift` != "" AND `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`delete` = "0" GROUP BY `iu`.id, `iu`.item_id')); + $chest = $u->genInv(10, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" ORDER BY `lastUPD` DESC'); + $inventory = $u->genInv(9, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "39") AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'); + } + $additional = ' + +
Сундук ' . ($hostel['category'] == 1 ? '[' . $count . '/' . $hostel_option[$hostel['type']]['tariff']['items'] . ']' : '') . ' Сувениры ' . ($hostel['category'] == 2 ? '[' . $count . '/' . $hostel_option[$hostel['type']]['tariff']['souvenirs'] . ']' : '') . '
'; - - if ($sleep['vars'] == 'sleep') - {$filter = ' - - -
'.( $sleep['vars'] == 'sleep' ? "
" : '').'Состояние: Вы '.( $sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете').''.( $sleep['vars'] == 'sleep' ? "
" : '').'
'.( $sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть').'
';} - $filter .= ' + + if ($sleep['vars'] == 'sleep') { + $filter = '
+ + +
' . ($sleep['vars'] == 'sleep' ? "
" : '') . 'Состояние: Вы ' . ($sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете') . '' . ($sleep['vars'] == 'sleep' ? "
" : '') . '
' . ($sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть') . '
'; + } + $filter .= ' +
- +
'.$text1.':' . $text1 . ':
Поиск:
@@ -337,7 +338,7 @@ function partition($pid){
- + - +
'.$text2.':' . $text2 . ': Поиск:
@@ -354,411 +355,533 @@ function partition($pid){
   передач: '.$u->info['transfers'].''.'  передач: ' . $u->info['transfers'] . '' . '
'; - $content = ' - - + $content = '
ПУСТО
'.$chest[2].'
ПУСТО
'.$inventory[2].'
+ +
ПУСТО
' . $chest[2] . '
ПУСТО
' . $inventory[2] . '
'; - - } else if( $hostel['partition'] == 3) { # Животное - $ar = changePets(); - $pet = $ar['pet']; - $cage1 = $ar['cage1']; - $cage2 = $ar['cage2']; - $content = " + + } elseif ($hostel['partition'] == 3) { # Животное + $ar = changePets(); + $pet = $ar['pet']; + $cage1 = $ar['cage1']; + $cage2 = $ar['cage2']; + $content = "
'; + } else { + $content .= ''; + } + if ($cage2['pet_in_cage'] == 2) { + $content .= ''; + } else { + $content .= ''; + } + $content .= "
"; - if( $cage1['pet_in_cage'] == 1 ) { - $content .= ''; - } else { - $content .= ''; - } - if( $cage2['pet_in_cage'] == 2 ) { - $content .= ''; - } else { - $content .= ''; - } - $content .= "
'.$cage1['name'].' ['.$cage1['level'].']
свободно

'.$cage2['name'].' ['.$cage2['level'].']
свободно

+ if ($cage1['pet_in_cage'] == 1) { + $content .= '
' . $cage1['name'] . ' [' . $cage1['level'] . ']
свободно

' . $cage2['name'] . ' [' . $cage2['level'] . ']
свободно

  "; - if(!$pet) { - $content .= '
свободно
'; - } else { - $content .= '
'.$pet['name'].' ['.$pet['level'].']
'; - } - $content .= " + if (!$pet) { + $content .= '
свободно
'; + } else { + $content .= '
' . $pet['name'] . ' [' . $pet['level'] . ']
'; + } + $content .= "

"; - } else if( $hostel['partition'] == 4 ) { # Сон + } elseif ($hostel['partition'] == 4) { # Сон - if( $sleep['vars'] == 'sleep' ) $u->error = 'Во время сна нельзя перемещаться и пользоваться чем-либо.'; - $content = '
Вы можете заснуть, забыв о внешнем мире.
'.'Во время сна все временные эффекты на вас приостанавливаются. Это касается как, например, эликсиров, так и травм.
'.'Сон не влияет на состояние предметов с ограниченным сроком существования
'; - $filter = ' - - + if ($sleep['vars'] == 'sleep') $u->error = 'Во время сна нельзя перемещаться и пользоваться чем-либо.'; + $content = '
Вы можете заснуть, забыв о внешнем мире.
' . 'Во время сна все временные эффекты на вас приостанавливаются. Это касается как, например, эликсиров, так и травм.
' . 'Сон не влияет на состояние предметов с ограниченным сроком существования
'; + $filter = '
'.( $sleep['vars'] == 'sleep' ? "
" : '').'Состояние: Вы '.( $sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете').''.( $sleep['vars'] == 'sleep' ? "
" : '').'
'.( $sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть').'
+ +
' . ($sleep['vars'] == 'sleep' ? "
" : '') . 'Состояние: Вы ' . ($sleep['vars'] == 'sleep' ? 'спите' : 'бодрствуете') . '' . ($sleep['vars'] == 'sleep' ? "
" : '') . '
' . ($sleep['vars'] == 'sleep' ? 'Проснуться' : 'Уснуть') . '
'; - } - return array('filter'=>$filter, 'content'=>$content, 'additional'=>$additional); + } + return ['filter' => $filter, 'content' => $content, 'additional' => $additional]; } -if($_GET['changelist']==1 && $hostel['id']>0) { - $hostel['action'] = 'changelist'; -} elseif( isset($_GET['changearenda']) && ($_GET['changearenda'] == 'advanced2' OR $_GET['changearenda'] == 'advanced' OR $_GET['changearenda'] == 'base') && $hostel['id']>0 ){ - $hostel['action'] = 'changearenda'; -} elseif( isset($_GET['arenda']) && isset($hostel_option[$_GET['arenda']]) && $hostel_option[$_GET['arenda']]['type']>0){ - $hostel['action'] = 'newarenda'; +if ($_GET['changelist'] == 1 && $hostel['id'] > 0) { + $hostel['action'] = 'changelist'; +} elseif (isset($_GET['changearenda']) && ($_GET['changearenda'] == 'advanced2' or $_GET['changearenda'] == 'advanced' or $_GET['changearenda'] == 'base') && $hostel['id'] > 0) { + $hostel['action'] = 'changearenda'; +} elseif (isset($_GET['arenda']) && isset($hostel_option[$_GET['arenda']]) && $hostel_option[$_GET['arenda']]['type'] > 0) { + $hostel['action'] = 'newarenda'; } -if( isset($hostel['action']) AND $hostel['action'] != '' ){ - updateHostel(); +if (isset($hostel['action']) and $hostel['action'] != '') { + updateHostel(); } //if( $u->info['admin'] > 0 ) { # Твинки - $user_new_pers = true; +$user_new_pers = true; //} else { // $user_new_pers = false; //} - -if( $hostel['balance'] <= 0 && $u->room['id'] != 214 && $sleep['vars'] != 'sleep' ) { - $result['filter'] = 'Аренда прекращена. Оплатите задолженность.
'; -}elseif( !isset($hostel) && $u->room['id'] != 214 ) { - $result['filter'] = 'Вы ничего не арендуете на этом этаже.
'; -} elseif( isset($hostel) && $hostel_option[$hostel['type']]['room'] != $u->room['id'] && $u->room['id'] != 214 ) { - $result['filter'] = 'Вы ничего не арендуете на этом этаже.
'; - $hostel_option[$hostel['type']]['type'] = false; -} elseif( isset($hostel) && $hostel_option[$hostel['type']]['room'] == $u->room['id'] && $u->room['id'] != 214 ){ - $result = partition( $hostel['type'] ); -} elseif( $u->room['id'] == 214 ){ - if( isset($_GET['closearenda']) && (int)$_GET['closearenda']==1) { #---Прекращаем аренду - mysql_query("UPDATE `items_users` SET `inShop` = '0' WHERE `uid` = '".mysql_real_escape_string($u->info['id'])."' AND `inShop` = '1';"); - mysql_query("DELETE FROM `house` WHERE `owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Вы отказались арендовать "'.$hostel_option[$hostel['type']]['t_name'].'"';unset($hostel); - } - if(isset($hostel) && $hostel_option[$hostel['type']]['type'] > 0){ - if(isset($_POST['payarenda']) && !isset($_GET['zby'])) { #---Продлить аренду - if($_POST['payarenda']>=1) { - if($u->info['money']>0 && (int)$_POST['payarenda']>0 && ((int)$_POST['payarenda']<=$u->info['money'])) { - $paytime = ($_POST['payarenda']/$hostel['weekcost'])*604800; - mysql_query("UPDATE `house`,`users` SET `house`.`endtime` = `house`.`endtime`+'".$paytime."', `house`.`balance` = `house`.`balance`+'".mysql_real_escape_string($_POST['payarenda'])."' WHERE `house`.`owner` = `users`.`id` AND `house`.`owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Вы положили на счет '.htmlspecialchars($_POST['payarenda'],NULL).'.00 кр. '; - $u->info['money'] -= round((int)$_POST['payarenda']); - mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $hostel['balance'] +=$_POST['payarenda']; - $hostel['endtime'] += $paytime; - } else { - $err = 'У вас недостаточно денег

'; - } - } else { - $err = 'Минимальная сумма: 1кр.

'; - } - }elseif(isset($_POST['payarenda']) && isset($_GET['zby'])) { #---Продлить аренду (за зубы) - if($_POST['payarenda']>=5) { - if($u->info['level'] < 8 && $u->info['money4']>0 && (int)$_POST['payarenda']>0 && ((int)$_POST['payarenda']<=$u->info['money4'])) { - $paytime = (round($_POST['payarenda']/5,2)/$hostel['weekcost'])*604800; - mysql_query("UPDATE `house`,`users` SET `house`.`endtime` = `house`.`endtime`+'".$paytime."', `house`.`balance` = `house`.`balance`+'".mysql_real_escape_string($_POST['payarenda'])."' WHERE `house`.`owner` = `users`.`id` AND `house`.`owner` = '".mysql_real_escape_string($u->info['id'])."';"); - $err = 'Вы положили на счет '.$u->zuby(round((int)$_POST['payarenda']),1).' '; - $u->info['money4'] -= round((int)$_POST['payarenda']); - mysql_query('UPDATE `users` SET `money4` = "'.mysql_real_escape_string($u->info['money4']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $hostel['balance'] += round($_POST['payarenda']/5,2); - $hostel['endtime'] += $paytime; - } else { - $err = 'У вас недостаточно зубов

'; - } - } else { - $err = 'Минимальная сумма: '.$u->zuby(5,1).'.

'; - } - } - $result = hostel($hostel_option[$hostel['type']]['type']); - } else { - $result = hostel(0); - } +if ($hostel['balance'] <= 0 && $u->room['id'] != 214 && $sleep['vars'] != 'sleep') { + $result['filter'] = 'Аренда прекращена. Оплатите задолженность.
'; +} elseif (!isset($hostel) && $u->room['id'] != 214) { + $result['filter'] = 'Вы ничего не арендуете на этом этаже.
'; +} elseif (isset($hostel) && $hostel_option[$hostel['type']]['room'] != $u->room['id'] && $u->room['id'] != 214) { + $result['filter'] = 'Вы ничего не арендуете на этом этаже.
'; + $hostel_option[$hostel['type']]['type'] = false; +} elseif (isset($hostel) && $hostel_option[$hostel['type']]['room'] == $u->room['id'] && $u->room['id'] != 214) { + $result = partition($hostel['type']); +} elseif ($u->room['id'] == 214) { + if (isset($_GET['closearenda']) && (int)$_GET['closearenda'] == 1) { #---Прекращаем аренду + mysql_query("UPDATE `items_users` SET `inShop` = '0' WHERE `uid` = '" . mysql_real_escape_string($u->info['id']) . "' AND `inShop` = '1';"); + mysql_query("DELETE FROM `house` WHERE `owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Вы отказались арендовать "' . $hostel_option[$hostel['type']]['t_name'] . '"'; + unset($hostel); + } + if (isset($hostel) && $hostel_option[$hostel['type']]['type'] > 0) { + if (isset($_POST['payarenda']) && !isset($_GET['zby'])) { #---Продлить аренду + if ($_POST['payarenda'] >= 1) { + if ($u->info['money'] > 0 && (int)$_POST['payarenda'] > 0 && ((int)$_POST['payarenda'] <= $u->info['money'])) { + $paytime = ($_POST['payarenda'] / $hostel['weekcost']) * 604800; + mysql_query("UPDATE `house`,`users` SET `house`.`endtime` = `house`.`endtime`+'" . $paytime . "', `house`.`balance` = `house`.`balance`+'" . mysql_real_escape_string($_POST['payarenda']) . "' WHERE `house`.`owner` = `users`.`id` AND `house`.`owner` = '" . mysql_real_escape_string($u->info['id']) . "';"); + $err = 'Вы положили на счет ' . htmlspecialchars($_POST['payarenda'], null) . '.00 кр. '; + $u->info['money'] -= round((int)$_POST['payarenda']); + mysql_query('UPDATE `users` SET `money` = "' . mysql_real_escape_string($u->info['money']) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $hostel['balance'] += $_POST['payarenda']; + $hostel['endtime'] += $paytime; + } else { + $err = 'У вас недостаточно денег

'; + } + } else { + $err = 'Минимальная сумма: 1кр.

'; + } + } + $result = hostel($hostel_option[$hostel['type']]['type']); + } else { + $result = hostel(0); + } } ?> - - - + + + -
+ +
- - - + - + echo '
' . $goLis . '
- - ';?> - - - - -
'.$err.$u->error.$error.$er.$re.'
- - - - - - - -
microLogin($u->info['id'],1)?>

room['name'];?>

-
-
- + + + '; ?> + + + + + + +
' . $err . $u->error . $error . $er . $re . '
+ + + + + + + + + +
microLogin($u->info['id'], 1) ?>

room['name']; ?>

+
+
+ '.$goLis.''; - if ($sleep['vars'] != 'sleep' || $u->info['room']=='214') //ТУТ - { - $roomGo = explode(',', $u->room['roomGo']); - foreach($roomGo as $val) { - $temp = $u->roomInfo($val, true); - if( isset($temp['id']) ){ // Перемещение по комнатам. - echo ''; - } - } - } - echo '
'.''.$temp['name'].'
'; - if($u->info['room']=="214") { // Вход - echo '

Аренда
'; - if(isset($hostel) && $hostel_option[$hostel['type']]['t_name']){ - echo "«".$hostel_option[$hostel['type']]['t_name']."» ".$hostel_option[$hostel['type']]['stage'].".

"; - } - echo '

Деньги: '.$u->info['money'].' кр.

'; - } else { // Перемещение по частям комнат - if($hostel_option[$hostel['type']]['type'] != false) { - echo ''; - } - } - ?> -
'; + if ($sleep['vars'] != 'sleep' || $u->info['room'] == '214') //ТУТ + { + $roomGo = explode(',', $u->room['roomGo']); + $roomInfo = fn(int $roomId) => Db::getRow('select id, name, code from room where id = ?', [$roomId]); + foreach ($roomGo as $val) { + $temp = $roomInfo($val); + if (isset($temp['id'])) { // Перемещение по комнатам. + echo ''; + } + } + } + echo '
' . '' . $temp['name'] . '
'; + if ($u->info['room'] == "214") { // Вход + echo '

Аренда
'; + if (isset($hostel) && $hostel_option[$hostel['type']]['t_name']) { + echo "«" . $hostel_option[$hostel['type']]['t_name'] . "» " . $hostel_option[$hostel['type']]['stage'] . ".

"; + } + echo '

Деньги: ' . $u->info['money'] . ' кр.

'; + } else { // Перемещение по частям комнат + if ($hostel_option[$hostel['type']]['type'] != false) { + echo ''; + } + } + ?> +
\ No newline at end of file diff --git a/modules_data/location/shop_.php b/modules_data/location/shop_.php index d6c35180..58704e97 100644 --- a/modules_data/location/shop_.php +++ b/modules_data/location/shop_.php @@ -90,7 +90,6 @@ if ($actionSale) { $sellprice = $item['1price'] - $item['1price'] * 0.1; ItemsModel::delete($item['id']); $u->addKr($sellprice); - $u->info['money'] += $sellprice; $status = "Вы успешно продали предмет «{$item['name']}» за $sellprice кр."; Delo::add(2, 'shopid:' . $shopId, $u->info['id'], "Предмет «{$item['name']}» [id:{$item['id']}] продан за $sellprice кр.", -$sellprice); } diff --git a/modules_data/moder/teleport.php b/modules_data/moder/teleport.php index 7c596820..379a9549 100644 --- a/modules_data/moder/teleport.php +++ b/modules_data/moder/teleport.php @@ -1,65 +1,31 @@ city_name[$cgo])) - { - $uer = 'Город "'.$cgo.'" не найден.'; - }else{ - $uu = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" LIMIT 1')); - if(isset($uu['id'])) - { - if($uu['id']!=$u->info['id'] && $u->info['admin']==0) - { - $uer = 'Вы можете телепортировать только себя'; - }elseif($uu['battle']>0) - { - $uer = 'Персонаж находится в бою'; - }elseif($uu['admin']>0 && $u->info['admin']==0) - { - $uer = 'Вы не можете телепортировать Ангелов в другой город'; - }elseif($uu['city']!=$u->info['city'] && $u->info['admin']==0){ - $uer = 'Персонаж находится в другом городе'; - }elseif(floor($uu['align'])==$a && $uu['align']>$u->info['align'] && $u->info['admin']==0) - { - $uer = 'Вы не можете телепортировать старших по званию'; - }else{ - $rid = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `name` = "Вокзал" AND `city` = "'.mysql_real_escape_string($cgo).'" LIMIT 1')); - if(!isset($rid['id'])) - { - $uer = 'Телепортация в "'.$u->city_name[$cgo].'" запрещена!'; - }else{ - $upd = mysql_query('UPDATE `users` SET `city` = "'.mysql_real_escape_string($cgo).'",`room` = "'.$rid['id'].'" WHERE `id` = "'.$uu['id'].'" LIMIT 1'); - if($upd) - { - $sx = ''; - if($u->info['sex']==1) - { - $sx = 'а'; - } - $rtxt = '[img[items/teleport.gif]] '.$rang.' "'.$u->info['cast_login'].'" телепортировал'.$sx.' персонажа "'.$uu['login'].'" в [img[city_ico/'.$cgo.'.gif]] '.$u->city_name[$cgo].'.'; +/** @var User $u */ -$cmsg = new ChatMessage(); -$cmsg->setCity($u->info['city']); -$cmsg->setRoom($u->info['room']); -$cmsg->setText($rtxt); -$cmsg->setType(6); -$cmsg->setTypeTime(1); -(new Chat())->sendMsg($cmsg); - $rtxt = $rang.' "'.$u->info['login'].'" телепортировал'.$sx.' в "'.$u->city_name[$cgo].'".'; - mysql_query("INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('".$uu['id']."','".$_SERVER['REMOTE_ADDR']."','".$u->info['city']."','".time()."','".$rtxt."','".$u->info['login']."',5)"); - $uer = 'Вы успешно телепортировали персонажа "'.$uu['login'].'" в '.$u->city_name[$cgo].'.'; - }else{ - $uer = 'Не удалось использовать данное заклятие'; - } - } - } - }else{ - $uer = 'Персонаж не найден в этом городе'; - } - } - -?> \ No newline at end of file +$caster = $u; +$targetUser = $_POST['logingo']; +$targetRoom = null; // Заглушка + +echo 'Не работает. Проверь исполняемый файл.'; + +$target = $targetUser === $caster->info['login'] ? $caster->info : User::getInfo($targetUser); + +if (empty($target) || $target['admin'] > 0 && !$caster->isAdmin()) { + $uer = 'Цель не найдена!'; +} elseif ($caster->info['id'] != $target['id'] && !$caster->isAdmin()) { + $uer = 'Нельзя телепортировать других!'; +} elseif (!empty($target['battle']) || !empty($caster->info['battle'])) { + $uer = 'Не работает в поединке!'; +} else { + Db::sql('update users set room = ? where login = ?', [$targetRoom, $target['id']]); + Delo::add(5, 'teleport', $target['login'], "{$caster->info['login']} телепортировал игрока в $targetRoom."); + $uer = 'Успешная телепортация!'; +} + +unset($caster, $target, $targetUser, $targetRoom); diff --git a/modules_data/stats_inv.php b/modules_data/stats_inv.php index 868085bf..b81c7d3a 100644 --- a/modules_data/stats_inv.php +++ b/modules_data/stats_inv.php @@ -203,9 +203,7 @@ if ($u->stats['pbe'] > 0) { } echo '
'; } -if ($u->info['level'] < 8 && $c['zuby'] == true) { - echo 'Зубы: ' . $u->zuby($u->info['money4']) . '
'; -} + if ($u->info['ability'] > 0 || ($u->info['skills'] > 0 && $u->info['level'] > 0)) { echo ' + Способности
'; } diff --git a/online.php b/online.php index e1a17310..99a6e8ac 100644 --- a/online.php +++ b/online.php @@ -695,6 +695,8 @@ foreach ($chat->getMessages((int)$_POST['mid'], $u->info['login']) as $pl) { unset($qix); } + $see = 1; //временно. + if ($see == 1) { if ($pl['time'] < 0) { if ($pl['to'] == '') {