Рефакторинг заявок на поединок.

This commit is contained in:
Ivor Barhansky 2023-04-15 22:17:40 +03:00
parent 92318be837
commit f92aa003ac
17 changed files with 1733 additions and 4491 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace Core;
class ComparsionHelper
{
public static function minimax($value, $minimum, $maximum)
{
if ($value < $minimum) {
$value = $minimum;
}
if ($value > $maximum) {
$value = $maximum;
}
return $value;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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);
}
}

View File

@ -1,12 +1,14 @@
<?php
namespace Insallah;
namespace Tournament;
use Core\Db;
class Tournament
{
const IS_ENABLED = true;
const IS_ENABLED = false;
private const SEND_CHAT_MESSAGE = 3;
private const START_TOURNAMENT = 5;
public const START_TOURNAMENT = 5;
private const PRIZE1 = 25;
private const PRIZE2 = 10;
private const PRIZE3 = 5;
@ -72,12 +74,11 @@ class Tournament
*/
public function startAllBattles(): void
{
$db = new Db();
$db::sql(
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');
$tournamentLevels = Db::getColumn('select tid from tournaments where start_time = -1');
foreach ($tournamentLevels as $level) {
$aliveFighters = TournamentModel::getFreeFighters($level);
if (count($aliveFighters) > 1) {

View File

@ -1,6 +1,10 @@
<?php
namespace Insallah;
namespace Tournament;
use Chat;
use ChatMessage;
use Core\Db;
class TournamentModel
{
@ -15,8 +19,7 @@ class TournamentModel
*/
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]);
$level = Db::getValue('select level from users where id = ? and level between 8 and 12 and battle = 0', [$uid]);
return $level ?: 0;
}
@ -28,11 +31,10 @@ class TournamentModel
*/
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]);
$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]);
$wearedItemsEkrPrice = Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
return $wearedItemsEkrPrice > Tournament::ekrOverpriceFormula($level);
}
@ -43,9 +45,8 @@ class TournamentModel
*/
public static function isEnoughExperience(int $uid): bool
{
$db = new Db();
return $db::getValue('select exp from stats where id = ?', [$uid]) >= Tournament::MIN_EXP;
}
return Db::getValue('select exp from stats where id = ?', [$uid]) >= Tournament::MIN_EXP;
}
/**
* @param int $uid
@ -54,8 +55,7 @@ class TournamentModel
*/
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]);
return Db::getValue('select count(*) from eff_users where uid = ? and id_eff = 486 and `delete` = 0', [$uid]);
}
/**
@ -65,8 +65,7 @@ class TournamentModel
*/
public static function isStarted(int $tid): bool
{
$db = new Db();
return $db::getValue('select count(*) from tournaments where start_time = -1 and tid = ?', [$tid]);
return Db::getValue('select count(*) from tournaments where start_time = -1 and tid = ?', [$tid]);
}
/**
@ -78,8 +77,7 @@ class TournamentModel
*/
public static function getWaitingMembersQuantity(int $tid): int
{
$db = new Db();
return $db::getValue('select count(*) from tournaments_users where tid = ?', [$tid]);
return Db::getValue('select count(*) from tournaments_users where tid = ?', [$tid]);
}
/**
@ -91,8 +89,7 @@ class TournamentModel
*/
public static function createTournament(int $tid): void
{
$db = new Db();
$db::sql('insert into tournaments (tid) values (?)', [$tid]);
Db::sql('insert into tournaments (tid) values (?)', [$tid]);
}
/**
@ -107,8 +104,7 @@ class TournamentModel
{
/** Кастомные комнаты 25008 - 25012. */
$roomId = 25000 + $tid;
$db = new Db();
$db::sql('insert into tournaments_users (tid, uid) values (?, ?)', [$tid, $uid]);
Db::sql('insert into tournaments_users (tid, uid) values (?, ?)', [$tid, $uid]);
self::teleport($uid, $roomId);
}
@ -121,8 +117,7 @@ class TournamentModel
*/
public static function startTournament(int $tid): void
{
$db = new Db();
$db::sql('update tournaments set start_time = -1 where tid = ?', [$tid]);
Db::sql('update tournaments set start_time = -1 where tid = ?', [$tid]);
}
/**
@ -134,9 +129,8 @@ class TournamentModel
*/
public static function destroyTournament(int $tid): void
{
$db = new Db();
//Убедиться что в базе настроен foreign_keys и последует автоочистка tournaments_users !!!
$db::sql('delete from tournaments where tid = ?', [$tid]);
Db::sql('delete from tournaments where tid = ?', [$tid]);
}
/**
@ -148,9 +142,8 @@ class TournamentModel
*/
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);
return array_chunk(Db::getColumn($query), 2);
}
/**
@ -162,8 +155,9 @@ class TournamentModel
*/
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]);
return Db::getColumn(
'select uid from tournaments_users where tid = ? and death_time = 0 order by uid', [$tid]
);
}
/**
@ -175,12 +169,13 @@ class TournamentModel
*/
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]);
$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]
3 => $winners[2],
];
}
@ -210,8 +205,8 @@ class TournamentModel
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);
$row = Db::getRow($query);
return $row['uid'] ?? 0;
}
@ -228,8 +223,9 @@ class TournamentModel
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]);
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]);
@ -245,8 +241,7 @@ class TournamentModel
*/
public static function getTournamentIdByUserId(int $uid)
{
$db = new Db();
return $db::getValue('select tid from tournaments_users where uid = ?', [$uid]);
return Db::getValue('select tid from tournaments_users where uid = ?', [$uid]);
}
/**
@ -262,18 +257,19 @@ class TournamentModel
*/
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]);
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]);
}
/**
@ -285,8 +281,7 @@ class TournamentModel
*/
public static function uidToLogin(int $uid)
{
$db = new Db();
return $db::getValue('select login from users where id = ?', [$uid]);
return Db::getValue('select login from users where id = ?', [$uid]);
}
/**
@ -299,8 +294,7 @@ class TournamentModel
*/
private static function teleport(int $uid, int $roomId): void
{
$db = new Db();
$db::sql('update users set room = ? where id = ?', [$roomId, $uid]);
Db::sql('update users set room = ? where id = ?', [$roomId, $uid]);
}
/**
@ -315,12 +309,12 @@ class TournamentModel
if (empty($message)) {
return;
}
$cmsg = new \ChatMessage();
$cmsg = new ChatMessage();
$cmsg->setDa(1);
$cmsg->setType(6);
$cmsg->setText($message);
$cmsg->setColor('forestgreen');
(new \Chat())->sendMsg($cmsg);
(new Chat())->sendMsg($cmsg);
}
/**
@ -337,10 +331,9 @@ class TournamentModel
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'
'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);
$stmt = Db::prepare($query);
for ($i = 0; $i < $quantity; $i++) {
$stmt->execute($args);
}
@ -354,9 +347,8 @@ class TournamentModel
*/
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);
Db::sql($query, $args);
}
}

View File

@ -1,559 +0,0 @@
<?php
use Core\Db;
class Tournir
{
private User $u;
private array $info;
private array $user;
private array $name = [0 => 'Выжить любой ценой', 1 => 'Каждый сам за себя', 2 => 'Захват ключа',];
public function __construct()
{
$this->u = User::start();
$this->start();
$this->locationSee();
}
private function start()
{
$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 = 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 {
Db::sql('update turnirs set status = 3 where id = ?', [$this->info['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();
//Закидываем персонажей в поединок
Db::sql('update users set battle = ? where inUser = 0 and inTurnirnew = ?', [$uri, $this->info['id']]);
//Обозначаем завершение турнира при выходе
die('Перейтиде в раздел "поединки"...');
}
}
private function finishTurnir()
{
$chat = new Chat();
$cmsg = new ChatMessage();
$cmsg->setType(6);
$this->info = mysql_fetch_array(
mysql_query('SELECT * FROM `turnirs` WHERE `id` = ' . $this->u->info['inTurnirnew'])
);
if ($this->info['status'] != 3) {
return;
}
$win = '';
$lose = '';
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" ORDER BY `points` DESC'
);
while ($pl = mysql_fetch_array($sp)) {
mysql_query('DELETE FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '"');
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'));
$bot = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1'));
if (isset($inf['id'], $bot['id'])) {
//выдаем призы и т.д
mysql_query('DELETE FROM `users` WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000');
}
if ($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) {
$inf['add_expp'] = [0, 1, 5, 10, 15, 25, 35, 70, 100, 150, 200, 300, 500, 700, 1000];
//получаем опыт (с 0 по 12 лвл)
$inf['add_expn'] = [10, 30, 55, 62, 92, 180, 350, 1350, 4500, 7000, 21000, 30000, 35000];
$inf['add_expn'] = $inf['add_expn'][$inf['level']];
mysql_query(
'UPDATE `users` SET `win` = `win` + 1,`win_t` = `win_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `stats` SET `exp` = `exp` + ' . $inf['add_expn'] . ' WHERE `id` = "' . $inf['id'] . '" LIMIT 1'
);
$win .= '<b>' . $inf['login'] . '</b>, ';
$cmsg->setRoom($inf['room']);
$cmsg->setTo($inf['login']);
$cmsg->setText("Турнир завершен. Вы являетесь победителем турнира, получено опыта: <b>{$inf['add_expn']}</b>.");
$chat->sendMsg($cmsg);
} elseif ($pl['team'] != $this->info['winner'] && $this->info['winner'] != 0) {
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');
}
mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1');
}
mysql_query(
'UPDATE `users` SET `inUser` = 0,`inTurnirnew` = 0 WHERE `inTurnirnew` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']
);
mysql_query(
'UPDATE `turnirs` SET `chat` = 4 , `winner` = -1,`users_in` = 0,`status` = 0,`winner` = -1,`step` = 0,`time` = "' . (time(
) + $this->info['time2']) . '",`count` = `count` + 1 WHERE `id` = ' . $this->info['id'] . ' LIMIT 1'
);
if ($win != '') {
$win = rtrim($win, ', ');
$lose = rtrim($lose, ', ');
$win = 'Победители турнира: ' . $win . '. Проигравшая сторона: ' . $lose . '. Следующий турнир начнется через ' . $this->u->timeOut(
$this->info['time2']
) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').';
} else {
$win = 'Победители турнира отсутствует. Следующий турнир начнется через ' . $this->u->timeOut(
$this->info['time2']
) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').';
}
$cmsg->setText('<b>Турнир завершен.</b> ' . $win);
$chat->sendMsg($cmsg);
}
private function locationSee()
{
$r = '';
$tm1 = '';
$tm2 = '';
$noitm = [869 => 1, 1246 => 1, 155 => 1, 1245 => 1, 678 => 1];
//получение комплекта
if ($this->info['step'] != 3 && $this->info['step'] != 0 && isset($_GET['gocomplect']) && $this->user['points'] < 2) {
$aso = explode(',', $this->user['items']);
$ast = explode('-', $_GET['gocomplect']);
$asg = [];
$asj = [];
$asgp = [];
$i = 0;
while ($i < count($aso)) {
if ($aso[$i] > 0) {
$asg[$aso[$i]] = true;
}
$i++;
}
$i = 0;
$j = 0;
$noitm = 0;
$addi = 1;
while ($i < count($ast)) {
if ($ast[$i] > 0) {
if (!$asg[$ast[$i]]) {
$noitm++;
}
$itm = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inSlot`,`price1` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string(
$ast[$i]
) . '" LIMIT 1'
)
);
if (isset($itm['id'])) {
$itm2 = mysql_fetch_array(
mysql_query(
'SELECT `iid`,`price_1` FROM `items_shop` WHERE `item_id` = "' . mysql_real_escape_string(
$ast[$i]
) . '" AND `kolvo` > 0 LIMIT 1'
)
);
if ($itm2['price_1'] > $itm['price1']) {
$itm['price1'] = $itm2['price_1'];
}
if ($itm['inSlot'] == 3 || $itm['inSlot'] == 10) {
$asg[$itm['inSlot']][count($asg[$itm['inSlot']])] = $itm['id'];
$asgp[$itm['inSlot']][count($asgp[$itm['inSlot']])] = $itm['price1'];
} else {
$asg[$itm['inSlot']] = $itm['id'];
$asp[$itm['inSlot']] = $itm['price1'];
}
$j++;
}
}
$i++;
}
if ($noitm > 0) {
echo 'Использование багов карается законом!';
$addi = 0;
} elseif (count($asg[3]) > 2) {
echo 'Вы выбрали слишком много предметов, выберите только два оружия и один щит';
$addi = 0;
} elseif (count($asg[10]) > 3) {
echo 'Вы выбрали слишком много предметов, выберите только три кольца';
$addi = 0;
} elseif ($j > 16) {
echo 'Вы выбрали слишком много предметов';
$addi = 0;
} elseif ($j < 1) {
echo 'Выберите хотя бы один предмет';
$addi = 0;
}
if ($addi == 1) {
$i = 0;
while ($i <= 17) {
if ($i == 10) {
if ($asg[$i][0] > 0) {
$this->u->addItem($asg[$i][0], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i][0]);
}
if ($asg[$i][1] > 0) {
$this->u->addItem($asg[$i][1], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i][1]);
}
if ($asg[$i][2] > 0) {
$this->u->addItem($asg[$i][2], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i][2]);
}
} elseif ($i == 3) {
if ($asg[$i][0] > 0) {
$this->u->addItem($asg[$i][0], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i][0]);
}
if ($asg[$i][1] > 0) {
$this->u->addItem($asg[$i][1], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i][1]);
}
} elseif ($asg[$i] > 0) {
$this->u->addItem($asg[$i], $this->u->info['id']);
$this->user['points'] += 1 + round($asgp[$i]);
}
$i++;
}
mysql_query(
'UPDATE `users_turnirs` SET `points` = "' . $this->user['points'] . '",`items` = "0" WHERE `bot` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `stats` SET `ability` = "100",`skills` = "10" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `users` SET `level` = "12" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `turnirs` SET `step` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
$this->info['step'] = 0;
$this->info['items'] = '0';
}
}
if ($this->info['step'] == 3) {
$this->finishTurnir();
} elseif ($this->info['step'] == 0) {
//распределяем команды
$po = [0, 0];
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" AND `points` > 3 ORDER BY `points` DESC LIMIT ' . $this->info['users_in']
);
$tmr = rand(1, 2);
if ($tmr == 1) {
$tmr = [2, 1];
} else {
$tmr = [1, 2];
}
while ($pl = mysql_fetch_array($sp)) {
$inf = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')
);
$bot = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1')
);
if (isset($inf['id'], $bot['id'])) {
if ($po[1] == $po[2]) {
$tm = rand(1, 2);
} elseif ($po[1] > $po[2]) {
$tm = 2;
} else {
$tm = 1;
}
//$tm = $tmr[$tm];
$bot['team'] = $tm;
$po[$bot['team']] += $pl['points'];
mysql_query(
'UPDATE `stats` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `users_turnirs` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
}
}
mysql_query('UPDATE `turnirs` SET `step` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
}
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']
);
$po = [0, 0];
while ($pl = mysql_fetch_array($sp)) {
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'));
$bot = mysql_fetch_array(
mysql_query(
'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `u`.`id` = "' . $pl['bot'] . '" LIMIT 1'
)
);
if (isset($inf['id'], $bot['id'])) {
$po[$bot['team']] += $pl['points'];
//${'tm'.$bot['team']} .= '<b>'.$bot['login'].'</b> ['.$bot['level'].']<br>';
${'tm' . $bot['team']} .= $this->u->microLogin($bot, 2) . '<br>';
}
}
$r .= '<style>/* цвета команд */
.CSSteam0 { font-weight: bold; cursor:pointer; }
.CSSteam1 { font-weight: bold; color: #6666CC; cursor:pointer; }
.CSSteam2 { font-weight: bold; color: #B06A00; cursor:pointer; }
.CSSteam3 { font-weight: bold; color: #269088; cursor:pointer; }
.CSSteam4 { font-weight: bold; color: #A0AF20; cursor:pointer; }
.CSSteam5 { font-weight: bold; color: #0F79D3; cursor:pointer; }
.CSSteam6 { font-weight: bold; color: #D85E23; cursor:pointer; }
.CSSteam7 { font-weight: bold; color: #5C832F; cursor:pointer; }
.CSSteam8 { font-weight: bold; color: #842B61; cursor:pointer; }
.CSSteam9 { font-weight: bold; color: navy; cursor:pointer; }
.CSSvs { font-weight: bold; }</style>';
$r .= '<h3>&laquo;' . $this->name[$this->info['type']] . '&raquo;</h3><br>Начало турнира через ' . $this->u->timeOut(
$this->info['time'] - time()
) . '! ';
if (isset($_GET['hpregenNowTurnir']) && ($this->u->stats['hpNow'] < $this->u->stats['hpAll'] || $this->u->stats['mpNow'] < $this->u->stats['mpAll'])) {
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->u->stats['hpAll'] . '",`mpNow` = "' . $this->u->stats['mpAll'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
}
if ($this->user['points'] < 3) {
//Еще не получили обмундирование
if ($this->user['points'] < 2) {
$r .= '<INPUT class=\'btn_grey\' onClick="selectItmSave()" TYPE=button name=tmp value="Получить обмундирование">';
} else {
$r .= ' <INPUT class=\'btn_grey\' onClick="location=\'main.php\';" TYPE=button name=tmp value="Я готов';
if ($this->u->info['sex'] == 1) {
$r .= 'а';
}
$r .= '!">';
}
} else {
$r .= '<small><b>Вы участвуете в турнире!</b></small>';
$r .= ' &nbsp; <INPUT class=\'btn_grey\' onClick="location.href=\'main.php?hpregenNowTurnir=1\'" TYPE=button name=tmp value="Восстановить HP и MP">';
}
$r .= '<div style="float:right"><INPUT onClick="location=\'main.php\';" TYPE=button name=tmp value="Обновить"></div>';
if ($this->user['points'] < 3 && $this->user['items'] != '0') {
$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
if ($this->user['items'] == '') {
//Выдаем предметы для выбора
$ai = '';
$sp = mysql_query(
'SELECT `a`.*,`b`.* FROM `items_shop` AS `a` LEFT JOIN `items_main` AS `b` ON (`a`.`item_id` = `b`.`id`) WHERE `a`.`sid` = 1 AND
(`a`.`r` != 5 AND `a`.`r` != 9 AND `a`.`r` <= 18 AND `a`.`kolvo` > 0 AND `cantBuy` = 0 AND `a`.`level` < 9 AND `b`.`level` < 9) AND
`b`.`class` != 6'
);
while ($pl = mysql_fetch_array($sp)) {
if (!isset($noitm[$pl['item_id']])) {
$aso[$pl['inslot']][count($aso[$pl['inslot']])] = $pl;
}
}
$j = 1;
$com = [];
while ($j <= 5) {
$i = 0;
while ($i <= 17) {
if ($i == 3) {
//
$com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)];
} elseif ($i == 14) {
//правая рука
$com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)];
} else {
//обмундирование
$com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)];
if ($i == 10) {
$ai .= $com[$i]['id'] . ',';
$com[$i] = $aso[$i][rand(0, count($aso[$i]) - 1)];
$ai .= $com[$i]['id'] . ',';
}
}
if ($com[$i]['id'] > 0 && $i != 10) {
$ai .= $com[$i]['id'] . ',';
}
$i++;
}
$j++;
}
unset($com);
$ai .= '0';
$this->user['items'] = $ai;
mysql_query(
'UPDATE `users_turnirs` SET `items` = "' . $ai . '" WHERE `id` = "' . $this->user['id'] . '" LIMIT 1'
);
}
//Выводим предметы чтобы надеть их
$ai = explode(',', $this->user['items']);
$i = 0;
$ia = [];
while ($i < count($ai)) {
if ($ai[$i] > 0) {
$pli = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inSlot`,`name`,`type`,`img`,`level` FROM `items_main` WHERE `id` = "' . $ai[$i] . '" LIMIT 1'
)
);
$ia[$pli['inSlot']][count($ia[$pli['inSlot']])] = $pli;
unset($pli);
}
$i++;
}
unset($ai);
$r .= '<b>Выберите предметы для турнира:</b><br>';
?>
<style>
.its0 {
margin: 2px;
cursor: pointer;
filter: DXImageTransform.Microsoft.BasicImage(grayscale=1);
-ms-filter: DXImageTransform.Microsoft.BasicImage(grayscale=1);
-webkit-filter: grayscale(100%);
}
.its1 {
background-color: #ee9898;
margin: 1px;
border: 1px solid #b16060;
}
</style>
<script>
var set = [];
set[3] = [0, 0, 0];
set[10] = [0, 0, 0, 0];
function selectItmAdd(x, y, id, s) {
if (s != 10 && s != 3) {
if (set[s] != undefined && set[s] != 0) {
$('#it_' + set[s][1] + '_' + set[s][2]).attr('class', 'its0');
set[s] = 0;
}
set[s] = [id, x, y];
$('#it_' + x + '_' + y).attr('class', 'its1');
} else if (s == 10) {
if (set[s][0] > 2) {
$('#it_' + set[s][1][1] + '_' + set[s][1][2]).attr('class', 'its0');
$('#it_' + set[s][2][1] + '_' + set[s][2][2]).attr('class', 'its0');
$('#it_' + set[s][3][1] + '_' + set[s][3][2]).attr('class', 'its0');
set[s] = [0, 0, 0, 0];
}
if (set[s][1] == 0) {
set[s][1] = [id, x, y];
} else if (set[s][2] == 0) {
set[s][2] = [id, x, y];
} else if (set[s][3] == 0) {
set[s][3] = [id, x, y];
}
set[s][0]++;
$('#it_' + x + '_' + y).attr('class', 'its1');
} else if (s == 3) {
if (set[s][0] > 1) {
$('#it_' + set[s][1][1] + '_' + set[s][1][2]).attr('class', 'its0');
$('#it_' + set[s][2][1] + '_' + set[s][2][2]).attr('class', 'its0');
set[s] = [0, 0, 0];
}
if (set[s][1] == 0) {
set[s][1] = [id, x, y];
} else if (set[s][2] == 0) {
set[s][2] = [id, x, y];
}
set[s][0]++;
$('#it_' + x + '_' + y).attr('class', 'its1');
}
}
function selectItmSave() {
var i = 0;
var r = '';
while (i <= 17) {
if (set[i] != undefined) {
if (i == 10) {
if (set[i][1][0] != undefined) {
r += set[i][1][0] + '-';
}
if (set[i][2][0] != undefined) {
r += set[i][2][0] + '-';
}
if (set[i][3][0] != undefined) {
r += set[i][3][0] + '-';
}
} else if (i == 3) {
if (set[i][1][0] != undefined) {
r += set[i][1][0] + '-';
}
if (set[i][2][0] != undefined) {
r += set[i][2][0] + '-';
}
} else {
if (set[i][0] != undefined) {
r += set[i][0] + '-';
}
}
}
i++;
}
location = "main.php?gocomplect=" + r;
}
</script>
<?php
$i = 0;
while ($i <= 17) {
if (count($ia[$i]) > 0) {
$j = 0;
while ($j < count($ia[$i])) {
$r .= '<img id="it_' . $i . '_' . $j . '" onclick="selectItmAdd(' . $i . ',' . $j . ',' . $ia[$i][$j]['id'] . ',' . $ia[$i][$j]['inSlot'] . ');" class="its0" title="' . $ia[$i][$j]['name'] . '" src="//img.new-combats.tech/i/items/' . $ia[$i][$j]['img'] . '">';
$j++;
}
$r .= '<br>';
}
$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">
<tr>
<td width="350" align="center" bgcolor="#99cccc"><b class="CSSteam1">Команда 1</b></td>
<td align="center" bgcolor="#99cccc"><b class="CSSteam2">Команда 2</b></td>
</tr>
<tr>
<td align="center" style="border-right:1px solid #99cccc">' . rtrim($tm1, ', ') . '</td>
<td align="center">' . rtrim($tm2, ', ') . '</td>
</tr>
</table>';
if (($this->info['time'] - time() < 0) && $this->info['step'] == 1) {
//начинаем турнир
$this->startTurnir();
}
echo $r;
}
}

View File

@ -2599,7 +2599,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null)
{
if ($clon != null) {
$r = false;
$r = 0;
if (!is_array($clon)) {
$clon = $this->getUserInfoById((int)$clon);
}
@ -11887,4 +11887,22 @@ LIMIT 1'
Db::sql('update users set online = unix_timestamp() where id = ?', [$uid]);
}
public function isModerator(): bool
{
return $this->isAdmin() || $this->info['align'] > 3 && $this->info['align'] < 4;
}
public function isAdmin(): bool
{
return $this->info['admin'] > 0;
}
/** Игрок имеет меньше 30% хп.
* @return bool
*/
public function isWeakened(): bool
{
return $this->stats['hpNow'] < ceil($this->stats['hpMax'] / 100 * 30);
}
}

View File

@ -0,0 +1,25 @@
<?php
use Core\Db;
class UserEffects
{
/** Äàòü èãðîêó ýôôåêò.
* @param int $uid id èãðîêà
* @param int $id id ýôôåêòà
* @return void
*/
public static function addById(int $uid, int $id)
{
$eff = Db::getRow('select mname, mdata, oneType, id2 from eff_main where id2 = ?', [$id]);
if (!$eff['id2']) {
return;
}
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']]
);
}
}

View File

@ -31,4 +31,31 @@ union all select data from eff_users where uid = ? and `delete` = 0';
}
return $params;
}
/** Данные для отрисовки логина и полосок жизни\маны.
* @param User $u
* @return object
*/
public static function getLoginHpManaBars(User $u): object
{
$hpNow = floor($u->stats['hpNow']);
$hpAll = $u->stats['hpAll'];
$mpNow = floor($u->stats['mpNow']);
$mpAll = $u->stats['mpAll'];
//floor(120 / 100 * ($hpNow / $hpAll * 100)); // ??????
$ph = ($hpAll > 0 && $hpNow > 0) ? floor(120 / $hpNow / $hpAll) : 0;
$pm = ($mpAll > 0 && $mpNow > 0) ? floor(120 / $mpNow / $mpAll) : 0;
return (object)[
'uid' => $u->info['id'],
'login' => $u->microLogin($u->info['id']),
'hpbarwidth' => $ph,
'mpbarwidth' => $pm,
'hpbartext' => ' ' . $hpNow . '/' . $hpAll,
'mpbartext' => ' ' . $mpNow . '/' . $mpAll,
'divstyle' => $pm === 0 ? ' margin-top:13px;' : '',
'hasmana' => $mpAll > 0,
];
}
}

View File

@ -1,20 +0,0 @@
<?php
if(isset($_GET['test'])) {
echo 'Тест 5<br>'.$_GET['test'].'<br>'.$_POST['test_post'].'';
die();
}
echo 'Тест 1<br>';
?>
<script src="/js/jquery.js" type="text/javascript"></script>
<script>
function test() {
$('#test_side').html( 'Тест 3' );
$.post('/ajax.php?test=Тест 6&',{'test_post':'Тест7'},function(data){ $('#test_block').html( data ); });
}
</script>
Тест 2<br>
<div id="test_side"></div>
<div id="test_block"></div>
<br><br>
<a href="javascript:test();">Протестировать запрос</a>

View File

@ -1,69 +0,0 @@
// if (document.documentElement.clientWidth >= 414 && document.documentElement.clientWidth <= 736 ) {
// console.log(document.documentElement.clientWidth)
// console.log(document.documentElement.clientHeight)
// // var $reline2 = document.getElementById("reline2")
// var $chatMobile = document.getElementsByClassName("allChat")
// var $arrayChatWindow = Array.from($chatMobile)
// var $onlineList = document.getElementById("online_list")
// var $online = document.getElementById("online")
// var $chatList = document.getElementById("chat_list")
// var $chat_menus = document.getElementById("chat_menus")
// // var $cb1 = document.getElementById("cb1")
// // var $cb2 = document.getElementById("cb2")
// var $globalMain = document.getElementById("globalMain")
// for (let key of $arrayChatWindow) {
// key.hidden = true
// }
// // $reline2.hidden = true
// // Кнопка показа чата
// var $buttonChat = document.createElement("button")
// $buttonChat.id = "buttonHiddenChat"
// $buttonChat.textContent = "Показать чат"
// // $buttonChat.style.width = "100%"
// // $buttonChat.style.fontSize = "17pt"
// // $buttonChat.style.position = "fixed"
// $buttonChat.style.top = `${document.documentElement.clientHeight - 33}px`
// document.body.append($buttonChat)
// document.body.addEventListener("click", function (event) {
// if (event.target == $buttonChat) {
// if ($buttonChat.textContent == "Показать чат") {
// $buttonChat.textContent = "Скрыть чат"
// // for (let key of $arrayChatWindow) {
// // key.hidden = false
// // }
// $arrayChatWindow[0].hidden = false
// $onlineList.hidden = true
// $online.hidden = true
// // $chat_menus.display = "none"
// // $chatList.style.width = "410px"
// // var $p = document.createElement("p")
// // $p.textContent = "Онлайн"
// // document.getElementById("chat_menus").prepend(`<button>Онлайн</button>`)
// return
// }
// $buttonChat.textContent = "Показать чат"
// $arrayChatWindow[0].hidden = true
// // for (let key of $arrayChatWindow) {
// // key.hidden = true
// // }
// }
// })
// }

View File

@ -1,278 +0,0 @@
<?php
if (!defined('GAME')) {
die();
}
class turnir
{
public $info, $user, $name = [
0 => 'Выжить любой ценой',
1 => 'Каждый сам за себя',
2 => 'Захват ключа',
];
public function start()
{
global $c, $u;
$this->info = mysql_fetch_array(
mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $u->info['inTurnir'] . '" LIMIT 1')
);
$this->user = mysql_fetch_array(
mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $u->info['inTurnir'] . '" AND `bot` = "' . $u->info['id'] . '" LIMIT 1'
)
);
}
public function startTurnir()
{
global $c, $u;
$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) {
//Создание поединка
mysql_query(
'INSERT INTO `battle` (`city`,`time_start`,`timeout`,`type`,`turnir`) VALUES ("' . $u->info['city'] . '","' . time(
) . '","60","1","' . $this->info['id'] . '")'
);
$uri = mysql_insert_id();
//Закидываем персонажей в поединок
mysql_query(
'UPDATE `users` SET `battle` = "' . $uri . '" WHERE `inUser` = "0" AND `inTurnir` = "' . $this->info['id'] . '"'
);
//Обозначаем завершение турнира при выходе
mysql_query('UPDATE `turnirs` SET `status` = "3" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
die('Перейтиде в раздел "поединки"...');
} else {
if ($this->info['status'] == 3) {
$this->finishTurnir();
}
}
}
public function finishTurnir()
{
global $c, $u;
$this->info = mysql_fetch_array(
mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $u->info['inTurnir'] . '" LIMIT 1')
);
//mysql_query('UPDATE `users` SET `inUser` = 0, `inTurnir` = 0 WHERE `inTurnir` = '.$this->info['id'].' AND `inUser` > 0 LIMIT '.$this->info['users_in']);
if ($this->info['status'] == 3) {
$win = '';
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" ORDER BY `points` DESC LIMIT ' . $this->info['users_in']
);
while ($pl = mysql_fetch_array($sp)) {
$inf = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')
);
$bot = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1')
);
if (isset($inf['id'], $bot['id'])) {
//выдаем призы и т.д
mysql_query('DELETE FROM `users` WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $bot['id'] . '" LIMIT 1000');
}
if ($bot['win'] > 0 && $bot['lose'] < 1) {
$win .= '<b>' . $inf['login'] . '</b>, ';
}
}
mysql_query(
'UPDATE `users` SET `inUser` = "0",`inTurnir` = "0" WHERE `inTurnir` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']
);
mysql_query(
'UPDATE `turnirs` SET `users_in` = 0,`status` = 0,`winner` = -1,`step` = 0,`time` = "' . (time(
) + $this->info['time2']) . '",`count` = `count` + 1 WHERE `id` = ' . $this->info['id'] . ' LIMIT 1'
);
if ($win != '') {
$win = rtrim($win, ', ');
$win = 'Победители турнира: ' . $win . '. Следующий турнир начнется через ' . $u->timeOut(
$this->info['time2']
) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').';
} else {
$win = 'Победители турнира отсутствует. Следующий турнир начнется через ' . $u->timeOut(
$this->info['time2']
) . ' (' . date('d.m.Y H:i', (time() + $this->info['time2'])) . ').';
}
$r = '<b>Турнир &laquo;' . $this->name[$this->info['type']] . ' [' . $this->info['level'] . '] №' . $this->info['count'] . '&raquo; завершился!</b> ' . $win;
mysql_query(
'DELETE FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']
);
$cmsg = new ChatMessage();
$cmsg->setType(6);
$cmsg->setText($r);
(new Chat())->sendMsg($cmsg);
}
}
public function locationSee()
{
global $c, $u;
$r = '';
$tm1 = '';
$tm2 = '';
if ($this->info['step'] != 3 && $this->info['step'] != 0) {
//получение комплекта
if (isset($_GET['gocomplect']) && $this->user['points'] < 2) {
$aso = [];
$noitm = [
869 => 1,
];
$sp = mysql_query(
'SELECT `id`,`price1`,`inslot`,`price2` FROM `items_main` WHERE `inslot` > 0 AND `inslot` <= 26 AND `inslot` != 25 AND `inslot` != 24 AND `inslot` != 23 AND `inslot` != 16 AND `inslot` != 17 AND `inslot` != 2 AND `price2` = 0'
);
while ($pl = mysql_fetch_array($sp)) {
if (!isset($noitm[$pl['id']])) {
$aso[$pl['inslot']][count($aso[$pl['inslot']])] = $pl;
}
}
$i = 0;
$com = [];
while ($i <= 17) {
if ($i == 16) {
//левая рука
} elseif ($i == 17) {
//правая рука
} else {
//обмундирование
$com[$i] = $aso[$i][rand(0, count($aso[$i]))];
}
if ($com[$i]['id'] > 0) {
$u->addItem($com[$i]['id'], $u->info['id']);
$this->user['points'] += $com[$i]['price1'];
}
echo ',' . $com[$i];
$i++;
}
mysql_query(
'UPDATE `users_turnirs` SET `points` = "' . $this->user['points'] . '" WHERE `bot` = "' . $u->info['id'] . '" LIMIT 1'
);
$this->info['step'] == 0;
}
}
if ($this->info['step'] == 3) {
$this->finishTurnir();
} elseif ($this->info['step'] == 0) {
//распределяем команды
$po = [0, 0];
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" ORDER BY `points` DESC LIMIT ' . $this->info['users_in']
);
$tmr = rand(1, 2);
if ($tmr == 1) {
$tmr = [2, 1];
} else {
$tmr = [1, 2];
}
while ($pl = mysql_fetch_array($sp)) {
$inf = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1')
);
$bot = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['bot'] . '" LIMIT 1')
);
if (isset($inf['id'], $bot['id'])) {
if ($po[1] == $po[2]) {
$tm = rand(1, 2);
} elseif ($po[1] > $po[2]) {
$tm = 2;
} else {
$tm = 1;
}
//$tm = $tmr[$tm];
$bot['team'] = $tm;
$po[$bot['team']] += $pl['points'];
mysql_query(
'UPDATE `stats` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `users_turnirs` SET `team` = "' . $bot['team'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
}
}
mysql_query(
'UPDATE `turnirs` SET `step` = "1",`time` = "' . (time(
) + $this->info['time3']) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
}
$sp = mysql_query(
'SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->info['id'] . '" LIMIT ' . $this->info['users_in']
);
$po = [0, 0];
while ($pl = mysql_fetch_array($sp)) {
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'));
$bot = mysql_fetch_array(
mysql_query(
'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `u`.`id` = "' . $pl['bot'] . '" LIMIT 1'
)
);
if (isset($inf['id'], $bot['id'])) {
$po[$bot['team']] += $pl['points'];
${'tm' . $bot['team']} .= '<b>' . $bot['login'] . '</b> [' . $bot['level'] . '], ';
}
}
$r .= '<style>/* цвета команд */
.CSSteam0 { font-weight: bold; cursor:pointer; }
.CSSteam1 { font-weight: bold; color: #6666CC; cursor:pointer; }
.CSSteam2 { font-weight: bold; color: #B06A00; cursor:pointer; }
.CSSteam3 { font-weight: bold; color: #269088; cursor:pointer; }
.CSSteam4 { font-weight: bold; color: #A0AF20; cursor:pointer; }
.CSSteam5 { font-weight: bold; color: #0F79D3; cursor:pointer; }
.CSSteam6 { font-weight: bold; color: #D85E23; cursor:pointer; }
.CSSteam7 { font-weight: bold; color: #5C832F; cursor:pointer; }
.CSSteam8 { font-weight: bold; color: #842B61; cursor:pointer; }
.CSSteam9 { font-weight: bold; color: navy; cursor:pointer; }
.CSSvs { font-weight: bold; }</style>';
$r .= '<h3>&laquo;' . $this->name[$this->info['type']] . '&raquo;</h3><br>Начало турнира через ' . $u->timeOut(
$this->info['time'] - time()
) . '! ';
if ($this->user['points'] < 3) {
//Еще не получили обмундирование
if ($this->user['points'] < 2) {
$r .= '<INPUT class=\'btn_grey\' onClick="location=\'main.php?gocomplect=1\';" TYPE=button name=tmp value="Получить обмундирование">';
} else {
$r .= ' <INPUT class=\'btn_grey\' onClick="location=\'main.php\';" TYPE=button name=tmp value="Я готов';
if ($u->info['sex'] == 1) {
$r .= 'а';
}
$r .= '!">';
}
} else {
$r .= '<small><b>Вы участвуете в турнире!</b></small>';
}
$r .= '<div style="float:right"><INPUT onClick="location=\'main.php\';" TYPE=button name=tmp value="Обновить"></div><hr>';
$r .= '<b class="CSSteam1">Команда №1</b>: ' . rtrim($tm1, ', ');
$r .= '<br><b class="CSSteam2">Команда №2</b>: ' . rtrim($tm2, ', ');
if (($this->info['time'] - time() < 0) && $this->info['step'] == 1) {
//начинаем турнир
$this->startTurnir();
}
echo $r;
}
}
$tur = new turnir;
$tur->start();

View File

@ -1,443 +0,0 @@
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
if(!defined('GAME')) {
die();
}
$slot = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal_slot` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
if(!isset($slot['id'])) {
if( mysql_query('INSERT INTO `users_animal_slot` ( `uid`,`slots`,`ekr` ) VALUES ( "'.$u->info['id'].'","2","0" )') ) {
$slot = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal_slot` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
}else{
$u->error = 'Ошибка в работе базы данных...';
}
}
$slot['price_next'] = 5;
$petox = mysql_fetch_array(mysql_query('SELECT * FROM `obraz_pet` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
$petox = $petox[0];
$an_eda = array(
0.05,
0.07,
0.10,
0.15,
0.20,
0.30,
0.40,
0.50,
0.60,
0.70,
0.80,
1.00,
1.50,
2.00,
2.50,
3.00,
3.50,
4.00,
4.50,
5.00,
5.50,
7.00
);
function en_ru($txt) {
$g = false;
$en = preg_match("/^(([0-9a-zA-Z _-])+)$/i", $txt);
$ru = preg_match("/^(([0-9а-яА-Я _-])+)$/i", $txt);
if(($ru && $en) || (!$ru && !$en)) {
$g = true;
}
return $g;
}
//
function testBad($txt) {
$white = '-_ 0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёйцукенгшщзхъфывапролджэячсмитьбю';
$r = false;
$i = 0;
while( $i != -1 ) {
if( isset($txt[$i]) ) {
$g = false;
$j = 0;
while( $j != -1 ) {
if(isset($white[$j])) {
if( $white[$j] == $txt[$i] ) {
$g = true;
}
}else{
$j = -2;
}
$j++;
}
if( $g == false ) {
$r = true;
}
}else{
$i = -2;
}
$i++;
}
return $r;
}
function is_login_an($login) {
$r = true;
//
$login = htmlspecialchars($login,NULL);
//
$bad = array(
'Мусорщик' => 1,
'Мироздатель' => 1
);
//
//$login_db = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "'.mysql_real_escape_string($login).'" LIMIT 1'));
//$login_an_db = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_animal` WHERE `name` = "'.mysql_real_escape_string($login).'" LIMIT 1'));
if( isset($login_db['id']) || isset($login_an_db['id']) || isset($bad[$login]) ) {
$r = false;
}else{
$true = true;
//
/*
Логин может содержать от 2 до 16 символов, и состоять только из букв русского ИЛИ английского алфавита, цифр, символов '_', '-' и пробела.
Логин не может начинаться или заканчиваться символами '_', '-' или пробелом.
*/
//
$login = str_replace(' ',' ',$login);
$login = str_replace('%',' ',$login);
$login = str_replace('&nbsp;',' ',$login);
//
if( strlen($login) > 16 ) {
$true = false;
}elseif( strlen($login) < 2 ) {
$true = false;
}elseif( strripos($login,' ') == true ) {
$true = false;
}elseif( substr($login,1) == ' ' || substr($login,-1) == ' ' ) {
$true = false;
}elseif( substr($login,1) == '-' || substr($login,-1) == '-' ) {
$true = false;
}elseif( substr($login,1) == '_' || substr($login,-1) == '_' ) {
$true = false;
}elseif( testBad($login) == true ) {
$true = false;
}elseif( en_ru(str_replace('ё','е',str_replace('Ё','Е',$login))) == true ) {
$true = false;
}
//
if( $true == false ) {
$r = false;
}else{
$r = true;
}
}
return $r;
}
if(isset($_GET['buy_slot'])) {
if($u->info['money2'] < $slot['price_nex']) {
$u->error = 'Недостаточно денег';
}elseif($u->info['money2'] < 5 ) {
$u->error = 'Недостаточно екр!';
}elseif( isset($slot['id']) && $slot['slots'] < 7 ) {
$slot['slots']++;
$u->info['money2'] -= 5;
mysql_query('UPDATE `users_animal_slot` SET `slots` = "'.$slot['slots'].'" WHERE `id` = "'.$slot['id'].'" LIMIT 1');
mysql_query('UPDATE `users` SET `money2` = "'.$u->info['money2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
$u->error = 'Куплен слот для зверя.';
}else{
$u->error = 'Нельзя купить больше слотов';
}
}elseif(isset($_GET['pet'])) {
$_GET['pet'] = round((int)$_GET['pet']);
$_GET['petname'] = htmlspecialchars($_GET['petname'],NULL);
$ax = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users_animal` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 LIMIT 1'));
$ax = $ax[0];
if( $_GET['pet'] < 1 || $_GET['pet'] > 7 ) {
$u->error = 'Нельзя привзвать такого зверя';
}elseif( $ax >= $slot['slots'] ) {
$u->error = 'Нет свободных слотов для зверя';
}elseif( $u->info['money'] < 50 ) {
$u->error = 'Недостаточно денег';
}elseif(is_login_an($_GET['petname']) == false) {
$u->error = 'Неверная кличка зверя, выберите другую';
}else{
$u->error = 'Зверь пришел к Вам!';
$u->info['money'] -= 50;
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
//
$anm['type'] = $_GET['pet'];
//
if($anm['type']==1)
{
$anm['name'] = 'Кот';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'20864.gif',2=>'21301.gif',3=>'21139.gif',4=>'20427.gif');
$anm['stats'] = 's1=2|s2=5|s3=2|s4=5|rinv=40|m9=5|m6=10';
}elseif($anm['type']==2)
{
$anm['name'] = 'Сова';
$anm['sex'] = 1;
$anm['obraz'] = array(1=>'21415.gif',2=>'21722.gif',3=>'21550.gif');
$anm['stats'] = 's1=2|s2=2|s3=5|s4=5|rinv=40|m9=5|m6=10';
}elseif($anm['type']==3)
{
$anm['name'] = 'Светляк';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'22277.gif',2=>'22265.gif',3=>'22333.gif',4=>'22298.gif');
$anm['stats'] = 's1=3|s2=10|s3=3|s4=4|rinv=40|m9=5|m6=10';
}elseif($anm['type']==4)
{
$anm['name'] = 'Чертяка';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'22177.gif',2=>'21976.gif',3=>'21877.gif');
$anm['stats'] = 's1=25|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10';
}elseif($anm['type']==5)
{
$anm['name'] = 'Пес';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'22352.gif',2=>'23024.gif',3=>'22900.gif',4=>'22501.gif',5=>'22700.gif');
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
}elseif($anm['type']==6)
{
$anm['name'] = 'Свин';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'24000.gif',2=>'25000.gif',3=>'27000.gif',4=>'28000.gif');
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
}elseif($anm['type']==7)
{
$anm['name'] = 'Дракон';
$anm['sex'] = 0;
$anm['obraz'] = array(1=>'21338_pgtpdbx.gif');
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
}
//
$anm['name'] = $_GET['petname'];
//
$anm['obraz'] = $anm['obraz'][rand(1,count($anm['obraz']))];
$anm['obraz'] = str_replace('.gif','',$anm['obraz']);
$anm['obraz'] = str_replace('.jpg','',$anm['obraz']);
$anm['obraz'] = str_replace('.png','',$anm['obraz']);
$ins = mysql_query('INSERT INTO `users_animal` (`type`,`name`,`uid`,`obraz`,`stats`,`sex`,`eda`) VALUES ("'.$anm['type'].'","'.$anm['name'].'","'.$u->info['id'].'","'.$anm['obraz'].'","'.$anm['stats'].'","'.$anm['sex'].'","0")');
if($ins)
{
$u->addDelo(1,$u->info['id'],'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж призвал зверя &quot;'.$_GET['petname'].'&quot; ('.$_GET['pet'].') - 50 кр.',time(),$u->info['city'],'System.inventory',0,0);
}else{
$u->error = 'Не удалось призвать зверя, что-то здесь не так ...';
}
//
}
//
}elseif(isset($_GET['eda'])) {
$anm = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `id` = "'.mysql_real_escape_string($_GET['eda']).'" AND `uid` = "'.$u->info['id'].'" AND `delete` = 0 LIMIT 1'));
$x = round((int)$_GET['vvv']);
if($x > 100 - $anm['eda']) { $x = 100 - $anm['eda']; }
if($x < 1) { $x = 1; }
if($x > 100) { $x = 100; }
if(!isset($anm['id'])) {
$u->error = 'Зверь не найден.';
}elseif( $anm['eda'] >= 100 ) {
$u->error = 'Зверь сыт и не нуждается в еде.';
}elseif($an_eda[$anm['level']]*$_GET['vvv'] > $u->info['money']) {
$u->error = 'Недостаточно денег.';
}else{
$u->error = 'Покормили зверя &quot;'.$anm['name'].'&quot; на '.$x.' ед. за '.($x*$an_eda[$anm['level']]).' кр.';
$u->info['money'] -= ($x*$an_eda[$anm['level']]);
$anm['eda'] += $x;
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `users_animal` SET `eda` = "'.$anm['eda'].'" WHERE `id` = "'.$anm['id'].'" LIMIT 1');
}
}elseif(isset($_GET['pet_del'])) {
if(mysql_query('UPDATE `users_animal` SET `delete` = "'.time().'" WHERE `id` = "'.mysql_real_escape_string($_GET['pet_del']).'" AND `delete` = 0 AND `uid` = "'.$u->info['id'].'" LIMIT 1')) {
$u->error = 'Зверь был выгнан.';
}else{
$u->error = 'Зверь не найден.';
}
}elseif(isset($_GET['rename'])) {
$anm = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `id` = "'.mysql_real_escape_string($_GET['rename']).'" AND `uid` = "'.$u->info['id'].'" AND `delete` = 0 LIMIT 1'));
$_GET['vvv'] = htmlspecialchars($_GET['vvv'],NULL);
if(!isset($anm['id'])) {
$u->error = 'Зверь не найден.';
}elseif(30 > $u->info['money']) {
$u->error = 'Недостаточно денег.';
}else{
$u->info['money'] -= 30;
$anm['name'] = $_GET['vvv'];
$u->error = 'Кличка зверя изменена на &quot;'.$anm['name'].'&quot; за 30 кр.';
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `users_animal` SET `name` = "'.$anm['name'].'" WHERE `id` = "'.$anm['id'].'" LIMIT 1');
}
}elseif(isset($_GET['shadow']) && $petox > 0) {
if(isset($_GET['rechange'])) {
$u->error = 'Образ питомца снят.';
mysql_query('UPDATE `obraz_pet` SET `use` = 0 WHERE `uid` = "'.$u->info['id'].'"');
}elseif(isset($_GET['change'])) {
$u->error = 'Образ питомца установлен.';
mysql_query('UPDATE `obraz_pet` SET `use` = 0 WHERE `uid` = "'.$u->info['id'].'"');
mysql_query('UPDATE `obraz_pet` SET `use` = 1 WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['change']).'" LIMIT 1');
}
}
?>
<style>
.an_border {
border:1px solid #aaaaaa;
padding:2px;
width:120px;
height:220px;
}
.an_btn {
cursor:pointer;
}
.an_btn:hover {
cursor:pointer;
background-color:#cccccc;
}
.an_img64x64 {
padding-top:75px;
height:145px;
}
.an_line {
text-align:center;
padding:5px;
}
.an_line2 {
text-align:left;
padding:5px;
width:124px;
}
.an_w120 {
width:120px;
}
.cp {
cursor:pointer;
}
.obrsl1 {
border:1px solid #888;
padding:1px;
margin-bottom:5px;
}
.obrsl1d {
display:inline-block;
widows:120px;
}
</style>
<center><b>Ваши деньги:<font color=darkgreen> <?=$u->info['money']?> кр.</center></b></font>
<div align="right">
<?php
if(!isset($_GET['shadow']) || $petox == 0 ) {
if( $petox > 0 ) {
echo '<button onClick="location.href=\'/main.php?newanimal&shadow\';" class="btn btn-success">Образ</button>&nbsp;';
}else{
echo '<button disabled="disabled" onClick="alert(\'Установка образов возможно после покупки хотя бы одного образа для питомца.\');" class="btn btn-success">Образ</button>&nbsp;';
}
?>
<button onClick="location.href='/main.php?newanimal';" class="btn">Обновить</button>&nbsp;
<button onClick="location.href='/main.php?inv';" class="btn">Вернуться</button>
<?php }else{ ?>
<button onClick="location.href='/main.php?newanimal&shadow';" class="btn">Обновить</button>&nbsp;
<button onClick="location.href='/main.php?newanimal';" class="btn">Вернуться</button>
<?php } ?>
</div>
<?php
if( $u->error != '' ) {
echo '<div><b><font color="red">'.$u->error.'</font></b></div>';
}
?>
<hr>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
if(isset($_GET['shadow']) && $petox > 0) {
//
echo '<td align="left">';
$sp = mysql_query('SELECT * FROM `obraz_pet` WHERE `uid` = "'.$u->info['id'].'"');
while( $pl = mysql_fetch_array($sp) ) {
echo '<div class="obrsl1d">';
//
echo '<img class="obrsl1" src="//img.new-combats.tech/pet/'.$pl['img'].'" width="120" height="40"><br><div align="center">';
if( $pl['use'] == 0 ) {
echo '<input onclick="location.href=\'/main.php?newanimal&shadow&change='.$pl['id'].'\';" style="width:120px;" type="button" value="Выбрать" class="btn">';
}else{
echo '<input onclick="location.href=\'/main.php?newanimal&shadow&rechange\';" style="width:120px;" type="button" value="Используется" class="btn btn-success">';
}
echo '</div>';
//
echo '</div>';
}
echo '</td>';
}else{
$sp = mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 LIMIT 6');
$i = 1;
while( $pl = mysql_fetch_array($sp) ) {
//
if( isset($_GET['selected']) && $pl['id'] == $_GET['selected'] ) {
if( $u->info['animal'] != $pl['id'] ) {
$u->info['animal'] = $pl['id'];
}else{
$u->info['animal'] = 0;
}
mysql_query('UPDATE `users` SET `animal` = "'.$u->info['animal'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
//
//$kp = 0.05; //цена корма
$kp = $an_eda[$pl['level']];
//$kp = $an_eda[1];
//
echo '<td width="16%" align="center" valign="top">';
//
echo '<div class="an_line"><b><img onclick="top.anrename('.$pl['id'].',\''.$pl['name'].'\');" class="cp" src="//img.new-combats.tech/pencil.png" width="16" height="16" title="Изменить кличку"> <small>'.$pl['name'].'</small> <img onclick="if(confirm(\'Вы действительно хотите ВЫГНАТЬ зверя &quot;'.$pl['name'].'&quot;?\')) location.href=\'main.php?newanimal&pet_del='.$pl['id'].'\';" class="cp" src="//img.new-combats.tech/i/clear.gif" title="Выгнать" width="13" height="13"></b></div>';
//
echo '<div title="'.$pl['name'].'" class="an_border"><img src="//img.new-combats.tech/i/obraz/'.$pl['sex'].'/'.$pl['obraz'].'.gif" width="120" height="220"></div>';
//
echo '<div class="an_line2"><small>';
echo 'Уровень: '.$pl['level'].'<br>Опыт: <b>'.$pl['exp'].'</b><br>Сытность: '.$pl['eda'].'/100<br>';
//
echo '<input ';
if( $pl['eda'] >= 100 ) {
echo ' disabled="disabled" ';
}else{
echo ' onclick="top.eda('.$pl['id'].',\''.$pl['name'].'\','.(0+$kp).','.(0+100-$pl['eda']).');" ';
}
echo 'type="button" value="Покормить" class="btn an_w120';
if( $pl['eda'] < 1 ) {
echo ' btn-danger';
}
echo '">';
//
if( $pl['id'] != $u->info['animal'] || ( isset($_GET['selected']) && $pl['id'] != $_GET['selected'] ) ) {
echo '<input onClick="location.href=\'main.php?newanimal&selected='.$pl['id'].'\';" type="button" value="Выбрать" class="btn an_w120">';
}else{
echo '<input onClick="location.href=\'main.php?newanimal&selected='.$pl['id'].'\';" type="button" value="Используется" class="btn btn-success an_w120">';
}
//
echo '</small></div>';
//
echo '</td>';
$i++;
}
if( $i <= 6 ) {
$j = 0;
while( $i <= 6 ) {
if( $i <= $slot['slots'] ) {
echo '<td width="16%" align="center" valign="top"><div class="an_line">&nbsp;</div><div onclick="top.petbuy();" onMouseOver="top.hi(this,\'Завести питомца (50 КР)\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" class="an_border an_btn an_img64x64"><img src="//img.new-combats.tech/pet_free_slot.png" width="64" height="64"></div></td>';
}else{
if( $j == 0 ) {
echo '<td width="16%" align="center" valign="top"><div class="an_line">&nbsp;</div><div onclick="if(confirm(\'Вы действительно хотите купить слот за '.$slot['price_next'].' ЕКР?\')) location.href=\'main.php?newanimal&buy_slot\';" onMouseOver="top.hi(this,\'Купить слот ('.$slot['price_next'].' ЕКР)\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" class="an_border an_btn an_img64x64"><img src="//img.new-combats.tech/pet_add.png" width="64" height="64"></div></td>';
$j++;
}else{
echo '<td width="16%" align="center" valign="top"><div class="an_line">&nbsp;</div><div title="Недоступно" class="an_border an_img64x64"><img src="//img.new-combats.tech/pet_lock.png" width="64" height="64"></div></td>';
}
}
$i++;
}
}
}
?>
</tr>
</table>

View File

@ -1,171 +0,0 @@
<?php
if(!defined('GAME') || !isset($_GET['referals']))
{
die();
}
$rfs = array();
$rfs['count'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `host_reg` = "'.$u->info['id'].'" AND `mail` != "No E-Mail" LIMIT 1000'));
$rfs['count'] = 0+$rfs['count'][0];
$rfs['c'] = 1;
$rfs['data'] = explode('|',$u->info['ref_data']);
if(isset($_POST['r_bank']) || isset($_POST['r_type']))
{
$bnk = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `id` = "'.mysql_real_escape_string($_POST['r_bank']).'" AND `uid` = "'.$u->info['id'].'" AND `block` = "0" LIMIT 1'));
if(!isset($bnk['id']))
{
}else{
if($_POST['r_type']==1){ $_POST['r_type'] = 1; }else{ $_POST['r_type'] = 2; }
$u->info['ref_data'] = $bnk['id'].'|'.$_POST['r_type'];
$rfs['data'] = explode('|',$u->info['ref_data']);
mysql_query('UPDATE `stats` SET `ref_data` = "'.mysql_real_escape_string($u->info['ref_data']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
}
$rfs['see'] = '';
$sp = mysql_query('SELECT `s`.`active`,`u`.`online`,`u`.`id`,`u`.`level` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `u`.`id` = `s`.`id` WHERE `u`.`host_reg` = "'.$u->info['id'].'" AND `u`.`mail` != "No E-Mail" ORDER BY `u`.`level` DESC LIMIT '.$rfs['count']);
while($pl = mysql_fetch_array($sp))
{
$rfs['c2'] = '&nbsp; '.$rfs['c'].'. &nbsp; '.$u->microLogin($pl['id'],1).'';
if($pl['active']!='')
{
$rfs['c2'] = '<font color="grey">'.$rfs['c2'].' &nbsp; <small>не активирован</small></font>';
}elseif($pl['level']>5)
{
$rfs['c2'] = '<font color="green">'.$rfs['c2'].'</font>';
}
if($pl['online'] >time()-520) {
$rfs['c2'] .= '<font color="green"> &nbsp; <small>ONLINE</small></font>';
}
$rfs['see'] .= $rfs['c2'].'<br>';
$rfs['c']++;
}
if($rfs['see']=='')
{
$rfs['see'] = '<b>К сожалению у Вас нет рефералов</b>';
}
?>
<table cellspacing="0" cellpadding="2" width="100%">
<tr>
<td style="vertical-align: top; "><table cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="4" align="center"><h4>Как заработать игровую валюту и реальные деньги в БК:</h4></td>
</tr>
<tr>
<td colspan="4">
<u><font color=#003388><b>Активация подарочных ваучеров</b>:</font></u><br>
<form style="padding:10px;" method="post" action="main.php?referals">
Номер: <input type="text" value="" name="va_num" /> &nbsp; Пароль: <input type="password" name="va_psw" value="" /><button type="submit"><small>Активировать</small></button><br />Ссылка на ваучер: <input style="width:280px" type="text" name="va_url" value="" /><br>
</form>
<small><b>Правила размещения ваучера:</b>
<br />- Ваучер должен быть размещен в социальных сетях, либо других сайтах с подробной информацией по его использованию
<br />- Он должен находиться на указанном адресе не менее суток
<br />- Награду за ваучер возможно получить в течении 24 ч. (Защита от "накрутки")
<br />- Для создания собственного ваучера перейдите по ссылке: <a href="В разработке">В разработке</a>
</small>
<br><br>
<u><font color=#003388><b>Кредиты</b> можно получить:</font></u> <br>
- набирая опыт в боях и поднимаясь по апам и уровням в соответствии с <a href=https://lib.new-combats.com/main/85 target=_blank>Таблицей Опыта</a> (доступно на любом уровне)<br>
- в Пещерах: продав ресурсы в Магазин<br>
- с помощью <b>Реферальной системы</b>, которая описана ниже (доступно на любом уровне)<br>
- лечением и другими магическими услугами (доступно с 4 уровня)<br>
- торговлей (доступно с 4 уровня)<br>
- в Башне Смерти: обналичив у Архивариуса найденный в башне чек (доступно с 1 уровня)<br>
<br><br>
<u><font color=#003388><b>Еврокредиты</b> можно получить:</font></u><br>
- с помощью <b>Реферальной системы</b>, которая описана ниже (доступно на любом уровне)<br>
- купив еврокредиты у официальных дилеров БК<br>
<br>
<br>
<u><font color=#003388><b>Реальные деньги</b> можно получить:</font></u><br>
- с помощью <b>Партнерской программы БК</b>.<br>
<br><br>
<b>Реферальная система</b> - это возможность Вашего <b>дополнительного заработка</b> в игре. При открытии счета в банке, Вы автоматически получаете личную <b>реферальную ссылку</b>, которую можете раздать своим друзьям и знакомым.<br><br>
<b>Каждый персонаж</b>, зарегистрировавшийся в БК по Вашей реферальной ссылке, по достижению им <b>7го</b> уровня начнет приносить Вам <b>дополнительный заработок</b>.<br>
<br>
При достижении Вашим рефералом:<br>
<b>&nbsp;2го</b> уровня - <b>0.50 кр</b>.<br>
<b>&nbsp;4го</b> уровня - <b>1.00 кр</b>.<br>
<b>&nbsp;5го</b> уровня - <b>25.00 кр</b>.<br>
<b>&nbsp;6го</b> уровня - <b>35.00 кр</b>.<br>
<b>&nbsp;7го</b> уровня - <b>75.00 кр</b>.<br>
<b>&nbsp;8го</b> уровня, Вам автоматически будет переведено на счет <b>1 екр</b>.<br>
<b>&nbsp;9го</b> уровня - <b>5 екр</b>.<br>
<b>10го</b> уровня - <b>15 екр</b>.<br>
<b>11го</b> уровня - <b>35 екр</b>.<br>
<b>12го</b> уровня - <b>50 екр</b>.<br>
<p>&nbsp;</p>
<p>Ваша уникальная ссылка
<input style="background-color:#FBFBFB; border:1px solid #EFEFEF; padding:5px;" size="45" value="new-combats.com/register.php?ref=<?=$u->info['id']?>" /> или <input style="background-color:#FBFBFB; border:1px solid #EFEFEF; padding:5px;" size="45" value="new-combats.com/r<?=$u->info['id']?>" />
</p></td>
</tr>
<tr>
<td colspan="4"><p>&nbsp;</p>
<ul>
В реферальной системе отображаются персонажи прошедшие регистрацию
Выплаты производятся по банковскому счету указаному в настройках системы
</ul>
</td>
</tr>
<tr>
<td colspan="4">Количество рефералов: <b><?=$rfs['count']?></b> шт.</td>
</tr>
<tr>
<td colspan="4"><?=$rfs['see']?></td>
</tr>
</table></td>
<td style="width: 5%; vertical-align: top; ">&nbsp;</td>
<td style="width: 30%; vertical-align: top; "><table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td style="width: 25%; vertical-align: top; text-align: right; "><input type='button' value='Обновить' style='width: 75px' onclick='location=&quot;main.php?referals&quot;' />
&nbsp;
<input type="button" value="Вернуться" style='width: 75px' onclick='location=&quot;main.php&quot;' /></td>
</tr>
<tr>
<td align="center"><h4>Настройка реферальной системы</h4></td>
</tr>
<tr>
<td style="text-align:left;"><form method="post" action="main.php?referals"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="200">Счет зачисления Екр.:</td>
<td>
<?php $bsees = '';
$sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$u->info['id'].'" AND `block` = "0" LIMIT 1');
while($pl = mysql_fetch_array($sp))
{
if($rfs['data'][0]==$pl['id'])
{
$bsees .= '<option selected="selected" value="'.$pl['id'].'">№ '.$pl['id'].'</option>';
}else{
$bsees .= '<option value="'.$pl['id'].'">№ '.$pl['id'].'</option>';
}
}
if($bsees != '') {
?>
<select name="r_bank" id="r_bank">
<?php
echo $bsees;
?>
</select>
<?php }else{
echo '<b>Для начала откройте счет в банке на страшилкиной улице.</b>';
}?>
</td>
</tr>
<tr>
<td align="right"><input type="submit" name="button" id="button" value="сохранить изменения" /></td>
<td>&nbsp;</td>
</tr>
</table></form></td>
</tr>
</table></td>
</tr>
</table>

View File

@ -2,38 +2,56 @@
use Core\Config;
use Core\Db;
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_incl_data/autoload.php';
use Tournament\Tournament;
use Tournament\TournamentModel;
if (!defined('GAME')) {
die();
}
if (isset($_GET['r'])) {
$_GET['r'] = (int)$_GET['r'];
} else {
$_GET['r'] = null;
}
if ($_GET['r'] == 3 || $_GET['r'] == 8 || !isset($_GET['r'])) {
$_GET['r'] = 2;
}
/** @var User $u */
if ($u->info['inTurnir'] > 0 && $u->info['inUser'] == 0 && $u->info['room'] == 318) {
die('<script>location="main.php";</script>');
}
$zv = new FightRequest();
// Турниры по умолчанию.
// 4-group,5-chaos,6-current,7-ended,10-tournament
$r = (int)$_GET['r'] ??= FightRequest::BATTLE_RAZDEL_TOURNAMENTS;
$js_5356 = sprintf(
"top.lafstReg[%d] = 0; top.startHpRegen(\"main\",%d,%d,%d,%d,%d,%d,%d,%d,%d,1);",
$u->info['id'], $u->info['id'], 0 + $u->stats['hpNow'], 0 + $u->stats['hpAll'],
0 + $u->stats['mpNow'], 0 + $u->stats['mpAll'], time() - $u->info['regHP'], time() - $u->info['regMP'],
0 + $u->rgd[0], 0 + $u->rgd[1]
$u->info['id'],
$u->info['id'],
$u->stats['hpNow'],
$u->stats['hpAll'],
$u->stats['mpNow'],
$u->stats['mpAll'],
time() - $u->info['regHP'],
time() - $u->info['regMP'],
$u->rgd[0],
$u->rgd[1]
);
$code ??= PassGen::intCode();
$userinfo = UserStats::getLoginHpManaBars($u);
$slogin = null;
$dt = null;
$dateformatter = null;
if ($r === FightRequest::BATTLE_RAZDEL_ENDED) {
$dateformatter = new IntlDateFormatter(
'ru_RU',
IntlDateFormatter::LONG,
IntlDateFormatter::NONE
);
$dt = $_GET['logs2'] ??= time();
$slogin = $_GET['filter'] ?? $_POST['filter'] ?? $u->info['login'];
$slogin = str_replace('"', '', $slogin);
$slogin = str_replace("'", '', $slogin);
$slogin = str_replace('\\', '', $slogin);
}
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
@ -66,13 +84,95 @@ $code ??= PassGen::intCode();
.firsttd {
width: 70px;
}
.seehp, .hpborder, .senohp, .senomp, .hp_none, .seemp {
position: absolute;
}
.seehp, .hpborder, .hp_none, .seemp {
width: 120px;
}
.seehp, .hp_none, .seemp {
height: 10px;
}
.hpborder, .senohp, .senomp {
height: 9px;
}
.seehp {
z-index: 12;
}
.hpborder {
z-index: 13;
}
.senohp {
width: <?= $userinfo->hpbarwidth ?>px;
z-index: 11;
}
.senomp {
width: <?= $userinfo->hpbarwidth ?>px;
z-index: 11;
}
.hp_none {
z-index: 10;
}
.seemp {
z-index: 12;
}
.hptop {
top: -10px;
}
.mptop {
top: 0px;
}
</style>
<TABLE class="wfix" cellspacing=1 cellpadding=3>
<TR>
<TD colspan=<?= $u->info['level'] == 0 ? '4' : '6' ?> align=right>
<div style="float:left"><?= $zv->userInfo() ?></div>
<TD colspan=6 align=right>
<div style="float:left">
<table border="0" cellspacing="0" cellpadding="0" height="20">
<tr>
<td valign="middle">&nbsp;<?= $userinfo->login ?>&nbsp;</td>
<td valign="middle" width="120">
<div style="position:relative;<?= $userinfo->divstyle ?>">
<div id="vhp$uid" title="Уровень жизни"
class="seehp hptop"><?= $userinfo->hpbartext ?></div>
<div title="Уровень жизни" class="hpborder hptop">
<img src="//img.new-combats.tech/1x1.gif" height="9" width="1" alt="">
</div>
<div class="hp_3 senohp hptop" id="lhp$uid">
<img src="//img.new-combats.tech/1x1.gif" height="9" width="1">
</div>
<div title="Уровень жизни" class="hp_none hptop">
<img src="//img.new-combats.tech/1x1.gif" height="10">
</div>
<?php if ($userinfo->hasmana): ?>
<div id="vmp$uid" title="Уровень маны"
class="seemp mptop"><?= $userinfo->mpbartext ?></div>
<div title="Уровень маны" class="hpborder mptop">
<img src="//img.new-combats.tech/1x1.gif" height="9" width="1" alt="">
</div>
<div class="hp_mp senomp mptop" id="lmp$uid">
<img src="//img.new-combats.tech/1x1.gif" height="9" width="1" alt="">
</div>
<div title="Уровень маны" class="hp_none mptop"></div>
<?php endif; ?>
</div>
</td>
</tr>
</table>
</div>
<div style="float:right;">
<INPUT class="btn" onClick="location='main.php?zayvka&r=<?= $_GET['r'] ?>&rnd=<?= $code ?>';"
<INPUT class="btn" onClick="location='main.php?zayvka&r=<?= $r ?>&rnd=<?= $code ?>';"
TYPE=button name=tmp value="Обновить">
<INPUT class="btn" TYPE=button value="Вернуться" onClick="location.href='main.php?rnd=<?= $code ?>';">
</div>
@ -80,57 +180,42 @@ $code ??= PassGen::intCode();
</tr>
<tr>
<td class="firsttd m">&nbsp;<b>Бои:</b>&nbsp;</td>
<?php if ($u->info['level'] == 0): ?>
<td class="<?= $_GET['r'] == 1 ? 's' : 'm' ?>"><a href="/main.php?zayvka=1&r=1&rnd=<?= $code ?>">Новички</a>
</td>
<?php else: ?>
<td class="<?= $_GET['r'] == 2 ? 's' : 'm' ?>"><a href="/main.php?zayvka=1&r=2&rnd=<?= $code ?>">Турниры</a>
</td>
<td class="<?= $_GET['r'] == 4 ? 's' : 'm' ?>"><a
href="main.php?zayvka=1&r=4&rnd=<?= $code ?>">Групповые</a></td>
<td class="<?= $_GET['r'] == 5 ? 's' : 'm' ?>"><a
href="main.php?zayvka=1&r=5&rnd=<?= $code ?>">Хаотичные</a></td>
<?php endif; ?>
<td class="<?= $_GET['r'] == 6 ? 's' : 'm' ?>"><a href="/main.php?zayvka=1&r=6&rnd=<?= $code ?>">Текущие</a>
<td class="<?= $r == FightRequest::BATTLE_RAZDEL_TOURNAMENTS ? 's' : 'm' ?>">
<a href="/main.php?zayvka=1&r=<?= FightRequest::BATTLE_RAZDEL_TOURNAMENTS ?>&rnd=<?= $code ?>">Турниры</a>
</td>
<td class="<?= $_GET['r'] == 7 ? 's' : 'm' ?>"><a href="/main.php?zayvka=1&r=7&rnd=<?= $code ?>">Завершенные</a>
<td class="<?= $r == FightRequest::BATTLE_RAZDEL_GROUP ? 's' : 'm' ?>">
<a href="main.php?zayvka=1&r=<?= FightRequest::BATTLE_RAZDEL_GROUP ?>&rnd=<?= $code ?>">Групповые</a>
</td>
<td class="<?= $r == FightRequest::BATTLE_RAZDEL_CHAOTIC ? 's' : 'm' ?>">
<a href="main.php?zayvka=1&r=<?= FightRequest::BATTLE_RAZDEL_CHAOTIC ?>&rnd=<?= $code ?>">Хаотичные</a>
</td>
<td class="<?= $r == FightRequest::BATTLE_RAZDEL_CURRENT ? 's' : 'm' ?>">
<a href="/main.php?zayvka=1&r=<?= FightRequest::BATTLE_RAZDEL_CURRENT ?>&rnd=<?= $code ?>">Текущие</a>
</td>
<td class="<?= $r == FightRequest::BATTLE_RAZDEL_ENDED ? 's' : 'm' ?>">
<a href="/main.php?zayvka=1&r=<?= FightRequest::BATTLE_RAZDEL_ENDED ?>&rnd=<?= $code ?>">Завершенные</a>
</td>
</tr>
</table>
<script>
function console_clonelogin() {
var s = prompt("Введите логин персонажа с которым хотите сразиться:", "");
if ((s !== null) && (s !== '')) {
location.href = "main.php?zayvka=1&r=2&bot_clone=" + s + "&rnd=1";
}
}
</script>
<div style="padding:2px;">
<?php
$zi = false;
$zi = [];
if ($u->info['battle'] == 0) {
if (isset($_POST['add_new_zv'])) {
$zv->add();
} elseif (isset($_GET['bot']) && ($u->info['level'] <= 7 || $u->info['admin'] > 0)) {
$zv->addBot();
} elseif (isset($_GET['bot_clone'])) {
$zvclone = Db::getValue(
'select id from users where admin = 0 and `real` = 1 and login = ?',
[$_GET['bot_clone']]
);
$zv->addBotClone($zvclone['id']);
} elseif (isset($_GET['add_group'])) {
$zv->add();
} elseif (isset($_GET['start_haot'])) {
$zv->add();
}
if (
$u->info['battle'] == 0 &&
(isset($_GET['add_group']) || isset($_GET['start_haot']))
) {
$zv->addGroupOrChaoticRequest($r);
}
if ($u->info['zv'] != 0) {
$zi = Db::getRow('select id, razdel from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 or razdel > 3', [$u->info['zv']]);
//fixme результаты этого запроса используются в методах класса FightRequest как global $zi.
$zi = Db::getRow(
'select * from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 or razdel > 3',
[$u->info['zv']]
);
if (!isset($zi['id'])) {
$zi = false;
$zi = [];
$u->info['zv'] = 0;
Db::sql('update stats set zv = 0 where id = ?', [$u->info['id']]);
}
@ -138,7 +223,10 @@ $code ??= PassGen::intCode();
if ($u->info['battle'] == 0) {
if (isset($_POST['groupClick']) && !isset($zi['id'])) {
$zg = Db::getRow('select * from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 and btl_id = 0 and razdel = 4', [(int)$_POST['groupClick']]);
$zg = Db::getRow(
'select * from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 and btl_id = 0 and razdel = 4',
[(int)$_POST['groupClick']]
);
if (!isset($zg['id'])) {
echo '<div style="text-align: center;"><br><br>Заявка на групповой бой не найдена.</div>';
} else {
@ -147,9 +235,14 @@ $code ??= PassGen::intCode();
$tm1 = '';
$tm2 = '';
$tm3 = '';
$users = Db::getRow('select users.id, login, level, align, clan, admin, team from users left join stats on users.id = stats.id where zv = ?', [$zg['id']]);
$users = Db::getRow(
'select users.id, login, level, align, clan, admin, team from users left join stats on users.id = stats.id where zv = ?',
[$zg['id']]
);
foreach ($users as $user) {
${'tm' . $user['team']} .= '<b>' . $user['login'] . '</b> [' . $user['level'] . ']<a href="info/' . $user['id'] . '" target="_blank"><img src="//' . Config::get('img') . '/i/inf_capitalcity.gif" title="Инф. о ' . $user['login'] . '" alt="inf"></a><br>';
${'tm' . $user['team']} .= '<b>' . $user['login'] . '</b> [' . $user['level'] . ']<a href="info/' . $user['id'] . '" target="_blank"><img src="//' . Config::get(
'img'
) . '/i/inf_capitalcity.gif" title="Инф. о ' . $user['login'] . '" alt="inf"></a><br>';
}
if (empty($tm1)) {
$tm1 = 'группа пока не набрана';
@ -187,10 +280,10 @@ $code ??= PassGen::intCode();
<tr>
<td> Бой начнется через <?= $tm_start; ?> мин.</td>
<td align="right">
<INPUT class="btn" onClick="location='main.php?zayvka&r=<?= $_GET['r']; ?>&rnd=<?= $code; ?>';"
<INPUT class="btn" onClick="location='main.php?zayvka&r=<?= $r; ?>&rnd=<?= $code; ?>';"
TYPE=button name=tmp value="Обновить">
<input class="btn" type="button" value="Вернуться"
onclick="location.href='main.php?zayvka&r=<?= $_GET['r']; ?>&rnd=<?= $code; ?>';">
onclick="location.href='main.php?zayvka&r=<?= $r; ?>&rnd=<?= $code; ?>';">
</td>
</tr>
</table>
@ -233,12 +326,12 @@ $code ??= PassGen::intCode();
<tr>
<td align="center">
<input class="btn" title="На данный момент свободно мест: <?= $sv1 ?>"
onclick="location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm1=<?= $code ?>'"
onclick="location='main.php?r=<?= $r ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm1=<?= $code ?>'"
type="submit" name="confirm1" value="Я за этих!"/>
</td>
<td align="center">
<input class="btn" title="На данный момент свободно мест: <?= $sv2 ?>"
onclick="location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm2=<?= $code ?>'"
onclick="location='main.php?r=<?= $r ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm2=<?= $code ?>'"
type="submit" name="confirm2" value="Я за этих!"/>
</td>
<?php
@ -246,7 +339,7 @@ $code ??= PassGen::intCode();
?>
<td align="center">
<input class="btn" title="На данный момент свободно мест: <?= $sv3 ?>"
onclick="location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm3=<?= $code ?>'"
onclick="location='main.php?r=<?= $r ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm3=<?= $code ?>'"
type="submit" name="confirm3" value="Я за этих!"/>
</td>
<?php
@ -256,35 +349,218 @@ $code ??= PassGen::intCode();
</table>
<?php
}
} elseif (isset($_GET['cancelzv']) && !isset($_POST['add_new_zv'])) {
$zv->cancelzv();
} elseif (isset($_GET['startBattle']) && isset($zi['id']) && ($zi['razdel'] >= 1 && $zi['razdel'] <= 3)) {
$zv->startBattle($zi['id']);
}
}
if (isset($_POST['btl_go'])) {
$zv->go($_POST['btl_go']);
} elseif (isset($_GET['btl_go'])) {
$zv->go($_GET['btl_go']);
}
$btl_go = (int)$_POST['btl_go'] ?? (int)$_GET['btl_go'] ?? 0;
$zv->go($btl_go);
if ($zv->error) {
echo '<b style="color: red">' . $zv->error . '</b><br>';
}
if ($zv->test_s) {
echo '<b style="color: red">' . $zv->test_s . '</b><br>';
}
?>
<table style="padding:2px;" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><?php $zv->see(); ?></td>
<td>
<?php if ($r === FightRequest::BATTLE_RAZDEL_GROUP && $u->room['zvsee'] == 0): ?>
<span id="hidezv1_btn"><INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp
value="Подать заявку на групповой бой" style="margin:3px;"></span>
<FIELDSET id="hidezv1" style="display:none; border-color:#FFF; width:500px;">
<LEGEND><B style="color:#8f0000">Подать заявку на групповой бой</B></LEGEND>
<form method="post" action="/main.php?zayvka&r=<?= $r ?>&add_group&rnd=<?= $code ?>">
<table>
<tr>
<td>
Начало боя через
<select style="padding:2px;" name="startime">
<option value="300" selected>5 минут</option>
<option value="600">10 минут</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;Таймаут
<select style="padding:2px;" name="timeout">
<option value="1" selected>1 мин.</option>
<option value="2">2 мин.</option>
<option value="3">3 мин.</option>
</select>
<br/>
Ваша команда
<input style="padding:2px;" type="text" name="nlogin1" size="3" maxlength="2"/>
игроков
<select style="padding:2px;" name="levellogin1">
<option value="0">любой</option>
<option value="1">только моего и ниже</option>
<option value="2">только ниже моего уровня</option>
<option value="3" selected>только моего уровня</option>
<option value="4">не старше меня более чем на уровень</option>
<option value="5">не младше меня более чем на уровень</option>
<option value="6">мой уровень +/- 1</option>
<option value="99">мой клан</option>
<option value="98">моя склонность</option>
</select>
<br>
Противники &nbsp;
<input style="padding:2px;" type="text" name="nlogin2" size="3" maxlength="2"/>
игроков
<select style="padding:2px;" name="levellogin2">
<option value="0">любой</option>
<option value="1">только моего и ниже</option>
<option value="2">только ниже моего уровня</option>
<option value="3" selected>только моего уровня</option>
<option value="4">не старше меня более чем на уровень</option>
<option value="5">не младше меня более чем на уровень</option>
<option value="6">мой уровень +/- 1</option>
<option value="99">только клан</option>
<option value="98">только склонность</option>
</select>
<br/>
<input type="checkbox" name="travma">
<label for="travma">Бой без правил <span class="dsc">(проигравшая сторона
получает инвалидность)</span></label><br>
<INPUT maxLength="40" size="40" name="cmt" placeholder="Комментарий к бою"><BR>
</td>
</tr>
<tr>
<td align="left">
<input class="btn" type="submit" value="Подать заявку" name="open">
</td>
</tr>
</table>
</form>
</FIELDSET>
<?php elseif ($r === FightRequest::BATTLE_RAZDEL_CHAOTIC && $u->room['zvsee'] == 0): ?>
<div id="hidezv1_btn">
<INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp
value="Подать заявку на хаотичный бой" style="margin:3px;">
</div>
<form method="post" action="/main.php?zayvka&r=<?= $r ?>&add_group&rnd=<?= $code ?>">
<input type="hidden" name="timeout" value="1">
<div style="display:none; width:600px;" id="hidezv1">
<br>
<FIELDSET style="border-color:#FFF;">
<LEGEND><strong style="color:#8f0000">Подать заявку на хаотичный бой</strong></LEGEND>
Начало боя через
<SELECT name="startime2">
<option value="60" selected>1 минута
<OPTION value="180">3 минуты
<OPTION value="300">5 минут
</SELECT>
Игроков
<SELECT name="players">
<OPTION selected value="6">6</OPTION>
<OPTION value="8">8</OPTION>
<OPTION value="10">10</OPTION>
<OPTION value="12">12</OPTION>
</SELECT>
<BR>
Уровни бойцов
<SELECT name="levellogin1">
<OPTION value="0">любой
<OPTION selected value="3">только моего уровня
<OPTION value="6">мой уровень +/- 1</OPTION>
</SELECT>
<BR><BR>
<INPUT type="checkbox" name="travma">
Бой без правил <span
style="color: #777; ">(проигравшая сторона получает инвалидность)</span><BR>
<INPUT type="checkbox" name="noatack"> Закрытый поединок <span style="color: #777; ">(бой будет изолирован от нападений)</span><BR>
<INPUT type="checkbox" name="noeff">
Запрет на использование свитков восстановления НР и Маны<BR>
<?php if (!$u->info['no_zv_key']): ?>
<img src="/show_reg_img/security2.php?id=<?= time() ?>" width="70" height="20">
Код подтверждения: <input style="width:40px;" type="text" name="code21">'
<?php endif; ?>
<INPUT maxLength="40" size="40" name="cmt" placeholder="Комментарий к бою"><BR>
<INPUT class="btn" value="Подать заявку" type="submit" name="open">
</FIELDSET>
</div>
</form>
<?php elseif ($r === FightRequest::BATTLE_RAZDEL_CURRENT): ?>
<h3>Записи текущих боев на <?= date('d.m.Y'); ?></h3>
<?php $zv->getCurrentBattlesList(); ?>
<?php elseif ($r === FightRequest::BATTLE_RAZDEL_ENDED): ?>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD valign=top>
&nbsp;
<A HREF="?filter=<?= $slogin ?>&zayvka=1&r=7&logs2=<?= $dt - 86400 ?>">« Предыдущий день</A>
</TD>
<TD valign=top align=center>
<H3>Записи о завершенных боях за <?= $dateformatter->format($dt) ?></H3>
</TD>
<TD valign=top align=right>
<A HREF="?filter=<?= $slogin ?>&zayvka=1&r=7&logs2=<?= $dt + 86400 ?>">Следующий день »</A>
&nbsp;
</TD>
</TR>
<TR>
<TD colspan=3 align=center>
<form method="POST" action="main.php?zayvka=1&r=7&rnd=<?= $code ?>">
Показать только бои персонажа:
<INPUT TYPE=text NAME=filter value="<?= $slogin ?>"> за
<INPUT TYPE=text NAME=logs size=12 value="<?= date('d.m.Y', $dt) ?>">
<INPUT class="btn" TYPE=submit value="фильтр!">
</form>
</TD>
</TR>
</TABLE>
<?php $zv->getEndedBattlesList($slogin, $dt); ?>
<?php elseif ($r === FightRequest::BATTLE_RAZDEL_TOURNAMENTS): ?>
<?php if (Tournament::IS_ENABLED): ?>
<div>
<strong style="color: red;">Внимание!</strong>
<ul>
<li style="color: blue;">В случае создания либо присоединения к Турниру, покинуть его -
<u>невозможно</u>!
</li>
<?php if (TournamentModel::isEkrOverpriced($u->info['id'])): ?>
<li>Стоимость предметов, одетых на вас не должна
превышать <?= Tournament::ekrOverpriceFormula($u->info['level']) ?> еврокредитов.
</li>
<?php endif; ?>
<?php if ($u->info['exp'] < Tournament::MIN_EXP): ?>
<li>У вас должно быть не менее <?= Tournament::MIN_EXP ?> опыта.</li>
<?php endif; ?>
<li style="color: blue;">Турнир начнётся, когда в заявке
наберётся <?= Tournament::START_TOURNAMENT ?> человек.
</li>
<li style="color: blue;">Игроки занявшие 1, 2 и 3 места получат 25, 15, 5 Реликвий
Ангела, а так же задержки на участие в турнире 12 часов, 6 и 3 часа соответственно!
</li>
</ul>
</div>
<?php $trn = $zv->getTournaments(); ?>
<?php if ($trn->hasTournaments): ?>
<div>
<strong>Активные турниры.</strong><br>
<?= $trn->listTournaments ?>
</div>
<?php endif; ?>
<?php if (!TournamentModel::getTournamentIdByUserId(
$this->u->info['id']
) || !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 style="font-weight: bold; color: firebrick;">В данный момент турниры не проводятся!</div>
<?php endif; ?>
<?php else: ?>
nan
<?php endif; ?>
<?php $zv->getCurrentStatus($zi, $r); ?>
</td>
</tr>
<tr>
<td><?php $zv->seeZv(); ?></td>
<td><?php $zv->seeZv($zi, $r); ?></td>
</tr>
</table><br/>
<div style="text-align: right">
</table>
<div style="text-align: right; margin-top: 5px;">
<?= Config::get('counters') ?>
</div>

View File

@ -1,64 +0,0 @@
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
if(!defined('GAME'))
{
die();
}
if(isset($_GET['r']))
{
$_GET['r'] = (int)$_GET['r'];
}else{
$_GET['r'] = NULL;
}
$u->info['referals'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `register_code` WHERE `uid` = "'.$u->info['id'].'" AND `time_finish` > 0 AND `end` = 0 LIMIT 1000'));
$u->info['referals'] = $u->info['referals'][0];
$zv = new FightRequest();
?>
<script> var zv_Priem = 0; </script>
<style>
.m {background: #d2d2d2;text-align: center;}
.s {background: #b4b4b4;text-align: center;}
</style>
<TABLE width=100% cellspacing=1 cellpadding=3>
<TR><TD colspan=8 align=right>
<div style="float:left">
<?php
echo ' &nbsp; &nbsp; <b style="color:grey">(Удаленный просмотр)</b>';
?>
</div>
<div style="float:right">
<INPUT TYPE=button value="Вернуться" onClick="location.href='main.php?rnd=<?= $code; ?>';">
</div>
</TD></TR>
<TR>
<TD class=m width=40>&nbsp;<B>Бои:</B></TD>
<TD width="15%" class="<?php if($_GET['r']==1){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=1&rnd=<?= $code; ?>">Новички</A></TD>
<TD width="15%" class="<?php if($_GET['r']==2){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=2&rnd=<?= $code; ?>">Физические</A></TD>
<TD width="14%" class="<?php if($_GET['r']==3){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=3&rnd=<?= $code; ?>">Договорные</A></TD>
<TD width="14%" class="<?php if($_GET['r']==4){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=4&rnd=<?= $code; ?>">Групповые</A></TD>
<TD width="14%" class="<?php if($_GET['r']==5){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=5&rnd=<?= $code; ?>">Хаотичные</A></TD>
<TD width="14%" class="<?php if($_GET['r']==6){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=6&rnd=<?= $code; ?>">Текущие</A></TD>
<TD width="14%" class="<?php if($_GET['r']==7){ echo 's'; }else{ echo 'm'; } ?>"><A HREF="main.php?zayvka=1&r=7&rnd=<?= $code; ?>">Завершенные</A></TD>
</TR></TR></TABLE>
<table style="padding:2px;" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><?= $zv->see(); ?></td>
</tr>
<tr>
<td><?php $zv->seeZv(); ?></td>
</tr>
</table><br />
<DIV align="right">
<?php
echo $c['counters'];
?>
</DIV>

View File

@ -1,10 +0,0 @@
<?php
if(!defined('GAME'))
{
die();
}
if($u->room['file'] != 'turnir') {
return;
}
$tur = new Tournir();