Compare commits
52 Commits
dev-battle
...
dev-battle
| Author | SHA1 | Date | |
|---|---|---|---|
| 09655ce234 | |||
| 7692c9f658 | |||
| d41147da45 | |||
| 70389921ea | |||
| 73862ca752 | |||
| 450a9bf375 | |||
| 5e0dda8ed0 | |||
| bc136cc030 | |||
| 7b8ffdfd6a | |||
| a1408072d6 | |||
| f3d475a0b8 | |||
| 023d9856ea | |||
| 2026029bf5 | |||
| 244e081014 | |||
| 85b74015b7 | |||
| bfc075010d | |||
| 078cb49669 | |||
| 5f9d3b85bf | |||
| bd7af6b31c | |||
| b91a305ac0 | |||
| 70f2f900eb | |||
| 9c4e8fb035 | |||
| 65aa6fba8e | |||
| 4775f6e5cb | |||
| a6b5dd83c3 | |||
| 3830c97ac2 | |||
| 60ac124ea9 | |||
| b79a0ccf1b | |||
| 9843a3a991 | |||
| 66d825bc6e | |||
| 8c49088f27 | |||
| 98882e156e | |||
| 7c15294688 | |||
| 7986d33ab6 | |||
| 4470f80098 | |||
| 1a05960ddc | |||
| 172c7fdcde | |||
| 3df3f1b4d7 | |||
| 96beb132e8 | |||
| e3f362cf23 | |||
| 2b2767044c | |||
| c18241bda3 | |||
| 664c24ff1e | |||
| 8af1a5114a | |||
| be537b5dfc | |||
| 88aeb4a912 | |||
| 7dc27047b6 | |||
| 68ef35d14a | |||
| b0d1388cda | |||
| bd8761f240 | |||
| 9652ee5c8e | |||
| 4a7535d67d |
166
.htaccess
166
.htaccess
@@ -1,86 +1,86 @@
|
||||
DefaultLanguage ru
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
Options -Indexes
|
||||
Options -MultiViews
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{HTTP:VIA} !^$ [OR]
|
||||
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
|
||||
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
|
||||
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
|
||||
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
|
||||
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
|
||||
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
|
||||
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
|
||||
RewriteRule (.+) https://new-combats.tech/proxy/
|
||||
|
||||
RewriteBase /
|
||||
RewriteCond %{ENV:REDIRECT} !^yes$
|
||||
RewriteRule ruletka.pl ruletka.php [L]
|
||||
RewriteRule bandit.pl bandit.php [L]
|
||||
RewriteRule blackjack.pl blackjack.php [L]
|
||||
RewriteRule casino/SWFP.pl casino/SWFP.php [L]
|
||||
RewriteCond %{ENV:REDIRECT} !^yes$
|
||||
RewriteRule ^r([0-9]+)/?$ /register.php?ref=$1 [L]
|
||||
|
||||
RewriteRule ^settings/?$ /settings.php [L]
|
||||
|
||||
RewriteRule ^info/(.*)/?$ /inf.php?$1 [L]
|
||||
|
||||
RewriteRule ^rating_pers/?$ /reting_pers.php [L]
|
||||
RewriteRule ^rating_pers/(.*)/?$ /reting_pers.php?$1 [L]
|
||||
|
||||
RewriteRule ^rating_clans/?$ /reting_clans.php [L]
|
||||
RewriteRule ^rating_clans/(.*)/?$ /reting_clans.php?$1 [L]
|
||||
|
||||
RewriteRule ^clan/(.*)/?$ /clans_inf.php?$1 [L]
|
||||
RewriteRule ^clan/?$ /clans_inf.php [L]
|
||||
|
||||
RewriteRule ^ruins/(.*)/?$ /ruins.php?$1 [L]
|
||||
RewriteRule ^ruins/?$ /ruins.php [L]
|
||||
|
||||
RewriteRule ^news/(.*)/?$ /n/$1 [R=301,L]
|
||||
RewriteRule ^news/?$ /n [R=301,L]
|
||||
|
||||
RewriteRule ^n/(.*)/?$ /news_script/index.php?$1 [L]
|
||||
RewriteRule ^n/?$ /news_script/index.php [L]
|
||||
|
||||
RewriteRule ^forum/(.*)/?$ /forum_script/index.php?$1 [L]
|
||||
RewriteRule ^forum/?$ /forum_script/index.php [L]
|
||||
|
||||
RewriteRule ^shadow/(.*)/?$ /obraz.php?$1 [L]
|
||||
RewriteRule ^shadow/?$ /obraz.php [L]
|
||||
|
||||
RewriteRule ^dress/(.*)/?$ /dress.php?$1 [L]
|
||||
RewriteRule ^dress/?$ /dress.php [L]
|
||||
|
||||
RewriteRule ^monitoring/(.*)/?$ /hmonitor.php?$1 [L]
|
||||
RewriteRule ^monitoring/?$ /hmonitor.php [L]
|
||||
|
||||
RewriteRule ^rating/(.*)/?$ /rating_script/index.php?$1 [L]
|
||||
RewriteRule ^rating/?$ /rating_script/index.php [L]
|
||||
|
||||
RewriteRule ^item/(.*)/?$ /items_info.php?$1 [L]
|
||||
RewriteRule ^item/?$ /items_info.php [L]
|
||||
RewriteRule ^repass/?$ /repass.php [L]
|
||||
|
||||
RewriteRule ^mail/(.*)/?$ /mailconf.php?$1 [L]
|
||||
|
||||
RewriteRule ^register/?$ /register.php [L]
|
||||
|
||||
RewriteRule ^reg/?$ /register.php [L]
|
||||
|
||||
RewriteRule ^enter/?$ /enter.php [L]
|
||||
|
||||
RewriteRule ^bk/?$ /buttons.php [L]
|
||||
|
||||
RewriteRule ^mobile/?$ /main_mobile.php [L]
|
||||
|
||||
RewriteRule ^btl([0-9]+)/?$ /jx/battle/refresh$1.php [L]
|
||||
RewriteRule ^/n/?$ /news_script/index.php [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
<IfModule mod_headers.c>
|
||||
Header always set X-Content-Type-Options nosniff
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
Options -Indexes
|
||||
Options -MultiViews
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{HTTP:VIA} !^$ [OR]
|
||||
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
|
||||
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
|
||||
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
|
||||
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
|
||||
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
|
||||
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
|
||||
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
|
||||
RewriteRule (.+) https://new-combats.tech/proxy/
|
||||
|
||||
RewriteBase /
|
||||
RewriteCond %{ENV:REDIRECT} !^yes$
|
||||
RewriteRule ruletka.pl ruletka.php [L]
|
||||
RewriteRule bandit.pl bandit.php [L]
|
||||
RewriteRule blackjack.pl blackjack.php [L]
|
||||
RewriteRule casino/SWFP.pl casino/SWFP.php [L]
|
||||
RewriteCond %{ENV:REDIRECT} !^yes$
|
||||
RewriteRule ^r([0-9]+)/?$ /register.php?ref=$1 [L]
|
||||
|
||||
RewriteRule ^settings/?$ /settings.php [L]
|
||||
|
||||
RewriteRule ^info/(.*)/?$ /inf.php?$1 [L]
|
||||
|
||||
RewriteRule ^rating_pers/?$ /reting_pers.php [L]
|
||||
RewriteRule ^rating_pers/(.*)/?$ /reting_pers.php?$1 [L]
|
||||
|
||||
RewriteRule ^rating_clans/?$ /reting_clans.php [L]
|
||||
RewriteRule ^rating_clans/(.*)/?$ /reting_clans.php?$1 [L]
|
||||
|
||||
RewriteRule ^clan/(.*)/?$ /clans_inf.php?$1 [L]
|
||||
RewriteRule ^clan/?$ /clans_inf.php [L]
|
||||
|
||||
RewriteRule ^news/(.*)/?$ /n/$1 [R=301,L]
|
||||
RewriteRule ^news/?$ /n [R=301,L]
|
||||
|
||||
RewriteRule ^n/(.*)/?$ /news_script/index.php?$1 [L]
|
||||
RewriteRule ^n/?$ /news_script/index.php [L]
|
||||
|
||||
RewriteRule ^forum/(.*)/?$ /forum_script/index.php?$1 [L]
|
||||
RewriteRule ^forum/?$ /forum_script/index.php [L]
|
||||
|
||||
RewriteRule ^shadow/(.*)/?$ /obraz.php?$1 [L]
|
||||
RewriteRule ^shadow/?$ /obraz.php [L]
|
||||
|
||||
RewriteRule ^dress/(.*)/?$ /dress.php?$1 [L]
|
||||
RewriteRule ^dress/?$ /dress.php [L]
|
||||
|
||||
RewriteRule ^monitoring/(.*)/?$ /hmonitor.php?$1 [L]
|
||||
RewriteRule ^monitoring/?$ /hmonitor.php [L]
|
||||
|
||||
RewriteRule ^rating/(.*)/?$ /rating_script/index.php?$1 [L]
|
||||
RewriteRule ^rating/?$ /rating_script/index.php [L]
|
||||
|
||||
RewriteRule ^item/(.*)/?$ /items_info.php?$1 [L]
|
||||
RewriteRule ^item/?$ /items_info.php [L]
|
||||
RewriteRule ^repass/?$ /repass.php [L]
|
||||
|
||||
RewriteRule ^mail/(.*)/?$ /mailconf.php?$1 [L]
|
||||
|
||||
RewriteRule ^register/?$ /register.php [L]
|
||||
|
||||
RewriteRule ^reg/?$ /register.php [L]
|
||||
|
||||
RewriteRule ^enter/?$ /enter.php [L]
|
||||
|
||||
RewriteRule ^bk/?$ /buttons.php [L]
|
||||
|
||||
RewriteRule ^mobile/?$ /main_mobile.php [L]
|
||||
|
||||
RewriteRule ^btl([0-9]+)/?$ /jx/battle/refresh$1.php [L]
|
||||
RewriteRule ^/n/?$ /news_script/index.php [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
</IfModule>
|
||||
|
||||
12
.idea/dataSources.xml
generated
Normal file
12
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@sokol" uuid="c5a52191-dffb-4c22-9257-bd5d9e5d5f29">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://85.209.45.159:54001/game_production</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
345
AI.php
345
AI.php
@@ -15,11 +15,8 @@ if (!defined('GAME_VERSION')) {
|
||||
require_once '_incl_data/autoload.php';
|
||||
}
|
||||
|
||||
//const GAME = true;
|
||||
$user = User::start();
|
||||
|
||||
//var_dump($user->info['testStats'], $user->info['testStats2']);
|
||||
//exit();
|
||||
$user = User::start();
|
||||
|
||||
$im = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'items_main'");
|
||||
$iu = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'items_users'");
|
||||
@@ -63,21 +60,28 @@ var_dump((new ShopOtdel())->getGroups());
|
||||
<?php
|
||||
$rr = 1;
|
||||
foreach ($user->stats as $k => $v) {
|
||||
if ($k === 'items_o') {
|
||||
continue;
|
||||
}
|
||||
if (isset($user->is[$k])) {
|
||||
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]";
|
||||
} else {
|
||||
$k = "<span>$k";
|
||||
}
|
||||
|
||||
echo "$rr. $k</span> = $v<br>";
|
||||
$vv = is_array($v) ? 'array' : $v;
|
||||
echo "$rr. $k</span> = $vv<br>";
|
||||
$rr++;
|
||||
|
||||
if (is_array($v)) {
|
||||
foreach ($v as $k2 => $v2) {
|
||||
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $v2</span><br>";
|
||||
$vv2 = is_array($v2) ? 'array' : $v2;
|
||||
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $vv2</span><br>";
|
||||
|
||||
if (is_array($v2)) {
|
||||
foreach ($v2 as $k3 => $v3) {
|
||||
echo "<span style='background-color: aliceblue; margin-left: 10px;'>$k3 = $v3</span><br>";
|
||||
$vv3 = is_array($v2) ? 'array' : $v3;
|
||||
echo "<span style='background-color: aliceblue; margin-left: 10px;'>$k3 = $vv3</span><br>";
|
||||
if ($k3 === 'data' && $v3 !== '[]') {
|
||||
$v3 .= '|add_mib2=43';
|
||||
$itemData = Conversion::dataStringToArray($v3);
|
||||
@@ -101,26 +105,7 @@ var_dump((new ShopOtdel())->getGroups());
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
Совпадения по параметрам $user->info и $user->stats. Возможно, это ничего не значит, а может и дублирование.<br><br>
|
||||
|
||||
<?php
|
||||
$i = 1;
|
||||
$i2 = 1;
|
||||
foreach ($user->info as $a => $b) {
|
||||
if (isset($user->stats[$a])) {
|
||||
echo "$i. info = stats: $a = $b<br>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo '<br>';
|
||||
foreach ($user->stats as $a2 => $b2) {
|
||||
if (isset($user->info[$a2])) {
|
||||
echo "$i2. stats = info: $a2 = $b2<br>";
|
||||
$i2++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<div style="display: grid; grid-template-columns: auto auto;">
|
||||
<div> Поля в базе users
|
||||
@@ -161,315 +146,9 @@ foreach ($user->stats as $a2 => $b2) {
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr> Все возможные поля в $user->stats. Некоторые имена полей генерируются динамически на лету, поэтому соответствия имени нет. А каких-то, возможно просто не существует.<br><br>
|
||||
|
||||
<?php
|
||||
|
||||
$st['clanpos'] = 0;
|
||||
$st['levels'] = 0;
|
||||
$st['levels'] = 0;
|
||||
$st['id'] = 0;
|
||||
$st['login'] = 0;
|
||||
$st['lvl'] = 0;
|
||||
$st['hpNow'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpNow'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['zona'] = 0;
|
||||
$st['zonb'] = 0;
|
||||
$st['items'] = 0;
|
||||
$st['effects'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['vip'] = 0;
|
||||
$st['items_img'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['wp'] = 0;
|
||||
$st['items'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['art'] = 0;
|
||||
$st['maks_itm'] = 0;
|
||||
$st['zonb'] = 0;
|
||||
$st['zona'] = 0;
|
||||
$st['a'] = 0;
|
||||
$st['mg'] = 0;
|
||||
$st['s'] = 0;
|
||||
$st['effects'] = 0;
|
||||
$st['puti'] = 0;
|
||||
$st['slvtm'] = 0;
|
||||
$st['act'] = 0;
|
||||
$st['noeffectbattle1'] = 0;
|
||||
$st['items_img'] = 0;
|
||||
$st['set_pog'] = 0;
|
||||
$st['set_pog2'] = 0;
|
||||
$st['act'] = 0;
|
||||
$st['effects'] = 0;
|
||||
$st['raztac'] = 0;
|
||||
$st['set_natoe'] = 0;
|
||||
$st['act'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['s6'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['m5'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['zaproc'] = 0;
|
||||
$st['s5'] = 0;
|
||||
$st['m19'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['antm3'] = 0;
|
||||
$st['s5'] = 0;
|
||||
$st['m10'] = 0;
|
||||
$st['m11'] = 0;
|
||||
$st['m11a'] = 0;
|
||||
$st['m8'] = 0;
|
||||
$st['zona'] = 0;
|
||||
$st['zonb'] = 0;
|
||||
$st['pm'] = 0;
|
||||
$st['a'] = 0;
|
||||
$st['mg'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['s5'] = 0;
|
||||
$st['pm'] = 0;
|
||||
$st['s5'] = 0;
|
||||
$st['m11a'] = 0;
|
||||
$st['pm'] = 0;
|
||||
$st['a'] = 0;
|
||||
$st['aall'] = 0;
|
||||
$st['m2all'] = 0;
|
||||
$st['mg'] = 0;
|
||||
$st['m2all'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['zma'] = 0;
|
||||
$st['mib'] = 0;
|
||||
$st['mab'] = 0;
|
||||
$st['mg'] = 0;
|
||||
$st['pm'] = 0;
|
||||
$st['pa'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['mall'] = 0;
|
||||
$st['mg'] = 0;
|
||||
$st['mall'] = 0;
|
||||
$st['m11'] = 0;
|
||||
$st['pm'] = 0;
|
||||
$st['m11'] = 0;
|
||||
$st['m10'] = 0;
|
||||
$st['pa'] = 0;
|
||||
$st['m10'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['yzm'] = 0;
|
||||
$st['yzma'] = 0;
|
||||
$st['yza'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['hpVinos'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['mpVinos'] = 0;
|
||||
$st['s6'] = 0;
|
||||
$st['hpProc'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpProc'] = 0;
|
||||
$st['hpNow'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['hpNow'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpNow'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['mpNow'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['zona'] = 0;
|
||||
$st['zonb'] = 0;
|
||||
$st['ozash'] = 0;
|
||||
$st['ozmsh'] = 0;
|
||||
$st['weapon1'] = 0;
|
||||
$st['weapon2'] = 0;
|
||||
$st['sheld1'] = 0;
|
||||
$st['sv_'] = 0;
|
||||
$st['sv_i'] = 0;
|
||||
$st['dom'] = 0;
|
||||
$st['prsu'] = 0;
|
||||
$st['x'] = 0;
|
||||
$st['y'] = 0;
|
||||
$st['s'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['maxves'] = 0;
|
||||
$st['speed_dungeon'] = 0;
|
||||
$st['speedhp'] = 0;
|
||||
$st['exp'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['reting'] = 0;
|
||||
$st['btl_cof'] = 0;
|
||||
$st['prckr'] = 0;
|
||||
$st['btl_cof'] = 0;
|
||||
$st['prckr'] = 0;
|
||||
$st['btl_cof'] = 0;
|
||||
$st['prckr'] = 0;
|
||||
$st['prckr'] = 0;
|
||||
$st['id'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['this_animal'] = 0;
|
||||
$st['this_animal'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['add_'] = 0;
|
||||
$st['add_'] = 0;
|
||||
$st['add_'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['pa2'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['pa2'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['pa2'] = 0;
|
||||
$st['m7'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['pa2'] = 0;
|
||||
$st['m7'] = 0;
|
||||
$st['s1'] = 0;
|
||||
$st['pa2'] = 0;
|
||||
$st['m7'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['m15'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['m15'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['m15'] = 0;
|
||||
$st['s2'] = 0;
|
||||
$st['pa1'] = 0;
|
||||
$st['m2'] = 0;
|
||||
$st['m4'] = 0;
|
||||
$st['m15'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['pa4'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['pa4'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['pa4'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['m5'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['pa4'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['m5'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['s3'] = 0;
|
||||
$st['pa4'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['m5'] = 0;
|
||||
$st['m14'] = 0;
|
||||
$st['m3'] = 0;
|
||||
$st['m1'] = 0;
|
||||
$st['m5'] = 0;
|
||||
$st['m14'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['m19'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['m19'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['s4'] = 0;
|
||||
$st['hpAll'] = 0;
|
||||
$st['za'] = 0;
|
||||
$st['zm'] = 0;
|
||||
$st['s5'] = 0;
|
||||
$st['m11'] = 0;
|
||||
$st['pzm'] = 0;
|
||||
$st['s6'] = 0;
|
||||
$st['mpAll'] = 0;
|
||||
$st['speedmp'] = 0;
|
||||
$st['s6'] = 0;
|
||||
$st['pzm'] = 0;
|
||||
$st['m10'] = 0;
|
||||
|
||||
$stnames = [];
|
||||
foreach ($st as $k => $v) {
|
||||
if (isset($user->is[$k])) {
|
||||
$v = $user->is[$k];
|
||||
}
|
||||
$stnames[$k] = $v;
|
||||
}
|
||||
var_dump($stnames);
|
||||
|
||||
echo "<h5>Текущая таблица параметров</h5>";
|
||||
foreach ($p as $prow) {
|
||||
echo "{$prow['sys_name']} → {$prow['name']}";
|
||||
|
||||
@@ -10,13 +10,18 @@ require_once 'mysql_override.php';
|
||||
|
||||
spl_autoload_register(function (string $className) {
|
||||
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data' . DIRECTORY_SEPARATOR;
|
||||
$addsrc = function ($class) {
|
||||
$c = explode('\\', $class);
|
||||
array_splice($c, 1, 0, 'src');
|
||||
return implode(DIRECTORY_SEPARATOR, $c);
|
||||
};
|
||||
# 1 with namespaces
|
||||
# 2 without
|
||||
$fileName = [
|
||||
$rootdir . 'class' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||
$rootdir . 'class' . DIRECTORY_SEPARATOR . $className . '.php',
|
||||
$rootdir . 'function' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||
$rootdir . 'vendor' . DIRECTORY_SEPARATOR . $className . '.php',
|
||||
$rootdir . 'vendor' . DIRECTORY_SEPARATOR . $addsrc($className) . '.php',
|
||||
];
|
||||
foreach ($fileName as $file) {
|
||||
if (file_exists($file)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
62
_incl_data/class/Battle/BattleHTML.php
Normal file
62
_incl_data/class/Battle/BattleHTML.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Core\Config;
|
||||
use Helper\Conversion;
|
||||
use User;
|
||||
|
||||
class BattleHTML
|
||||
{
|
||||
/**
|
||||
* Генерирует HTML, который будет вставляться в javascript в файлах refresh{X}.php
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function printMagicScrolls(): string
|
||||
{
|
||||
$sv = array_fill(1, 12, '<img class="nopriemuse" title="Пустой слот магия" src="' . Config::img() . '/i/items/w/w101.gif" alt="">');
|
||||
|
||||
foreach (User::start()->stats['items'] as $stat) {
|
||||
if (!in_array($stat['inslot'], [40, 51])) {
|
||||
continue;
|
||||
}
|
||||
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] = '<img ' . $vl . ' title="' . $iznos . '" src="' . $img . '" alt="">';
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<table style="border: 0; border-collapse: collapse; border-spacing: 0;">
|
||||
<tr>
|
||||
<td>$sv[1]</td>
|
||||
<td>$sv[2]</td>
|
||||
<td>$sv[3]</td>
|
||||
<td>$sv[4]</td>
|
||||
<td>$sv[5]</td>
|
||||
<td>$sv[6]</td>
|
||||
<td>$sv[7]</td>
|
||||
<td>$sv[8]</td>
|
||||
<td>$sv[9]</td>
|
||||
<td>$sv[10]</td>
|
||||
<td>$sv[11]</td>
|
||||
<td>$sv[12]</td>
|
||||
</tr>
|
||||
</table>
|
||||
HTML;
|
||||
|
||||
//Если сломается, применить str_replace('"', '\"', $r);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,632 @@
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Helper\Math;
|
||||
use User;
|
||||
|
||||
class Fighter
|
||||
{
|
||||
private string $obraz;
|
||||
private string $login;
|
||||
private int $level;
|
||||
private int $life;
|
||||
private int $mana;
|
||||
private int $maxlife;
|
||||
private int $maxmana;
|
||||
|
||||
}
|
||||
private int $damage;
|
||||
private int $damageMultiplier;
|
||||
private int $critChance;
|
||||
private int $critMultiplier;
|
||||
private int $evadeChance;
|
||||
private int $counterstrikeChance;
|
||||
private int $parryChance;
|
||||
private int $shieldblockChance;
|
||||
private int $ignoreArmorChance;
|
||||
private int $anticritChance;
|
||||
private int $antievadeChance;
|
||||
private int $defence;
|
||||
private int $airdefence;
|
||||
private int $waterdefence;
|
||||
private int $firedefence;
|
||||
private int $earthdefence;
|
||||
private int $armor;
|
||||
private int $team;
|
||||
|
||||
public function __construct(private readonly int $id)
|
||||
{
|
||||
$u = User::start($id, true);
|
||||
$this->obraz = $u->info['sex'] . DIRECTORY_SEPARATOR . $u->info['obraz'];
|
||||
$this->login = $u->info['login'];
|
||||
$this->level = $u->info['level'];
|
||||
$this->life = $u->stats['hpNow'];
|
||||
$this->mana = $u->stats['mpNow'];
|
||||
$this->maxlife = $u->stats['hpAll'];
|
||||
$this->maxmana = $u->stats['mpAll'];
|
||||
$this->damage = mt_rand(0, 100);
|
||||
$this->armor = mt_rand(0, 5);
|
||||
$this->damageMultiplier = $u->stats['m10'];
|
||||
$this->critChance = $u->stats['m1'];
|
||||
$this->critMultiplier = $u->stats['m3'];
|
||||
$this->evadeChance = $u->stats['m4'];
|
||||
$this->counterstrikeChance = $u->stats['m6'];
|
||||
$this->parryChance = $u->stats['m7'];
|
||||
$this->shieldblockChance = $u->stats['m8'];
|
||||
$this->ignoreArmorChance = $u->stats['m9'];
|
||||
$this->anticritChance = $u->stats['m2'];
|
||||
$this->antievadeChance = $u->stats['m5'];
|
||||
$this->defence = $u->stats['za']; // ой не та это защита, ой не та. ещё ж броня должна быть.
|
||||
$this->airdefence = $u->stats['zm2'];
|
||||
$this->waterdefence = $u->stats['zm3'];
|
||||
$this->firedefence = $u->stats['zm1'];
|
||||
$this->earthdefence = $u->stats['zm4'];
|
||||
$this->team = $u->info['team'];
|
||||
unset($u);
|
||||
}
|
||||
|
||||
public function get(): object
|
||||
{
|
||||
return (object)[
|
||||
'damage' => $this->damage,
|
||||
'armor' => $this->armor + $this->defence,
|
||||
'health' => $this->life,
|
||||
'name' => $this->login,
|
||||
'crit' => $this->critChance,
|
||||
'evade' => $this->evadeChance,
|
||||
];
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
||||
$dmg = Math::addPercent($this->damage, $this->damageMultiplier);
|
||||
return <<<RETURN
|
||||
$this->login [$this->level] <a href="/info/$this->id" target="_blank">id:$this->id</a> <br>
|
||||
Здоровье: $this->life / $this->maxlife <br>
|
||||
Мана: $this->mana / $this->maxmana <br><hr>
|
||||
<!-- <img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>-->
|
||||
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
|
||||
Броня: $this->armor <br><hr>
|
||||
Крит: $this->critChance% <br>
|
||||
Антикрит $this->anticritChance% <br>
|
||||
Мощность крита $this->critMultiplier% <br>
|
||||
Уровот $this->evadeChance% <br>
|
||||
Антиуворот $this->antievadeChance% <br>
|
||||
Контрудар $this->counterstrikeChance% <br>
|
||||
<!-- Парирование $this->parryChance% <br>-->
|
||||
<!-- Блок щитом $this->shieldblockChance% <br>-->
|
||||
<!-- Игнор брони $this->ignoreArmorChance% <br>-->
|
||||
Защита от урона $this->defence <br>
|
||||
Зашита от огня $this->firedefence <br>
|
||||
Защита от воды $this->waterdefence <br>
|
||||
Защита от воздуха $this->airdefence <br>
|
||||
Защита от земли $this->earthdefence <br><hr>
|
||||
Сражается за команду: $this->team
|
||||
RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
/app/_incl_data/class/Battle.php:471:
|
||||
array (size=126)
|
||||
'zag' => string '' (length=0)
|
||||
'id' => int 27205347
|
||||
'login' => string 'Merlin' (length=6)
|
||||
'login2' => string '' (length=0)
|
||||
'online' => int 1704494746
|
||||
'admin' => int 1
|
||||
'city' => string 'capitalcity' (length=11)
|
||||
'cityreg' => string 'capitalcity' (length=11)
|
||||
'align' => string '1.99' (length=4)
|
||||
'align_lvl' => int 0
|
||||
'align_exp' => int 0
|
||||
'clan' => int 0
|
||||
'level' => int 8
|
||||
'money' => float 62531.5
|
||||
'money3' => float 30
|
||||
'money2' => float 15
|
||||
'money4' => float 40
|
||||
'battle' => int 466011
|
||||
'sex' => int 0
|
||||
'obraz' => string '78.gif' (length=6)
|
||||
'win' => int 0
|
||||
'win_t' => int 0
|
||||
'lose' => int 4
|
||||
'lose_t' => int 0
|
||||
'nich' => int 16
|
||||
'timeMain' => int 1704494746
|
||||
'invis' => int 0
|
||||
'bot_id' => int 0
|
||||
'animal' => int 0
|
||||
'type_pers' => int 0
|
||||
'notrhod' => int -1
|
||||
'bot_room' => int 0
|
||||
'inUser' => int 0
|
||||
'inTurnir' => int 0
|
||||
'inTurnirnew' => int 0
|
||||
'stopexp' => int 0
|
||||
'real' => int 1
|
||||
'stats' => string 's1=3|s2=3|s3=3|s4=250|rinv=40|m9=5|m6=10|s7="0"|a1=0|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0' (length=175)
|
||||
'hpNow' => int 1132
|
||||
'mpNow' => int 0
|
||||
'enNow' => int 0
|
||||
'hpAll' => int 2130
|
||||
'mpAll' => int 0
|
||||
'regHP' => int 1704492966
|
||||
'regMP' => int 1704492966
|
||||
'showmenu' => string '1|1|1|1|1|1|1|1' (length=15)
|
||||
'prmenu' => string '0|1|2|3|4|5|6|7' (length=15)
|
||||
'ability' => int 78
|
||||
'skills' => int 9
|
||||
'sskills' => int 0
|
||||
'nskills' => int 0
|
||||
'exp' => int 250
|
||||
'minHP' => int 15
|
||||
'minMP' => int 8
|
||||
'zv' => int 0
|
||||
'dn' => int 0
|
||||
'dnow' => int 0
|
||||
'team' => int 1
|
||||
'battle_yron' => int 0
|
||||
'battle_exp' => int 0
|
||||
'enemy' => int 27319397
|
||||
'last_a' => int 0
|
||||
'last_b' => int 0
|
||||
'battle_text' => string '' (length=0)
|
||||
'upLevel' => int 57
|
||||
'wipe' => int 0
|
||||
'bagStats' => string '0' (length=1)
|
||||
'timeGo' => int 1704297684
|
||||
'timeGoL' => int 1704297679
|
||||
'nextAct' => string '64e9f79e15fca80055d7eabb26f390a4' (length=32)
|
||||
'active' => string '' (length=0)
|
||||
'bot' => int 0
|
||||
'lastAlign' => string '' (length=0)
|
||||
'tactic1' => int 0
|
||||
'tactic2' => int 0
|
||||
'tactic3' => int 0
|
||||
'tactic4' => int 7
|
||||
'tactic5' => int 0
|
||||
'tactic6' => float 0
|
||||
'tactic7' => float 20
|
||||
'x' => int 3
|
||||
'y' => int 4
|
||||
's' => int 1
|
||||
'battleEnd' => int 0
|
||||
'priemslot' => int 10
|
||||
'priems' => string '0|2|3|0|0|138|235|213|140|4|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' (length=87)
|
||||
'priems_z' => string '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|0|0|0|0|0|0|0|0|0|0' (length=101)
|
||||
'bet' => int 0
|
||||
'clone' => int 0
|
||||
'atack' => int 0
|
||||
'bbexp' => int 0
|
||||
'ref_data' => string '' (length=0)
|
||||
'res_x' => int 0
|
||||
'res_y' => int 0
|
||||
'res_s' => int 1
|
||||
'bn_capitalcity' => int 0
|
||||
'bn_demonscity' => int 0
|
||||
'smena' => int 3
|
||||
'last_hp' => int -20
|
||||
'last_pr' => int 0
|
||||
'transfers' => int 65000
|
||||
'btl_cof' => int 381
|
||||
'dieline' => int 0
|
||||
'lider' => int 462716
|
||||
'old_battle' => int 10
|
||||
'alog' => int 0
|
||||
'mlog' => int 0
|
||||
'seff' => null
|
||||
'upexpdate' => int 1671486569
|
||||
'expstopu' => int 0
|
||||
'repexp' => int 35
|
||||
/app/_incl_data/class/Battle.php:471:
|
||||
array (size=102)
|
||||
'a1' => int 0
|
||||
'a2' => int 0
|
||||
'a3' => int 0
|
||||
'a4' => int 0
|
||||
'a5' => int 0
|
||||
'aall' => int 0
|
||||
'm1' => int 15
|
||||
'm10' => int 90
|
||||
'm11' => int 0
|
||||
'm14' => int 0
|
||||
'm15' => int 0
|
||||
'm18' => int 0
|
||||
'm19' => int 0
|
||||
'm2' => int 15
|
||||
'm3' => int 0
|
||||
'm4' => int 15
|
||||
'm5' => int 15
|
||||
'm6' => int 10
|
||||
'm7' => int 0
|
||||
'm8' => int 0
|
||||
'm9' => int 5
|
||||
'mall' => int 0
|
||||
'mg1' => int 0
|
||||
'mg2' => int 0
|
||||
'mg3' => int 0
|
||||
'mg4' => int 0
|
||||
'mg7' => int 0
|
||||
'pa1' => int 0
|
||||
'pa2' => int 0
|
||||
'pa3' => int 0
|
||||
'pa4' => int 0
|
||||
'pm1' => int 0
|
||||
'pm2' => int 0
|
||||
'pm3' => int 0
|
||||
'pm4' => int 0
|
||||
'pm7' => int 0
|
||||
's1' => int 3
|
||||
's2' => int 3
|
||||
's3' => int 3
|
||||
's4' => int 250
|
||||
's5' => int 0
|
||||
's6' => int 0
|
||||
's7' => int 0
|
||||
'za' => int 375
|
||||
'za1' => int 375
|
||||
'za2' => int 375
|
||||
'za3' => int 375
|
||||
'za4' => int 375
|
||||
'zm' => int 125
|
||||
'zm1' => int 125
|
||||
'zm2' => int 125
|
||||
'zm3' => int 125
|
||||
'zm4' => int 125
|
||||
'zona' => int 2
|
||||
'zonb' => int 2
|
||||
'levels' =>
|
||||
array (size=17)
|
||||
'upLevel' => int 57
|
||||
'nextLevel' => int 8
|
||||
'exp' => int 200000
|
||||
'money' => int 0
|
||||
'money_bonus1' => int 0
|
||||
'money_bonus2' => int 0
|
||||
'ability' => int 0
|
||||
'skills' => int 0
|
||||
'nskills' => int 0
|
||||
'sskills' => int 0
|
||||
'expBtlMax' => int 5000
|
||||
'bprice' => int 2300
|
||||
'hpRegen' => int 250
|
||||
'mpRegen' => int 250
|
||||
'money2' => float 0.5
|
||||
'duh' => int 0
|
||||
'vinos' => int 0
|
||||
'id' => int 27205347
|
||||
'login' => string 'Merlin' (length=6)
|
||||
'hpNow' => int 1132
|
||||
'mpNow' => int 0
|
||||
'items' =>
|
||||
array (size=5)
|
||||
0 =>
|
||||
array (size=14)
|
||||
'type' => int 1
|
||||
'data' => string '' (length=0)
|
||||
'inOdet' => int 1
|
||||
'item_id' => int 391
|
||||
'inslot' => int 1
|
||||
'useInBattle' => int 0
|
||||
'btl_zd' => int 0
|
||||
'iznosNOW' => float 0.7
|
||||
'iznosMAX' => float 30
|
||||
'magic_inci' => string '' (length=0)
|
||||
'name' => string 'Серый Шлем' (length=19)
|
||||
'id' => int 75917766
|
||||
'img' => string 'helmet77.gif' (length=12)
|
||||
'2h' => int 0
|
||||
1 =>
|
||||
array (size=14)
|
||||
'type' => int 26
|
||||
'data' => string 'tr_lvl=4|sv_yron_min=5|sv_yron_max=10|tya1=20|tya3=80' (length=53)
|
||||
'inOdet' => int 3
|
||||
'item_id' => int 631
|
||||
'inslot' => int 3
|
||||
'useInBattle' => int 0
|
||||
'btl_zd' => int 0
|
||||
'iznosNOW' => float 0.55
|
||||
'iznosMAX' => float 110
|
||||
'magic_inci' => string '' (length=0)
|
||||
'name' => string 'Укрепленный Костыль ' (length=38)
|
||||
'id' => int 75917784
|
||||
'img' => string 'kostyl2.gif' (length=11)
|
||||
'2h' => int 0
|
||||
2 =>
|
||||
array (size=14)
|
||||
'type' => int 29
|
||||
'data' => string '' (length=0)
|
||||
'inOdet' => int 54
|
||||
'item_id' => int 1032
|
||||
'inslot' => int 53
|
||||
'useInBattle' => int 1
|
||||
'btl_zd' => int 0
|
||||
'iznosNOW' => float 0
|
||||
'iznosMAX' => float 3
|
||||
'magic_inci' => string '446' (length=3)
|
||||
'name' => string 'Живая Вода' (length=19)
|
||||
'id' => int 75917747
|
||||
'img' => string 'invoke_kar3_lifew.gif' (length=21)
|
||||
'2h' => int 0
|
||||
3 =>
|
||||
array (size=14)
|
||||
'type' => int 29
|
||||
'data' => string '' (length=0)
|
||||
'inOdet' => int 53
|
||||
'item_id' => int 1034
|
||||
'inslot' => int 53
|
||||
'useInBattle' => int 1
|
||||
'btl_zd' => int 0
|
||||
'iznosNOW' => float 0
|
||||
'iznosMAX' => float 3
|
||||
'magic_inci' => string '449' (length=3)
|
||||
'name' => string 'Сушеный Мухомор' (length=29)
|
||||
'id' => int 75917742
|
||||
'img' => string 'invoke_kar3_mush.gif' (length=20)
|
||||
'2h' => int 0
|
||||
4 =>
|
||||
array (size=14)
|
||||
'type' => int 18
|
||||
'data' => string 'tr_lvl=8|tr_s2=30|tr_s3=30|tr_s1=15|tr_s4=30|tr_a1=9|add_m4=40|add_s2=1|add_s3=2|sv_yron_min=5|sv_yron_max=15|add_m5=30|add_m1=30|add_m9=15|complect=106|tya1=75|tya3=25||fromshop=1' (length=180)
|
||||
'inOdet' => int 14
|
||||
'item_id' => int 6473
|
||||
'inslot' => int 3
|
||||
'useInBattle' => int 0
|
||||
'btl_zd' => int 0
|
||||
'iznosNOW' => float 0.7
|
||||
'iznosMAX' => float 25
|
||||
'magic_inci' => string '' (length=0)
|
||||
'name' => string 'Кинжал Злодеяний [8]' (length=35)
|
||||
'id' => int 75917776
|
||||
'img' => string 'knife76.gif' (length=11)
|
||||
'2h' => int 0
|
||||
'effects' =>
|
||||
array (size=1)
|
||||
0 =>
|
||||
array (size=41)
|
||||
'id' => int 106916938
|
||||
'id_eff' => int 31
|
||||
'uid' => int 27205347
|
||||
'name' => string 'Касание Хаоса' (length=25)
|
||||
'data' => string 'nofastfinisheff=1' (length=17)
|
||||
'overType' => int 0
|
||||
'timeUse' => int 1704492685
|
||||
'timeAce' => int 0
|
||||
'user_use' => string '' (length=0)
|
||||
'delete' => int 0
|
||||
'v1' => string '0' (length=1)
|
||||
'v2' => int 0
|
||||
'img2' => string '' (length=0)
|
||||
'x' => int 1
|
||||
'hod' => int -1
|
||||
'bj' => string '0' (length=1)
|
||||
'sleeptime' => int 0
|
||||
'no_Ace' => int 0
|
||||
'file_finish' => string '' (length=0)
|
||||
'tr_life_user' => int 0
|
||||
'deactiveTime' => int 0
|
||||
'deactiveLast' => int 0
|
||||
'mark' => int 0
|
||||
'bs' => int 0
|
||||
'id2' => int 31
|
||||
'mname' => string 'Касание Хаоса' (length=25)
|
||||
'type1' => int 21
|
||||
'img' => string 'survival_timeout.gif' (length=20)
|
||||
'mdata' => string 'nofastfinisheff=1' (length=17)
|
||||
'actionTime' => int 86400
|
||||
'type2' => int 6
|
||||
'type3' => int 6
|
||||
'onlyOne' => int 1
|
||||
'oneType' => int 0
|
||||
'noAce' => int 0
|
||||
'see' => int 1
|
||||
'info' => string 'Вы слишком близко приблизились к центру Излома Хаоса' (length=97)
|
||||
'overch' => int 0
|
||||
'bp' => int 1
|
||||
'noch' => int 0
|
||||
'minfo' => string '' (length=0)
|
||||
'vip' => null
|
||||
'rinv' => int 40
|
||||
'mg5' => int 0
|
||||
'mg6' => int 0
|
||||
'a6' => int 0
|
||||
's8' => int 0
|
||||
's9' => int 0
|
||||
's10' => int 0
|
||||
's11' => int 0
|
||||
's12' => int 0
|
||||
's13' => int 0
|
||||
's14' => int 0
|
||||
's15' => int 0
|
||||
'wp1id' => int 0
|
||||
'reting' => int 3
|
||||
'wp3id' => int 1
|
||||
'wp54id' => int 2
|
||||
'wp53id' => int 3
|
||||
'wp14id' => int 4
|
||||
'set_pog' =>
|
||||
array (size=0)
|
||||
empty
|
||||
'set_pog2' =>
|
||||
array (size=0)
|
||||
empty
|
||||
'ozash' =>
|
||||
array (size=4)
|
||||
1 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
2 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
3 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
4 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
'ozmsh' =>
|
||||
array (size=4)
|
||||
1 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
2 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
3 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
4 =>
|
||||
array (size=2)
|
||||
0 => int 0
|
||||
1 => int 0
|
||||
'weapon1' => int 1
|
||||
'weapon2' => int 1
|
||||
'sheld1' => int 0
|
||||
'sv_' =>
|
||||
array (size=57)
|
||||
'a1' => int 0
|
||||
'a2' => int 0
|
||||
'a3' => int 0
|
||||
'a4' => int 0
|
||||
'a5' => int 0
|
||||
'aall' => int 0
|
||||
'hpall' => int 0
|
||||
'm1' => int 0
|
||||
'm10' => int 0
|
||||
'm11' => int 0
|
||||
'm14' => int 0
|
||||
'm15' => int 0
|
||||
'm18' => int 0
|
||||
'm19' => int 0
|
||||
'm2' => int 0
|
||||
'm3' => int 0
|
||||
'm4' => int 0
|
||||
'm5' => int 0
|
||||
'm6' => int 0
|
||||
'm7' => int 0
|
||||
'm8' => int 0
|
||||
'm9' => int 0
|
||||
'mall' => int 0
|
||||
'mg1' => int 0
|
||||
'mg2' => int 0
|
||||
'mg3' => int 0
|
||||
'mg4' => int 0
|
||||
'mg7' => int 0
|
||||
'mpall' => int 0
|
||||
'pa1' => int 0
|
||||
'pa2' => int 0
|
||||
'pa3' => int 0
|
||||
'pa4' => int 0
|
||||
'pm1' => int 0
|
||||
'pm2' => int 0
|
||||
'pm3' => int 0
|
||||
'pm4' => int 0
|
||||
'pm7' => int 0
|
||||
's1' => int 0
|
||||
's2' => int 0
|
||||
's3' => int 0
|
||||
's4' => int 0
|
||||
's5' => int 0
|
||||
's6' => int 0
|
||||
's7' => int 0
|
||||
'za' => int 0
|
||||
'za1' => int 0
|
||||
'za2' => int 0
|
||||
'za3' => int 0
|
||||
'za4' => int 0
|
||||
'zm' => int 0
|
||||
'zm1' => int 0
|
||||
'zm2' => int 0
|
||||
'zm3' => int 0
|
||||
'zm4' => int 0
|
||||
'zona' => int 0
|
||||
'zonb' => int 0
|
||||
'sv_i' =>
|
||||
array (size=57)
|
||||
'a1' => int 0
|
||||
'a2' => int 0
|
||||
'a3' => int 0
|
||||
'a4' => int 0
|
||||
'a5' => int 0
|
||||
'aall' => int 0
|
||||
'hpall' => int 0
|
||||
'm1' => int 0
|
||||
'm10' => int 0
|
||||
'm11' => int 0
|
||||
'm14' => int 0
|
||||
'm15' => int 0
|
||||
'm18' => int 0
|
||||
'm19' => int 0
|
||||
'm2' => int 0
|
||||
'm3' => int 0
|
||||
'm4' => int 0
|
||||
'm5' => int 0
|
||||
'm6' => int 0
|
||||
'm7' => int 0
|
||||
'm8' => int 0
|
||||
'm9' => int 0
|
||||
'mall' => int 0
|
||||
'mg1' => int 0
|
||||
'mg2' => int 0
|
||||
'mg3' => int 0
|
||||
'mg4' => int 0
|
||||
'mg7' => int 0
|
||||
'mpall' => int 0
|
||||
'pa1' => int 0
|
||||
'pa2' => int 0
|
||||
'pa3' => int 0
|
||||
'pa4' => int 0
|
||||
'pm1' => int 0
|
||||
'pm2' => int 0
|
||||
'pm3' => int 0
|
||||
'pm4' => int 0
|
||||
'pm7' => int 0
|
||||
's1' => int 0
|
||||
's2' => int 0
|
||||
's3' => int 0
|
||||
's4' => int 0
|
||||
's5' => int 0
|
||||
's6' => int 0
|
||||
's7' => int 0
|
||||
'za' => int 0
|
||||
'za1' => int 0
|
||||
'za2' => int 0
|
||||
'za3' => int 0
|
||||
'za4' => int 0
|
||||
'zm' => int 0
|
||||
'zm1' => int 0
|
||||
'zm2' => int 0
|
||||
'zm3' => int 0
|
||||
'zm4' => int 0
|
||||
'zona' => int 0
|
||||
'zonb' => int 0
|
||||
'dom' =>
|
||||
array (size=0)
|
||||
empty
|
||||
'prsu' =>
|
||||
array (size=0)
|
||||
empty
|
||||
'x' => int 3
|
||||
'y' => int 4
|
||||
's' => int 1
|
||||
'maxves' => int 100
|
||||
'speed_dungeon' => int 500
|
||||
'speedhp' => int 500
|
||||
'this_animal' => int 0
|
||||
'lvl' => int 8
|
||||
'hpAll' => int 2130
|
||||
'mpAll' => int 0
|
||||
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
208
_incl_data/class/Battle/Info.php
Normal file
208
_incl_data/class/Battle/Info.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Info
|
||||
{
|
||||
public readonly int $id;
|
||||
public readonly string $city;
|
||||
public readonly int $timeStart;
|
||||
public readonly int $testFinish;
|
||||
public readonly string $players;
|
||||
public readonly int $timeout;
|
||||
public readonly int $type;
|
||||
public readonly int $status;
|
||||
public readonly int $kulak;
|
||||
public readonly int $invis;
|
||||
public readonly int $noinc;
|
||||
public readonly int $travmchance;
|
||||
public readonly int $typebattle;
|
||||
private float $addexp;
|
||||
public readonly float $money;
|
||||
public readonly float $money3;
|
||||
public readonly int $timeover;
|
||||
private int $teamwin;
|
||||
public readonly string $dungeon;
|
||||
public readonly int $razdel;
|
||||
public readonly int $dnId;
|
||||
public readonly int $x;
|
||||
public readonly int $y;
|
||||
public readonly string $fdate;
|
||||
public readonly int $izlom;
|
||||
public readonly int $izlomlvl;
|
||||
private int $izlomround;
|
||||
private int $start1;
|
||||
private int $start2;
|
||||
public readonly int $izlomroundsee;
|
||||
public readonly int $izlomobr;
|
||||
public readonly int $izlomobrnow;
|
||||
public readonly int $turnir;
|
||||
public readonly int $inturnir;
|
||||
public readonly int $clone;
|
||||
private int $playersC;
|
||||
private int $playersCC;
|
||||
private int $playersCC2;
|
||||
public readonly int $fastfight;
|
||||
public readonly ?int $nobot;
|
||||
public readonly ?int $kingfight;
|
||||
public readonly ?int $arand;
|
||||
public readonly ?int $noatack;
|
||||
public readonly ?int $noeff;
|
||||
public readonly ?int $smert;
|
||||
public readonly ?int $noart;
|
||||
public readonly int $zarad;
|
||||
public readonly int $priz;
|
||||
public readonly int $otmorozok;
|
||||
public readonly int $otmorozokUse;
|
||||
public readonly int $hod;
|
||||
public readonly int $clan1;
|
||||
public readonly int $clan2;
|
||||
|
||||
public function getAddexp(): float
|
||||
{
|
||||
return $this->addexp;
|
||||
}
|
||||
|
||||
public function getTeamwin(): int
|
||||
{
|
||||
return $this->teamwin;
|
||||
}
|
||||
|
||||
public function getIzlomround(): int
|
||||
{
|
||||
return $this->izlomround;
|
||||
}
|
||||
|
||||
public function getStart1(): int
|
||||
{
|
||||
return $this->start1;
|
||||
}
|
||||
|
||||
public function getStart2(): int
|
||||
{
|
||||
return $this->start2;
|
||||
}
|
||||
|
||||
public function getPlayersC(): int
|
||||
{
|
||||
return $this->playersC;
|
||||
}
|
||||
|
||||
public function getPlayersCC(): int
|
||||
{
|
||||
return $this->playersCC;
|
||||
}
|
||||
|
||||
public function getPlayersCC2(): int
|
||||
{
|
||||
return $this->playersCC2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Иноформация о поединке.
|
||||
* @param int $battleId
|
||||
*/
|
||||
public function __construct(int $battleId)
|
||||
{
|
||||
$b = Db::getRow('select * from battle where id = ?', [$battleId]);
|
||||
if (!$b) {
|
||||
return;
|
||||
}
|
||||
$this->id = $b['id'];
|
||||
$this->city = $b['city'];
|
||||
$this->timeStart = $b['time_start'];
|
||||
$this->testFinish = $b['testfinish'];
|
||||
$this->players = $b['players'];
|
||||
$this->timeout = $b['timeout'];
|
||||
$this->type = $b['type'];
|
||||
$this->status = $b['status'];
|
||||
$this->kulak = $b['kulak'];
|
||||
$this->invis = $b['invis'];
|
||||
$this->noinc = $b['noinc'];
|
||||
$this->travmchance = $b['travmChance'];
|
||||
$this->typebattle = $b['typeBattle'];
|
||||
$this->addexp = $b['addExp'];
|
||||
$this->money = $b['money'];
|
||||
$this->money3 = $b['money3'];
|
||||
$this->timeover = $b['time_over'];
|
||||
$this->teamwin = $b['team_win'];
|
||||
$this->dungeon = $b['dungeon'];
|
||||
$this->razdel = $b['razdel'];
|
||||
$this->dnId = $b['dn_id'];
|
||||
$this->x = $b['x'];
|
||||
$this->y = $b['y'];
|
||||
$this->fdate = $b['fDate'];
|
||||
$this->izlom = $b['izlom'];
|
||||
$this->izlomlvl = $b['izlomLvl'];
|
||||
$this->izlomround = $b['izlomRound'];
|
||||
$this->start1 = $b['start1'];
|
||||
$this->start2 = $b['start2'];
|
||||
$this->izlomroundsee = $b['izlomRoundSee'];
|
||||
$this->izlomobr = $b['izlomObr'];
|
||||
$this->izlomobrnow = $b['izlomObrNow'];
|
||||
$this->turnir = $b['turnir'];
|
||||
$this->inturnir = $b['inTurnir'];
|
||||
$this->clone = $b['clone'];
|
||||
$this->playersC = $b['players_c'];
|
||||
$this->fastfight = $b['fastfight'];
|
||||
$this->nobot = $b['nobot'];
|
||||
$this->kingfight = $b['kingfight'];
|
||||
$this->arand = $b['arand'];
|
||||
$this->noatack = $b['noatack'];
|
||||
$this->noeff = $b['noeff'];
|
||||
$this->smert = $b['smert'];
|
||||
$this->noart = $b['noart'];
|
||||
$this->zarad = $b['zarad'];
|
||||
$this->priz = $b['priz'];
|
||||
$this->otmorozok = $b['otmorozok'];
|
||||
$this->otmorozokUse = $b['otmorozok_use'];
|
||||
$this->hod = $b['hod'];
|
||||
$this->clan1 = $b['clan1'];
|
||||
$this->clan2 = $b['clan2'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ничья
|
||||
* @return void
|
||||
*/
|
||||
public function setDraw(): void
|
||||
{
|
||||
$this->playersCC = 0;
|
||||
$this->playersCC2 = 0;
|
||||
}
|
||||
|
||||
public function setTeamWin(int $team = 0): void
|
||||
{
|
||||
$this->teamwin = $team;
|
||||
}
|
||||
|
||||
public function modifyAddExp(int $value): void
|
||||
{
|
||||
$this->addexp += $value;
|
||||
}
|
||||
|
||||
public function setStart1(): void
|
||||
{
|
||||
$this->start1 = time();
|
||||
}
|
||||
|
||||
public function setStart2(): void
|
||||
{
|
||||
$this->start2 = time();
|
||||
}
|
||||
|
||||
public function setIzlomround(int $izlomround): void
|
||||
{
|
||||
$this->izlomround = $izlomround;
|
||||
}
|
||||
|
||||
public function setPlayerC(): void
|
||||
{
|
||||
$this->playersC =
|
||||
Db::getValue("select count(id) from users where login not like '%(зверь%' and battle = ?", [$this->id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Battle;
|
||||
use Core\Db;
|
||||
|
||||
class Log
|
||||
@@ -38,10 +37,14 @@ class Log
|
||||
$data['type'],
|
||||
]
|
||||
);
|
||||
|
||||
if (Helper::getChanse(12)) {
|
||||
self::addComment($data['battle'], $data['id_hod']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function addComment(Battle $battle): void
|
||||
private static function addComment(int $battleId, int $hodId): void
|
||||
{
|
||||
$comments = [
|
||||
'А танцуешь ты лучше.',
|
||||
@@ -172,8 +175,8 @@ class Log
|
||||
|
||||
self::add(
|
||||
[
|
||||
'battle' => $battle->info['id'],
|
||||
'id_hod' => $battle->hodID,
|
||||
'battle' => $battleId,
|
||||
'id_hod' => $hodId,
|
||||
'text' => "{tm1} <i>Комментатор: $randomcomment</i>",
|
||||
'vars' => 'time1=' . time(),
|
||||
'type' => 1,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use Model\Constant\Stat;
|
||||
|
||||
class BotPriemLogic
|
||||
{
|
||||
@@ -104,9 +106,9 @@ class BotPriemLogic
|
||||
|
||||
private static function testpriem($pl): int
|
||||
{
|
||||
global $u;
|
||||
$notr = 0;
|
||||
|
||||
$statnames = new Stat();
|
||||
$statnames->getRequirement();
|
||||
$tr = Conversion::dataStringToArray($pl['tr']);
|
||||
$d2 = Conversion::dataStringToArray($pl['date2']);
|
||||
|
||||
@@ -123,16 +125,16 @@ class BotPriemLogic
|
||||
}
|
||||
|
||||
if ($pl['xuse'] > 0) {
|
||||
$xu = $u->testAction('`vars` = "use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', 2);
|
||||
if ($xu[0] >= $pl['xuse']) {
|
||||
$xu = ActionModel::testCount(['vars = ' . 'use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'], "vals = {$pl['id']}",], $pl['xuse']);
|
||||
if ($xu >= $pl['xuse']) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
|
||||
$x = 0;
|
||||
$t = $u->items['tr'];
|
||||
while ($x < count($t)) {
|
||||
$n = $t[$x];
|
||||
|
||||
while ($x < count($statnames->sysRequirementNames)) {
|
||||
$n = $statnames->sysRequirementNames[$x];
|
||||
if (isset($tr['tr_' . $n])) {
|
||||
if ($n == 'lvl') {
|
||||
if ($tr['tr_' . $n] > BotLogic::$bot['level']) {
|
||||
|
||||
@@ -10,29 +10,103 @@ use User\ItemsModel;
|
||||
|
||||
class ItemStorage
|
||||
{
|
||||
private string $error = '';
|
||||
|
||||
public function put(int $itemId, int $clanId): string
|
||||
private string $error = '';
|
||||
private int $clanId;
|
||||
private int $userId;
|
||||
private string $userLogin;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$user = User::start()->info;
|
||||
$item = ItemsModel::getOwnedItemById($itemId, $user['id']);
|
||||
$clanName = Db::getValue('select name from clan where id = ?', [$clanId]) ?? '';
|
||||
$userinfo = User::start()->info;
|
||||
$this->userId = $userinfo['id'];
|
||||
$this->clanId = $userinfo['clan'];
|
||||
$this->userLogin = $userinfo['login'];
|
||||
}
|
||||
|
||||
public function take(int $itemId): string
|
||||
{
|
||||
$item = Db::getRows('select items_users.id, name, data from items_users inner join items_main on item_id = items_main.id where uid = ? and items_users.id = ?', ["-21$this->clanId", $itemId]);
|
||||
|
||||
if (!isset($item['id'])) {
|
||||
return 'Предмет не найден.<br>' . $itemId;
|
||||
}
|
||||
|
||||
$data = Conversion::dataStringToArray($item['data']);
|
||||
$cls = isset($data['toclan']) ? explode('#', $data['toclan'])[1] : 0;
|
||||
$col = ItemsModel::itemsX($itemId);
|
||||
|
||||
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ? where id = ?', [$this->userId, $itemId]);
|
||||
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,5,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$item['name']} (x$col) Id:$itemId Хозяин: $cls", $this->userId]);
|
||||
|
||||
return "Вы успешно взяли предмет «{$item['name']}» из хранилища.";
|
||||
}
|
||||
|
||||
public function remove(int $type): void
|
||||
{
|
||||
$storedItems = Db::getRows('select items_users.id, uid, name, data, inOdet from items_users inner join items_main on item_id = items_main.id where uid = ? or data like ?', ["-21$this->clanId", "%toclan=$this->clanId#%"]);
|
||||
|
||||
foreach ($storedItems as $storedItem) {
|
||||
$data = Conversion::dataStringToArray($storedItem['data']);
|
||||
$cls = isset($data['toclan']) ? explode('#', $data['toclan'])[1] : 0;
|
||||
$col = ItemsModel::itemsX($storedItem['id']);
|
||||
|
||||
if ($cls == $this->userId) {
|
||||
if ($storedItem['uid'] != $this->userId && $storedItem['inOdet'] != 0) {
|
||||
Db::sql('update items_users set inOdet = 0 where id = ?', [$storedItem['id']]);
|
||||
}
|
||||
unset($data['toclan']);
|
||||
$storedItem['data'] = Conversion::arrayToDataString($data);
|
||||
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ?, data = ? where id = ?', [$this->userId, $storedItem['data'], $storedItem['id']]);
|
||||
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,?,?,unix_timestamp(),?,?)', [$this->clanId, $type, $this->userLogin, "{$storedItem['name']} (x$col) Id:{$storedItem['id']}", $this->userId]);
|
||||
} elseif ($storedItem['uid'] == $this->userId) {
|
||||
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ? where id = ?', ["-21$this->clanId", $storedItem['id']]);
|
||||
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,9,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$storedItem['name']} (x$col) Id:{$storedItem['id']}", $this->userId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function backToOwner(int $itemId): string
|
||||
{
|
||||
$item = ItemsModel::getOwnedItemById($itemId, $this->userId, true);
|
||||
if (empty($item)) {
|
||||
return 'Предмет не найден.';
|
||||
}
|
||||
|
||||
$ownerIsNotReal = !Db::getValue('select count(id) from stats where id = ? and (bot = 0 or clone = 0)', [$item['uid']]);
|
||||
if ($ownerIsNotReal) {
|
||||
return 'Вы не можете изьять данный предмет, он не принадлежит клану.';
|
||||
}
|
||||
|
||||
$iw = $item['inOdet'] > 0 ? 'inOdet = 0' : '';
|
||||
$col = ItemsModel::itemsX($itemId);
|
||||
|
||||
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,6,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$item['name']} (x$col) Id:$itemId У персонажа: {$item['uid']}", $this->userId]);
|
||||
Db::sql("update items_users set lastUPD = unix_timestamp(), $iw, uid = ? where id = ?", ["-21$this->clanId", $itemId]);
|
||||
|
||||
return "Вы успешно изъяли предмет «{$item['name']}»";
|
||||
}
|
||||
|
||||
public function put(int $itemId): string
|
||||
{
|
||||
$item = ItemsModel::getOwnedItemById($itemId, $this->userId);
|
||||
$clanName = Db::getValue('select name from clan where id = ?', [$this->clanId]) ?? '';
|
||||
if (empty($clanName)) {
|
||||
return 'Клан не найден.';
|
||||
}
|
||||
if (!$this->isGoodForStorage($item, $user['clan'])) {
|
||||
if (!$this->isGoodForStorage($item)) {
|
||||
return $this->error;
|
||||
}
|
||||
$col = User::start()->itemsX(($itemId));
|
||||
$col = ItemsModel::itemsX($itemId);
|
||||
$idata = Conversion::dataStringToArray($item['data']);
|
||||
if (!isset($idata['toclan'])) {
|
||||
$idata['toclan'] = $user['clan'] . '#' . $user['id'];
|
||||
$idata['toclan'] = $this->clanId . '#' . $this->userId;
|
||||
$item['data'] = Conversion::arrayToDataString($idata);
|
||||
Delo::add(
|
||||
2,
|
||||
'System.transfer.clan',
|
||||
$user['id'],
|
||||
'"System.transfer.MONEY": Предмет "' . $item['name'] . '" (#id : "' . $itemId . '") (x' . $col . ') был пожертвован клану "' . $clanName . '" (' . $clanId . ').',
|
||||
$this->userId,
|
||||
'"System.transfer.MONEY": Предмет "' . $item['name'] . '" (#id : "' . $itemId . '") (x' . $col . ') был пожертвован клану "' . $clanName . '" (' . $this->clanId . ').',
|
||||
);
|
||||
$sendType = 4;
|
||||
} else {
|
||||
@@ -40,17 +114,17 @@ class ItemStorage
|
||||
}
|
||||
Db::sql(
|
||||
'insert into clan_operations (clan, time, type, text, val, uid) values (?,unix_timestamp(),?,?,?,?)',
|
||||
[$clanId, $sendType, $user['login'], $item['name'] . ("x$col Ид: [$itemId]"), $user['id']]
|
||||
[$this->clanId, $sendType, $this->userLogin, $item['name'] . ("x$col Ид: [$itemId]"), $this->userId]
|
||||
);
|
||||
Db::sql(
|
||||
'update items_users set lastUPD = unix_timestamp(), uid = ?, data = ? where id = ?',
|
||||
['-21' . $user['clan'], $item['data'], $itemId]
|
||||
['-21' . $this->clanId, $item['data'], $itemId]
|
||||
);
|
||||
|
||||
return 'Вы передали предмет "' . $item['name'] . '" клану.';
|
||||
}
|
||||
|
||||
private function isGoodForStorage(array $item, $userClanId): bool
|
||||
private function isGoodForStorage(array $item): bool
|
||||
{
|
||||
if (empty($item['inslot']) || !empty($item['gift'])) {
|
||||
$this->error = 'Предмет не найден.';
|
||||
@@ -64,118 +138,9 @@ class ItemStorage
|
||||
) {
|
||||
$this->error = 'Предмет не подходит.';
|
||||
}
|
||||
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $userClanId) {
|
||||
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $this->clanId) {
|
||||
$this->error = 'Предмет уже принадлежит клану.';
|
||||
}
|
||||
return empty($this->error);
|
||||
}
|
||||
|
||||
public function ungive_itm_cl($id, $user, $cl): string
|
||||
{
|
||||
$itm_ = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
|
||||
$user_itm = mysql_fetch_array(
|
||||
mysql_query('SELECT `id`,`bot`,`clone` FROM `stats` WHERE `id` = "' . $itm_['uid'] . '" LIMIT 1')
|
||||
);
|
||||
if ($user_itm['bot'] > 0 || $user_itm['clone'] > 0 || !isset($user_itm['id'])) {
|
||||
$r = '<font color="#FF0000"><strong>Вы не можете изьять данный предмет, он не принадлежит клану</strong></font><br />';
|
||||
} elseif (isset($itm_['id'])) {
|
||||
|
||||
if ($itm_['inOdet'] != 0) {
|
||||
$o = ', `inOdet` = 0';
|
||||
} else {
|
||||
$o = '';
|
||||
}
|
||||
$r = '<font color="#FF0000"><strong>Вы успешно изъяли предмет "' . $itm_['name'] . '"</strong></font><br />';
|
||||
$col = $this->itemsX(((int)$id));
|
||||
mysql_query(
|
||||
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] | У персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'
|
||||
);
|
||||
|
||||
} else {
|
||||
$r = '<font color="#FF0000"><strong>Предмет не найден.</strong></font><br />';
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function take_itm_cl($id, $user, $cl): string
|
||||
{
|
||||
$itm_ = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "-21' . $user['clan'] . '" AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
|
||||
if (isset($itm_['id'])) {
|
||||
$po = Conversion::dataStringToArray($itm_['data']);
|
||||
if (isset($po['toclan'])) {
|
||||
$cls = explode('#', $po['toclan']);
|
||||
$cls = $cls[1];
|
||||
}
|
||||
|
||||
$col = $this->itemsX(((int)$id));
|
||||
mysql_query(
|
||||
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] Хозяин : [' . $cls . ']", "' . $user['id'] . '")'
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
|
||||
);
|
||||
$r = '<font color="#FF0000"><strong>Вы успешно взяли предмет "' . $itm_['name'] . '" из хранилища</strong></font><br />';
|
||||
|
||||
} else {
|
||||
$r = '<font color="#FF0000"><strong>Предмет не найден.</strong></font><br />' . $id;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function rem_itm_cl($user, $cl, $type)
|
||||
{
|
||||
$itms = mysql_query(
|
||||
'SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")'
|
||||
);
|
||||
while ($pl = mysql_fetch_array($itms)) {
|
||||
$po = Conversion::dataStringToArray($pl['data']);
|
||||
if (isset($po['toclan'])) {
|
||||
$cls = explode('#', $po['toclan']);
|
||||
$cls = $cls[1];
|
||||
}
|
||||
if ($cls == $user['id']) {
|
||||
if ($pl['uid'] != $user['id']) {
|
||||
if ($pl['inOdet'] != 0) {
|
||||
mysql_query('UPDATE `items_users` SET `inOdet` = 0 WHERE `id` = "' . $pl['id'] . '"');
|
||||
}
|
||||
}
|
||||
unset($po['toclan']);
|
||||
$pl['data'] = Conversion::arrayToDataString($po);
|
||||
$col = $this->itemsX(((int)$pl['id']));
|
||||
$it_n = mysql_fetch_array(
|
||||
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'
|
||||
);
|
||||
mysql_query(
|
||||
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
|
||||
);
|
||||
} elseif ($pl['uid'] == $user['id']) {
|
||||
$col = $this->itemsX(((int)$pl['id']));
|
||||
$it_n = mysql_fetch_array(
|
||||
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'
|
||||
);
|
||||
mysql_query(
|
||||
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,35 @@
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\Constant\Stat;
|
||||
use User\ItemsModel;
|
||||
|
||||
class ComissionShop
|
||||
{
|
||||
public function commisionShop($preview = 'full')
|
||||
private array $info;
|
||||
private array $stats;
|
||||
private array $is;
|
||||
private array $rep;
|
||||
/**
|
||||
* @var array|string[]
|
||||
*/
|
||||
private array $align_nm;
|
||||
private array $items;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->info = User::start()->info;
|
||||
$this->rep = User::start()->rep;
|
||||
$this->stats = User::start()->stats;
|
||||
$this->is = User::start()->is;
|
||||
$this->align_nm = User::start()->align_nm;
|
||||
$itemStatNames = new Stat();
|
||||
$itemStatNames->getBonus();
|
||||
$itemStatNames->getRequirement();
|
||||
$this->items['tr'] = $itemStatNames->sysRequirementNames;
|
||||
}
|
||||
|
||||
public function commisionShop($preview = 'full'): void
|
||||
{
|
||||
global $code;
|
||||
$typeOtdel = match ((int)$_GET['otdel']) {
|
||||
@@ -43,8 +68,8 @@ UNION ALL SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1pric
|
||||
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
|
||||
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string(
|
||||
$typeOtdel
|
||||
) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0
|
||||
ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0
|
||||
ORDER BY `1price`, inGroupCount DESC'
|
||||
);
|
||||
} else {
|
||||
$cl = mysql_query(
|
||||
@@ -56,7 +81,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
} else {
|
||||
if ($preview == "full") {
|
||||
$cl = mysql_query(
|
||||
'SELECT
|
||||
'SELECT
|
||||
`items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
|
||||
`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
|
||||
`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
|
||||
@@ -67,11 +92,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
|
||||
`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
|
||||
`items_main`.`lvl_aexp` , count(`items_users`.`id`) as inGroupCount
|
||||
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
|
||||
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
|
||||
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
|
||||
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
|
||||
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
|
||||
GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
|
||||
`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
|
||||
`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
|
||||
@@ -82,15 +107,15 @@ SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item
|
||||
`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
|
||||
`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
|
||||
`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount
|
||||
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
|
||||
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
|
||||
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
|
||||
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
|
||||
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
|
||||
GROUP BY `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup = 0
|
||||
ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
ORDER BY `1price`, inGroupCount DESC'
|
||||
);
|
||||
} else {
|
||||
$cl = mysql_query(
|
||||
'SELECT `items_users`.`id`, `items_users`.`id` AS `idu`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp` FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" GROUP BY `items_users`.`item_id` ORDER BY `items_main`.`id` DESC'
|
||||
'select items_users.id, items_users.id as idu,items_users.item_id,items_users.`1price`,items_users.`2price`,items_users.uid,items_users.use_text,items_users.data,items_users.inOdet,items_users.inShop,items_users.`delete`,items_users.iznosNOW,items_users.iznosMAX,items_users.gift,items_users.gtxt1,items_users.gtxt2,items_users.kolvo,items_users.geniration,items_users.magic_inc,items_users.maidin,items_users.lastUPD,items_users.timeOver,items_users.overType,items_users.secret_id,items_users.time_create,items_users.inGroup,items_users.dn_delete,items_users.inTransfer,items_users.post_delivery,items_users.lbtl_,items_users.bexp,items_users.so,items_users.blvl,items_main.id,items_main.name,items_main.img,items_main.type,items_main.inslot,items_main.`2h`,items_main.`2too`,items_main.iznosMAXi,items_main.inRazdel,items_main.price1,items_main.price2,items_main.magic_chance,items_main.info,items_main.massa,items_main.level,items_main.magic_inci,items_main.overTypei,items_main.`group`,items_main.group_max,items_main.geni,items_main.ts,items_main.srok,items_main.class,items_main.class_point,items_main.anti_class,items_main.anti_class_point,items_main.max_text,items_main.useInBattle,items_main.lbtl,items_main.lvl_itm,items_main.lvl_exp,items_main.lvl_aexp from items_users left join items_main on (items_main.id = items_users.item_id) where (( items_users.time_create + items_main.srok) > unix_timestamp() or items_main.srok = "0") and items_users.`delete`="0" and items_users.inOdet="0" and items_users.inShop="30" and items_main.type != "18" and items_main.type != "19" and items_main.type != "20" and items_main.type != "21" and items_main.type != "22" and items_main.type != "15" and items_main.type != "12" and items_main.type != "4" and items_main.type != "5" and items_main.type != "6" and items_main.type != "1" and items_main.type != "3" and items_main.type != "8" and items_main.type != "14" and items_main.type != "13" and items_main.type != "9" and items_main.type != "10" and items_main.type != "11" and items_main.type != "29" and items_main.type != "30" group by items_users.item_id order by items_main.id desc'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -121,11 +146,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
} else {
|
||||
$po = Helper\Conversion::dataStringToArray($pl['data']);
|
||||
}
|
||||
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
|
||||
if ((($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) && $pl['inOdet'] != 14) {
|
||||
//Зоны блока +
|
||||
if ($pl['inOdet'] != 14) {
|
||||
$po['zonb']++;
|
||||
}
|
||||
$po['zonb']++;
|
||||
}
|
||||
$is2 = '';
|
||||
$is1 = '<img src="//img.new-combats.tech/i/items/' . $pl['img'] . '"><br>';
|
||||
@@ -136,7 +159,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
}
|
||||
//название
|
||||
|
||||
$col = $this->itemsX($pl[0]);
|
||||
$col = ItemsModel::itemsX($pl[0]);
|
||||
if ($col > 1 && $pl['inGroup'] != 0 && $pl['inGroupCount'] > 1) {
|
||||
$pl['kolvo'] = $col;
|
||||
$pl['name'] .= ' (x' . $col . ')';
|
||||
@@ -145,7 +168,6 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($pl['massa'] > 0 && $preview == "full") {
|
||||
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
|
||||
if ($pl['gift'] != '') {
|
||||
$ttl = '';
|
||||
if ($pl['gift'] == 1) {
|
||||
$ttl = 'Вы не можете передать этот предмет кому-либо';
|
||||
} else {
|
||||
@@ -154,16 +176,14 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
$is2 .= ' <img title="' . $ttl . '" src="//img.new-combats.tech/i/podarok.gif">';
|
||||
}
|
||||
if (isset($po['art'])) {
|
||||
$is2 .= ' <img title="Артефакт" src="//img.new-combats.tech/i/artefact.gif">';
|
||||
$is2 .= ' <img alt="Артефакт" title="Артефакт" src="//img.new-combats.tech/i/artefact.gif">';
|
||||
}
|
||||
if (isset($po['sudba'])) {
|
||||
if ($po['sudba'] == '0') {
|
||||
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">';
|
||||
} elseif ($po['sudba'] == '1') {
|
||||
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">';
|
||||
} else {
|
||||
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/desteny.gif">';
|
||||
}
|
||||
$is2 .= match ($po['sudba']) {
|
||||
'0' => ' <img alt="" title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">',
|
||||
'1' => ' <img alt="" title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">',
|
||||
default => ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/desteny.gif">',
|
||||
};
|
||||
}
|
||||
}
|
||||
//цена
|
||||
@@ -178,41 +198,38 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
}
|
||||
|
||||
//долговечность
|
||||
if ($pl['iznosMAX'] > 0) {
|
||||
$izcol = '';
|
||||
if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
|
||||
$izcol = 'brown';
|
||||
}
|
||||
}
|
||||
$is2 .= '<br>Долговечность: ';
|
||||
if ($preview == "preview") {
|
||||
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor($steck[1]) . '/' . ceil(
|
||||
$steck[2]
|
||||
) . '</font>';
|
||||
$durability = floor($steck[1]) . '/' . ceil($steck[2]);
|
||||
} else {
|
||||
if ($pl['iznosMAXi'] == 999999999) {
|
||||
$is2 .= '<br>Долговечность: <font color="brown">неразрушимо</font>';
|
||||
$durability = 'неразрушимо';
|
||||
} else {
|
||||
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor(
|
||||
$pl['iznosNOW']
|
||||
) . '/' . ceil($pl['iznosMAX']) . '</font>';
|
||||
$durability = floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($pl['iznosMAX'] > 0 && floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
|
||||
$durability = "<span style='color: brown;'>$durability</span>";
|
||||
}
|
||||
$is2 .= $durability;
|
||||
|
||||
//Срок годности предмета
|
||||
|
||||
if ($po['srok'] > 0) {
|
||||
$pl['srok'] = $po['srok'];
|
||||
$is2 .= '<br>Срок годности: ';
|
||||
}
|
||||
if ($pl['srok'] > 0 and $preview != "preview") {
|
||||
if ($pl['srok'] > 0 && $preview != "preview") {
|
||||
if ($pl['time_create'] + $pl['srok'] < time()) {
|
||||
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']) . ' (испорчен)';
|
||||
$is2 .= $this->timeOut($pl['srok']) . ' (испорчен)';
|
||||
} else {
|
||||
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date(
|
||||
'd.m.Y H:i', $pl['time_create'] + $pl['srok']
|
||||
) . ')';
|
||||
$is2 .= $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')';
|
||||
}
|
||||
} elseif ($pl['srok'] > 0) {
|
||||
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']);
|
||||
$is2 .= $this->timeOut($pl['srok']);
|
||||
}
|
||||
|
||||
if ($pl['magic_chance'] > 0) {
|
||||
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
|
||||
}
|
||||
@@ -269,10 +286,8 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
} else {
|
||||
$tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
|
||||
}
|
||||
if ($po['tr_' . $n] > $this->stats[$n]) {
|
||||
if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
|
||||
$tr .= '</font>';
|
||||
}
|
||||
if ($po['tr_' . $n] > $this->stats[$n] && ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n])) {
|
||||
$tr .= '</font>';
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
@@ -292,7 +307,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($po['add_' . $n] < 0) {
|
||||
$z = '';
|
||||
}
|
||||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
|
||||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . $po['add_' . $n];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -306,7 +321,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($po['add_mab' . $i] < 0) {
|
||||
$z = '';
|
||||
}
|
||||
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
|
||||
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . $po['add_mab' . $i];
|
||||
} else {
|
||||
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx(
|
||||
[$po['add_mib' . $i], $po['add_mab' . $i]]
|
||||
@@ -332,7 +347,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($po['sv_' . $n] < 0) {
|
||||
$z = '';
|
||||
}
|
||||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
|
||||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -390,7 +405,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
}
|
||||
if (isset($po['free_stats']) && $po['free_stats'] > 0) {
|
||||
$is2 .= '<br><strong>Распределение статов:</strong>';
|
||||
$is2 .= '• Возможных распределений: ' . $po['free_stats'] . '';
|
||||
$is2 .= '• Возможных распределений: ' . $po['free_stats'];
|
||||
}
|
||||
if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
|
||||
$d[0] = 0;
|
||||
@@ -403,7 +418,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
//не отображается
|
||||
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
|
||||
$spc = mysql_query(
|
||||
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
|
||||
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` LIMIT 20'
|
||||
);
|
||||
while ($plc = mysql_fetch_array($spc)) {
|
||||
$com1['name'] = $plc['name'];
|
||||
@@ -512,13 +527,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($pl['dn_delete'] > 0) {
|
||||
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
|
||||
}
|
||||
if (isset($po['zazuby']) && $po['zazuby'] > 0) {
|
||||
$is2 .= '<div style="color:brown;">Предмет куплен за зубы</div>';
|
||||
}
|
||||
|
||||
$is2 .= '</small>';
|
||||
}
|
||||
if ($preview == "preview") {
|
||||
$kolvoprint = "<small style=\"float:right; color:grey;\" align=\"right\">Количество: <strong>$steck[0]</strong> шт.</small>";
|
||||
$kolvoprint = "<small style=\"float:right; color:grey; text-align=right\">Количество: <strong>$steck[0]</strong> шт.</small>";
|
||||
}
|
||||
echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top">' . $kolvoprint . $is2 . '</td></tr>';
|
||||
$i++;
|
||||
@@ -529,6 +542,28 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
}
|
||||
}
|
||||
|
||||
private function timeOut(int|string $seconds): string
|
||||
{
|
||||
return Conversion::secondsToTimeout($seconds);
|
||||
}
|
||||
|
||||
private function bronFx($br): string
|
||||
{
|
||||
$r = '';
|
||||
if ($br[0] > 0) {
|
||||
$r .= $br[0] - 1;
|
||||
} else {
|
||||
$r .= 0;
|
||||
}
|
||||
$r .= 'd';
|
||||
if ($br[0] > 0) {
|
||||
$r .= $br[1] - $br[0];
|
||||
} else {
|
||||
$r .= 0;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -547,7 +582,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
$u->addKr(-$price);
|
||||
$u->addKr($price, $irow['uid']);
|
||||
|
||||
$col = $u->itemsX($iid);
|
||||
$col = ItemsModel::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 ?',
|
||||
@@ -568,56 +603,45 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
return '<div>' . $r . '</div>';
|
||||
}
|
||||
|
||||
public function rent($action, int $iid, int $price, User $u)
|
||||
public function rent($action, int $iid, int $price): void
|
||||
{
|
||||
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" '
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->rentPut($iid, $price);
|
||||
} 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'
|
||||
);
|
||||
}
|
||||
$this->rentTake($iid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function rentPut(int $id, int $price): void
|
||||
{
|
||||
$item = Db::getRow('select id, item_id, data, ingroup, uid from items_users where id = ?', [$id]);
|
||||
$data = Conversion::dataStringToArray($item['data']);
|
||||
$col = ItemsModel::itemsX($item['id']);
|
||||
|
||||
if (isset($data['sudba']) || $data['sudba'] != 0 || isset($data['toclan'])) {
|
||||
return;
|
||||
}
|
||||
if (!isset($item['ingroup']) || $item['ingroup'] <= 0 || $col < 2) {
|
||||
Db::sql('update items_users set inShop = 30, 1price = ? where id = ? and uid = ? and inOdet = 0', [$price, $id, $item['uid']]);
|
||||
return;
|
||||
}
|
||||
|
||||
Db::sql('update items_users set inShop = 30, 1price = ? where item_id = ? and uid = ? and inGroup = ? limit ?', [$price, $item['id'], $item['uid'], $item['ingroup'], (int)$col]);
|
||||
}
|
||||
|
||||
private function rentTake(int $id): void
|
||||
{
|
||||
$item = Db::getRow('select items_users.*, price1, inGroup from items_users inner join items_main on items_main.id = item_id where items_users.id = ? and inShop = 30 limit 1', [$id]);
|
||||
if (!isset($item['inGroup']) || $item['inGroup'] <= 0) {
|
||||
Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30', [$item['price1'], $id]);
|
||||
return;
|
||||
}
|
||||
$col = ItemsModel::itemsX($item['id']);
|
||||
if ($col > 1) {
|
||||
Db::sql('update items_users set inShop = 0, 1price = ? where item_id = ? and uid = ? and inGroup = ? and inShop = 30 limit ?',
|
||||
[$item['price1'], $item['item_id'], $item['uid'], $item['ingroup'], (int)$col]);
|
||||
} else {
|
||||
Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and uid = ? and inOdet = 0', [$item['price1'], $id, $item['uid']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
|
||||
namespace Core;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class Config
|
||||
{
|
||||
const EKR_RUB_PRICE = 30;
|
||||
const KR_TO_EKR_EXCHANGE = 500;
|
||||
const EKR_TO_KR_EXCHANGE = 200;
|
||||
private const HOSTNAME = 'new-combats.tech';
|
||||
public const GAMENAME = 'Новый Бойцовский Клуб';
|
||||
private static self $instance;
|
||||
private static string $hostname = 'new-combats.tech';
|
||||
private static string $gamename = 'Бойцовский Клуб';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -27,75 +29,51 @@ class Config
|
||||
|
||||
private static function subdomain(string $name): string
|
||||
{
|
||||
return DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $name . '.' . self::$hostname;
|
||||
return DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $name . '.' . self::HOSTNAME;
|
||||
}
|
||||
|
||||
public static function get(?string $key = null)
|
||||
{
|
||||
$c['ver'] = '1.8.3.7';
|
||||
$c['ver'] = '0.8.2 alpha';
|
||||
/* Конфигурации игры */
|
||||
$c['name'] = 'Новый «' . self::$gamename . '»';
|
||||
$c['title'] = $c['name'] . ' - Бесплатная,браузерная онлайн игра'; //Название игры
|
||||
$c['title2'] = ' - Бесплатная, онлайн игра посвященная сражениям и магии!';
|
||||
$c['title3'] = $c['name'];
|
||||
$c['keys'] = self::$gamename . ', combats.com, ' . self::$gamename . ' игра, ' . self::$gamename . ' играть, игра ' . self::$gamename . ', старый ' . self::$gamename . ', ' . self::$gamename . ' онлайн игра, ' . self::$gamename . ' браузерная игра, играть в ' . $c['name'] . ', игра бк, бк игра, старый бк, играть в бк, бк онлайн игра, новый бк, Легендарный ' . $c['name'] . ', легендарный бк, combats, комбатс, combats ru, combats com, OldBK, oldbk ru, oldbk com, олдбк, old bk, олд бк, mycombats, rebk, recombats, oldcombats, obk2'; //Ключевые слова META
|
||||
$c['desc'] = self::$gamename . ' – это бесплатная увлекательная браузерная онлайн игра 2004-2009г, в которой сконцентрировано все самое лучшее от современных онлайн игр. В этой браузерной игре заложены самые интересные традиции всем известной онлайн игры под названием «' . self::$gamename . ' 2004-2009», которая, кстати, стала первооткрывателем всех браузерных игр.'; //Описание META
|
||||
$c['footer'] = $c['name'] . ' © 2013-' . date('Y');
|
||||
$c['title'] = self::GAMENAME . ' - Бесплатная, браузерная онлайн игра'; //Название игры
|
||||
$c['keys'] = self::GAMENAME . ', combats.com, ' . self::GAMENAME . ' игра, ' . self::GAMENAME . ' играть, игра ' . self::GAMENAME . ', старый ' . self::GAMENAME . ', ' . self::GAMENAME . ' онлайн игра, ' . self::GAMENAME . ' браузерная игра, играть в ' . self::GAMENAME . ', игра бк, бк игра, старый бк, играть в бк, бк онлайн игра, новый бк, Легендарный ' . self::GAMENAME . ', легендарный бк, combats, комбатс, combats ru, combats com, OldBK, oldbk ru, oldbk com, олдбк, old bk, олд бк, mycombats, rebk, recombats, oldcombats, obk2'; //Ключевые слова META
|
||||
$c['desc'] = self::GAMENAME . ' – это бесплатная увлекательная браузерная онлайн игра 2004-2009г, в которой сконцентрировано все самое лучшее от современных онлайн игр. В этой браузерной игре заложены самые интересные традиции всем известной онлайн игры под названием «' . self::GAMENAME . ' 2004-2009», которая, кстати, стала первооткрывателем всех браузерных игр.'; //Описание META
|
||||
$c['footer'] = self::GAMENAME . ' © 2013-' . date('Y');
|
||||
|
||||
//Сервера
|
||||
$c['host'] = self::$hostname;
|
||||
$c['host'] = self::HOSTNAME;
|
||||
$c['forum'] = self::subdomain('forum');
|
||||
$c['img'] = 'img.' . self::$hostname;
|
||||
$c['thiscity'] = 'capitalcity';
|
||||
$c['capitalcity'] = self::$hostname;
|
||||
$c['abandonedplain'] = self::$hostname;
|
||||
$c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::$hostname;
|
||||
$c['img'] = 'img.' . self::HOSTNAME;
|
||||
$c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::HOSTNAME;
|
||||
$c['img2'] = self::subdomain('img');
|
||||
$c['lib'] = self::subdomain('lib');
|
||||
$c['exit'] = "<script>window.location.replace('{$c['https']}');</script>";
|
||||
$c['support'] = 'support@' . $c['host'];
|
||||
|
||||
|
||||
//Валюта
|
||||
$c['curency_name'] = 'RUB';
|
||||
$c['curency_value'] = 30;
|
||||
$c['support'] = 'support@' . self::HOSTNAME;
|
||||
|
||||
//Бот клон
|
||||
$c['bot_level'] = 0; // до какого лвл бот (включительно)
|
||||
$c['propsk_die'] = 0; //Смерть при пропуске ходов, 0 - выкл. , >= 1 - количество пропусков до смерти при нападении
|
||||
|
||||
//Скупка
|
||||
$c['exp'] = 0; //бонус опыта
|
||||
$c['shop_type1'] = 100; //в гос НЕ ТРОГАТЬ
|
||||
|
||||
//Скупка
|
||||
$c['shop_type2'] = 90; //в березку НЕ ТРОГАТЬ
|
||||
$c['shop_all'] = 0; //Скупка на все! , 0 - сделать для отключения скупки.
|
||||
$c['shop_all_type1'] = 100; //Скупка только с госе! , 0 - сделать для отключения скупки.
|
||||
$c['shop_all_type2'] = 100; //Скупка только с березки! , 0 - сделать для отключения скупки.
|
||||
//
|
||||
$c['nosanich'] = true; //Странички Саныча не выпадают - true , выпадают - false
|
||||
$c['zuby'] = false; //зубы
|
||||
|
||||
$c['limitedexp'] = false; //лимит опыта
|
||||
$c['expstop'] = 2999999; //9; //Опыт на котором останавливаемся 11 149999999
|
||||
$c['expstopu'] = 2999999; //Опыт на котором останавливаемся
|
||||
$c['noobgade'] = false; //нуб квест (пещера)
|
||||
$c['level_ransfer'] = 8; //С какого уровня разрешены передачи
|
||||
|
||||
$c['level_transfer'] = 8; //С какого уровня разрешены передачи
|
||||
$c['noitembuy'] = false; //Не требует ресурсы для покупки
|
||||
$c['effz'] = 0; //Скольким секундам равен заряд
|
||||
$c['money_haot'] = true; //кр за хаоты
|
||||
$c['crtoecr'] = 500; //Курс обмена кр на екр (если 0, то выключено)
|
||||
$c['ecrtocr'] = 200; //Курс обмена екр на кр
|
||||
$c['bonuslevel'] = true; //Бонус уровня
|
||||
$c['bonussocial'] = false; //Бонус социальный
|
||||
|
||||
$c['w'] = date('w');
|
||||
$c['m'] = date('m');
|
||||
|
||||
$c['counters'] = '';
|
||||
$c['counters_noFrm'] = '';
|
||||
$c['securetime'] = 0; //Время последнего возможного взлома персов (подбор пароля по базам данных других игр)
|
||||
|
||||
$c['copyright'] = 'Copyright © ' . date('Y') . ' « Новый Бойцовский Клуб »';
|
||||
$c['db_host'] = 'db';
|
||||
$c['db_user'] = 'prod1';
|
||||
$c['db_name'] = 'game_production';
|
||||
@@ -110,4 +88,9 @@ class Config
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function getCopyright(): string
|
||||
{
|
||||
return '©' . (new DateTime())->format('Y') . ' Copyright «<a href="//' . self::HOSTNAME . '">' . self::GAMENAME . '</a>». All Rights Reserved.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +53,15 @@ class Db
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return false|array
|
||||
* @return array
|
||||
*/
|
||||
public static function getRows(string $query, array $args = []): false|array
|
||||
public static function getRows(string $query, array $args = []): array
|
||||
{
|
||||
return self::run($query, $args)->fetchAll();
|
||||
$stmt = self::run($query, $args)->fetchAll();
|
||||
if (!$stmt) {
|
||||
return [];
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,19 +112,23 @@ class Db
|
||||
{
|
||||
$result = self::getRow($query, $args);
|
||||
if (!empty($result)) {
|
||||
$result = array_shift($result);
|
||||
return array_shift($result);
|
||||
}
|
||||
return $result;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public static function getRow(string $query, array $args = []): mixed
|
||||
public static function getRow(string $query, array $args = []): array
|
||||
{
|
||||
return self::run($query, $args)->fetch();
|
||||
$stmt = self::run($query, $args)->fetch();
|
||||
if (!$stmt) {
|
||||
return [];
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +138,11 @@ class Db
|
||||
*/
|
||||
public static function getColumn(string $query, array $args = []): array
|
||||
{
|
||||
return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
|
||||
$stmt = self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
|
||||
if (!$stmt) {
|
||||
return [];
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
69
_incl_data/class/Core/TOTP.php
Normal file
69
_incl_data/class/Core/TOTP.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Core;
|
||||
|
||||
readonly class TOTP
|
||||
{
|
||||
private const BASE32CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; // RFC 4648 Base32
|
||||
|
||||
public function __construct(private string $secret)
|
||||
{
|
||||
}
|
||||
|
||||
public static function otpSecret($uniqueString, $length = 20): string
|
||||
{
|
||||
// Уникальная строка + текущее время в микросекундах
|
||||
$seed = $uniqueString . microtime(true);
|
||||
|
||||
// Хэшируем сид для более случайного распределения
|
||||
$seed = hash('sha256', $seed);
|
||||
|
||||
$secret = '';
|
||||
$max = strlen(self::BASE32CHARS) - 1;
|
||||
|
||||
// Генерируем случайную строку нужной длины
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$index = hexdec(substr($seed, $i, 2)) % $max; // Получаем индекс символа из хэшированного сида
|
||||
$secret .= self::BASE32CHARS[$index];
|
||||
}
|
||||
|
||||
return $secret;
|
||||
}
|
||||
|
||||
public function generate(int $digits = 6, int $timeStep = 30): string
|
||||
{
|
||||
$time = floor(time() / $timeStep);
|
||||
$secretKey = $this->base32_decode($this->secret);
|
||||
$binaryTime = pack('N*', 0) . pack('N*', $time);
|
||||
$hash = hash_hmac('sha1', $binaryTime, $secretKey, true);
|
||||
$offset = ord($hash[strlen($hash) - 1]) & 0x0F;
|
||||
$otp = (
|
||||
((ord($hash[$offset]) & 0x7F) << 24) |
|
||||
((ord($hash[$offset + 1]) & 0xFF) << 16) |
|
||||
((ord($hash[$offset + 2]) & 0xFF) << 8) |
|
||||
(ord($hash[$offset + 3]) & 0xFF)
|
||||
) % 10 ** $digits;
|
||||
return str_pad((string)$otp, $digits, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
private function base32_decode(string $input): string
|
||||
{
|
||||
$base32charsFlipped = array_flip(str_split(self::BASE32CHARS));
|
||||
$output = '';
|
||||
$v = 0;
|
||||
$vbits = 0;
|
||||
|
||||
for ($i = 0, $j = strlen($input); $i < $j; $i++) {
|
||||
$v <<= 5;
|
||||
if ($input[$i] == '=') continue;
|
||||
$v += $base32charsFlipped[$input[$i]];
|
||||
$vbits += 5;
|
||||
|
||||
if ($vbits >= 8) {
|
||||
$vbits -= 8;
|
||||
$output .= chr(($v & (0xFF << $vbits)) >> $vbits);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
29
_incl_data/class/DTO/BattlePriem.php
Normal file
29
_incl_data/class/DTO/BattlePriem.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace DTO;
|
||||
|
||||
readonly class BattlePriem
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param int $act 1 - когда персонаж получает повреждение
|
||||
* 2 - когда персонаж наносит удар
|
||||
*
|
||||
* @param int $typeOf 1 - уворот
|
||||
* 2 - крит
|
||||
* 3 - атака
|
||||
* 4 - защита
|
||||
* 5 - прочее
|
||||
* @param int|null $typeSec
|
||||
* @param int|null $moment
|
||||
* @param int|null $momentEnd
|
||||
*/
|
||||
public function __construct(
|
||||
public int $act,
|
||||
public int $typeOf,
|
||||
public ?int $typeSec = null,
|
||||
public ?int $moment = null,
|
||||
public ?int $momentEnd = null,
|
||||
) {}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
use User\Stats;
|
||||
|
||||
@@ -413,7 +414,7 @@ class Dungeon
|
||||
if ($usr_real['clan'] > 0) {
|
||||
$usrreal .= '<img src=//img.new-combats.tech/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@@ -425,7 +426,7 @@ class Dungeon
|
||||
if ($me_real['clan'] > 0) {
|
||||
$mereal .= '<img src=//img.new-combats.tech/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@@ -540,7 +541,7 @@ class Dungeon
|
||||
if ($usr_real['clan'] > 0) {
|
||||
$usrreal .= '<img src=//img.new-combats.tech/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@@ -552,7 +553,7 @@ class Dungeon
|
||||
if ($me_real['clan'] > 0) {
|
||||
$mereal .= '<img src=//img.new-combats.tech/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@@ -876,7 +877,7 @@ class Dungeon
|
||||
$i = count($a);
|
||||
}
|
||||
} elseif ($s[0] == 'repl_ptp') {
|
||||
require_once('dnaction/_dungeon_replace.php');
|
||||
require_once 'dnaction/_dungeon_replace.php';
|
||||
die();
|
||||
} elseif ($s[0] == 'add_eff') {
|
||||
//Кастуем эффект
|
||||
@@ -884,16 +885,10 @@ class Dungeon
|
||||
$j = 0;
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" AND `uid` = "' . $this->userinfo['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch2 = $u->testAction(
|
||||
' `vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[4]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток (все юзеры)
|
||||
$ch2 = $ch2[0];
|
||||
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = add_eff_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
$ch2 = ActionModel::testCount(["vars = add_eff_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[4]); //кол-во прошлых попыток (все юзеры)
|
||||
|
||||
if (($ch2 < $itm[4] || $itm[4] == 0) && $ch < $itm[2]) {
|
||||
if ($itm[1] * 100 >= rand(0, 10000)) {
|
||||
//удачно
|
||||
@@ -936,11 +931,8 @@ class Dungeon
|
||||
$t = explode(',', $s[1]);
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "bafit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch = ActionModel::testCount(["vars = bafit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
if ($ch < $itm[3]) {
|
||||
if ($itm[2] * 1000 >= rand(1, 100000)) {
|
||||
if ($itm[0] == 'hpNow') {
|
||||
@@ -1026,11 +1018,8 @@ class Dungeon
|
||||
$t = explode(',', $s[1]);
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`uid` = "' . $this->userinfo['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r = 'ничего не произошло...<br>';
|
||||
@@ -1050,9 +1039,8 @@ class Dungeon
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
@@ -1067,98 +1055,84 @@ class Dungeon
|
||||
}
|
||||
} elseif ($s[0] == 'itm1') {
|
||||
//Добавляем предмет , только 1 предмет из всех и все юзеры могут тоже
|
||||
$nj = 0;
|
||||
$t = explode(',', $s[1]);
|
||||
$j = rand(0, count($t));
|
||||
if ($nj == 0) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`uid` = "' . $this->userinfo['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Странно, но ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Странно, но ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
$nj++;
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ($s[0] == 'itm2') {
|
||||
//Добавляем предмет , только 1 предмет из всех и только 1 юзер может поднять
|
||||
$nj = 0;
|
||||
|
||||
$t = explode(',', $s[1]);
|
||||
$j = rand(0, count($t) - 1);
|
||||
if ($nj == 0) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = ActionModel::testCount(["vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
$nj++;
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
}
|
||||
}
|
||||
} elseif ($s[0] == 'fileact') {
|
||||
@@ -1166,7 +1140,7 @@ class Dungeon
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$r = rtrim($r, '\<br\>');
|
||||
$r = rtrim($r, '\<br>');
|
||||
if ($r == '') {
|
||||
$r = 'В этот раз не удалось найти что-либо еще';
|
||||
}
|
||||
@@ -1690,7 +1664,7 @@ class Dungeon
|
||||
}
|
||||
|
||||
|
||||
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50');
|
||||
$sp = mysql_query('select * from dungeon_now where time_finish = 0 limit 50');
|
||||
while ($pl = mysql_fetch_assoc($sp)) {
|
||||
$cn = mysql_fetch_assoc(
|
||||
mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1')
|
||||
|
||||
68
_incl_data/class/Helper/QueryBuilder.php
Normal file
68
_incl_data/class/Helper/QueryBuilder.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
use Exception;
|
||||
|
||||
class QueryBuilder
|
||||
{
|
||||
public function __construct(private readonly string $tableName, private string $columns = '*') {}
|
||||
|
||||
public function setColumns(string $columns): void
|
||||
{
|
||||
$this->columns = $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function select(array $filters = [], int $limit = 0): array
|
||||
{
|
||||
if (empty($filters)) {
|
||||
return ['sql' => "select $this->columns from $this->tableName"];
|
||||
}
|
||||
$where = [];
|
||||
$params = [];
|
||||
foreach ($filters as $filter) {
|
||||
[$name, $operation, $value] = explode(' ', $filter, 3);
|
||||
$placeholder = ":$name";
|
||||
$value = explode(' ', $value, 3); //todo: а ведь может прилететь значение из нескольких слов с пробелом...
|
||||
if (count($value) === 1) {
|
||||
$value = $value[0];
|
||||
if (is_numeric($value)) {
|
||||
$value = (int)$value;
|
||||
}
|
||||
} else {
|
||||
array_walk_recursive($value, function (&$var) {
|
||||
if (is_numeric($var)) {
|
||||
$var = (int)$var;
|
||||
}
|
||||
});
|
||||
if (is_numeric($value[0]) && is_numeric($value[2])) {
|
||||
$value = match ($value[1]) {
|
||||
'+' => $value[0] + $value[2],
|
||||
'-' => $value[0] - $value[2],
|
||||
'*' => $value[0] * $value[2],
|
||||
'/' => ($value[2] != 0) ? $value[0] / $value[2] : throw new Exception('Деление на ноль недопустимо.'),
|
||||
default => throw new Exception('Недопустимый оператор. Допустимы: +, -, *, /.'),
|
||||
};
|
||||
} elseif (is_string($value[0])) {
|
||||
$placeholder = "$value[0] $value[1] :$name";
|
||||
$value = $value[2];
|
||||
} elseif (is_string($value[2])) {
|
||||
$placeholder = "$value[2] $value[1] :$name";
|
||||
$value = $value[0];
|
||||
}
|
||||
}
|
||||
//todo: но есть ещё форменное скотство, когда в запрос кидают сложные формулы...
|
||||
|
||||
$where[] = "$name $operation $placeholder";
|
||||
$params[$name] = $value;
|
||||
}
|
||||
|
||||
return [
|
||||
'sql' => "select $this->columns from $this->tableName where " . implode(" and ", $where) . ($limit > 0 ? " limit $limit" : ""),
|
||||
'binds' => $params,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,14 @@ class Bonuses
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->stat = new Stat();
|
||||
$this->stat->getBonus();
|
||||
|
||||
foreach ($data as $bonusName => $value) {
|
||||
if (!$this->stat->getBonusNames()[$bonusName]) {
|
||||
if (!$this->stat->bonusNames[$bonusName]) {
|
||||
$this->result[$bonusName] = $value; //fixme на период отладки для отлова забытых
|
||||
//continue;
|
||||
}
|
||||
$this->result[$this->stat->getBonusNames()[$bonusName]] = $value;
|
||||
$this->result[$this->stat->bonusNames[$bonusName]] = $value;
|
||||
}
|
||||
$this->armor($data);
|
||||
}
|
||||
@@ -58,10 +59,10 @@ class Bonuses
|
||||
|
||||
public function addZonb(): void
|
||||
{
|
||||
if (isset($this->result[$this->stat->getBonusNames()['zonb']])) {
|
||||
$this->result[$this->stat->getBonusNames()['zonb']]++;
|
||||
if (isset($this->result[$this->stat->bonusNames['zonb']])) {
|
||||
$this->result[$this->stat->bonusNames['zonb']]++;
|
||||
} else {
|
||||
$this->result[$this->stat->getBonusNames()['zonb']] = 1;
|
||||
$this->result[$this->stat->bonusNames['zonb']] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ class Requirements
|
||||
private int $alignValue = 0;
|
||||
|
||||
private array $result = [];
|
||||
private Stat $stat;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->stat = new Stat();
|
||||
$statnames = new Stat();
|
||||
$statnames->getRequirement();
|
||||
foreach ($data as $requirementName => $value) {
|
||||
if (!$this->stat->getRequirementNames()[$requirementName]) {
|
||||
if (!$statnames->requirementNames[$requirementName]) {
|
||||
$this->result[$requirementName] = $value; //fixme на период отладки для отлова забытых
|
||||
//continue;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class Requirements
|
||||
//$this->result[$this->stat->getRequirementNames()[$requirementName]] = $value;
|
||||
|
||||
$this->result[$requirementName] = [
|
||||
'name' => $this->stat->getRequirementNames()[$requirementName],
|
||||
'name' => $statnames->requirementNames[$requirementName],
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Magic
|
||||
if (isset($itm['id'])) {
|
||||
|
||||
//Группа предметов
|
||||
if ($itm['group'] == 1 && $u->itemsX($itm['id']) > 1) {
|
||||
if ($itm['group'] == 1 && ItemsModel::itemsX($itm['id']) > 1) {
|
||||
//вытаскиваем предмет из группы
|
||||
$u->unstack($itm['id'], 1);
|
||||
}
|
||||
@@ -685,7 +685,7 @@ class Magic
|
||||
$u->error = 'Неудалось использовать на мертвых...';
|
||||
} elseif ($u->info['hpNow'] < 1) {
|
||||
$u->error = 'Неудалось использовать, вы погибли...';
|
||||
} elseif ($btl->info['noeff'] > 0) {
|
||||
} elseif ($btl->i->noeff > 0) {
|
||||
$u->error = 'Запрет на использования свитков восстановления';
|
||||
} elseif ($po['magic_hpNow'] < 1 && $po['magic_mpNow'] < 1) {
|
||||
$u->error = 'Неудалось использовать, в магическом свитке нет магии...';
|
||||
@@ -845,7 +845,7 @@ class Magic
|
||||
);
|
||||
if (isset($bu['id'])) {
|
||||
$u->error = 'Нельзя использовать свиток каждый ход...';
|
||||
} elseif ($btl->info['noeff'] > 0) {
|
||||
} elseif ($btl->i->noeff > 0) {
|
||||
$u->error = 'Запрет на использования свитков восстановления';
|
||||
} elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] > 1 && $u->info['hpNow'] >= 1) {
|
||||
//кастуем
|
||||
@@ -1491,9 +1491,6 @@ class Magic
|
||||
} else {
|
||||
$u->error = 'Персонаж "' . $jl . '" не найден в этом городе (' . $u->info['city'] . ')';
|
||||
}
|
||||
} elseif (isset($st['useOnItem']) && $st['useOnItem'] == 1) {
|
||||
//используем на предмет
|
||||
|
||||
} else {
|
||||
//на себя
|
||||
$goodUse = 1;
|
||||
@@ -1502,170 +1499,7 @@ class Magic
|
||||
$u->error = 'Хаосники не могут использовать данное заклятие';
|
||||
}
|
||||
|
||||
if ($itm['magic_inci'] == 'sanich2') {
|
||||
if ($u->info['battle'] == 0) {
|
||||
$sz = $u->testAction(
|
||||
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich2" AND `time` > ' . (time() - 4 * 60 * 60) . ' LIMIT 1', 1
|
||||
);
|
||||
if (!isset($sz['id'])) {
|
||||
$slech = rand(0, 4);
|
||||
$goodUse = 0;
|
||||
if ($slech == 1) {
|
||||
//3083 Настойка на жучьей требухе
|
||||
//$this->add_eff($u->info['id'],3083);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 290 AND `delete` =0'
|
||||
);
|
||||
$this->addEffect($u->info['id'], 290);
|
||||
$echotext = 'Настойка на жучьей требухе!';
|
||||
$u->error = 'Вы получили эфект от ' . $echotext . '';
|
||||
} elseif ($slech == 2) {
|
||||
//5239 Амброзия подмастерья Владык
|
||||
//$this->add_eff($u->info['id'],5239);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'
|
||||
);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'
|
||||
);
|
||||
$this->addEffect($u->info['id'], 472);
|
||||
$echotext = 'Амброзия подмастерья Владык!';
|
||||
$u->error = 'Вы получили эфект от ' . $echotext . '';
|
||||
} elseif ($slech == 3) {
|
||||
//5069 Амброзия Скучающих Владык
|
||||
//$this->add_eff($u->info['id'],470);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'
|
||||
);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'
|
||||
);
|
||||
$this->addEffect($u->info['id'], 470);
|
||||
$echotext = 'Амброзия Скучающих Владык!';
|
||||
$u->error = 'Вы получили эфект от ' . $echotext . '';
|
||||
} elseif ($slech == 4) {
|
||||
//1463 Звездное Сияние
|
||||
//$this->add_eff($u->info['id'],1463);
|
||||
mysql_query(
|
||||
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 35 AND `delete` =0'
|
||||
);
|
||||
$this->addEffect($u->info['id'], 35);
|
||||
$echotext = 'Звездное Сияние!';
|
||||
$u->error = 'Вы получили эфект от ' . $echotext . '';
|
||||
} else {
|
||||
$slech = 1;
|
||||
|
||||
$echotext = 'Не удалось прочитать страницу!';
|
||||
$u->error = ' ' . $echotext . ' ';
|
||||
}
|
||||
|
||||
$itm['iznosNOW'] += $slech;
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
$u->addAction(time(), 'sanich2', $slech);
|
||||
|
||||
if ($u->info['sex'] == 1) {
|
||||
$rtxt = '[img[items/' . $itm['img'] . ']] "' . $u->info['login'] . '" использовала "' . $itm['name'] . ' Саныча" и получила эффект ' . $echotext . ' травмы.';
|
||||
} else {
|
||||
$rtxt = '[img[items/' . $itm['img'] . ']] "' . $u->info['login'] . '" использовал "' . $itm['name'] . ' Саныча" и получил эффект ' . $echotext . ' травмы.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$u->error = 'Задержка использования ' . Conversion::secondsToTimeout(
|
||||
($sz['time'] + 4 * 60 * 60) - time()
|
||||
) . '.';
|
||||
}
|
||||
} else {
|
||||
$u->error = 'Невозможно использовать в бою';
|
||||
}
|
||||
|
||||
} elseif ($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) {
|
||||
|
||||
$sz = $u->testAction(
|
||||
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich1" AND `time` > ' . (time() - 6 * 60) . ' LIMIT 1', 1
|
||||
);
|
||||
if (!isset($sz['id'])) {
|
||||
$goodUse = 0;
|
||||
$u->error = 'Вы успешно использовали "' . $itm['name'] . '"';
|
||||
$z = 1;
|
||||
while ($z <= 5) {
|
||||
$u->info['tactic' . $z]++;
|
||||
if ($u->info['tactic' . $z] > 25) {
|
||||
$u->info['tactic' . $z] = 25;
|
||||
} elseif ($u->info['tactic' . $z] < 0) {
|
||||
$u->info['tactic' . $z] = 0;
|
||||
}
|
||||
$z++;
|
||||
}
|
||||
if ($u->info['sex'] == 1) {
|
||||
$this->inBattleLog('{u1} использовала "<b>' . $itm['name'] . ' Саныча</b>".');
|
||||
} else {
|
||||
$this->inBattleLog('{u1} использовал "<b>' . $itm['name'] . ' Саныча</b>".');
|
||||
}
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `tactic1` = "' . $u->info['tactic1'] . '",`tactic2` = "' . $u->info['tactic2'] . '",`tactic3` = "' . $u->info['tactic3'] . '",`tactic4` = "' . $u->info['tactic4'] . '",`tactic5` = "' . $u->info['tactic5'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
$itm['iznosNOW']++;
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
$u->addAction(time(), 'sanich1', $u->info['battle']);
|
||||
} else {
|
||||
$u->error = 'Задержка использования ' . Conversion::secondsToTimeout(($sz['time'] + 6 * 60) - time()) . '.';
|
||||
}
|
||||
|
||||
} elseif ($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) {
|
||||
|
||||
$sz = $u->testAction(
|
||||
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich3" AND `time` > ' . (time() - 3 * 60 * 60) . ' LIMIT 1', 1
|
||||
);
|
||||
if (!isset($sz['id'])) {
|
||||
|
||||
$usr = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `u`.`id`,`u`.`level`,`s`.`hpNow`,`s`.`team`,`u`.`login`,`u`.`sex` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`id` = "' . $u->info['enemy'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($usr['id']) && $usr['hpNow'] >= 1) {
|
||||
$iznslvl = $usr['level'];
|
||||
|
||||
$goodUse = 0;
|
||||
$u->error = 'Вы успешно использовали "' . $itm['name'] . '" на ' . $usr['login'] . '';
|
||||
|
||||
if ($u->info['sex'] == 1) {
|
||||
$this->inBattleLog(
|
||||
'{u1} использовала "<b>' . $itm['name'] . ' Саныча</b>" на {u2}.',
|
||||
$usr
|
||||
);
|
||||
} else {
|
||||
$this->inBattleLog(
|
||||
'{u1} использовал "<b>' . $itm['name'] . ' Саныча</b>" на {u2}.', $usr
|
||||
);
|
||||
}
|
||||
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `hpNow` = "' . $usr['hpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `hpNow` = "' . $u->stats['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
|
||||
);
|
||||
$itm['iznosNOW'] += $iznslvl;
|
||||
mysql_query(
|
||||
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
$u->addAction(time(), 'sanich3', $u->info['battle']);
|
||||
} else {
|
||||
$u->error = 'Нет подходящего противника';
|
||||
}
|
||||
|
||||
} else {
|
||||
$u->error = 'Задержка использования ' . Conversion::secondsToTimeout(
|
||||
($sz['time'] + 3 * 60 * 60) - time()
|
||||
) . '.';
|
||||
}
|
||||
|
||||
} elseif ($itm['magic_inci'] == 'lech') {
|
||||
if ($itm['magic_inci'] == 'lech') {
|
||||
$goodUse = 0;
|
||||
if ($u->info['level'] >= 2 and $u->info['level'] <= 13) {
|
||||
$travm = mysql_fetch_array(
|
||||
@@ -1698,7 +1532,6 @@ class Magic
|
||||
|
||||
|
||||
if ($goodUse == 1) {
|
||||
|
||||
$upd1 = 1;
|
||||
$upd2 = 1;
|
||||
//добавляем эффект персонажу
|
||||
|
||||
@@ -1,39 +1,43 @@
|
||||
<?php
|
||||
if(!defined('GAME'))
|
||||
{
|
||||
die();
|
||||
if (!defined('GAME')) {
|
||||
die();
|
||||
}
|
||||
|
||||
$bu = mysql_fetch_array(mysql_query('SELECT * FROM `tactic` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
||||
$bu = mysql_fetch_array(mysql_query('SELECT * FROM `tactic` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'));
|
||||
|
||||
if($u->info['battle']==0) {
|
||||
$u->error = 'Использовать можно только в поединке';
|
||||
}elseif(isset($bu['id'])) {
|
||||
$u->error = 'Нельзя использовать свиток каждый ход...';
|
||||
}elseif( isset($btl->info['id']) ) {
|
||||
//
|
||||
mysql_query('INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("'.$u->info['battle'].'","'.$u->info['id'].'","'.time().'","'.$itm['item_id'].'","'.$itm['name'].'","1")');
|
||||
//
|
||||
$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
'',
|
||||
'{tm1} {u1} использовал заклятие "<b>'.$itm['name'].'</b>".',
|
||||
($btl->hodID)
|
||||
);
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic1'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic2'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic3'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic4'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic5'] += 1;
|
||||
|
||||
mysql_query('UPDATE `stats` SET
|
||||
`tactic1` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic1'].'",
|
||||
`tactic2` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic2'].'",
|
||||
`tactic3` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic3'].'",
|
||||
`tactic4` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic4'].'",
|
||||
`tactic5` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic5'].'"
|
||||
WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
||||
//
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
|
||||
$u->error = '‚ы использовали “никальную тактику +1';
|
||||
if ($u->info['battle'] == 0) {
|
||||
$u->error = 'Использовать можно только в поединке';
|
||||
} elseif (isset($bu['id'])) {
|
||||
$u->error = 'Нельзя использовать свиток каждый ход...';
|
||||
} elseif (isset($btl->i->id)) {
|
||||
//
|
||||
mysql_query(
|
||||
'INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time(
|
||||
) . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")'
|
||||
);
|
||||
//
|
||||
$btl->priemAddLog(
|
||||
$id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
'',
|
||||
'{tm1} {u1} использовал заклятие "<b>' . $itm['name'] . '</b>".',
|
||||
($btl->hodID)
|
||||
);
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic1'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic2'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic3'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic4'] += 1;
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic5'] += 1;
|
||||
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET
|
||||
`tactic1` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic1'] . '",
|
||||
`tactic2` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic2'] . '",
|
||||
`tactic3` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic3'] . '",
|
||||
`tactic4` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic4'] . '",
|
||||
`tactic5` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic5'] . '"
|
||||
WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
//
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
|
||||
$u->error = '‚ы использовали “никальную тактику +1';
|
||||
}
|
||||
?>
|
||||
@@ -18,7 +18,7 @@ if( $itm['magic_inci'] == 'dispell' ) {
|
||||
|
||||
//Действие при клике
|
||||
|
||||
if( isset($btl->info['id']) ) {
|
||||
if( isset($btl->i->id) ) {
|
||||
$btl->priemAddLog( $id, 1, 2, $usr['id'], $u->info['enemy'],
|
||||
'',
|
||||
'{tm1} {u1} использовал заклятие "<b>'.$itm['name'].'</b>".',
|
||||
@@ -56,7 +56,7 @@ if( $itm['magic_inci'] == 'dispell' ) {
|
||||
$pvr['pl'] = mysql_fetch_array($pvr['sp']);
|
||||
if(!isset($pvr['pl']['id'])) {
|
||||
$u->error = '<font color=red><b>Не удалось использовать "'.$itm['name'].'", на вас нет проклятий!</b></font>';
|
||||
}elseif( isset($btl->info['id']) ) {
|
||||
}elseif( isset($btl->i->id) ) {
|
||||
$pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$pvr['pl']['v2'].'" LIMIT 1'));
|
||||
//if( isset($pvr['pl']['priem']) ) {
|
||||
// $btl->delPriem($pvr['pl'],$btl->users[$btl->uids[$u->info['id']]],100);
|
||||
|
||||
@@ -13,9 +13,9 @@ if( $itm['magic_inci'] == 'esfer' ) {
|
||||
//Действие при клике
|
||||
if( $u->stats['hpNow'] < 1 ) {
|
||||
$u->error = '<font color=red><b>Вы поглибли и не можете воспользоваться свитком...</b></font>';
|
||||
}elseif( isset($btl->info['id']) ) {
|
||||
}elseif( isset($btl->i->id) ) {
|
||||
|
||||
if( $btl->info['noinc'] > 0 ) {
|
||||
if( $btl->i->noinc > 0 ) {
|
||||
$u->error = '<font color=red><b>Бой был изолирован ранее</b></font>';
|
||||
}else{
|
||||
$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
@@ -24,7 +24,7 @@ if( $itm['magic_inci'] == 'esfer' ) {
|
||||
($btl->hodID)
|
||||
);
|
||||
$u->error = '<font color=red><b>Мерцающая сфера отделила всех вас от остального мира... </b></font>';
|
||||
mysql_query('UPDATE `battle` SET `noinc` = 1 WHERE `id` = '.$btl->info['id'].' LIMIT 1');
|
||||
mysql_query('UPDATE `battle` SET `noinc` = 1 WHERE `id` = '.$btl->i->id.' LIMIT 1');
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,19 +11,19 @@ if( $itm['magic_inci'] == 'exitbtl' ) {
|
||||
$pvr = array();
|
||||
|
||||
//Действие при клике
|
||||
if( isset($btl->info['id']) ) {
|
||||
if( isset($btl->i->id) ) {
|
||||
|
||||
if( $btl->info['dn_id'] > 0 || $btl->info['izlom'] > 0 ) {
|
||||
if( $btl->i->dnId > 0 || $btl->i->izlom > 0 ) {
|
||||
$u->error = '<font color=red><b>Магия не действует в пещерах и подобных локациях...</b></font>';
|
||||
}elseif( $btl->info['noinc'] > 0 ) {
|
||||
}elseif( $btl->i->noinc > 0 ) {
|
||||
$u->error = '<font color=red><b>Бой изолирован и вы не можете его покинуть</b></font>';
|
||||
}elseif( $btl->info['clone'] > 0 ) {
|
||||
}elseif( $btl->i->clone > 0 ) {
|
||||
$u->error = '<font color=red><b>Невозможно покинуть поединок с клоном</b></font>';
|
||||
}elseif( $u->info['hpNow'] < 1 ) {
|
||||
$u->error = '<font color=red><b>Вы умерли и не можете покинуть бой</b></font>';
|
||||
}elseif( $btl->info['type'] == 500 || $btl->info['type'] == 33){
|
||||
}elseif( $btl->i->type == 500 || $btl->i->type == 33){
|
||||
$u->error = '<font color=red><b>Невозможно покинуть этот поединок!</b></font>';
|
||||
}elseif( $btl->info['smert'] == 1){
|
||||
}elseif( $btl->i->smert == 1){
|
||||
$u->error = '<font color=red><b>Невозможно покинуть этот поединок!</b></font>';
|
||||
}else{
|
||||
$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
@@ -33,7 +33,7 @@ if( $itm['magic_inci'] == 'exitbtl' ) {
|
||||
);
|
||||
$u->error = '<font color=red><b>Вы сбежали с поля боя и потеряли всю энергию...</b></font>';
|
||||
//
|
||||
mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ("'.$u->info['login'].'","'.$u->info['city'].'","'.$btl->info['id'].'","'.$u->info['id'].'","'.time().'","'.$btl->info['team_win'].'","'.$u->info['lvl'].'","'.$u->info['align'].'","'.$u->info['clan'].'","0","0","'.$u->info['money'].'","'.$u->info['money2'].'","'.$u->info['money'].'")');
|
||||
mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ("'.$u->info['login'].'","'.$u->info['city'].'","'.$btl->i->id.'","'.$u->info['id'].'","'.time().'","'.$btl->i->getTeamwin().'","'.$u->info['lvl'].'","'.$u->info['align'].'","'.$u->info['clan'].'","0","0","'.$u->info['money'].'","'.$u->info['money2'].'","'.$u->info['money'].'")');
|
||||
mysql_query('UPDATE `stats` SET `battle_yron` = 0, `battle_exp` = 0,`tactic1` = 0 , `tactic2` = 0 , `tactic3` = 0 , `tactic4` = 0 , `tactic5` = 0 , `tactic6` = 0 , `tactic7` = -1 , `last_pr` = 0 , `last_hp` = -1 , `team` = 0 WHERE `id` = '.$u->info['id'].' LIMIT 1');
|
||||
mysql_query('UPDATE `users` SET `battle` = "0", `lose` = `lose` + 1 WHERE `id` = '.$u->info['id'].' LIMIT 1');
|
||||
//
|
||||
@@ -41,7 +41,7 @@ if( $itm['magic_inci'] == 'exitbtl' ) {
|
||||
//
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
|
||||
//
|
||||
mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ('.$u->info['login'].','.$u->info['city'].','.$btl->info['id'].','.$u->info['id'].','.time().','.$btl->info['team_win'].','.$u->info['lvl'].','.$u->info['align'].','.$u->info['clan'].',0,0,'.$u->info['money'].','.$u->info['money2'].','.$u->info['money'].')');
|
||||
mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ('.$u->info['login'].','.$u->info['city'].','.$btl->i->id.','.$u->info['id'].','.time().','.$btl->i->getTeamwin().','.$u->info['lvl'].','.$u->info['align'].','.$u->info['clan'].',0,0,'.$u->info['money'].','.$u->info['money2'].','.$u->info['money'].')');
|
||||
mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "'.$u->info['id'].'" OR `uid2` = "'.$u->info['id'].'"');
|
||||
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "'.$u->info['id'].'"');
|
||||
mysql_query('UPDATE `stats` SET `hpNow`= 1, `mpNow` = 1,`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" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
||||
|
||||
@@ -1,38 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
|
||||
if (!defined('GAME')) {
|
||||
die();
|
||||
}
|
||||
|
||||
if ($itm['magic_inci'] == 'podvig') {
|
||||
$test = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "podvig" AND `time` > "' . (time()) . '" LIMIT 1'));
|
||||
if ($u->info['align'] != 2) {
|
||||
if (isset($test['id'])) {
|
||||
$u->error = 'Задержка не прошла, еще ' . Conversion::secondsToTimeout($test['time'] - time());
|
||||
} else {
|
||||
//
|
||||
$dngcity = [
|
||||
5035 => ['angelscity', 'Бездна'],
|
||||
5036 => ['capitalcity', 'Пещера Тысячи Проклятий'],
|
||||
5037 => ['demonscity', 'Катакомбы'],
|
||||
5038 => ['abandonedplain', 'Гора Легиона'], //mooncity
|
||||
5039 => ['suncity', 'Грибница'],
|
||||
5040 => ['sandcity', 'Пещера Мглы'],
|
||||
];
|
||||
$dngcity = $dngcity[$itm['item_id']];
|
||||
$hgo1 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > "' . (time() - 86400) . '" AND `vars` = "psh_qt_' . $dngcity[0] . '" LIMIT 1', 1);
|
||||
if (!isset($hgo1['id'])) {
|
||||
$u->error = 'Нет задержки для подземелья ' . $dngcity[1] . '.';
|
||||
} else {
|
||||
$u->addAction(time(), 'podvig', '');
|
||||
$u->error = 'Успешно использован свиток Право на Подвиг (' . $dngcity[1] . ')';
|
||||
mysql_query('UPDATE `actions` SET `time` = "' . (time() - 86401) . '" WHERE `id` = "' . ($hgo1['id']) . '" LIMIT 1');
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
|
||||
}
|
||||
}
|
||||
$test = Db::getRow("select id, time from actions where uid = ? and vars = 'podvig' and time > unix_timestamp() limit 1", [$u->info['id']]);
|
||||
if (isset($test['id'])) {
|
||||
$u->error = 'Задержка не прошла, еще ' . Conversion::secondsToTimeout($test['time'] - time());
|
||||
} else {
|
||||
$u->error = 'Хаосники не могут пользоваться этим свитком!';
|
||||
//
|
||||
$dngcity = [
|
||||
5035 => ['angelscity', 'Бездна'],
|
||||
5036 => ['capitalcity', 'Пещера Тысячи Проклятий'],
|
||||
5037 => ['demonscity', 'Катакомбы'],
|
||||
5038 => ['abandonedplain', 'Гора Легиона'], //mooncity
|
||||
5039 => ['suncity', 'Грибница'],
|
||||
5040 => ['sandcity', 'Пещера Мглы'],
|
||||
];
|
||||
$dngcity = $dngcity[$itm['item_id']];
|
||||
$hgo1 = ActionModel::getOne(["uid = {$u->info['id']}", "time > unix_timestamp() - 86400", "vars = psh_qt_$dngcity[0]"], 'id');
|
||||
|
||||
if (!isset($hgo1)) {
|
||||
$u->error = 'Нет задержки для подземелья ' . $dngcity[1] . '.';
|
||||
} else {
|
||||
$u->addAction(time(), 'podvig', '');
|
||||
$u->error = "Успешно использован свиток Право на Подвиг ($dngcity[1])";
|
||||
Db::sql('update actions set time = unix_timestamp() - 86401 where id = ?', [$hgo1]);
|
||||
ItemsModel::addIznos($itm['id']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
|
||||
if (!defined('GAME')) {
|
||||
die();
|
||||
}
|
||||
@@ -15,15 +19,16 @@ if (isset($po['finish_file']) && $po['finish_file'] == 'tznanie') {
|
||||
//Уже что-то изучаем
|
||||
$u->error = 'Так не пойдет, вы уже что-то изучаете';
|
||||
} else {
|
||||
$tst = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "read" AND `vals` = "' . $itm['item_id'] . '" LIMIT 1', 1);
|
||||
if (isset($tst['id'])) {
|
||||
$tst = (bool)ActionModel::testCount(["uid = $u->info['id']", 'vars = read', "vals = {$itm['item_id']}"]);
|
||||
|
||||
if ($tst) {
|
||||
$u->error = 'Вы уже изучили данное знание';
|
||||
} else {
|
||||
$fn = '';
|
||||
$tom_iz = 0;
|
||||
if (($itm['item_id'] >= 1045 && $itm['item_id'] <= 1047) || ($itm['item_id'] >= 4812 && $itm['item_id'] <= 4813)) {
|
||||
$tst2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "read" AND `vals` = "' . ($itm['item_id'] - 1) . '" LIMIT 1', 1);
|
||||
if (!isset($tst2['id'])) {
|
||||
$tst2 = (bool)ActionModel::testCount(["uid = $u->info['id']", 'vars = read', "vals = {$itm['item_id']} - 1"]);
|
||||
if (!$tst2) {
|
||||
$tom_iz = 1;
|
||||
}
|
||||
unset($tst2);
|
||||
@@ -41,7 +46,7 @@ if (isset($po['finish_file']) && $po['finish_file'] == 'tznanie') {
|
||||
|
||||
$u->error = 'Вы изучили "' . $itm['name'] . '".';
|
||||
$u->addAction(time() + $st['timeRead'], 'read', $itm['item_id']);
|
||||
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
|
||||
ItemsModel::addIznos($itm['id']);
|
||||
|
||||
} else {
|
||||
$u->error = 'Требует изучения предыдущего тома';
|
||||
|
||||
@@ -19,7 +19,7 @@ if( $itm['magic_inci'] == 'undie' ) {
|
||||
$u->error = '<font color=red><b>Вы поглибли и не можете воспользоваться свитком...</b></font>';
|
||||
}elseif( $u->info['tactic7'] < $pvr['trs7'] ) {
|
||||
$u->error = '<font color=red><b>Недостаточно духа, необходимо '.$pvr['trs7'].'...</b></font>';
|
||||
}elseif( isset($btl->info['id']) ) {
|
||||
}elseif( isset($btl->i->id) ) {
|
||||
/*
|
||||
$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
'',
|
||||
|
||||
@@ -16,7 +16,7 @@ if( $itm['magic_inci'] == 'yarostzvezd' ) {
|
||||
$u->error = '<font color=red><b>Вы поглибли и не можете воспользоваться свитком...</b></font>';
|
||||
}elseif( $u->info['tactic7'] < $pvr['trs7'] ) {
|
||||
$u->error = '<font color=red><b>Недостаточно духа, необходимо '.$pvr['trs7'].'...</b></font>';
|
||||
}elseif( isset($btl->info['id']) ) {
|
||||
}elseif( isset($btl->i->id) ) {
|
||||
/*
|
||||
$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
|
||||
'',
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
namespace Model;
|
||||
|
||||
use Core\Db;
|
||||
use Exception;
|
||||
use Helper\QueryBuilder;
|
||||
use User\UserIp;
|
||||
|
||||
class ActionModel
|
||||
{
|
||||
private const TABLE_NAME = 'actions';
|
||||
private int $uid;
|
||||
|
||||
public function __construct(int $uid)
|
||||
@@ -24,7 +27,7 @@ class ActionModel
|
||||
[
|
||||
$user['id'],
|
||||
$time,
|
||||
$user['city'],
|
||||
'',
|
||||
$user['room'],
|
||||
$vars,
|
||||
UserIp::get(),
|
||||
@@ -34,14 +37,51 @@ class ActionModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function getAll(string $filter = ''): array
|
||||
public static function get(array $filters, string $columns = '*'): array
|
||||
{
|
||||
return Db::getRows('select * from actions');
|
||||
$query = new QueryBuilder(self::TABLE_NAME, $columns);
|
||||
try {
|
||||
$stmt = $query->select($filters, 1);
|
||||
return Db::getRow($stmt['sql'], $stmt['binds']);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
trigger_error(__METHOD__ . ': ' . $e->getMessage(), E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public function getByVals(string $vals)
|
||||
public static function getOne(array $filters, string $column): mixed
|
||||
{
|
||||
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
|
||||
$result = self::get($filters, $column);
|
||||
if (!empty($result)) {
|
||||
return array_shift($result);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function deleteById(int $id): void
|
||||
{
|
||||
Db::sql('delete from actions where id = ?', [$id]);
|
||||
}
|
||||
|
||||
public static function testCount(array $filters, int $limit = 0): int
|
||||
{
|
||||
$query = new QueryBuilder(self::TABLE_NAME, 'count(id)');
|
||||
try {
|
||||
$stmt = $query->select($filters, $limit);
|
||||
return Db::getValue($stmt['sql'], $stmt['binds']);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
trigger_error(__METHOD__ . ': ' . $e->getMessage(), E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public static function testCountCustom(string $filter, array $binds, int $limit = 0): int
|
||||
{
|
||||
$sql = "select count(id) from actions where $filter";
|
||||
if ($limit > 0) {
|
||||
$sql .= ' limit ' . $limit;
|
||||
}
|
||||
return (int)Db::getValue($sql, $binds);
|
||||
}
|
||||
|
||||
public function getLastByVals(string $vals)
|
||||
@@ -54,6 +94,11 @@ class ActionModel
|
||||
|
||||
public function getLastByValsAndTime(string $vals, int $time)
|
||||
{
|
||||
$filter = [
|
||||
"uid = $this->uid",
|
||||
"vals = '$vals'",
|
||||
"time > unix_timestamp() - $time",
|
||||
];
|
||||
return Db::getRow(
|
||||
'select * from actions where uid = ? and vals = ? and time > unix_timestamp() - ? order by time desc limit 1',
|
||||
[$this->uid, $vals, $time]
|
||||
@@ -65,30 +110,6 @@ class ActionModel
|
||||
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
|
||||
}
|
||||
|
||||
public static function deleteById(int $id): void
|
||||
{
|
||||
Db::sql('delete from actions where id = ?', [$id]);
|
||||
}
|
||||
|
||||
/*protected 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));
|
||||
|
||||
return !empty($arr) ? $arr : [];
|
||||
}*/
|
||||
|
||||
public function getDailyQuest(): array|false
|
||||
{
|
||||
return Db::getRow("select * from actions where uid = ? and vars = 'day_quest' limit 1", [$this->uid]);
|
||||
}
|
||||
|
||||
public function getFinishedDailyQuestTasks(int $timeout): array
|
||||
{
|
||||
$arr = [];
|
||||
|
||||
@@ -7,17 +7,16 @@ use Enum\StatFilterCellName;
|
||||
|
||||
class Stat extends Constant
|
||||
{
|
||||
public readonly array $sysBonusNames;
|
||||
public readonly array $sysRequirementNames;
|
||||
public readonly array $bonusNames;
|
||||
public readonly array $requirementNames;
|
||||
public function __construct()
|
||||
{
|
||||
self::$tableName = 'const_stats';
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getBonusNames(): array
|
||||
{
|
||||
return $this->filterByCell(StatFilterCellName::Bonus);
|
||||
}
|
||||
|
||||
private function filterByCell(StatFilterCellName $cellName): array
|
||||
{
|
||||
$result = [];
|
||||
@@ -30,8 +29,24 @@ class Stat extends Constant
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getRequirementNames(): array
|
||||
/**
|
||||
* Создаёт и заполняет массивы bonusNames и sysBonusNames.
|
||||
* @return void
|
||||
*/
|
||||
public function getBonus(): void
|
||||
{
|
||||
return $this->filterByCell(StatFilterCellName::Requirement);
|
||||
$this->bonusNames = $this->filterByCell(StatFilterCellName::Bonus);
|
||||
$this->sysBonusNames = array_keys($this->bonusNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Создаёт и заполняет массивы requirementNames и sysRequirementNames.
|
||||
* @return void
|
||||
*/
|
||||
public function getRequirement(): void
|
||||
{
|
||||
$this->requirementNames = $this->filterByCell(StatFilterCellName::Requirement);
|
||||
$this->sysRequirementNames = array_keys($this->requirementNames);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user