game/modules_data/location/hram.php

432 lines
22 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Core\Config;
use Insallah\Runes;
use Location\KnowledgeTemple;
use User\ItemsModel;
use User\StatsModel;
/** @var User $u */
if (!defined('GAME') || $u->room['file'] != 'hram') {
exit();
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/_incl_data/class/Insallah/Runes/Runes.php';
$qst_hram = true;
$kt = new KnowledgeTemple();
if (isset($_GET['itm']) && $_GET['itm'] > 0) {
if ($_GET['r'] == 1) {
$_GET['itm'] = (int)$_GET['itm'];
$re = $kt->smeltItem($_GET['itm']);
} elseif ($_GET['r'] == 2) {
//Переплавка рун
$resz = '';
$itm123 = explode('x', $_GET['itm']);
$itm1 = (int)$itm123[0];
$itm2 = (int)$itm123[1];
$itm3 = (int)$itm123[2];
$q = 'SELECT `a`.`id` AS `iid`,`a`.*,`b`.* FROM `items_users` AS `a` LEFT JOIN `items_main` AS `b` ON (`b`.`id` = `a`.`item_id` AND `b`.`type` = 31) WHERE `a`.`id` = %d AND `a`.`uid` = %d AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0';
$itm1 = mysql_fetch_array(mysql_query(sprintf($q, $itm1, $u->info['id'])));
$itm2 = mysql_fetch_array(mysql_query(sprintf($q, $itm2, $u->info['id'])));
$itm3 = mysql_fetch_array(mysql_query(sprintf($q, $itm3, $u->info['id'])));
if (!isset($itm1['id']) || !isset($itm2['id']) || !isset($itm3['id'])) {
$resz = 'Недостаточно компонентов для преобразования.';
} elseif ($itm1['iid'] == $itm2['iid'] || $itm2['iid'] == $itm3['iid'] || $itm1['iid'] == $itm3['iid']) {
$resz = 'Не удалось расплавить одну руну, она не сгорела.';
}
if (empty($resz)) {
$check = Runes::checkParts($itm1['item_id'], $itm2['item_id'], $itm3['item_id'], $u->rep['rep1']);
if (empty($check)) {
$resz = 'Ингредиенты должны быть одного уровня или у вас недостаточен уровень прокачки храма знаний!';
} else {
mysql_query(sprintf($check['query'], $u->info['id']));
$newRune = Runes::get($check['rune_level']);
if (!empty($newRune)) {
ItemsModel::addItem($check['rune_id'], $u->info['id'], $newRune[0]);
$resz = $newRune[1];
mysql_query(sprintf('update items_users set `delete` = unix_timestamp() where id in (%d, %d, %d)',
$itm1['iid'], $itm2['iid'], $itm3['iid']));
if (date('w') == 0 || date('w') == 6 || date('w') == 2) {
StatsModel::addRepexpById($u->info['id'], 10); //Репутация плавка рун +10
}
}
}
}
} elseif ($itm1['level'] == 1) {
//$resz = 'Унируны нельзя преобразовывать';
$itm4 = [];
$sp = mysql_query('SELECT * FROM `items_main` WHERE `level` = "' . $itm1['level'] . '" AND `type` = 31
AND `id` != "' . $itm1['item_id'] . '" AND `id` != "' . $itm2['item_id'] . '" AND `id` != "' . $itm3['item_id'] . '" AND `id` < 6000');
while ($pl = mysql_fetch_array($sp)) {
$itm4[] = $pl;
}
$itm4 = $itm4[rand(0, count($itm4) - 1)];
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm3['iid'] . '" OR `id` = "' . $itm2['iid'] . '" OR `id` = "' . $itm1['iid'] . '"');
ItemsModel::addItem($itm4['id'], $u->info['id']);
$resz = 'Удачно преобразованы руны &quot;' . $itm1['name'] . '&quot;,&quot;' . $itm2['name'] . '&quot; и &quot;' . $itm3['name'] . '&quot; в &quot;' . $itm4['name'] . '&quot;.';
} else {
$itm4 = [];
$sp = mysql_query('SELECT * FROM `items_main` WHERE `level` = "' . $itm1['level'] . '" AND `type` = 31
AND `id` != "' . $itm1['item_id'] . '" AND `id` != "' . $itm2['item_id'] . '" AND `id` != "' . $itm3['item_id'] . '"');
while ($pl = mysql_fetch_array($sp)) {
$itm4[] = $pl;
}
$itm4 = $itm4[rand(0, count($itm4) - 1)];
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm3['iid'] . '" OR `id` = "' . $itm2['iid'] . '" OR `id` = "' . $itm1['iid'] . '"');
ItemsModel::addItem($itm4['id'], $u->info['id']);
$resz = 'Удачно преобразованы руны &quot;' . $itm1['name'] . '&quot;,&quot;' . $itm2['name'] . '&quot; и &quot;' . $itm3['name'] . '&quot; в &quot;' . $itm4['name'] . '&quot;.';
}
$re = $resz;
unset($resz);
}
?>
<style>
.pH3 {
COLOR: #8f0000;
FONT-FAMILY: Arial, serif;
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;
}
</style>
<div id="hint3" style="visibility:hidden"></div>
<?php if (isset($_GET['r'])) { ?>
<TABLE width="100%" cellspacing="0" cellpadding="0">
<tr>
<td style="vertical-align: top;">
<div style="text-align: center;" class="pH3">Храм Знаний <?php if ($_GET['r'] == 2) {
echo ', Алтарь рун';
} elseif ($_GET['r'] == 1) {
echo ', Алтарь предметов';
} ?></div>
<div style="text-align: left;"><?= $re ??= '' ?></div>
<td style="width: 280px; vertical-align: top; text-align: right;">
<br><br>
<input type="button" class="btn" value="Обновить" onclick="location.href = '<?php if (isset($_GET['r'])) {
echo 'main.php?r=' . floor($_GET['r']);
} else {
echo 'main.php';
} ?>';"/><?php if (isset($_GET['r'])) { ?> &nbsp; <input class="btn" type="button" value="Вернуться" onclick="location.href = 'main.php';"/><?php } ?><br><br>
</td>
</table>
<div id="textgo" style="visibility:hidden;"></div>
<?php
}
if (!isset($_GET['r'])) {
//Диалоговый перс
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250" valign="top"><?php $usee = $u->getInfoPers($u->info['id'], 0);
if ($usee) {
echo $usee[0];
} else {
echo 'information is lost.';
} ?></td>
<td width="230" valign="top" style="padding-top:19px;"><?php require_once('modules_data/stats_loc.php'); ?></td>
<td valign="top">
<div align="right">
<table border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="top">
<td><?php if ($re != '') {
echo '<b style="color: red">' . $re . '</b>';
} ?>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div style="position:relative; cursor: pointer;" id="ione">
<img src="//img.new-combats.tech/city/ap_bg13_1.jpg" alt="" name="img_ione" width="500" height="268" border="1" id="img_ione">
<div id="buttons_on_image" style="cursor:pointer; font-weight:bold; color:#D8D8D8; font-size:10px;">
&nbsp; <span onmousemove="this.runtimeStyle.color = 'white';"
onmouseout="this.runtimeStyle.color = this.parentElement.style.color;"
onclick="window.open('/forum', 'forum', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')">Форум</span>
&nbsp;
</div>
<script>
<!--
if (document.getElementById('ione')) {
document.getElementById('ione').appendChild(document.getElementById('buttons_on_image'));
document.getElementById('buttons_on_image').style.position = 'absolute';
document.getElementById('buttons_on_image').style.bottom = '8px';
document.getElementById('buttons_on_image').style.right = '23px';
} else {
document.getElementById('buttons_on_image').style.display = 'none';
}
-->
</script>
<div style="position: absolute; left: 437px; top: 96px; width: 48px; height: 33px; z-index: 94;">
<img <?php thisInfRm('1.180.0.11'); ?>src="//img.new-combats.tech/city/ap_exit.gif" class="aFilter" alt=""></div>
<div style="position: absolute; left: 191px; top: 12px; width: 75px; height: 68px; z-index: 94;">
<img onclick="location.href='main.php?talk=11'" src="//img.new-combats.tech/city/1269_igsetee.png" class="aFilter" title="Диалог с Арквиерро"
alt=""></div>
<div style="position: absolute; left: 30px; top: 127px; width: 48px; height: 33px; z-index: 94;">
<img <?php if (!$qst_hram) {
echo 'onclick="alert(\'Арквиерро: Вы не допущены к котлам! (Выполните задание)\');"';
} else { ?> onclick="location.href='main.php?r=1'" <?php } ?>
title="Алтарь Предметов" src="//img.new-combats.tech/city/ap_altar1.gif" class="aFilter" alt="">
</div>
<div style="position: absolute; left: 333px; top: 129px; width: 48px; height: 33px; z-index: 94;">
<img <?php if (!$qst_hram) {
echo 'onclick="alert(\'Арквиерро: Вы не допущены к котлам! (Выполните задание)\');"';
} else { ?> onclick="location.href='main.php?r=2'" <?php } ?>
title="Алтарь Рун" src="//img.new-combats.tech/city/ap_altar2.gif" class="aFilter" alt="">
</div>
<div style="position: absolute; left: 437px; top: 96px; width: 48px; height: 33px; z-index: 94;">
<img <?php thisInfRm('1.180.0.11'); ?> src="//img.new-combats.tech/city/ap_exit.gif" class="aFilter" alt=""></div>
<div id="snow"></div>
<?= $goline; ?>
</div>
</td>
</tr>
</table>
<div style="display:none; height:0px " id="moveto"></div>
</td>
</tr>
</table>
</div>
</td>
<td></td>
</tr>
</table>
<br><?= $rowonmax ?><br>
<?php
} elseif ($_GET['r'] == 1) {
$itmAll = '';
$itmAllSee = '';
$itmAll = $u->genInv(11, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`data` NOT LIKE "%fromshop=2%" ORDER BY `lastUPD` DESC');
if ($itmAll[0] == 0) {
$itmAllSee = '<tr><td style="text-align: center; background-color: #E2E0E0;">ПУСТО (нет подходящих предметов)</td></tr>';
} else {
$itmAllSee = $itmAll[2];
}
//Удачно растворен предмет "Укрепленный Костыль". Получена руна "Моно Бауни".
?>
<script>
function takeItRun(img, id, vl) {
if (id != urlras) {
urlras = id;
document.getElementById('use_item').innerHTML = '<img src="https://<?=$c['img'];?>/i/items/' + img + '" title="Предмет для переплавки"/><br><a href="javascript:void(0);" onClick="cancelItRun()">Отменить</a>';
if (vl == 0) {
document.getElementById('add_rep').innerHTML = ' + ' + vl + '<br><div><b><font color="red"><small>(Необходим предмет подходящего уровня, иначе вы не получите репутацию)</small></font></b></div>';
} else {
document.getElementById('add_rep').innerHTML = ' + ' + vl;
}
} else {
cancelItRun();
}
}
function cancelItRun() {
urlras = 0;
document.getElementById('use_item').innerHTML = 'Предмет не выбран';
document.getElementById('add_rep').innerHTML = '';
}
urlras = 0;
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= $u->microLogin($u->info['id'], 1) ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><B>Подходящие предметы в инвентаре</B></td>
</tr>
<tr>
<td width="300" valign="top">
<b>Репутация: <?= 0 + $u->rep['rep1']; ?></b><span id="add_rep"></span>
<div style="text-align: center; margin-top: 5px; margin-bottom: 5px;">
<span id="use_item">Предмет не выбран</span><br><br>
<button onclick="location.href='?r=<?= $_GET['r'] ?>&rnd=<?= $code ?>&itm='+urlras;">Растворить</button>
</div>
<small><span style="color: red; ">Внимание!</span><br/> Предметы при растворении и заготовки при слиянии необратимо теряются.</small>
</td>
<td valign="top">
<!-- -->
<?php if (!empty($u->info['invBlock'])): ?>
<div style="padding:10px;background-color:#A5A5A5; text-align: center;">
<b>Рюкзак закрыт.</b><br>
<img title="Замок для рюкзака" src="<?= Config::img() ?>/i/items/box_lock.gif" alt="">
<form method="post" action="/main.php?inv=1&otdel=<?= $_GET['otdel'] ?>&relockinvent">
<label>Введите пароль: <input id="relockInv" name="relockInv" type="password"></label>
<input type="submit" value="Открыть">
</form>
</div>
<?php else: ?>
<table style="width: 100%; text-align: center; background-color: #A5A5A5; border: 0;" cellspacing="1" cellpadding="0">
<?= $itmAllSee ?>
</table>
<?php endif; ?>
</td>
</tr>
</table>
<?php } elseif ($_GET['r'] == 2) {
$itmAll = '';
$itmAllSee = '';
$itmAll = $u->genInv(14, '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND (`im`.`type` = 31 OR`im`.`type` = 72) ORDER BY `lastUPD` DESC');
if ($itmAll[0] == 0) {
$itmAllSee = '<tr><td style="text-align: center; background-color: #E2E0E0;">ПУСТО (нет подходящих предметов)</td></tr>';
} else {
$itmAllSee = $itmAll[2];
}
//Удачно растворен предмет "Укрепленный Костыль". Получена руна "Моно Бауни".
?>
<script>
function takeItRun(img, id, vl) {
if (id != urlras) {
urlras = id;
document.getElementById('use_item').innerHTML = '<img src="https://<?=$c['img'];?>/i/items/' + img + '" title="Предмет для переплавки"/><br><a href="javascript:void(0);" onClick="cancelItRun()">Отменить</a>';
} else {
cancelItRun();
}
}
function cancelItRun() {
urlras = 0;
document.getElementById('use_item').innerHTML = 'Пусто';
document.getElementById('add_rep').innerHTML = '';
}
urlras = 0;
//
function takeItRun2(img, id, vl) {
if (id != urlras2) {
urlras2 = id;
document.getElementById('use_item2').innerHTML = '<img src="https://<?=$c['img'];?>/i/items/' + img + '" title="Предмет для переплавки"/><br><a href="javascript:void(0);" onClick="cancelItRun2()">Отменить</a>';
} else {
cancelItRun2();
}
}
function cancelItRun2() {
urlras2 = 0;
document.getElementById('use_item2').innerHTML = 'Пусто';
}
urlras2 = 0;
//
function takeItRun3(img, id, vl) {
if (id != urlras3) {
urlras3 = id;
document.getElementById('use_item3').innerHTML = '<img src="https://<?=$c['img'];?>/i/items/' + img + '" title="Предмет для переплавки"/><br><a href="javascript:void(0);" onClick="cancelItRun3()">Отменить</a>';
} else {
cancelItRun3();
}
}
function cancelItRun3() {
urlras3 = 0;
document.getElementById('use_item3').innerHTML = 'Пусто';
}
urlras3 = 0;
//
function massTakeItRun(img, id, vl) {
if (urlras == id) {
takeItRun(img, id, vl);
} else if (urlras2 == id) {
takeItRun2(img, id, vl);
} else if (urlras3 == id) {
takeItRun3(img, id, vl);
} else if (urlras == 0) {
takeItRun(img, id, vl);
} else if (urlras2 == 0) {
takeItRun2(img, id, vl);
} else {
takeItRun3(img, id, vl);
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= $u->microLogin($u->info['id'], 1) ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><b>Подходящие предметы в инвентаре</b></td>
</tr>
<tr>
<td width="300" valign="top">
<b>Репутация: <?= 0 + $u->rep['rep1']; ?></b><span id="add_rep"></span>
<br/><br/>
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" align="center"><span id="use_item">Пусто</span></td>
<td width="80" align="center"><span id="use_item2">Пусто</span></td>
<td width="80" align="center"><span id="use_item3">Пусто</span></td>
</tr>
</table>
<br/><br/>
<input class="btn" type="button" value="Преобразовать" onclick="location.href = '?r=<?= $_GET['r'] . '&rnd=' . $code . '&itm='; ?>'+urlras+'x'+urlras2+'x'+urlras3;"/>
</center>
<br>
<br><small><span style="color: red;">Внимание!</span><br>Предметы при растворении и заготовки при слиянии необратимо теряются.</small>
</td>
<td valign="top">
<!-- -->
<table width="100%" border="0" cellspacing="1" align="center" cellpadding="0" bgcolor="#A5A5A5">
<?php if ($u->info['invBlock'] == 0) {
echo $itmAllSee;
} else {
echo '<div align="center" style="padding:10px;background-color:#A5A5A5;"><form method="post" action="main.php?inv=1&otdel=' . $_GET['otdel'] . '&relockinvent"><b>Рюкзак закрыт.</b><br><img title="Замок для рюкзака" src="//img.new-combats.tech/i/items/box_lock.gif"> Введите пароль: <input id="relockInv" name="relockInv" type="password"><input type="submit" value="Открыть"></form></div>';
} ?>
</table>
<!-- -->
</td>
</tr>
</table>
<?php } ?>