Compare commits
259 Commits
| 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 | |||
| a2c658166d | |||
| 07f905ef64 | |||
| 253eafca3b | |||
| e5b3c47228 | |||
| 0c85c61d0c | |||
| 8efb371909 | |||
| 655987979f | |||
| bfd9e0c5a3 | |||
| f614e5ef83 | |||
| c7be3e57f8 | |||
| bf17b19309 | |||
| acd9c98d38 | |||
| 69641b49c3 | |||
| 1f6626ea33 | |||
| 26f28a9be8 | |||
| 8be1c6cd7e | |||
| c51dbaeae3 | |||
| 0abc1bb2f5 | |||
| faa472f2a1 | |||
| c9d6565b09 | |||
| c8d3bc83f8 | |||
| bbf409b3d2 | |||
| af827a262a | |||
| 9623695242 | |||
| 268d7463ee | |||
| c3591977b8 | |||
| 47e90c261b | |||
| d7d8db2198 | |||
| 9c8b6bd89c | |||
| 70f6e3252d | |||
| 8b83ef3ba8 | |||
| 9b243ec729 | |||
| a2775be423 | |||
| 490b9bc901 | |||
| f761c22950 | |||
| 4c6a5d055b | |||
| ad80a30a5f | |||
| 44856fa9c1 | |||
| 5f25fcd7e5 | |||
| 774bc82556 | |||
| cf614b5fd2 | |||
| ea46cd7f35 | |||
| fc17eada24 | |||
| 1645f58a63 | |||
| ce2691971b | |||
| 3e753c8b93 | |||
| def933dca4 | |||
| a14232a899 | |||
| 2abd435798 | |||
| 4113c4a1da | |||
| 53f0e1108f | |||
| bdbb359e20 | |||
| e0b08e0b1a | |||
| 707d6c5c99 | |||
| 82e48d473b | |||
| 7535cc657a | |||
| eb971fbc65 | |||
| 3b4bbf3a6a | |||
| be5779ff27 | |||
| 0e832dbbc2 | |||
| 5f48c6f67d | |||
| 6f006ed790 | |||
| 045803087d | |||
| 294575021a | |||
| 0ab73fe5e2 | |||
| c4aeb53f57 | |||
| d1663a34cf | |||
| 5c01742890 | |||
| fc663a8c42 | |||
| 80ef052c6e | |||
| 0f30620f61 | |||
| 0d2b4aba63 | |||
| 81a8161d32 | |||
| 63be6c94b3 | |||
| f557dbcd1a | |||
| e5c7ff4a33 | |||
| e359eb6f40 | |||
| e5e614d1d7 | |||
| afde0b1380 | |||
| 351cc5c6a2 | |||
| e4bf3fd342 | |||
| deac9203bd | |||
| f4a66a1147 | |||
| d36d5361f2 | |||
| 7266569f69 | |||
| 08b43f096e | |||
| c4f0485960 | |||
| fff3de0a98 | |||
| a412d334ae | |||
| 77f3135f7a | |||
| 77f8a0056e | |||
| 12e75d2c34 | |||
| 9de7415f08 | |||
| cffcf57031 | |||
| 74b644fe59 | |||
| b378e8e117 | |||
| ad182a21fe | |||
| 2d3f23f81b | |||
| 83ec9d12f9 | |||
| 01b00cc392 | |||
| 4d4743e888 | |||
| b7dd8d2d2e | |||
| 0796da3c53 | |||
| 9001974e2f | |||
| 059b8e9579 | |||
| 89a8c47471 | |||
| 5df55f8623 | |||
| 92772463e6 | |||
| 1500eb9364 | |||
| 6185c43e00 | |||
| b064cb349c | |||
| be1b631a18 | |||
| 22c2348ed4 | |||
| 8b2accf246 | |||
| c6c6e32ac4 | |||
| 6eca7863ce | |||
| 49a7f3a273 | |||
| d2cf95ef55 | |||
| 48ca7b4109 | |||
| b76f096196 | |||
| c2eae44401 | |||
| b055071e2e | |||
| bff6e87ab8 | |||
| adc1f81007 | |||
| 802f0a2ad0 | |||
| 7270ec2004 | |||
| 5e06f5e136 | |||
| f49f8cd08d | |||
| 0668d3de5f | |||
| 2440ad3cc1 | |||
| a073a02176 | |||
| 0163cb5be6 | |||
| 72c502d94a | |||
| cf2aea847a | |||
| 02c76e76ad | |||
| 2bc67ce543 | |||
| 3dc4cf7284 | |||
| 2d63efd915 | |||
| ec11709a86 | |||
| 6afdb1a1be | |||
| bdda3d24a0 | |||
| f92aa003ac | |||
| 92318be837 | |||
| 4e9d2deed4 | |||
| e2daf51a5f | |||
| 3893a1c734 | |||
| c77107c3bf | |||
| f8e02fd793 | |||
| cfaf82f73a | |||
| 3f3ffc2114 | |||
| 0a8662c591 | |||
| 4c4136577c | |||
| d82a2e3103 | |||
| c41f36644c | |||
| 01b504e677 | |||
| 1b5bf26294 | |||
| fdf063d527 | |||
| c3d7f0c649 | |||
| 6344d11dc3 | |||
| 22b9b7097c | |||
| c97071a642 | |||
| 00ecc3a862 | |||
| 075165d37d | |||
| b7003d0c63 | |||
| d9bf4b0bdc | |||
| 656e3549eb | |||
| 395153f291 | |||
| 253a8dca63 | |||
| a9dc9af61e | |||
| 00c76de9d5 | |||
| acf6a2d167 | |||
| ea01cd0a56 | |||
| 99b90a198b | |||
| a9ab7257e8 | |||
| 6095358496 | |||
| b619cd302b | |||
| 72fe6139c6 | |||
| 2d3bd006c0 | |||
| 1fbd8d6de2 | |||
| 571ba4dffb | |||
| f0a9a3e8a1 | |||
| 46c1e38ea8 | |||
| dcc6a1337c | |||
| d1be4995e2 | |||
| 5518b335a8 | |||
| 95604fc4b1 | |||
| 5df2447d34 | |||
| 328e7483cd | |||
| 3f579afaed | |||
| bae941e155 | |||
| 037d43857d | |||
| 739caee04b | |||
| 35c0b6825f | |||
| 45fc2f51b4 | |||
| 9ec0f42e17 | |||
| d9ec810f7f | |||
| 89469b919f | |||
| d0fb296691 | |||
| e8252b8d4d | |||
| c647600141 | |||
| 68fe6ec13e | |||
| b483b79df5 | |||
| 557921edfa | |||
| f3bee1c3ac | |||
| 84c0847178 | |||
| a1aca77a35 | |||
| f1d838fcc4 |
+79
-1
@@ -1 +1,79 @@
|
||||
/.idea/
|
||||
# ---> JetBrains
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
|
||||
@@ -1,99 +1,86 @@
|
||||
DefaultLanguage ru
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
#Options +FollowSymLinks -MultiViews
|
||||
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.com/proxy/
|
||||
|
||||
RewriteCond %{SERVER_PORT} 80
|
||||
RewriteRule ^(.*)$ https://new-combats.com/$1 [R,L]
|
||||
|
||||
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 ^adminion/([a-zA-Z0-9]+)/?$ /adminion/index.php?mod=$1 [L]
|
||||
RewriteRule ^adminion/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ /adminion/index.php?mod=$1 [L]
|
||||
RewriteRule ^adminion/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ /adminion/index.php?mod=$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 ^exp/(.*)/?$ /exp.php?$1 [L]
|
||||
RewriteRule ^exp/?$ /exp.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 ^register1/?$ /register1.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>
|
||||
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
<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>
|
||||
|
||||
Generated
+12
@@ -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>
|
||||
@@ -1 +0,0 @@
|
||||
open_basedir=/home/newcom1/public_html/:/usr/local/lib/php/:/tmp
|
||||
@@ -1,222 +1,197 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Item\Data\Bonuses;
|
||||
use Item\Data\Properties;
|
||||
use Item\Data\Requirements;
|
||||
use Model\Constant\ShopOtdel;
|
||||
|
||||
Ядро для обработки данных.
|
||||
Обработка поединков, обработка заявок, обработка ботов, обработка пещер, обработка турниров, обработка временных генераций
|
||||
ini_set('xdebug.var_display_max_depth', 10);
|
||||
ini_set('xdebug.var_display_max_children', 256);
|
||||
ini_set('xdebug.var_display_max_data', 1024);
|
||||
|
||||
*/
|
||||
|
||||
if (isset($_GET['m1'])) {
|
||||
define('GAME', true);
|
||||
|
||||
|
||||
|
||||
include_once '_incl_data/__config.php';
|
||||
include_once '_incl_data/class/__db_connect.php';
|
||||
|
||||
$sp = mysql_query('SELECT * FROM `users_recombats` WHERE `email` != "" ORDER BY `name` DESC LIMIT 7000');
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
echo "<br>" . $pl['email'];
|
||||
}
|
||||
} elseif (isset($_GET['bk1'])) {
|
||||
define('GAME', true);
|
||||
|
||||
|
||||
|
||||
include('_incl_data/__config.php');
|
||||
include('_incl_data/class/__db_connect.php');
|
||||
$u = User::start();
|
||||
|
||||
$ins = 'Вещи БК-1:<hr>';
|
||||
$sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1');
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
|
||||
$po = mysql_fetch_array(
|
||||
mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1')
|
||||
);
|
||||
$po = $u->lookStats($po['data']);
|
||||
|
||||
if (!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) {
|
||||
$po['add_minAtack'] = $po['sv_minAtack'];
|
||||
$po['add_maxAtack'] = $po['sv_maxAtack'];
|
||||
}
|
||||
|
||||
$ins .= 'INSERT INTO `items_main` (
|
||||
`id`, `name`, `img`, `art`, `type`, `inslot`, `use_magic`, `price`, `price2`, `iznosMAXi`, `massa`, `tr_level`, `tr_s1`, `tr_s2`, `tr_s3`, `tr_s4`, `tr_s5`, `tr_s6`, `add_s1`, `add_s2`, `add_s3`, `add_s4`, `add_s5`, `add_s6`, `add_hp`, `add_mp`, `add_m1`, `add_m2`, `add_m3`, `add_m4`, `add_b1`, `add_b2`, `add_b3`, `add_b4`, `add_attack_min`, `add_attack_max`
|
||||
,`tr_a1`,`tr_a2`,`tr_a3`,`tr_a4`,`tr_mg1`,`tr_mg2`,`tr_mg3`,`tr_mg4`,`tr_mg5`,`tr_mg6`,`tr_mg7`
|
||||
,`add_a1`,`add_a2`,`add_a3`,`add_a4`,`add_mg1`,`add_mg2`,`add_mg3`,`add_mg4`,`add_mg5`,`add_mg6`,`add_mg7`
|
||||
) VALUES ';
|
||||
$ins .= '(
|
||||
NULL,
|
||||
"' . $pl['name'] . '",
|
||||
"' . $pl['img'] . '",
|
||||
"' . (0 + round($po['art'])) . '",
|
||||
"' . $pl['type'] . '",
|
||||
"' . $pl['inslot'] . '",
|
||||
"",
|
||||
"' . $pl['price1'] . '",
|
||||
"' . $pl['price2'] . '",
|
||||
"' . $pl['iznosMAXi'] . '",
|
||||
"' . $pl['massa'] . '",
|
||||
"' . (0 + round($po['tr_lvl'])) . '",
|
||||
"' . (0 + round($po['tr_s1'])) . '",
|
||||
"' . (0 + round($po['tr_s2'])) . '",
|
||||
"' . (0 + round($po['tr_s3'])) . '",
|
||||
"' . (0 + round($po['tr_s4'])) . '",
|
||||
"' . (0 + round($po['tr_s5'])) . '",
|
||||
"' . (0 + round($po['tr_s6'])) . '",
|
||||
"' . (0 + round($po['add_s1'])) . '",
|
||||
"' . (0 + round($po['add_s2'])) . '",
|
||||
"' . (0 + round($po['add_s3'])) . '",
|
||||
"' . (0 + round($po['add_s4'])) . '",
|
||||
"' . (0 + round($po['add_s5'])) . '",
|
||||
"' . (0 + round($po['add_s6'])) . '",
|
||||
"' . (0 + round($po['add_hpAll'])) . '",
|
||||
"' . (0 + round($po['add_mpAll'])) . '",
|
||||
"' . (0 + round($po['add_m1'])) . '",
|
||||
"' . (0 + round($po['add_m2'])) . '",
|
||||
"' . (0 + round($po['add_m3'])) . '",
|
||||
"' . (0 + round($po['add_m4'])) . '",
|
||||
"' . (0 + round($po['add_mib1'])) . '",
|
||||
"' . (0 + round($po['add_mib2'])) . '",
|
||||
"' . (0 + round($po['add_mib3'])) . '",
|
||||
"' . (0 + round($po['add_mib4'])) . '",
|
||||
"' . (0 + round($po['add_minAtack'])) . '",
|
||||
"' . (0 + round($po['add_maxAtack'])) . '",
|
||||
"' . (0 + round($po['tr_a1'])) . '",
|
||||
"' . (0 + round($po['tr_a2'])) . '",
|
||||
"' . (0 + round($po['tr_a3'])) . '",
|
||||
"' . (0 + round($po['tr_a4'])) . '",
|
||||
"' . (0 + round($po['tr_mg1'])) . '",
|
||||
"' . (0 + round($po['tr_mg2'])) . '",
|
||||
"' . (0 + round($po['tr_mg3'])) . '",
|
||||
"' . (0 + round($po['tr_mg4'])) . '",
|
||||
"' . (0 + round($po['tr_mg5'])) . '",
|
||||
"' . (0 + round($po['tr_mg6'])) . '",
|
||||
"' . (0 + round($po['tr_mg7'])) . '",
|
||||
"' . (0 + round($po['add_a1'])) . '",
|
||||
"' . (0 + round($po['add_a2'])) . '",
|
||||
"' . (0 + round($po['add_a3'])) . '",
|
||||
"' . (0 + round($po['add_a4'])) . '",
|
||||
"' . (0 + round($po['add_mg1'])) . '",
|
||||
"' . (0 + round($po['add_mg2'])) . '",
|
||||
"' . (0 + round($po['add_mg3'])) . '",
|
||||
"' . (0 + round($po['add_mg4'])) . '",
|
||||
"' . (0 + round($po['add_mg5'])) . '",
|
||||
"' . (0 + round($po['add_mg6'])) . '",
|
||||
"' . (0 + round($po['add_mg7'])) . '"
|
||||
);';
|
||||
$ins .= "\n" . '<br>';
|
||||
}
|
||||
|
||||
echo $ins;
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
if (isset($_GET['test'])) {
|
||||
$i = 3;
|
||||
|
||||
|
||||
function yrn($sila)
|
||||
{
|
||||
return 2 + $_GET['test'] + $sila - round($sila / 5);
|
||||
}
|
||||
|
||||
|
||||
while ($i <= 100) {
|
||||
echo '<div';
|
||||
if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
|
||||
echo ' style="background-color:green;color:#fff;"';
|
||||
} elseif ($i == 7 || $i == 12 || $i == 17 || $i == 22) {
|
||||
echo ' style="background-color:grey;color:#fff;"';
|
||||
}
|
||||
echo '> ';
|
||||
echo $i . ' = ' . yrn($i);
|
||||
echo '</div>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
if (!isset($_GET['robot']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get(
|
||||
) != '' && UserIp::get() != '31.131.116.166') {
|
||||
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
||||
if (!defined('GAME_VERSION')) {
|
||||
require_once '_incl_data/autoload.php';
|
||||
}
|
||||
|
||||
|
||||
const GAME = true;
|
||||
$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'");
|
||||
|
||||
$u = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users'");
|
||||
$s = Db::getColumn("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'stats'");
|
||||
|
||||
$p = Db::getRows('select * from const_stats');
|
||||
|
||||
var_dump((new ShopOtdel())->getGroups());
|
||||
?>
|
||||
|
||||
|
||||
<div style="display: grid; grid-template-columns: 50% 50%; word-wrap: break-word;">
|
||||
<div>
|
||||
<b><u>$user->[info]</u></b><br>
|
||||
<?php
|
||||
$rr = 1;
|
||||
foreach ($user->info as $k => $v) {
|
||||
if (isset($user->is[$k])) {
|
||||
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]</span>";
|
||||
}
|
||||
if ($k == 'stats') {
|
||||
echo 'stats = ARRAY<br>';
|
||||
foreach (Conversion::dataStringToArray($v) as $dk => $dv) {
|
||||
if (isset($user->is[$dk])) {
|
||||
$dk .= " <span style='background-color: lightcyan;'>[{$user->is[$dk]}]</span>";
|
||||
}
|
||||
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$dk = $dv</span><br>";
|
||||
}
|
||||
$k = '';
|
||||
$v = '';
|
||||
}
|
||||
echo "$rr. $k = $v<br>";
|
||||
$rr++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div>
|
||||
<b><u>$user->[stats]</u></b><br>
|
||||
<?php
|
||||
$rr = 1;
|
||||
foreach ($user->stats as $k => $v) {
|
||||
if ($k === 'items_o') {
|
||||
continue;
|
||||
}
|
||||
if (isset($user->is[$k])) {
|
||||
$k .= " <span style='background-color: lightcyan;'>[{$user->is[$k]}]";
|
||||
} else {
|
||||
$k = "<span>$k";
|
||||
}
|
||||
|
||||
include('_incl_data/__config.php');
|
||||
include('_incl_data/class/__db_connect.php');
|
||||
$vv = is_array($v) ? 'array' : $v;
|
||||
echo "$rr. $k</span> = $vv<br>";
|
||||
$rr++;
|
||||
|
||||
$count = [0, 0, 0, 0, 0, 0];
|
||||
if (is_array($v)) {
|
||||
foreach ($v as $k2 => $v2) {
|
||||
$vv2 = is_array($v2) ? 'array' : $v2;
|
||||
echo "<span style='background-color: #99FFCC; margin-left: 5px;'>$k2 = $vv2</span><br>";
|
||||
|
||||
function inuser_go_btl($id)
|
||||
{
|
||||
if (isset($id['id'])) {
|
||||
file_get_contents(
|
||||
'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
|
||||
$id['id'] . '_brfCOreW@!_' . $id['pass']
|
||||
) . '&pass=' . $id['pass']
|
||||
);
|
||||
if (is_array($v2)) {
|
||||
foreach ($v2 as $k3 => $v3) {
|
||||
$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);
|
||||
|
||||
echo 'DATA TR_<br>';
|
||||
foreach ((new Requirements($itemData))->get() as $k => $v) {
|
||||
echo "$k = $v<br>";
|
||||
}
|
||||
echo 'DATA ADD_<br>';
|
||||
foreach ((new Bonuses($itemData))->get() as $k => $v) {
|
||||
echo "$k = $v<br>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div style="display: grid; grid-template-columns: auto auto;">
|
||||
<div> Поля в базе users
|
||||
<?php var_dump($u); ?>
|
||||
</div>
|
||||
<div> Поля в базе stats
|
||||
<?php var_dump($s); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 10px; background-color: aliceblue">Отдельно, уже согласованные параметры предметов, которые могут находиться исключительно в поле data</div>
|
||||
<div style="display: grid; grid-template-columns: auto auto auto; background-color: aliceblue">
|
||||
<div> sv_* (хотим убрать)
|
||||
<?php var_dump(Properties::$names); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: grid; grid-template-columns: auto auto;">
|
||||
<div> Поля в базе items_main
|
||||
<?php var_dump($im); ?>
|
||||
</div>
|
||||
<div> Поля в базе items_users
|
||||
<?php var_dump($iu); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<hr> Параметры игрока.<br><br>
|
||||
<div style="display: grid; grid-template-columns: auto auto auto;">
|
||||
<div> Заскриптованные
|
||||
<?php var_dump($user->is); ?>
|
||||
</div>
|
||||
<div> Хотим оставить
|
||||
|
||||
</div>
|
||||
<div> Хотим убрать
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
echo "<h5>Текущая таблица параметров</h5>";
|
||||
foreach ($p as $prow) {
|
||||
echo "{$prow['sys_name']} → {$prow['name']}";
|
||||
if ($prow['is_percentage']) {
|
||||
echo " (%)";
|
||||
}
|
||||
if ($prow['is_requirement']) {
|
||||
echo " <span style='background-color: lightpink;'>[требуется]</span> ";
|
||||
}
|
||||
if ($prow['is_bonus']) {
|
||||
echo " <span style='background-color: lightgreen;'>[даёт]</span> ";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
$sp = mysql_query(
|
||||
'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200'
|
||||
);
|
||||
|
||||
$btltest = [];
|
||||
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
|
||||
$i++;
|
||||
|
||||
if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) {
|
||||
|
||||
$btltest[$pl['battle']]++;
|
||||
|
||||
if ($pl['timereg'] == 0) {
|
||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
} else {
|
||||
User::setOnline($pl['id']);
|
||||
}
|
||||
|
||||
if ($pl['bot'] == 0) {
|
||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
}
|
||||
|
||||
User::setOnline($pl['id']);
|
||||
|
||||
BotLogic::start($pl['id']);
|
||||
|
||||
} else {
|
||||
|
||||
if ($pl['zv'] > 0) {
|
||||
BotLogic::start($pl['id']);
|
||||
}
|
||||
|
||||
if ($pl['timereg'] == 0) {
|
||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
} else {
|
||||
User::setOnline($pl['id']);
|
||||
}
|
||||
|
||||
if ($pl['bot'] == 0) {
|
||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
}
|
||||
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
User::setOnline($pl['id']);
|
||||
|
||||
echo '*';
|
||||
}
|
||||
echo '+';
|
||||
echo '[' . $pl['login'] . '] -> Действие: ' . $pl['ipreg'] . ' , ожидаем: ' . ($pl['timeMain'] - time(
|
||||
)) . ' сек., заявка: ' . $pl['zv'] . ', поединок: ' . $pl['battle'] . '';
|
||||
echo '<hr>';
|
||||
$stats = Db::getRows('select id, stats from stats');
|
||||
$sarr = [];
|
||||
foreach ($stats as $stat) {
|
||||
$data = Conversion::dataStringToArray($stat['stats']);
|
||||
$arr = [
|
||||
'uid' => $stat['id'],
|
||||
's1' => $data['s1'] ?? 0,
|
||||
's2' => $data['s2'] ?? 0,
|
||||
's3' => $data['s3'] ?? 0,
|
||||
's4' => $data['s4'] ?? 0,
|
||||
's5' => $data['s5'] ?? 0,
|
||||
's6' => $data['s6'] ?? 0,
|
||||
's7' => $data['s7'] ?? 0,
|
||||
'a1' => $data['a1'] ?? 0,
|
||||
'a2' => $data['a2'] ?? 0,
|
||||
'a3' => $data['a3'] ?? 0,
|
||||
'a4' => $data['a4'] ?? 0,
|
||||
'mg1' => $data['mg1'] ?? 0,
|
||||
'mg2' => $data['mg2'] ?? 0,
|
||||
'mg3' => $data['mg3'] ?? 0,
|
||||
'mg4' => $data['mg4'] ?? 0,
|
||||
];
|
||||
unset($data['s1'], $data['s2'], $data['s3'], $data['s4'], $data['s5'], $data['s6'], $data['s7'],
|
||||
$data['a1'], $data['a2'], $data['a3'], $data['a4'],
|
||||
$data['mg1'], $data['mg2'], $data['mg3'], $data['mg4']);
|
||||
$arr['tails'] = Conversion::arrayToDataString($data);
|
||||
$arr['tails_json'] = json_encode($data);
|
||||
$sarr[] = $arr;
|
||||
}
|
||||
|
||||
var_dump($sarr);
|
||||
@@ -1,6 +0,0 @@
|
||||
# Netscape HTTP Cookie File
|
||||
# https://curl.haxx.se/rfc/cookie_spec.html
|
||||
# This file was generated by libcurl! Edit at your own risk.
|
||||
|
||||
new-combats.com FALSE / FALSE 0 PHPSESSID vt7d2f0tttjoneil7bqsc7org0
|
||||
new-combats.com FALSE /jx/battle/ FALSE 1517571089 btl 0
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Enum\ShopId;
|
||||
|
||||
?>
|
||||
<style>
|
||||
.wares {
|
||||
display: grid;
|
||||
grid-template-columns: 100px auto;
|
||||
background-color: #d4d4d4;
|
||||
}
|
||||
|
||||
.wares > div:nth-child(odd of .left), .wares > div:nth-child(odd of .left) + div {
|
||||
background-color: #c8c8c8;
|
||||
}
|
||||
|
||||
table.zerowide {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.zerowide td {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<form id="F1" name="F1" method="post"></form>
|
||||
<table class="zerowide">
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<h3><?= $shopName ?></h3>
|
||||
<div style="text-align: center; font-weight: bold;"><span style="color: crimson;"> <?= $status ?></span></div>
|
||||
<table class="zerowide">
|
||||
<tr>
|
||||
<td style="text-align: left; vertical-align: top; padding: 4px;">
|
||||
<!--Магазин-->
|
||||
<div id="hint3" style="visibility:hidden"></div>
|
||||
<table class="zerowide" style="background-color: darkgrey;">
|
||||
<tr>
|
||||
<td style="text-align: center; height: 21px;">
|
||||
<?php if ($actionSale): ?>
|
||||
<strong>Отдел «Скупка»</strong><br>
|
||||
Здесь вы можете продать свои вещи, за жалкие гроши...<br>
|
||||
У вас в наличии:
|
||||
<?php elseif ($actionGifts): ?>
|
||||
<strong>Отдел «Сделать подарки»</strong>
|
||||
<?php elseif ($shop->shopOtdel->getName($otdel)): ?>
|
||||
<strong>Отдел «<?= $shop->shopOtdel->getName($otdel) ?>»</strong>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!--Рюкзак / Прилавок-->
|
||||
<table class="zerowide" style="background-color: dimgrey;">
|
||||
<?php if ($actionGifts): ?>
|
||||
<tr>
|
||||
<td style="background-color: #d5d5d5;">
|
||||
Вы можете сделать подарок дорогому человеку. Ваш подарок будет отображаться в информации о персонаже.
|
||||
<input name="itemgift" id="itemgift" type="hidden" value="0" form="F1">
|
||||
<ol>
|
||||
<li>
|
||||
Укажите имя персонажа, которому хотите сделать подарок.
|
||||
<label>Имя <input name="to_login" form="F1"></label>
|
||||
</li>
|
||||
<?php if ($u->info['exp'] >= Present::EXP_NEEDED_FOR_ADD_PRESENT_TEXT): ?>
|
||||
<li>
|
||||
Поздравление. Будет отображаться в информации о персонаже (не более 60 символов).
|
||||
<label><input name="podarok2" size="50" maxlength="60" form="F1"></label>
|
||||
</li>
|
||||
<li>
|
||||
Приватное поздравление (в информации о персонаже не отображается).
|
||||
<label><textarea name="txt" cols="80" rows="6" form="F1"></textarea></label>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
Выберите, от чьего имени подарок:<br>
|
||||
<label style="font-weight: bold;"><input type="radio" name="from" value="0" checked form="F1"> <?= $u->info['login'] ?></label><br>
|
||||
<label><input type="radio" name="from" value="1" form="F1">анонимно</label><br>
|
||||
<?php if ($uc->isRegistered()): ?>
|
||||
<label><input type="radio" name="from" value="2" form="F1">от имени клана <?= $uc->getName() ?></label>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<li>
|
||||
Нажмите кнопку <strong>Подарить</strong> под предметом, который хотите преподнести в подарок:<br>
|
||||
</li>
|
||||
</ol>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($giftsvars): ?>
|
||||
<?php foreach ($giftsvars as $k => $v): ?>
|
||||
<tr>
|
||||
<td style="text-align: center; background-color: lightgrey;">
|
||||
<?php if ($k === 0): ?>
|
||||
<h3>Уникальные подарки</h3>
|
||||
<?php endif; ?>
|
||||
<table class="zerowide">
|
||||
<tr>
|
||||
<td style="width: 160px; text-align: center; border-right: 1px solid #a5a5a5; padding: 5px;">
|
||||
<img style="padding-bottom: 5px;" src="<?= $v['img'] ?>" alt=""><br>
|
||||
<button onclick="document.getElementById('itemgift').value=<?= $v['jsvalue'] ?>;document.getElementById('F1').submit();">
|
||||
Подарить за <?= $v['money'] ?> кр.
|
||||
</button>
|
||||
</td>
|
||||
<td style="vertical-align: top; border-right: 1px solid #a5a5a5; padding: 5px;">
|
||||
<a href="/item/0"><?= $v['linkname'] ?></a><br><small>Это именной подарок, его можете подарить только вы.</small>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td style="text-align: center; background-color: lightgrey;"><h3>Стандартные подарки</h3></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?= $itmAllSee ?>
|
||||
<?php elseif ($actionSale): ?>
|
||||
<?= $itmAllSee ?>
|
||||
<?php else: ?>
|
||||
<div class="wares">
|
||||
<?php $shop->printWares(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td style="width: 280px; vertical-align: top;">
|
||||
<div style="display: flex; align-items: flex-end; font-size: smaller; flex-direction: column; gap: 2px;">
|
||||
<?= $goLis; ?>
|
||||
<?php if ($shopId === ShopId::MAIN->value): ?>
|
||||
<button onclick="location.href='main.php?loc=1.180.0.9&rnd=<?= $code; ?>'">Центральная Площадь</button>
|
||||
<button onclick="location.href='main.php?loc=1.180.0.368&rnd=<?= $code; ?>'">Подпольная лавка</button>
|
||||
<button onclick="location.href='main.php?loc=1.180.0.13&rnd=<?= $code; ?>'">Магазин «Берёзка»</button>
|
||||
<?php else: ?>
|
||||
<button onclick="location.href='main.php?loc=1.180.0.10&rnd=<?= $code; ?>'">Государственный магазин</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: grid; grid-template-columns: max-content max-content; font-size: smaller; justify-content: end; margin: 10px 0;">
|
||||
<div style="text-align: right; margin-right: 5px;">Масса:</div>
|
||||
<div style="font-weight: bold;"><?= $u->aves['now'] ?>/<?= $u->aves['max'] ?></div>
|
||||
<div style="text-align: right; margin-right: 5px;">У вас в наличии:</div>
|
||||
<div style="font-weight: bold; color: green"><?= $shop->getUserWallet() ?></div>
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<?php if (!$actionSale): ?>
|
||||
<INPUT class="btn" TYPE="button" value="Продать вещи" onclick="location='?otdel=<?= $otdel ?>&sale=1'">
|
||||
<?php else: ?>
|
||||
<INPUT class="btn" TYPE="button" value="Купить вещи" onclick="location='?otdel=<?= $otdel ?>'">
|
||||
<?php endif; ?>
|
||||
|
||||
<INPUT class="btn" TYPE="button" value="Обновить" onclick="location = '<?= str_replace('item', '', str_replace('buy', '', $_SERVER['REQUEST_URI'])); ?>';">
|
||||
</div>
|
||||
<BR>
|
||||
</div>
|
||||
<div style="background-color:#A5A5A5; padding:1px; text-align: center; font-weight: bold;">Отделы магазина</div>
|
||||
<div style="line-height:17px;">
|
||||
<?php
|
||||
/*названия разделов (справа)*/
|
||||
//$otdels = $shop->getUsedOtdels();
|
||||
$otdels[37] = "<span style='color: red'>$otdels[37]</span>";
|
||||
$otdels[100] = 'Сделать подарки';
|
||||
|
||||
//$i = 1;
|
||||
foreach ($otdels as $k => $v) {
|
||||
$color = $otdel === $k ? '#C7C7C7' : '#e2e0e0';
|
||||
if (in_array($k, array_keys($shop->shopOtdel->getGroups()))) {
|
||||
if ($i !== 1) {
|
||||
echo '<br>';
|
||||
}
|
||||
echo sprintf('<div style="background-color: #d5d5d5;"><img src="/i/shop_ico/%s.png" alt="%s"> <strong>%s</strong></div>',
|
||||
$i, $shop->shopOtdel->getGroups()[$k], $shop->shopOtdel->getGroups()[$k]);
|
||||
$i++;
|
||||
}
|
||||
if ($k === 100) {
|
||||
echo '<br><div style="background-color: #d5d5d5;"><b>Возможности:</b></div>';
|
||||
$k = '32&gifts=1';
|
||||
}
|
||||
echo '<a href="?otdel=' . $k . '"><div style="background-color: ' . $color . '"> ' . $v . '</a></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</table>
|
||||
<br>
|
||||
<div id="textgo" style="visibility:hidden;"></div>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Core\Config;
|
||||
use Insallah\Tournaments\Tournament;
|
||||
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
ini_set('display_errors', 'Off');
|
||||
//error_reporting(E_ALL);
|
||||
|
||||
date_default_timezone_set('Europe/Moscow');
|
||||
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
@@ -13,9 +12,6 @@ header('Expires: 0');
|
||||
|
||||
require_once 'mysql_override.php';
|
||||
|
||||
// Для всех доработок, пока нет автозагрузки классов.
|
||||
require_once 'class/Insallah/Config.php';
|
||||
|
||||
// Попробуем в автозагрузку.
|
||||
// Никогда не заработает с такими названиями классов и файлов!
|
||||
// "На потом."
|
||||
@@ -24,8 +20,8 @@ spl_autoload_register(function ($className) {
|
||||
# 2 without
|
||||
$fileName = [
|
||||
__DIR__ . '/class/' . str_replace('\\', '/', $className . '.php'),
|
||||
__DIR__ . '/class/' . $className . '.php'
|
||||
];
|
||||
__DIR__ . '/class/' . $className . '.php',
|
||||
];
|
||||
foreach ($fileName as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
|
||||
+16
-6
@@ -1,18 +1,27 @@
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
const GAME = true; // Для совместимости с этой "защитой".
|
||||
const GAME_VERSION = 'alpha-7.4';
|
||||
// Новая автозагрузка.
|
||||
// ВНИМАНИЕ! Не введено в эксплуатацию!
|
||||
|
||||
require_once 'mysql_override.php';
|
||||
require_once 'class/Insallah/Config.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 = [
|
||||
__DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||
__DIR__ . '/class/' . $className . '.php'
|
||||
$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 . $addsrc($className) . '.php',
|
||||
];
|
||||
foreach ($fileName as $file) {
|
||||
if (file_exists($file)) {
|
||||
@@ -23,10 +32,11 @@ spl_autoload_register(function (string $className) {
|
||||
});
|
||||
|
||||
spl_autoload_register(function (string $classname) {
|
||||
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data';
|
||||
$classMap = [
|
||||
'NewCombats' => __DIR__ . '/class/',
|
||||
'Insallah' => __DIR__ . '/class/Insallah/',
|
||||
'DarksLight2' => __DIR__ . '/class/DarksLight2/',
|
||||
'NewCombats' => $rootdir . '/class/',
|
||||
'Insallah' => $rootdir . '/class/Insallah/',
|
||||
'DarksLight2' => $rootdir . '/class/DarksLight2/',
|
||||
];
|
||||
$parts = explode('\\', $classname);
|
||||
$namespace = array_shift($parts);
|
||||
|
||||
@@ -1,126 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
use Core\Db;
|
||||
use User;
|
||||
use Helper\Math;
|
||||
use Helper\Table;
|
||||
use User\ItemsModel;
|
||||
|
||||
class Achievements
|
||||
{
|
||||
private User $user;
|
||||
private $info;
|
||||
private array $info;
|
||||
private array $data = [
|
||||
'zb' => [
|
||||
'questname' => 'Ежедн.Задания',
|
||||
'quest' => 'Выполнить задания бабки.',
|
||||
'check' => ['Заданий', 5, 25, 50, 100, 250],
|
||||
'prize' => ['Жетон <br>успеха <br>', 5, 20, 40, 60, 100],
|
||||
'startlink' => 11
|
||||
'startlink' => 11,
|
||||
],
|
||||
'vx' => [
|
||||
'questname' => 'Хаотические бои',
|
||||
'quest' => 'Победить в хаотических боях.',
|
||||
'check' => ['Побед', 50, 300, 400, 500, 1000],
|
||||
'prize' => ['екр.', 25, 50, 75, 100, 200],
|
||||
'startlink' => 21
|
||||
'startlink' => 21,
|
||||
],
|
||||
'snt' => [
|
||||
'questname' => 'Сундук трупожора',
|
||||
'quest' => 'Открыть сундук трупожора.',
|
||||
'check' => ['Открытий', 5, 25, 50, 100, 250],
|
||||
'prize' => ['екр.', 10, 25, 50, 75, 200],
|
||||
'startlink' => 31
|
||||
'startlink' => 31,
|
||||
],
|
||||
'rp' => [
|
||||
'questname' => 'Руны 8 лвл.',
|
||||
'quest' => 'Получить руну при плавке плохих заготовок. [S]',
|
||||
'check' => ['Рун', 5, 10, 25, 50, 100],
|
||||
'prize' => ['Плохие <br> заготовки <br>', 5, 7, 10, 12, 15],
|
||||
'startlink' => 41
|
||||
'startlink' => 41,
|
||||
],
|
||||
'rn' => [
|
||||
'questname' => 'Руны 9 лвл.',
|
||||
'quest' => 'Получить руну при плавке нормальных заготовок. [M]',
|
||||
'check' => ['Рун', 5, 10, 15, 25, 50],
|
||||
'prize' => ['Нормальные <br> заготовки <br>', 5, 7, 9, 12, 15],
|
||||
'startlink' => 51
|
||||
'startlink' => 51,
|
||||
],
|
||||
'rb' => [
|
||||
'questname' => 'Руны 10 лвл.',
|
||||
'quest' => 'Получить руну при плавке идеальных заготовок. [L]',
|
||||
'check' => ['Рун', 2, 5, 8, 11, 15],
|
||||
'prize' => ['Идеальные <br> заготовки <br>', 2, 4, 6, 10, 15],
|
||||
'startlink' => 61
|
||||
'startlink' => 61,
|
||||
],
|
||||
'pg' => [
|
||||
'questname' => 'Героич. Сражения',
|
||||
'quest' => 'Поучаствовать в героическом сражении.',
|
||||
'check' => ['Участий', 100, 200, 400, 600, 1000],
|
||||
'prize' => ['Жетон <br>успеха <br>', 10, 20, 40, 60, 80],
|
||||
'startlink' => 71
|
||||
'startlink' => 71,
|
||||
],
|
||||
'bv' => [
|
||||
'questname' => 'Продажи Бабушке',
|
||||
'quest' => 'Продать бабушке найденные вещи в пещере.',
|
||||
'check' => ['Продаж', 5, 25, 50, 100, 250],
|
||||
'prize' => ['кр.', 500, 1000, 2000, 4000, 5000],
|
||||
'startlink' => 81
|
||||
'startlink' => 81,
|
||||
],
|
||||
'kw' => [
|
||||
'questname' => 'Клан Поединки',
|
||||
'quest' => 'Победить в клановой войне.',
|
||||
'check' => ['Побед', 5, 10, 15, 20, 25],
|
||||
'prize' => ['Свиток <br> кланового<br> опыта ', 1, 2, 5, 10, 15],
|
||||
'startlink' => 91
|
||||
'startlink' => 91,
|
||||
],
|
||||
'pa' => [ # not implemented!
|
||||
'questname' => 'Покровительство',
|
||||
'quest' => 'Получить покровительство Ангела.',
|
||||
'check' => ['Получено', 5, 25, 50, 100, 250],
|
||||
'prize' => null,
|
||||
'startlink' => null
|
||||
'startlink' => null,
|
||||
],
|
||||
'bs' => [
|
||||
'questname' => 'Башня смерти',
|
||||
'quest' => 'Победы в башне смерти.',
|
||||
'check' => ['Побед', 1, 5, 10, 50, 500],
|
||||
'prize' => ['екр.', 1, 5, 10, 50, 200],
|
||||
'startlink' => 101
|
||||
'startlink' => 101,
|
||||
],
|
||||
'trn' => [ # not implemented!
|
||||
'questname' => 'Турниры',
|
||||
'quest' => 'Поучавствовать в турнирах.',
|
||||
'check' => ['Побед', 25, 50, 100, 200, 500],
|
||||
'prize' => ['екр.', 25, 25, 25, 25, 50],
|
||||
'startlink' => 111
|
||||
'startlink' => 111,
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
|
||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]) ?: [];
|
||||
}
|
||||
|
||||
//fixme: сюда иногда приходит (NULL, NULL).
|
||||
private function prizeName(?int $int, ?string $string): string
|
||||
{
|
||||
return in_array($string, ['екр.', 'кр.']) ? $int . ' ' . $string : $string . ' ' . $int;
|
||||
}
|
||||
|
||||
private function drawSunduk($nagr, $whatInside, $tier): string
|
||||
{
|
||||
return vsprintf(
|
||||
'<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="Сундук">',
|
||||
[
|
||||
"location.href='\main.php?titul&nagr=$nagr'",
|
||||
"top.hi(this, '<b>Сундук $tier ранга<hr>Содержит:<hr> $whatInside</b>', event, 2, 0, 1, 1, 'max-width:307px')",
|
||||
"top.hic();",
|
||||
"top.hic();",
|
||||
"https://img.new-combats.com/i/titul/nagr$tier.gif"
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getList(): string
|
||||
{
|
||||
@@ -161,8 +143,8 @@ class Achievements
|
||||
$this->prizeName($value['prize'][2], $value['prize'][0]),
|
||||
$this->prizeName($value['prize'][3], $value['prize'][0]),
|
||||
$this->prizeName($value['prize'][4], $value['prize'][0]),
|
||||
$this->prizeName($value['prize'][5], $value['prize'][0])
|
||||
]
|
||||
$this->prizeName($value['prize'][5], $value['prize'][0]),
|
||||
],
|
||||
], 'prizelist', true);
|
||||
# If has new tier, AND only first 5 tiers AND prize is set.
|
||||
if (
|
||||
@@ -183,7 +165,7 @@ class Achievements
|
||||
return $string;
|
||||
}
|
||||
|
||||
private function calculateCurrent($check = null)
|
||||
private function calculateCurrent($check = null): void
|
||||
{
|
||||
$this->info['bs'] = $this->user->info['win_bs'];
|
||||
foreach ($this->info as $k => $v) {
|
||||
@@ -205,26 +187,46 @@ class Achievements
|
||||
$this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]);
|
||||
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
if ($this->info[$k] >= $this->data[$k]['check'][$i]) {
|
||||
$this->info["klas$k"] = $i;
|
||||
if ($i === 5) {
|
||||
# На 5 ранге должно отдавать максимум.
|
||||
$this->info["klasP$k"] = 100;
|
||||
} else {
|
||||
$this->info["klasP$k"] = Math::get100Percentage(
|
||||
$this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i],
|
||||
$this->info[$k] - $this->data[$k]['check'][$i]
|
||||
);
|
||||
}
|
||||
if ($this->info[$k] < $this->data[$k]['check'][$i]) {
|
||||
continue;
|
||||
}
|
||||
$this->info["klas$k"] = $i;
|
||||
if ($i === 5) {
|
||||
# На 5 ранге должно отдавать максимум.
|
||||
$this->info["klasP$k"] = 100;
|
||||
} else {
|
||||
$this->info["klasP$k"] = Math::get100Percentage(
|
||||
$this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i],
|
||||
$this->info[$k] - $this->data[$k]['check'][$i]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prizeName(?int $int, ?string $string): string
|
||||
{
|
||||
return in_array($string, ['екр.', 'кр.']) ? $int . ' ' . $string : $string . ' ' . $int;
|
||||
}
|
||||
|
||||
private function drawSunduk($nagr, $whatInside, $tier): string
|
||||
{
|
||||
return vsprintf(
|
||||
'<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="Сундук">',
|
||||
[
|
||||
"location.href='\main.php?titul&nagr=$nagr'",
|
||||
"top.hi(this, '<b>Сундук $tier ранга<hr>Содержит:<hr> $whatInside</b>', event, 2, 0, 1, 1, 'max-width:307px')",
|
||||
"top.hic();",
|
||||
"top.hic();",
|
||||
"//img.new-combats.tech/i/titul/nagr$tier.gif",
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getInfo(?int $uid = null)
|
||||
{
|
||||
if (!is_null($uid)) {
|
||||
$this->info = \Core\Db::getRow('select * from users_achiv where id = ?', [$uid]);
|
||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$uid]) ?: [];
|
||||
}
|
||||
$this->calculateCurrent();
|
||||
return $this->info;
|
||||
@@ -236,11 +238,6 @@ class Achievements
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
private function addOne($name)
|
||||
{
|
||||
\Core\Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
||||
}
|
||||
|
||||
public function updateTier($name)
|
||||
{
|
||||
if (in_array($name, array_keys($this->data))) {
|
||||
@@ -248,6 +245,11 @@ class Achievements
|
||||
}
|
||||
}
|
||||
|
||||
private function addOne($name)
|
||||
{
|
||||
Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
||||
}
|
||||
|
||||
public function updateCounter($name)
|
||||
{
|
||||
if (in_array($name, array_keys($this->data))) {
|
||||
@@ -271,7 +273,7 @@ class Achievements
|
||||
public function givePrizeItems($itemId, $aType)
|
||||
{
|
||||
for ($i = 1; $i <= $this->data[$aType]['prize'][$this->info[$aType . '_n'] + 1]; $i++) {
|
||||
$this->user->addItem($itemId, $this->user->info['id']);
|
||||
ItemsModel::addItem($itemId, $this->user->info['id']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Actions
|
||||
{
|
||||
public static function addDungeon(
|
||||
int $dungeonid,
|
||||
int $userid,
|
||||
int $x,
|
||||
int $y,
|
||||
string $vars = '',
|
||||
string $vals = '',
|
||||
): void {
|
||||
Db::sql(
|
||||
'insert into dungeon_actions (dn, x, y, time, uid, vars, vals) values (?,?,?,unix_timestamp(),?,?,?)',
|
||||
[
|
||||
$dungeonid,
|
||||
$x,
|
||||
$y,
|
||||
$userid,
|
||||
$vars,
|
||||
$vals,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public static function countDungeon(int $dungeonid, int $userid, string $vars = ''): int
|
||||
{
|
||||
return Db::getValue(
|
||||
'select count(id) from dungeon_actions where dn = ? and uid = ? and vars = ?',
|
||||
[
|
||||
$dungeonid,
|
||||
$userid,
|
||||
$vars,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace Admin;
|
||||
|
||||
use Core\Db;
|
||||
|
||||
readonly class Monster
|
||||
{
|
||||
public array $info;
|
||||
|
||||
public function __construct(int $monsterid)
|
||||
{
|
||||
$this->info = Db::getRow('select * from aaa_monsters where uid = ?', [$monsterid]);
|
||||
if ($_SERVER['REQUEST_METHOD'] === OAUTH_HTTP_METHOD_POST) {
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
private function save(): void
|
||||
{
|
||||
$params['uid'] = $this->info['uid'];
|
||||
$params['start_room'] = (int)$_POST['bot_sroom'];
|
||||
|
||||
$params['start_day'] = (int)$_POST['bot_sday'];
|
||||
$params['start_dd'] = (int)$_POST['bot_sdd'];
|
||||
$params['start_mm'] = (int)$_POST['bot_smm'];
|
||||
$params['start_hh'] = (int)$_POST['bot_shh'];
|
||||
$params['start_min'] = (int)$_POST['bot_smin'];
|
||||
|
||||
$params['back_day'] = (int)$_POST['bot_bday'];
|
||||
$params['back_dd'] = (int)$_POST['bot_bdd'];
|
||||
$params['back_mm'] = (int)$_POST['bot_bmm'];
|
||||
$params['back_hh'] = (int)$_POST['bot_bhh'];
|
||||
$params['back_min'] = (int)$_POST['bot_bmin'];
|
||||
|
||||
$params['start_text'] = $_POST['bot_stext'];
|
||||
$params['back_text'] = $_POST['bot_btext'];
|
||||
$params['win_text'] = $_POST['bot_wintext'];
|
||||
$params['lose_text'] = $_POST['bot_losetext'];
|
||||
$params['nich_text'] = $_POST['bot_nichtext'];
|
||||
|
||||
$params['win_back'] = $_POST['bot_winback'];
|
||||
$params['time_restart'] = $_POST['bot_trs'];
|
||||
|
||||
$params['win_itm'] = $_POST['bot_winitm'];
|
||||
$params['win_money1'] = $_POST['bot_winmoney1'];
|
||||
$params['win_money2'] = $_POST['bot_winmoney2'];
|
||||
$params['win_exp'] = $_POST['bot_winexp'];
|
||||
$params['win_eff'] = $_POST['bot_wineff'];
|
||||
$params['win_ico'] = $_POST['bot_winico'];
|
||||
|
||||
$params['lose_itm'] = $_POST['bot_loseitm'];
|
||||
$params['lose_money'] = $_POST['bot_losemoney1'];
|
||||
$params['lose_money2'] = $_POST['bot_losemoney2'];
|
||||
$params['lose_exp'] = $_POST['bot_loseexp'];
|
||||
$params['lose_eff'] = $_POST['bot_loseeff'];
|
||||
$params['lose_ico'] = $_POST['bot_loseico'];
|
||||
|
||||
if (!isset(
|
||||
$params['uid'],
|
||||
$params['start_room'],
|
||||
$params['start_day'],
|
||||
$params['back_day'],
|
||||
$params['start_dd'],
|
||||
$params['start_mm'],
|
||||
$params['start_hh'],
|
||||
$params['start_min'],
|
||||
$params['back_min'],
|
||||
$params['back_dd'],
|
||||
$params['back_mm'],
|
||||
$params['back_hh'],
|
||||
$params['start_text'],
|
||||
$params['back_text'],
|
||||
$params['win_text'],
|
||||
$params['lose_text'],
|
||||
$params['nich_text'],
|
||||
$params['win_money1'],
|
||||
$params['win_money2'],
|
||||
$params['lose_money'],
|
||||
$params['lose_money2'],
|
||||
$params['win_exp'],
|
||||
$params['lose_exp'],
|
||||
$params['win_itm'],
|
||||
$params['lose_itm'],
|
||||
$params['win_eff'],
|
||||
$params['lose_eff'],
|
||||
$params['win_ico'],
|
||||
$params['lose_ico'],
|
||||
$params['win_back'],
|
||||
$params['time_restart']
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
Db::sql('replace into aaa_monsters
|
||||
(uid, start_room, start_day, back_day, start_dd, start_mm, start_hh, start_min,
|
||||
back_min, back_dd, back_mm, back_hh, start_text, back_text, win_text, lose_text,
|
||||
nich_text, win_money1, win_money2, lose_money, lose_money2, win_exp, lose_exp,
|
||||
win_itm, lose_itm, win_eff, lose_eff, win_ico, lose_ico, win_back, time_restart)
|
||||
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [
|
||||
$params['uid'],
|
||||
$params['start_room'],
|
||||
$params['start_day'],
|
||||
$params['back_day'],
|
||||
$params['start_dd'],
|
||||
$params['start_mm'],
|
||||
$params['start_hh'],
|
||||
$params['start_min'],
|
||||
$params['back_min'],
|
||||
$params['back_dd'],
|
||||
$params['back_mm'],
|
||||
$params['back_hh'],
|
||||
$params['start_text'],
|
||||
$params['back_text'],
|
||||
$params['win_text'],
|
||||
$params['lose_text'],
|
||||
$params['nich_text'],
|
||||
$params['win_money1'],
|
||||
$params['win_money2'],
|
||||
$params['lose_money'],
|
||||
$params['lose_money2'],
|
||||
$params['win_exp'],
|
||||
$params['lose_exp'],
|
||||
$params['win_itm'],
|
||||
$params['lose_itm'],
|
||||
$params['win_eff'],
|
||||
$params['lose_eff'],
|
||||
$params['win_ico'],
|
||||
$params['lose_ico'],
|
||||
$params['win_back'],
|
||||
$params['time_restart'],
|
||||
]);
|
||||
|
||||
echo '<b style="color: red">Новые данные были успешно сохранены!</b>';
|
||||
}
|
||||
}
|
||||
+4084
-9280
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
<?php
|
||||
|
||||
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
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Battle;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function getChanse(int $percent): bool
|
||||
{
|
||||
return mt_rand(0, 100) <= $percent;
|
||||
}
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,679 @@
|
||||
<?php
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Log
|
||||
{
|
||||
/**
|
||||
* @param array $data [text,battle,id_hod,vars,type]
|
||||
* @return void
|
||||
*/
|
||||
public static function add(array $data): void
|
||||
{
|
||||
if (
|
||||
empty($data['text']) ||
|
||||
empty($data['battle']) ||
|
||||
empty($data['id_hod']) ||
|
||||
!isset($data['vars']) ||
|
||||
!isset($data['type'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($data['type'])) {
|
||||
$data['type'] = 0;
|
||||
}
|
||||
|
||||
Db::sql(
|
||||
"insert into battle_logs (time, battle, id_hod, text, vars, type, zona1, zona2, zonb1, zonb2)
|
||||
values (unix_timestamp(),?,?,?,?,?,'','','','')",
|
||||
[
|
||||
$data['battle'],
|
||||
$data['id_hod'],
|
||||
$data['text'],
|
||||
$data['vars'],
|
||||
$data['type'],
|
||||
]
|
||||
);
|
||||
|
||||
if (Helper::getChanse(12)) {
|
||||
self::addComment($data['battle'], $data['id_hod']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static function addComment(int $battleId, int $hodId): void
|
||||
{
|
||||
$comments = [
|
||||
'А танцуешь ты лучше.',
|
||||
'А мы что, в прятки тут играем?',
|
||||
'А вы разве пингвинов никогда не видели?',
|
||||
'А, ведь когда-то, вы были красивыми… А теперь? Ну и рожи! Жуть!',
|
||||
'А потом еще труп пинать будут.',
|
||||
'А я вчера ночью за соседями подглядывал. Они точно так же кувыркались',
|
||||
'А ведь вы живых людей дубасите...',
|
||||
'А вот я вчера в зоопарке был...',
|
||||
'А вы в стройбате не служили?',
|
||||
'А вы видели, чтобы так на улице делали!?',
|
||||
'А вы знали что ёжики размножаются в интернете?',
|
||||
'А жить-то, как хочется:',
|
||||
'А из-за чего вы собственно дерётесь?',
|
||||
'А чего ржёте, вы ещё остальных не видели',
|
||||
'А что произойдёт если ты испугаешся до полусмерти дважды?!',
|
||||
'Больше так не делай. Ты же не садист?',
|
||||
'Без комментариев...',
|
||||
'Больно ведь!',
|
||||
'Быстро ты за монитор спрятался!',
|
||||
'Все хотят попасть в рай, но никто не хочет умирать!',
|
||||
'Вчера с такой девчонкой познакомился.',
|
||||
'Всего 5 минут знакомы, а дерутся, словно супруги с 20-ти летним стажем...',
|
||||
'Все. Я так больше не могу.',
|
||||
'В конце концов, кто-то победит?',
|
||||
'Вы чего, с дерева упали?',
|
||||
'Возятся как сонные мухи... давайте я вам лучше анекдот расскажу: ...',
|
||||
'Вот видишь, как полезно чистить зубы на ночь?',
|
||||
'Вот вы все руками махаете, а за вами уже очередь',
|
||||
'Вот попадёте вы в плен и вас там будут долго бить. Но вы ничего не расскажете... и не потому, что вы такой стойкий, просто вы ничего не знаете',
|
||||
'Вы бы лучше пошли потренировались!',
|
||||
'Вы все еще разминаетесь? Позовите, когда кости в муку друг другу разминать будете.',
|
||||
'Вы же бойцы! Имейте совесть!',
|
||||
'Гаси недоумка!',
|
||||
'Да, если бы я смог это остановить, то получил бы нобелевскую премию `За мир` ',
|
||||
'Да куда они бьют?!',
|
||||
'Давайте быстрее! За вами уже очередь образовалась.',
|
||||
'Давайте обойдемся сегодня таймаутом. А? А то мне уже кошмары скоро будут сниться.',
|
||||
'Дерутся как девчонки!',
|
||||
'Дети, посмотрите налево... Ой!.. Нет, туда лучше не смотреть.',
|
||||
'Если так будет продолжаться, то скоро мы заснем!',
|
||||
'Если бы у меня было кресло-качалка, я бы в нём качался...',
|
||||
'Если вы что-то сказать хотите, то лучше молчите :)',
|
||||
'Жестокость не порок.',
|
||||
'Жизнь вне нашего клуба - это пустая трата кислорода!!!',
|
||||
'Жми! Дави! Кусай! Царапай!',
|
||||
'За такие бои надо в хаос отправлять!',
|
||||
'Знаете откуда в комиссионном магазине столько вещей? Это я после ваших гулянок собираю и сдаю туда. Иногда вместе с частями тела, застрявшими в них.',
|
||||
'Здесь люди так близки друг к другу. Просто иначе ударить нельзя.',
|
||||
'И пролитая кровь еще пульсирует...',
|
||||
'Инвалидов развелось...',
|
||||
'Какой бой!!!',
|
||||
'Кто!? Кто здесь?!',
|
||||
'Кто вас этому научил?',
|
||||
'Кузнечик, блин...',
|
||||
'Куплю импортный проигрыватель грампластинок.',
|
||||
'Лошадью ходи!',
|
||||
'Лучше враг, чем друг - враг.',
|
||||
'Ладно, вы тут пока друг друга за волосы таскайте, а я пойду, пообедаю.',
|
||||
'Мне ваш балет уже надоел!',
|
||||
'Может, начнется-таки настоящий бой???',
|
||||
'Мысли лезут в голову изнутри, а удары снаружи.',
|
||||
'Ну и где ваши коронные удары? Где живописные падения я спрашиваю!',
|
||||
'Ну, нельзя же так наотмашь лупить!',
|
||||
'Надо раньше было думать, теперь смертельно поздно...',
|
||||
'На такое зрелище билеты продавать можно. Народ ухохочется!',
|
||||
'Нет! Не надо драки! А... ладно деритесь, все равно не умеете.',
|
||||
'Нет, ну должен быть повод, должен же быть повод?',
|
||||
'Нет, я отказываюсь это комментировать!',
|
||||
'Не таких обламывали!',
|
||||
'Ну выпили вы рюмку, ну две... ну литр, ну два... так зачем же после этого драку затевать?!',
|
||||
'Ну и кто за этот погром платить будет?',
|
||||
'Ну и оскал у вас. Из вашей улыбки кастеты делать можно.',
|
||||
'Ну, что же ты..? Не печалься. Выше голову, так по ней удобней попасть.',
|
||||
'Ничего... Блок тоже удар.',
|
||||
'Обернись!!!.... Поздно...',
|
||||
'Ого! Научите меня так не делать.',
|
||||
'Осторожно! Сделаешь дырочку, уже не запломбируешь!',
|
||||
'Оно вам надо???',
|
||||
'Обычное дело...там что-то отклеилось.',
|
||||
'Ой, и заболтался я с вами...',
|
||||
'Он же не промахнётся если ты не отойдёшь!',
|
||||
'По-моему, кому-то светит инвалидность.',
|
||||
'Подкинь ему грабли, на которые он еще не наступал.',
|
||||
'Прав был кот Леопольд, давайте жить дружно?',
|
||||
'При ударе в живот нарушается кислотно-щелочной баланс.',
|
||||
'Проверь, не торчит ли у тебя нож из живота.',
|
||||
'Перестаньте мне орать!',
|
||||
'Подкинь ему грабли, на которые он еще не наступал.',
|
||||
'Прыгают тут как блохи... Все, я пошел за дихлофосом!',
|
||||
'Разбудите меня когда эта порнография закончится...',
|
||||
'Ребенок сильнее ударил бы!',
|
||||
'Славно вмазал!',
|
||||
'Славно они веселятся',
|
||||
'Смотрю вот на вас, и слезы наворачиваются.',
|
||||
'Сначала учатся ходить, а потом только в драку лезут.',
|
||||
'Так они друг другу что-нибудь сломают.',
|
||||
'Так ты ему все кости переломаешь!',
|
||||
'У меня в подъезде точно так же соседа отмудохали',
|
||||
'Убогих развелось...',
|
||||
'Ух ты, какой прыткий!',
|
||||
'Фашист!! Надо ж, так по больному месту врезать...',
|
||||
'Хватит бить его об угол моей кабинки! Мне же потом ее чинить.',
|
||||
'Хулиганы, прекратите немедленно!',
|
||||
'Хочешь, подскажу, куда он ударит?',
|
||||
'Хорошо, что у меня ловкости больше чем у вас всех, а то б вы и меня в инвалидную коляску посадили бы.',
|
||||
'Хороший бой!',
|
||||
'Хороший удар!',
|
||||
'Хиляк-разрядник!',
|
||||
'Что ты его за волосы схватил?! Отпусти немедленно!',
|
||||
'Щас я вас настигну, вот тогда мы и похохочем',
|
||||
'Это была какая-то неизвестная мне техника...',
|
||||
'Это же противник, а не глина! Хватит мяться!',
|
||||
'Это не бой, это издевательское избиение.',
|
||||
'Это поубавит спеси',
|
||||
'Это и был твой план `Б` ?',
|
||||
'Это была какая-то неизвестная мне техника...',
|
||||
'Я же предупреждал, - будет больно.',
|
||||
'Я не страдаю безумием. Я наслаждаюсь им каждую минуту :)',
|
||||
'Я красивый, я сильный, я умный, я добрый. А вот вы? Вы себя-то видели?!',
|
||||
'Я тоже умею драться, но не буду...',
|
||||
'(тревожно озираясь) я вам по секрету скажу... за вами наблюдают!',
|
||||
'<вырезано цензурой> после боя я этих <вырезано цензурой> обоих в <вырезано цензурой> и <вырезано цензурой>',
|
||||
'<вырезано цензурой> каратисты фиговы',
|
||||
];
|
||||
$randomcomment = $comments[array_rand($comments)];
|
||||
|
||||
self::add(
|
||||
[
|
||||
'battle' => $battleId,
|
||||
'id_hod' => $hodId,
|
||||
'text' => "{tm1} <i>Комментатор: $randomcomment</i>",
|
||||
'vars' => 'time1=' . time(),
|
||||
'type' => 1,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public static function getAttackTurnText(int $weaponType, int $attackZone): array
|
||||
{
|
||||
$w = [
|
||||
0 => ['грудью', 'ребром руки', 'лбом', 'кулаком', 'ногой', 'левой ногой', 'правой ногой', 'коленом',],
|
||||
1 => ['ножом', 'тыльной стороной лезвия ножа', 'рукоятью ножа', 'лезвием ножа'],
|
||||
2 => ['сучковатой палкой', 'поленом', 'тяжелой дубиной', 'дубиной', 'рукоятью молота'],
|
||||
3 => ['секирой', 'топором', 'лезвием секиры', 'алебардой', 'тяжелым держаком', 'длинной секирой'],
|
||||
4 => ['ножнами', 'гардой', 'мечом', 'лезвием меча', 'рукоятью меча', 'тупым лезвием', 'острой стороной меча', 'огромным мечом',],
|
||||
5 => ['сучковатой палкой', 'посохом', 'тяжелой тростью', 'корявым посохом', 'основанием посоха'],
|
||||
22 => ['костылем'],
|
||||
100 => ['непонятной хреновиной'],
|
||||
];
|
||||
|
||||
$z = [
|
||||
1 => ['в нос', 'в глаз', 'в челюсть', 'по переносице', 'в кадык', 'по затылку', 'в правый глаз', 'в левый глаз', 'в скулу',],
|
||||
2 => ['в грудь', 'в корпус', 'в солнечное сплетение', 'в сердце', 'в область лопаток'],
|
||||
3 => ['в бок', 'по желудку', 'по левой руке', 'по правой руке'],
|
||||
4 => ['по <вырезано цензурой>', 'в пах', 'в промежность', 'по левой ягодице', 'по правой ягодице'],
|
||||
5 => ['по ногам', 'в область правой пятки', 'в область левой пятки', 'по коленной чашечке', 'по икрам'],
|
||||
100 => ['по непонятному месту'],
|
||||
];
|
||||
|
||||
if (!in_array($weaponType, [0, 1, 2, 3, 4, 5, 22])) {
|
||||
$weaponType = 100;
|
||||
}
|
||||
|
||||
if (!in_array($attackZone, [1, 2, 3, 4, 5])) {
|
||||
$attackZone = 100;
|
||||
}
|
||||
|
||||
return [
|
||||
$w[$weaponType][array_rand($w[$weaponType])],
|
||||
$z[$attackZone][array_rand($z[$attackZone])],
|
||||
];
|
||||
}
|
||||
|
||||
public static function addLogLine(int $type, int $gender, bool $count = false): string|int
|
||||
{
|
||||
$logtext = [
|
||||
[ // муж.
|
||||
[],
|
||||
[
|
||||
'вспомнил что-то важное',
|
||||
'высморкался',
|
||||
'задумался',
|
||||
'замешкался',
|
||||
'засмотрелся на <вырезано цензурой>',
|
||||
'кашлянул',
|
||||
'ковырялся в зубах',
|
||||
'обернулся',
|
||||
'осмотрелся',
|
||||
'почесался',
|
||||
'пошатнулся',
|
||||
'пришел в себя',
|
||||
'пытался сконцентрироваться',
|
||||
'пытался увернуться',
|
||||
'пытался что-то сказать',
|
||||
'расплылся в улыбке',
|
||||
'расстроился',
|
||||
'растерялся',
|
||||
'удивился',
|
||||
'чесал <вырезано цензурой>',
|
||||
'пытался отойти покурить',
|
||||
'чесал яйца',
|
||||
],
|
||||
[
|
||||
', и за это ',
|
||||
', а ',
|
||||
', но в это время ',
|
||||
', и тут ',
|
||||
', но вдруг неожиданно ',
|
||||
', и вдруг ',
|
||||
', но ',
|
||||
', и внезапно ',
|
||||
', но неожиданно ',
|
||||
', и в этот момент ',
|
||||
', и в ту же секунду ',
|
||||
', и в этот миг ',
|
||||
],
|
||||
[
|
||||
'обезумевший',
|
||||
'расстроенный',
|
||||
'неустрашимый',
|
||||
'продвинутый',
|
||||
'расстроенный',
|
||||
'страшный',
|
||||
'задумчивый',
|
||||
'небритый',
|
||||
'бесстрастный',
|
||||
'разъяренный',
|
||||
'смелый',
|
||||
'безумный',
|
||||
'восхитительный',
|
||||
'жестокий',
|
||||
'злобный',
|
||||
'мужественный',
|
||||
'непобедимый',
|
||||
'наглый',
|
||||
'хитрый',
|
||||
'храбрый',
|
||||
'отважный',
|
||||
'железный',
|
||||
'могучий',
|
||||
'сильнейший',
|
||||
'крепкий',
|
||||
'великий',
|
||||
'бесстрашный',
|
||||
],
|
||||
[
|
||||
'случайно ',
|
||||
'отчаянно ',
|
||||
'проснувшись ',
|
||||
'мимоходом ',
|
||||
'разбежавшись ',
|
||||
'сдуру ',
|
||||
'со скуки ',
|
||||
'не помня себя от испуга ',
|
||||
'улыбаясь ',
|
||||
'прослезившись ',
|
||||
'пошатнувшись ',
|
||||
'проснувшись ',
|
||||
'беспричинно ',
|
||||
'опрометчиво ',
|
||||
'разбежавшись ',
|
||||
'зевнув ',
|
||||
'сделав двойное сальто ',
|
||||
'не подумав ',
|
||||
'хихикая ',
|
||||
'ласково ',
|
||||
'с испугу ',
|
||||
],
|
||||
[
|
||||
'влепил ',
|
||||
'вломил ',
|
||||
'саданул ',
|
||||
],
|
||||
[
|
||||
'грубый',
|
||||
'наглый',
|
||||
'красивый',
|
||||
],
|
||||
[
|
||||
'неизвестный удар',
|
||||
'колющий удар',
|
||||
'рубящий удар',
|
||||
'дробящий удар',
|
||||
'режущий удар',
|
||||
'обжигающий удар',
|
||||
'удар электричеством',
|
||||
'обмораживающий удар',
|
||||
'удар магией земли',
|
||||
'удар светлой магией',
|
||||
'удар тёмной магией',
|
||||
'удар серой магией',
|
||||
'обычный удар',
|
||||
'удар',
|
||||
],
|
||||
[
|
||||
'не контролировал ситуацию',
|
||||
'обманулся',
|
||||
'старался провести удар',
|
||||
'думал о <вырезано цензурой>',
|
||||
'испугался',
|
||||
'потерял самоконтроль',
|
||||
'потерял момент',
|
||||
'был слишком самоуверен',
|
||||
'пытался провести удар',
|
||||
'поскользнулся',
|
||||
'не думал о бое',
|
||||
'не рассчитал свои силы',
|
||||
'промахнулся',
|
||||
'оступился',
|
||||
'думал не о том',
|
||||
],
|
||||
[
|
||||
', и потому ',
|
||||
' и ',
|
||||
', но ',
|
||||
', вследствие чего ',
|
||||
', потому ',
|
||||
],
|
||||
[
|
||||
'остановил',
|
||||
'поставил блок на',
|
||||
'блокировал',
|
||||
'отбил',
|
||||
],
|
||||
[
|
||||
'ушел вправо от удара',
|
||||
'ушел влево от удара',
|
||||
'увел удар',
|
||||
'уклонился от удара',
|
||||
'увернулся от удара',
|
||||
],
|
||||
[
|
||||
'приняв боевые 100 грамм',
|
||||
'сказав "БУ!"',
|
||||
'показав противнику кукиш',
|
||||
'в отчаянном рывке',
|
||||
'показав сразу два пальца',
|
||||
],
|
||||
[
|
||||
'о<вырезано цензурой>ный',
|
||||
'точнейший',
|
||||
],
|
||||
[
|
||||
'погиб!',
|
||||
'повержен!',
|
||||
'мертв!',
|
||||
'убит!',
|
||||
'проиграл бой!',
|
||||
],
|
||||
[
|
||||
'пропустил свой ход',
|
||||
'потратил свой ход на магию',
|
||||
'потратил свой ход на прием',
|
||||
],
|
||||
[
|
||||
'использовал',
|
||||
],
|
||||
[
|
||||
'{u1}, вспомнив слова своего сэнсея, из последних сил применил прием "{pr}".',
|
||||
'Кроличья лапка, подкова в перчатке и прием "{pr}" помогли {u1} продержаться ещё немного.',
|
||||
'{u1}, пораскинув мозгами по земле, сообразил, что его выручат или прием "{pr}" или вмешательство Мусорщика.',
|
||||
'{u1} выкрикнув: "А ещё я вот так могу!", применил прием "{pr}".',
|
||||
'{u1} понял, пропустив очередной удар в голову, что поможет ему только прием "{pr}".',
|
||||
'{u1} сам не поняв зачем, применил прием "{pr}".',
|
||||
'{u1} нетрезво оценив положение, решил, что его спасение это прием "{pr}".',
|
||||
],
|
||||
[
|
||||
'{u1}, вспомнив слова своего сэнсея, из последних сил применил прием "{pr}" на {u2}.',
|
||||
],
|
||||
[
|
||||
'{u1}, победив страх, решил поразить {u2} заклятьем "{pr}"',
|
||||
'{u1} наконец сфокусировал свое внимание на поединке и наколдовал "{pr}" на {u2}',
|
||||
'{u1} нарисовав вокруг себя несколько рун, призвал заклятье "{pr}" на {u2}',
|
||||
'{u1} догадавшись, что пришло время показать себя, произнес заклятье "{pr}" на {u2}',
|
||||
'{u1} с испугу произнес, первое пришедшее на ум, заклятье "{pr}" на {u2}',
|
||||
'{u1} впал в транс и начал бормотать заклятие "{pr}" на {u2}',
|
||||
'{u1} очнулся от медитации, и призвал заклятье "{pr}" на {u2}',
|
||||
],
|
||||
[
|
||||
'{u1} пытался наколдовать ужасающее заклятие "{pr}" на {u2}, но ничего не вышло',
|
||||
'{u1} не смог сфокусировать и наколдовать "{pr}" на {u2}, но ничего не вышло',
|
||||
'{u1} с испугу произнес ошибочное заклятие "{pr}" на {u2} и ничего не вышло',
|
||||
'{u1}, потеряв концентрацию, не смог наколдовать "{pr}" на {u2} и ничего не вышло',
|
||||
'{u1} <вырезано цензурой> от перенапряжения, вследствие чего не смог наколдовать "{pr}" на {u2}',
|
||||
'{u1} пытался превратить {u2} в табуретку при помощи заклинания "{pr}"... но ничего не вышло',
|
||||
],
|
||||
[
|
||||
'{u1}, победив страх, решил поразить всех и наколдовал "{pr}"',
|
||||
'{u1} наконец сфокусировал свое внимание на поединке и наколдовал "{pr}"',
|
||||
'{u1} нарисовав вокруг себя несколько рун, призвал заклятье "{pr}"',
|
||||
'{u1} догадавшись, что пришло время показать себя, произнес заклятье "{pr}"',
|
||||
'{u1} с испугу произнес, первое пришедшее на ум, заклятье "{pr}"',
|
||||
'{u1} впал в транс и начал бормотать заклятие "{pr}"',
|
||||
'{u1} очнулся от медитации, и призвал заклятье "{pr}"',
|
||||
],
|
||||
|
||||
],
|
||||
[ // жен.
|
||||
[],
|
||||
[
|
||||
'вспомнила что-то важное',
|
||||
'высморкалась',
|
||||
'задумалась',
|
||||
'замешкалась',
|
||||
'засмотрелась на <вырезано цензурой>',
|
||||
'кашлянула',
|
||||
'ковырялась в зубах',
|
||||
'обернулась',
|
||||
'осмотрелась',
|
||||
'почесалась',
|
||||
'пошатнулась',
|
||||
'пришла в себя',
|
||||
'пыталась сконцентрироваться',
|
||||
'пыталась увернуться',
|
||||
'пыталась что-то сказать',
|
||||
'расплылалась в улыбке',
|
||||
'расстроилась',
|
||||
'растерялась',
|
||||
'удивилась',
|
||||
'чесала <вырезано цензурой>',
|
||||
'пыталась отойти покурить',
|
||||
'поправляла прическу',
|
||||
],
|
||||
[
|
||||
', и за это ',
|
||||
', а ',
|
||||
', но в это время ',
|
||||
', и тут ',
|
||||
', но вдруг неожиданно ',
|
||||
', и вдруг ',
|
||||
', но ',
|
||||
', и внезапно ',
|
||||
', но неожиданно ',
|
||||
', и в этот момент ',
|
||||
', и в ту же секунду ',
|
||||
', и в этот миг ',
|
||||
],
|
||||
[
|
||||
'обезумевшая',
|
||||
'расстроенная',
|
||||
'неустрашимая',
|
||||
'продвинутая',
|
||||
'расстроенная',
|
||||
'страшная',
|
||||
'задумчивая',
|
||||
'взъерошенная',
|
||||
'бесстрастная',
|
||||
'разъяренная',
|
||||
'смелая',
|
||||
'безумная',
|
||||
'восхитительная',
|
||||
'жестокая',
|
||||
'злобная',
|
||||
'мужественная',
|
||||
'непобедимая',
|
||||
'наглая',
|
||||
'хитрая',
|
||||
'храбрая',
|
||||
'отважная',
|
||||
'железная',
|
||||
'могучая',
|
||||
'сильнейшая',
|
||||
'крепкая',
|
||||
'великая',
|
||||
'бесстрашная',
|
||||
],
|
||||
[
|
||||
'случайно ',
|
||||
'отчаянно ',
|
||||
'проснувшись ',
|
||||
'мимоходом ',
|
||||
'разбежавшись ',
|
||||
'сдуру ',
|
||||
'со скуки ',
|
||||
'не помня себя от испуга ',
|
||||
'улыбаясь ',
|
||||
'прослезившись ',
|
||||
'пошатнувшись ',
|
||||
'проснувшись ',
|
||||
'беспричинно ',
|
||||
'опрометчиво ',
|
||||
'разбежавшись ',
|
||||
'зевнув ',
|
||||
'сделав двойное сальто ',
|
||||
'не подумав ',
|
||||
'хихикая ',
|
||||
'ласково ',
|
||||
'с испугу ',
|
||||
],
|
||||
[
|
||||
'влепила ',
|
||||
'вломила ',
|
||||
'саданула ',
|
||||
],
|
||||
[
|
||||
'грубый',
|
||||
'наглый',
|
||||
'красивый',
|
||||
],
|
||||
[
|
||||
'тычок',
|
||||
'тычок',
|
||||
'рубящий удар',
|
||||
'разбивающий удар',
|
||||
'рассекающий удар',
|
||||
'обжигающий удар',
|
||||
'удар электричеством',
|
||||
'обмораживающий удар',
|
||||
'удар магией земли',
|
||||
'удар светлой магией',
|
||||
'удар тёмной магией',
|
||||
'удар серой магией',
|
||||
'неизсветный удар',
|
||||
'удар',
|
||||
],
|
||||
[
|
||||
'не контролировала ситуацию',
|
||||
'обманулась',
|
||||
'старалась провести удар',
|
||||
'думала о <вырезано цензурой>',
|
||||
'испугалась',
|
||||
'потеряла самоконтроль',
|
||||
'потеряла момент',
|
||||
'была слишком самоуверенна',
|
||||
'пыталась провести удар',
|
||||
'поскользнулась',
|
||||
'не думала о бое',
|
||||
'не рассчитала свои силы',
|
||||
'промахнулась',
|
||||
'оступилась',
|
||||
'думала не о том',
|
||||
],
|
||||
[
|
||||
', и потому ',
|
||||
' и ',
|
||||
', но ',
|
||||
', вследствие чего ',
|
||||
', потому ',
|
||||
],
|
||||
[
|
||||
'остановила',
|
||||
'поставила блок на',
|
||||
'блокировала',
|
||||
'отбила',
|
||||
],
|
||||
[
|
||||
'ушла вправо от удара',
|
||||
'ушла влево от удара',
|
||||
'увела удар',
|
||||
'уклонилась от удара',
|
||||
'увернулась от удара',
|
||||
],
|
||||
[
|
||||
'приняв боевые 100 грамм',
|
||||
'сказав "БУ!"',
|
||||
'показав противнику кукиш',
|
||||
'в отчаянном рывке',
|
||||
'показав сразу два пальца',
|
||||
],
|
||||
[
|
||||
'о<вырезано цензурой>ный',
|
||||
'точнейший',
|
||||
],
|
||||
[
|
||||
'погибла!',
|
||||
'повержена!',
|
||||
'мертва!',
|
||||
'убита!',
|
||||
'проиграла бой!',
|
||||
],
|
||||
[
|
||||
'пропустила свой ход',
|
||||
'потратила свой ход на магию',
|
||||
'потратила свой ход на прием',
|
||||
],
|
||||
[
|
||||
'использовала',
|
||||
],
|
||||
[
|
||||
'{u1}, вспомнив слова своего сэнсея, из последних сил применила прием "{pr}".',
|
||||
'Кроличья лапка, подкова в перчатке и прием "{pr}" помогли {u1} продержаться ещё немного.',
|
||||
'{u1}, пораскинув мозгами по земле, сообразила, что её выручат или прием "{pr}" или вмешательство Мусорщика.',
|
||||
'{u1} выкрикнув: "А ещё я вот так могу!", применила прием "{pr}".',
|
||||
'{u1} поняла, пропустив очередной удар в голову, что поможет ей только прием "{pr}".',
|
||||
'{u1} сама не поняв зачем, применила прием "{pr}".',
|
||||
'{u1} нетрезво оценив положение, решила, что её спасение это прием "{pr}".',
|
||||
],
|
||||
[
|
||||
'{u1}, вспомнив слова своего сэнсея, из последних сил применила прием "{pr}" на {u2}.',
|
||||
],
|
||||
[
|
||||
'{u1}, победив страх, решила поразить {u2} заклятьем "{pr}"',
|
||||
'{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}" на {u2}',
|
||||
'{u1} нарисовав вокруг себя несколько рун, призвала заклятье "{pr}" на {u2}',
|
||||
'{u1} догадавшись, что пришло время показать себя, произнесла заклятье "{pr}" на {u2}',
|
||||
'{u1} с испугу произнесла, первое пришедшее на ум, заклятье "{pr}" на {u2}',
|
||||
'{u1} впала в транс и начала бормотать заклятие "{pr}" на {u2}',
|
||||
'{u1} очнулась от медитации, и призвала заклятье "{pr}" на {u2}',
|
||||
],
|
||||
[
|
||||
'{u1} пыталась наколдовать ужасающее заклятие "{pr}" на {u2}, но ничего не вышло',
|
||||
'{u1} не смогла сфокусировать и наколдовать "{pr}" на {u2}, но ничего не вышло',
|
||||
'{u1} с испугу произнесла ошибочное заклятие "{pr}" на {u2} и ничего не вышло',
|
||||
'{u1}, потеряв концентрацию, не смогла наколдовать "{pr}" на {u2} и ничего не вышло',
|
||||
'{u1} <вырезано цензурой> от перенапряжения, вследствие чего не смогла наколдовать "{pr}" на {u2}',
|
||||
'{u1} пыталась превратить {u2} в табуретку при помощи заклинания "{pr}"... но ничего не вышло',
|
||||
],
|
||||
[
|
||||
'{u1}, победив страх, решила поразить всех и наколдовала "{pr}"',
|
||||
'{u1} наконец сфокусировала свое внимание на поединке и наколдовала "{pr}"',
|
||||
'{u1} нарисовав вокруг себя несколько рун, призвала заклятье "{pr}"',
|
||||
'{u1} догадавшись, что пришло время показать себя, произнесла заклятье "{pr}"',
|
||||
'{u1} с испугу произнесла, первое пришедшее на ум, заклятье "{pr}"',
|
||||
'{u1} впала в транс и начала бормотать заклятие "{pr}"',
|
||||
'{u1} очнулась от медитации, и призвала заклятье "{pr}"',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if ($count) {
|
||||
return count($logtext[$gender][$type]);
|
||||
}
|
||||
|
||||
if (!in_array($gender, [0, 1]) || !in_array($type, range(1, 21))) {
|
||||
return 'произошло нечто непонятное';
|
||||
}
|
||||
|
||||
return $logtext[$gender][$type][array_rand($logtext[$gender][$type])];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Battle\Priem;
|
||||
|
||||
abstract class AbstractPriem implements PriemInterface
|
||||
{
|
||||
protected int $caster;
|
||||
protected string $name;
|
||||
protected string $icon;
|
||||
|
||||
protected int $power;
|
||||
|
||||
/**
|
||||
* На кого применяем приём. Например:
|
||||
* self, static_friend, static_enemy, random_friend, random_enemy, random_friend_group, random_enemy_group,
|
||||
* all_friend, all_enemy, all,...
|
||||
* @var int
|
||||
*/
|
||||
protected int $targetType;
|
||||
|
||||
/**
|
||||
* Массив id союзников
|
||||
* @var array
|
||||
*/
|
||||
protected array $friendTeam;
|
||||
|
||||
/** Массив id противников
|
||||
* @var array
|
||||
*/
|
||||
protected array $enemyTeam;
|
||||
|
||||
public function __construct(
|
||||
int $caster,
|
||||
array $friendTeam,
|
||||
array $enemyTeam,
|
||||
int $targetType,
|
||||
string $name,
|
||||
string $icon = '',
|
||||
) {
|
||||
$this->caster = $caster;
|
||||
$this->friendTeam = $friendTeam;
|
||||
$this->enemyTeam = $enemyTeam;
|
||||
$this->targetType = $targetType;
|
||||
$this->icon = $icon;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
protected function getTarget(): array
|
||||
{
|
||||
$targets = [];
|
||||
$allExceptCaster = array_merge($this->friendTeam, $this->enemyTeam);
|
||||
switch ($this->targetType) {
|
||||
case self::TAGRET_SELF:
|
||||
$targets[] = $this->caster;
|
||||
break;
|
||||
case self::TARGET_RANDOM_ENEMY:
|
||||
shuffle($this->enemyTeam);
|
||||
$targets[] = end($this->enemyTeam);
|
||||
break;
|
||||
case self::TARGET_RANDOM_FRIEND:
|
||||
shuffle($this->friendTeam);
|
||||
$targets[] = end($this->friendTeam);
|
||||
break;
|
||||
case self::TARGET_RANDOM:
|
||||
shuffle($allExceptCaster);
|
||||
$targets[] = end($allExceptCaster);
|
||||
break;
|
||||
case self::TARGET_RANDOM_ENEMIES:
|
||||
for ($i = 1; $i <= count($this->enemyTeam); $i++) {
|
||||
if ($i > 1 && mt_rand(1,2) === 1) {
|
||||
continue;
|
||||
}
|
||||
shuffle($this->enemyTeam);
|
||||
$targets[] = array_shift($this->enemyTeam);
|
||||
}
|
||||
break;
|
||||
case self::TARGET_RANDOM_FRIENDS:
|
||||
for ($i = 1; $i <= count($this->friendTeam); $i++) {
|
||||
if ($i > 1 && mt_rand(1,2) === 1) {
|
||||
continue;
|
||||
}
|
||||
shuffle($this->friendTeam);
|
||||
$targets[] = array_shift($this->friendTeam);
|
||||
}
|
||||
break;
|
||||
case self::TARGET_RANDOMS:
|
||||
for ($i = 1; $i <= count($allExceptCaster); $i++) {
|
||||
if ($i > 1 && mt_rand(1,2) === 1) {
|
||||
continue;
|
||||
}
|
||||
shuffle($allExceptCaster);
|
||||
$targets[] = array_shift($allExceptCaster);
|
||||
}
|
||||
break;
|
||||
case self::TARGET_ALL_ENEMIES:
|
||||
$targets = $this->enemyTeam;
|
||||
break;
|
||||
case self::TARGET_ALL_FRIENDS:
|
||||
$targets = $this->friendTeam;
|
||||
break;
|
||||
case self::TARGET_ALL:
|
||||
$targets = $allExceptCaster;
|
||||
$targets[] = $this->caster;
|
||||
break;
|
||||
}
|
||||
return $targets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает иконку приёма. В текущей реализации у каждого приёма должна быть иконка.
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getIcon(): string;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Battle\Priem;
|
||||
|
||||
class Priem extends AbstractPriem
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
id, name, image,
|
||||
damage_type_value: static, +value,
|
||||
damage_time: now, next_turn, x_turns,
|
||||
target: self, static_friend, static_enemy, random_friend, random_enemy, random_friend_group, random_enemy_group, all_friend, all_enemy, all,
|
||||
damage_type: physical (колка, рубка, резка, дробка), magical (water, air, earth, fire,)
|
||||
|
||||
physical: {
|
||||
type: [static, +value,]
|
||||
time: [now, next_turn, x_turns,]
|
||||
target: [static_enemy,]
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
protected int $power;
|
||||
private array $targets;
|
||||
|
||||
/**
|
||||
* @param int $caster
|
||||
* @param array $friendTeam
|
||||
* @param array $enemyTeam
|
||||
* @param int $targetType
|
||||
* @param int $power
|
||||
* @param int $powerType static, +value,
|
||||
* @param string $name
|
||||
* @param int $activeTurns количество ходов которое будет применяться приём. 0 - выполнить в текущий ход.
|
||||
* @param string $icon
|
||||
*/
|
||||
public function __construct(
|
||||
int $caster,
|
||||
array $friendTeam,
|
||||
array $enemyTeam,
|
||||
int $targetType,
|
||||
int $power,
|
||||
int $powerType,
|
||||
string $name,
|
||||
int $activeTurns = 1,
|
||||
string $icon = '',
|
||||
) {
|
||||
parent::__construct($caster, $friendTeam, $enemyTeam, $targetType, $name, $icon);
|
||||
$this->power = $power;
|
||||
$this->targets = $this->getTarget();
|
||||
|
||||
}
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return $this->icon;
|
||||
}
|
||||
|
||||
public function getTargetType(): int
|
||||
{
|
||||
return $this->targetType;
|
||||
}
|
||||
|
||||
public function getTarget(): array
|
||||
{
|
||||
return $this->targets;
|
||||
}
|
||||
|
||||
public function getPower(): int
|
||||
{
|
||||
return $this->power;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//$pr = new Priem(45,[1,2,3],[4,5,6],5,44,'Kaboom!', 'kaboom.gif');
|
||||
//$pr->
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Battle\Priem;
|
||||
|
||||
interface PriemInterface
|
||||
{
|
||||
public const DAMAGE = 1;
|
||||
public const HEAL = 2;
|
||||
|
||||
public const TAGRET_SELF = 1; //Приём на себя
|
||||
public const TARGET_CUSTOM = 2; //Приём на конкретного персонажа
|
||||
public const TARGET_RANDOM_ENEMY = 3; //Приём на случайного врага
|
||||
public const TARGET_RANDOM_FRIEND = 4; //Приём на случайного друга
|
||||
public const TARGET_RANDOM = 5; //Приём на случайного персонажа
|
||||
public const TARGET_RANDOM_ENEMIES = 6; //Приём на случайных врагов
|
||||
public const TARGET_RANDOM_FRIENDS = 7; //Приём на случайных друзей
|
||||
public const TARGET_RANDOMS = 8; //Приём на случайных персонажей
|
||||
public const TARGET_ALL_ENEMIES = 9; //Приём на всех врагов
|
||||
public const TARGET_ALL_FRIENDS = 10; //Приём на всех друзей
|
||||
public const TARGET_ALL = 11; //Приём на всех персонажей
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Возвращает тип цели к которым применяется приём.
|
||||
* @return int
|
||||
*/
|
||||
public function getTargetType(): int;
|
||||
|
||||
/**
|
||||
* Возвращает силу действия приёма. Параметр на который изменится та или иная характеристика. Урон для боевых,
|
||||
* количество восстановленого здоровья для лечения, количество процентов для процентных значений.
|
||||
* @return int
|
||||
*/
|
||||
public function getPower(): int;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Battle\Priem;
|
||||
|
||||
class UsePriem
|
||||
{
|
||||
|
||||
public function __construct(Priem $priem) {
|
||||
$damage = $priem->getPower();
|
||||
$targets = $priem->getTarget();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
|
||||
namespace Battle;
|
||||
|
||||
use Battle;
|
||||
use Helper\Comparsion;
|
||||
use Helper\Conversion;
|
||||
|
||||
class Razmen
|
||||
{
|
||||
private array $attackerStats;
|
||||
private array $targetStats;
|
||||
private int $uid1;
|
||||
private int $uid2;
|
||||
|
||||
/**
|
||||
* @param Battle $battle
|
||||
* @param int $id
|
||||
* @param array $at
|
||||
*/
|
||||
public function __construct(private readonly Battle $battle, private readonly int $id, private array $at)
|
||||
{
|
||||
$uid1 = $this->battle->atacks[$this->id]['uid1'];
|
||||
$uid2 = $this->battle->atacks[$this->id]['uid2'];
|
||||
$stats1 = $this->battle->stats[$this->battle->uids[$uid1]];
|
||||
$stats2 = $this->battle->stats[$this->battle->uids[$uid2]];
|
||||
if ($stats1['yhod'] > 0) {
|
||||
$uid1 = $this->battle->yhod_user($uid2, $uid1, $stats1['yhod']);
|
||||
} elseif ($stats2['yhod'] > 0) {
|
||||
$uid2 = $this->battle->yhod_user($uid1, $uid2, $stats2['yhod']);
|
||||
}
|
||||
$this->uid1 = $uid1;
|
||||
$this->uid2 = $uid2;
|
||||
$this->attackerStats = $this->battle->stats[$this->battle->uids[$uid1]];
|
||||
$this->targetStats = $this->battle->stats[$this->battle->uids[$uid2]];
|
||||
|
||||
# Переменные - Моё почтение!
|
||||
# $this->stats[$this->uids[$this->yhod_user($this->atacks[$this->id]['uid2'], $this->atacks[$this->id]['uid1'], $this->stats[$this->uids[$this->atacks[$this->id]['uid1']]]['yhod'])]];
|
||||
# $this->battle->stats[$this->battle->uids[$this->battle->yhod_user($this->battle->atacks[$this->id]['uid2'], $this->battle->atacks[$this->id]['uid1'], $this->battle->stats[$this->battle->uids[$this->battle->atacks[$this->id]['uid1']]]['yhod'])]];
|
||||
|
||||
}
|
||||
|
||||
private function updateBattleStats(): void
|
||||
{
|
||||
$this->battle->stats[$this->battle->uids[$this->uid1]] = $this->attackerStats;
|
||||
$this->battle->stats[$this->battle->uids[$this->uid2]] = $this->targetStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Расчет парирования Цели (uid2) от Атакующего (uid1)
|
||||
* @param int $counterstrikecheck
|
||||
* @param bool $pat
|
||||
* @param int $loopstart
|
||||
* @return void
|
||||
*/
|
||||
public function parry(int $counterstrikecheck = 0, bool $pat = false, int $loopstart = 0): void
|
||||
{
|
||||
if ($pat) {
|
||||
$tempAt = $this->at;
|
||||
$this->at = $tempAt['p'];
|
||||
}
|
||||
|
||||
if ($loopstart > 0) {
|
||||
$loopstart--;
|
||||
}
|
||||
|
||||
|
||||
if (is_array($this->at[1]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
!empty($this->targetStats['no_pr1']) ||
|
||||
$this->at[1]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->mfs(__FUNCTION__, [1 => $this->targetStats['m7'], 2 => $this->attackerStats['m7'],]) != 1 ||
|
||||
$this->battle->atacks[$this->id]['out2'] != 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (!empty($this->attackerStats['nopryh']) || $this->attackerStats['nopryh_act'] > 0) {
|
||||
continue;
|
||||
}
|
||||
// Парировал
|
||||
$this->attackerStats['nopryh'] = (int)floor($this->attackerStats['nopryh']);
|
||||
$this->at[1]['atack'][$j][1] = 6;
|
||||
$this->attackerStats['nopryh']--;
|
||||
$this->attackerStats['nopryh_act']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->at[2]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
!empty($this->attackerStats['no_pr1']) ||
|
||||
$this->at[2]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->mfs(__FUNCTION__, [1 => $this->attackerStats['m7'], 2 => $this->targetStats['m7'],]) != 1 ||
|
||||
$this->battle->atacks[$this->id]['out1'] != 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (!empty($this->targetStats['nopryh']) || $this->targetStats['nopryh_act'] > 0) {
|
||||
continue;
|
||||
}
|
||||
// Парировал
|
||||
$this->targetStats['nopryh'] = (int)floor($this->targetStats['nopryh']);
|
||||
$this->at[2]['atack'][$j][1] = 6;
|
||||
$this->targetStats['nopryh']--;
|
||||
$this->targetStats['nopryh_act']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tempAt)) {
|
||||
$tempAt['p'] = $this->at;
|
||||
$this->at = $tempAt;
|
||||
}
|
||||
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Расчет блока щитом Цели (uid2) от Атакующего (uid1)
|
||||
* @param int $counterstrikecheck
|
||||
* @param bool $pat
|
||||
* @return void
|
||||
*/
|
||||
public function blockByShield(int $counterstrikecheck = 0, bool $pat = false): void
|
||||
{
|
||||
if ($pat) {
|
||||
$tempAt = $this->at;
|
||||
$this->at = $tempAt['p'];
|
||||
}
|
||||
|
||||
//m8 блок щитом, m18 абсолютный блок щитом
|
||||
if ($this->targetStats['shield1'] > 0) {
|
||||
for ($j = 0; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
$this->at[1]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->battle->atacks[$this->id]['out2'] != 0 ||
|
||||
$this->mfs(__FUNCTION__, $this->targetStats['m8'] / 2 + $this->targetStats['m18']) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->at[1]['atack'][$j][1] = 7;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->attackerStats['shield1'] > 0) {
|
||||
for ($j = 0; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
$this->at[2]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->battle->atacks[$this->id]['out1'] != 0 ||
|
||||
$this->mfs(__FUNCTION__, $this->attackerStats['m8'] / 2 + $this->attackerStats['m18']) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->at[2]['atack'][$j][1] = 7;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tempAt)) {
|
||||
$tempAt['p'] = $this->at;
|
||||
$this->at = $tempAt;
|
||||
}
|
||||
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Расчет крита Атакующего (uid1) по Цели (uid2)
|
||||
* @param bool $pat
|
||||
* @param int $loopstart
|
||||
* @return void
|
||||
*/
|
||||
public function criticalDamage(bool $pat = false, int $loopstart = 0): void
|
||||
{
|
||||
if ($pat) {
|
||||
$tempAt = $this->at;
|
||||
$this->at = $tempAt['p'];
|
||||
}
|
||||
|
||||
if ($loopstart > 0) {
|
||||
$loopstart--;
|
||||
}
|
||||
|
||||
$checkhand = false;
|
||||
|
||||
if (is_array($this->at[1]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand] = $this->getDataArrayByHand($checkhand, $this->attackerStats);
|
||||
|
||||
if ($this->mfs(__FUNCTION__, ['mf' => $this->attackerStats['m1'] + $data['sv_m1'], 'amf' => $this->attackerStats['m14'], 'smf' => $this->targetStats['m2']]) != 1) {
|
||||
continue;
|
||||
}
|
||||
$this->at[1]['atack'][$j][1] = match (true) {
|
||||
$this->at[1]['atack'][$j][1] == 3 => 4, //в блок
|
||||
!in_array($this->at[1]['atack'][$j][1], [2, 6, 7, 8]) => 5, //обычный крит
|
||||
default => 1 // а ты что такое?
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->at[2]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand] = $this->getDataArrayByHand($checkhand, $this->targetStats);
|
||||
|
||||
if ($this->mfs(__FUNCTION__, ['mf' => $this->targetStats['m1'] + $data['sv_m1'], 'amf' => $this->targetStats['m14'], 'smf' => $this->attackerStats['m2']]) != 1) {
|
||||
continue;
|
||||
}
|
||||
$this->at[2]['atack'][$j][1] = match (true) {
|
||||
$this->at[2]['atack'][$j][1] == 3 => 4, //в блок
|
||||
!in_array($this->at[2]['atack'][$j][1], [2, 6, 7, 8]) => 5, //обычный крит
|
||||
default => 1 // а ты что такое?
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tempAt)) {
|
||||
$tempAt['p'] = $this->at;
|
||||
$this->at = $tempAt;
|
||||
}
|
||||
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Расчет уворота Цели (uid2) от Атакующего (uid1)
|
||||
* @param int $counterstrikecheck
|
||||
* @param bool $pat
|
||||
* @param int $loopstart
|
||||
* @return void
|
||||
*/
|
||||
public function evasion(int $counterstrikecheck = 0, bool $pat = false, int $loopstart = 0): void
|
||||
{
|
||||
if ($pat) {
|
||||
$tempAt = $this->at;
|
||||
$this->at = $tempAt['p'];
|
||||
}
|
||||
|
||||
if ($loopstart > 0) {
|
||||
$loopstart--;
|
||||
}
|
||||
|
||||
$checkhand = false;
|
||||
|
||||
if (is_array($this->at[1]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand] = $this->getDataArrayByHand($checkhand, $this->attackerStats);
|
||||
|
||||
if (
|
||||
$this->at[1]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->battle->atacks[$this->id]['out2'] != 0 ||
|
||||
$this->mfs(
|
||||
__FUNCTION__,
|
||||
[
|
||||
'mf' => $this->targetStats['m4'],
|
||||
'amf' => $this->targetStats['m15'],
|
||||
'smf' => $this->attackerStats['m5'] + $data['sv_m5'],
|
||||
'asmf' => $this->attackerStats['m21'],
|
||||
]
|
||||
) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->attackerStats['nopryh'] = (int)floor($this->attackerStats['nopryh']);
|
||||
if (!isset($this->attackerStats['nopryh']) || $this->attackerStats['nopryh'] < 1) {
|
||||
$this->at[1]['atack'][$j][1] = 2;
|
||||
} else {
|
||||
$this->attackerStats['nopryh']--;
|
||||
$this->attackerStats['nopryh_act']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->at[2]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand] = $this->getDataArrayByHand($checkhand, $this->targetStats);
|
||||
|
||||
if (
|
||||
$this->at[2]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->battle->atacks[$this->id]['out1'] != 0 ||
|
||||
$this->mfs(
|
||||
__FUNCTION__,
|
||||
[
|
||||
'mf' => $this->attackerStats['m4'],
|
||||
'amf' => $this->attackerStats['m15'],
|
||||
'smf' => $this->targetStats['m5'] + $data['sv_m5'],
|
||||
'asmf' => $this->targetStats['m21'],
|
||||
]
|
||||
) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->targetStats['nopryh'] = (int)floor($this->targetStats['nopryh']);
|
||||
if (!isset($this->targetStats['nopryh']) || $this->targetStats['nopryh'] < 1) {
|
||||
$this->at[2]['atack'][$j][1] = 2;
|
||||
} else {
|
||||
$this->targetStats['nopryh']--;
|
||||
$this->targetStats['nopryh_act']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tempAt)) {
|
||||
$tempAt['p'] = $this->at;
|
||||
$this->at = $tempAt;
|
||||
}
|
||||
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Расчет контрудара Цели (uid2) по Атакующему (uid1)
|
||||
* @param int $counterstrikecheck
|
||||
* @return void
|
||||
*/
|
||||
public function counterstrike(int $counterstrikecheck = 0): void //terrorists win!
|
||||
{
|
||||
if (is_array($this->at[1]['atack'])) {
|
||||
for ($j = 0; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
$this->at[1]['atack'][$j][1] != 2 ||
|
||||
$this->at[1]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->mfs(__FUNCTION__, ['a' => $this->targetStats['m6'], 'b' => $this->attackerStats['m6']]) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->at[1]['atack'][$j][1] = 8;
|
||||
$rand = mt_rand(1, 5);
|
||||
if ($this->battle->testRazmenblock1($this->id, $this->uid2, $this->uid1)) {
|
||||
$this->at[2]['atack'][] = [$rand, 3, 0, 1];
|
||||
} else {
|
||||
$this->at[2]['atack'][] = [$rand, 1, 0, 1]; // 3 , 0 , 1
|
||||
}
|
||||
|
||||
$this->counterstrikehit(count($this->at[2]['atack']));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->at[2]['atack'])) {
|
||||
for ($j = 0; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
if (
|
||||
$this->at[2]['atack'][$j][1] != 2 ||
|
||||
$this->at[2]['atack'][$j][2] != $counterstrikecheck ||
|
||||
$this->mfs(__FUNCTION__, ['a' => $this->attackerStats['m6'], 'b' => $this->targetStats['m6']]) != 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$this->at[2]['atack'][$j][1] = 8;
|
||||
$rand = mt_rand(1, 5);
|
||||
if ($this->battle->testRazmenblock1($this->id, $this->uid1, $this->uid2)) {
|
||||
$this->at[1]['atack'][] = [$rand, 3, 0, 1];
|
||||
} else {
|
||||
$this->at[1]['atack'][] = [$rand, 1, 0, 1]; // 3 , 0 , 1
|
||||
}
|
||||
|
||||
$this->counterstrikehit(count($this->at[1]['atack']));
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Рассчёт урона.
|
||||
* @param bool $pat
|
||||
* @param int $loopstart
|
||||
* @return void
|
||||
*/
|
||||
public function damage(bool $pat = false, int $loopstart = 0): void
|
||||
{
|
||||
$yhod = [1 => 0, 0];
|
||||
if ($this->battle->stats[$this->battle->uids[$this->uid1]]['yhod'] > 0) {
|
||||
$yhod = [1 => 1, 0];
|
||||
} elseif ($this->battle->stats[$this->battle->uids[$this->uid2]]['yhod'] > 0) {
|
||||
$yhod = [1 => 0, 1];
|
||||
}
|
||||
|
||||
if ($pat) {
|
||||
$tempAt = $this->at;
|
||||
$this->at = $tempAt['p'];
|
||||
}
|
||||
|
||||
if ($loopstart > 0) {
|
||||
$loopstart--;
|
||||
}
|
||||
|
||||
$checkhand = false;
|
||||
|
||||
if (is_array($this->at[1]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[1]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand, $wp, $witm] = $this->getDataArrayByHand($checkhand, $this->attackerStats);
|
||||
$this->at[1]['atack'][$j]['wt'] = $witm['type'];
|
||||
$this->at[1]['atack'][$j]['yhod'] = $yhod[1];
|
||||
|
||||
if (
|
||||
!isset($this->at[1]['atack'][$j]['yron']) &&
|
||||
in_array($this->at[1]['atack'][$j][1], [1, 4, 5])
|
||||
) {
|
||||
$type = 'yron';
|
||||
} else {
|
||||
$type = 'block';
|
||||
}
|
||||
|
||||
$this->at[1]['atack'][$j][$type] = $this->battle->yronGetrazmen($this->uid2, $this->uid1, $witm);
|
||||
if ($this->at[1]['atack'][$j][1] == 4) {
|
||||
$this->at[1]['atack'][$j][$type]['y_old'] = $this->at[1]['atack'][$j][$type]['y'];
|
||||
$this->at[1]['atack'][$j][$type]['y'] = (int)round($this->at[1]['atack'][$j][$type]['k'] / 2);
|
||||
} elseif ($this->at[1]['atack'][$j][1] == 5) {
|
||||
$this->at[1]['atack'][$j][$type]['y_old'] = $this->at[1]['atack'][$j][$type]['y'];
|
||||
$this->at[1]['atack'][$j][$type]['y'] = $this->at[1]['atack'][$j][$type]['k'];
|
||||
}
|
||||
$this->at[1]['atack'][$j][$type]['2h'] = $data['2h'];
|
||||
$this->at[1]['atack'][$j][$type]['w'] = $wp;
|
||||
if ($this->at[1]['atack'][$j][$type]['y'] > 0) {
|
||||
$this->at[1]['atack'][$j][$type]['r'] = '-' . $this->at[1]['atack'][$j][$type]['y'];
|
||||
} else {
|
||||
$this->at[1]['atack'][$j][$type]['r'] = '--';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->at[2]['atack'])) {
|
||||
for ($j = $loopstart; $j < count($this->at[2]['atack']) && $j < 8; $j++) {
|
||||
[$data, $checkhand, $wp, $witm] = $this->getDataArrayByHand($checkhand, $this->targetStats);
|
||||
$this->at[2]['atack'][$j]['wt'] = $witm['type'];
|
||||
$this->at[2]['atack'][$j]['yhod'] = $yhod[1];
|
||||
|
||||
if (
|
||||
!isset($this->at[2]['atack'][$j]['yron']) &&
|
||||
in_array($this->at[2]['atack'][$j][1], [1, 4, 5])
|
||||
) {
|
||||
$type = 'yron';
|
||||
} else {
|
||||
$type = 'block';
|
||||
}
|
||||
|
||||
$this->at[2]['atack'][$j][$type] = $this->battle->yronGetrazmen($this->uid1, $this->uid2, $witm);
|
||||
if ($this->at[2]['atack'][$j][1] == 4) {
|
||||
$this->at[2]['atack'][$j][$type]['y_old'] = $this->at[2]['atack'][$j][$type]['y'];
|
||||
$this->at[2]['atack'][$j][$type]['y'] = (int)round($this->at[2]['atack'][$j][$type]['k'] / 2);
|
||||
} elseif ($this->at[2]['atack'][$j][1] == 5) {
|
||||
$this->at[2]['atack'][$j][$type]['y_old'] = $this->at[2]['atack'][$j][$type]['y'];
|
||||
$this->at[2]['atack'][$j][$type]['y'] = $this->at[2]['atack'][$j][$type]['k'];
|
||||
}
|
||||
$this->at[2]['atack'][$j][$type]['2h'] = $data['2h'];
|
||||
$this->at[2]['atack'][$j][$type]['w'] = $wp;
|
||||
if ($this->at[2]['atack'][$j][$type]['y'] > 0) {
|
||||
$this->at[2]['atack'][$j][$type]['r'] = '-' . $this->at[2]['atack'][$j][$type]['y'];
|
||||
} else {
|
||||
$this->at[2]['atack'][$j][$type]['r'] = '--';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tempAt)) {
|
||||
$tempAt['p'] = $this->at;
|
||||
$this->at = $tempAt;
|
||||
}
|
||||
$this->updateBattleStats();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Возвращает массив:
|
||||
*
|
||||
* 0 => data предмета в зависимости от руки в которой тот находится,
|
||||
*
|
||||
* 1 => флажок проверки руки,
|
||||
*
|
||||
* 2 => число слота руки(?!),
|
||||
*
|
||||
* 3 => массив параметров предмета для Battle::class->yronGetrazmen()
|
||||
* @param bool $check
|
||||
* @param array $stats
|
||||
* @return array{array,bool,int,array}
|
||||
*/
|
||||
private function getDataArrayByHand(bool $check, array $stats): array
|
||||
{
|
||||
if (!$check && isset($stats['wp3id'])) { //Левая рука
|
||||
$wp = 3;
|
||||
$check = true;
|
||||
} else { //Правая рука
|
||||
if (isset($stats['wp14id']) && $stats['items'][$stats['wp14id']]['type'] != 13) {
|
||||
$wp = 14;
|
||||
} else {
|
||||
$wp = 3;
|
||||
}
|
||||
$check = false;
|
||||
}
|
||||
$witm = $stats['items'][$stats["wp{$wp}id"]];
|
||||
return [Conversion::dataStringToArray($witm['data']), $check, $wp, $witm];
|
||||
}
|
||||
|
||||
|
||||
private function mfs(int|string $type, array|int $mf): int
|
||||
{
|
||||
if (is_array($mf)) {
|
||||
$mf = array_map(fn($a) => max($a, 0), $mf);
|
||||
}
|
||||
$rval = 0;
|
||||
if ($type == 'criticalDamage') {
|
||||
//Крит
|
||||
if ($mf['mf'] > $mf['smf']) {
|
||||
$rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100));
|
||||
}
|
||||
|
||||
$rval = Comparsion::minimax($rval, 0, 75);
|
||||
|
||||
if ($mf['amf'] > 0) {
|
||||
$mf['amf'] = min(100, $mf['amf']);
|
||||
|
||||
if (($mf['amf'] * 100) >= mt_rand(1, 10000)) {
|
||||
$rval = 100;
|
||||
}
|
||||
}
|
||||
} elseif ($type == 'evasion') {
|
||||
if ($mf['mf'] > $mf['smf']) {
|
||||
$rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5
|
||||
}
|
||||
|
||||
$rval = Comparsion::minimax($rval, 0, 75);
|
||||
|
||||
if ($mf['asmf'] > 0) {
|
||||
$mf['asmf'] = min(100, $mf['asmf']);
|
||||
|
||||
if ($mf['asmf'] >= mt_rand(1, 100)) {
|
||||
$rval = 0;
|
||||
}
|
||||
}
|
||||
if ($mf['amf'] >= 0) {
|
||||
$mf['amf'] = min(100, $mf['amf']);
|
||||
|
||||
if ($mf['amf'] >= mt_rand(1, 100)) {
|
||||
$rval = 100;
|
||||
}
|
||||
}
|
||||
} elseif ($type == 'parry') {
|
||||
$mf[1] = max($mf[1], 1);
|
||||
$mf[2] = max($mf[2], 1);
|
||||
$rval = $mf[1] - $mf[2] / 2;
|
||||
$rval = Comparsion::minimax($rval, 1, 75);
|
||||
|
||||
} elseif ($type == 4) {
|
||||
$mf = round($mf * 0.6);
|
||||
$mf = Comparsion::minimax($mf, 0, 100);
|
||||
$rval = min($mf, 100); //пробой брони
|
||||
} elseif ($type == 'blockByShield') {
|
||||
$mf = max($mf, 0);
|
||||
$rval = min($mf, 85); //блок щитом
|
||||
} elseif ($type == 'counterstrike') {
|
||||
//Контрудар
|
||||
if ($mf['a'] > 0) {
|
||||
if ($mf['b'] > 0) {
|
||||
$rval = round($mf['a'] - ($mf['b'] / 2));
|
||||
} else {
|
||||
$rval = $mf['a'];
|
||||
}
|
||||
}
|
||||
$rval = Comparsion::minimax($rval, 0, 75);
|
||||
}
|
||||
return Helper::getChanse($rval) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Повторный просчёт всего для успешного контрудара.
|
||||
* @param int $loopstart
|
||||
* @return void
|
||||
*/
|
||||
private function counterstrikehit(int $loopstart): void
|
||||
{
|
||||
$this->evasion(1, true, $loopstart);
|
||||
$this->parry(1, true, $loopstart);
|
||||
$this->blockByShield(1, true);
|
||||
$this->criticalDamage(true, $loopstart);
|
||||
$this->damage(true, $loopstart);
|
||||
}
|
||||
|
||||
public function getAt(): array
|
||||
{
|
||||
return $this->at;
|
||||
}
|
||||
}
|
||||
+556
-490
File diff suppressed because it is too large
Load Diff
+270
-244
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use Model\Constant\Stat;
|
||||
|
||||
class BotPriemLogic
|
||||
{
|
||||
|
||||
@@ -100,247 +104,13 @@ class BotPriemLogic
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function usePriem($id, $on = null)
|
||||
private static function testpriem($pl): int
|
||||
{
|
||||
$go_txt = '&usepriem=' . $id;
|
||||
if ($on != '') {
|
||||
$on = str_replace(' ', '%20', $on);
|
||||
$go_txt .= '&useon=' . $on;
|
||||
}
|
||||
BotLogic::inuser_go_btl(BotLogic::$bot, $go_txt);
|
||||
}
|
||||
|
||||
//Ставка на опережение
|
||||
private static function priem220($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Разгадать тактику
|
||||
private static function priem217($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Обреченность
|
||||
private static function priem204($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Выжить
|
||||
private static function priem232($i)
|
||||
{
|
||||
if (self::hp() <= 30 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Жажда крови
|
||||
private static function priem188($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Шок удар
|
||||
private static function priem235($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Хлебнуть крови
|
||||
private static function priem240($i)
|
||||
{
|
||||
if (self::hp() <= 70) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Силовое поле
|
||||
private static function priem175($i)
|
||||
{
|
||||
self::usePriem($i);
|
||||
}
|
||||
|
||||
//Прикрыться
|
||||
private static function priem1($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Вломить
|
||||
private static function priem2($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Собрать зубы
|
||||
private static function priem3($i)
|
||||
{
|
||||
if (self::hp() <= 70 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Воля к победе
|
||||
private static function priem6($i)
|
||||
{
|
||||
if (self::hp() <= 40 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Танец ветра
|
||||
private static function priem8($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Танец лезвий
|
||||
private static function priem48($i)
|
||||
{
|
||||
if (rand(0, 100) < 70) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Дикая удача
|
||||
private static function priem9($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Слепая удача
|
||||
private static function priem47($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Предвиденье
|
||||
private static function priem10($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Второе дыхание
|
||||
private static function priem49($i)
|
||||
{
|
||||
if (rand(0, 100) < 80 && self::hp() <= 60) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Рывок
|
||||
private static function priem223($i)
|
||||
{
|
||||
if (self::hp() <= 50 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Удачный удар
|
||||
private static function priem11($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Стойкость
|
||||
private static function priem13($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Ярость
|
||||
private static function priem14($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Сильный удар
|
||||
private static function priem4($i)
|
||||
{
|
||||
if (rand(0, 100) < 60) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Утереть пот
|
||||
private static function priem5($i)
|
||||
{
|
||||
if (self::hp() <= 95) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Агрессивная защита
|
||||
private static function priem211($i)
|
||||
{
|
||||
if (rand(0, 100) < 80) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Полная защита
|
||||
private static function priem45($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Активная защита
|
||||
private static function priem7($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static function hp()
|
||||
{
|
||||
return round((BotLogic::$st['hpNow'] / BotLogic::$st['hpAll'] * 100), 2);
|
||||
}
|
||||
|
||||
//Тест на возможность использования
|
||||
private static function testpriem($pl)
|
||||
{
|
||||
global $u;
|
||||
$notr = 0;
|
||||
|
||||
$tr = $u->lookStats($pl['tr']);
|
||||
$d2 = $u->lookStats($pl['date2']);
|
||||
$statnames = new Stat();
|
||||
$statnames->getRequirement();
|
||||
$tr = Conversion::dataStringToArray($pl['tr']);
|
||||
$d2 = Conversion::dataStringToArray($pl['date2']);
|
||||
|
||||
$x = 1;
|
||||
while ($x <= 7) {
|
||||
@@ -355,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']) {
|
||||
@@ -396,4 +166,260 @@ class BotPriemLogic
|
||||
|
||||
return $notr;
|
||||
}
|
||||
|
||||
//Ставка на опережение
|
||||
|
||||
private static function priem1($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Разгадать тактику
|
||||
|
||||
private static function usePriem($id)
|
||||
{
|
||||
BotLogic::inuser_go_btl(BotLogic::$bot, '&usepriem=' . $id);
|
||||
}
|
||||
|
||||
//Обреченность
|
||||
|
||||
private static function priem2($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Выжить
|
||||
|
||||
private static function priem3($i)
|
||||
{
|
||||
if (self::hp() <= 70 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Жажда крови
|
||||
|
||||
private static function hp(): float
|
||||
{
|
||||
return round((BotLogic::$st['hpNow'] / BotLogic::$st['hpAll'] * 100), 2);
|
||||
}
|
||||
|
||||
//Шок удар
|
||||
|
||||
private static function priem4($i)
|
||||
{
|
||||
if (rand(0, 100) < 60) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Хлебнуть крови
|
||||
|
||||
private static function priem5($i)
|
||||
{
|
||||
if (self::hp() <= 95) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Силовое поле
|
||||
|
||||
private static function priem6($i)
|
||||
{
|
||||
if (self::hp() <= 40 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Прикрыться
|
||||
|
||||
private static function priem7($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Вломить
|
||||
|
||||
private static function priem8($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Собрать зубы
|
||||
|
||||
private static function priem9($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Воля к победе
|
||||
|
||||
private static function priem10($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Танец ветра
|
||||
|
||||
private static function priem11($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Танец лезвий
|
||||
|
||||
private static function priem13($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Дикая удача
|
||||
|
||||
private static function priem14($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Слепая удача
|
||||
|
||||
private static function priem45($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Предвиденье
|
||||
|
||||
private static function priem47($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Второе дыхание
|
||||
|
||||
private static function priem48($i)
|
||||
{
|
||||
if (rand(0, 100) < 70) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Рывок
|
||||
|
||||
private static function priem49($i)
|
||||
{
|
||||
if (rand(0, 100) < 80 && self::hp() <= 60) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Удачный удар
|
||||
|
||||
private static function priem188($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Стойкость
|
||||
|
||||
private static function priem204($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Ярость
|
||||
|
||||
private static function priem211($i)
|
||||
{
|
||||
if (rand(0, 100) < 80) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Сильный удар
|
||||
|
||||
private static function priem217($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Утереть пот
|
||||
|
||||
private static function priem220($i)
|
||||
{
|
||||
if (rand(0, 100) < 30) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Агрессивная защита
|
||||
|
||||
private static function priem223($i)
|
||||
{
|
||||
if (self::hp() <= 50 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Полная защита
|
||||
|
||||
private static function priem232($i)
|
||||
{
|
||||
if (self::hp() <= 30 && rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Активная защита
|
||||
|
||||
private static function priem235($i)
|
||||
{
|
||||
if (rand(0, 100) < 50) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
private static function priem240($i)
|
||||
{
|
||||
if (self::hp() <= 70) {
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
//Тест на возможность использования
|
||||
|
||||
private static function priem175($i)
|
||||
{
|
||||
self::usePriem($i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Captcha;
|
||||
|
||||
class Captcha
|
||||
{
|
||||
private int $width;
|
||||
private int $height;
|
||||
private string $sum;
|
||||
|
||||
public function width(int $width): Captcha
|
||||
{
|
||||
$this->width = max($width, 1);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function height(int $height): Captcha
|
||||
{
|
||||
$this->height = max($height, 1);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function newImage()
|
||||
{
|
||||
if ($this->width < 1 || $this->height < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$img = imagecreatetruecolor($this->width, $this->height) or die('Cannot create image'); // создаем картинку
|
||||
imagefill($img, 0, 0, 0x616161); // заполняем фон картинки
|
||||
$x = -20;
|
||||
$i = 1;
|
||||
$sum = "";
|
||||
$colorRGB = rand(180, 200); //цвет текста
|
||||
while ($i++ <= 5000) {
|
||||
imageSetPixel($img, rand(0, 105), rand(0, 24), 0x515151);
|
||||
}
|
||||
|
||||
//рисуем 2 линии
|
||||
imageLine($img, rand(0, 10), rand(0, 50), rand(95, 105), rand(0, 26), 0x909090);
|
||||
imageLine($img, rand(0, 10), rand(0, 50), rand(95, 105), rand(0, 26), 0x909090);
|
||||
//рамка
|
||||
imageRectangle($img, 0, 0, 105, 24, 0x343434);
|
||||
|
||||
$fonts = [
|
||||
'fonts/FRSCRIPT.ttf',
|
||||
'fonts/CHILLER.ttf',
|
||||
'fonts/Bradley Hand ITC.ttf',
|
||||
'fonts/de_Manu_2_Regular.ttf',
|
||||
'fonts/Edgar_da_cool_Regular.ttf',
|
||||
'fonts/Hurryup_Hurryup.ttf',
|
||||
'fonts/Fh_Script_Regular.ttf',
|
||||
'fonts/Gabo4_Gabo4.ttf',
|
||||
'fonts/JAMI_Regular.ttf',
|
||||
'fonts/Justy1_Regular.ttf',
|
||||
];
|
||||
$font = '../' . $fonts[rand(0, sizeof($fonts) - 1)];
|
||||
|
||||
$i = 1;
|
||||
while ($i++ <= 4) { // выводим одну цифру за один проход цикла
|
||||
imagettftext($img, 15, 0, $x = $x + 25, 20, imagecolorallocate($img, $colorRGB, $colorRGB, $colorRGB), $font, $rnd = mt_rand(0, 9)); // выводим текст поверх картинки
|
||||
$sum = $sum . $rnd; // Собираем в одну строку все символы на картинке
|
||||
}
|
||||
|
||||
ob_start();
|
||||
imagepng($img); // выводим готовую картинку в формате PNG
|
||||
$imgData = ob_get_clean();
|
||||
imagedestroy($img); // освобождаем память, выделенную для картинки
|
||||
|
||||
echo '<img src="data:image/png;base64,' . base64_encode($imgData) . '" alt="captcha">';
|
||||
$this->sum = $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSum(): string
|
||||
{
|
||||
return $this->sum;
|
||||
}
|
||||
}
|
||||
+169
-33
File diff suppressed because one or more lines are too long
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
#todo кажется часть полей вроде city, room, color, invis напрямик зависит от login (отправитель)
|
||||
#todo если это так, частью сеттеров можно будет пожертвовать.
|
||||
|
||||
class ChatMessage
|
||||
{
|
||||
private string $city = 'capitalcity';
|
||||
private int $room = 0;
|
||||
private string $login = '';
|
||||
private string $to = '';
|
||||
private string $text;
|
||||
private int $time = 0;
|
||||
private int $type = 0;
|
||||
private int $typeTime = 0;
|
||||
private string $color = '#000';
|
||||
private int $sound = 0;
|
||||
private int $spam = 0;
|
||||
private bool $isAlert = false;
|
||||
private int $invis = 0;
|
||||
private int $da = 0;
|
||||
private int $delete = 0;
|
||||
private int $molch = 0;
|
||||
private int $dn = 0;
|
||||
/**
|
||||
* Феерверки, чёрт подери!
|
||||
* _incl_data\class\magic\feerverks.php
|
||||
* @var string|null
|
||||
*/
|
||||
private ?string $fireworks = null;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDn(): int
|
||||
{
|
||||
return $this->dn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $dn
|
||||
*/
|
||||
public function setDn(int $dn): void
|
||||
{
|
||||
$this->dn = $dn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDelete(): int
|
||||
{
|
||||
return $this->delete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $delete
|
||||
*/
|
||||
public function setDelete(int $delete): void
|
||||
{
|
||||
$this->delete = $delete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMolch(): int
|
||||
{
|
||||
return $this->molch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $molch
|
||||
*/
|
||||
public function setMolch(int $molch): void
|
||||
{
|
||||
$this->molch = $molch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getInvis(): int
|
||||
{
|
||||
return $this->invis;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $invis
|
||||
*/
|
||||
public function setInvis(int $invis): void
|
||||
{
|
||||
$this->invis = $invis;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDa(): int
|
||||
{
|
||||
return $this->da;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $da
|
||||
*/
|
||||
public function setDa(int $da): void
|
||||
{
|
||||
$this->da = $da;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSpam(): int
|
||||
{
|
||||
return $this->spam;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $spam
|
||||
*/
|
||||
public function setSpam(int $spam): void
|
||||
{
|
||||
$this->spam = $spam;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSound(): int
|
||||
{
|
||||
return $this->sound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $sound
|
||||
*/
|
||||
public function setSound(int $sound): void
|
||||
{
|
||||
$this->sound = $sound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity(): string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRoom(): int
|
||||
{
|
||||
return $this->room;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogin(): string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTo(): string
|
||||
{
|
||||
return $this->to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getText(): string
|
||||
{
|
||||
if ($this->isAlert) {
|
||||
return '<span style="color: red">Внимание!</span> ' . $this->text;
|
||||
}
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTime(): int
|
||||
{
|
||||
if (!$this->time) {
|
||||
$this->time = time();
|
||||
}
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getType(): int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTypeTime(): int
|
||||
{
|
||||
return $this->typeTime;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getColor(): string
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $city
|
||||
*/
|
||||
public function setCity(string $city): void
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $room
|
||||
*/
|
||||
public function setRoom(int $room): void
|
||||
{
|
||||
$this->room = $room;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $login
|
||||
*/
|
||||
public function setLogin(string $login): void
|
||||
{
|
||||
$this->login = $login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $to
|
||||
*/
|
||||
public function setTo(string $to): void
|
||||
{
|
||||
$this->to = $to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
*/
|
||||
public function setText(string $text): void
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $time
|
||||
*/
|
||||
public function setTime(int $time): void
|
||||
{
|
||||
$this->time = $time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function setType(int $type): void
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $typeTime
|
||||
*/
|
||||
public function setTypeTime(int $typeTime): void
|
||||
{
|
||||
$this->typeTime = $typeTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $color
|
||||
*/
|
||||
public function setColor(string $color): void
|
||||
{
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавляет к сообщению красный префикс "Внимание!".
|
||||
* @param bool $isAlert
|
||||
*/
|
||||
public function setIsAlert(bool $isAlert): void
|
||||
{
|
||||
$this->isAlert = $isAlert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFireworks(): ?string
|
||||
{
|
||||
return $this->fireworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fireworks
|
||||
*/
|
||||
public function setFireworks(?string $fireworks): void
|
||||
{
|
||||
$this->fireworks = $fireworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Заглушка для опциональной передачи параметров.
|
||||
* @param string $json
|
||||
* @return void
|
||||
*/
|
||||
public function setParamsFromJson(string $json): void
|
||||
{
|
||||
$params = json_decode($json, true);
|
||||
foreach ($params as $param => $value) {
|
||||
$method = 'set' . ucfirst($param);
|
||||
if (method_exists(self::class, $method)) {
|
||||
$this->$method($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Clan;
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class ClanInfo
|
||||
{
|
||||
public static function isJoinable(string $name): bool
|
||||
{
|
||||
return Db::getValue('select count(name) from clan where name = ? and status = 1', [$name]) > 0;
|
||||
}
|
||||
|
||||
public static function getNameById(int $id): string
|
||||
{
|
||||
$clan = self::getById($id);
|
||||
return !empty($clan['name']) ? $clan['name'] : '';
|
||||
}
|
||||
|
||||
public static function getById(int $id): array
|
||||
{
|
||||
return Db::getRow('select * from clan where id = ? and status = 1', [$id]) ?: [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace Clan;
|
||||
|
||||
use Core\Db;
|
||||
use Delo;
|
||||
use Helper\Conversion;
|
||||
use User;
|
||||
use User\ItemsModel;
|
||||
|
||||
class ItemStorage
|
||||
{
|
||||
|
||||
private string $error = '';
|
||||
private int $clanId;
|
||||
private int $userId;
|
||||
private string $userLogin;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$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)) {
|
||||
return $this->error;
|
||||
}
|
||||
$col = ItemsModel::itemsX($itemId);
|
||||
$idata = Conversion::dataStringToArray($item['data']);
|
||||
if (!isset($idata['toclan'])) {
|
||||
$idata['toclan'] = $this->clanId . '#' . $this->userId;
|
||||
$item['data'] = Conversion::arrayToDataString($idata);
|
||||
Delo::add(
|
||||
2,
|
||||
'System.transfer.clan',
|
||||
$this->userId,
|
||||
'"System.transfer.MONEY": Предмет "' . $item['name'] . '" (#id : "' . $itemId . '") (x' . $col . ') был пожертвован клану "' . $clanName . '" (' . $this->clanId . ').',
|
||||
);
|
||||
$sendType = 4;
|
||||
} else {
|
||||
$sendType = 3;
|
||||
}
|
||||
Db::sql(
|
||||
'insert into clan_operations (clan, time, type, text, val, uid) values (?,unix_timestamp(),?,?,?,?)',
|
||||
[$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' . $this->clanId, $item['data'], $itemId]
|
||||
);
|
||||
|
||||
return 'Вы передали предмет "' . $item['name'] . '" клану.';
|
||||
}
|
||||
|
||||
private function isGoodForStorage(array $item): bool
|
||||
{
|
||||
if (empty($item['inslot']) || !empty($item['gift'])) {
|
||||
$this->error = 'Предмет не найден.';
|
||||
}
|
||||
$idata = Conversion::dataStringToArray($item['data']);
|
||||
if (
|
||||
!empty($idata['frompisher']) ||
|
||||
!empty($idata['sudba']) ||
|
||||
!empty($idata['icos']) ||
|
||||
!empty($idata['fromlaba'])
|
||||
) {
|
||||
$this->error = 'Предмет не подходит.';
|
||||
}
|
||||
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $this->clanId) {
|
||||
$this->error = 'Предмет уже принадлежит клану.';
|
||||
}
|
||||
return empty($this->error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace Clan;
|
||||
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
use Uploader;
|
||||
|
||||
class Register
|
||||
{
|
||||
const REGISTER_COST_EKR = 50;
|
||||
private string $name;
|
||||
private int $align = 0;
|
||||
private Uploader $logo;
|
||||
private int $newClanId = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (!isset($_POST['newclanname'], $_POST['newclanalign'], $_FILES['newclanlogo'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setName($_POST['newclanname']);
|
||||
$this->setLogo();
|
||||
$this->setAlign(intval($_POST['newclanalign']));
|
||||
$this->new();
|
||||
}
|
||||
|
||||
private function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
private function setLogo()
|
||||
{
|
||||
$this->logo = new Uploader('newclanlogo');
|
||||
$this->logo->setMaxFileSize(.03);
|
||||
$this->logo->setDimensions(24, 15);
|
||||
$this->logo->setExtentions(['gif', 'png']);
|
||||
}
|
||||
|
||||
private function setAlign(int $align)
|
||||
{
|
||||
if (!in_array($align, [0, 1, 3, 7])) {
|
||||
$align = 0;
|
||||
}
|
||||
$this->align = $align;
|
||||
}
|
||||
|
||||
public function new()
|
||||
{
|
||||
if (!$this->hasGoodName()) {
|
||||
return;
|
||||
}
|
||||
$imageId = $this->logo->saveToDb();
|
||||
if (!$imageId) {
|
||||
echo $this->logo::$error;
|
||||
return;
|
||||
}
|
||||
Db::sql('insert into clan (name, align, logo) values (?,?,?)', [$this->name, $this->align, $imageId]);
|
||||
$this->newClanId = Db::lastInsertId();
|
||||
}
|
||||
|
||||
private function hasGoodName(): bool
|
||||
{
|
||||
return Db::getValue('select count(id) from clan where name = ?', [$this->name]) === 0;
|
||||
}
|
||||
|
||||
public static function approve(int $clanId)
|
||||
{
|
||||
Db::sql('update clan set status = 1, time_reg = unix_timestamp() where id = ?', [$clanId]);
|
||||
}
|
||||
|
||||
public static function reject(int $clanId)
|
||||
{
|
||||
Db::sql('delete from clan where id = ?', [$clanId]);
|
||||
}
|
||||
|
||||
public static function printForm(): string
|
||||
{
|
||||
$img = Config::img() . '/i/align';
|
||||
return <<<REGISTERFORM
|
||||
<style>
|
||||
div.regclangrid [type=radio] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* IMAGE STYLES */
|
||||
div.regclangrid [type=radio] + img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* CHECKED STYLES */
|
||||
div.regclangrid [type=radio]:checked + img {
|
||||
outline: 1px solid brown;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.regclangrid {
|
||||
display: grid;
|
||||
grid-template-columns: 100px auto;
|
||||
}
|
||||
</style>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="regclangrid">
|
||||
<div><label for="clanname">Название:</label></div>
|
||||
<div><input name="newclanname" id="clanname"></div>
|
||||
<div><label for="clanlogo">Логотип:</label></div>
|
||||
<div><input type="file" name="newclanlogo" accept="image/*" id="newclanlogo"> размер: 24×15, формат: png или gif, до 30Кб</div>
|
||||
<div>Склонность:</div>
|
||||
<div>
|
||||
<label><input type="radio" name="newclanalign" value="0" checked><img src="$img/align0.gif" alt="none"></label>
|
||||
<label><input type="radio" name="newclanalign" value="1"><img src="$img/align1.gif" alt="light"></label>
|
||||
<label><input type="radio" name="newclanalign" value="3"><img src="$img/align3.gif" alt="dark"></label>
|
||||
<label><input type="radio" name="newclanalign" value="7"><img src="$img/align7.gif" alt="neutral"></label>
|
||||
</div>
|
||||
<div></div>
|
||||
<div><button type="submit">Подать заявку</button></div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
REGISTERFORM;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNewClanId(): int
|
||||
{
|
||||
return $this->newClanId;
|
||||
}
|
||||
|
||||
}
|
||||
+200
-128
@@ -1,77 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\Constant\Stat;
|
||||
use User\ItemsModel;
|
||||
|
||||
class ComissionShop
|
||||
{
|
||||
public function commisionShop($sid, $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()
|
||||
{
|
||||
global $c, $code, $sid;
|
||||
switch ((int)$_GET['otdel']) {
|
||||
case 1:
|
||||
$typeOtdel = 18;
|
||||
break;
|
||||
case 2:
|
||||
$typeOtdel = 19;
|
||||
break;
|
||||
case 3:
|
||||
$typeOtdel = 20;
|
||||
break;
|
||||
case 4:
|
||||
$typeOtdel = 21;
|
||||
break;
|
||||
case 5:
|
||||
$typeOtdel = 22;
|
||||
break;
|
||||
case 6:
|
||||
$typeOtdel = 15;
|
||||
break;
|
||||
case 7:
|
||||
$typeOtdel = 12;
|
||||
break;
|
||||
case 8:
|
||||
$typeOtdel = 4;
|
||||
break;
|
||||
case 9:
|
||||
$typeOtdel = 5;
|
||||
break;
|
||||
case 10:
|
||||
$typeOtdel = 6;
|
||||
break;
|
||||
case 11:
|
||||
$typeOtdel = 1;
|
||||
break;
|
||||
case 12:
|
||||
$typeOtdel = 3;
|
||||
break;
|
||||
case 13:
|
||||
$typeOtdel = 8;
|
||||
break;
|
||||
case 14:
|
||||
$typeOtdel = 14;
|
||||
break;
|
||||
case 15:
|
||||
$typeOtdel = 13;
|
||||
break;
|
||||
case 16:
|
||||
$typeOtdel = 9;
|
||||
break;
|
||||
case 17:
|
||||
$typeOtdel = 10;
|
||||
break;
|
||||
case 18:
|
||||
$typeOtdel = 11;
|
||||
break;
|
||||
case 19:
|
||||
$typeOtdel = 29;
|
||||
break;
|
||||
case 20:
|
||||
$typeOtdel = 30;
|
||||
break;
|
||||
case 1050:
|
||||
$typeOtdel = 1050;
|
||||
break;
|
||||
default :
|
||||
$typeOtdel = 18;
|
||||
}
|
||||
$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']) {
|
||||
2 => 19,
|
||||
3 => 20,
|
||||
4 => 21,
|
||||
5 => 22,
|
||||
6 => 15,
|
||||
7 => 12,
|
||||
8 => 4,
|
||||
9 => 5,
|
||||
10 => 6,
|
||||
11 => 1,
|
||||
12 => 3,
|
||||
13 => 8,
|
||||
14 => 14,
|
||||
15 => 13,
|
||||
16 => 9,
|
||||
17 => 10,
|
||||
18 => 11,
|
||||
19 => 29,
|
||||
20 => 30,
|
||||
1050 => 1050,
|
||||
default => 18,
|
||||
};
|
||||
if ($typeOtdel != 1050) {
|
||||
if ($preview == "full") {
|
||||
$cl = mysql_query(
|
||||
@@ -85,7 +69,7 @@ FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.
|
||||
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'
|
||||
ORDER BY `1price`, inGroupCount DESC'
|
||||
);
|
||||
} else {
|
||||
$cl = mysql_query(
|
||||
@@ -127,11 +111,11 @@ FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`
|
||||
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"
|
||||
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'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -158,18 +142,16 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
)
|
||||
);
|
||||
if ($steck[0] > 1 && $preview == "preview") {
|
||||
$po = $this->lookStats($d['data']);
|
||||
$po = Helper\Conversion::dataStringToArray($d['data']);
|
||||
} else {
|
||||
$po = $this->lookStats($pl['data']);
|
||||
$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="https://img.new-combats.com/i/items/' . $pl['img'] . '"><br>';
|
||||
$is1 = '<img src="//img.new-combats.tech/i/items/' . $pl['img'] . '"><br>';
|
||||
if ($preview == "full") {
|
||||
$is1 .= '<a href="?otdel=' . ((int)$_GET['otdel']) . '&toRent=3&itemid=' . (int)$_GET['itemid'] . '&buy=' . $pl[0] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . ' " >купить</a> ';
|
||||
} elseif ($preview == "preview") {
|
||||
@@ -177,34 +159,31 @@ 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 . ')';
|
||||
}
|
||||
$is2 .= '<a href="https://new-combats.com/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> ';
|
||||
$is2 .= '<a href="/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> ';
|
||||
if ($pl['massa'] > 0 && $preview == "full") {
|
||||
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
|
||||
if ($pl['gift'] != '') {
|
||||
$ttl = '';
|
||||
if ($pl['gift'] == 1) {
|
||||
$ttl = 'Вы не можете передать этот предмет кому-либо';
|
||||
} else {
|
||||
$ttl = 'Этот предмет подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще';
|
||||
}
|
||||
$is2 .= ' <img title="' . $ttl . '" src="https://img.new-combats.com/i/podarok.gif">';
|
||||
$is2 .= ' <img title="' . $ttl . '" src="//img.new-combats.tech/i/podarok.gif">';
|
||||
}
|
||||
if (isset($po['art'])) {
|
||||
$is2 .= ' <img title="Артефакт" src="https://img.new-combats.com/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="https://img.new-combats.com/i/destiny0.gif">';
|
||||
} elseif ($po['sudba'] == '1') {
|
||||
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="https://img.new-combats.com/i/destiny0.gif">';
|
||||
} else {
|
||||
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="https://img.new-combats.com/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">',
|
||||
};
|
||||
}
|
||||
}
|
||||
//цена
|
||||
@@ -219,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]) . '%';
|
||||
}
|
||||
@@ -310,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++;
|
||||
@@ -333,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++;
|
||||
}
|
||||
@@ -347,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]]
|
||||
@@ -373,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++;
|
||||
}
|
||||
@@ -431,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;
|
||||
@@ -444,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'];
|
||||
@@ -452,7 +426,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
//действие комплекта
|
||||
$i1c = 0;
|
||||
$i2c = 0;
|
||||
$i1e = $this->lookStats($plc['data']);
|
||||
$i1e = Helper\Conversion::dataStringToArray($plc['data']);
|
||||
while ($i1c < count($this->items['add'])) {
|
||||
if (isset($i1e[$this->items['add'][$i1c]])) {
|
||||
$i3c = $i1e[$this->items['add'][$i1c]];
|
||||
@@ -488,7 +462,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
//действие комплекта
|
||||
$i1c = 0;
|
||||
$i2c = 0;
|
||||
$i1e = $this->lookStats($plc['data']);
|
||||
$i1e = Helper\Conversion::dataStringToArray($plc['data']);
|
||||
while ($i1c < count($this->items['add'])) {
|
||||
if (isset($i1e[$this->items['add'][$i1c]])) {
|
||||
$i3c = $i1e[$this->items['add'][$i1c]];
|
||||
@@ -553,16 +527,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
if ($pl['dn_delete'] > 0) {
|
||||
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
|
||||
}
|
||||
if ($this->pokol > $pl['geni']) {
|
||||
$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++;
|
||||
@@ -572,4 +541,107 @@ ORDER BY `1price`ASC , inGroupCount DESC'
|
||||
echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">Прилавок магазина пуст</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
from items_users
|
||||
left join users on users.id = uid
|
||||
left join items_main on items_main.id = item_id
|
||||
where items_users.id = ? and inShop = 30', [$iid]);
|
||||
|
||||
$price = $irow['1price'];
|
||||
if (!isset($irow['id']) || !isset($iid) || $irow['inShop'] != 30) {
|
||||
$r = 'Предмет не найден на прилавке';
|
||||
} else {
|
||||
if ($price > $u->info['money']) {
|
||||
$r = 'У вас недостаточно денег (не хватает ' . ($price - $u->info['money']) . ' кр.)';
|
||||
} else {
|
||||
$u->addKr(-$price);
|
||||
$u->addKr($price, $irow['uid']);
|
||||
|
||||
$col = 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 ?',
|
||||
[$u->info['id'], $irow['price1'], $irow['item_id'], $irow['uid'], $irow['inGroup'], $col]);
|
||||
$irow['name'] .= "(x$col)";
|
||||
} else {
|
||||
Db::sql('update items_users set uid = ?, 1price = ?, lastUPD = unix_timestamp(), inShop = 0
|
||||
where id = ? and uid = ? and inOdet = 0',
|
||||
[$iid, $irow['uid']]);
|
||||
}
|
||||
|
||||
Delo::add(1, 'comShop', $u->info['id'], "Купил предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.", $price);
|
||||
Delo::add(1, 'comShop', $irow['uid'], "Продал предмет «{$irow['name']}» игроку {$irow['login']} за $price кр.");
|
||||
|
||||
$r = "Вы купили предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.<br>Предмет успешно добавлен в инвентарь.";
|
||||
}
|
||||
}
|
||||
return '<div>' . $r . '</div>';
|
||||
}
|
||||
|
||||
public function rent($action, int $iid, int $price): void
|
||||
{
|
||||
if ($action == "Сдать в магазин" && $price > 0) {
|
||||
$this->rentPut($iid, $price);
|
||||
} elseif ($action == "Забрать") {
|
||||
$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,88 +2,79 @@
|
||||
|
||||
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 function __construct()
|
||||
{
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
//singleton
|
||||
}
|
||||
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('date.timezone', 'Europe/Moscow');
|
||||
/** Самый распространённый субдомен
|
||||
* //img.{siteName}.
|
||||
* @return string
|
||||
*/
|
||||
public static function img(): string
|
||||
{
|
||||
return self::subdomain('img');
|
||||
}
|
||||
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
private static function subdomain(string $name): string
|
||||
{
|
||||
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'] = 'Бойцовский Клуб';
|
||||
$c['title'] = 'Новый «' . $c['name'] . '» - Бесплатная,браузерная онлайн игра'; //Название игры
|
||||
$c['title2'] = ' - Бесплатная, онлайн игра посвященная сражениям и магии!';
|
||||
$c['title3'] = $c['name'];
|
||||
$c['keys'] = $c['name'] . ', combats.com, ' . $c['name'] . ' игра, ' . $c['name'] . ' играть, игра ' . $c['name'] . ', старый ' . $c['name'] . ', ' . $c['name'] . ' онлайн игра, ' . $c['name'] . ' браузерная игра, играть в ' . $c['name'] . ', игра бк, бк игра, старый бк, играть в бк, бк онлайн игра, новый бк, Легендарный ' . $c['name'] . ', легендарный бк, combats, комбатс, combats ru, combats com, OldBK, oldbk ru, oldbk com, олдбк, old bk, олд бк, mycombats, rebk, recombats, oldcombats, obk2'; //Ключевые слова META
|
||||
$c['desc'] = '«' . $c['name'] . '» – это бесплатная увлекательная браузерная онлайн игра 2004-2009г, в которой сконцентрировано все самое лучшее от современных онлайн игр. В этой браузерной игре заложены самые интересные традиции всем известной онлайн игры под названием «' . $c['name'] . ' 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'] = 'new-combats.com';
|
||||
$c['forum'] = 'forum.' . $c['host'];
|
||||
$c['img'] = 'img.' . $c['host'];
|
||||
$c['thiscity'] = 'capitalcity';
|
||||
$c['capitalcity'] = $c['host'];
|
||||
$c['abandonedplain'] = $c['host'];
|
||||
$c['https'] = 'https://' . $c['host'] . DIRECTORY_SEPARATOR;
|
||||
$c['exit'] = '<script>top.location.href="' . $c['https'] . '";</script>';
|
||||
$c['support'] = 'support@' . $c['host'];
|
||||
|
||||
|
||||
//Валюта
|
||||
$c['curency_name'] = 'RUB';
|
||||
$c['curency_value'] = 30;
|
||||
$c['host'] = self::HOSTNAME;
|
||||
$c['forum'] = self::subdomain('forum');
|
||||
$c['img'] = 'img.' . self::HOSTNAME;
|
||||
$c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::HOSTNAME;
|
||||
$c['img2'] = self::subdomain('img');
|
||||
$c['exit'] = "<script>window.location.replace('{$c['https']}');</script>";
|
||||
$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['infinity5level'] = false; //вечные 5 уровни
|
||||
$c['expstop'] = 2999999; //9; //Опыт на котором останавливаемся 11 149999999
|
||||
$c['expstopu'] = 2999999; //Опыт на котором останавливаемся
|
||||
$c['noobgade'] = false; //нуб квест (пещера)
|
||||
$c['bonusonline'] = true; //бонус за онлайн
|
||||
$c['level_ransfer'] = 8; //С какого уровня разрешены передачи
|
||||
$c['znahar'] = true; //бесплатный знахарь
|
||||
$c['nolevel'] = false; //лимитирование уровней
|
||||
$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';
|
||||
$c['db_password'] = 'Bz@fGaZjFU2206Ua';
|
||||
@@ -97,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.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class Database
|
||||
* Singleton.
|
||||
*/
|
||||
private function __construct() {
|
||||
mysql_select_db(Config::get('db_name'), mysql_connect('localhost', Config::get('db_user'), Config::get('db_password')));
|
||||
mysql_select_db(Config::get('db_name'), mysql_connect(Config::get('db_host'), Config::get('db_user'), Config::get('db_password')));
|
||||
mysql_query('SET NAMES utf8mb4');
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class Database
|
||||
public static function pdoinit(): PDO
|
||||
{
|
||||
return new PDO(
|
||||
'mysql:host=localhost;dbname=' . Config::get('db_name'),
|
||||
'mysql:host=' . Config::get('db_host') . ';dbname=' . Config::get('db_name'),
|
||||
Config::get('db_user'),
|
||||
Config::get('db_password'),
|
||||
[
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Core;
|
||||
|
||||
use Exception;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use PDOStatement;
|
||||
@@ -15,67 +14,62 @@ class Db
|
||||
|
||||
/**
|
||||
* DB constructor.
|
||||
* @throws Exception
|
||||
* @throws PDOException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
self::$db = Database::pdoinit();
|
||||
} catch (PDOException $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
throw new PDOException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @return false|int
|
||||
*/
|
||||
public static function exec(string $query): false|int
|
||||
{
|
||||
self::init();
|
||||
return self::$db->exec($query);
|
||||
}
|
||||
|
||||
private static function init(): void
|
||||
{
|
||||
self::$instance ??= new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stmt
|
||||
* @return PDOStatement
|
||||
* @param ?string $name [optional] Name of the sequence object from which the ID should be returned.
|
||||
* @return false|string
|
||||
*/
|
||||
private static function query(string $stmt): PDOStatement
|
||||
public static function lastInsertId(?string $name = null): false|string
|
||||
{
|
||||
self::init();
|
||||
return self::$db->query($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stmt
|
||||
* @return PDOStatement
|
||||
*/
|
||||
public static function prepare(string $stmt): PDOStatement
|
||||
{
|
||||
self::init();
|
||||
return self::$db->prepare($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @return int
|
||||
*/
|
||||
static public function exec(string $query): int
|
||||
{
|
||||
self::init();
|
||||
return self::$db->exec($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
static public function lastInsertId(): string
|
||||
{
|
||||
self::init();
|
||||
return self::$db->lastInsertId();
|
||||
return self::$db->lastInsertId($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return PDOStatement
|
||||
* @return array
|
||||
*/
|
||||
public static function run(string $query, array $args = []): PDOStatement
|
||||
public static function getRows(string $query, array $args = []): array
|
||||
{
|
||||
$stmt = self::run($query, $args)->fetchAll();
|
||||
if (!$stmt) {
|
||||
return [];
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return false|PDOStatement
|
||||
*/
|
||||
public static function run(string $query, array $args = []): false|PDOStatement
|
||||
{
|
||||
try {
|
||||
if (!$args) {
|
||||
@@ -89,14 +83,38 @@ class Db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stmt
|
||||
* @return false|PDOStatement
|
||||
*/
|
||||
private static function query(string $stmt): false|PDOStatement
|
||||
{
|
||||
self::init();
|
||||
return self::$db->query($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stmt
|
||||
* @return false|PDOStatement
|
||||
*/
|
||||
public static function prepare(string $stmt): false|PDOStatement
|
||||
{
|
||||
self::init();
|
||||
return self::$db->prepare($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getRow(string $query, array $args = [])
|
||||
public static function getValue(string $query, array $args = []): mixed
|
||||
{
|
||||
return self::run($query, $args)->fetch();
|
||||
$result = self::getRow($query, $args);
|
||||
if (!empty($result)) {
|
||||
return array_shift($result);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,23 +122,13 @@ class Db
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public static function getRows(string $query, array $args = []): array
|
||||
public static function getRow(string $query, array $args = []): array
|
||||
{
|
||||
return self::run($query, $args)->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getValue(string $query, array $args = [])
|
||||
{
|
||||
$result = self::getRow($query, $args);
|
||||
if (!empty($result)) {
|
||||
$result = array_shift($result);
|
||||
$stmt = self::run($query, $args)->fetch();
|
||||
if (!$stmt) {
|
||||
return [];
|
||||
}
|
||||
return $result;
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,14 +138,18 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
*/
|
||||
public static function sql(string $query, array $args = [])
|
||||
public static function sql(string $query, array $args = []): void
|
||||
{
|
||||
self::run($query, $args);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Core;
|
||||
|
||||
class Debug
|
||||
{
|
||||
public static function x(): void
|
||||
{
|
||||
ini_set('xdebug.var_display_max_depth', 10);
|
||||
ini_set('xdebug.var_display_max_children', 256);
|
||||
ini_set('xdebug.var_display_max_data', 1024);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Core;
|
||||
|
||||
use PHPMailer;
|
||||
|
||||
class Mail
|
||||
{
|
||||
public static function send($to, $message, $subject = 'Бойцовский клуб')
|
||||
{
|
||||
require dirname(__DIR__) . '/mail/class.phpmailer.php';
|
||||
$mail = new PHPMailer;
|
||||
|
||||
$mail->IsSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup server
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'newcombats@yahoo.com'; // SMTP username
|
||||
$mail->Password = 'uqcdbnsoagxcyysh';
|
||||
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
||||
$mail->Port = 587;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
|
||||
$mail->From = 'newcombats@yahoo.com';
|
||||
$mail->FromName = 'Бойцовский Клуб';
|
||||
$mail->AddAddress($to); // Add a recipient
|
||||
|
||||
$mail->IsHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = '<div>' . $message . '</div>';
|
||||
$mail->AltBody = $message;
|
||||
|
||||
if (!$mail->Send()) {
|
||||
return 'Message could not be sent. Mailer Error: ' . $mail->ErrorInfo;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Core;
|
||||
|
||||
class View
|
||||
{
|
||||
public static function render(string $view, array $arguments = []): void
|
||||
{
|
||||
extract($arguments, EXTR_SKIP);
|
||||
$file = $_SERVER['DOCUMENT_ROOT'] . "/_incl_data/Views/$view";
|
||||
|
||||
if (is_readable($file)) {
|
||||
require $file;
|
||||
} else {
|
||||
trigger_error("File $file not found!", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace DTO;
|
||||
|
||||
class BattleSpell
|
||||
{
|
||||
public string $name;
|
||||
public string $elemental;
|
||||
public int $damage;
|
||||
public string $color;
|
||||
public string $colorCrit;
|
||||
public string $colorMiss;
|
||||
|
||||
public function __construct(string $elemental)
|
||||
{
|
||||
if (!in_array($elemental, ['fire', 'water', 'air', 'earth', 'light', 'dark'])) {
|
||||
$this->elemental = 'raw';
|
||||
}
|
||||
if ($elemental === 'fire') {
|
||||
$this->elemental = $elemental;
|
||||
$this->color = '#a00';
|
||||
$this->colorCrit = '#f00';
|
||||
$this->colorMiss = '#909090';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace DTO;
|
||||
|
||||
use Helper\Conversion;
|
||||
use ItemModel;
|
||||
|
||||
class KnowledgeTempleItem
|
||||
{
|
||||
public int $id;
|
||||
public int $type;
|
||||
public string $name;
|
||||
public int $level;
|
||||
|
||||
private int $rowId;
|
||||
|
||||
/**
|
||||
* @param array $item
|
||||
*/
|
||||
public function __construct(array $item)
|
||||
{
|
||||
$this->rowId = $item['id'];
|
||||
$this->id = intval($item['item_id']);
|
||||
$this->type = intval($item['type']);
|
||||
$this->name = $item['name'];
|
||||
|
||||
// Общий + конкретный.
|
||||
$itemData = array_merge(
|
||||
Conversion::dataStringToArray(ItemModel::getItemData($this->id)),
|
||||
Conversion::dataStringToArray($item['data']),
|
||||
);
|
||||
$this->level = intval($itemData['tr_lvl']);
|
||||
}
|
||||
|
||||
public function exists(): bool
|
||||
{
|
||||
return !empty($this->rowId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace DTO;
|
||||
|
||||
class Present
|
||||
{
|
||||
/** Логин отправителя
|
||||
* @var string
|
||||
*/
|
||||
public string $sender;
|
||||
/** Логин получателя
|
||||
* @var string
|
||||
*/
|
||||
public string $receiver;
|
||||
/** id подарка
|
||||
* @var int
|
||||
*/
|
||||
public int $itemId;
|
||||
/** Заголовок поздравления.
|
||||
* Обычно отображается в инфе персонажа в тултипе.
|
||||
* @var string
|
||||
*/
|
||||
public string $textTitle = '';
|
||||
/** Текст поздравления
|
||||
* Отображается только получателю подарка в инвентаре.
|
||||
* @var string
|
||||
*/
|
||||
public string $text = '';
|
||||
/** Флаг анонимности. Если true, в поле "отправитель" будет "невидимка".
|
||||
* @var bool
|
||||
*/
|
||||
public bool $anonymousSender = false;
|
||||
/** Флаг кланового подарка. Если true, в поле "отправитель" будет имя клана в котором состоит игрок.
|
||||
* @var bool
|
||||
*/
|
||||
public bool $clanSender = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Battle\Techniques;
|
||||
|
||||
use DarksLight2\Entity;
|
||||
use DarksLight2\Traits\Singleton;
|
||||
|
||||
class TechniqueCategoryEntity extends Entity
|
||||
{
|
||||
use Singleton;
|
||||
|
||||
public int $id;
|
||||
public string $name;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Battle\Techniques;
|
||||
|
||||
use DarksLight2\Entity;
|
||||
use DarksLight2\Traits\Singleton;
|
||||
|
||||
class TechniquesEntity extends Entity
|
||||
{
|
||||
use Singleton;
|
||||
|
||||
public int $id;
|
||||
public string $name;
|
||||
public string $description;
|
||||
public string $image;
|
||||
public int $category_id;
|
||||
public int $delay;
|
||||
public float $spirit_points;
|
||||
public int $critical_points;
|
||||
public int $parry_points;
|
||||
public int $defense_points;
|
||||
public int $damage_points;
|
||||
public ?int $skip;
|
||||
public int $level;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2;
|
||||
|
||||
use Core\Db;
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReflectionProperty;
|
||||
|
||||
abstract class Entity
|
||||
{
|
||||
protected string $table;
|
||||
|
||||
public function toSnakCase($string): string
|
||||
{
|
||||
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $string));
|
||||
}
|
||||
|
||||
protected function getTable(): string
|
||||
{
|
||||
if(!isset($this->table)) {
|
||||
try {
|
||||
$class = new ReflectionClass($this);
|
||||
$table_name = preg_replace(
|
||||
'/_entity/',
|
||||
'',
|
||||
$this->toSnakCase($class->getShortName())
|
||||
);
|
||||
|
||||
if (!Db::getRow("SHOW TABLES LIKE '$table_name'")) {
|
||||
throw new Exception(
|
||||
'Undefined table ' . $table_name . ' in database'
|
||||
);
|
||||
}
|
||||
|
||||
$this->table = $table_name;
|
||||
} catch (Exception $e) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function morph(array $object) {
|
||||
|
||||
$class = new ReflectionClass(get_called_class());
|
||||
|
||||
try {
|
||||
$entity = $class->newInstance();
|
||||
} catch (ReflectionException $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
|
||||
foreach($class->getProperties(ReflectionProperty::IS_PUBLIC) as $prop) {
|
||||
if (isset($object[$prop->getName()])) {
|
||||
$prop->setValue($entity,$object[$prop->getName()]);
|
||||
}
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
public function find(array $condition): ?Entity
|
||||
{
|
||||
$query = "SELECT * FROM {$this->getTable()} WHERE ";
|
||||
$values = [];
|
||||
|
||||
foreach ($condition as $field => $value) {
|
||||
$values[] = $value;
|
||||
$query .= "$field = ?";
|
||||
}
|
||||
|
||||
$request = Db::prepare("$query LIMIT 1");
|
||||
$request->execute($values);
|
||||
|
||||
if($result = $request->fetch()) {
|
||||
return self::morph($result);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $condition
|
||||
*
|
||||
* @return Entity[]|null
|
||||
*/
|
||||
public function findAll(?array $condition = null): ?array
|
||||
{
|
||||
if(!isset($condition)) {
|
||||
$query = "SELECT * FROM {$this->getTable()}";
|
||||
} else {
|
||||
$query = "SELECT * FROM {$this->getTable()} WHERE ";
|
||||
$values = [];
|
||||
|
||||
foreach ($condition as $field => $value) {
|
||||
$values[] = $value;
|
||||
$query .= "$field = ?";
|
||||
}
|
||||
}
|
||||
|
||||
$request = Db::prepare("$query");
|
||||
$request->execute($values ?? null);
|
||||
|
||||
if($rows = $request->fetchAll()) {
|
||||
$result = [];
|
||||
foreach ($rows as $row) {
|
||||
$result[] = self::morph($row);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Helpers;
|
||||
|
||||
class Str
|
||||
{
|
||||
public static function snakeCase($string): string
|
||||
{
|
||||
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $string));
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,47 @@
|
||||
|
||||
namespace DarksLight2\Training;
|
||||
|
||||
use DarksLight2\Helpers\Str;
|
||||
use User;
|
||||
|
||||
abstract class StepFactory
|
||||
{
|
||||
|
||||
abstract public function getTitle(): string;
|
||||
abstract public function getMessage(): string;
|
||||
abstract public function getShortName(): string;
|
||||
abstract public function getRewards(): array;
|
||||
public function onLocations(): array
|
||||
{
|
||||
return ['all'];
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return Str::snakeCase(get_class($this));
|
||||
}
|
||||
public function getAnswer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function allowedToMove(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function databaseRecord()
|
||||
{
|
||||
return [
|
||||
'completed' => false,
|
||||
'progress' => [
|
||||
'current' => 0,
|
||||
'need' => 1,
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class ChatFirstQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Начало.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Отправьте сообщение в общий чат.';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'chat_first_quest';
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class ChatFirstStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Начало.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Помните, оскорблять, унижать, обсуждать политику, подстёгивать других игроков, как в общем чате так и в приватном приведет к временному ограничению возможности отправки сообщений в любой из чатов.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'chat_first_step';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class ChatSecondQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Начало.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Отправьте адресное сообщение в общий чат, нажав 1 раз по никнейму игрока либо в чате, либо со списка онлайна, который находится справа.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'chat_second_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class ChatThirdQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Начало.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Отправьте адресное личное сообщение в чат, нажав 2 раза по никнему игрока либо в чате, либо со списка онлайна, который находится справа.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'chat_third_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class FirstStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Первое знакомство';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'test';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'first_step';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserFirstQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Сколько всего основных игровых Валют? Введите их число...';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_first_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAnswer(): string
|
||||
{
|
||||
return '2';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserFirstStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'В нашей игре, ваш персонаж расположен слева от экрана с игровыми локациями, там же, можно увидеть пустые слоты под предметы и параметры персонажа, ваш опыт, деньги, ежедневные задания...';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_first_step';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserFourthQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Войдите во вкладку " Умения ", в правой части экрана, сверху, а далее, перейдите во вкладку " Приёмы ", после чего, выберите нужные Вам приемы, но будьте внимательны, некоторые из приемов могут быть на разные классы, обязательно прочтите их описание или потестируйте в поединках.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_fourth_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserFourthStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return '"Параметры Персонажа"<br>
|
||||
Все игроки имеют свободные очки распределения параметров, что они дают игрокам конкретные модификаторы в зависимости от того, в какой из параметров распределяются очки распределения.<br>
|
||||
--- если можно, добавить скрин как выглядит эта кнопка ---
|
||||
Сила - Увеличивает мощность рубящего урона ( для Силачей )<br>
|
||||
Ловкость - Увеличивает мощность колющего урона ( для Критоуворотов и Уворотов )<br>
|
||||
Интуиция - Увеличивает мощность режущего урона ( для Критовиков )<br>
|
||||
Выносливость - Увеличивает защиту от урона и магии, а так же добавит немного жизней. ( для Танков )<br>
|
||||
Интелект - Увеличивает мощность магии. ( Для Любого Мага )<br>
|
||||
Мудрость - Увеличивает колличество маны. ( Для Любого Мага )<br>
|
||||
<br>
|
||||
Дополнительно, игроки имеют очки распределения Мастерства Оружия, это позволит воинам увеличить урон, а магам, открыть новые приемы.<br>
|
||||
Очки распределения Оружий распределяются точно так же, как и очки распределения параметров ( статов ).<br>
|
||||
<br>
|
||||
В случае, если вы распределили неверно любые доступные очки распределения, или хотите их изменить, вы можете это сделать, поднявшись на 2 этаж здания " Бойцовский Клуб ".';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_fourth_step';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAnswer(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserSecondQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Кого убивает игровой класс "Танк"?';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_second_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAnswer(): string
|
||||
{
|
||||
return 'Уворотов и Силачей';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserSecondStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Опыт - Получение опыта происходит после сыгранных поединков, в зависимости от выбитого урона с противников, нажав по своему опыту, откроется таблица опыта, в которой можно посмотреть, когда вы получите дополнительное очко распределение параметров персонажа/оружий, награду за взятие " апа " или " Уровня "<br>
|
||||
Текущий уровень - Отображает ваш текущий уровень персонажа.<br>
|
||||
Победы - Отображает сумму всех ваших побед, в любых поединках.<br>
|
||||
Поражения - Отображает сумму всех ваших поражений, в любых поединках.<br>
|
||||
Ничьих - Отображает сумму всех поединков, которые завершились в ничью.<br>
|
||||
Кредиты - Обычная игровая валюта - кредиты ( креды ), которые можно потратить в обычном магазине.<br>
|
||||
Еврокредиты - Покупная игровая валюта - еврокредиты ( екры ) , которые можно потратить в магазине " Берёзка ". <br>
|
||||
Воинственность - Дополнительная игровая валюта, потратить её можно в Подпольной Лавке.<br>
|
||||
Ежедневное задание - Отображает текущее ежедневное задание либо предоставляет возможность его взятия.<br>
|
||||
Бонус - Позволяет получить немного кредитов или еврокредитов.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_second_step';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserThirdQuest extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'Распределите свободные параметры распределения ( статы ) и параметры оружий ( умения ) в зависимости от выбранного вами при регистрации "Класса" игрока нажав по кнопке " + Способности ", а далее, после распределения параметров " Сохранить ".';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_third_quest';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isInfo(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function allowedToMove(): array
|
||||
{
|
||||
return ['cp1'];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace DarksLight2\Training\Steps;
|
||||
|
||||
use DarksLight2\Training\StepFactory;
|
||||
|
||||
class MyUserThirdStep extends StepFactory
|
||||
{
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Персонаж.';
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return 'В нашей игре, существует 5 Воинских и 4 Магических класса, такие как:<br>
|
||||
Критовик - Убивает Танков и Магов, основное оружие - Мечи<br>
|
||||
Уворот - Убивает Критовиков и Силачей, основное оружие - Кинжалы<br>
|
||||
Танк - Убивает Уворотов и Силачей, основное оружие - Дубина и щит.<br>
|
||||
Силач - Убивает Критовиков и Магов, основное оружие - Топоры<br>
|
||||
Критоуворот - Убивает Силачей и с небольшим шансом Критовиков и Уворотов, основное оружие - Кинжалы.<br>
|
||||
<br>
|
||||
Маг Огня - Атакующий маг, убивает Уворотов и Танков.<br>
|
||||
Маг Воздуха - Атакующий маг, убивает Уворотов и Танков.<br>
|
||||
Маг Земли - Защищающийся маг, слабый урон, хорошая защита.<br>
|
||||
Маг Воды - Защищающийся маг, слабый урон, хорошая защита.';
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return 'my_user_third_step';
|
||||
}
|
||||
|
||||
public function getRewards(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function allowedToMove(): array
|
||||
{
|
||||
return ['cp1'];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,24 +3,125 @@
|
||||
namespace DarksLight2\Training;
|
||||
|
||||
use Core\Db;
|
||||
use DarksLight2\Training\Steps\ChatFirstStep;
|
||||
use DarksLight2\Training\Steps\MyUserFirstQuest;
|
||||
use DarksLight2\Training\Steps\MyUserFirstStep;
|
||||
use DarksLight2\Training\Steps\MyUserFourthQuest;
|
||||
use DarksLight2\Training\Steps\MyUserFourthStep;
|
||||
use DarksLight2\Training\Steps\MyUserSecondQuest;
|
||||
use DarksLight2\Training\Steps\MyUserSecondStep;
|
||||
use DarksLight2\Training\Steps\MyUserThirdQuest;
|
||||
use DarksLight2\Training\Steps\MyUserThirdStep;
|
||||
use DarksLight2\Traits\Singleton;
|
||||
use PDO;
|
||||
use stdClass;
|
||||
use PassGen;
|
||||
use User;
|
||||
|
||||
class TrainingManager
|
||||
{
|
||||
|
||||
use Singleton;
|
||||
|
||||
private $database_records = false;
|
||||
private array $steps_data;
|
||||
private int $user_id;
|
||||
private array $steps;
|
||||
public string $current_step = '';
|
||||
private array $registered_steps;
|
||||
private array $completed_steps;
|
||||
private array $active_steps;
|
||||
|
||||
public function __construct(int $user_id)
|
||||
private $database;
|
||||
|
||||
public function __construct(int $user_id, $refresh_token = true)
|
||||
{
|
||||
try {
|
||||
$this->register([
|
||||
new ChatFirstStep(),
|
||||
new MyUserFirstStep(),
|
||||
new MyUserFirstQuest(),
|
||||
new MyUserSecondStep(),
|
||||
new MyUserSecondQuest(),
|
||||
new MyUserThirdStep(),
|
||||
new MyUserThirdQuest(),
|
||||
new MyUserFourthStep(),
|
||||
new MyUserFourthQuest(),
|
||||
]);
|
||||
} catch (TrainingException $e) {
|
||||
}
|
||||
|
||||
$this->user_id = $user_id;
|
||||
|
||||
if($refresh_token) {
|
||||
$this->generateToken();
|
||||
}
|
||||
|
||||
$this->database = Db::getRow('SELECT * FROM user_training WHERE user_id = ?', [$user_id]);
|
||||
|
||||
$this->createDatabaseRecord();
|
||||
|
||||
$this->database['data'] = json_decode($this->database['data'], true);
|
||||
|
||||
$this->selectActiveSteps();
|
||||
}
|
||||
|
||||
public function getCurrentStepName(): string
|
||||
{
|
||||
if(empty($this->current_step)) {
|
||||
$this->current_step = array_key_first($this->active_steps) ?? '';
|
||||
}
|
||||
|
||||
return $this->current_step;
|
||||
}
|
||||
public function getRegistered(): array
|
||||
{
|
||||
return $this->registered_steps;
|
||||
}
|
||||
|
||||
public function getDatabaseData()
|
||||
{
|
||||
return $this->database;
|
||||
}
|
||||
|
||||
public function addPoint($short_name, $closure = null)
|
||||
{
|
||||
if($short_name === $this->getCurrentStepName()) {
|
||||
$this->database['data'][$short_name]['progress']['current']++;
|
||||
if(isset($closure)) {
|
||||
$closure($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function nextStep()
|
||||
{
|
||||
|
||||
if($this->database['data'][$this->getCurrentStepName()]['progress']['need'] <= $this->database['data'][$this->getCurrentStepName()]['progress']['current']) {
|
||||
$this->database['data'][$this->getCurrentStepName()]['progress']['current'] = 0;
|
||||
$this->database['data'][$this->getCurrentStepName()]['completed'] = true;
|
||||
unset($this->active_steps[$this->getCurrentStepName()]);
|
||||
$this->current_step = array_key_first($this->active_steps) ?? '';
|
||||
$this->database['current'] = $this->getCurrentStepName();
|
||||
}
|
||||
}
|
||||
|
||||
public function previousStep()
|
||||
{
|
||||
$this->current_step = end($this->completed_steps) ?? '';
|
||||
$this->database['current'] = $this->current_step;
|
||||
$this->database['data'][$this->getCurrentStepName()]['completed'] = false;
|
||||
}
|
||||
|
||||
public function selectActiveSteps()
|
||||
{
|
||||
foreach ($this->database['data'] as $step_name => $data) {
|
||||
if($data['completed'] === false) {
|
||||
$this->active_steps[$step_name] = $data;
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->completed_steps[] = $step_name;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
Db::sql('UPDATE user_training SET data = ?, current = ? WHERE user_id = ?', [json_encode($this->database['data']), $this->database['current'], $this->user_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,104 +138,55 @@ class TrainingManager
|
||||
|
||||
foreach ($steps as $step) {
|
||||
if($step instanceof StepFactory) {
|
||||
$this->steps[$step->getShortName()] = new class (
|
||||
$step->getMessage(),
|
||||
$step->getTitle(),
|
||||
$step->getRewards(),
|
||||
$this->stepData($step->getShortName())->complete,
|
||||
$step->getShortName(),
|
||||
$this->stepData($step->getShortName())->progress
|
||||
) {
|
||||
public string $message;
|
||||
public string $title;
|
||||
public string $short_name;
|
||||
public array $rewards;
|
||||
public bool $isComplete;
|
||||
|
||||
public stdClass $progress;
|
||||
|
||||
public function __construct(
|
||||
string $message,
|
||||
string $title,
|
||||
array $rewards,
|
||||
bool $isComplete,
|
||||
string $short_name,
|
||||
stdClass $progress
|
||||
) {
|
||||
$this->rewards = $rewards;
|
||||
$this->title = $title;
|
||||
$this->isComplete = $isComplete;
|
||||
$this->message = $message;
|
||||
$this->short_name = $short_name;
|
||||
$this->progress = $progress;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$path = $_SERVER['DOCUMENT_ROOT'] . '/modules_data/steps/' . $this->short_name . '.php';
|
||||
|
||||
if(file_exists($path)) {
|
||||
require $path;
|
||||
return;
|
||||
}
|
||||
|
||||
throw TrainingException::noRenderingFile();
|
||||
}
|
||||
};
|
||||
$this->registered_steps[$step->getShortName()] = $step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function stepData(string $short_name): object
|
||||
private function generateToken($length = 16)
|
||||
{
|
||||
return json_decode($this->getDatabaseRecords()->data)->$short_name;
|
||||
}
|
||||
|
||||
private function getDatabaseRecords()
|
||||
{
|
||||
if(!$this->database_records) {
|
||||
$this->database_records = Db::run('SELECT * FROM user_training WHERE user_id = ?', [$this->user_id])
|
||||
->fetch(PDO::FETCH_OBJ);
|
||||
}
|
||||
|
||||
return $this->database_records;
|
||||
Db::run('UPDATE user_training SET api_token = ? WHERE user_id = ?', [
|
||||
PassGen::new($length),
|
||||
$this->user_id
|
||||
]);
|
||||
}
|
||||
|
||||
public function createDatabaseRecord()
|
||||
{
|
||||
if(!$this->getDatabaseRecords()) {
|
||||
Db::run('INSERT INTO user_training (user_id, data) VALUES (?, ?)', [
|
||||
if(!$this->database) {
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($this->registered_steps as $step) {
|
||||
$data[$step->getShortName()] = $step->databaseRecord();
|
||||
}
|
||||
|
||||
Db::sql('INSERT INTO user_training (user_id, data, current) VALUES (?, ?, ?)', [
|
||||
$this->user_id,
|
||||
json_encode($this->firstRecordData())
|
||||
json_encode($data, true),
|
||||
array_key_first($data)
|
||||
]);
|
||||
|
||||
$this->database = Db::getRow('SELECT * FROM user_training WHERE user_id = ?', [$this->user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
private function firstRecordData(): array
|
||||
/**
|
||||
* @throws \DarksLight2\Training\TrainingException
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return [
|
||||
'first_step' => [
|
||||
'complete' => 0,
|
||||
'progress' => [
|
||||
'current' => 0,
|
||||
'need' => 0,
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
if(in_array(User::start()->room['file'], $this->registered_steps[$this->getCurrentStepName()]->onLocations()) || in_array('all', $this->registered_steps[$this->getCurrentStepName()]->onLocations())) {
|
||||
$path = $_SERVER['DOCUMENT_ROOT'] . '/modules_data/steps/step.php';
|
||||
|
||||
public function __get(string $name)
|
||||
{
|
||||
return $this->steps[$name];
|
||||
}
|
||||
|
||||
public function addPoint(string $short_name)
|
||||
{
|
||||
$this->$short_name->progress++;
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
if (file_exists($path)) {
|
||||
$short_name = $this->getCurrentStepName();
|
||||
$answer = $this->registered_steps[$this->getCurrentStepName()]->getAnswer();
|
||||
require $path;
|
||||
return;
|
||||
}
|
||||
|
||||
throw TrainingException::noRenderingFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
use User\UserIp;
|
||||
|
||||
class Delo
|
||||
{
|
||||
/**
|
||||
* Запись в личное дело персонажа.
|
||||
* @param int $type цифровой тип лога (??)
|
||||
* @param string $from отправитель записи
|
||||
* @param int $uid кому пишется
|
||||
* @param string $text текст
|
||||
* @param float $moneyOut количество денег снятых с игрока
|
||||
* @param float $moneyIn количество денег полученных игроком
|
||||
* @return void
|
||||
*/
|
||||
public static function add(int $type, string $from, int $uid, string $text, float $moneyOut = 0, float $moneyIn = 0): void
|
||||
{
|
||||
$sql = 'insert into users_delo (uid, time, text, login, `delete`, no_right, ip, moneyOut, moneyIn, type) values (?,unix_timestamp(),?,?,0,?,?,?,?,?)';
|
||||
Db::sql($sql, [
|
||||
$uid, $text, $from, '', UserIp::get(), $moneyOut, $moneyIn, $type,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function printPublicModerationStatus(int $userid): void
|
||||
{
|
||||
$status = Db::getValue('select text from users_delo where uid = ? and hb != 0 order by id desc limit 1', [$userid]);
|
||||
if (!$status) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo <<<HTML
|
||||
<div style="padding-left: 5px; margin: 5px 0;">
|
||||
Сообщение от модераторов:<br>
|
||||
<span style="color: red; background-color: bisque; font-weight: bold;">$status</span>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getAllByUserId(int $userid): array
|
||||
{
|
||||
return Db::getRows('select time, text from users_delo where uid = ? and type = 0 order by id desc', [$userid]);
|
||||
}
|
||||
}
|
||||
|
||||
+56
-48
@@ -1,11 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Helper\Conversion;
|
||||
use User\ItemsModel;
|
||||
|
||||
class Dialog
|
||||
{
|
||||
private $info;
|
||||
public $dText = '', $aText = '', $youInfo = '', $botInfo = '', $title = '', $p = 1, $pg = 1;
|
||||
private array $info;
|
||||
public string $dText = '';
|
||||
public string $aText = '';
|
||||
public string $youInfo = '';
|
||||
public string $botInfo = '';
|
||||
public string $title = '';
|
||||
public int $p = 1;
|
||||
public int $pg = 1;
|
||||
|
||||
public function trnObj($x, $j)
|
||||
public function trnObj($x, $j): array
|
||||
{
|
||||
$i = floor($x / $j);
|
||||
return [0 => $i, 1 => $x - ($i * $j)];
|
||||
@@ -202,7 +211,7 @@ class Dialog
|
||||
//Выдаем предмет для квеста
|
||||
$itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $act1[8] . '" LIMIT 1'));
|
||||
if (isset($itmb['id'])) {
|
||||
$u->addItem($act1[8], $u->info['id'], '|nodelete=1');
|
||||
ItemsModel::addItem($act1[8], $u->info['id'], '|nodelete=1');
|
||||
$txt .= '<br><b><font color=red>Вы получили предмет "' . $itmb['name'] . '"</font></b>';
|
||||
}
|
||||
}
|
||||
@@ -223,16 +232,16 @@ class Dialog
|
||||
$txt .= ' за ' . $act1[2] . ' екр.';
|
||||
}
|
||||
if ($act1[3] > 0) {
|
||||
$txt .= ' на срок ' . $u->timeOut($act1[3]) . '';
|
||||
$act1dt .= '|srok=' . $act1[3] . '';
|
||||
$txt .= ' на срок ' . Conversion::secondsToTimeout($act1[3]);
|
||||
$act1dt .= '|srok=' . $act1[3];
|
||||
}
|
||||
$txt .= '</font></b>';
|
||||
|
||||
$u->addItem($itmb['id'], $u->info['id'], $act1dt);
|
||||
ItemsModel::addItem($itmb['id'], $u->info['id'], $act1dt);
|
||||
$pg = $act1[4];
|
||||
}
|
||||
} else {
|
||||
$txt .= '<br><b><font color=red>Неудалось приобрести предмет...</font></b>';
|
||||
$txt .= '<br><b style="color: red">Неудалось приобрести предмет...</b>';
|
||||
$pg = 1;
|
||||
}
|
||||
} elseif ($act1[0] == 'quest') {
|
||||
@@ -257,7 +266,7 @@ class Dialog
|
||||
}
|
||||
$ic2 = 1;
|
||||
while ($ic2 <= $act3[2]) {
|
||||
$u->addItem($itmqs['id'], $u->info['id'], '|quest_item=1', ['del' => $act3[3]]);
|
||||
ItemsModel::addItem($itmqs['id'], $u->info['id'], '|quest_item=1', ['del' => $act3[3]]);
|
||||
$ic2++;
|
||||
}
|
||||
}
|
||||
@@ -387,7 +396,7 @@ class Dialog
|
||||
if ($upd) {
|
||||
if ($itik > 0) {
|
||||
//Выдаем предметы
|
||||
$u->addItem($itik, $u->info['id'], '|nosale=1|srok=' . (7 * 86400) . '', null, 1);
|
||||
ItemsModel::addItem($itik, $u->info['id'], '|nosale=1|srok=' . (7 * 86400) . '', null, 1);
|
||||
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itik . '" LIMIT 1'));
|
||||
$txt = 'Вы получили предмет "' . $itm_nm['name'] . '"';
|
||||
} else {
|
||||
@@ -407,7 +416,7 @@ class Dialog
|
||||
}
|
||||
$arts_1 = $arts_1[rand(0, count($arts_1) - 1)];
|
||||
if ($arts_1 > 0) {
|
||||
$u->addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100);
|
||||
ItemsModel::addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100);
|
||||
}
|
||||
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $arts_1 . '" LIMIT 1'));
|
||||
|
||||
@@ -427,7 +436,7 @@ class Dialog
|
||||
}
|
||||
$arts_1 = $arts_1[rand(0, count($arts_1) - 1)];
|
||||
if ($arts_1 > 0) {
|
||||
$u->addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100);
|
||||
ItemsModel::addItem($arts_1, $u->info['id'], '|sroknext=1|nosale=1|sleep_moroz=1|srok=' . (86400 / 2) . '', null, 100);
|
||||
}
|
||||
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $arts_1 . '" LIMIT 1'));
|
||||
|
||||
@@ -517,7 +526,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
$txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '<br>';
|
||||
@@ -563,7 +572,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
$txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '<br>';
|
||||
@@ -609,7 +618,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
$txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i]['add'][1] . ' x' . $t[0] . '<br>';
|
||||
@@ -641,7 +650,7 @@ class Dialog
|
||||
if (isset($keypr1['id'], $keypr2['id'])) {
|
||||
mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr1['id'] . '" OR `id` = "' . $keypr2['id'] . '" LIMIT 2');
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$u->addItem(2555, $u->info['id'], $data);
|
||||
ItemsModel::addItem(2555, $u->info['id'], $data);
|
||||
$txt = 'Вы успешно получили "Пирамидальный ключ"';
|
||||
}
|
||||
|
||||
@@ -684,7 +693,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr['id'] . '" LIMIT 1');
|
||||
@@ -740,7 +749,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $keypr['id'] . '" LIMIT 1');
|
||||
@@ -796,7 +805,7 @@ class Dialog
|
||||
$data = '|frompisher=' . $d->info['id2'];
|
||||
$e = 1;
|
||||
while ($e <= $t[0]) {
|
||||
$u->addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
ItemsModel::addItem($cn[$i][$j]['add'][0], $u->info['id'], $data);
|
||||
$e++;
|
||||
}
|
||||
$txt .= $cn[$i][$j]['n'] . ' x' . ($t[0] * $this->objLevel($cn[$i][$j], $u->info['level'])) . ' = ' . $cn[$i][$j]['add'][1] . ' x' . $t[0] . '<br>';
|
||||
@@ -951,7 +960,7 @@ class Dialog
|
||||
$qsw = 0;
|
||||
while ($qsw < $item['colvo']) {
|
||||
$txt .= '<br/>Вы получили предмет';
|
||||
$u->addItem($item['item_id'], $u->info['id']);
|
||||
ItemsModel::addItem($item['item_id'], $u->info['id']);
|
||||
$qsw++;
|
||||
}
|
||||
}
|
||||
@@ -977,7 +986,7 @@ class Dialog
|
||||
if ($this->info['tr_dn'] != $d->info['id2']) {
|
||||
$go = 0;
|
||||
} elseif ($this->info['x'] != 0 || $this->info['y'] != 0) {
|
||||
if ($d->testLike($u->info['x'], $u->info['y'], $this->info['x'], $this->info['y']) != 1) {
|
||||
if (!$d->cellIsGoodforAction($u->info['x'], $u->info['y'], $this->info['x'], $this->info['y'])) {
|
||||
$go = 0;
|
||||
}
|
||||
//если бот погиб
|
||||
@@ -1015,8 +1024,7 @@ class Dialog
|
||||
}
|
||||
|
||||
$this->title = $this->info['text'];
|
||||
$this->youInfo = $u->getInfoPers($u->info['id'], 1);
|
||||
$this->youInfo = $this->youInfo[0];
|
||||
$this->youInfo = $u->getInfoPers($u->info['id'], 1)[0];
|
||||
$this->botInfo = $this->infoBot($this->info['bot_id']);
|
||||
//Диалог
|
||||
$qpl = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "1" AND `qid` = "0" AND `id_dg` = "' . $this->info['id'] . '" AND `page` = "' . ((int)$pg) . '" LIMIT 1'));
|
||||
@@ -1135,7 +1143,7 @@ class Dialog
|
||||
}
|
||||
}
|
||||
if ($u->info['admin'] > 0) {
|
||||
$a .= '<small>(<a href="javascript:window.open(\'https://new-combats.com/quest_dlg_edit.php?pid=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" title="Редактировать вариант ответа">ред.</a>)</small> ';
|
||||
$a .= '<small>(<a href="javascript:window.open(\'/quest_dlg_edit.php?pid=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" title="Редактировать вариант ответа">ред.</a>)</small> ';
|
||||
}
|
||||
if ($go1 == '') {
|
||||
$a .= '• <a href="' . $pl['action'] . '">' . $pl['text'] . '</a><br>';
|
||||
@@ -1209,7 +1217,7 @@ class Dialog
|
||||
$val = 4799;
|
||||
}
|
||||
}
|
||||
$u->addItem($val, $u->info['id'], $data_itm);
|
||||
ItemsModel::addItem($val, $u->info['id'], $data_itm);
|
||||
$i1++;
|
||||
}
|
||||
} elseif ($var == 'up') {
|
||||
@@ -1274,41 +1282,41 @@ class Dialog
|
||||
if (isset($bot['id'])) {
|
||||
//Характеристики от предметов и их изображение
|
||||
$witm = [];
|
||||
$witm[1] = '<img width="60" height="60" style="display:block;" title="Пустой слот шлем" src="https://img.new-combats.com/i/items/w/w9.gif">';
|
||||
$witm[2] = '<img width="60" height="40" style="display:block;" title="Пустой слот наручи" src="https://img.new-combats.com/i/items/w/w13.gif">';
|
||||
$witm[3] = '<img width="60" height="60" style="display:block;" title="Пустой слот оружие" src="https://img.new-combats.com/i/items/w/w3.gif">';
|
||||
$witm[4] = '<img width="60" height="80" style="display:block;" title="Пустой слот броня" src="https://img.new-combats.com/i/items/w/w4.gif">';
|
||||
$witm[7] = '<img width="60" height="40" style="display:block;" title="Пустой слот пояс" src="https://img.new-combats.com/i/items/w/w5.gif">';
|
||||
$witm[8] = '<img width="60" height="20" style="display:block;" title="Пустой слот серьги" src="https://img.new-combats.com/i/items/w/w1.gif">';
|
||||
$witm[9] = '<img width="60" height="20" style="display:block;" title="Пустой слот ожерелье" src="https://img.new-combats.com/i/items/w/w2.gif">';
|
||||
$witm[10] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="https://img.new-combats.com/i/items/w/w6.gif">';
|
||||
$witm[11] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="https://img.new-combats.com/i/items/w/w6.gif">';
|
||||
$witm[12] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="https://img.new-combats.com/i/items/w/w6.gif">';
|
||||
$witm[13] = '<img width="60" height="40" style="display:block;" title="Пустой слот перчатки" src="https://img.new-combats.com/i/items/w/w11.gif">';
|
||||
$witm[14] = '<img width="60" height="60" style="display:block;" title="Пустой слот щит" src="https://img.new-combats.com/i/items/w/w10.gif">';
|
||||
$witm[16] = '<img width="60" height="80" style="display:block;" title="Пустой слот поножи" src="https://img.new-combats.com/i/items/w/w19.gif">';
|
||||
$witm[17] = '<img width="60" height="40" style="display:block;" title="Пустой слот обувь" src="https://img.new-combats.com/i/items/w/w12.gif">';
|
||||
$witm[1] = '<img width="60" height="60" style="display:block;" title="Пустой слот шлем" src="//img.new-combats.tech/i/items/w/w9.gif">';
|
||||
$witm[2] = '<img width="60" height="40" style="display:block;" title="Пустой слот наручи" src="//img.new-combats.tech/i/items/w/w13.gif">';
|
||||
$witm[3] = '<img width="60" height="60" style="display:block;" title="Пустой слот оружие" src="//img.new-combats.tech/i/items/w/w3.gif">';
|
||||
$witm[4] = '<img width="60" height="80" style="display:block;" title="Пустой слот броня" src="//img.new-combats.tech/i/items/w/w4.gif">';
|
||||
$witm[7] = '<img width="60" height="40" style="display:block;" title="Пустой слот пояс" src="//img.new-combats.tech/i/items/w/w5.gif">';
|
||||
$witm[8] = '<img width="60" height="20" style="display:block;" title="Пустой слот серьги" src="//img.new-combats.tech/i/items/w/w1.gif">';
|
||||
$witm[9] = '<img width="60" height="20" style="display:block;" title="Пустой слот ожерелье" src="//img.new-combats.tech/i/items/w/w2.gif">';
|
||||
$witm[10] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="//img.new-combats.tech/i/items/w/w6.gif">';
|
||||
$witm[11] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="//img.new-combats.tech/i/items/w/w6.gif">';
|
||||
$witm[12] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="//img.new-combats.tech/i/items/w/w6.gif">';
|
||||
$witm[13] = '<img width="60" height="40" style="display:block;" title="Пустой слот перчатки" src="//img.new-combats.tech/i/items/w/w11.gif">';
|
||||
$witm[14] = '<img width="60" height="60" style="display:block;" title="Пустой слот щит" src="//img.new-combats.tech/i/items/w/w10.gif">';
|
||||
$witm[16] = '<img width="60" height="80" style="display:block;" title="Пустой слот поножи" src="//img.new-combats.tech/i/items/w/w19.gif">';
|
||||
$witm[17] = '<img width="60" height="40" style="display:block;" title="Пустой слот обувь" src="//img.new-combats.tech/i/items/w/w12.gif">';
|
||||
//40-52 слот под магию
|
||||
$witm[53] = '<img style="display:block;" title="Пустой слот правый карман" src="https://img.new-combats.com/i/items/w/w15.gif">';
|
||||
$witm[54] = '<img style="display:block;" title="Пустой слот левый карман" src="https://img.new-combats.com/i/items/w/w15.gif">';
|
||||
$witm[55] = '<img style="display:block;" title="Пустой слот центральный карман" src="https://img.new-combats.com/i/items/w/w15.gif">';
|
||||
$witm[56] = '<img style="display:block;" title="Пустой слот смена" src="https://img.new-combats.com/i/items/w/w20.gif">';
|
||||
$witm[57] = '<img style="display:block;" title="Пустой слот смена" src="https://img.new-combats.com/i/items/w/w20.gif">';
|
||||
$witm[58] = '<img style="display:block;" title="Пустой слот смена" src="https://img.new-combats.com/i/items/w/w20.gif">';
|
||||
$witm[53] = '<img style="display:block;" title="Пустой слот правый карман" src="//img.new-combats.tech/i/items/w/w15.gif">';
|
||||
$witm[54] = '<img style="display:block;" title="Пустой слот левый карман" src="//img.new-combats.tech/i/items/w/w15.gif">';
|
||||
$witm[55] = '<img style="display:block;" title="Пустой слот центральный карман" src="//img.new-combats.tech/i/items/w/w15.gif">';
|
||||
$witm[56] = '<img style="display:block;" title="Пустой слот смена" src="//img.new-combats.tech/i/items/w/w20.gif">';
|
||||
$witm[57] = '<img style="display:block;" title="Пустой слот смена" src="//img.new-combats.tech/i/items/w/w20.gif">';
|
||||
$witm[58] = '<img style="display:block;" title="Пустой слот смена" src="//img.new-combats.tech/i/items/w/w20.gif">';
|
||||
|
||||
$pb = '';
|
||||
$hpmp = '?? ';
|
||||
$eff = '';
|
||||
$anml = '';
|
||||
$oi = '';
|
||||
$msl = '<img width="120" height="40" style="display:block" src="https://img.new-combats.com/i/slot_bottom.gif">';
|
||||
$msl = '<img width="120" height="40" style="display:block" src="//img.new-combats.tech/i/slot_bottom.gif">';
|
||||
$witmg = '';
|
||||
|
||||
if ($bot['level'] < 0) {
|
||||
$bot['level'] = '??';
|
||||
}
|
||||
|
||||
$r = '<div style="width:246px; padding:2px;" align="center"><b>' . $bot['login'] . '</b> [' . $bot['level'] . ']<img src="https://img.new-combats.com/i/inf_.gif"></div>
|
||||
$r = '<div style="width:246px; padding:2px;" align="center"><b>' . $bot['login'] . '</b> [' . $bot['level'] . ']<img src="//img.new-combats.tech/i/inf_.gif"></div>
|
||||
<div style="width:240px; padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
|
||||
<div align="center"><!-- blocked -->' . $pb . '</div>
|
||||
<table width="240" border="0" cellspacing="0" cellpadding="0">
|
||||
@@ -1345,7 +1353,7 @@ class Dialog
|
||||
<td valign="top">
|
||||
<div style="position:relative;height:220px;">
|
||||
<!-- образ -->
|
||||
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="#obraz_pers"><img width="120" height="220" src="https://img.new-combats.com/i/obraz/' . $bot['sex'] . '/' . $bot['obraz'] . '" ' . $oi . '></a></div>
|
||||
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="#obraz_pers"><img width="120" height="220" src="//img.new-combats.tech/i/obraz/' . $bot['sex'] . '/' . $bot['obraz'] . '" ' . $oi . '></a></div>
|
||||
<div style="position:absolute; width:120px; height:220px; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
|
||||
</div>
|
||||
</td>
|
||||
|
||||
+1508
-1133
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ class DungeonEditor
|
||||
$this->bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "' . $u->info['city'] . '" AND `id` = "' . $this->info['bsid'] . '" AND `time_start` = "' . $this->info['time_start'] . '" LIMIT 1'));
|
||||
//Если БС закончена
|
||||
if (isset($this->bs['id']) && $this->bs['users'] - $this->bs['users_finish'] < 2) {
|
||||
$u->bsfinish($this->bs, false, null);
|
||||
\Location\DeathTower::finish($this->bs, false, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Enum;
|
||||
|
||||
enum ShopId: int
|
||||
{
|
||||
case MAIN = 1;
|
||||
case BEREZKA = 2;
|
||||
case LUKA = 5; // пещера тысячи проклятий
|
||||
case FLOWER = 6;
|
||||
case BOOKS = 7;
|
||||
case ANIMALS = 8; // магазин новичка
|
||||
case TAVERN = 9; // наковальня
|
||||
case IZLOM = 10;
|
||||
case TEMPLE = 14;
|
||||
case MUSHROOMS = 17; // общий рыцарский
|
||||
case REFERALS = 27;
|
||||
case RULF_HRUNT = 33; // бездна
|
||||
case SHOP_KAT = 44; // магазин рульфа хрунта, а ты что такое?
|
||||
case LABORATORY = 45;
|
||||
case NEWBIE = 106; // пещера мглы
|
||||
case KNIGHTS_MAIN = 400; //магазин рефералов
|
||||
case SHOP_PRIZ = 404; // каморка Луки
|
||||
case SHOP_2 = 609; // магазин грибоеда??
|
||||
case ANVIL = 700; // катакомбы
|
||||
case ARTEFACTS = 777; //магазин самоцветов
|
||||
case DUNGEON_BEZDNA = 801; // храм?!
|
||||
case DUNGEON_PTP = 802; // излом?!
|
||||
case DUNGEON_CATACOMBS = 803; //лаборатория?!?!
|
||||
case DUNGEON_MISTY = 804;
|
||||
case CRYSTALS = 1050;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Enum;
|
||||
|
||||
enum StatFilterCellName: string
|
||||
{
|
||||
case Bonus = 'is_bonus';
|
||||
case Requirement = 'is_requirement';
|
||||
case Percentage = 'is_percentage';
|
||||
}
|
||||
+1265
-2840
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace FightRequest;
|
||||
|
||||
class FRHelper
|
||||
{
|
||||
/** Считает разрешенные уровни игроков в групповых заявках.
|
||||
* @param int $type тип фильтра.
|
||||
* @param int $userLevel уровень игрока подающего заявку.
|
||||
* @return object
|
||||
*/
|
||||
public static function getTeammatesLevel(int $type, int $userLevel): object
|
||||
{
|
||||
$min = 0;
|
||||
$max = 21;
|
||||
switch ($type) {
|
||||
default:
|
||||
break;
|
||||
case 1: // только моего и ниже
|
||||
$max = $userLevel;
|
||||
break;
|
||||
case 2: // только ниже моего
|
||||
$max = $userLevel - 1;
|
||||
break;
|
||||
case 3: // только моего
|
||||
$min = $userLevel;
|
||||
$max = $userLevel;
|
||||
break;
|
||||
case 4: // не выше меня на 1 уровень
|
||||
$min = $userLevel;
|
||||
$max = $userLevel + 1;
|
||||
break;
|
||||
case 5: // не ниже меня на 1 уровень
|
||||
$min = $userLevel - 1;
|
||||
$max = $userLevel;
|
||||
break;
|
||||
case 6: // мой уровень +- 1
|
||||
$min = $userLevel - 1;
|
||||
$max = $userLevel + 1;
|
||||
break;
|
||||
}
|
||||
return (object)[
|
||||
'min'=> $min,
|
||||
'max'=> $max,
|
||||
];
|
||||
}
|
||||
|
||||
/** Считает разрешенные уровни игроков в хаотических заявках.
|
||||
* @param int $type тип фильтра.
|
||||
* @param int $userLevel уровень игрока подающего заявку.
|
||||
* @return object
|
||||
*/
|
||||
public static function getChaoticTeammatesLevel(int $type, int $userLevel): object
|
||||
{
|
||||
if (!in_array($type, [3, 6])) {
|
||||
$type = 0;
|
||||
}
|
||||
return self::getTeammatesLevel($type, $userLevel);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-54
@@ -11,15 +11,11 @@ class Filter
|
||||
}
|
||||
//
|
||||
//Смайлики
|
||||
private $sm = ["laugh" => 1, "fingal" => 1, "eek" => 1, "smoke" => 1, "hi" => 1, "bye" => 1, "king" => 1, "king2" => 1, "boks2" => 1, "boks" => 1, "gent" => 1, "lady" => 1, "tongue" => 1, "smil" => 1, "rotate" => 1, "ponder" => 1, "bow" => 1, "angel" => 1, "angel2" => 1, "hello" => 1, "dont" => 1, "idea" => 1, "mol" => 1, "super" => 1, "beer" => 1, "drink" => 1, "baby" => 1, "tongue2" => 1, "sword" => 1, "agree" => 1, "loveya" => 1, "kiss" => 1, "kiss2" => 1, "kiss3" => 1, "kiss4" => 1, "rose" => 1, "love" => 1, "love2" => 1, "confused" => 1, "yes" => 1, "no" => 1, "shuffle" => 1, "nono" => 1, "maniac" => 1, "privet" => 1, "ok" => 1, "ninja" => 1, "pif" => 1, "smash" => 1, "alien" => 1, "pirate" => 1, "gun" => 1, "trup" => 1, "mdr" => 1, "sneeze" => 1, "mad" => 1, "friday" => 1, "cry" => 1, "grust" => 1, "rupor" => 1, "fie" => 1, "nnn" => 1, "row" => 1, "red" => 1, "lick" => 1, "help" => 1, "wink" => 1, "jeer" => 1, "tease" => 1, "nunu" => 1, "inv" => 1, "duel" => 1, "susel" => 1, "nun" => 1, "kruger" => 1, "flowers" => 1, "horse" => 1, "hug" => 1, "str" => 1, "alch" => 1, "pal" => 1, "mag" => 1, "sniper" => 1, "vamp" => 1, "doc" => 1, "doc2" => 1, "sharp" => 1, "naem" => 1, "naem2" => 1, "naem3" => 1, "invis" => 1, "chtoza" => 1, "beggar" => 1, "sorry" => 1, "sorry2" => 1, "creator" => 1, "grace" => 1, "dustman" => 1, "carreat" => 1, "lordhaos" => 1, "ura" => 1, "elix" => 1, "dedmoroz" => 1, "snegur" => 1, "showng" => 1, "superng" => 1, "podz" => 1, "sten" => 1, "devil" => 1, "cat" => 1, "owl" => 1, "lightfly" => 1, "snowfight" => 1, "rocket" => 1, "ball" => 1, "smile" => 1, "fuck" => 1];
|
||||
private array $sm = ["laugh" => 1, "fingal" => 1, "eek" => 1, "smoke" => 1, "hi" => 1, "bye" => 1, "king" => 1, "king2" => 1, "boks2" => 1, "boks" => 1, "gent" => 1, "lady" => 1, "tongue" => 1, "smil" => 1, "rotate" => 1, "ponder" => 1, "bow" => 1, "angel" => 1, "angel2" => 1, "hello" => 1, "dont" => 1, "idea" => 1, "mol" => 1, "super" => 1, "beer" => 1, "drink" => 1, "baby" => 1, "tongue2" => 1, "sword" => 1, "agree" => 1, "loveya" => 1, "kiss" => 1, "kiss2" => 1, "kiss3" => 1, "kiss4" => 1, "rose" => 1, "love" => 1, "love2" => 1, "confused" => 1, "yes" => 1, "no" => 1, "shuffle" => 1, "nono" => 1, "maniac" => 1, "privet" => 1, "ok" => 1, "ninja" => 1, "pif" => 1, "smash" => 1, "alien" => 1, "pirate" => 1, "gun" => 1, "trup" => 1, "mdr" => 1, "sneeze" => 1, "mad" => 1, "friday" => 1, "cry" => 1, "grust" => 1, "rupor" => 1, "fie" => 1, "nnn" => 1, "row" => 1, "red" => 1, "lick" => 1, "help" => 1, "wink" => 1, "jeer" => 1, "tease" => 1, "nunu" => 1, "inv" => 1, "duel" => 1, "susel" => 1, "nun" => 1, "kruger" => 1, "flowers" => 1, "horse" => 1, "hug" => 1, "str" => 1, "alch" => 1, "pal" => 1, "mag" => 1, "sniper" => 1, "vamp" => 1, "doc" => 1, "doc2" => 1, "sharp" => 1, "naem" => 1, "naem2" => 1, "naem3" => 1, "invis" => 1, "chtoza" => 1, "beggar" => 1, "sorry" => 1, "sorry2" => 1, "creator" => 1, "grace" => 1, "dustman" => 1, "carreat" => 1, "lordhaos" => 1, "ura" => 1, "elix" => 1, "dedmoroz" => 1, "snegur" => 1, "showng" => 1, "superng" => 1, "podz" => 1, "sten" => 1, "devil" => 1, "cat" => 1, "owl" => 1, "lightfly" => 1, "snowfight" => 1, "rocket" => 1, "ball" => 1, "smile" => 1, "fuck" => 1];
|
||||
|
||||
public function e($t)
|
||||
{
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("#' . date('d.m.Y') . ' %' . date(
|
||||
'H:i:s'
|
||||
) . ': <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","Игромир","6","1","-1")'
|
||||
);
|
||||
(new Chat())->debug($t, true);
|
||||
}
|
||||
|
||||
public function setOnline($online, $uid)
|
||||
@@ -36,7 +32,7 @@ class Filter
|
||||
|
||||
if ($add > 0) {
|
||||
$on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid` = "' . $uid . '" LIMIT 1'));
|
||||
if (isset($on['id'])) {
|
||||
if (isset($on['uid'])) {
|
||||
$mt = 0;
|
||||
$lst = time();
|
||||
if (date('d', $on['lastUp']) != date('d', $lst)) {
|
||||
@@ -46,13 +42,13 @@ class Filter
|
||||
}
|
||||
$add = $on['time_all'] + $add;
|
||||
mysql_query(
|
||||
'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `id` = "' . $on['id'] . '" LIMIT 1'
|
||||
'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `uid` = "' . $on['uid'] . '" LIMIT 1'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function mystr($string)
|
||||
public function mystr($string): string
|
||||
{
|
||||
$str = strtolower($string);
|
||||
if (strtolower('S') != 's') {
|
||||
@@ -94,57 +90,22 @@ class Filter
|
||||
/* фильтр */
|
||||
$spam = mysql_fetch_array(mysql_query('SELECT * FROM `spam_word` WHERE `id` = 1 LIMIT 1'));
|
||||
$spam = $spam['data'];
|
||||
//
|
||||
$testEN = preg_replace('/[^A-z]*/i', '', $txt);
|
||||
$testEN2 = $txt;
|
||||
|
||||
$testEN2 = str_replace('"', '', $testEN2);
|
||||
$testEN2 = str_replace(' ', '', $testEN2);
|
||||
$testEN2 = str_replace('а', 'a', $testEN2);
|
||||
$testEN2 = str_replace('б', 'b', $testEN2);
|
||||
$testEN2 = str_replace('с', 'c', $testEN2);
|
||||
$testEN2 = str_replace('в', 'b', $testEN2);
|
||||
$testEN2 = str_replace('е', 'e', $testEN2);
|
||||
$testEN2 = str_replace('т', 't', $testEN2);
|
||||
$testEN2 = str_replace('о', 'o', $testEN2);
|
||||
$testEN2 = str_replace('р', 'p', $testEN2);
|
||||
$testEN2 = str_replace('м', 'm', $testEN2);
|
||||
$testEN2 = str_replace('н', 'h', $testEN2);
|
||||
$testEN2 = str_replace('у', 'y', $testEN2);
|
||||
$testEN2 = str_replace('к', 'k', $testEN2);
|
||||
$testEN2 = str_replace('и', 'u', $testEN2);
|
||||
$testEN2 = str_replace('х', 'x', $testEN2);
|
||||
$testEN2 = str_replace('я', '9', $testEN2);
|
||||
$testEN2 = str_replace('()', 'o', $testEN2);
|
||||
$testEN2 = str_replace('0', 'o', $testEN2);
|
||||
$testEN2 = preg_replace('/[^A-z]*/i', '', $testEN2);
|
||||
$testEN = preg_replace('/[^A-z]*/i', '', $txt);
|
||||
$testRU = preg_replace('/[^А-я]*/i', '', $txt);
|
||||
|
||||
$testRU2 = $txt;
|
||||
$testRU2 = str_replace('a', 'а', $testRU2);
|
||||
$testRU2 = str_replace('b', 'б', $testRU2);
|
||||
$testRU2 = str_replace('c', 'с', $testRU2);
|
||||
$testRU2 = str_replace('b', 'в', $testRU2);
|
||||
$testRU2 = str_replace('e', 'е', $testRU2);
|
||||
$testRU2 = str_replace('t', 'т', $testRU2);
|
||||
$testRU2 = str_replace('o', 'о', $testRU2);
|
||||
$testRU2 = str_replace('p', 'р', $testRU2);
|
||||
$testRU2 = str_replace('m', 'м', $testRU2);
|
||||
$testRU2 = str_replace('h', 'н', $testRU2);
|
||||
$testRU2 = str_replace('y', 'у', $testRU2);
|
||||
$testRU2 = str_replace('k', 'к', $testRU2);
|
||||
$testRU2 = str_replace('x', 'х', $testRU2);
|
||||
$testRU2 = str_replace('u', 'и', $testRU2);
|
||||
$testRU2 = str_replace('()', 'о', $testRU2);
|
||||
$testRU2 = str_replace('0', 'о', $testRU2);
|
||||
$testRU2 = preg_replace('/[^А-я]*/i', ' ', $testRU2);
|
||||
$testRU2 = preg_replace('/[^А-Я]*/i', ' ', $testRU2);
|
||||
$i = 0;
|
||||
$spe = explode('|', $spam);
|
||||
while ($i <= count($spe)) {
|
||||
if (isset($spe[$i]) && $spe[$i] != '' && $spe[$i] != 'new-combats.com' && (stristr(
|
||||
$testEN, $spe[$i]
|
||||
) || stristr($testRU, $spe[$i]))) {
|
||||
if (
|
||||
isset($spe[$i]) &&
|
||||
$spe[$i] != '' &&
|
||||
$spe[$i] != 'new-combats.tech' &&
|
||||
(
|
||||
stristr($testEN, $spe[$i]) ||
|
||||
stristr($testRU, $spe[$i])
|
||||
)
|
||||
) {
|
||||
$nospam .= '%' . $spe[$i];
|
||||
}
|
||||
$i++;
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**@deprecated вроде нигде не вызывается, никем не используется */
|
||||
class GameDealer
|
||||
{
|
||||
//Конфигурации
|
||||
private $c = [
|
||||
'db_name' => 'pay_operations', //Таблица в которую заносятся данные
|
||||
'db_host' => 'localhost',
|
||||
'db_user' => 'newcom1_abk',
|
||||
'db_pass' => '4nWYsIM[c?}P',
|
||||
'db_base' => 'newcom1_abk', /* Настройки платежей */
|
||||
'ip_list' => ['127,0,0,1,188.166.34.68,136.243.38.147,136.243.38.149,136.243.38.150,136.243.38.151,136.243.38.189,88.198.88.98'], //Указывать через запятую (Разрешенные IP)
|
||||
'key' => 'qtzl0igb', //gamedealer key
|
||||
'id' => '65643' //ID проекта
|
||||
], $BACK = []; //Результат который возвращаем в конце
|
||||
|
||||
//Кодируем из ЮТФ-8 в Кирилицу
|
||||
/**
|
||||
* @param $text
|
||||
* @return mixed
|
||||
* @deprecated
|
||||
*/
|
||||
public function in($text)
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
//Кодируем из Кирилицу в ЮТФ-8
|
||||
|
||||
/**
|
||||
* @param $text
|
||||
* @return mixed
|
||||
* @deprecated
|
||||
*/
|
||||
public function out($text)
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
//Добавляем данные в базу данных
|
||||
public function add($type, $value, $money)
|
||||
{
|
||||
mysql_query('INSERT INTO `' . $this->c['db_name'] . '` (`time`,`type`,`ip`,`value`,`money`,`project`) VALUES ("' . time() . '","' . mysql_real_escape_string($type) . '","' . $_SERVER['HTTP_X_REAL_IP'] . '","' . mysql_real_escape_string($value) . '","' . mysql_real_escape_string($money) . '","' . mysql_real_escape_string($this->id) . '")');
|
||||
}
|
||||
|
||||
//Подключаемся к базе данных
|
||||
public function connect_db()
|
||||
{
|
||||
$db = mysql_connect($this->c['db_host'], $this->c['db_user'], $this->c['db_pass']) or die('Ошибка подключения к MySQL серверу!');
|
||||
mysql_select_db($this->c['db_base'], $db) or die('Ошибка подключения к базе данных!');
|
||||
mysql_query('SET NAMES utf8mb4');
|
||||
}
|
||||
|
||||
public function output($a, $v = null)
|
||||
{
|
||||
$r = '';
|
||||
$i = 0;
|
||||
while ($i < count($a)) {
|
||||
$rn = '';
|
||||
$tb = '';
|
||||
if ($v != null) {
|
||||
$rn = "\r\n";
|
||||
$tb = " ";
|
||||
}
|
||||
$r .= $rn . '<' . $a[$i][0] . '>';
|
||||
if (!is_array($a[$i][1])) {
|
||||
$rn = '';
|
||||
$tb = '';
|
||||
$r .= $rn . $tb . ($this->out($a[$i][1]));
|
||||
} else {
|
||||
if ($i > 0) {
|
||||
$r .= $rn;
|
||||
}
|
||||
$r .= $tb . ($this->output($a[$i][1], 1));
|
||||
}
|
||||
$r .= $rn . '</' . $a[$i][0] . '>';
|
||||
$i++;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//Генерируем XML-файл
|
||||
public function backInformation()
|
||||
{
|
||||
header('Content-Type: text/html/force-download');
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
echo $this->output($this->BACK, 1);
|
||||
}
|
||||
|
||||
//Проверка существования персонажа
|
||||
public function test_accaunt($nick)
|
||||
{
|
||||
$r = false;
|
||||
$nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `id` = "' . mysql_real_escape_string($nick) . '" LIMIT 1'));
|
||||
if (isset($nick['id'])) {
|
||||
$r = true;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//Получает счет в банке по логину
|
||||
public function getBank($nick)
|
||||
{
|
||||
$nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "' . mysql_real_escape_string($nick) . '" LIMIT 1'));
|
||||
$nick = mysql_fetch_array(mysql_query('SELECT `id` FROM `bank` WHERE `uid` = "' . mysql_real_escape_string($nick['id']) . '" LIMIT 1'));
|
||||
return $nick['id'];
|
||||
}
|
||||
|
||||
//Поиск логина
|
||||
public function bank_user($nick)
|
||||
{
|
||||
$nick = mysql_fetch_array(mysql_query('SELECT `id`,`uid FROM `bank` WHERE `id` = "' . mysql_real_escape_string($nick) . '" LIMIT 1'));
|
||||
$nick = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `login` = "' . mysql_real_escape_string($nick['uid']) . '" LIMIT 1'));
|
||||
return $nick['login'];
|
||||
}
|
||||
|
||||
//Начинаем обработку запросов
|
||||
public function start_session()
|
||||
{
|
||||
|
||||
$ip = '';
|
||||
$ip = $_SERVER['HTTP_X_REAL_IP'];
|
||||
|
||||
//Подключаемся к БД
|
||||
$this->connect_db();
|
||||
|
||||
//Получаем данные запроса
|
||||
//$xml = file_get_contents('php://input');
|
||||
|
||||
//Парсинг XML запроса
|
||||
if (function_exists('simplexml_load_string')) {
|
||||
$xml = simplexml_load_string($xml);
|
||||
} else {
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Не удалось произвести обработку запроса']]]];
|
||||
die($this->backInformation());
|
||||
}
|
||||
|
||||
$this->id = $xml->projectid;
|
||||
|
||||
if (!in_array($ip, $this->c['ip_list'])) {
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Нет доступа с данного IP']]]];
|
||||
die($this->backInformation());
|
||||
}
|
||||
|
||||
//Обработка запросов
|
||||
if ($xml->method == 'check_balance') {
|
||||
//<sign>MD5(method+MD5(gdKey))</sign>
|
||||
|
||||
$sign = md5($xml->method . md5($this->c['key']));
|
||||
|
||||
if ($sign == $xml->sign) {
|
||||
//Баланс дилера
|
||||
$balance = 1000000;
|
||||
$this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Баланс дилера: ' . $balance], ['balance', $balance]]]];
|
||||
$this->add('4', 'check:' . $xml->nick . ':1' . $r, 0);
|
||||
}
|
||||
|
||||
} elseif ($xml->method == 'check') {
|
||||
/*
|
||||
nick - логин персонажа <sign>MD5(nick+method+MD5(gdKey))</sign> */
|
||||
|
||||
$sign = md5($xml->nick . $xml->method . md5($this->c['key']));
|
||||
|
||||
if ($sign == $xml->sign) {
|
||||
$xml->nick = $this->in($xml->nick);
|
||||
if ($this->test_accaunt($xml->nick) == true) {
|
||||
//Персонаж найден и зачисляем ему игровую валюту
|
||||
$this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Банковский счет найден']]]];
|
||||
$this->add('3', 'check:' . $xml->nick . ':1' . $r, 0);
|
||||
} else {
|
||||
//Персонаж не найден
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Платеж не обработан. Банковский счет не найден.']]]];
|
||||
$this->add('-1', 'Персонаж не найден:pay:' . $xml->nick . ':0', 0);
|
||||
}
|
||||
}
|
||||
} elseif ($xml->method == 'pay') {
|
||||
/* Проводим платеж
|
||||
nick - логин аккаунта , projectid - id проекта , sign , amount - деньги , payid - id платежа */
|
||||
|
||||
$sign = md5($xml->nick . $xml->projectid . $xml->amount . $xml->payid . $xml->method . md5($this->c['key']));
|
||||
|
||||
if ($sign == $xml->sign) {
|
||||
$xml->nick = $this->in($xml->nick);
|
||||
if ($this->test_accaunt($xml->nick)) {
|
||||
//Персонаж найден и зачисляем ему игровую валюту
|
||||
$bank = $this->test_accaunt($xml->nick);
|
||||
if ($bank > 0) {
|
||||
mysql_query('UPDATE `bank` SET `money2` = `money2` + ' . mysql_real_escape_string($xml->amount) . ' WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1');
|
||||
$this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Платеж прошел успешно'], ['id', $this->c['id']]]]];
|
||||
$this->add('2', 'pay:' . $xml->nick . ':' . $xml->projectid . ':' . $xml->sign . ':' . $xml->amount . ':' . $xml->payid . ':' . $bank['id'], $xml->amount);
|
||||
|
||||
$user = mysql_fetch_array(mysql_query('SELECT `id`,`uid` FROM `bank` WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1'));
|
||||
$user = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`city`,`sex`,`room` FROM `users` WHERE `id` = "' . mysql_real_escape_string($user['uid']) . '" LIMIT 1'));
|
||||
|
||||
mysql_query('UPDATE `users` SET `catch` = `catch` + ' . mysql_real_escape_string(floor($xml->amount)) . ' WHERE `id` = "' . mysql_real_escape_string($xml->nick) . '" LIMIT 1');
|
||||
|
||||
$r = '<span class=date>' . date('d.m.Y H:i') . '</span> Алхимик <img src=https://img.new-combats.com/i/align/align50.gif width=12 height=15 /><u><b>Enchanter</b> / Автоматическая оплата</u> сообщает: ';
|
||||
|
||||
if ($user['sex'] == 1) {
|
||||
$r .= 'Уважаемая';
|
||||
} else {
|
||||
$r .= 'Уважаемый';
|
||||
}
|
||||
|
||||
$r .= ' <b>' . $user['login'] . '</b>, на Ваш банковский счет №' . $bank . ' зачислено ' . $xml->amount . ' Ekr. Благодарим Вас за покупку!';
|
||||
|
||||
mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $user['city'] . "','" . $user['room'] . "','','" . $user['login'] . "','" . $r . "','-1','5','0')");
|
||||
|
||||
} else {
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'У пользователя отсутствует банк'], ['id', $this->c['id']]]]];
|
||||
$this->add('-1', 'У персонажа отсутствует банк:pay:' . $xml->nick . ':' . $xml->projectid . ':' . $xml->sign . ':' . $xml->amount . ':' . $xml->payid . ':' . $bank['id'], $xml->amount);
|
||||
}
|
||||
} else {
|
||||
//Персонаж не найден
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Платеж не обработан. Персонаж не найден.']]]];
|
||||
$this->add('-1', 'Персонаж не найден:pay:' . $xml->nick . ':0', 0);
|
||||
}
|
||||
} else {
|
||||
//Ошибка сигнатуры
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Ошибка сигнатуры']]]];
|
||||
$this->add('-1', 'Ошибка сигнатуры:pay:' . $xml->nick . ':0', 0);
|
||||
}
|
||||
} elseif ($xml->method == 'check_login') {
|
||||
/* Проверка аккаунта
|
||||
nick - логин аккаунта , projectid - id проекта , sign */
|
||||
$sign = md5($xml->nick . $xml->method . md5($this->c['key']));
|
||||
|
||||
if ($sign == $xml->sign) {
|
||||
$xml->nick = $this->in($xml->nick);
|
||||
if ($this->test_accaunt($xml->nick)) {
|
||||
//Персонаж найден
|
||||
$this->BACK = [['gdanswer', [['status', '1'], ['desc', 'Счет найден'], ['addinfo', $this->bank_user($xml->nick)]]]];
|
||||
$this->add('1', 'check_login:' . $xml->nick . ':1' . $r, 0);
|
||||
} else {
|
||||
//Персонаж не найден
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Счет не найден']]]];
|
||||
$this->add('-1', 'Персонаж не найден:check_login:' . $xml->nick . ':0', 0);
|
||||
}
|
||||
} else {
|
||||
//Ошибка сигнатуры
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Ошибка сигнатуры']]]];
|
||||
$this->add('-1', 'Ошибка сигнатуры:pay:' . $xml->nick . ':0', 0);
|
||||
}
|
||||
} else {
|
||||
$this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'Неизвестный тип запроса']]]];
|
||||
$this->add('-1', 'Неизвестный тип запроса:error_method:gamedealer', 0);
|
||||
}
|
||||
|
||||
//Возвращаем результат
|
||||
$this->backInformation();
|
||||
}
|
||||
}
|
||||
|
||||
$pay = new GameDealer;
|
||||
$pay->start_session();
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
class ArraySorter
|
||||
{
|
||||
/**
|
||||
* Groups an array by a given key.
|
||||
*
|
||||
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
|
||||
*
|
||||
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
|
||||
* This variant allows $key to be closures.
|
||||
*
|
||||
* @param array $array The array to have grouping performed on.
|
||||
* @param mixed $key,... The key to group or split by. Can be a _string_,
|
||||
* an _integer_, a _float_, or a _callable_.
|
||||
*
|
||||
* If the key is a callback, it must return
|
||||
* a valid key from the array.
|
||||
*
|
||||
* If the key is _NULL_, the iterated element is skipped.
|
||||
*
|
||||
* ```
|
||||
* string|int callback ( mixed $item )
|
||||
* ```
|
||||
*
|
||||
* @return array|null Returns a multidimensional array or `null` if `$key` is invalid.
|
||||
*/
|
||||
public static function groupBy(array $array, $key): ?array
|
||||
{
|
||||
if (!is_string($key) && !is_int($key) && !is_float($key) && !is_callable($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$func = (!is_string($key) && is_callable($key) ? $key : null);
|
||||
$key2 = $key;
|
||||
|
||||
// Load the new array, splitting by the target key
|
||||
$grouped = [];
|
||||
foreach ($array as $value) {
|
||||
$key = null;
|
||||
|
||||
if (is_callable($func)) {
|
||||
$key = call_user_func($func, $value);
|
||||
} elseif (is_object($value) && property_exists($value, $key2)) {
|
||||
$key = $value->{$key2};
|
||||
} elseif (isset($value[$key2])) {
|
||||
$key = $value[$key2];
|
||||
}
|
||||
|
||||
if ($key === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$grouped[$key][] = $value;
|
||||
}
|
||||
|
||||
// Recursively build a nested grouping if more parameters are supplied
|
||||
// Each grouped array value is grouped according to the next sequential key
|
||||
if (func_num_args() > 2) {
|
||||
$args = func_get_args();
|
||||
|
||||
foreach ($grouped as $key => $value) {
|
||||
$params = array_merge([$value], array_slice($args, 2, func_num_args()));
|
||||
$grouped[$key] = call_user_func_array('array_group_by', $params);
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
class Comparsion
|
||||
{
|
||||
/** Не даёт значению выйти за пределы.
|
||||
* @param $value
|
||||
* @param $minimum
|
||||
* @param $maximum
|
||||
* @return mixed
|
||||
*/
|
||||
public static function minimax($value, $minimum, $maximum): mixed
|
||||
{
|
||||
if ($value < $minimum) {
|
||||
$value = $minimum;
|
||||
}
|
||||
if ($value > $maximum) {
|
||||
$value = $maximum;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class Conversion
|
||||
{
|
||||
/** Превращает строку data ('a=1|b=2|c=3') из БД в массив [a=>1, b=>2, c=>3].
|
||||
* @param string|null $dataString
|
||||
* @return array
|
||||
*/
|
||||
public static function dataStringToArray(?string $dataString): array
|
||||
{
|
||||
if (empty($dataString)) {
|
||||
return [];
|
||||
}
|
||||
$dataString = str_replace('||', '|', $dataString); // любители забивать руками параметры и задваивать разделители.
|
||||
|
||||
if (mb_substr($dataString, -1) === '|') {
|
||||
$dataString = rtrim($dataString, '|');
|
||||
}
|
||||
$arr = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $dataString . '}'), true);
|
||||
return $arr ?: [];
|
||||
}
|
||||
|
||||
/** Превращает массив [a=>1, b=>2, c=>3] в строку data ('a=1|b=2|c=3') для БД.
|
||||
* @param array $dataArray
|
||||
* @return string
|
||||
*/
|
||||
public static function arrayToDataString(array $dataArray): string
|
||||
{
|
||||
$str = json_encode($dataArray);
|
||||
return $str ? str_replace(['":', ',"', '{"', '}'], ['=', '|'], $str) : '';
|
||||
}
|
||||
|
||||
/** Превращает количество секунд в человекопонятное Х мес. Х дн. Х ч. Х мин. Х сек.,
|
||||
* используемое обычно для отображения игровых таймаутов.
|
||||
* @param int|string $seconds
|
||||
* @return string
|
||||
*/
|
||||
public static function secondsToTimeout(int|string $seconds): string
|
||||
{
|
||||
$seconds = (int)$seconds;
|
||||
$time = new DateTime();
|
||||
$time->setTimestamp($seconds);
|
||||
$sec = intval($time->format('s'));
|
||||
$min = intval($time->format('i'));
|
||||
$hr = intval($time->format('G'));
|
||||
$day = intval($time->format('j'));
|
||||
$month = intval($time->format('n'));
|
||||
$timeout = '';
|
||||
if ($month > 1) {
|
||||
$timeout .= $month . ' мес. ';
|
||||
}
|
||||
if ($day > 1) {
|
||||
$timeout .= $day . ' дн. ';
|
||||
}
|
||||
if ($hr) {
|
||||
$timeout .= $hr . ' ч. ';
|
||||
}
|
||||
if ($sec && !$min) {
|
||||
$timeout .= $sec . ' сек. ';
|
||||
} elseif ($min) {
|
||||
$timeout .= $min . ' мин. ';
|
||||
}
|
||||
return $timeout;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
|
||||
class Mail
|
||||
{
|
||||
public static function send($to, $message, $subject = 'Бойцовский клуб'): int
|
||||
{
|
||||
$mail = new PHPMailer;
|
||||
try {
|
||||
$mail->IsSMTP();
|
||||
$mail->Host = 'smtp.mail.yahoo.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'newcombats@yahoo.com';
|
||||
$mail->Password = 'uqcdbnsoagxcyysh';
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||
$mail->Port = 587;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
|
||||
$mail->setFrom('newcombats@yahoo.com', 'Бойцовский Клуб');
|
||||
$mail->addAddress($to); // Add a recipient
|
||||
|
||||
$mail->IsHTML();
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = '<div>' . $message . '</div>';
|
||||
$mail->AltBody = $message;
|
||||
$mail->send();
|
||||
return 1;
|
||||
} catch (Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
/** All raw mathematics in one place. */
|
||||
class Math
|
||||
{
|
||||
/**
|
||||
* @param float|int $total
|
||||
* @param int|null $number
|
||||
* @return float
|
||||
*/
|
||||
public static function getPercentage($total, ?int $number): float
|
||||
{
|
||||
if (is_null($number)) {
|
||||
return 0;
|
||||
}
|
||||
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
|
||||
}
|
||||
|
||||
|
||||
public static function get100Percentage($total, ?int $number)
|
||||
{
|
||||
if (is_null($number)) {
|
||||
return 0;
|
||||
}
|
||||
return min(self::getPercentage($total, $number), 100);
|
||||
}
|
||||
|
||||
/** Number-20% and Number+20% */
|
||||
public static function get20PercentRange($number): array
|
||||
{
|
||||
return [
|
||||
'min' => $number * ((100 - 20) / 100),
|
||||
'max' => $number * ((100 + 20) / 100),
|
||||
];
|
||||
}
|
||||
|
||||
public static function addPercent($num, $percent)
|
||||
{
|
||||
return $num + (($percent / 100) * $num);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
class Table
|
||||
{
|
||||
public static function get($rows, $class = '', $fill = false): string
|
||||
{
|
||||
$c = '';
|
||||
$maxRows = sizeof(max($rows));
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($fill && sizeof($row) < $maxRows) {
|
||||
$row = array_merge($row, array_fill(0, $maxRows - sizeof($row), ''));
|
||||
}
|
||||
$c .= '<tr><td>' . implode('</td><td>', $row) . '</td></tr>';
|
||||
}
|
||||
|
||||
return (!empty($class) ? "<table class='$class'>" : '<table>') . $c . '</table>' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Images
|
||||
{
|
||||
public static function getSrc(int $id): string
|
||||
{
|
||||
$i = Db::getRow('select mime_type, img from images where id = ?', [$id]);
|
||||
return 'data:' . $i['mime_type'] . ';base64,' . base64_encode($i['img']);
|
||||
}
|
||||
|
||||
public static function getSrcByName(string $name): string
|
||||
{
|
||||
$i = Db::getRow('select mime_type, img from images where id = (select logo from clan where name = ?)', [$name]);
|
||||
return 'data:' . $i['mime_type'] . ';base64,' . base64_encode($i['img']);
|
||||
}
|
||||
|
||||
public static function getJson(int $id)
|
||||
{
|
||||
$stmt = Db::getRow('select mime_type, img from images where id = ?', [$id]);
|
||||
if (!$stmt) {
|
||||
$stmt = [];
|
||||
}
|
||||
return json_encode($stmt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace Inf;
|
||||
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
|
||||
class Awards
|
||||
{
|
||||
private const KNIGHT = [
|
||||
1 => 'Рыцарь первого круга',
|
||||
2 => 'Рыцарь второго круга',
|
||||
3 => 'Рыцарь третьего круга',
|
||||
];
|
||||
private const SCHOLAR = [
|
||||
1 => 'Посвящённый первого круга',
|
||||
2 => 'Посвящённый второго круга',
|
||||
3 => 'Посвящённый третьего круга',
|
||||
];
|
||||
private const IZLOM = [
|
||||
1 => 'Аттестованный боец',
|
||||
2 => 'Опытный боец',
|
||||
3 => 'Ветеран',
|
||||
4 => 'Генерал',
|
||||
];
|
||||
private const DUNGEON_NAME = [
|
||||
'repdreamscity' => 'Водосток',
|
||||
'repizlom' => 'Излом Хаоса',
|
||||
'rep1' => 'Храм Знаний',
|
||||
];
|
||||
private array $awards = [];
|
||||
|
||||
public function __construct(int $userid)
|
||||
{
|
||||
$reputations = Db::getRow('select * from rep where id = ?', [$userid]) ?: [];
|
||||
$customAwards = Db::getRows('select text, img from users_ico where uid = ? and (endTime = 0 or endTime > unix_timestamp())', [$userid]);
|
||||
|
||||
foreach ($customAwards as $award) {
|
||||
$this->awards[] = ['', $award['text'], $award['img']];
|
||||
}
|
||||
|
||||
if (!empty($reputations)) {
|
||||
$this->addDungeonAwards($reputations);
|
||||
}
|
||||
}
|
||||
|
||||
private function addDungeonAwards(mixed $reputations): void
|
||||
{
|
||||
match (true) {
|
||||
$reputations['repdreamscity'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[3], 'i/ico/ric_kanal3.gif'],
|
||||
$reputations['repdreamscity'] > 4999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[2], 'i/ico/ric_kanal2.gif'],
|
||||
$reputations['repdreamscity'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[1], 'i/ico/ric_kanal1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['rep1'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[3], 'znrune_3.gif'],
|
||||
$reputations['rep1'] > 999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[2], 'znrune_2.gif'],
|
||||
$reputations['rep1'] > 99 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[1], 'znrune_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repizlom'] > 24999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[4], 'iz_zn_ver10_4.gif'],
|
||||
$reputations['repizlom'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[3], 'iz_zn_ver10_3.gif'],
|
||||
$reputations['repizlom'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[2], 'iz_zn_ver10_2.gif'],
|
||||
$reputations['repizlom'] > 99 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[1], 'iz_zn_ver10_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repcapitalcity'] > 24999 => $this->awards[] = ['Capital city', self::KNIGHT[2], 'zn1_2.gif'],
|
||||
$reputations['repcapitalcity'] > 9999 => $this->awards[] = ['Capital city', self::KNIGHT[1], 'zn1_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repangelscity'] > 24999 => $this->awards[] = ['Angels city', self::KNIGHT[2], 'zn2_2.gif'],
|
||||
$reputations['repangelscity'] > 9999 => $this->awards[] = ['Angels city', self::KNIGHT[1], 'zn2_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repdemonscity'] > 24999 => $this->awards[] = ['Demons city', self::KNIGHT[2], 'zn3_2.gif'],
|
||||
$reputations['repdemonscity'] > 9999 => $this->awards[] = ['Demons city', self::KNIGHT[1], 'zn3_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repdevilscity'] > 24999 => $this->awards[] = ['Devils city', self::KNIGHT[2], 'zn4_2.gif'],
|
||||
$reputations['repdevilscity'] > 9999 => $this->awards[] = ['Devils city', self::KNIGHT[1], 'zn4_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repsuncity'] > 24999 => $this->awards[] = ['Sun city', self::KNIGHT[2], 'zn5_2.gif'],
|
||||
$reputations['repsuncity'] > 9999 => $this->awards[] = ['Sun city', self::KNIGHT[1], 'zn5_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repsandcity'] > 24999 => $this->awards[] = ['Sand city', self::KNIGHT[2], 'zn7_2.gif'],
|
||||
$reputations['repsandcity'] > 9999 => $this->awards[] = ['Sand city', self::KNIGHT[1], 'zn7_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repemeraldscity'] > 24999 => $this->awards[] = ['Emeralds city', self::KNIGHT[2], 'zn6_2.gif'],
|
||||
$reputations['repemeraldscity'] > 9999 => $this->awards[] = ['Emeralds city', self::KNIGHT[1], 'zn6_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repmooncity'] > 24999 => $this->awards[] = ['Moon city', self::KNIGHT[2], 'zn9_2.gif'],
|
||||
$reputations['repmooncity'] > 9999 => $this->awards[] = ['Moon city', self::KNIGHT[1], 'zn9_1.gif'],
|
||||
default => '',
|
||||
};
|
||||
|
||||
match (true) {
|
||||
$reputations['repabandonedplain'] > 9999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[2], '1_gora.gif'],
|
||||
$reputations['repabandonedplain'] > 999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[1], '2_gora.gif'],
|
||||
default => '',
|
||||
};
|
||||
}
|
||||
|
||||
public function addCustom(string $name, string $description, string $image): void
|
||||
{
|
||||
$this->awards[] = [$name, $description, $image];
|
||||
}
|
||||
|
||||
public function print(): void
|
||||
{
|
||||
foreach ($this->awards as $award) {
|
||||
$img = Config::img() . DIRECTORY_SEPARATOR . $award[2];
|
||||
if (!empty($award[0])) {
|
||||
$award[1] = "<b>$award[0]</b><br>$award[1]";
|
||||
}
|
||||
echo <<<HTML
|
||||
<img src="$img" alt="" onmouseover="top.hi(this,'$award[1]',event,0,0,1,0);" onmouseout="top.hic();" onmousedown="top.hic();" style="cursor: pointer;">
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Inf;
|
||||
|
||||
use Core\Db;
|
||||
use DateTimeImmutable;
|
||||
|
||||
class LastNames
|
||||
{
|
||||
private array $lastnames = [];
|
||||
|
||||
/** История имён
|
||||
* @param int $userid
|
||||
*/
|
||||
public function __construct(int $userid)
|
||||
{
|
||||
$names = Db::getRows('select * from lastnames where uid = ? order by time desc', [$userid]);
|
||||
$dt = new DateTimeImmutable();
|
||||
|
||||
foreach ($names as $name) {
|
||||
$dt->setTimestamp($name['time']);
|
||||
$this->lastnames[] = "«{$name['login']}» до " . $dt->format('d.m.Y H:i');
|
||||
}
|
||||
}
|
||||
|
||||
public function print(): void
|
||||
{
|
||||
echo $this->get();
|
||||
}
|
||||
|
||||
private function get(): string
|
||||
{
|
||||
if (empty($this->lastnames)) {
|
||||
return '';
|
||||
}
|
||||
return 'История имен:<br>' . implode('<br>', $this->lastnames);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Inf;
|
||||
|
||||
use Core\Config;
|
||||
use Helper\Conversion;
|
||||
|
||||
class Status
|
||||
{
|
||||
private array $statuses;
|
||||
|
||||
public function add(bool $condition, string $text, int|string|null $timeout = 0, ?string $img = ''): void
|
||||
{
|
||||
if (!$condition) {
|
||||
return;
|
||||
}
|
||||
if (!empty($timeout)) {
|
||||
$text .= ' ещё ' . Conversion::secondsToTimeout($timeout - time());
|
||||
}
|
||||
|
||||
$text = "<span style='vertical-align:middle;'>$text</span>";
|
||||
|
||||
if (!empty($img)) {
|
||||
$text = '<span><img src="' . Config::img() . DIRECTORY_SEPARATOR . $img . '" alt="' . $text . '" style="vertical-align:middle;"></span> ' . $text;
|
||||
}
|
||||
|
||||
$this->statuses[] = "<div>$text</div>"; // обёртка для центрирования картинки с текстом
|
||||
}
|
||||
|
||||
public function print(): void
|
||||
{
|
||||
if (empty($this->statuses)) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<br><div style="font-size: smaller;">' . implode('<br>', $this->statuses) . '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Inf;
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Twinks
|
||||
{
|
||||
private array $twinks = [];
|
||||
|
||||
/** Мульты персонажа
|
||||
* @param int $userid
|
||||
* @param int $twinkid
|
||||
*/
|
||||
public function __construct(int $userid, int $twinkid)
|
||||
{
|
||||
$twinks = Db::getRows('select login, level, twink from users_twink where uid = ? and twink != 0', [$userid]);
|
||||
foreach ($twinks as $twink) {
|
||||
$str = $twink['login'] . ' [' . $twink['level'] . ']';
|
||||
if ($twinkid === $twink['twink']) {
|
||||
$str = '<b style="color:#ff9900;">' . $str . '</b>';
|
||||
}
|
||||
$this->twinks[] = $str;
|
||||
}
|
||||
}
|
||||
|
||||
public function print(): void
|
||||
{
|
||||
echo $this->get();
|
||||
}
|
||||
|
||||
private function get(): string
|
||||
{
|
||||
if (empty($this->twinks)) {
|
||||
return '';
|
||||
}
|
||||
return 'Другие образы: ' . implode(', ', $this->twinks) . '<br>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Inf;
|
||||
|
||||
use Core\Config;
|
||||
|
||||
class Zodiac
|
||||
{
|
||||
private const ZODIAC = [
|
||||
1 => 'Овен',
|
||||
2 => 'Телец',
|
||||
3 => 'Близнецы',
|
||||
4 => 'Рак',
|
||||
5 => 'Лев',
|
||||
6 => 'Дева',
|
||||
7 => 'Весы',
|
||||
8 => 'Скорпион',
|
||||
9 => 'Стрелец',
|
||||
10 => 'Козерог',
|
||||
11 => 'Водолей',
|
||||
12 => 'Рыбы',
|
||||
];
|
||||
private int $day = 0;
|
||||
private int $month = 0;
|
||||
|
||||
public function __construct(string $date)
|
||||
{
|
||||
[$d, $m, $y] = explode('.', $date);
|
||||
if (!checkdate($d, $m, $y)) {
|
||||
return;
|
||||
}
|
||||
$this->day = (int)$d;
|
||||
$this->month = (int)$m;
|
||||
}
|
||||
|
||||
public function getImageLink(): string
|
||||
{
|
||||
if (empty($this->getName())) {
|
||||
return '#';
|
||||
}
|
||||
$id = array_flip(self::ZODIAC);
|
||||
return Config::img() . '/i/zodiac/' . $id[$this->getName()] . '.gif';
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
if (empty($this->day) || empty($this->month)) {
|
||||
return '';
|
||||
}
|
||||
$z = [
|
||||
1 => self::ZODIAC[10],
|
||||
self::ZODIAC[11],
|
||||
self::ZODIAC[12],
|
||||
self::ZODIAC[1],
|
||||
self::ZODIAC[2],
|
||||
self::ZODIAC[3],
|
||||
self::ZODIAC[4],
|
||||
self::ZODIAC[5],
|
||||
self::ZODIAC[6],
|
||||
self::ZODIAC[7],
|
||||
self::ZODIAC[8],
|
||||
self::ZODIAC[9],
|
||||
self::ZODIAC[10],
|
||||
];
|
||||
$lastDay = [1 => 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19];
|
||||
return $this->day > $lastDay[$this->month] ? $z[$this->month + 1] : $z[$this->month];
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
//use Insallah\Tournament;
|
||||
|
||||
//require_once 'Core/Db.php';
|
||||
require_once 'Core/Math.php';
|
||||
require_once 'Core/Table.php';
|
||||
require_once 'Runes/Runes.php';
|
||||
//require_once 'Tournament/Tournament.php';
|
||||
//require_once 'Tournament/TournamentModel.php';
|
||||
require_once 'Achievements.php';
|
||||
|
||||
//Вместо крона для турнира.
|
||||
//if (Tournament::IS_ENABLED) {
|
||||
// (new Tournament())->startAllBattles();
|
||||
//}
|
||||
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
//use Core\Database;
|
||||
use Exception;
|
||||
//use http\Message;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use PDOStatement;
|
||||
|
||||
class DbOld
|
||||
{
|
||||
/**
|
||||
* Настройки подключения
|
||||
* Лучше выносить в конфиг
|
||||
* self::DB_HOST -> Config::DB_HOST
|
||||
*/
|
||||
const DB_HOST = '127.0.0.1'; // localhost
|
||||
const DB_USER = 'newcom1_abk';
|
||||
const DB_PASSWORD = '4nWYsIM[c?}P';
|
||||
const DB_NAME = 'newcom1_abk';
|
||||
const CHARSET = 'utf8mb4';
|
||||
const DB_PREFIX = '';
|
||||
|
||||
/**
|
||||
* @var PDO
|
||||
*/
|
||||
static private $db;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* DB constructor.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
try {
|
||||
self::$db = new PDO(
|
||||
'mysql:host=' . self::DB_HOST . ';dbname=' . self::DB_PREFIX . self::DB_NAME,
|
||||
self::DB_USER,
|
||||
self::DB_PASSWORD,
|
||||
[
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES " . self::CHARSET,
|
||||
]
|
||||
);
|
||||
// self::$db = Database::pdoinit();
|
||||
} catch (PDOException $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $stmt
|
||||
* @return PDOStatement
|
||||
*/
|
||||
public static function query($stmt)
|
||||
{
|
||||
return self::$db->query($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $stmt
|
||||
* @return PDOStatement
|
||||
*/
|
||||
public static function prepare($stmt)
|
||||
{
|
||||
return self::$db->prepare($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @return int
|
||||
*/
|
||||
static public function exec($query)
|
||||
{
|
||||
return self::$db->exec($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
static public function lastInsertId()
|
||||
{
|
||||
return self::$db->lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param array $args
|
||||
* @return PDOStatement
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function run($query, $args = [])
|
||||
{
|
||||
try {
|
||||
if (!$args) {
|
||||
return self::query($query);
|
||||
}
|
||||
$stmt = self::prepare($query);
|
||||
$stmt->execute($args);
|
||||
return $stmt;
|
||||
} catch (PDOException $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getRow($query, $args = [])
|
||||
{
|
||||
return self::run($query, $args)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public static function getRows($query, $args = [])
|
||||
{
|
||||
return self::run($query, $args)->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getValue($query, $args = [])
|
||||
{
|
||||
$result = self::getRow($query, $args);
|
||||
if (!empty($result)) {
|
||||
$result = array_shift($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public static function getColumn($query, $args = [])
|
||||
{
|
||||
return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
|
||||
public static function sql($query, $args = [])
|
||||
{
|
||||
self::run($query, $args);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user