Ремонт лотореи. Централизованная работа через БД. Дополнительная защита от ложных срабатываний.

This commit is contained in:
Ivor Barhansky 2023-06-08 21:33:56 +03:00
parent 02c76e76ad
commit cf2aea847a
9 changed files with 477 additions and 780 deletions

View File

@ -26,7 +26,8 @@ class Config
$c['thiscity'] = 'capitalcity'; $c['thiscity'] = 'capitalcity';
$c['capitalcity'] = $c['host']; $c['capitalcity'] = $c['host'];
$c['abandonedplain'] = $c['host']; $c['abandonedplain'] = $c['host'];
$c['https'] = '//' . $c['host'] . DIRECTORY_SEPARATOR; $c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $c['host'] . DIRECTORY_SEPARATOR;
$c['img2'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . 'img.' . $c['host'];
$c['exit'] = '<script>top.location.href="//' . $c['host'] . '/";</script>'; $c['exit'] = '<script>top.location.href="//' . $c['host'] . '/";</script>';
$c['support'] = 'support@' . $c['host']; $c['support'] = 'support@' . $c['host'];

View File

@ -2,13 +2,27 @@
use Core\Db; use Core\Db;
/** Предметы которые никому не принадлежат. Не перепутай! */ /** Предметы которые никому не принадлежат. Не перепутай! */
class ItemModel class ItemModel
{ {
private $item;
public function __construct(int $id)
{
$this->item = Db::getRow('select * from items_main where id = ?', [$id]);
}
public static function getItemData(int $id): string public static function getItemData(int $id): string
{ {
return Db::getValue('select data from items_main_data where items_id = ?', [$id]); return Db::getValue('select data from items_main_data where items_id = ?', [$id]);
} }
public function getName()
{
return $this->item['name'];
}
public function getImage()
{
return $this->item['img'];
}
} }

View File

@ -0,0 +1,148 @@
<?php
namespace Location;
use Chat;
use ChatMessage;
use Core\Config;
use Core\Db;
use ItemModel;
use Model\ActionModel;
use User;
use User\ItemsModel;
class Loto
{
private array $prizes = [];
private const PRIZE_IMAGE = 0;
private const PRIZE_NAME = 1;
private const PRIZE_RARITY = 2;
private const PRIZE_ROW_ID = 3;
private const PRIZE_ITEM_ID = 4;
public function __construct()
{
$loto = Db::getRows('select * from loto order by id');
foreach ($loto as $prize) {
$item = new ItemModel($prize['idgame']);
$this->prizes[] = [
$item->getImage(),
$item->getName(),
ltrim($prize['type'], $prize['type'][0]),
$prize['id'],
$prize['idgame'],
];
}
}
public function getPrizeListByRarity(): string
{
$prizelist = '';
$rarity = [1 => 'Частое', 'Нормальное', 'Нечастое', 'Редкое', 'Очень редкое', 'Невероятно редкое',];
$prizelistSortedByRarity = $this->prizes;
usort($prizelistSortedByRarity, fn($a, $b) => $a[self::PRIZE_RARITY] <=> $b[self::PRIZE_RARITY]);
foreach ($prizelistSortedByRarity as $prize) {
$prizelist .= '<tr>';
$prizelist .= '<td><img src="' . Config::get('img2') .
'/i/items/' . $prize[self::PRIZE_IMAGE] . '" alt="' . $prize[self::PRIZE_NAME] . '"></td>';
$prizelist .= '<td>' . $prize[self::PRIZE_NAME] . '</td>';
$prizelist .= '<td class="chanceitem">' . $rarity[$prize[self::PRIZE_RARITY]] . ' выпадение</td>';
$prizelist .= '</tr>';
}
return $prizelist;
}
public function getPrizes(): array
{
return $this->prizes;
}
public function roll(): array
{
$result = [];
$prizes = $this->prizes;
shuffle($prizes);
$d100 = rand(1, 1000);
if ($d100 <= 5) {
$itemTier = 6;
} elseif ($d100 <= 10) {
$itemTier = 5;
} elseif ($d100 <= 30) {
$itemTier = 4;
} elseif ($d100 <= 70) {
$itemTier = 3;
} elseif ($d100 <= 150) {
$itemTier = 2;
} else {
$itemTier = 1;
}
foreach ($prizes as $prize) {
if (intval($prize[self::PRIZE_RARITY]) === $itemTier) {
$result = $prize;
break;
}
}
return [
'row_id' => $result[self::PRIZE_ROW_ID],
'item_id' => $result[self::PRIZE_ITEM_ID],
'name' => $result[self::PRIZE_NAME],
];
}
public static function freeRoll(string $uidCheck): void
{
$user = User::start()->info;
$am = new ActionModel($user['id']);
$titm = $am->getLastByValsAndTime('loto', 24 * 60 * 60);
if (intval($uidCheck) != $user['id']) {
echo 'No user!';
exit;
}
if ($titm) {
echo 'Wait asign!';
exit;
}
$loto = new Loto();
$prize = $loto->roll();
ItemsModel::addItem($prize['item_id'], $user['id'], '|frompisher=1|nosale=1' . $user['login']);
$cmsg = new ChatMessage();
$cmsg->setText("<b>{$user['login']}</b> выиграл в бесплатной рулетке <b>{$prize['name']}</b>!");
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
ActionModel::new($user, 'loto', $prize['item_id']);
echo $prize['row_id'];
exit;
}
public static function paidRoll(string $uidCheck): void
{
$u = User::start();
if ($uidCheck == 'ekr') {
echo $u->info['money2'];
exit;
}
if (intval($uidCheck) != $u->info['id']) {
echo "No user!";
exit;
}
if ($u->info['money2'] < 5) {
echo "No Ekr!";
exit;
}
$loto = new Loto();
$prize = $loto->roll();
ItemsModel::addItem($prize['item_id'], $u->info['id'], '|frompisher=1|nosale=1' . $u->info['login']);
$u->info['money2'] = $u->info['money2'] - 5;
$u->addEkr(-5);
$cmsg = new ChatMessage();
$cmsg->setText("<b>{$u->info['login']}</b> выиграл в платной рулетке <b>{$prize['name']}</b>!");
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
echo $prize['row_id'];
exit;
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Model;
use Core\Db;
use User\UserIp;
class ActionModel
{
private int $uid;
public function __construct(int $uid)
{
$this->uid = $uid;
}
public function getByVals(string $vals)
{
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public function getLastByVals(string $vals)
{
return Db::getRow(
'select * from actions where uid = ? and vals = ? order by time desc limit 1',
[$this->uid, $vals]
);
}
public function getLastByValsAndTime(string $vals, int $time)
{
return Db::getRow(
'select * from actions where uid = ? and vals = ? and time > unix_timestamp() - ? order by time desc limit 1',
[$this->uid, $vals, $time]
);
}
public function deleteByVals(string $vals)
{
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public static function new(array $user, string $vals, string $vars)
{
Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),?,?,?,?,?,?)',
[
$user['id'],
$user['city'],
$user['room'],
$vars,
UserIp::get(),
$vals,
'',
]
);
}
public static function getAll(): array
{
return Db::getRows('select * from actions');
}
}

View File

@ -107,7 +107,7 @@ class ItemsModel
$room = $user->info['city']; $room = $user->info['city'];
} }
$args = [ $args = [
$i['overTypei'], $i['overTypei'] ?? 0,
$i['id'], $i['id'],
$uid, $uid,
$data, $data,

View File

@ -1,150 +1,13 @@
<?php <?php
const GAME = true; use Location\Loto;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$u = User::start();
$body = file_get_contents('php://input'); if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1')); exit;
$titm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `actions` WHERE `uid` = "' . $body . '" AND `vals` = "loto" AND `time` > ' . (time(
) - 24 * 60 * 60) . ' ORDER BY `time` DESC LIMIT 1'
)
);
if (!isset($user) || $user['id'] != $u->info['id']) {
echo "No user!";
} elseif ($titm) {
echo "Wait asign!";
} else {
// не редкий > t1 42% чуть чуть редкий > t2 25% немного редкий > t3 15% редкий > t4 10% очень редкий > t5 5% невероятно редкий > t6 3%
/*$droplist = array(
0=>4514, t1
1=>4515, t1
2=>4688, t1
3=>4689, t1
4=>4690, t1
5=>5009, t2
6=>5008, t2
7=>5010, t2
8=>5239, t2
9=>5069, t2
10=>10035, t1
11=>10036, t1
12=>10037, t1
13=>10008, t3
14=>10020, t3
15=>6112, t4
16=>6113, t4
17=>6114, t4
18=>6115, t4
19=>6116, t4
20=>6360, t6
21=>6462, t5
22=>5022, t6
23=>5023, t6
24=>6445, t5
25=>6455, t3
26=>10009, t4
27=>1032, t1
28=>1031, t1
29=>1034 t1
);*/
$nrnd = rand(1, 100);
if ($nrnd <= 1) //t6
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
} elseif (($nrnd - 1) <= 5) // t5
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
} elseif (($nrnd - 1 - 5) <= 7) // t4
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
} elseif (($nrnd - 1 - 5 - 7) <= 10) // t3
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
} elseif (($nrnd - 1 - 5 - 7 - 10) <= 15) // t2
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
} else // t1
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"'));
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
}
if (!isset($droplist['id'])) {
echo 'Error';
} else {
$idve = $droplist['idgame'];
\User\ItemsModel::addItem($idve, $user['id'], '|frompisher=1|nosale=1' . $user['login']);
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $idve . '" LIMIT 1'));
$titm = mysql_query(
'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $user['id'] . '","' . time(
) . '","' . $user['city'] . '","' . $user['room'] . '","' . $idve . '","' . mysql_real_escape_string(
$_SERVER['HTTP_X_REAL_IP']
) . '","loto")'
);
$chat = new Chat();
$chatMessageDto = new ChatMessage();
$chatMessageDto->setText("Игрок <b>{$user['login']}</b> выиграл в бесплатной рулетке <b>{$inf['name']}</b>!");
$chatMessageDto->setType(6);
$chat->sendMsg($chatMessageDto);
echo $droplist['id']; //
}
} }
if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
Loto::freeRoll(file_get_contents('php://input'));

View File

@ -1,80 +1,13 @@
<?php <?php
const GAME = true; use Location\Loto;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$u = User::start();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$body = file_get_contents('php://input'); exit;
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1'));
if ($body == 'ekr') {
echo $u->info['money2'];
die();
} }
if (!isset($user) || $user['id'] != $u->info['id']) { if (!defined('GAME_VERSION')) {
echo "No user!"; require_once '_incl_data/autoload.php';
} else {
if ($user['money2'] < 5) {
echo "No Ekr!";
} else {
$nrnd = rand(1, 100);
if ($nrnd <= 1) //t6
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"'));
} elseif (($nrnd - 1) <= 7) // t5
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"'));
} elseif (($nrnd - 1 - 7) <= 10) // t4
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"'));
} elseif (($nrnd - 1 - 7 - 10) <= 15) // t3
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"'));
} elseif (($nrnd - 1 - 7 - 10 - 15) <= 25) // t2
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"'));
} else // t1
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"');
$y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"'));
}
$rndt = rand(0, $y['COUNT'] - 1);
$i = 0;
while ($pl = mysql_fetch_array($droplistt)) {
if ($i == $rndt) {
$droplist = $pl;
}
$i++;
}
if (!isset($droplist['id'])) {
echo 'Error';
} else {
$idve = $droplist['idgame'];
\User\ItemsModel::addItem($idve, $user['id'], '|frompisher=1|nosale=1' . $user['login']);
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $idve . '" LIMIT 1'));
$u->info['money2'] = $u->info['money2'] - 5;
mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "' . $u->info['id'] . '"');
if ($droplist['type'] == "t6" || $droplist['type'] == "t5") {
$cmsg = new ChatMessage();
$cmsg->setText("Игрок {$user['login']} выиграл в платной рулетке <b>{$inf['name']}</b>!");
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
}
echo $droplist['id']; // это закоментить
/*//этот блок разкоментить
$array = array(
'1' => $droplist['id']', // 1 элемент id вещи
'2' => $u->info['money2'] // бабло пользователя
);
$json = json_encode($array);
echo $json;*/
}
}
} }
Loto::paidRoll(file_get_contents('php://input'));

View File

@ -1,30 +1,35 @@
<?php <?php
if(!defined('GAME'))
{ use Core\Config;
die(); use Location\Loto;
use Model\ActionModel;
if (!defined('GAME')) {
die();
} }
session_start(); if ($u->room['file'] != 'loto') {
return;
if($u->room['file']=='loto')
{
$titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vals` = "loto" ORDER BY `time` DESC LIMIT 1'));
if($_GET['get']=='20' && isset($titm['id']))
{
if ($u->info['money2']>5)
{
$u->info['money2'] = $u->info['money2'] - 5;
mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "'.$u->info['id'].'"');
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vals` = "loto"');
}
} }
$titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vals` = "loto" AND `time` > '.(time()-24*60*60).' ORDER BY `time` DESC LIMIT 1')); $loto = new Loto();
$am = new ActionModel($u->info['id']);
$titm = $am->getLastByVals($u->room['file']);
if ($_GET['get'] == '20' && isset($titm['id']) && $u->info['money2'] > 5) {
$u->info['money2'] = $u->info['money2'] - 5;
$u->addEkr(-5);
$am->deleteByVals($u->room['file']);
}
$titm = $am->getLastByValsAndTime($u->room['file'], 24 * 60 * 60);
?> ?>
<TABLE width="100%" cellspacing="0" cellpadding="0"> <TABLE width="100%" cellspacing="0" cellpadding="0">
<tr><td valign="top" id="centerBlockLoto"><div align="center" class="pH3"><h1>Ежедневная Бесплатная Рулетка</h1></div> <tr>
<br /> <td valign="top" id="centerBlockLoto">
<div align="center" class="pH3"><h1>Ежедневная Бесплатная Рулетка</h1></div>
<br/>
<div id="winDiv"> <div id="winDiv">
<p class="testDiv">Ваш приз: <span id="win"></span></p> <p class="testDiv">Ваш приз: <span id="win"></span></p>
@ -39,230 +44,40 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
</div> </div>
</div> </div>
<p style="text-align: center"> <p style="text-align: center">
<?if ($titm==false){?><button class="buttonRuletka" onclick="(<?= json_encode($idve) ?>)" formmethod="get">Запустить игру!</button><?} <?php if (!$titm): ?>
else <button class="buttonRuletka" formmethod="get">Запустить игру!</button>
{?><button class="buttonRuletka" disabled onclick="(<?= json_encode($idve) ?>)" formmethod="get">Приходите Завтра!</button><?}?> <?php else: ?>
<button class="buttonRuletka" disabled formmethod="get">
<button class="buttonsElements">Предметы и шансы</button> Приходите Завтра!
</button>
<?php endif; ?>
<button class="buttonsElements">Предметы и шансы</button>
<div id="tableItemChange" hidden> <div id="tableItemChange" hidden>
<table> <table>
<tr> <tr>
<th colspan="2">Предмет</th> <th colspan="2">Предмет</th>
<!-- <th></th> -->
<th>Шанс выпадения</th> <th>Шанс выпадения</th>
</tr> </tr>
<tr> <?= $loto->getPrizeListByRarity() ?>
<td><img src="//img.new-combats.tech/i/items/pot_base_200_alldmg2_p1k.gif"></td>
<td>Зелье Каменной Стойкости</td>
<td class="chanceItem">Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_200_allmag2_p1k.gif"></td>
<td>Зелье Стража Магии</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_str.gif"></td>
<td>Топливо для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_dex.gif"></td>
<td>Смазка для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_inst.gif"></td>
<td>Ускоритель для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/voda112.gif"></td>
<td>Живая Вода</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/otvar112.gif"></td>
<td>Отвар Когтей ПГ</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/grib112.gif"></td>
<td>Сушеный Мухомор</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l11_e.gif"></td>
<td>Жёсткая Рыба</td>
<td class="chanceItem">Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l10_e.gif"></td>
<td>Яблоко Раздора</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l5_eng.gif"></td>
<td>Бутерброд -The Best Friend-</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/ambosia_gora.gif"></td>
<td>Амброзия Скучающих Владык</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/poor.gif"></td>
<td>Плохое Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/fine.gif"></td>
<td>Нормальное Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/best.gif"></td>
<td>Хорошее Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/invoke_plain_honor_attack_invul_any1.gif">
</td>
<td>Защита от Нападения [30]</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/joust_rew_s.gif"></td>
<td>Жетон Успеха</td>
<td class="chanceItem">Не частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/ambosia_gora.gif"></td>
<td>Амброзия подмастерья Владык</td>
<td>Не частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora10.gif"></td>
<td>Сумка Копателя Катакомб</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora9.gif"></td>
<td>Сумка Копателя Горы Легиона</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora7.gif"></td>
<td>Сумка Копателя Бездны</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/svitok1.png"></td>
<td>Свиток Репутации Горы Легиона</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/zolyaichko.gif"></td>
<td>Яйцо Дракона</td>
<td class="chanceItem">Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora8.gif"></td>
<td>Сумка Защиты</td>
<td>Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/svitok1.png"></td>
<td>Свиток Репутации Потерянного Входа</td>
<td>Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/50ekkr.gif"></td>
<td>Чек на 50 Еврокредитов</td>
<td class="chanceItem">Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/100ekkr.gif"></td>
<td>Чек на 100 Еврокредитов</td>
<td>Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/lootbag_.gif"></td>
<td>Сумка Валлуара Великого</td>
<td>Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora101.gif"></td>
<td>Улучшенная Сумка Короля</td>
<td>Невероятно редкое выпадение</td>
</tr>
<td><img src="//img.new-combats.tech/i/items/bag1291.gif"></td>
<td>Туманная Сумка</td>
<td>Невероятно редкое выпадение</td>
</table> </table>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script> <script>
let img = "<?= Config::get('img2') ?>/i/items";
let prizesArray = <?= json_encode($loto->getPrizes()) ?>;
let arrLiImg = [];
prizesArray.forEach(function (elem, key) {
arrLiImg.push(`<li><img src="${img}/${elem[0]}" title="${elem[1]}" alt="${elem[1]}" type="id${key}"></li>`);
});
var $ulImg = document.getElementsByClassName("list")[0] let ulImg = document.getElementsByClassName("list")[0]
var usedID = <?echo $u->info['id'];?>
var $arrLiImg = [ let finallyLiImg = arrLiImg.sort(() => 0.5 - Math.random())
'<li><img src="//img.new-combats.tech/i/items/pot_base_200_alldmg2_p1k.gif" type="id0" title="Зелье Каменной Стойкости"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_200_allmag2_p1k.gif" type="id1" title="Зелье Стража Магии"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_str.gif" type="id2" title="Топливо для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_dex.gif" type="id3" title="Смазка для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_inst.gif" type="id4" title="Ускоритель для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l11_e.gif" type="id5" title="Жесткая Рыба"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l10_e.gif" type="id6" title="Яблоко Раздора"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l5_eng.gif" type="id7" title="Бутерброд -The Best Friend-"></li>',
'<li><img src="//img.new-combats.tech/i/items/ambosia_gora.gif" type="id8" title="Амброзия подмастерья Владык"></li>',
'<li><img src="//img.new-combats.tech/i/items/ambosia_gora.gif" type="id9" title="Амброзия Скучающих Владык"></li>',
'<li><img src="//img.new-combats.tech/i/items/poor.gif" type="id10" title="Плохое Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/fine.gif" type="id11" title="Нормальное Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/best.gif" type="id12" title="Хорошее Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/svitok1.png" type="id13" title="Свиток Репутации Потерянного Входа"></li>',
'<li><img src="//img.new-combats.tech/i/items/joust_rew_s.gif" type="id14" title="Жетон Успеха"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora101.gif" type="id15" title="Улучшенная Сумка Короля"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora8.gif" type="id16" title="Сумка Защиты"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora10.gif" type="id17" title="Сумка Копателя Катакомб"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora9.gif" type="id18" title="Сумка Копателя Горы Легиона"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora7.gif" type="id19" title="Сумка Копателя Бездны"></li>',
'<li><img src="//img.new-combats.tech/i/items/lootbag_.gif" type="id20" title="Сумка Валлуара Великого"></li>',
'<li><img src="//img.new-combats.tech/i/items/bag1291.gif" type="id21" title="Туманная Сумка"></li>',
'<li><img src="//img.new-combats.tech/i/items/50ekkr.gif" type="id22" title="Чек на 50 Еврокредитов"></li>',
'<li><img src="//img.new-combats.tech/i/items/100ekkr.gif" type="id23" title="Чек на 100 Еврокредитов"></li>',
'<li><img src="//img.new-combats.tech/i/items/zolyaichko.gif" type="id24" title="Яйцо Дракона"></li>',
'<li><img src="//img.new-combats.tech/i/items/invoke_plain_honor_attack_invul_any1.gif" type="id25" title="Защита от Нападения [30]"></li>',
'<li><img src="//img.new-combats.tech/i/items/svitok1.png" type="id26" title="Свиток Репутации Горы Легиона"></li>',
'<li><img src="//img.new-combats.tech/i/items/voda112.gif" type="id27" title="Живая Вода"></li>',
'<li><img src="//img.new-combats.tech/i/items/otvar112.gif" type="id28" title="Отвар Когтей ПГ"></li>',
'<li><img src="//img.new-combats.tech/i/items/grib112.gif" type="id29" title="Сушеный Мухомор"></li>'
]
function shuffle (array) { for (let key of finallyLiImg) {
var currentIndex = array.length, temporaryValue, randomIndex ; let htmlElementsMessage = new DOMParser().parseFromString(key, "text/html").getElementsByTagName("li")[0]
ulImg.append(htmlElementsMessage)
while (0 != currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
var $finallyLiImg = shuffle($arrLiImg)
for (let key of $finallyLiImg) {
var $htmlElementsMessage = new DOMParser().parseFromString(key, "text/html").getElementsByTagName("li")[0]
$ulImg.append($htmlElementsMessage)
} }
var $button = document.getElementsByClassName("buttonRuletka")[0] var $button = document.getElementsByClassName("buttonRuletka")[0]
@ -271,8 +86,6 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
var $wrapper = document.getElementsByClassName("wraper")[0] var $wrapper = document.getElementsByClassName("wraper")[0]
var $imgWin = document.getElementById("imgWin") var $imgWin = document.getElementById("imgWin")
// $winWindow.style.top = `${$wrapper.offsetTop - 70}px`
// $winWindow.style.left = `${($wrapper.offsetWidth / 2) - 326}px`
$wrapper.style.marginTop = "110px" $wrapper.style.marginTop = "110px"
$winWindow.hidden = true $winWindow.hidden = true
@ -298,7 +111,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
var response = await fetch("/lotowork.php", { var response = await fetch("/lotowork.php", {
method: "POST", method: "POST",
body: usedID body: <?= $u->info['id'] ?>
}) })
$('.window').css({ $('.window').css({
@ -332,7 +145,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
$('.window').animate({ $('.window').animate({
right: elemRul - 452.5 right: elemRul - 452.5
}, 10000, () => { }, 10000, () => {
setTimeout( () => { setTimeout(() => {
var idThing = $winImg.children[0].getAttribute("type") var idThing = $winImg.children[0].getAttribute("type")
var titleThing = $winImg.children[0].getAttribute("title") var titleThing = $winImg.children[0].getAttribute("title")
@ -348,14 +161,14 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
$img.src = $winImg.children[0].getAttribute("src") $img.src = $winImg.children[0].getAttribute("src")
$imgWin.append($img) $imgWin.append($img)
timeOutWin = setTimeout( () => { timeOutWin = setTimeout(() => {
$imgWin.innerHTML = "" $imgWin.innerHTML = ""
$winWindow.hidden = true $winWindow.hidden = true
$wrapper.style.marginTop = "110px" $wrapper.style.marginTop = "110px"
}, 10000) }, 10000)
}, 300) }, 300)
}) })
// }); // });
} }
}); });
@ -370,7 +183,6 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
} }
</script> </script>
<style> <style>
#centerBlockLoto { #centerBlockLoto {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -388,7 +200,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
} }
#tableItemChange table { #tableItemChange table {
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
margin: auto; margin: auto;
@ -429,7 +241,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
position: relative; position: relative;
width: 25000px; width: 25000px;
height: 82px; height: 82px;
right: 0px; right: 0;
} }
.wraper { .wraper {
@ -456,6 +268,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
width: 75px; width: 75px;
height: 75px; height: 75px;
} }
.arrowup { .arrowup {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
@ -479,6 +292,7 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
border-left: 5px solid transparent; border-left: 5px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
} }
.buttonRuletka { .buttonRuletka {
font-size: 17px; font-size: 17px;
padding: 5px; padding: 5px;
@ -487,9 +301,11 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
background: rgba(0, 149, 25, 0.33); background: rgba(0, 149, 25, 0.33);
margin: 10px 0; margin: 10px 0;
} }
.buttonRuletka:hover, .buttonsElements:hover { .buttonRuletka:hover, .buttonsElements:hover {
background: rgba(0, 102, 149, 0.33); background: rgba(0, 102, 149, 0.33);
} }
#winDiv { #winDiv {
text-align: center; text-align: center;
border-radius: 3px; border-radius: 3px;
@ -498,46 +314,71 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
margin: 10px auto 5px; margin: 10px auto 5px;
padding: 7px; padding: 7px;
} }
.testDiv { .testDiv {
font-size: 16px; font-size: 16px;
} }
#win { #win {
font-weight: 600; font-weight: 600;
} }
</style> </style>
<td width="50" valign="top"> <td width="50" valign="top">
<TABLE cellspacing="0" cellpadding="0"><TD width="100%">&nbsp;</TD><TD> <TABLE cellspacing="0" cellpadding="0">
<table border="0" cellpadding="0" cellspacing="0"> <tr>
<tr align="right" valign="top"> <TD width="100%">&nbsp;</TD>
<td> <TD>
<!-- --> <table border="0" cellpadding="0" cellspacing="0">
<?= $goLis; ?> <tr align="right" valign="top">
<!-- --> <td>
<table border="0" cellspacing="0" cellpadding="0"> <?= $goLis; ?>
<tr> <table border="0" cellspacing="0" cellpadding="0">
<td nowrap="nowrap"> <tr>
<tr> <td nowrap="nowrap">
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7" /></td> <tr>
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.9&rnd=<?= $code; ?>';" title="<?php thisInfRm('1.180.0.9',1); ?>">Центральная площадь</a></td> <td bgcolor="#D3D3D3">
<img src="<?= Config::get('img2') ?>/i/move/links.gif" width="9"
height="7">
</td>
<td bgcolor="#D3D3D3" nowrap>
<a
href="#"
id="greyText"
class="menutop"
onclick="location='main.php?loc=1.180.0.9&rnd=<?= PassGen::intCode(
) ?>';"
title="<?php thisInfRm('1.180.0.9', 1); ?>">
Центральная площадь
</a>
</td>
</tr> </tr>
<tr> <tr>
<td bgcolor="#D3D3D3">
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7" /></td> <img src="<?= Config::get('img2') ?>/i/move/links.gif" width="9"
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.449&rnd=<?= $code; ?>';" title="<?php thisInfRm('1.180.0.449',1); ?>">Платная Комната</a></td> height="7">
</td> </td>
</tr> <td bgcolor="#D3D3D3" nowrap>
</td> <a
</tr> href="#"
</table> id="greyText"
</td></table> class="menutop"
</td></table> onclick="location='main.php?loc=1.180.0.449&rnd=<?= PassGen::intCode(
<br/> ) ?>';"
</td> title="<?php thisInfRm('1.180.0.449', 1); ?>">
</table> Платная Комната
<br> </a>
<div id="textgo" style="visibility:hidden;"></div> </td>
<?php </tr>
} </table>
?> </td>
</tr>
</table>
</td>
</tr>
</TABLE>
</td>
</tr>
</table>
<br><br>
<div id="textgo" style="visibility:hidden;"></div>

View File

@ -1,17 +1,24 @@
<?php <?php
if(!defined('GAME'))
{ use Core\Config;
die(); use Location\Loto;
if (!defined('GAME')) {
die();
} }
session_start(); if ($u->room['file'] != 'loto2') {
return;
}
$loto = new Loto();
if($u->room['file']=='loto2')
{
?> ?>
<TABLE width="100%" cellspacing="0" cellpadding="0"> <TABLE width="100%" cellspacing="0" cellpadding="0">
<tr><td valign="top" id="centerBlockLoto"><div align="center" class="pH3"><h1>Платная Рулетка</h1></div> <tr>
<br /> <td valign="top" id="centerBlockLoto">
<div align="center" class="pH3"><h1>Платная Рулетка</h1></div>
<br/>
<div id="winDiv"> <div id="winDiv">
<p class="testDiv">Ваш приз: <span id="win"></span></p> <p class="testDiv">Ваш приз: <span id="win"></span></p>
@ -25,244 +32,51 @@ if($u->room['file']=='loto2')
<ul class="list"></ul> <ul class="list"></ul>
</div> </div>
</div> </div>
<p id="ekrMessage">Стоимость платной прокрутки - 5 Еврокредитов! У Вас в наличии - <b id="ekr">---</b> Екр.<br> <p id="ekrMessage">Стоимость платной прокрутки - 5 Еврокредитов! У Вас в наличии - <b id="ekr">---</b>
<?if ($u->info['money2']>=5){?><button class="buttonRuletka" onclick="(<?= json_encode($idve) ?>)" formmethod="get">Запустить игру!</button><?} Екр.<br>
else <?php if ($u->info['money2'] >= 5): ?>
{}?> <button class="buttonRuletka" formmethod="get">Запустить игру!</button>
<button class="buttonsElements">Предметы и шансы</button> <?php endif; ?>
<button class="buttonsElements">Предметы и шансы</button>
<div id="tableItemChange" hidden> <div id="tableItemChange" hidden>
<table> <table>
<tr> <tr>
<th colspan="2">Предмет</th> <th colspan="2">Предмет</th>
<!-- <th></th> -->
<th>Шанс выпадения</th> <th>Шанс выпадения</th>
</tr> </tr>
<tr> <?= $loto->getPrizeListByRarity() ?>
<td><img src="//img.new-combats.tech/i/items/pot_base_200_alldmg2_p1k.gif"></td>
<td>Зелье Каменной Стойкости</td>
<td class="chanceItem">Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_200_allmag2_p1k.gif"></td>
<td>Зелье Стража Магии</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_str.gif"></td>
<td>Топливо для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_dex.gif"></td>
<td>Смазка для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/pot_base_1000_inst.gif"></td>
<td>Ускоритель для Големов</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/voda112.gif"></td>
<td>Живая Вода</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/otvar112.gif"></td>
<td>Отвар Когтей ПГ</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/grib112.gif"></td>
<td>Сушеный Мухомор</td>
<td>Частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l11_e.gif"></td>
<td>Жёсткая Рыба</td>
<td class="chanceItem">Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l10_e.gif"></td>
<td>Яблоко Раздора</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/food_l5_eng.gif"></td>
<td>Бутерброд -The Best Friend-</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/ambosia_gora.gif"></td>
<td>Амброзия Скучающих Владык</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/poor.gif"></td>
<td>Плохое Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/fine.gif"></td>
<td>Нормальное Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/best.gif"></td>
<td>Хорошее Железо</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/invoke_plain_honor_attack_invul_any1.gif">
</td>
<td>Защита от Нападения [30]</td>
<td>Нормальное выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/joust_rew_s.gif"></td>
<td>Жетон Успеха</td>
<td class="chanceItem">Не частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/ambosia_gora.gif"></td>
<td>Амброзия подмастерья Владык</td>
<td>Не частое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora10.gif"></td>
<td>Сумка Копателя Катакомб</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora9.gif"></td>
<td>Сумка Копателя Горы Легиона</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora7.gif"></td>
<td>Сумка Копателя Бездны</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/svitok1.png"></td>
<td>Свиток Репутации Горы Легиона</td>
<td>Редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/zolyaichko.gif"></td>
<td>Яйцо Дракона</td>
<td class="chanceItem">Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora8.gif"></td>
<td>Сумка Защиты</td>
<td>Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/svitok1.png"></td>
<td>Свиток Репутации Потерянного Входа</td>
<td>Очень редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/50ekkr.gif"></td>
<td>Чек на 50 Еврокредитов</td>
<td class="chanceItem">Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/100ekkr.gif"></td>
<td>Чек на 100 Еврокредитов</td>
<td>Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/lootbag_.gif"></td>
<td>Сумка Валлуара Великого</td>
<td>Невероятно редкое выпадение</td>
</tr>
<tr>
<td><img src="//img.new-combats.tech/i/items/jora101.gif"></td>
<td>Улучшенная Сумка Короля</td>
<td>Невероятно редкое выпадение</td>
</tr>
<td><img src="//img.new-combats.tech/i/items/bag1291.gif"></td>
<td>Туманная Сумка</td>
<td>Невероятно редкое выпадение</td>
</table> </table>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script> <script>
let img = "<?= Config::get('img2') ?>/i/items";
let prizesArray = <?= json_encode($loto->getPrizes()) ?>;
let arrLiImg = [];
prizesArray.forEach(function (elem, key) {
arrLiImg.push(`<li><img src="${img}/${elem[0]}" title="${elem[1]}" alt="${elem[1]}" type="id${key}"></li>`);
});
var $ulImg = document.getElementsByClassName("list")[0] let ulImg = document.getElementsByClassName("list")[0]
var usedID = <?echo $u->info['id'];?>
var $ekrB = document.getElementById("ekr") let ekrB = document.getElementById("ekr")
var testQ = 0 var testQ = 0
run() run()
async function run () { async function run() {
var response = await fetch("/lotoworkekr.php", { let response = await fetch("/lotoworkekr.php", {
method: "POST", method: "POST",
body: "ekr" body: "ekr"
}) })
var ekrRes = await response.text() ekrB.textContent = await response.text()
$ekrB.textContent = ekrRes
} }
var $arrLiImg = [ let finallyLiImg = arrLiImg.sort(() => 0.5 - Math.random())
'<li><img src="//img.new-combats.tech/i/items/pot_base_200_alldmg2_p1k.gif" type="id0" title="Зелье Каменной Стойкости"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_200_allmag2_p1k.gif" type="id1" title="Зелье Стража Магии"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_str.gif" type="id2" title="Топливо для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_dex.gif" type="id3" title="Смазка для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/pot_base_1000_inst.gif" type="id4" title="Ускоритель для Големов"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l11_e.gif" type="id5" title="Жесткая Рыба"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l10_e.gif" type="id6" title="Яблоко Раздора"></li>',
'<li><img src="//img.new-combats.tech/i/items/food_l5_eng.gif" type="id7" title="Бутерброд -The Best Friend-"></li>',
'<li><img src="//img.new-combats.tech/i/items/ambosia_gora.gif" type="id8" title="Амброзия подмастерья Владык"></li>',
'<li><img src="//img.new-combats.tech/i/items/ambosia_gora.gif" type="id9" title="Амброзия Скучающих Владык"></li>',
'<li><img src="//img.new-combats.tech/i/items/poor.gif" type="id10" title="Плохое Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/fine.gif" type="id11" title="Нормальное Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/best.gif" type="id12" title="Хорошее Железо"></li>',
'<li><img src="//img.new-combats.tech/i/items/svitok1.png" type="id13" title="Свиток Репутации Потерянного Входа"></li>',
'<li><img src="//img.new-combats.tech/i/items/joust_rew_s.gif" type="id14" title="Жетон Успеха"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora101.gif" type="id15" title="Улучшенная Сумка Короля"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora8.gif" type="id16" title="Сумка Защиты"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora10.gif" type="id17" title="Сумка Копателя Катакомб"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora9.gif" type="id18" title="Сумка Копателя Горы Легиона"></li>',
'<li><img src="//img.new-combats.tech/i/items/jora7.gif" type="id19" title="Сумка Копателя Бездны"></li>',
'<li><img src="//img.new-combats.tech/i/items/lootbag_.gif" type="id20" title="Сумка Валлуара Великого"></li>',
'<li><img src="//img.new-combats.tech/i/items/bag1291.gif" type="id21" title="Туманная Сумка"></li>',
'<li><img src="//img.new-combats.tech/i/items/50ekkr.gif" type="id22" title="Чек на 50 Еврокредитов"></li>',
'<li><img src="//img.new-combats.tech/i/items/100ekkr.gif" type="id23" title="Чек на 100 Еврокредитов"></li>',
'<li><img src="//img.new-combats.tech/i/items/zolyaichko.gif" type="id24" title="Яйцо Дракона"></li>',
'<li><img src="//img.new-combats.tech/i/items/invoke_plain_honor_attack_invul_any1.gif" type="id25" title="Защита от Нападения [30]"></li>',
'<li><img src="//img.new-combats.tech/i/items/svitok1.png" type="id26" title="Свиток Репутации Горы Легиона"></li>',
'<li><img src="//img.new-combats.tech/i/items/voda112.gif" type="id27" title="Живая Вода"></li>',
'<li><img src="//img.new-combats.tech/i/items/otvar112.gif" type="id28" title="Отвар Когтей ПГ"></li>',
'<li><img src="//img.new-combats.tech/i/items/grib112.gif" type="id29" title="Сушеный Мухомор"></li>'
]
function shuffle (array) { for (let key of finallyLiImg) {
var currentIndex = array.length, temporaryValue, randomIndex ; let htmlElementsMessage = new DOMParser().parseFromString(key, "text/html").getElementsByTagName("li")[0];
ulImg.append(htmlElementsMessage)
while (0 != currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
var $finallyLiImg = shuffle($arrLiImg)
for (let key of $finallyLiImg) {
var $htmlElementsMessage = new DOMParser().parseFromString(key, "text/html").getElementsByTagName("li")[0]
$ulImg.append($htmlElementsMessage)
} }
var $button = document.getElementsByClassName("buttonRuletka")[0] var $button = document.getElementsByClassName("buttonRuletka")[0]
@ -304,7 +118,7 @@ if($u->room['file']=='loto2')
var response = await fetch("/lotoworkekr.php", { var response = await fetch("/lotoworkekr.php", {
method: "POST", method: "POST",
body: usedID body: <?= $u->info['id'] ?>
}) })
var textFromResponse = await response.text() var textFromResponse = await response.text()
@ -331,7 +145,7 @@ if($u->room['file']=='loto2')
$('.window').animate({ $('.window').animate({
right: elemRul - 452.5 right: elemRul - 452.5
}, 10000, () => { }, 10000, () => {
setTimeout( () => { setTimeout(() => {
var idThing = $winImg.children[0].getAttribute("type") var idThing = $winImg.children[0].getAttribute("type")
var titleThing = $winImg.children[0].getAttribute("title") var titleThing = $winImg.children[0].getAttribute("title")
@ -347,14 +161,14 @@ if($u->room['file']=='loto2')
$img.src = $winImg.children[0].getAttribute("src") $img.src = $winImg.children[0].getAttribute("src")
$imgWin.append($img) $imgWin.append($img)
timeOutWin = setTimeout( () => { timeOutWin = setTimeout(() => {
$imgWin.innerHTML = "" $imgWin.innerHTML = ""
$winWindow.hidden = true $winWindow.hidden = true
$wrapper.style.marginTop = "110px" $wrapper.style.marginTop = "110px"
}, 10000) }, 10000)
}, 300) }, 300)
}) })
// }) ; // }) ;
} }
}); });
@ -369,7 +183,6 @@ if($u->room['file']=='loto2')
} }
</script> </script>
<style> <style>
#centerBlockLoto { #centerBlockLoto {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -387,7 +200,7 @@ if($u->room['file']=='loto2')
} }
#tableItemChange table { #tableItemChange table {
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
margin: auto; margin: auto;
@ -428,7 +241,7 @@ if($u->room['file']=='loto2')
position: relative; position: relative;
width: 25000px; width: 25000px;
height: 82px; height: 82px;
right: 0px; right: 0;
} }
.wraper { .wraper {
@ -455,6 +268,7 @@ if($u->room['file']=='loto2')
width: 75px; width: 75px;
height: 75px; height: 75px;
} }
.arrowup { .arrowup {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
@ -480,6 +294,7 @@ if($u->room['file']=='loto2')
border-left: 5px solid transparent; border-left: 5px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
} }
.buttonRuletka { .buttonRuletka {
font-size: 17px; font-size: 17px;
padding: 5px; padding: 5px;
@ -488,9 +303,11 @@ if($u->room['file']=='loto2')
background: rgba(0, 149, 25, 0.33); background: rgba(0, 149, 25, 0.33);
margin: 10px 0; margin: 10px 0;
} }
.buttonRuletka:hover, .buttonsElements:hover { .buttonRuletka:hover, .buttonsElements:hover {
background: rgba(0, 102, 149, 0.33); background: rgba(0, 102, 149, 0.33);
} }
#winDiv { #winDiv {
text-align: center; text-align: center;
border-radius: 3px; border-radius: 3px;
@ -499,12 +316,15 @@ if($u->room['file']=='loto2')
margin: 10px auto 5px; margin: 10px auto 5px;
padding: 7px; padding: 7px;
} }
.testDiv { .testDiv {
font-size: 16px; font-size: 16px;
} }
#win { #win {
font-weight: 600; font-weight: 600;
} }
#ekrMessage { #ekrMessage {
text-align: center; text-align: center;
font-size: 16px; font-size: 16px;
@ -512,31 +332,45 @@ if($u->room['file']=='loto2')
} }
</style> </style>
<td width="50" valign="top"> <td width="50" valign="top">
<TABLE cellspacing="0" cellpadding="0"><TD width="100%">&nbsp;</TD><TD> <TABLE cellspacing="0" cellpadding="0">
<table border="0" cellpadding="0" cellspacing="0"> <tr>
<tr align="right" valign="top"> <TD width="100%">&nbsp;</TD>
<td> <TD>
<!-- --> <table border="0" cellpadding="0" cellspacing="0">
<?= $goLis; ?> <tr align="right" valign="top">
<!-- --> <td>
<table border="0" cellspacing="0" cellpadding="0"> <?= $goLis; ?>
<tr> <table border="0" cellspacing="0" cellpadding="0">
<td nowrap="nowrap"> <tr>
<tr> <td nowrap="nowrap"></td>
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7" /></td> </tr>
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.371&rnd=<?= $code; ?>';" title="<?php thisInfRm('1.180.0.371',1); ?>">Бесплатное Лото</a></td> <tr>
</tr> <td bgcolor="#D3D3D3">
</td> <img src="<?= Config::get('img2') ?>/i/move/links.gif" width="9"
</tr> height="7">
</table> </td>
</td></table> <td bgcolor="#D3D3D3" nowrap>
</td></table> <a
<br/> href="#"
</td> id="greyText"
</table> class="menutop"
<br> onclick="location='main.php?loc=1.180.0.371&rnd=<?= PassGen::intCode(
<div id="textgo" style="visibility:hidden;"></div> ) ?>';"
<?php title="<?php thisInfRm('1.180.0.371', 1); ?>">
} Бесплатное Лото
?> </a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br>
<div id="textgo" style="visibility:hidden;"></div>