Merge remote-tracking branch 'origin/master'
# Conflicts: # admin/admin.php # classes/Battles/User.php # classes/Battles/UserStats.php # fbattle.php # functions.php
This commit is contained in:
commit
b1f578f4b0
@ -1,10 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
# Date: 31.01.2021 (20:21)
|
# Date: 31.01.2021 (20:21)
|
||||||
|
require_once '../config.php';
|
||||||
|
|
||||||
|
use Battles\Admin\Item;
|
||||||
|
|
||||||
|
if (isset($_POST)) {
|
||||||
|
Item::add($_POST);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<form method=post>
|
<form method=post>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
<caption>Добавление вещей в магазин</caption>
|
<caption>Добавление вещей в игру</caption>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="main">Основное
|
<th id="main">Основное
|
||||||
<tr>
|
<tr>
|
||||||
@ -18,7 +25,7 @@
|
|||||||
<option value="2">Цветной</option>
|
<option value="2">Цветной</option>
|
||||||
</select>
|
</select>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=count placeholder="Количество (шт.)">
|
<td><input name=count placeholder="Количество (шт.)" disabled>
|
||||||
<tr>
|
<tr>
|
||||||
<td><select name="item_type">
|
<td><select name="item_type">
|
||||||
<option value="0" selected disabled>Тип предмета</option>
|
<option value="0" selected disabled>Тип предмета</option>
|
||||||
@ -41,7 +48,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><input name=durability placeholder="Макс. износ">
|
<td><input name=durability placeholder="Макс. износ">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=price placeholder="Цена (кр.)">
|
<td><input name=price placeholder="Цена (кр.)" disabled>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="needs">Требования
|
<th id="needs">Требования
|
||||||
<tr>
|
<tr>
|
||||||
@ -65,79 +72,29 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><input name=maxu placeholder="Макс.урон">
|
<td><input name=maxu placeholder="Макс.урон">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=gsila placeholder="Сила">
|
<td><input name=add_strength placeholder="Сила">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=glovk placeholder="Ловкость">
|
<td><input name=add_dexterity placeholder="Ловкость">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=ginta placeholder="Интуиция">
|
<td><input name=add_intuition placeholder="Интуиция">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=gintel placeholder="Интеллект">
|
<td><input name=add_endurance placeholder="Выносливость">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=ghp placeholder="НР">
|
<td><input name=add_intelligence placeholder="Интеллект">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=mfkrit placeholder="Мф.крит">
|
<td><input name=add_wisdom placeholder="Мудрость">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=mfakrit placeholder="Мф.антикрит">
|
<td><input name=add_accuracy placeholder="Точность">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=mfuvorot placeholder="Мф.уворот">
|
<td><input name=add_evasion placeholder="Уворот">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=mfauvorot placeholder="Мф.антиуворот">
|
<td><input name=add_criticals placeholder="Крит">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=gnoj placeholder="Ум.ножи">
|
<td><input name=add_min_physical_damage placeholder="Мин.удар">
|
||||||
<tr>
|
<tr>
|
||||||
<td><input name=gtopor placeholder="Ум.топоры">
|
<td><input name=add_min_physical_damage placeholder="Макс.удар">
|
||||||
<tr>
|
|
||||||
<td><input name=gdubina placeholder="Ум.дубины">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gmech placeholder="Ум.мечи">
|
|
||||||
<tr>
|
|
||||||
<td><input name=bron1 placeholder="Броня головы">
|
|
||||||
<tr>
|
|
||||||
<td><input name=bron2 placeholder="Броня корпуса">
|
|
||||||
<tr>
|
|
||||||
<td><input name=bron3 placeholder="Броня пояса">
|
|
||||||
<tr>
|
|
||||||
<td><input name=bron4 placeholder="Броня ног">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gfire placeholder="Мастерство огня">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gwater placeholder="Мастерство воды">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gair placeholder="Мастерство воздуха">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gearth placeholder="Мастерство земли">
|
|
||||||
<tr>
|
|
||||||
<td><input name=glight placeholder="Светлая магия">
|
|
||||||
<tr>
|
|
||||||
<td><input name=ggray placeholder="Серая магия">
|
|
||||||
<tr>
|
|
||||||
<td><input name=gdark placeholder="Темная магия">
|
|
||||||
<tr>
|
|
||||||
<td><input name=encicl placeholder="В энциклопедию">
|
|
||||||
<tr>
|
|
||||||
<td><input name=magic placeholder="Наложенно заклятие">
|
|
||||||
</table>
|
</table>
|
||||||
<INPUT TYPE="submit" value="Добавить">
|
<INPUT TYPE="submit" value="Добавить">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
|
||||||
if (isset($_POST)) {
|
|
||||||
echo "Ждём лучших времён!";
|
|
||||||
//if($_POST['razdel'] !=7) $goden_tmp=0; else */
|
|
||||||
// $goden_tmp = $_POST['goden'];
|
|
||||||
//
|
|
||||||
// if ($_POST['shop'] == 1) if (mysql_query("INSERT INTO shop(name,duration,maxdur,cost,ecost,nlevel,nsila,nlovk,ninta,nvinos,nintel,nmudra,nnoj,ntopor,ndubina,nmech,nalign,minu,maxu,goden,gsila,glovk,ginta,gintel,ghp,mfkrit,mfakrit,mfuvorot,mfauvorot,gnoj,gtopor,gdubina,gmech,img,count,bron1,bron2,bron3,bron4,magic,type,massa,needident,nfire,nwater,nair,nearth,nlight,ngray,ndark,gfire,gwater,gair,gearth,glight,ggray,gdark,encicl,artefact,letter,isrep,razdel) VALUES ('" . $_POST['name'] . "','" . $_POST['duration'] . "','" . $_POST['maxdur'] . "','" . $_POST['cost'] . "','" . $_POST['ecost'] . "','" . $_POST['nlevel'] . "','" . $_POST['nsila'] . "','" . $_POST['nlovk'] . "','" . $_POST['ninta'] . "','" . $_POST['nvinos'] . "','" . $_POST['nintel'] . "','" . $_POST['nmudra'] . "','" . $_POST['nnoj'] . "','" . $_POST['ntopor'] . "','" . $_POST['ndubina'] . "','" . $_POST['nmech'] . "','" . $_POST['nalign'] . "','" . $_POST['minu'] . "','" . $_POST['maxu'] . "','" . $goden_tmp . "','" . $_POST['gsila'] . "','" . $_POST['glovk'] . "','" . $_POST['ginta'] . "','" . $_POST['gintel'] . "','" . $_POST['ghp'] . "','" . $_POST['mfkrit'] . "','" . $_POST['mfakrit'] . "','" . $_POST['mfuvorot'] . "','" . $_POST['mfauvorot'] . "','" . $_POST['gnoj'] . "','" . $_POST['gtopor'] . "','" . $_POST['gdubina'] . "','" . $_POST['gmech'] . "','" . $_POST['img'] . "','" . $_POST['count'] . "','" . $_POST['bron1'] . "','" . $_POST['bron2'] . "','" . $_POST['bron3'] . "','" . $_POST['bron4'] . "','" . $_POST['magic'] . "','" . $_POST['type'] . "','" . $_POST['massa'] . "','" . $_POST['needident'] . "','" . $_POST['nfire'] . "','" . $_POST['nwater'] . "','" . $_POST['nair'] . "','" . $_POST['nearth'] . "','" . $_POST['nlight'] . "','" . $_POST['ngray'] . "','" . $_POST['ndark'] . "','" . $_POST['gfire'] . "','" . $_POST['gwater'] . "','" . $_POST['gair'] . "','" . $_POST['gearth'] . "','" . $_POST['glight'] . "','" . $_POST['ggray'] . "','" . $_POST['gdark'] . "','" . $_POST['encicl'] . "','0','" . $_POST['letter'] . "','" . $_POST['isrep'] . "','" . $_POST['razdel'] . "');")) {
|
|
||||||
// echo "Предмет успешно добавлен";
|
|
||||||
// } else {
|
|
||||||
// echo "Предмет не был добавлен!-1";
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// if ($_POST['shop'] == 2) if (mysql_query("INSERT INTO fshop(name,duration,maxdur,cost,ecost,nlevel,nsila,nlovk,ninta,nvinos,nintel,nmudra,nnoj,ntopor,ndubina,nmech,nalign,minu,maxu,goden,gsila,glovk,ginta,gintel,ghp,mfkrit,mfakrit,mfuvorot,mfauvorot,gnoj,gtopor,gdubina,gmech,img,count,bron1,bron2,bron3,bron4,magic,type,massa,needident,nfire,nwater,nair,nearth,nlight,ngray,ndark,gfire,gwater,gair,gearth,glight,ggray,gdark,letter,isrep,razdel) VALUES ('" . $_POST['name'] . "','" . $_POST['duration'] . "','" . $_POST['maxdur'] . "','" . $_POST['cost'] . "','" . $_POST['ecost'] . "','" . $_POST['nlevel'] . "','" . $_POST['nsila'] . "','" . $_POST['nlovk'] . "','" . $_POST['ninta'] . "','" . $_POST['nvinos'] . "','" . $_POST['nintel'] . "','" . $_POST['nmudra'] . "','" . $_POST['nnoj'] . "','" . $_POST['ntopor'] . "','" . $_POST['ndubina'] . "','" . $_POST['nmech'] . "','" . $_POST['nalign'] . "','" . $_POST['minu'] . "','" . $_POST['maxu'] . "','" . $goden_tmp . "','" . $_POST['gsila'] . "','" . $_POST['glovk'] . "','" . $_POST['ginta'] . "','" . $_POST['gintel'] . "','" . $_POST['ghp'] . "','" . $_POST['mfkrit'] . "','" . $_POST['mfakrit'] . "','" . $_POST['mfuvorot'] . "','" . $_POST['mfauvorot'] . "','" . $_POST['gnoj'] . "','" . $_POST['gtopor'] . "','" . $_POST['gdubina'] . "','" . $_POST['gmech'] . "','" . $_POST['img'] . "','" . $_POST['count'] . "','" . $_POST['bron1'] . "','" . $_POST['bron2'] . "','" . $_POST['bron3'] . "','" . $_POST['bron4'] . "','" . $_POST['magic'] . "','" . $_POST['type'] . "','" . $_POST['massa'] . "','" . $_POST['needident'] . "','" . $_POST['nfire'] . "','" . $_POST['nwater'] . "','" . $_POST['nair'] . "','" . $_POST['nearth'] . "','" . $_POST['nlight'] . "','" . $_POST['ngray'] . "','" . $_POST['ndark'] . "','" . $_POST['gfire'] . "','" . $_POST['gwater'] . "','" . $_POST['gair'] . "','" . $_POST['gearth'] . "','" . $_POST['glight'] . "','" . $_POST['ggray'] . "','" . $_POST['gdark'] . "','" . $_POST['letter'] . "','" . $_POST['isrep'] . "','" . $_POST['razdel'] . "');")) {
|
|
||||||
// echo "Предмет успешно добавлен";
|
|
||||||
// } else {
|
|
||||||
// echo "Предмет не был добавлен!" . mysql_error();
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
}
|
|
||||||
//End item adder
|
|
@ -4,10 +4,11 @@
|
|||||||
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
||||||
* Project name: Battles-Game
|
* Project name: Battles-Game
|
||||||
*/
|
*/
|
||||||
require_once '../functions.php';
|
require_once '../config.php';
|
||||||
|
|
||||||
use Battles\Database\Db;
|
use Battles\Admin\Clan;
|
||||||
use Battles\GameConfigs;
|
use Battles\Admin\User as AUser;
|
||||||
|
use Battles\Chat;
|
||||||
use Battles\Moderation;
|
use Battles\Moderation;
|
||||||
use Battles\Template;
|
use Battles\Template;
|
||||||
use Battles\User;
|
use Battles\User;
|
||||||
@ -29,72 +30,25 @@ if (isset($_POST['syschatmsg'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//clans to reg
|
//clans to reg
|
||||||
$unregisteredClans = new class {
|
Clan::getUnapprovedList();
|
||||||
|
|
||||||
public function getList()
|
|
||||||
{
|
|
||||||
$row = Db::getInstance()->ofetchAll('SELECT * FROM clans WHERE status = 0');
|
|
||||||
$i = 0;
|
|
||||||
while ($i < count($row)) {
|
|
||||||
$id = $row[$i]->owner_id;
|
|
||||||
$login = User::getInstance($row[$i]->owner_id)->getLogin();
|
|
||||||
$fullName = $row[$i]->full_name;
|
|
||||||
$shortName = $row[$i]->short_name;
|
|
||||||
$info = nl2br($row[$i]->info);
|
|
||||||
$i++;
|
|
||||||
echo <<<UNREGCLANLIST
|
|
||||||
<div>
|
|
||||||
<fieldset style="display: inline;">
|
|
||||||
<legend>$fullName [$shortName]</legend>
|
|
||||||
Глава клана: <span class="abils">$login</span><br>
|
|
||||||
Описание:<div class="abils">$info</div>
|
|
||||||
<BR>
|
|
||||||
<button onclick="location.href='?regclan=$id'">Зарегистрировать</button>
|
|
||||||
<button onclick="location.href='?remclan=$id'">Отказать</button>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
UNREGCLANLIST;
|
|
||||||
}
|
|
||||||
unset($i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function allowRegister($id)
|
|
||||||
{
|
|
||||||
Db::getInstance()->execute('UPDATE clans SET status = 1 WHERE status = 0 AND owner_id = ?', $id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function disallowRegister($id)
|
|
||||||
{
|
|
||||||
Db::getInstance()->execute('DELETE FROM clans WHERE status = 0 AND owner_id = ?', $id);
|
|
||||||
User::getInstance()->money()->modifyBank(GameConfigs::CLAN['clan_register_cost']);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$unregisteredClans->getList();
|
|
||||||
|
|
||||||
if (isset($_GET['regclan'])) {
|
if (isset($_GET['regclan'])) {
|
||||||
$unregisteredClans->allowRegister($_GET['regclan']);
|
Clan::allowRegister($_GET['regclan']);
|
||||||
header('Location:/admin/admin.php');
|
header('Location:/admin/admin.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (isset($_GET['remclan'])) {
|
if (isset($_GET['remclan'])) {
|
||||||
$unregisteredClans->disallowRegister($_GET['remclan']);
|
Clan::disallowRegister($_GET['remclan']);
|
||||||
header('Location:/admin/admin.php');
|
header('Location:/admin/admin.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Телеграф.
|
# Телеграф.
|
||||||
if (!empty($_POST['receiver']) && !empty($_POST['tgmsg'])) {
|
if (!empty($_POST['receiver']) && !empty($_POST['tgmsg'])) {
|
||||||
$receiver = Db::getInstance()->ofetch('SELECT id FROM users WHERE login= ?', $_POST['receiver']);
|
Chat::sendTelegraf($_POST['tgmsg'], User::getInstance($_POST['receiver'])->getId());
|
||||||
telegraph($receiver->id, $_POST['tgmsg']);
|
|
||||||
echo "Успешно.";
|
echo "Успешно.";
|
||||||
}
|
}
|
||||||
# Показывает невидимок.
|
|
||||||
$row = Db::getInstance()->ofetchAll('SELECT id,login FROM users LEFT JOIN users_effects ue on users.id = ue.owner_id WHERE type = 1022 ORDER BY `id` DESC');
|
|
||||||
foreach ($row as $r) {
|
|
||||||
$invisList .= '<b>[id] = ' .$r->id. ', ' .$r->login. '</b><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
User::getInstance()->
|
|
||||||
Template::header('ᐰdminка');
|
Template::header('ᐰdminка');
|
||||||
?>
|
?>
|
||||||
<link rel=stylesheet href="/css/admin.css">
|
<link rel=stylesheet href="/css/admin.css">
|
||||||
@ -123,27 +77,50 @@ Template::header('ᐰdminка');
|
|||||||
<button disabled><img src="../i/magic/check.gif" alt="check"> Проверка</button>
|
<button disabled><img src="../i/magic/check.gif" alt="check"> Проверка</button>
|
||||||
|
|
||||||
<form method='post'>
|
<form method='post'>
|
||||||
|
<fieldset>
|
||||||
<legend>Добавить в «дело» игрока заметку о нарушении правил, прокрутке и пр.</legend>
|
<legend>Добавить в «дело» игрока заметку о нарушении правил, прокрутке и пр.</legend>
|
||||||
<input name='ldnick' placeholder='Логин'> <input name='ldtext' size='50' placeholder='Сообщение'>
|
<label>
|
||||||
|
<input name='ldnick' placeholder='Логин'>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input name='ldtext' size='50' placeholder='Сообщение'>
|
||||||
|
</label>
|
||||||
<input type='submit' value='Добавить'><br>
|
<input type='submit' value='Добавить'><br>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<form method='post'>
|
<form method='post'>
|
||||||
|
<fieldset>
|
||||||
<legend>Отправить системное сообщение в чат</legend>
|
<legend>Отправить системное сообщение в чат</legend>
|
||||||
|
<label>
|
||||||
<input name='syschatmsg' size='74' placeholder='Введите сообщение'>
|
<input name='syschatmsg' size='74' placeholder='Введите сообщение'>
|
||||||
|
</label>
|
||||||
<input type='submit' value='Отправить'>
|
<input type='submit' value='Отправить'>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<form method='post'>
|
<form method='post'>
|
||||||
|
<fieldset>
|
||||||
<legend>Телеграф</legend>
|
<legend>Телеграф</legend>
|
||||||
|
<label>
|
||||||
<input name='receiver' placeholder='Логин'>
|
<input name='receiver' placeholder='Логин'>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
<input name='tgmsg' size='50' placeholder='Сообщение'>
|
<input name='tgmsg' size='50' placeholder='Сообщение'>
|
||||||
|
</label>
|
||||||
<input type='submit' value='Отправить'>
|
<input type='submit' value='Отправить'>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<form method='post'>
|
<form method='post'>
|
||||||
|
<fieldset>
|
||||||
<legend>Поменять статус</legend>
|
<legend>Поменять статус</legend>
|
||||||
|
<label>
|
||||||
<input name='login' placeholder='Логин'>
|
<input name='login' placeholder='Логин'>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
<input name='status' placeholder='Статус'>
|
<input name='status' placeholder='Статус'>
|
||||||
|
</label>
|
||||||
<input type='submit' value='Изменить статус'>
|
<input type='submit' value='Изменить статус'>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<span class="legend">Невидимки</span><br>
|
<span class="legend">Невидимки</span><br>
|
||||||
<div class="abils" style="width: fit-content;"><?= $invisList ?></div>
|
<div class="abils" style="width: fit-content; font-weight: bold;"><?= AUser::getInvisiblesList() ?></div>
|
@ -67,7 +67,7 @@ if ($_POST['pay']) {
|
|||||||
if ($_POST['adm_start_raid'] && $user['id'] == 1256) {
|
if ($_POST['adm_start_raid'] && $user['id'] == 1256) {
|
||||||
mysql_query("DELETE FROM `cit_haos_status`;");
|
mysql_query("DELETE FROM `cit_haos_status`;");
|
||||||
mysql_query("DELETE FROM `cit_haos_var`;");
|
mysql_query("DELETE FROM `cit_haos_var`;");
|
||||||
Chat::addSYSMessage('Начинается прием заявок в рейд на Цитадель Хаоса! Начало рейда через 15 минут.');
|
Chat::sendSys('Начинается прием заявок в рейд на Цитадель Хаоса! Начало рейда через 15 минут.');
|
||||||
$ch_time = time();
|
$ch_time = time();
|
||||||
mysql_query("UPDATE variables SET value='{$ch_time}' where var='cit_haos_time';");
|
mysql_query("UPDATE variables SET value='{$ch_time}' where var='cit_haos_time';");
|
||||||
}
|
}
|
||||||
|
2
chat.php
2
chat.php
@ -12,7 +12,7 @@ use Battles\Template;
|
|||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
$chat = new Chat(Db::getInstance());
|
$chat = new Chat(Db::getInstance());
|
||||||
if (!empty($_POST['msg'])) {
|
if (!empty($_POST['msg'])) {
|
||||||
$chat->addMessage($_POST['msg']);
|
$chat->sendMessage($_POST['msg']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Template::header('chat');
|
Template::header('chat');
|
||||||
|
49
classes/Battles/Admin/Clan.php
Normal file
49
classes/Battles/Admin/Clan.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Battles\Admin;
|
||||||
|
|
||||||
|
use Battles\Bank;
|
||||||
|
use Battles\Database\Db;
|
||||||
|
use Battles\GameConfigs;
|
||||||
|
use Battles\User;
|
||||||
|
|
||||||
|
class Clan
|
||||||
|
{
|
||||||
|
public static function getUnapprovedList(): string
|
||||||
|
{
|
||||||
|
$list = '';
|
||||||
|
$rows = Db::getInstance()->ofetchAll('select * from clans where status = 0');
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$id = $row->owner_id;
|
||||||
|
$login = User::getInstance($id)->getLogin();
|
||||||
|
$full = $row->full_name;
|
||||||
|
$short = $row->short_name;
|
||||||
|
$info = nl2br($row->info);
|
||||||
|
$list .= <<<UNREGCLANLIST
|
||||||
|
<div>
|
||||||
|
<fieldset style="display: inline;">
|
||||||
|
<legend>$full [$short]</legend>
|
||||||
|
Глава клана: <span class="abils">$login</span><br>
|
||||||
|
Описание:<div class="abils">$info</div>
|
||||||
|
<BR>
|
||||||
|
<button onclick="location.href='?regclan=$id'">Зарегистрировать</button>
|
||||||
|
<button onclick="location.href='?remclan=$id'">Отказать</button>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
UNREGCLANLIST;
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allowRegister($id)
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('UPDATE clans SET status = 1 WHERE status = 0 AND owner_id = ?', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function disallowRegister($id)
|
||||||
|
{
|
||||||
|
$bank = new Bank($id);
|
||||||
|
Db::getInstance()->execute('DELETE FROM clans WHERE status = 0 AND owner_id = ?', $id);
|
||||||
|
$bank::setBankMoney($bank->getMoney() + GameConfigs::CLAN['clan_register_cost'], $id);
|
||||||
|
}
|
||||||
|
}
|
49
classes/Battles/Admin/Item.php
Normal file
49
classes/Battles/Admin/Item.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Battles\Admin;
|
||||||
|
|
||||||
|
use Battles\Database\Db;
|
||||||
|
|
||||||
|
class Item
|
||||||
|
{
|
||||||
|
public static function add(array $params): void
|
||||||
|
{
|
||||||
|
$query = 'insert into items (
|
||||||
|
name, item_type, durability,
|
||||||
|
need_strength, need_dexterity, need_intuition, need_endurance, need_intelligence, need_wisdom,
|
||||||
|
add_strength, add_dexterity, add_intuition, add_endurance, add_intelligence, add_wisdom,
|
||||||
|
add_accuracy, add_evasion, add_criticals, add_min_physical_damage, add_max_physical_damage,
|
||||||
|
image, weight)
|
||||||
|
values (
|
||||||
|
:name, :item_type, :durability,
|
||||||
|
:need_strength, :need_dexterity, :need_intuition, :need_endurance, :need_intelligence, :need_wisdom,
|
||||||
|
:add_strength, :add_dexterity, :add_intuition, :add_endurance, :add_intelligence, :add_wisdom,
|
||||||
|
:add_accuracy, :add_evasion, :add_criticals, :add_min_physical_damage, :add_max_physical_damage,
|
||||||
|
:image, :weight)';
|
||||||
|
$values = [
|
||||||
|
'name' => $params['name'] ?? uniqid(),
|
||||||
|
'item_type' => $params['item_type'],
|
||||||
|
'durability' => $params['durability'] ?? 1,
|
||||||
|
'need_strength' => $params['need_strength'] ?? 0,
|
||||||
|
'need_dexterity' => $params['need_dexterity'] ?? 0,
|
||||||
|
'need_intuition' => $params['need_intuition'] ?? 0,
|
||||||
|
'need_endurance' => $params['need_endurance'] ?? 0,
|
||||||
|
'need_intelligence' => $params['need_intelligence'] ?? 0,
|
||||||
|
'need_wisdom' => $params['need_wisdom'] ?? 0,
|
||||||
|
'add_strength' => $params['add_strength'] ?? 0,
|
||||||
|
'add_dexterity' => $params['add_dexterity'] ?? 0,
|
||||||
|
'add_intuition' => $params['add_intuition'] ?? 0,
|
||||||
|
'add_endurance' => $params['add_endurance'] ?? 0,
|
||||||
|
'add_intelligence' => $params['add_intelligence'] ?? 0,
|
||||||
|
'add_wisdom' => $params['add_wisdom'] ?? 0,
|
||||||
|
'add_accuracy' => $params['add_accuracy'] ?? 0,
|
||||||
|
'add_evasion' => $params['add_evasion'] ?? 0,
|
||||||
|
'add_criticals' => $params['add_criticals'] ?? 0,
|
||||||
|
'add_min_physical_damage' => $params['add_min_physical_damage'] ?? 0,
|
||||||
|
'add_max_physical_damage' => $params['add_max_physical_damage'] ?? 0,
|
||||||
|
'image' => $params['image'] ?? 'noitem.png',
|
||||||
|
'weight' => $params['weight'] ?? 1,
|
||||||
|
];
|
||||||
|
Db::getInstance()->execute($query, $values);
|
||||||
|
}
|
||||||
|
}
|
20
classes/Battles/Admin/User.php
Normal file
20
classes/Battles/Admin/User.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Battles\Admin;
|
||||||
|
|
||||||
|
use Battles\Database\Db;
|
||||||
|
|
||||||
|
class User
|
||||||
|
{
|
||||||
|
private const INVISIBILITY_EFFECT = 1022;
|
||||||
|
|
||||||
|
public static function getInvisiblesList(): string
|
||||||
|
{
|
||||||
|
$list = '';
|
||||||
|
$row = Db::getInstance()->ofetchAll('select id, login from users left join users_effects ue on users.id = ue.owner_id where type = ' . self::INVISIBILITY_EFFECT);
|
||||||
|
foreach ($row as $item) {
|
||||||
|
$list .= '[id] = ' . $item->id . ', ' . $item->login . '<br>';
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
}
|
@ -62,14 +62,18 @@ class Chat
|
|||||||
return $wrappedMessage;
|
return $wrappedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addMessage(string $msg)
|
public function sendMessage(string $msg)
|
||||||
{
|
{
|
||||||
$this->db->execute('insert into chat (user_id, msg) values (?,?)', [User::getInstance()->getId(), $msg]);
|
$this->db->execute('insert into chat (user_id, msg) values (?,?)', [User::getInstance()->getId(), $msg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addSYSMessage( string $msg, ?int $receiver_id = null)
|
public static function sendSys(string $msg, ?int $receiver_id = null)
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (?,?,?,?)', [User::getInstance()->getId(), $msg, $receiver_id, 'sys']);
|
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (-1,?,?,?)', [$msg, $receiver_id, 'sys']);
|
||||||
|
}
|
||||||
|
public static function sendTelegraf(string $msg, int $receiver_id)
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (-1,?,?,?)', [$msg, $receiver_id, 'sms']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -13,9 +13,10 @@ use stdClass;
|
|||||||
|
|
||||||
class DressedItems
|
class DressedItems
|
||||||
{
|
{
|
||||||
private $USERID;
|
private int $USERID;
|
||||||
private $dressedItem;
|
private stdClass $dressedItem;
|
||||||
private static $db;
|
private static Db $db;
|
||||||
|
private object $dressed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DressedItems constructor.
|
* DressedItems constructor.
|
||||||
@ -25,6 +26,7 @@ class DressedItems
|
|||||||
{
|
{
|
||||||
self::$db = Db::getInstance();
|
self::$db = Db::getInstance();
|
||||||
$this->USERID = $user_id;
|
$this->USERID = $user_id;
|
||||||
|
$this->dressed = self::$db->ofetchAll('select * from inventory where dressed_slot > 0 and owner_id = ?', $this->USERID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDressedItemBySlot($itemSlot, $ownerId)
|
public static function getDressedItemBySlot($itemSlot, $ownerId)
|
||||||
@ -34,9 +36,8 @@ class DressedItems
|
|||||||
|
|
||||||
public function getItemsInSlots(): stdClass
|
public function getItemsInSlots(): stdClass
|
||||||
{
|
{
|
||||||
$items = self::$db->ofetchALL('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot > 0', $this->USERID);
|
|
||||||
$this->dressedItem = new stdClass();
|
$this->dressedItem = new stdClass();
|
||||||
foreach ($items as $item) {
|
foreach ($this->dressed as $item) {
|
||||||
$i = $item->dressed_slot;
|
$i = $item->dressed_slot;
|
||||||
$this->dressedItem->$i = $item;
|
$this->dressedItem->$i = $item;
|
||||||
}
|
}
|
||||||
@ -55,8 +56,35 @@ class DressedItems
|
|||||||
Inventory::undressOne($slot_id, $this->USERID);
|
Inventory::undressOne($slot_id, $this->USERID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function undressAllItems($user_id)
|
public static function undressAllItems($user_id)
|
||||||
{
|
{
|
||||||
return self::$db->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?', $user_id);
|
return self::$db->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?', $user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkRequirements()
|
||||||
|
{
|
||||||
|
$stats = (new UserStats($this->USERID))->getFullStats();
|
||||||
|
$q = 'select count(*) from inventory where
|
||||||
|
dressed_slot > 0 and
|
||||||
|
need_strength > ? and
|
||||||
|
need_dexterity > ? and
|
||||||
|
need_intuition > ? and
|
||||||
|
need_endurance > ? and
|
||||||
|
need_intelligence > ? and
|
||||||
|
need_wisdom > ? and
|
||||||
|
owner_id = ?';
|
||||||
|
$args = [
|
||||||
|
$stats->strength,
|
||||||
|
$stats->dexterity,
|
||||||
|
$stats->intuition,
|
||||||
|
$stats->endurance,
|
||||||
|
$stats->intelligence,
|
||||||
|
$stats->wisdom,
|
||||||
|
$this->USERID
|
||||||
|
];
|
||||||
|
if (self::$db->fetchColumn($q, $args) > 0) {
|
||||||
|
self::undressAllItems($this->USERID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -46,7 +46,12 @@ class CureInjury extends Magic
|
|||||||
{
|
{
|
||||||
$this->target = $this->target == $_SESSION['uid'] ? User::getInstance() : User::getInstance($this->target);
|
$this->target = $this->target == $_SESSION['uid'] ? User::getInstance() : User::getInstance($this->target);
|
||||||
$this->login = $this->target->getLogin();
|
$this->login = $this->target->getLogin();
|
||||||
return ($this->isVisible(User::getInstance(), $this->target) && $this->isNotDead(User::getInstance()) && $this->enoughMana(User::getInstance()) && $this->isNotInBattle(User::getInstance()));
|
return (
|
||||||
|
$this->isVisible(User::getInstance(), $this->target) &&
|
||||||
|
$this->isNotDead(User::getInstance()) &&
|
||||||
|
$this->enoughMana(User::getInstance()) &&
|
||||||
|
$this->isNotInBattle(User::getInstance())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function cast($target, $type): self
|
public static function cast($target, $type): self
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
# Date: 16.09.2020 (08:45)
|
# Date: 16.09.2020 (08:45)
|
||||||
namespace Battles\Magic;
|
namespace Battles\Magic;
|
||||||
|
|
||||||
|
use Battles\Database\Db;
|
||||||
|
|
||||||
class Magic
|
class Magic
|
||||||
{
|
{
|
||||||
protected $status;
|
protected string $status;
|
||||||
|
private Db $db;
|
||||||
|
private object $magic;
|
||||||
|
|
||||||
protected function isVisible($caster, $target):bool
|
public function __construct(Db $db, int $id)
|
||||||
|
{
|
||||||
|
$this->magic = $db->ofetch('select * from magic where id = ?', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMagic(): object
|
||||||
|
{
|
||||||
|
return $this->magic;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isVisible($caster, $target): bool
|
||||||
{
|
{
|
||||||
if ($caster->battle != $target->battle || $caster->room != $target->room) {
|
if ($caster->battle != $target->battle || $caster->room != $target->room) {
|
||||||
$this->status = 'Вы не видите цель!';
|
$this->status = 'Вы не видите цель!';
|
||||||
@ -15,7 +30,7 @@ class Magic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isNotDead($caster):bool
|
protected function isNotDead($caster): bool
|
||||||
{
|
{
|
||||||
if ($caster->health < 1) {
|
if ($caster->health < 1) {
|
||||||
$this->status = 'Вы мертвы!';
|
$this->status = 'Вы мертвы!';
|
||||||
@ -25,7 +40,7 @@ class Magic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function enoughMana($caster):bool
|
protected function enoughMana($caster): bool
|
||||||
{
|
{
|
||||||
if ($caster->mana < 1) {
|
if ($caster->mana < 1) {
|
||||||
$this->status = 'Недостаточно пыли!';
|
$this->status = 'Недостаточно пыли!';
|
||||||
@ -35,7 +50,7 @@ class Magic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isNotInBattle($caster):bool
|
protected function isNotInBattle($caster): bool
|
||||||
{
|
{
|
||||||
if ($caster->battle) {
|
if ($caster->battle) {
|
||||||
$this->status = 'Невозможно применить в поединке!';
|
$this->status = 'Невозможно применить в поединке!';
|
||||||
@ -52,12 +67,12 @@ class Magic
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isSuccess($caster, int $difficulty = 40):bool
|
protected function isSuccess($caster, int $difficulty = 40): bool
|
||||||
{
|
{
|
||||||
# 40 - потолок стата.
|
# 40 - потолок стата.
|
||||||
if ($difficulty > 40) {
|
if ($difficulty > 40) {
|
||||||
$difficulty = 40;
|
$difficulty = 40;
|
||||||
}
|
}
|
||||||
return mt_rand(1,$difficulty) < $caster->intelligence;
|
return mt_rand(1, $difficulty) < $caster->intelligence;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,9 +6,6 @@
|
|||||||
* Project name: Battles-Game
|
* Project name: Battles-Game
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Battles\Database\Db;
|
|
||||||
use Battles\User;
|
|
||||||
|
|
||||||
include_once 'classes/Database/db.php';
|
include_once 'classes/Database/db.php';
|
||||||
include_once 'classes/Database/Mysql.php';
|
include_once 'classes/Database/Mysql.php';
|
||||||
include_once 'classes/Database/Statement.php';
|
include_once 'classes/Database/Statement.php';
|
||||||
|
@ -552,10 +552,10 @@ class fbattle
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($arr_battle['win'] == 1) {
|
if ($arr_battle['win'] == 1) {
|
||||||
Chat::addSYSMessage('Внимание! Тьма одержала победу благодаря великим воинам: <b>' . $uss . '</b>');
|
Chat::sendSys('Внимание! Тьма одержала победу благодаря великим воинам: <b>' . $uss . '</b>');
|
||||||
$this->AddToLog('<span class=date>' . date("H:i") . '</span> ' . 'Бой закончен, победа за <B>Силами Тьмы</B><BR>');
|
$this->AddToLog('<span class=date>' . date("H:i") . '</span> ' . 'Бой закончен, победа за <B>Силами Тьмы</B><BR>');
|
||||||
} else {
|
} else {
|
||||||
Chat::addSYSMessage('Внимание! Свет одержал победу благодаря великим воинам: <b>' . $uss . '</b>');
|
Chat::sendSys('Внимание! Свет одержал победу благодаря великим воинам: <b>' . $uss . '</b>');
|
||||||
$this->AddToLog('<span class=date>' . date("H:i") . '</span> ' . 'Бой закончен, победа за <B>Силами Света</B><BR>');
|
$this->AddToLog('<span class=date>' . date("H:i") . '</span> ' . 'Бой закончен, победа за <B>Силами Света</B><BR>');
|
||||||
}
|
}
|
||||||
mysql_query('UPDATE `variables` SET `value` = "' . $arr_battle['win'] . '" WHERE `var` = "arena_win" LIMIT 1');
|
mysql_query('UPDATE `variables` SET `value` = "' . $arr_battle['win'] . '" WHERE `var` = "arena_win" LIMIT 1');
|
||||||
@ -586,7 +586,7 @@ class fbattle
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->battle_data['aren_of'] == 1) {
|
if ($this->battle_data['aren_of'] == 1) {
|
||||||
Chat::addSYSMessage('Внимание! Бой на Арене Ангелов завершился ничьей, на этой недели силы тьмы и света равны.');
|
Chat::sendSys('Внимание! Бой на Арене Ангелов завершился ничьей, на этой недели силы тьмы и света равны.');
|
||||||
mysql_query('UPDATE `variables` SET `value` = 3 WHERE `var` = "arena_win" LIMIT 1');
|
mysql_query('UPDATE `variables` SET `value` = 3 WHERE `var` = "arena_win" LIMIT 1');
|
||||||
mysql_query('UPDATE `battle` SET `aren_of` = 0 WHERE `id` = "' . $arr_battle['id'] . '" AND `aren_of` = 1 LIMIT 1');
|
mysql_query('UPDATE `battle` SET `aren_of` = 0 WHERE `id` = "' . $arr_battle['id'] . '" AND `aren_of` = 1 LIMIT 1');
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Battles\DressedItems;
|
||||||
|
use Battles\Template;
|
||||||
|
use Battles\User;
|
||||||
|
|
||||||
if (isset($_POST['end'])) {
|
if (isset($_POST['end'])) {
|
||||||
header("Location: main.php");
|
header("Location: main.php");
|
||||||
exit;
|
exit;
|
||||||
@ -15,7 +20,7 @@ if (isset($user['id'])) {
|
|||||||
include('./classes/battle_new.class.php');
|
include('./classes/battle_new.class.php');
|
||||||
|
|
||||||
$fbattle = new fbattle($user['battle']);
|
$fbattle = new fbattle($user['battle']);
|
||||||
\Battles\Template::header('fbattle');
|
Template::header('fbattle');
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/sl2.js"></script>
|
<script type="text/javascript" src="js/sl2.js"></script>
|
||||||
<script type="text/javascript" src="js/ch.js"></script>
|
<script type="text/javascript" src="js/ch.js"></script>
|
||||||
@ -287,7 +292,7 @@ $fbattle = new fbattle($user['battle']);
|
|||||||
if (($user['hp'] > 0) && $fbattle->battle) {
|
if (($user['hp'] > 0) && $fbattle->battle) {
|
||||||
echo '<center><FONT COLOR=red><b>Ожидаем хода противника...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
|
echo '<center><FONT COLOR=red><b>Ожидаем хода противника...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
|
||||||
} elseif ($user['hp'] <= 0 && $fbattle->battle) {
|
} elseif ($user['hp'] <= 0 && $fbattle->battle) {
|
||||||
\Battles\InventoryItem::autoDrop();
|
(new DressedItems(User::getInstance()->getId()))->checkRequirements();
|
||||||
echo '<center><FONT COLOR=red><b>Ожидаем, пока бой закончат другие игроки...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
|
echo '<center><FONT COLOR=red><b>Ожидаем, пока бой закончат другие игроки...</b></FONT><BR><INPUT TYPE=submit value="Обновить" name=' . (($user['battle'] > 0) ? "battle" : "end") . '><BR></CENTER>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -24,7 +24,12 @@ if (User::getInstance()->getBlock()) {
|
|||||||
//Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам.
|
//Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам.
|
||||||
Travel::roomRedirects(User::getInstance()->getRoom(), User::getInstance()->getBattle());
|
Travel::roomRedirects(User::getInstance()->getRoom(), User::getInstance()->getBattle());
|
||||||
|
|
||||||
if (!empty($_GET['goto']) && !empty($_GET['tStamp']) && !empty($_GET['vcode']) && $_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) {
|
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 = ?';
|
$query = 'update users u, online o set u.room = ?, o.room = ? where user_id = id and user_id = ?';
|
||||||
Db::getInstance()->execute($query, [$_GET['goto'], $_GET['goto'], User::getInstance()->getId()]);
|
Db::getInstance()->execute($query, [$_GET['goto'], $_GET['goto'], User::getInstance()->getId()]);
|
||||||
User::getInstance()->setRoom(intval($_GET['goto']));
|
User::getInstance()->setRoom(intval($_GET['goto']));
|
||||||
@ -164,7 +169,7 @@ function addActions($time, $vars, $vls, $uid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ВАЖНО! (#44)
|
/* ВАЖНО! (#44)
|
||||||
* addch() и addchp() заменяются на Chat::class->addSYSMessage($message, [optional]$receiver);
|
* addch() и addchp() заменяются на Chat::class->sendSys($message, [optional]$receiver);
|
||||||
* Для addchp() используется второй опциональный ключ.
|
* Для addchp() используется второй опциональный ключ.
|
||||||
* Это 150+ вхождений в куче файлов, где надо менять структуру вызова функции из-за их несовместимости.
|
* Это 150+ вхождений в куче файлов, где надо менять структуру вызова функции из-за их несовместимости.
|
||||||
* Возможно, приоритетом стоит сделать унификацию свитков нападения, которых самих около 20 и которые
|
* Возможно, приоритетом стоит сделать унификацию свитков нападения, которых самих около 20 и которые
|
||||||
@ -173,30 +178,13 @@ function addActions($time, $vars, $vls, $uid)
|
|||||||
|
|
||||||
function addch($text, $room = 0)
|
function addch($text, $room = 0)
|
||||||
{
|
{
|
||||||
if ($room == 0) {
|
Chat::sendSys($text);
|
||||||
$room = User::getInstance()->getRoom();
|
|
||||||
}
|
|
||||||
if ($fp = @fopen("tmp/chat.txt", "a")) { //открытие
|
|
||||||
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
|
|
||||||
fwrite($fp, ":[" . time() . "]:[!sys!!]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
|
|
||||||
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
|
|
||||||
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
|
|
||||||
fclose($fp); //закрытие
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addchp($text, $who, $room = 0)
|
function addchp($text, $who, $room = 0)
|
||||||
{
|
{
|
||||||
if ($room == 0) {
|
Chat::sendSys($text, $who);
|
||||||
$room = User::getInstance()->getRoom();
|
|
||||||
}
|
|
||||||
$fp = fopen("tmp/chat.txt", "a"); //открытие
|
|
||||||
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
|
|
||||||
fwrite($fp, ":[" . time() . "]:[{$who}]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
|
|
||||||
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
|
|
||||||
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
|
|
||||||
fclose($fp); //закрытие
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function err($t)
|
function err($t)
|
||||||
|
@ -289,7 +289,7 @@ if (($kol_pl + $ls) < 2 && ($tur_data['start_time'] + 60) <= time()) {
|
|||||||
|
|
||||||
mysql_query('UPDATE `deztow_turnir` SET `winner` = \'' . $user['id'] . '\', `winnerlog` = \'' . Nick::id($user['id'])->full(1) . '\', `endtime` = \'' . time() . '\', `active` = FALSE, `log` = CONCAT(`log`,\'' . "<span class=date>" . date("d.m.y H:i") . "</span> Турнир завершен. Победитель : " . Nick::id($user['id'])->full(1) . " Приз : <b>" . $tur['coin'] . "</b> кр. <br />" . '\') WHERE `active` = TRUE LIMIT 1');
|
mysql_query('UPDATE `deztow_turnir` SET `winner` = \'' . $user['id'] . '\', `winnerlog` = \'' . Nick::id($user['id'])->full(1) . '\', `endtime` = \'' . time() . '\', `active` = FALSE, `log` = CONCAT(`log`,\'' . "<span class=date>" . date("d.m.y H:i") . "</span> Турнир завершен. Победитель : " . Nick::id($user['id'])->full(1) . " Приз : <b>" . $tur['coin'] . "</b> кр. <br />" . '\') WHERE `active` = TRUE LIMIT 1');
|
||||||
addchp('<font color=red>Внимание!</font> Поздравляем! Вы победитель турнира Башни смерти! Получаете <b>' . $tur['coin'] . '</b> кр.', '{[]}' . $user['login'] . '{[]}');
|
addchp('<font color=red>Внимание!</font> Поздравляем! Вы победитель турнира Башни смерти! Получаете <b>' . $tur['coin'] . '</b> кр.', '{[]}' . $user['login'] . '{[]}');
|
||||||
Chat::addSYSMessage('Внимание! Битва в Башне Смерти завершена. Победитель:' . $user['login'] . ' [' . $user['level'] . ']');
|
Chat::sendSys('Внимание! Битва в Башне Смерти завершена. Победитель:' . $user['login'] . ' [' . $user['level'] . ']');
|
||||||
if ($tur['art'] == 1) {
|
if ($tur['art'] == 1) {
|
||||||
$bs_art = 0;
|
$bs_art = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,7 +207,7 @@ class Zayavka
|
|||||||
return $this->errorMessage;
|
return $this->errorMessage;
|
||||||
} else {
|
} else {
|
||||||
if ($type == 3) {
|
if ($type == 3) {
|
||||||
Chat::addSYSMessage("Внимание! Подана заявка на хаотический поединок ({$t1min} - {$t1max}), который начнется через {$start} минут.");
|
Chat::sendSys("Внимание! Подана заявка на хаотический поединок ({$t1min} - {$t1max}), который начнется через {$start} минут.");
|
||||||
}
|
}
|
||||||
$start = time() + $start * 60;
|
$start = time() + $start * 60;
|
||||||
|
|
||||||
@ -662,19 +662,19 @@ Template::header('zayavka');
|
|||||||
}
|
}
|
||||||
if (!empty($_POST['back2'])) {
|
if (!empty($_POST['back2'])) {
|
||||||
$z = $zay->getlist(2, null, $user->getZayavka());
|
$z = $zay->getlist(2, null, $user->getZayavka());
|
||||||
Chat::addSYSMessage('Внимание!' . Nick::id($user->getId())->short() . ' отозвал заявку.');
|
Chat::sendSys('Внимание!' . Nick::id($user->getId())->short() . ' отозвал заявку.');
|
||||||
echo $zay->delteam($user->getId(), $user->getZayavka(), 2);
|
echo $zay->delteam($user->getId(), $user->getZayavka(), 2);
|
||||||
}
|
}
|
||||||
if (!empty($_POST['cansel'])) {
|
if (!empty($_POST['cansel'])) {
|
||||||
$z = $zay->getlist(2, null, $user->getZayavka());
|
$z = $zay->getlist(2, null, $user->getZayavka());
|
||||||
echo $zay->delteam($z[$user->getZayavka()]['team2'][0], $user->getZayavka(), 2);
|
echo $zay->delteam($z[$user->getZayavka()]['team2'][0], $user->getZayavka(), 2);
|
||||||
Chat::addSYSMessage('Внимание!' . Nick::id($user->getId())->short() . ' отказался от поединка.');
|
Chat::sendSys('Внимание!' . Nick::id($user->getId())->short() . ' отказался от поединка.');
|
||||||
}
|
}
|
||||||
if (!empty($_POST['confirm2']) && empty($user->getZayavka())) {
|
if (!empty($_POST['confirm2']) && empty($user->getZayavka())) {
|
||||||
$z = $zay->getlist(2, null, $_REQUEST['gocombat']);
|
$z = $zay->getlist(2, null, $_REQUEST['gocombat']);
|
||||||
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$_REQUEST['gocombat']]['team1'][0])->fetch_assoc();
|
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$_REQUEST['gocombat']]['team1'][0])->fetch_assoc();
|
||||||
if ($user->getClan() != $toper['klan'] || !$user->getClan()) {
|
if ($user->getClan() != $toper['klan'] || !$user->getClan()) {
|
||||||
Chat::addSYSMessage('Внимание!' . Nick::id($user->getId())->short() . ' принял заявку, нужно принять вызов или отказать.');
|
Chat::sendSys('Внимание!' . Nick::id($user->getId())->short() . ' принял заявку, нужно принять вызов или отказать.');
|
||||||
}
|
}
|
||||||
echo $zay->addteam(2, 2);
|
echo $zay->addteam(2, 2);
|
||||||
echo "</b></font><BR>Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
|
echo "</b></font><BR>Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
|
||||||
|
Loading…
Reference in New Issue
Block a user