Mass update
This commit is contained in:
+3167
-3770
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
* 11. ???
|
||||
*/
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Db;
|
||||
|
||||
class Chat
|
||||
{
|
||||
|
||||
@@ -4,13 +4,27 @@ namespace Core;
|
||||
|
||||
class Config
|
||||
{
|
||||
private static self $instance;
|
||||
private function __construct()
|
||||
{
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
||||
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('default_charset', 'windows-1251');
|
||||
ini_set('date.timezone', 'Europe/Moscow');
|
||||
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
}
|
||||
|
||||
public static function get(?string $key = null)
|
||||
{
|
||||
$c['ver'] = '1.8.3.7';
|
||||
/* Конфигурации игры */
|
||||
$c['name'] = 'Бойцовский Клуб';
|
||||
$c['title'] = '«' . $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
|
||||
@@ -23,7 +37,8 @@ class Config
|
||||
$c['thiscity'] = 'capitalcity';
|
||||
$c['capitalcity'] = $c['host'];
|
||||
$c['abandonedplain'] = $c['host'];
|
||||
$c['exit'] = '<script>top.location="https://' . $c['host'] . '/";</script>';
|
||||
$c['https'] = 'https://' . $c['host'] . DIRECTORY_SEPARATOR;
|
||||
$c['exit'] = '<script>top.location="' . $c['https'] . '";</script>';
|
||||
|
||||
//Валюта
|
||||
$c['curency_name'] = 'RUB';
|
||||
@@ -68,20 +83,17 @@ class Config
|
||||
$c['securetime'] = 0; //Время последнего возможного взлома персов (подбор пароля по базам данных других игр)
|
||||
|
||||
$c['copyright'] = 'Copyright © ' . date('Y') . ' « Новый Бойцовский Клуб »';
|
||||
$c['db_user'] = 'newcom1_abk';
|
||||
$c['db_name'] = 'newcom1_abk';
|
||||
$c['db_password'] = '4nWYsIM[c?}P';
|
||||
return $c[$key] ?? $c;
|
||||
}
|
||||
|
||||
public static function init(): void
|
||||
public static function init(): Config
|
||||
{
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
||||
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('default_charset', 'windows-1251');
|
||||
ini_set('date.timezone', 'Europe/Moscow');
|
||||
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
if (!isset(self::$instance)) {
|
||||
self::$instance = new static();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,44 @@
|
||||
<?php
|
||||
|
||||
# Let's hope it will work.
|
||||
|
||||
namespace Core;
|
||||
|
||||
use PDO;
|
||||
|
||||
class Database
|
||||
{
|
||||
private const DB = 'newcom1_abk';
|
||||
private const USER = 'newcom1_abk';
|
||||
private const PASSWORD = '4nWYsIM[c?}P';
|
||||
private const DSN = 'mysql:host=localhost;dbname=' . self::DB;
|
||||
private static self $instance;
|
||||
protected static PDO $db;
|
||||
|
||||
//todo: remove PDO from files and connect through new pdoinit().
|
||||
public static function init(): PDO
|
||||
{
|
||||
|
||||
mysql_select_db(self::DB, mysql_connect('localhost', self::USER, self::PASSWORD));
|
||||
/**
|
||||
* Singleton.
|
||||
*/
|
||||
private function __construct() {
|
||||
mysql_select_db(Config::get('db_name'), mysql_connect('localhost', Config::get('db_user'), Config::get('db_password')));
|
||||
mysql_query('SET NAMES cp1251');
|
||||
|
||||
return self::pdoinit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Для совместимости со старыми функциями mysql_*.
|
||||
* @return Database
|
||||
*/
|
||||
public static function init(): Database
|
||||
{
|
||||
if (!isset(self::$instance)) {
|
||||
self::$instance = new static();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Новое подключение к БД.
|
||||
* @return PDO
|
||||
*/
|
||||
public static function pdoinit(): PDO
|
||||
{
|
||||
return new PDO(
|
||||
self::DSN,
|
||||
self::USER,
|
||||
self::PASSWORD,
|
||||
'mysql:host=localhost;dbname=' . Config::get('db_name'),
|
||||
Config::get('db_user'),
|
||||
Config::get('db_password'),
|
||||
[
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace Core;
|
||||
|
||||
use Exception;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use PDOStatement;
|
||||
|
||||
class Db
|
||||
{
|
||||
|
||||
private static PDO $db;
|
||||
private static self $instance;
|
||||
|
||||
/**
|
||||
* DB constructor.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
self::$db = Database::pdoinit();
|
||||
} catch (PDOException $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static function init(): void
|
||||
{
|
||||
self::$instance ??= new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stmt
|
||||
* @return PDOStatement
|
||||
*/
|
||||
private static function query(string $stmt): PDOStatement
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return PDOStatement
|
||||
*/
|
||||
public static function run(string $query, array $args = []): PDOStatement
|
||||
{
|
||||
try {
|
||||
if (!$args) {
|
||||
return self::query($query);
|
||||
}
|
||||
$stmt = self::prepare($query);
|
||||
$stmt->execute($args);
|
||||
return $stmt;
|
||||
} catch (PDOException $e) {
|
||||
throw new PDOException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getRow(string $query, array $args = [])
|
||||
{
|
||||
return self::run($query, $args)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public static function getRows(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);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
public static function getColumn(string $query, array $args = []): array
|
||||
{
|
||||
return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $args
|
||||
*/
|
||||
public static function sql(string $query, array $args = [])
|
||||
{
|
||||
self::run($query, $args);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
|
||||
class FightRequest
|
||||
{
|
||||
private $z1n = [4 => 'ãðóïïîâûå', 5 => 'õàîòè÷íûå'];
|
||||
private $z2n = [4 => 'ãðóïïîâîãî', 5 => 'õàîòè÷íîãî'];
|
||||
private $backTest = false; // Äëÿ ïðîâåðîê õàîòè÷åñêèõ ïîåäèíêîâ.
|
||||
private static $bcktst;
|
||||
/**@var User $u */
|
||||
private $u;
|
||||
private $zv_see;
|
||||
public $test_s = '';
|
||||
public $error = '';
|
||||
private array $z1n = [4 => 'ãðóïïîâûå', 5 => 'õàîòè÷íûå'];
|
||||
private array $z2n = [4 => 'ãðóïïîâîãî', 5 => 'õàîòè÷íîãî'];
|
||||
private bool $backTest = false; // Äëÿ ïðîâåðîê õàîòè÷åñêèõ ïîåäèíêîâ.
|
||||
private static bool $bcktst;
|
||||
|
||||
private User $u;
|
||||
private ?int $zv_see = null;
|
||||
public string $test_s = '';
|
||||
public string $error = '';
|
||||
|
||||
/**
|
||||
* Çàÿâêè íà áîé.
|
||||
@@ -46,7 +47,7 @@ class FightRequest
|
||||
if (!$eff['id2']) {
|
||||
return;
|
||||
}
|
||||
Db::run(
|
||||
Db::sql(
|
||||
'insert into eff_users (overType, id_eff, uid, name, timeUse, data) values (?,?,?,?,unix_timestamp(),?)',
|
||||
[$eff['oneType'], $eff['id2'], $uid, $eff['mname'], $eff['mdata']]
|
||||
);
|
||||
@@ -98,10 +99,8 @@ class FightRequest
|
||||
}
|
||||
if ($pl['users_in'] > 1) {
|
||||
//Íà÷àëî òóðíèðà
|
||||
mysql_query(
|
||||
'UPDATE `turnirs` SET `time` = "' . (time(
|
||||
) + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('update turnirs set time = unix_timestamp() + ?, status = 1 where id = ?', [$pl['time3'], $pl['id']]);
|
||||
|
||||
$usp = mysql_query(
|
||||
'SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
|
||||
);
|
||||
@@ -1567,20 +1566,86 @@ class FightRequest
|
||||
echo '<br><br><br><b><font color="black"><center>Ïðèíèìàòü ó÷àñòèå â òóðíèðå òîëüêî ñ ïåðâîãî óðîâíÿ.</center></font></b>';
|
||||
$this->zv_see = 0;
|
||||
} elseif ($r == 10) {
|
||||
|
||||
/** Òóðíèðû by Insallah*/
|
||||
# Çàùèòà îò F5
|
||||
if (!isset($_SESSION['bypass'])) {
|
||||
$_SESSION['bypass'] = mt_rand();
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) {
|
||||
unset($_SESSION['bypass']);
|
||||
if (array_key_exists('tournament_start', $_POST)) {
|
||||
(new Insallah\Tournaments\Tournament())->join($this->u->info['id']);
|
||||
if (\Insallah\Tournament::IS_ENABLED) {
|
||||
/** Òóðíèðû by Insallah*/
|
||||
# Çàùèòà îò F5
|
||||
if (!isset($_SESSION['bypass'])) {
|
||||
$_SESSION['bypass'] = mt_rand();
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) {
|
||||
unset($_SESSION['bypass']);
|
||||
if (array_key_exists('tournament_start', $_POST)) {
|
||||
(new \Insallah\Tournament())->join($this->u->info['id']);
|
||||
}
|
||||
}
|
||||
##
|
||||
# Ôîðìèðóåì ñïèñîê èäóùèõ òóðíèðîâ.
|
||||
$tournamentsList = Db::getRows('select * from tournaments');
|
||||
$tournaments = '<ul>';
|
||||
foreach ($tournamentsList as $tournament) {
|
||||
$time = $tournament['start_time'] === -1 ? 'Òóðíèð óæå íà÷àëñÿ!' : date(
|
||||
'G:i', $tournament['start_time']
|
||||
);
|
||||
$tournament_members_id = \Insallah\TournamentModel::getFreeFighters($tournament['tid']);
|
||||
$members = [];
|
||||
foreach ($tournament_members_id as $member) {
|
||||
$members[] = \Insallah\TournamentModel::uidToLogin($member);
|
||||
}
|
||||
$tournaments .= sprintf(
|
||||
"<li>Òóðíèð äëÿ %d óðîâíåé.<br>Âðåìÿ ïîäà÷è çàÿâêè: %s<br>Ó÷àñòíèêè: %s</li>",
|
||||
$tournament['tid'], $time, implode(', ', $members)
|
||||
);
|
||||
}
|
||||
$tournaments .= '</ul>';
|
||||
?>
|
||||
<div>
|
||||
<strong style="color: red;">Âíèìàíèå!</strong>
|
||||
<ul>
|
||||
<li style="color: blue;"> ñëó÷àå ñîçäàíèÿ ëèáî ïðèñîåäèíåíèÿ ê Òóðíèðó, ïîêèíóòü åãî -
|
||||
<u>íåâîçìîæíî</u>!
|
||||
</li>
|
||||
<?php if (\Insallah\TournamentModel::isEkrOverpriced($this->u->info['id'])): ?>
|
||||
<li>Ñòîèìîñòü ïðåäìåòîâ, îäåòûõ íà âàñ íå äîëæíà
|
||||
ïðåâûøàòü <?= \Insallah\Tournament::ekrOverpriceFormula(
|
||||
$this->u->info['level']
|
||||
) ?> åâðîêðåäèòîâ.
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->u->info['exp'] < \Insallah\Tournament::MIN_EXP): ?>
|
||||
<li>Ó âàñ äîëæíî áûòü íå ìåíåå <?= \Insallah\Tournament::MIN_EXP ?> îïûòà.</li>
|
||||
<?php endif; ?>
|
||||
<li style="color: blue;">Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
||||
íàáåð¸òñÿ <?= \Insallah\Tournament::START_TOURNAMENT ?> ÷åëîâåê.
|
||||
</li>
|
||||
<li style="color: blue;">Èãðîêè çàíÿâøèå 1, 2 è 3 ìåñòà ïîëó÷àò 25, 15, 5 Ðåëèêâèé
|
||||
Àíãåëà, à òàê æå çàäåðæêè íà ó÷àñòèå â òóðíèðå 12 ÷àñîâ, 6 è 3 ÷àñà ñîîòâåòñòâåííî!
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (!empty($tournamentsList)): ?>
|
||||
<div>
|
||||
<strong>Àêòèâíûå òóðíèðû.</strong><br>
|
||||
<?= $tournaments ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!\Insallah\TournamentModel::getTournamentIdByUserId(
|
||||
$this->u->info['id']
|
||||
) || !\Insallah\TournamentModel::isStarted($this->u->info['level'])): ?>
|
||||
<form method="post">
|
||||
<input type="submit" name="tournament_start" value="Ïðèíÿòü ó÷àñòèå â òóðíèðå">
|
||||
<input type="hidden" name="key" value="<?= $_SESSION['bypass'] ?>">
|
||||
</form>
|
||||
<?php else: ?>
|
||||
Âû ó÷àâñòâóåòå.
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div>
|
||||
<strong style="color: crimson;">Â äàííûé ìîìåíò òóðíèðû íå ïðîâîäÿòñÿ!</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$tlist = new \Insallah\Tournaments\View\TList($this->u);
|
||||
echo $tlist; # Ôîðìèðóåì ñïèñîê èäóùèõ òóðíèðîâ.
|
||||
/** Êîíåö òóðíèðîâ îò Insallah. */
|
||||
} elseif ($this->u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) {
|
||||
if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
|
||||
@@ -2268,7 +2333,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
||||
|
||||
public function seeZv()
|
||||
{
|
||||
global $c, $code, $zi;
|
||||
global $code, $zi;
|
||||
if (isset($_GET['r']) && $this->zv_see == 1) {
|
||||
$r = round(intval($_GET['r']));
|
||||
if ($r >= 1 && $r <= 5) {
|
||||
@@ -2592,7 +2657,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
||||
)
|
||||
);
|
||||
$d1 = '';
|
||||
if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= $c['bot_level']) {
|
||||
if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= Config::get('bot_level')) {
|
||||
$d1 = 'disabled="disabled"';
|
||||
}
|
||||
if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) {
|
||||
@@ -2652,7 +2717,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
||||
<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /></form></div>';
|
||||
}
|
||||
} else {
|
||||
if ($zvb != '' && $this->u->info['level'] > $c['bot_level']) {
|
||||
if ($zvb != '' && $this->u->info['level'] > Config::get('bot_level')) {
|
||||
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br><input class="btn" name="" type="submit" value="Ïðèíÿòü âûçîâ" /><br>' . $zvb . '<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü âûçîâ" /></form></div>';
|
||||
} else {
|
||||
echo '<div style="float:left;">' . $zvb . '</div>';
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
use Core\Db;
|
||||
use User;
|
||||
|
||||
class Achievements
|
||||
{
|
||||
private $user;
|
||||
private User $user;
|
||||
private $info;
|
||||
private $data = [
|
||||
private array $data = [
|
||||
'zb' => [
|
||||
'questname' => 'Åæåäí.Çàäàíèÿ',
|
||||
'quest' => 'Âûïîëíèòü çàäàíèÿ áàáêè.',
|
||||
@@ -93,41 +96,51 @@ class Achievements
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(\User $user)
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
|
||||
}
|
||||
|
||||
private function prizeName($int, $string)
|
||||
//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)
|
||||
private function drawSunduk($nagr, $whatInside, $tier): string
|
||||
{
|
||||
return vsprintf('<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="Ñóíäóê">',
|
||||
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()
|
||||
public function getList(): string
|
||||
{
|
||||
$string = '';
|
||||
$this->calculateCurrent(1);
|
||||
|
||||
foreach ($this->data as $key => $value) {
|
||||
|
||||
//Áëÿ, êàêóþ õåðíþ ïðèõîäèòñÿ ãîðîäèòü!
|
||||
//Ïåðâîå ÷èñëî = òðåáîâàíèå ñëåäóþùåãî òèðà ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàäî íàáðàòü)
|
||||
//Âòîðîå ÷èñëî = êîëè÷åñòâî äîñòèæåíèé ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàáðàë)
|
||||
//Òðåáîâàíèÿ òåêóùåãî òèðà îòíèìàþòñÿ ÷òîáû êàæäûé òèð íà÷èíàë ñ÷èòàòü ïðîöåíò ñ 0.
|
||||
//Ïèçäû äàòü òîìó, êòî òàê óåáàíñêè íàçûâàåò ïåðåìåííûå, ÷òî íóæíî ïîëäíÿ âúåçæàòü ÷òî ïðîèñõîäèò.
|
||||
//È õåð ïîìåíÿåøü - âñ¸ ñëîìàåòñÿ. FFUUUUUUUUUUUUUU!!! Ins.
|
||||
|
||||
if (!is_numeric($value['check'][$this->info['klas' . $key]])) {
|
||||
// Ïîòîìû ÷òî ïåðâûé ýëåìåíò ìàññèâà - ñëîâî. Â ÐÍÐ5.4 ïðîêàòûâàëî, â ÐÍÐ7.4 - íåò.
|
||||
$value['check'][$this->info['klas' . $key]] = 0;
|
||||
}
|
||||
|
||||
$percentToSuccess = Math::get100Percentage(
|
||||
$value['check'][$this->info['klas' . $key] + 1] - $value['check'][$this->info['klas' . $key]],
|
||||
$this->info[$key] - $value['check'][$this->info['klas' . $key]]
|
||||
@@ -136,7 +149,8 @@ class Achievements
|
||||
$string .= '<h4>' . $questname . '</h4>';
|
||||
$string .= '<strong>' . $value['quest'] . '</strong><br>';
|
||||
$string .= 'Òåêóùèé Ðàíã: <strong>' . $this->info['klas' . $key] . '</strong> ';
|
||||
$string .= 'Êîëè÷åñòâî ' . mb_strtolower($value['check'][0]) . ': <strong>' . $this->info[$key] . ' =' . $percentToSuccess . '%</strong>';
|
||||
$string .= 'Êîëè÷åñòâî ' . mb_strtolower($value['check'][0]) . ': <strong>' . $this->info[$key] . ' = ' . $percentToSuccess . '%</strong>';
|
||||
//$string .= '<progress value="' . $percentToSuccess . '" max="100" style="accent-color:green; appearance: none;">' . $percentToSuccess . '</progress>';
|
||||
|
||||
$string .= Table::get([
|
||||
['Ðàíãè', 1, 2, 3, 4, 5],
|
||||
@@ -182,6 +196,10 @@ class Achievements
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_null($this->info[$k])) {
|
||||
$this->info[$k] = 0;
|
||||
}
|
||||
|
||||
$this->info["klas$k"] = 0;
|
||||
$this->info["name$k"] = $this->data[$k]['questname'];
|
||||
$this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]);
|
||||
@@ -203,10 +221,10 @@ class Achievements
|
||||
}
|
||||
}
|
||||
|
||||
public function getInfo($user_id = null)
|
||||
public function getInfo(?int $uid = null)
|
||||
{
|
||||
if (!is_null($user_id)) {
|
||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user_id]);
|
||||
if (!is_null($uid)) {
|
||||
$this->info = \Core\Db::getRow('select * from users_achiv where id = ?', [$uid]);
|
||||
}
|
||||
$this->calculateCurrent();
|
||||
return $this->info;
|
||||
@@ -220,7 +238,7 @@ class Achievements
|
||||
|
||||
private function addOne($name)
|
||||
{
|
||||
Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
||||
\Core\Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
||||
}
|
||||
|
||||
public function updateTier($name)
|
||||
@@ -240,12 +258,12 @@ class Achievements
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function getData()
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function hasNoTier4Access($nagr)
|
||||
public function hasNoTier4Access($nagr): bool
|
||||
{
|
||||
return $this->user->info['level'] < 9 && in_array($nagr, [14, 15, 24, 25, 34, 35, 44, 45, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105]);
|
||||
}
|
||||
@@ -257,7 +275,7 @@ class Achievements
|
||||
}
|
||||
}
|
||||
|
||||
public function getTypes()
|
||||
public function getTypes(): array
|
||||
{
|
||||
return array_keys($this->data);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
<?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();
|
||||
//}
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
use Core\Database;
|
||||
//use Core\Database;
|
||||
use Exception;
|
||||
use http\Message;
|
||||
//use http\Message;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use PDOStatement;
|
||||
|
||||
class Db
|
||||
class DbOld
|
||||
{
|
||||
/**
|
||||
* Íàñòðîéêè ïîäêëþ÷åíèÿ
|
||||
@@ -5,19 +5,30 @@ namespace Insallah;
|
||||
/** All raw mathematics in one place. */
|
||||
class Math
|
||||
{
|
||||
public static function getPercentage($total, $number)
|
||||
/**
|
||||
* @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, $number)
|
||||
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)
|
||||
public static function get20PercentRange($number): array
|
||||
{
|
||||
return [
|
||||
'min' => $number * ((100 - 20) / 100),
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
/** 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
|
||||
{
|
||||
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
|
||||
}
|
||||
|
||||
|
||||
public static function get100Percentage($total, int $number)
|
||||
{
|
||||
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,22 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
class Table
|
||||
{
|
||||
public static function get($rows, $class = '', $fill = false)
|
||||
{
|
||||
$c = '';
|
||||
$max_rows = sizeof(max($rows));
|
||||
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($fill && sizeof($row) < $max_rows) {
|
||||
$row = array_merge($row, array_fill(0, $max_rows - 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,141 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
class Tournament
|
||||
{
|
||||
const IS_ENABLED = true;
|
||||
private const SEND_CHAT_MESSAGE = 3;
|
||||
private const START_TOURNAMENT = 5;
|
||||
private const PRIZE1 = 25;
|
||||
private const PRIZE2 = 10;
|
||||
private const PRIZE3 = 5;
|
||||
const MIN_EXP = 175000;
|
||||
private const CHAT_MESSAGE = 'Âíèìàíèå! Òóðíèð äëÿ %d óðîâíÿ îòêðûò! Ïîñïåøèòå ïðèíÿòü ó÷àñòèå â Çàëå Âîèíîâ!';
|
||||
private const VICTORY_MESSAGE = 'Òóðíèð äëÿ %d óðîâíåé çàâåðø¸í! Ïåðâîå ìåñòî: %s. Âòîðîå ìåñòî: %s. Òðåòüå ìåñòî: %s.';
|
||||
private const DELAY1 = '+12hour';
|
||||
private const DELAY2 = '+6hour';
|
||||
private const DELAY3 = '+3hour';
|
||||
|
||||
/** Ôîðìóëà ðàññ÷¸òà ðàçðåø¸ííîé ñòîèìîñòè îäåòûõ ïðåäìåòîâ.
|
||||
*
|
||||
* @param int $int
|
||||
*
|
||||
* @return float|int
|
||||
*/
|
||||
public static function ekrOverpriceFormula(int $int): int
|
||||
{
|
||||
return ($int - 7) * 151;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïðîâåðÿåì ìîæåò ëè èãðîê ó÷àâñòâîâàòü â òóðíèðå è ëèáî ïðèñîåäèíÿåì åãî, ëèáî îáëàìûâàåì.
|
||||
*
|
||||
* @param int $uid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function join(int $uid): void
|
||||
{
|
||||
/** Âîçâðàùàåò level, èëè 0 åñëè ïðîâàëåíû ïðîâåðêè. */
|
||||
$userLevel = TournamentModel::getUserLevel($uid);
|
||||
if (
|
||||
$userLevel === 0 ||
|
||||
TournamentModel::isEkrOverpriced($uid, $userLevel) ||
|
||||
!TournamentModel::isEnoughExperience($uid) ||
|
||||
TournamentModel::isRestrictedToJoin($uid) ||
|
||||
TournamentModel::isStarted($uid)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$mq = TournamentModel::getWaitingMembersQuantity($userLevel);
|
||||
if (empty($mq)) {
|
||||
TournamentModel::createTournament($userLevel);
|
||||
}
|
||||
|
||||
TournamentModel::joinTournament($uid, $userLevel);
|
||||
$mq++;
|
||||
|
||||
if ($mq == self::SEND_CHAT_MESSAGE) {
|
||||
TournamentModel::sysMessage(sprintf(self::CHAT_MESSAGE, $userLevel));
|
||||
}
|
||||
|
||||
if ($mq == self::START_TOURNAMENT) {
|
||||
TournamentModel::startTournament($userLevel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïðîâåðêà äëÿ êðîíà\êîíôèãà. Âûáèâàåò ïðîèãðàâøèõ è ïåðåçàïóñêàåò ïîåäèíêè âî âñåõ òóðíèðàõ.
|
||||
* @return void
|
||||
*/
|
||||
public function startAllBattles(): void
|
||||
{
|
||||
$db = new Db();
|
||||
$db::sql(
|
||||
'delete from tournaments where start_time + date_add(start_time,interval 30 minute) < unix_timestamp()'
|
||||
);
|
||||
TournamentModel::removeFighter(TournamentModel::getLooser());
|
||||
$tournamentLevels = $db::getColumn('select tid from tournaments where start_time = -1');
|
||||
foreach ($tournamentLevels as $level) {
|
||||
$aliveFighters = TournamentModel::getFreeFighters($level);
|
||||
if (count($aliveFighters) > 1) {
|
||||
shuffle($aliveFighters);
|
||||
$this->startBattle($aliveFighters);
|
||||
} elseif (count($aliveFighters) === 1) {
|
||||
TournamentModel::removeFighter($aliveFighters[0], true);
|
||||
$this->victory($level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïîëó÷àåì ïàðû áîéöîâ è íà÷èíàåì èõ ïîåäèíêè.
|
||||
*
|
||||
* @param array $fightersList
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function startBattle(array $fightersList): void
|
||||
{
|
||||
$teams = TournamentModel::getFightersTeams($fightersList);
|
||||
foreach ($teams as $team) {
|
||||
if (count($team) === 2) {
|
||||
TournamentModel::startBattle($team[0], $team[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Íàãðàæäàåì ïîáåäèòåëåé òóðíèðà, ÷èñòèì áàçó.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function victory(int $tid): void
|
||||
{
|
||||
$winners = TournamentModel::getWinners($tid);
|
||||
sleep(1);
|
||||
TournamentModel::givePrizeItems($winners[1], self::PRIZE1);
|
||||
TournamentModel::givePrizeItems($winners[2], self::PRIZE2);
|
||||
TournamentModel::givePrizeItems($winners[3], self::PRIZE3);
|
||||
sleep(1);
|
||||
TournamentModel::giveDelay($winners[1], strtotime(self::DELAY1));
|
||||
TournamentModel::giveDelay($winners[2], strtotime(self::DELAY2));
|
||||
TournamentModel::giveDelay($winners[3], strtotime(self::DELAY3));
|
||||
sleep(1);
|
||||
TournamentModel::sysMessage(
|
||||
sprintf(
|
||||
self::VICTORY_MESSAGE,
|
||||
$tid,
|
||||
TournamentModel::uidToLogin($winners[1]),
|
||||
TournamentModel::uidToLogin($winners[2]),
|
||||
TournamentModel::uidToLogin($winners[3])
|
||||
)
|
||||
);
|
||||
sleep(3);
|
||||
TournamentModel::destroyTournament($tid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
class TournamentModel
|
||||
{
|
||||
|
||||
/**
|
||||
* ïðîâåðêà óðîâíÿ, ñòîèìîñòè ýêâèïà, ïðî÷èå ïðîâåðêè, ÷òî ïåðñîíàæ ñâîáîäåí
|
||||
* òàéìåð îæèäàíèÿ 30 ìèíóò
|
||||
*
|
||||
* @param int $uid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getUserLevel(int $uid): int
|
||||
{
|
||||
$db = new Db();
|
||||
$level = $db::getValue('select level from users where id = ? and level between 8 and 12 and battle = 0', [$uid]);
|
||||
return $level ?: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $uid
|
||||
* @param int|null $level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEkrOverpriced(int $uid, ?int $level = null): bool
|
||||
{
|
||||
$db = new Db();
|
||||
if (is_null($level)) {
|
||||
$level = $db::getValue('select level from users where id = ?', [$uid]);
|
||||
}
|
||||
$wearedItemsEkrPrice = $db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||
return $wearedItemsEkrPrice > Tournament::ekrOverpriceFormula($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $uid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEnoughExperience(int $uid): bool
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select exp from stats where id = ?', [$uid]) >= Tournament::MIN_EXP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $uid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRestrictedToJoin(int $uid): bool
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select count(*) from eff_users where uid = ? and id_eff = 486 and `delete` = 0', [$uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $tid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isStarted(int $tid): bool
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select count(*) from tournaments where start_time = -1 and tid = ?', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñ÷èòàåì ñêîëüêî èãðîêîâ æäóò â çàÿâêå íà òóðíèð.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getWaitingMembersQuantity(int $tid): int
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select count(*) from tournaments_users where tid = ?', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñîçäàíèå íîâîãî òóðíèðà.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function createTournament(int $tid): void
|
||||
{
|
||||
$db = new Db();
|
||||
$db::sql('insert into tournaments (tid) values (?)', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Èãðîê ïðèñîåäèíÿåòñÿ ê òóðíèðó è òåëåïîðòèðóåòñÿ â òóðíèðíóþ êîìíàòó.
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $tid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function joinTournament(int $uid, int $tid): void
|
||||
{
|
||||
/** Êàñòîìíûå êîìíàòû 25008 - 25012. */
|
||||
$roomId = 25000 + $tid;
|
||||
$db = new Db();
|
||||
$db::sql('insert into tournaments_users (tid, uid) values (?, ?)', [$tid, $uid]);
|
||||
self::teleport($uid, $roomId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñòàðò òóðíèðà.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function startTournament(int $tid): void
|
||||
{
|
||||
$db = new Db();
|
||||
$db::sql('update tournaments set start_time = -1 where tid = ?', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* ×èñòèì áàçû îò ïðîøåäøåãî òóðíèðà.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function destroyTournament(int $tid): void
|
||||
{
|
||||
$db = new Db();
|
||||
//Óáåäèòüñÿ ÷òî â áàçå íàñòðîåí foreign_keys è ïîñëåäóåò àâòîî÷èñòêà tournaments_users !!!
|
||||
$db::sql('delete from tournaments where tid = ?', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïîëó÷àåì ñïèñîê áîéöîâ è áü¸ì èõ íà ïàðû. Âîçâðàùàåì ñïèñêè ïàð + 1 ïîñëåäíèé áåç ïàðû åñëè åñòü.
|
||||
*
|
||||
* @param array $fightersList
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getFightersTeams(array $fightersList): array
|
||||
{
|
||||
$db = new Db();
|
||||
$query = sprintf("select id from users where battle = 0 and id in (%s)", implode(', ', $fightersList));
|
||||
return array_chunk($db::getColumn($query), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Âûáèðàåì æèâûõ áîéöîâ íå ñðàæàþùèõñÿ â äàííûé ìîìåíò.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getFreeFighters(int $tid): array
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getColumn('select uid from tournaments_users where tid = ? and death_time = 0 order by uid', [$tid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Âûáèðàåì ïîáåäèòåëåé. Ñìåùàåì ìàññèâ, ÷òîáû âîçâðàò ø¸ë ñ åäèíèöû.
|
||||
*
|
||||
* @param int $tid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getWinners(int $tid): array
|
||||
{
|
||||
$db = new Db();
|
||||
$winners = $db::getColumn('select uid from tournaments_users where tid = ? order by death_time desc limit 3', [$tid]);
|
||||
return [
|
||||
1 => $winners[0],
|
||||
2 => $winners[1],
|
||||
3 => $winners[2]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïðîáóåì âûêóñèòü ïðîèãðàâøåãî â ïîñëåäíåé òóðíèðíîé áèòâå è óäàëèòü ýòó ñàìóþ áèòâó âî èçáåæàíèå.
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getLooser()
|
||||
{
|
||||
$query = '
|
||||
select uid, battle
|
||||
from
|
||||
battle_users,
|
||||
(select id, team_win
|
||||
from battle
|
||||
where
|
||||
team_win > 0 and
|
||||
typeBattle = 25000
|
||||
order by time_over desc
|
||||
limit 1) as last_battle
|
||||
where
|
||||
battle_users.battle = last_battle.id and
|
||||
battle_users.team != last_battle.team_win and
|
||||
battle_users.uid in (select uid from tournaments_users where death_time = 0)';
|
||||
|
||||
$query2 = 'select bu.uid from battle b
|
||||
inner join battle_users bu on b.team_win != bu.team and b.id = bu.battle
|
||||
inner join tournaments_users tu on bu.uid = tu.uid
|
||||
where typeBattle = 25000 and death_time = 0 order by b.time_start desc limit 1';
|
||||
$db = new Db;
|
||||
$row = $db::getRow($query);
|
||||
return $row['uid'] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Âûáûâøèé èç òóðíèðà ïîêèäàåò êîìíàòó è ïîëó÷àåò âðåìÿ ñìåðòè.
|
||||
*
|
||||
* @param int $uid
|
||||
* @param bool $winner
|
||||
* @return void
|
||||
*/
|
||||
public static function removeFighter(int $uid, bool $winner = false): void
|
||||
{
|
||||
if (!$uid) {
|
||||
return;
|
||||
}
|
||||
//$winner_timer_add = $winner? 500 : 0; # Ïîñëåäíûé ÄÎËÆÅÍ áûòü ïîñëåäíèì.
|
||||
$db = new Db();
|
||||
$db::sql('update tournaments_users set death_time = unix_timestamp() + 500 where death_time = 0 and uid = ?', [$uid]);
|
||||
self::teleport($uid, 9);
|
||||
//fixme: Êëàññû íå ïîäêëþ÷àþòñÿ äðóã ê äðóãó. Íóæíî ìåíÿòü àðõèòåêòóðó èãðû. :(
|
||||
Db::sql("update users_achiv set trn = trn + 1 where id = ?", [$uid]);
|
||||
//(new Achievements(\user::start()))->updateCounter('trn');
|
||||
}
|
||||
|
||||
/**
|
||||
* Óçíà¸ì id òóðíèðà ïî id èãðîêà.
|
||||
*
|
||||
* @param int $uid
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getTournamentIdByUserId(int $uid)
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select tid from tournaments_users where uid = ?', [$uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïîïðîáóåì ñòàðòîíóòü ïîåäèíîê.
|
||||
* 25000 - Óíèêàëüíûé id ïîåäèíêà ïîä òóðíèðû.
|
||||
* noinc - çàïðåò íà âìåøàòåëüñòâî
|
||||
* invis - íåâèäèìûé áîé
|
||||
*
|
||||
* @param int $uid1
|
||||
* @param int $uid2
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function startBattle(int $uid1, int $uid2): void
|
||||
{
|
||||
$db = new Db();
|
||||
$check = Db::getValue('select count(*) from users where id in (?, ?) and battle = 0', [$uid1, $uid2]);
|
||||
if ($check !== 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db::exec('insert into battle (city, time_start, timeout, type, invis, noinc, travmChance, typeBattle)
|
||||
values (\'capitalcity\', unix_timestamp(), 60, 0, 1, 1, 0, 25000)');
|
||||
$bid = $db::lastInsertId(); // ÂÀÆÍÎ!
|
||||
$db::sql('update stats set team = 1, hpNow = hpAll, mpNow = mpAll where id = ?', [$uid1]);
|
||||
$db::sql('update stats set team = 2, hpNow = hpAll, mpNow = mpAll where id = ?', [$uid2]);
|
||||
$db::sql('update users set battle = ? where id in (?, ?)', [$bid, $uid1, $uid2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Óçíà¸ì ëîãèí ïåðñîíàæà ïî åãî id.
|
||||
*
|
||||
* @param int $uid
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function uidToLogin(int $uid)
|
||||
{
|
||||
$db = new Db();
|
||||
return $db::getValue('select login from users where id = ?', [$uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Òåëåïîðò ïî êîìíàòàì.
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $roomId
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function teleport(int $uid, int $roomId): void
|
||||
{
|
||||
$db = new Db();
|
||||
$db::sql('update users set room = ? where id = ?', [$roomId, $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Íåò ïðîâåðîê $message ïîòîìó ÷òî îíî âñåãäà çàäà¸òñÿ â êîäå è èãðîê íà íåãî íå âëèÿåò.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function sysMessage(string $message): void
|
||||
{
|
||||
if (!empty($message)) {
|
||||
$db = new Db();
|
||||
$message = "<span style='font-weight: bold; color: forestgreen;'>$message</span>";
|
||||
$db::sql('insert into chat (time, type, text, new, da) values (unix_timestamp(), 6, ?, 1, 1)', [$message]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ãåíåðèðóåò ìíîæåñòâåííûé çàïðîñ ñðàçó íà $quantity îäíîòèïíûõ ïðåäìåòîâ â èíâåíòàðü ïîëüçîâàòåëÿ $uid.
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $quantity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function givePrizeItems(int $uid, int $quantity): void
|
||||
{
|
||||
$query = 'insert into items_users (item_id, uid, data, iznosMAX, lastUPD, time_create)
|
||||
values (4754, :uid, :data, 1, unix_timestamp(), unix_timestamp())';
|
||||
$args = [
|
||||
'uid' => $uid,
|
||||
'data' => 'nosale=1|musor=1|sudba=' . self::uidToLogin($uid) . '|lvl=8|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0'
|
||||
];
|
||||
$db = new Db();
|
||||
$stmt = $db::prepare($query);
|
||||
for ($i = 0; $i < $quantity; $i++) {
|
||||
$stmt->execute($args);
|
||||
}
|
||||
}
|
||||
|
||||
/** Ýôôåêò-îãðàíè÷èòåëü íà ó÷àñòèå â òóðíèðå.
|
||||
* @param int $uid
|
||||
* @param int $unixtime
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function giveDelay(int $uid, int $unixtime): void
|
||||
{
|
||||
$db = new Db();
|
||||
$query = 'insert into eff_users (id_eff, uid, name, timeUse) VALUES (?,?,?,?)';
|
||||
$args = [486, $uid, 'Ïðèç¸ð ãîðîäñêîãî òóðíèðà!', $unixtime];
|
||||
$db::sql($query, $args);
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,9 @@ class TList
|
||||
$this->str .= '<li>Ó âàñ äîëæíî áûòü íå ìåíåå ' . Config::MIN_EXP . ' îïûòà.</li>';
|
||||
}
|
||||
$this->str .= '<li>Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
||||
íàáåð¸òñÿ ' . Config::START_TOURNAMENT . ' ÷åëîâåê.</li>';
|
||||
$this->str .= '<li>Èãðîêè çàíÿâøèå 1, 2 è 3 ìåñòà ïîëó÷àò ' . Config::PRIZE1 . ', ' . Config::PRIZE2 . ',
|
||||
' . Config::PRIZE3 . ' Ðåëèêâèé Àíãåëà, à òàê æå çàäåðæêè íà ó÷àñòèå â òóðíèðå
|
||||
12 ÷àñîâ, 6 è 3 ÷àñà ñîîòâåòñòâåííî!</li>';
|
||||
$this->str .= '</ul></div>';
|
||||
íàáåð¸òñÿ ' . Config::START_TOURNAMENT . ' ÷åëîâåê.</li>
|
||||
</ul>
|
||||
</div>';
|
||||
$this->str .= $tournamentstatus->getList();
|
||||
if (!User::getTournamentIdByUserId($user->info['id']) || !$tournamentstatus->isStarted($user->info['level'])) {
|
||||
$this->str .= '<form method="post">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Db;
|
||||
|
||||
class Learming
|
||||
{
|
||||
|
||||
@@ -1604,7 +1604,7 @@ class Magic
|
||||
|
||||
private static function getDressedEkrTotalPrice($uid)
|
||||
{
|
||||
return \Insallah\Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||
return \Core\Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||
}
|
||||
|
||||
private static function canAttack8Level($attacker, $target)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class PassGen
|
||||
{
|
||||
public static function new($length = 8)
|
||||
{
|
||||
return substr(
|
||||
preg_replace(
|
||||
"/[^a-zA-Z0-9]/",
|
||||
"",
|
||||
base64_encode(openssl_random_pseudo_bytes($length + 1))
|
||||
),
|
||||
0,
|
||||
$length
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Db;
|
||||
use Insallah\Math;
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Db;
|
||||
|
||||
class Season
|
||||
{
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
if (!defined('GAME')) {
|
||||
die();
|
||||
}
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Tournir
|
||||
{
|
||||
private $u;
|
||||
private $info;
|
||||
private $user;
|
||||
private $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
||||
private User $u;
|
||||
private array $info;
|
||||
private array $user;
|
||||
private array $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -19,24 +18,24 @@ class Tournir
|
||||
|
||||
private function start()
|
||||
{
|
||||
$this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1'));
|
||||
$this->user = mysql_fetch_array(mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->u->info['inTurnirnew'] . '" AND `bot` = "' . $this->u->info['id'] . '" LIMIT 1'));
|
||||
$this->info = Db::getRow('select * from turnirs where id = ?', [$this->u->info['inTurnirnew']]);
|
||||
$this->user = Db::getRow('select * from users_turnirs where turnir = ? and bot = ?', [$this->u->info['inTurnirnew'], $this->u->info['id']]);
|
||||
}
|
||||
|
||||
private function startTurnir()
|
||||
{
|
||||
$row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `win` = "0" AND `lose` = "0" AND `nich` = "0"'));
|
||||
if ($row[0] <= 0 || $this->info['status'] == 3) {
|
||||
$row = Db::getValue('select count(*) from users where win = 0 and lose = 0 and nich = 0');
|
||||
if (!$row || $this->info['status'] == 3) {
|
||||
if ($this->info['status'] == 3) {
|
||||
$this->finishTurnir();
|
||||
}
|
||||
} else {
|
||||
mysql_query('UPDATE `turnirs` SET `status` = "3" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
|
||||
Db::sql('update turnirs set status = 3 where id = ?', [$this->info['id']]);
|
||||
//Ñîçäàíèå ïîåäèíêà
|
||||
mysql_query('INSERT INTO `battle` (`city`,`time_start`,`timeout`,`type`,`turnir`) VALUES ("' . $this->u->info['city'] . '","' . time() . '","60","1","' . $this->info['id'] . '")');
|
||||
$uri = mysql_insert_id();
|
||||
Db::sql('insert into battle (city, time_start, timeout, type, turnir) values (?,unix_timestamp(),60,1,?)', [$this->u->info['city'], $this->info['id']]);
|
||||
$uri = Db::lastInsertId();
|
||||
//Çàêèäûâàåì ïåðñîíàæåé â ïîåäèíîê
|
||||
mysql_query('UPDATE `users` SET `battle` = "' . $uri . '" WHERE `inUser` = "0" AND `inTurnirnew` = "' . $this->info['id'] . '"');
|
||||
Db::sql('update users set battle = ? where inUser = 0 and inTurnirnew = ?', [$uri, $this->info['id']]);
|
||||
//Îáîçíà÷àåì çàâåðøåíèå òóðíèðà ïðè âûõîäå
|
||||
die('Ïåðåéòèäå â ðàçäåë "ïîåäèíêè"...');
|
||||
}
|
||||
@@ -62,9 +61,6 @@ class Tournir
|
||||
}
|
||||
|
||||
if ($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) {
|
||||
|
||||
$inf['add_expn'] = 3000;
|
||||
|
||||
$inf['add_expp'] = [0, 1, 5, 10, 15, 25, 35, 70, 100, 150, 200, 300, 500, 700, 1000];
|
||||
|
||||
//ïîëó÷àåì îïûò (ñ 0 ïî 12 ëâë)
|
||||
@@ -82,7 +78,6 @@ class Tournir
|
||||
mysql_query('UPDATE `users` SET `lose` = `lose` + 1,`lose_t` = `lose_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||
|
||||
$lose .= '<b>' . $inf['login'] . '</b>, ';
|
||||
|
||||
} else {
|
||||
mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||
}
|
||||
@@ -172,7 +167,6 @@ class Tournir
|
||||
}
|
||||
|
||||
if ($addi == 1) {
|
||||
|
||||
$i = 0;
|
||||
while ($i <= 17) {
|
||||
if ($i == 10) {
|
||||
@@ -468,7 +462,6 @@ class Tournir
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
|
||||
$r .= '<table style="border:1px solid #99cccc" width="700" bgcolor="#bbdddd" border="0" align="center" cellpadding="5" cellspacing="0">
|
||||
|
||||
+2896
-1591
File diff suppressed because it is too large
Load Diff
@@ -1,28 +1,116 @@
|
||||
<?php
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class UserRegister
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
public function hasMixedLatCur(string $txt): bool
|
||||
{
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
define('IP', $ip);
|
||||
if ($_SERVER['HTTP_REFERER'] == 'https://new-combats.com/' && $_COOKIE['acomb1'] != '2') {
|
||||
setcookie('acomb1', '1', time() + 60 * 60 * 24 * 3);
|
||||
}
|
||||
}
|
||||
|
||||
public function en_ru($txt)
|
||||
{
|
||||
$en = preg_match("/^(([0-9A-z _-])+)$/i", $txt);
|
||||
$en = preg_match("/^(([0-9A-z -])+)$/i", $txt);
|
||||
$ru = preg_match("/^(([0-9À-ÿ _-])+)$/i", $txt);
|
||||
return ($ru && $en) || (!$ru && !$en);
|
||||
}
|
||||
|
||||
public function hasGoodLogin(string $login): string
|
||||
{
|
||||
$isRestricted = in_array(
|
||||
$login,
|
||||
[
|
||||
'àíãåë', 'angel', 'àäìèíèñòðàöèÿ', 'administration', 'Êîììåíòàòîð',
|
||||
'Ìèðîçäàòåëü', 'Ìóñîðùèê', 'Ïàäàëüùèê', 'Ïîâåëèòåëü',
|
||||
'Àðõèâàðèóñ', 'Ïåðåñìåøíèê', 'Âîëûíùèê', 'Ëîðä Ðàçðóøèòåëü',
|
||||
'Ìèëîñåðäèå', 'Ñïðàâåäëèâîñòü', 'Èñêóøåíèå', 'Âîçíåñåíèå',
|
||||
]
|
||||
);
|
||||
$isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]);
|
||||
//Áûâøèå â óïîòðåáëåíèè ëîãèíû. Äè÷ü, íî ëàäíî.
|
||||
$wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]);
|
||||
|
||||
$login = str_replace(' ', ' ', $login);
|
||||
//Ëîãèí îò 4 äî 20 ñèìâîëîâ
|
||||
if (strlen($login) > 20) {
|
||||
$error = 'Ëîãèí äîëæåí ñîäåðæàòü íå áîëåå 20 ñèìâîëîâ.';
|
||||
}
|
||||
if (strlen($login) < 4) {
|
||||
$error = 'Ëîãèí äîëæåí ñîäåðæàòü íå ìåíåå 4 ñèìâîëîâ.';
|
||||
}
|
||||
if ($this->hasMixedLatCur($login)) {
|
||||
$error = 'Â ëîãèíå ðàçðåøåíî èñïîëüçîâàòü òîëüêî áóêâû îäíîãî àëôàâèòà ðóññêîãî èëè àíãëèéñêîãî. Íåëüçÿ ñìåøèâàòü.';
|
||||
}
|
||||
//Ðàçäåëèòåëè
|
||||
if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) {
|
||||
$error = 'Íå áîëåå äâóõ ðàçäåëèòåëåé îäíîâðåìåííî (ïðîáåë, òèðå, íèæíåå ïîä÷åðêèâàíèå).';
|
||||
}
|
||||
if (!empty($error)) {
|
||||
$error .= '<br> Ïðèìåð ïðàâèëüíîãî íèêíåéìà: Ïåòÿ Óáèâàòîð, Êîëÿ, xalop. <br> Ïðèìåð íåïðàâèëüíîãî íèêíåéìà: )))), kolÿ)=-/.';
|
||||
|
||||
}
|
||||
if ($isRegistered || $wasRegistered || $isRestricted) {
|
||||
$error = 'Ëîãèí ' . $login . ' óæå çàíÿò, âûáåðèòå äðóãîé.';
|
||||
}
|
||||
|
||||
return $error ?? '';
|
||||
}
|
||||
|
||||
public function hasGoodEmail(string $email): string
|
||||
{
|
||||
$isRegistered = Db::getValue('select count(*) from users where mail = ?', [$email]);
|
||||
$isBlocked = Db::getValue('select count(*) from ban_email where email = ?', [$email]);
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || $isRegistered) {
|
||||
$error = 'Íåïðàâèëüíûé email.';
|
||||
}
|
||||
if ($isBlocked) {
|
||||
$error = 'Àäðåñ çàáëîêèðîâàí.';
|
||||
}
|
||||
|
||||
$allowedDomains = Db::getColumn('select email from trust_email');
|
||||
$domain = explode('@', $email)[1];
|
||||
|
||||
if (!in_array($domain, $allowedDomains)) {
|
||||
$error = 'Äàííûé ïî÷òîâûé ñåðâèñ èñïîëüçîâàòü íåëüçÿ.';
|
||||
}
|
||||
|
||||
return $error ?? '';
|
||||
}
|
||||
|
||||
public function hasGoodEmailCode(string $email, int $code): string
|
||||
{
|
||||
$check = Db::getValue('select code from secure_code where email = ?', [$email]);
|
||||
if ($code !== $check) {
|
||||
return 'Íåâåðíûé ïðîâåðî÷íûé êîä.';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function hasGoodPassword(string $password1, string $password2): string
|
||||
{
|
||||
if ($password1 !== $password2) {
|
||||
$error = 'Ïàðîëè íå ñîâïàäàþò';
|
||||
}
|
||||
if (strlen($password1 < 8)) {
|
||||
$error = 'Ïàðîëü äîëæåí áûòü áîëüøå 8 ñèìâîëîâ';
|
||||
$error .= 'Ìîæåòå èñïîëüçîâàòü ñãåíåðèðîâàííûé ïàðîëü: ' . PassGen::new();
|
||||
}
|
||||
return $error ?? '';
|
||||
}
|
||||
|
||||
public static function new(string $login, string $password, string $email, $ref, $birthday, $sex): string
|
||||
{
|
||||
Db::sql(
|
||||
'insert into users (users.real,login,host_reg,pass,ip,ipreg,room,timereg,activ,mail,bithday,sex,fnq,design,molch2,level,hobby,clan_zv) values (1,?,?,?,?,?,9,unix_timestamp(),0,?,?,?,0,1,unix_timestamp() + 86400,8,\'\',0)',
|
||||
[
|
||||
$login,
|
||||
(int)$ref,
|
||||
md5($password),
|
||||
UserIp::get(),
|
||||
UserIp::get(),
|
||||
$email,
|
||||
date('d.m.Y', strtotime($birthday)),
|
||||
$sex - 10,
|
||||
]
|
||||
);
|
||||
|
||||
return Db::lastInsertId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Insallah\Db;
|
||||
use Core\Db;
|
||||
|
||||
class UserStats
|
||||
{
|
||||
/**
|
||||
* Ñîáèðàåò ñóììû âñåõ áîíóñîâ ñ îäåòûõ ïðåäìåòîâ è àêòèâíûõ ýôåêòîâ.
|
||||
* @param $userId
|
||||
* @param int $userId
|
||||
* @param bool $showAll
|
||||
* @return array
|
||||
*/
|
||||
public static function getAllBonuses($userId, $showAll = false)
|
||||
public static function getAllBonuses(int $userId, bool $showAll = false): array
|
||||
{
|
||||
require_once '_incl_data/class/Insallah/Core/Db.php';
|
||||
$db = new Db();
|
||||
|
||||
$q = 'select data from items_users where uid = ? and inOdet > 0 and `delete` = 0
|
||||
union all select data from eff_users where uid = ? and `delete` = 0';
|
||||
$iData = $db::getColumn($q, [$userId, $userId]);
|
||||
$iData = Db::getColumn($q, [$userId, $userId]);
|
||||
$params = [];
|
||||
foreach ($iData as $datum) {
|
||||
foreach (explode('|', $datum) as $inner) {
|
||||
list($a, $b) = explode('=', $inner);
|
||||
[$a, $b] = explode('=', $inner);
|
||||
if (strpos($a, 'add') !== false || strpos($a, 'sv') !== false || $showAll) {
|
||||
if (isset($params[$a])) {
|
||||
$params[$a] += $b;
|
||||
|
||||
@@ -11,10 +11,8 @@ $db = [
|
||||
];
|
||||
$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d'];
|
||||
|
||||
include './_incl_data/mysql_override.php';
|
||||
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'mysql_override.php';
|
||||
|
||||
$dbgo = mysql_connect($db['s'], $db['u'], $db['p']);
|
||||
mysql_select_db($db['d'], $dbgo);
|
||||
mysql_query('SET NAMES cp1251');
|
||||
|
||||
$pdo = new PDO($dsn, $db['u'], $db['p'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES cp1251"]);
|
||||
|
||||
@@ -60,7 +60,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||
//
|
||||
$pvr['hp'] = floor($pvr['hp']);
|
||||
|
||||
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||
$pvr['promah_type'] = $pvr['hp'][3];
|
||||
$pvr['promah'] = $pvr['hp'][2];
|
||||
$pvr['krit'] = $pvr['hp'][1];
|
||||
$pvr['hp'] = $pvr['hp'][0];*/
|
||||
$pvr['hpSee'] = '--';
|
||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||
|
||||
@@ -108,5 +108,4 @@ if (
|
||||
$this->mintr($pl);
|
||||
}
|
||||
unset($pvr);
|
||||
?>
|
||||
?>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/**
|
||||
* Ïðèåì: Öåëü {ñòèõèÿ}
|
||||
* @var $this Priems
|
||||
* @var $btl Battle
|
||||
* @var $this priems
|
||||
* @var $btl battleClass
|
||||
* @var $id
|
||||
* @var $pl
|
||||
*/
|
||||
|
||||
@@ -41,12 +41,32 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
||||
$pvr['promah'] = $pvr['hp'][2];
|
||||
$pvr['krit'] = $pvr['hp'][1];
|
||||
$pvr['hp'] = $pvr['hp'][0];
|
||||
|
||||
/*//
|
||||
$pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']);
|
||||
$pvr['di'] = 0;
|
||||
$pvr['dc'] = count($pvr['data']['atgm']);
|
||||
$pvr['rd'] = 0;
|
||||
$pvr['redata'] = '';
|
||||
while( $pvr['di'] < 4 ) {
|
||||
if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) {
|
||||
if( $pvr['rd'] < 3 ) {
|
||||
$pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])];
|
||||
$pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata'];
|
||||
$pvr['rd']++;
|
||||
}
|
||||
}
|
||||
$pvr['di']++;
|
||||
}*/
|
||||
//
|
||||
$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata'];
|
||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||
//
|
||||
$pvr['hp'] = floor($pvr['hp']);
|
||||
|
||||
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||
$pvr['promah_type'] = $pvr['hp'][3];
|
||||
$pvr['promah'] = $pvr['hp'][2];
|
||||
$pvr['krit'] = $pvr['hp'][1];
|
||||
$pvr['hp'] = $pvr['hp'][0];*/
|
||||
$pvr['hpSee'] = '--';
|
||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||
|
||||
@@ -57,7 +57,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||
//
|
||||
$pvr['hp'] = floor($pvr['hp']);
|
||||
|
||||
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||
$pvr['promah_type'] = $pvr['hp'][3];
|
||||
$pvr['promah'] = $pvr['hp'][2];
|
||||
$pvr['krit'] = $pvr['hp'][1];
|
||||
$pvr['hp'] = $pvr['hp'][0];*/
|
||||
$pvr['hpSee'] = '--';
|
||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||
|
||||
@@ -59,7 +59,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||
//
|
||||
$pvr['hp'] = floor($pvr['hp']);
|
||||
|
||||
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäŕ', 0 );
|
||||
$pvr['promah_type'] = $pvr['hp'][3];
|
||||
$pvr['promah'] = $pvr['hp'][2];
|
||||
$pvr['krit'] = $pvr['hp'][1];
|
||||
$pvr['hp'] = $pvr['hp'][0];*/
|
||||
$pvr['hpSee'] = '--';
|
||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||
|
||||
@@ -56,6 +56,7 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is
|
||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||
//
|
||||
$pvr['hp'] = floor($pvr['hp']);
|
||||
//$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||
$pvr['promah_type'] = 0;
|
||||
$pvr['promah'] = false;
|
||||
$pvr['krit'] = false;
|
||||
|
||||
Reference in New Issue
Block a user