2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
2018-01-29 22:05:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2018.
|
|
|
|
|
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
|
|
|
|
* Project name: Battles-Game
|
|
|
|
|
*/
|
2021-01-27 15:19:05 +00:00
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
use Battles\Database\Db;
|
2021-01-27 15:19:05 +00:00
|
|
|
|
use Battles\Travel;
|
|
|
|
|
use Battles\User;
|
2021-08-27 15:55:18 +00:00
|
|
|
|
use Battles\UserStats;
|
2021-01-27 15:19:05 +00:00
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
require_once 'config.php';
|
2021-08-26 16:15:47 +00:00
|
|
|
|
|
2021-01-29 15:21:14 +00:00
|
|
|
|
if (empty($_SESSION['uid'])) {
|
|
|
|
|
header("Location: index.php");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2021-08-27 15:55:18 +00:00
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
if (User::getInstance()->getBlock()) {
|
2020-08-30 00:09:53 +00:00
|
|
|
|
exit('user blocked!');
|
2018-06-24 01:18:49 +00:00
|
|
|
|
}
|
2020-06-23 15:13:20 +00:00
|
|
|
|
|
2022-02-12 12:25:43 +00:00
|
|
|
|
//Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
Travel::roomRedirects(User::getInstance()->getRoom(), User::getInstance()->getBattle());
|
2020-10-29 23:30:05 +00:00
|
|
|
|
|
2021-08-27 15:55:18 +00:00
|
|
|
|
if (!empty($_GET['goto']) && !empty($_GET['tStamp']) && !empty($_GET['vcode']) && $_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) {
|
|
|
|
|
$query = 'update users u, online o set u.room = ?, o.room = ? where user_id = id and user_id = ?';
|
2022-01-26 23:15:33 +00:00
|
|
|
|
Db::getInstance()->execute($query, [$_GET['goto'], $_GET['goto'], User::getInstance()->getId()]);
|
|
|
|
|
User::getInstance()->setRoom(intval($_GET['goto']));
|
2020-06-23 19:34:52 +00:00
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2022-08-09 19:57:43 +00:00
|
|
|
|
function createbot($bot, $login = null): array
|
2018-01-28 16:40:49 +00:00
|
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
|
if (empty($login)) {
|
|
|
|
|
$login = Db::getInstance()->fetchColumn('select login from users where id = ?', $bot);
|
|
|
|
|
}
|
|
|
|
|
if (empty($login)) {
|
|
|
|
|
return [];
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
Db::getInstance()->execute('insert into bots (name, prototype) values (?,?)', [$login, $bot]);
|
|
|
|
|
return [
|
|
|
|
|
'id' => Db::getInstance()->lastInsertId(),
|
|
|
|
|
'login' => $login,
|
|
|
|
|
];
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 14:46:00 +00:00
|
|
|
|
$var_map = [
|
2018-01-28 16:40:49 +00:00
|
|
|
|
'cell_1' => 'Березовая роща', 'cell_2' => 'Березовая просека', 'cell_3' => 'Тёмный угол', 'cell_4' => 'Мрачная опушка',
|
|
|
|
|
'cell_5' => 'Тёмное урочище', 'cell_6' => 'Бурелом', 'cell_7' => 'Старая ива', 'cell_8' => 'Разнолесье',
|
|
|
|
|
'cell_9' => 'Сосновая тропа', 'cell_10' => 'Забытая дорога', 'cell_11' => 'Новая дорога', 'cell_12' => 'Мщаник',
|
|
|
|
|
'cell_13' => 'Ясная поляна', 'cell_14' => 'Заросший тракт', 'cell_15' => 'Смутный ельник', 'cell_16' => 'Сосновый бор',
|
|
|
|
|
'cell_17' => 'Тихоход', 'cell_18' => 'Сосновый гай', 'cell_19' => 'Смешаный лес', 'cell_20' => 'Темная поляна',
|
|
|
|
|
'cell_21' => 'Осенний угол', 'cell_22' => 'Грибное место', 'cell_23' => 'Опушка', 'cell_24' => 'Рыжий лес',
|
2020-06-23 16:57:16 +00:00
|
|
|
|
'cell_25' => 'Полесье',
|
2018-12-27 14:46:00 +00:00
|
|
|
|
];
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2021-08-26 14:44:14 +00:00
|
|
|
|
const _BOTSEPARATOR_ = 10000000;
|
2020-06-24 05:30:01 +00:00
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
function savecavedata($cavedata, $caveleader, $floor)
|
|
|
|
|
{
|
|
|
|
|
$f1 = fopen("cavedata/$caveleader-$floor.dat", "wb+");
|
|
|
|
|
flock($f1, LOCK_EX);
|
|
|
|
|
fwrite($f1, serialize($cavedata));
|
|
|
|
|
flock($f1, LOCK_UN);
|
|
|
|
|
fclose($f1);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-27 13:18:55 +00:00
|
|
|
|
/**
|
2020-08-29 23:21:22 +00:00
|
|
|
|
* Генератор прогрессбара.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
*
|
2020-08-30 00:09:53 +00:00
|
|
|
|
* @param $current - Текущее значение.
|
|
|
|
|
* @param $maximum - Максимальное значение.
|
2020-08-29 23:21:22 +00:00
|
|
|
|
* @param string $line_color - Цвет полоски прогрессбара.
|
2020-08-30 00:09:53 +00:00
|
|
|
|
* @param string $bg_color - Фон прогрессбара.
|
2022-08-09 19:57:43 +00:00
|
|
|
|
*
|
2020-08-29 23:21:22 +00:00
|
|
|
|
* @return string
|
2018-12-27 13:18:55 +00:00
|
|
|
|
*/
|
2021-08-26 14:44:14 +00:00
|
|
|
|
function showProgressBar($current, $maximum, string $line_color = 'limegreen', string $bg_color = 'silver'): string
|
2018-12-27 12:59:45 +00:00
|
|
|
|
{
|
2018-12-27 23:13:46 +00:00
|
|
|
|
$bar = round($current / $maximum * 100);
|
2020-06-23 20:24:15 +00:00
|
|
|
|
return <<<HTML
|
2018-12-27 23:13:46 +00:00
|
|
|
|
<div style="width: 100%; height: 16px; background: $bg_color; overflow: hidden; border-radius: 3px;">
|
|
|
|
|
<div style="height: 16px; background: $line_color; border-radius: 3px; width: $bar%;"></div>
|
2018-12-27 12:59:45 +00:00
|
|
|
|
</div>
|
2022-08-09 19:57:43 +00:00
|
|
|
|
<div style="width: 100%; height: 16px; font-size: 14px; text-align: center; margi
|
|
|
|
|
n-top: -16px;">
|
2018-12-27 23:13:46 +00:00
|
|
|
|
$current / $maximum
|
2018-12-27 12:59:45 +00:00
|
|
|
|
</div>
|
2018-12-27 13:18:55 +00:00
|
|
|
|
HTML;
|
2018-12-27 12:59:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-24 06:45:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Функция отображает слот для свитков в окне персонажа.
|
2020-07-03 15:36:06 +00:00
|
|
|
|
*
|
2020-06-24 06:45:32 +00:00
|
|
|
|
* @param $slot
|
2020-07-03 15:36:06 +00:00
|
|
|
|
*
|
2022-08-09 19:57:43 +00:00
|
|
|
|
* @return string
|
2020-06-24 06:45:32 +00:00
|
|
|
|
*/
|
2022-08-09 19:57:43 +00:00
|
|
|
|
function echoscroll($slot): string
|
2018-01-28 16:40:49 +00:00
|
|
|
|
{
|
2020-06-24 06:45:32 +00:00
|
|
|
|
$all_magic = 0;
|
2022-01-26 23:15:33 +00:00
|
|
|
|
if (User::getInstance()->getBattle()) {
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$script = 'fbattle';
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$all_magic = Db::getInstance()->fetchColumn('select magic from battle where id = ?', User::getInstance()->getBattle());
|
|
|
|
|
$all_magic = unserialize($all_magic);
|
2020-06-24 06:45:32 +00:00
|
|
|
|
} else {
|
|
|
|
|
$script = 'main';
|
2018-03-08 22:30:57 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$dress = Db::getInstance()->fetch('select magic, name, image, durability from inventory where item_id - ?', User::getInstance()->$slot);
|
|
|
|
|
$need_charge = Db::getInstance()->fetchColumn('select needcharge from magic where id = ?', $dress['magic']);
|
|
|
|
|
$str = null;
|
|
|
|
|
if ((User::getInstance()->$slot > 0) && ($all_magic[User::getInstance()->getId()] < 1 || empty($need_charge))) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$row['id'] = User::getInstance()->$slot;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
if ($dress['magic']) {
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$magic_targeted = Db::getInstance()->fetchColumn('select targeted from magic where id = ?', $dress['magic']);
|
|
|
|
|
$str .= "<a onclick=\"";
|
|
|
|
|
if ($magic_targeted === 1) {
|
|
|
|
|
$str .= "okno('Введите название предмета', '" . $script . ".php?use={$row['id']}', 'target'); ";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else
|
2022-08-09 19:57:43 +00:00
|
|
|
|
if ($magic_targeted === 2) {
|
|
|
|
|
$str .= "findlogin('Введите имя персонажа', '" . $script . ".php?use={$row['id']}', 'target'); ";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$str .= "if(confirm('Использовать сейчас?')) { window.location='" . $script . ".php?use=" . $row['id'] . "';}";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$str .= "\"href='#'>";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$str .= <<<ACTIVE_SCROLL
|
2020-06-24 06:45:32 +00:00
|
|
|
|
<img class='tooltip' src="i/sh/{$dress['img']}" width='40' title="<b>{$dress['name']}</b><br> Прочность {$dress['duration']} / {$dress['maxdur']} " height='25' alt="Свиток"></a>
|
|
|
|
|
ACTIVE_SCROLL;
|
2022-01-26 23:15:33 +00:00
|
|
|
|
} elseif ((User::getInstance()->$slot > 0) && ($all_magic[User::getInstance()->getId()] >= 1) && $need_charge['needcharge'] > 0) {
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$str .= <<<INACTIVE_SCROLL
|
2020-06-24 06:45:32 +00:00
|
|
|
|
<img src="i/sh/magicclock.gif" width="40" height="25" title='Произведите размен ударами и магия снова станет доступна' alt="Свиток">
|
|
|
|
|
INACTIVE_SCROLL;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$str .= <<<EMPTY_SLOT
|
2020-06-24 06:45:32 +00:00
|
|
|
|
<img class="tooltip" src="i/w13.gif" width="40" height="25" title='<b>Пустой слот магия</b>' alt="Слот для свитка">
|
|
|
|
|
EMPTY_SLOT;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
2022-08-09 19:57:43 +00:00
|
|
|
|
return $str;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-09 19:57:43 +00:00
|
|
|
|
function timeOut($ttm): string
|
2018-01-28 16:40:49 +00:00
|
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
|
require_once 'classes/quests_class.php';
|
|
|
|
|
$q = new Quests();
|
|
|
|
|
return $q->timeOut($ttm);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-01 10:57:27 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param $time
|
|
|
|
|
* @param $vars
|
|
|
|
|
* @param $vls
|
|
|
|
|
* @param $uid
|
|
|
|
|
*/
|
2018-01-28 16:40:49 +00:00
|
|
|
|
function addActions($time, $vars, $vls, $uid)
|
|
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$query = 'insert into actions (uid, time, city, room, vars, ip, vals) values (?,?,?,?,?,?,?)';
|
|
|
|
|
$values = [$uid, $time, 'capitalcity', 0, $vars, $_SERVER['REMOTE_ADDR'], $vls];
|
|
|
|
|
Db::getInstance()->execute('lock tables actions write');
|
|
|
|
|
Db::getInstance()->execute($query, $values);
|
|
|
|
|
Db::getInstance()->execute('unlock tables');
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 15:55:18 +00:00
|
|
|
|
/* ВАЖНО! (#44)
|
|
|
|
|
* addch() и addchp() заменяются на Chat::class->addSYSMessage($message, [optional]$receiver);
|
|
|
|
|
* Для addchp() используется второй опциональный ключ.
|
|
|
|
|
* Это 150+ вхождений в куче файлов, где надо менять структуру вызова функции из-за их несовместимости.
|
|
|
|
|
* Возможно, приоритетом стоит сделать унификацию свитков нападения, которых самих около 20 и которые
|
|
|
|
|
* по нескольку раз вызывают эти функции.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
function addch($text, $room = 0)
|
|
|
|
|
{
|
|
|
|
|
if ($room == 0) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$room = User::getInstance()->getRoom();
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
if ($fp = @fopen("tmp/chat.txt", "a")) { //открытие
|
|
|
|
|
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
|
2022-02-12 12:25:43 +00:00
|
|
|
|
fwrite($fp, ":[" . time() . "]:[!sys!!]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
|
2018-01-28 16:40:49 +00:00
|
|
|
|
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
|
|
|
|
|
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
|
|
|
|
|
fclose($fp); //закрытие
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addchp($text, $who, $room = 0)
|
|
|
|
|
{
|
|
|
|
|
if ($room == 0) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$room = User::getInstance()->getRoom();
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
$fp = fopen("tmp/chat.txt", "a"); //открытие
|
|
|
|
|
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
|
2022-02-12 12:25:43 +00:00
|
|
|
|
fwrite($fp, ":[" . time() . "]:[{$who}]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
|
2018-01-28 16:40:49 +00:00
|
|
|
|
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
|
|
|
|
|
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
|
|
|
|
|
fclose($fp); //закрытие
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function err($t)
|
|
|
|
|
{
|
2020-06-23 09:24:37 +00:00
|
|
|
|
echo '<span class="error">' . $t . '</span>';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 15:13:20 +00:00
|
|
|
|
|
2019-02-15 22:03:02 +00:00
|
|
|
|
/**
|
2022-08-09 19:57:43 +00:00
|
|
|
|
* @param int $userId
|
2021-02-01 01:39:50 +00:00
|
|
|
|
* @param string $text
|
2019-09-17 14:37:44 +00:00
|
|
|
|
*
|
2019-02-15 22:03:02 +00:00
|
|
|
|
*/
|
2021-02-01 01:39:50 +00:00
|
|
|
|
function telegraph(int $userId, string $text)
|
2019-02-15 22:03:02 +00:00
|
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
|
$userExists = Db::getInstance()->fetchColumn('select count(*) from users where id = ?', $userId) > 0;
|
|
|
|
|
if ($userExists) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
Db::getInstance()->execute('INSERT INTO chat (user_id,receiver_id,msg,type) VALUES (-1,?,?,?)', [$userId, $text, 'sms']);
|
2020-06-23 20:24:15 +00:00
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 15:55:18 +00:00
|
|
|
|
function SolveExp($at_id, $def_id, $damage): float
|
2018-01-28 16:40:49 +00:00
|
|
|
|
{
|
2021-08-27 15:55:18 +00:00
|
|
|
|
$mods = [
|
|
|
|
|
'bloodb' => 1.2,
|
|
|
|
|
'btl_1' => 1,
|
|
|
|
|
'btl_2' => 0.5,
|
|
|
|
|
'btl_3' => 0.05,
|
2022-08-09 19:57:43 +00:00
|
|
|
|
];
|
2021-08-27 15:55:18 +00:00
|
|
|
|
$baseexp = [
|
|
|
|
|
"0" => "2",
|
|
|
|
|
"1" => "5",
|
|
|
|
|
"2" => "10",
|
|
|
|
|
"3" => "15",
|
|
|
|
|
"4" => "30",
|
|
|
|
|
"5" => "60",
|
|
|
|
|
"6" => "90",
|
|
|
|
|
"7" => "115",
|
|
|
|
|
"8" => "300",
|
|
|
|
|
"9" => "400",
|
|
|
|
|
"10" => "500",
|
|
|
|
|
"11" => "600",
|
|
|
|
|
"12" => "700",
|
|
|
|
|
"13" => "800",
|
|
|
|
|
"14" => "900",
|
|
|
|
|
"15" => "1000",
|
|
|
|
|
"16" => "1100",
|
|
|
|
|
"17" => "1200",
|
|
|
|
|
"18" => "1300",
|
|
|
|
|
"19" => "1400",
|
|
|
|
|
"20" => "1500",
|
|
|
|
|
"21" => "1600",
|
|
|
|
|
];
|
2018-12-10 20:16:42 +00:00
|
|
|
|
$expmf = 0;
|
|
|
|
|
$bot_active = false;
|
|
|
|
|
$bot_def = false;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
|
|
|
|
if ($at_id > _BOTSEPARATOR_) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$at_id = Db::getInstance()->fetchColumn('select prototype from bots where bot_id = ?', $at_id);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$bot_active = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 15:55:18 +00:00
|
|
|
|
$query = 'select greatest(1, sum(price)) as allprice from users left join inventory on users.id = inventory.owner_id where id = ?';
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$atAllPrice = Db::getInstance()->fetchColumn($query, $at_id);
|
|
|
|
|
$defAllPrice = Db::getInstance()->fetchColumn($query, $def_id);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2021-08-27 15:55:18 +00:00
|
|
|
|
$atInfo = new UserStats($at_id);
|
|
|
|
|
$defInfo = new UserStats($def_id);
|
|
|
|
|
|
|
|
|
|
$table_name = $at_id > _BOTSEPARATOR_ ? 'bots' : 'users';
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$bt = Db::getInstance()->ofetch('select blood, type, t1, t2 from battle where battle_id = (select battle from ? where id = ?)', [$table_name, $at_id]);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
|
|
|
|
if ($def_id > _BOTSEPARATOR_) {
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$def_id = Db::getInstance()->fetchColumn('select prototype from bots where bot_id = ?', $def_id);
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$bot_def = true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
if ($bt->blood) {
|
2018-02-27 02:48:51 +00:00
|
|
|
|
$expmf = $mods['bloodb'];
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$filebtl = '/tmp/' . $at_id . '.btl';
|
2022-01-26 23:15:33 +00:00
|
|
|
|
if ($bt->type == 1 && file_exists($filebtl)) {
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$btfl = fopen($filebtl, 'r');
|
|
|
|
|
$contents = fread($btfl, filesize($filebtl));
|
|
|
|
|
fclose($btfl);
|
|
|
|
|
$cnt = substr_count($contents, $def_id);
|
|
|
|
|
$exmod = 1;
|
|
|
|
|
|
|
|
|
|
if ($cnt <= 1) {
|
|
|
|
|
$exmod = $mods['btl_1'];
|
|
|
|
|
} elseif ($cnt == 2) {
|
|
|
|
|
$exmod = $mods['btl_2'];
|
|
|
|
|
} elseif ($cnt > 2) {
|
|
|
|
|
$exmod = $mods['btl_3'];
|
|
|
|
|
}
|
|
|
|
|
$expmf = $expmf * $exmod;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-27 02:48:51 +00:00
|
|
|
|
$standart = [
|
|
|
|
|
"0" => 1,
|
|
|
|
|
"1" => 1,
|
|
|
|
|
"2" => 15,
|
|
|
|
|
"3" => 111,
|
|
|
|
|
"4" => 265,
|
|
|
|
|
"5" => 526,
|
|
|
|
|
"6" => 882,
|
|
|
|
|
"7" => 919,
|
|
|
|
|
"8" => 919,
|
|
|
|
|
"9" => 919,
|
|
|
|
|
"10" => 919,
|
|
|
|
|
"11" => 919,
|
|
|
|
|
"12" => 919,
|
2021-08-27 15:55:18 +00:00
|
|
|
|
"13" => 919,
|
|
|
|
|
"14" => 919,
|
|
|
|
|
"15" => 919,
|
|
|
|
|
"16" => 919,
|
|
|
|
|
"17" => 919,
|
|
|
|
|
"18" => 919,
|
|
|
|
|
"19" => 919,
|
|
|
|
|
"20" => 919,
|
|
|
|
|
"21" => 919,
|
|
|
|
|
"22" => 919,
|
|
|
|
|
"23" => 919,
|
|
|
|
|
"24" => 919,
|
|
|
|
|
"25" => 919
|
|
|
|
|
];
|
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$mfit = ($atAllPrice / ($standart[$atInfo->getLevel()] / 3));
|
2018-01-28 16:40:49 +00:00
|
|
|
|
if ($mfit < 0.8) {
|
|
|
|
|
$mfit = 0.8;
|
|
|
|
|
}
|
|
|
|
|
if ($mfit > 1.5) {
|
|
|
|
|
$mfit = 1.5;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
$pls = count(explode(";", $bt->t1)) + count(explode(";", $bt->t2));
|
2018-01-28 16:40:49 +00:00
|
|
|
|
if ($pls > 2) {
|
2020-06-23 20:24:15 +00:00
|
|
|
|
$mfbot = $bot_active ? 0.3 : 1;
|
|
|
|
|
$mfbot2 = $bot_def ? 0.7 : 1;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
|
|
|
|
$mfbot = 1;
|
|
|
|
|
$mfbot2 = 1;
|
|
|
|
|
}
|
|
|
|
|
if ($expmf == 0) {
|
|
|
|
|
$expmf = 1;
|
|
|
|
|
}
|
2020-06-23 20:24:15 +00:00
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
|
return round((($baseexp[$defInfo->getLevel()]) * ($defAllPrice / (($atAllPrice + $defAllPrice) / 2)) * ($damage / $defInfo->getMaxHealth()) * $expmf * $mfit * $mfbot * $mfbot2) / 3);
|
2021-08-27 15:55:18 +00:00
|
|
|
|
}
|