439 lines
22 KiB
PHP
439 lines
22 KiB
PHP
<?php
|
||
|
||
use Core\Db;
|
||
use Model\ActionModel;
|
||
use User\ItemsModel;
|
||
|
||
if (!defined('GAME')) {
|
||
die();
|
||
}
|
||
//id Новогоднего подарка
|
||
$pidid = 4008;
|
||
|
||
$dy = 1;
|
||
if ((date('n', time()) == 2 && date('j', time()) <= 14)) {
|
||
$dy = 0;
|
||
}
|
||
$dt = date('Y', time()) + $dy;
|
||
$dt = 2023;
|
||
|
||
if ($u->room['file'] != 'elka') {
|
||
return;
|
||
}
|
||
if (isset($_GET['elka_shar']) && isset($_GET['shar_name'])) //Украшение Ёлки
|
||
{
|
||
$itd = mysql_fetch_array(
|
||
mysql_query(' SELECT * FROM `items_users` WHERE `item_id` > 2723 AND `item_id` < 2741 AND `uid`= "' . $u->info['id'] . '" AND `delete` = 0 AND `id`= "' . $_GET['elka_shar'] . '" LIMIT 1 ')
|
||
);
|
||
if (isset($itd['id'])) {
|
||
$itdu = mysql_query('UPDATE `items_users` SET `delete` ="' . time() . '" WHERE `id` ="' . $_GET['elka_shar'] . '" LIMIT 1 ');
|
||
if (isset($itdu)) {
|
||
//eff Благословение Ёлки X
|
||
$effe = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`= "' . $u->info['id'] . '" AND `delete` = 0 AND `id_eff`= 477 LIMIT 1'));
|
||
if (isset($effe['id'])) {
|
||
$tdata = str_replace("add_hpAll=", "", $effe['data']);
|
||
$tdata = $tdata + 5;
|
||
if ($tdata > 500) {
|
||
$tdata = 500;
|
||
}
|
||
$newdata = 'add_hpAll=' . $tdata;
|
||
$newname = 'Благословение Ёлки x' . ($tdata / 5);
|
||
|
||
$effeadd = mysql_query('UPDATE `eff_users` SET `name` = "' . $newname . '",`data`="' . $newdata . '", `timeUse` = "' . time() . '"WHERE `id` ="' . $effe['id'] . '" ');
|
||
|
||
if (isset($effeadd)) {
|
||
echo "Вы получили <b><font color=red>Благословение Ёлки x" . round($tdata / 5) . "</font></b> ";
|
||
}
|
||
|
||
} else {
|
||
$effeadd = mysql_query(
|
||
'INSERT INTO `eff_users`
|
||
(`id`,`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`)
|
||
VALUES
|
||
(NULL, "477", "' . $u->info['id'] . '", "Благословение Ёлки x1", "add_hpAll=5", "110", "' . time() . '", "0", "", "0", "0", "0", "", "1", "-1", "0", "0", "0", "", "0", "0", "0", "0", "0")'
|
||
);
|
||
|
||
if (isset($effeadd)) {
|
||
echo "Вы получили <b><font color=red>Благословение Ёлки x1</font></b> ";
|
||
}
|
||
}
|
||
|
||
echo "Использовал: <b><font color=red>" . $_GET['shar_name'] . "</font><b>";
|
||
|
||
} else {
|
||
echo "<b><font color=red>Ошибка</font></b>";
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
if (isset($_GET['take_gift']) && (date('m') == 12 || (date('m') == 1 && date('d') <= 8))) {
|
||
//получаем свой новогодний подарок за текущий год addItem($id,$uid)
|
||
$smt = (bool)ActionModel::testCount(["uid = $u->info['id']", "vars = take_gift_$dt"]);
|
||
if ($smt) {
|
||
echo '<font color=red>Вы уже получили свой подарок ;)</font>';
|
||
} else {
|
||
$pid = ItemsModel::addItem($pidid, $u->info['id']);
|
||
if ($pid > 0) {
|
||
mysql_query('UPDATE `items_users` SET `gift` = "Администрация",`gtxt1` = "Поздравляем Вас с Новым Годом!" WHERE `id` = "' . $pid . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1');
|
||
$u->addAction(time(), 'take_gift_' . $dt . '', $u->info['city']);
|
||
echo '<font color=red>Предмет находится у Вас в инвентаре, в разделе "прочее"</font>';
|
||
} else {
|
||
echo '<font color=red>Не удалось получить подарок...</font>';
|
||
}
|
||
}
|
||
} elseif (isset($_GET['del'])) {
|
||
if ($u->isModerator()) {
|
||
if ($u->isAdmin()) {
|
||
$pInfo = '1';
|
||
} else {
|
||
$pInfo = '' . $u->info['align'] . '|' . $u->info['clan'] . '|' . $u->info['login'] . '|' . $u->info['level'] . '|' . $u->info['cityreg'];
|
||
}
|
||
mysql_query("UPDATE `elka` SET `delete`='" . $pInfo . "' WHERE `id`='" . mysql_real_escape_string($_GET['del']) . "'");
|
||
}
|
||
} elseif (isset($_GET['use_cup'])) {
|
||
$smt = (bool)ActionModel::testCount(["uid = $u->info['id']", 'vars = use_cupNewYear', 'time > unix_timestamp() - 600']);
|
||
if (!$smt) {
|
||
$u->addAction(time(), 'use_cupNewYear', '');
|
||
mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpAll'] . '",`mpNow` = "' . $u->stats['mpAll'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
|
||
echo '<font color=red>Успешно использован эликсир "Полное восстановление"</font>';
|
||
}
|
||
} elseif (isset($_POST['message'])) {
|
||
$_POST['message'] = htmlspecialchars($_POST['message'], null);
|
||
if ($_POST['message'] != '') {
|
||
$dy = 1;
|
||
if ((date('n', time()) == 1 && date('j', time()) <= 15)) {
|
||
$dy = 0;
|
||
}
|
||
|
||
$u->info['ET'] = (bool)ActionModel::testCount(["uid = $u->info['id']", 'vars = send_elka', 'time > unix_timestamp() - 600']);
|
||
if ($u->info['ET']) {
|
||
echo '<font color=red>Оставлять надписи на стволе ёлки можно не чаще одного раза в 10 минут</font>';
|
||
} else {
|
||
$pInfo = '' . $u->info['align'] . '|' . $u->info['clan'] . '|' . $u->info['login'] . '|' . $u->info['level'] . '|' . $u->info['cityreg'] . '|' . $u->info['id'];
|
||
Db::sql("insert into elka (year, time, pers, text, city) values (year(curdate()) + ?, unix_timestamp(),?,?,'')", [$dy, $pInfo, $_POST['message']]);
|
||
$u->addAction(time(), 'send_elka', '');
|
||
}
|
||
}
|
||
}
|
||
|
||
?>
|
||
<style>
|
||
|
||
.pH3 {
|
||
COLOR: #8f0000;
|
||
FONT-FAMILY: Arial;
|
||
FONT-SIZE: 12pt;
|
||
FONT-WEIGHT: bold;
|
||
}
|
||
|
||
.class_ {
|
||
font-weight: bold;
|
||
color: #C5C5C5;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.class_st {
|
||
font-weight: bold;
|
||
color: #659BA3;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.class__ {
|
||
font-weight: bold;
|
||
color: #FFFFFF;
|
||
cursor: pointer;
|
||
background-color: #659BA3;
|
||
}
|
||
|
||
.class__st {
|
||
font-weight: bold;
|
||
color: #FFFFFF;
|
||
cursor: pointer;
|
||
background-color: #659BA3;
|
||
font-size: 10px;
|
||
}
|
||
|
||
.class_old {
|
||
font-weight: bold;
|
||
color: #919191;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.class__old {
|
||
font-weight: bold;
|
||
color: #FFFFFF;
|
||
cursor: pointer;
|
||
background-color: #838383;
|
||
font-size: 10px;
|
||
}
|
||
|
||
div.error {
|
||
text-align: right;
|
||
color: red;
|
||
font-weight: bold;
|
||
}
|
||
|
||
img.present {
|
||
padding: 10px;
|
||
}
|
||
|
||
img.used {
|
||
filter: alpha(opacity=35);
|
||
-moz-opacity: 0.35;
|
||
opacity: 0.35;
|
||
}
|
||
</style>
|
||
<div class="error"><?= $re ?? '' ?></div>
|
||
<div id="hint3" style="visibility:hidden"></div>
|
||
<TABLE width="100%" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td valign="top">
|
||
<div align="center" class="pH3">Новогодняя елка <?= $dt ?>!
|
||
</div>
|
||
<br/>
|
||
<!-- Подарки -->
|
||
<?php
|
||
$sg = 1;
|
||
//Если есть подарки
|
||
if ((date('n', time()) == 12 || date('n', time()) <= 2) && $sg == 1) {
|
||
?>
|
||
<div style="padding-left:10px;">
|
||
<span class="pH3"><small>Подарки:</small></span>
|
||
<div>
|
||
<?php
|
||
$alreadyUsed = (bool)ActionModel::testCount(["uid = $u->info['id']", 'time > unix_timestamp() - 600', 'vars = use_cupNewYear']);
|
||
?>
|
||
<a href="?use_cup=<?= $code; ?>" <?= $alreadyUsed ? 'onClick="alert(\'Использовать "Чаша жизненных сил" можно не чаще одного раза в 10 минут\');return false;"' : '' ?>>
|
||
<img src="//img.new-combats.tech/cup2012.gif" class="present <?= $alreadyUsed ? 'used' : '' ?>" title="Выпить из`Чаши жизненных сил`" alt="">
|
||
</a>
|
||
|
||
<?php
|
||
if (date('m') == 12 || (date('m') == 1 && date('d') <= 8)) {
|
||
$alreadyUsed = (bool)ActionModel::testCount(["uid = $u->info['id']", 'time > unix_timestamp() - 600', "vars = take_gift$dt"]);
|
||
|
||
?>
|
||
<a href="?take_gift=<?= $code; ?>" <?= $alreadyUsed ? 'onClick="return false;"' : '' ?>>
|
||
<img src="//img.new-combats.tech/i/items/<?= 'podarok' . ($dt - 1) ?>.gif" class="present <?= $alreadyUsed ? 'used' : '' ?>" title="Взять `Новогодний подарок 2023`"
|
||
alt="">
|
||
</a>
|
||
<?php } ?>
|
||
</div>
|
||
</div>
|
||
<hr>
|
||
<?php
|
||
}
|
||
?>
|
||
<div style="padding-left:10px;">
|
||
<span class="pH3"><small>Наряжаем Ёлку:</small></span>
|
||
<div>
|
||
<?php
|
||
$it = mysql_fetch_array(mysql_query(' SELECT * FROM `items_users` WHERE `item_id` > 2723 AND `item_id` < 2741 AND `uid`= "' . $u->info['id'] . '" AND `delete` = 0 LIMIT 1 '));
|
||
if (isset($it['item_id'])) {
|
||
$itt = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $it['item_id'] . '" LIMIT 1'));
|
||
?>
|
||
<a href="?elka_shar=<?php echo $it['id']; ?>&shar_name=<?php echo $itt['name']; ?>" <?php if (!isset($itt['id'])) {
|
||
echo 'onClick="return false;"';
|
||
} ?> /><img src="//img.new-combats.tech/i/items/<?= $itt['img']; ?>" style="padding:10px;<?php if (!isset($it['id'])) {
|
||
echo 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;';
|
||
} ?>" title="Повесить `Шар`"></a>
|
||
<?php
|
||
} else {
|
||
echo "У Вас нет шаров для украшения Ёлки!";
|
||
}
|
||
?>
|
||
</div>
|
||
</div>
|
||
<hr>
|
||
<?php
|
||
// }
|
||
if (isset($_GET['page'])) {
|
||
$fpage = round($_GET['page']);
|
||
if ($fpage <= 0) {
|
||
$fpage = 1;
|
||
}
|
||
} else {
|
||
$fpage = 1;
|
||
}
|
||
$limit1 = ($fpage - 1) * 20 + $fpage - 1;
|
||
$limit2 = 21;
|
||
|
||
$i = mysql_fetch_array(mysql_query('SELECT COUNT(`year`) FROM `elka` WHERE `year` = "' . $dt . '" AND (`delete` = "0" OR ' . $u->info['admin'] . ' > 0) ORDER BY `id` DESC'));
|
||
$i = $i[0];
|
||
$d = ceil($i / 21);
|
||
if ($i > 0) {
|
||
if ($d < 13) {
|
||
$j = 0;
|
||
$pagesN = '';
|
||
while ($i >= 0) {
|
||
$i -= 21;
|
||
if ($i != 0) {
|
||
$j++;
|
||
$r2 = '';
|
||
if ($j <= $d) {
|
||
if (isset($r)) {
|
||
$r2 = '&r=' . $r;
|
||
}
|
||
$jt = $j;
|
||
if ($fpage == $j) {
|
||
$jt = '<span class="number">' . $j . '</span>';
|
||
}
|
||
$pagesN .= ' <a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=' . $j . '" title="Перейти на страницу №' . $j . '">' . $jt . '</a> ';
|
||
}
|
||
}
|
||
}
|
||
$pages .= ' ' . $pagesN . ' ';
|
||
} else {
|
||
$j = $fpage - 6;
|
||
$i = 0;
|
||
$pagesN = '';
|
||
while ($k < 13) {
|
||
if ($j > 0) {
|
||
if ($j <= $d) {
|
||
$jt = $j;
|
||
if ($fpage == $j) {
|
||
$jt = '<span class="number">' . $j . '</span>';
|
||
}
|
||
$pagesN .= ' <a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=' . $j . '" title="Перейти на страницу №' . $j . '">' . $jt . '</a> ';
|
||
}
|
||
$k++;
|
||
}
|
||
$j++;
|
||
}
|
||
$prpage = $fpage - 12;
|
||
$nxpage = $fpage + 12;
|
||
if ($prpage <= 0) {
|
||
$prpage = 1;
|
||
}
|
||
if ($nxpage > $d) {
|
||
$nxpage = $d;
|
||
}
|
||
$_GET['d'] = (int)$_GET['d'];
|
||
if ($fpage - 7 > 0) {
|
||
$pages .= '<a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=1" title="Первая страница">«</a> <a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=' . $prpage . '" title="Показать предыдущие страницы">...</a> ';
|
||
}
|
||
$pages .= ' ' . $pagesN . ' ';
|
||
if ($fpage < $d - 5) {
|
||
$pages .= '<a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=' . $nxpage . '" title="Показать следующие страницы">...</a> <a href="?id=' . $post['id'] . '&d=' . $_GET['d'] . '&page=' . $d . '" title="Последняя страница">»</a>';
|
||
}
|
||
}
|
||
} else {
|
||
$pages = '';
|
||
}
|
||
?>
|
||
<U>Посетители оставили надписи на стволе елки:</U> <?= $pages; ?><br>
|
||
<div style="padding:5px;">
|
||
<?php
|
||
$sp = mysql_query(
|
||
'SELECT * FROM `elka` WHERE `year`="' . $dt . '" AND `city`="' . $u->info['city'] . '" AND (`delete` = "0" OR ' . $u->info['admin'] . ' > 0) ORDER BY `time` DESC LIMIT ' . $limit1 . ',' . $limit2 . ''
|
||
);
|
||
$page = floor((int)$_POST['page']);
|
||
if ($page < 1) {
|
||
$page = 1;
|
||
} elseif ($page > 300) {
|
||
$page == 300;
|
||
}
|
||
while ($pl = mysql_fetch_array($sp)) {
|
||
$prs = explode('|', $pl['pers']);
|
||
$pers = '';
|
||
if ($prs[0] != 0) {
|
||
$pers .= '<img src="//img.new-combats.tech/i/align/align' . $prs[0] . '.gif">';
|
||
}
|
||
if ($prs[1] != 0) {
|
||
$clanPrs = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="' . $prs[1] . '" LIMIT 1'));
|
||
$pers .= '<img src="//img.new-combats.tech/i/clan/' . $clanPrs['name_mini'] . '.gif">';
|
||
}
|
||
$pers .= '<b>' . $prs[2] . '</b>[' . $prs[3] . ']<a href="/info/' . $prs[5] . '" title="Инф. о ' . $prs[2] . '" target="blank"><img src="//img.new-combats.tech/i/inf_' . $prs[4] . '.gif"></a>';
|
||
if ($pl['delete'] != '0') {
|
||
if ($pl['delete'] == '1') {
|
||
if ($u->info['admin'] > 0) {
|
||
$pl['text'] = '<font color=red><i>Сообщение стерто</i></font> <font color=grey><small>(' . $pl['text'] . ')</small></font>';
|
||
} else {
|
||
$pl['text'] = '<font color=red><i>Сообщение стерто</i></font>';
|
||
}
|
||
} else {
|
||
$prs = explode('|', $pl['delete']);
|
||
$pers2 = '';
|
||
if ($prs[0] != 0) {
|
||
$pers2 .= '<img src="//img.new-combats.tech/i/align/align' . $prs[0] . '.gif">';
|
||
}
|
||
if ($prs[1] != 0) {
|
||
$clanPrs = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="' . $prs[1] . '" LIMIT 1'));
|
||
$pers2 .= '<img src="//img.new-combats.tech/i/clan/' . $clanPrs['img'] . '.gif">';
|
||
}
|
||
$pers2 .= '<a href="javascript:top.toUser(\'' . $prs[2] . '\',\'private\');"><b>' . $prs[2] . '</b></a>[' . $prs[3] . ']<a href="/info/' . $prs[2] . '" title="Инф. о ' . $prs[2] . '" target="blank"><img src="//img.new-combats.tech/i/inf_' . $prs[4] . '.gif"></a>';
|
||
|
||
if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) {
|
||
$pl['text'] = '<i><font color=red>Сообщение стерто персонажем</font> ' . $pers2 . '</i> <font color=grey><small>(' . $pl['text'] . ')</small></font>';
|
||
} else {
|
||
$pl['text'] = '<i><font color=red>Сообщение стерто персонажем</font> ' . $pers2 . '</i>';
|
||
}
|
||
}
|
||
}
|
||
if (($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) && $pl['delete'] == '0') {
|
||
$dl = ' <a href="main.php?page=' . $_POST['page'] . '&del=' . $pl['id'] . '"><small>Стереть</small></a>';
|
||
} else {
|
||
$dl = '';
|
||
}
|
||
echo '<font class=date>' . date('d.m.Y H:i', $pl['time']) . '</font> ' . $pers . ' - ' . $pl['text'] . '' . $dl . '<BR>';
|
||
}
|
||
?>
|
||
</div>
|
||
Страницы: <?= $pages; ?><br>
|
||
<FORM method="post" action="main.php">
|
||
Оставить сообщение: <INPUT type=text name=message maxlength=150 size=50> <INPUT type=submit name=addmessage value='Добавить'>
|
||
</FORM>
|
||
<td width="280" valign="top">
|
||
<table cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td width="100%"> </td>
|
||
<td>
|
||
<table border="0" cellpadding="0" cellspacing="0">
|
||
<tr align="right" valign="top">
|
||
<td><!-- -->
|
||
<?= $goLis; ?>
|
||
<!-- -->
|
||
<table border="0" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td nowrap="nowrap">
|
||
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
|
||
<tr>
|
||
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7"/></td>
|
||
<td bgcolor="#D3D3D3" nowrap="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>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td nowrap="nowrap">
|
||
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
|
||
<tr>
|
||
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7"/></td>
|
||
<td bgcolor="#D3D3D3" nowrap="nowrap">
|
||
<div align="left">
|
||
<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.209&rnd=<?= $code; ?>';" title="<?php thisInfRm(
|
||
'1.180.0.209', 1
|
||
); ?>">Ледяная пещера</a></div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<br/>
|
||
<center></center>
|
||
</td>
|
||
</table>
|
||
<div id="textgo" style="visibility:hidden;"></div>
|
||
|
||
|