WIP: разгрузка User:class от сторонних методов.

This commit is contained in:
Ivor Barhansky 2023-04-18 12:21:54 +03:00
parent 2bc67ce543
commit 02c76e76ad
15 changed files with 548 additions and 4100 deletions

View File

@ -0,0 +1,193 @@
<?php
namespace Clan;
use Core\ConversionHelper;
use Core\Db;
use User;
use User\ItemsModel;
class ItemStorage
{
private string $error = '';
private function isGoodForStorage(array $item, $userClanId): bool
{
if (empty($item['inslot']) || !empty($item['gift'])) {
$this->error = 'Ïðåäìåò íå íàéäåí.';
}
$idata = ConversionHelper::dataStringToArray($item['data']);
if (
!empty($idata['frompisher']) ||
!empty($idata['sudba']) ||
!empty($idata['icos']) ||
!empty($idata['fromlaba'])
) {
$this->error = 'Ïðåäìåò íå ïîäõîäèò.';
}
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $userClanId) {
$this->error = 'Ïðåäìåò óæå ïðèíàäëåæèò êëàíó.';
}
return empty($this->error);
}
public function put(int $itemId, int $clanId): string
{
$user = User::start()->info;
$item = ItemsModel::getOwnedItemById($itemId, $user['id']);
$clanName = Db::getValue('select name from clan where id = ?', [$clanId]) ?? '';
if (empty($clanName)) {
return 'Êëàí íå íàéäåí.';
}
if (!$this->isGoodForStorage($item, $user['clan'])) {
return $this->error;
}
$col = User::start()->itemsX(($itemId));
$idata = ConversionHelper::dataStringToArray($item['data']);
if (!isset($idata['toclan'])) {
$idata['toclan'] = $user['clan'] . '#' . $user['id'];
$item['data'] = ConversionHelper::arrayToDataString($idata);
User::start()->addDelo(
2,
$user['id'],
'&quot;System.transfer.MONEY&quot;: Ïðåäìåò &quot;' . $item['name'] . '&quot; (#id : "' . $itemId . '") (x' . $col . ') áûë ïîæåðòâîâàí êëàíó &quot;' . $clanName . '&quot; (' . $clanId . ').',
time(),
$user['city'],
'System.transfer.clan',
0,
0
);
$sendType = 4;
} else {
$sendType = 3;
}
Db::sql(
'insert into clan_operations (clan, time, type, text, val, uid) values (?,unix_timestamp(),?,?,?,?)',
[$clanId, $sendType, $user['login'], $item['name'] . ("x$col Èä: [$itemId]"), $user['id']]
);
Db::sql(
'update items_users set lastUPD = unix_timestamp(), uid = ?, data = ? where id = ?',
['-21' . $user['clan'], $item['data'], $itemId]
);
return 'Âû ïåðåäàëè ïðåäìåò &quot;' . $item['name'] . '&quot; êëàíó.';
}
public function ungive_itm_cl($id, $user, $cl): string
{
$itm_ = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
)
);
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
$user_itm = mysql_fetch_array(
mysql_query('SELECT `id`,`bot`,`clone` FROM `stats` WHERE `id` = "' . $itm_['uid'] . '" LIMIT 1')
);
if ($user_itm['bot'] > 0 || $user_itm['clone'] > 0 || !isset($user_itm['id'])) {
$r = '<font color="#FF0000"><strong>Âû íå ìîæåòå èçüÿòü äàííûé ïðåäìåò, îí íå ïðèíàäëåæèò êëàíó</strong></font><br />';
} elseif (isset($itm_['id'])) {
if ($itm_['inOdet'] != 0) {
$o = ', `inOdet` = 0';
} else {
$o = '';
}
$r = '<font color="#FF0000"><strong>Âû óñïåøíî èçúÿëè ïðåäìåò &quot;' . $itm_['name'] . '&quot;</strong></font><br />';
$col = $this->itemsX(((int)$id));
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Èä : [' . $id . '] | Ó ïåðñîíàæà : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'
);
mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'
);
} else {
$r = '<font color="#FF0000"><strong>Ïðåäìåò íå íàéäåí.</strong></font><br />';
}
return $r;
}
public function take_itm_cl($id, $user, $cl): string
{
$itm_ = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "-21' . $user['clan'] . '" AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
)
);
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
if (isset($itm_['id'])) {
$po = ConversionHelper::dataStringToArray($itm_['data']);
if (isset($po['toclan'])) {
$cls = explode('#', $po['toclan']);
$cls = $cls[1];
}
$col = $this->itemsX(((int)$id));
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Èä : [' . $id . '] Õîçÿèí : [' . $cls . ']", "' . $user['id'] . '")'
);
mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
);
$r = '<font color="#FF0000"><strong>Âû óñïåøíî âçÿëè ïðåäìåò &quot;' . $itm_['name'] . '&quot; èç õðàíèëèùà</strong></font><br />';
} else {
$r = '<font color="#FF0000"><strong>Ïðåäìåò íå íàéäåí.</strong></font><br />' . $id;
}
return $r;
}
public function rem_itm_cl($user, $cl, $type)
{
$itms = mysql_query(
'SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")'
);
while ($pl = mysql_fetch_array($itms)) {
$po = ConversionHelper::dataStringToArray($pl['data']);
if (isset($po['toclan'])) {
$cls = explode('#', $po['toclan']);
$cls = $cls[1];
}
if ($cls == $user['id']) {
if ($pl['uid'] != $user['id']) {
if ($pl['inOdet'] != 0) {
mysql_query('UPDATE `items_users` SET `inOdet` = 0 WHERE `id` = "' . $pl['id'] . '"');
}
}
unset($po['toclan']);
$pl['data'] = ConversionHelper::arrayToDataString($po);
$col = $this->itemsX(((int)$pl['id']));
$it_n = mysql_fetch_array(
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
);
mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'
);
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Èä : [' . $pl['id'] . ']", "' . $user['id'] . '")'
);
} elseif ($pl['uid'] == $user['id']) {
$col = $this->itemsX(((int)$pl['id']));
$it_n = mysql_fetch_array(
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
);
mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'
);
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Èä : [' . $pl['id'] . ']", "' . $user['id'] . '")'
);
}
}
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace DTO;
use Core\ConversionHelper;
use ItemModel;
class KnowledgeTempleItem
{
public int $id;
public int $type;
public string $name;
public int $level;
private int $rowId;
/**
* @param array $item
*/
public function __construct(array $item)
{
$this->rowId = $item['id'];
$this->id = intval($item['item_id']);
$this->type = intval($item['type']);
$this->name = $item['name'];
// Îáùèé + êîíêðåòíûé.
$itemData = array_merge(
ConversionHelper::dataStringToArray(ItemModel::getItemData($this->id)),
ConversionHelper::dataStringToArray($item['data']),
);
$this->level = intval($itemData['tr_lvl']);
}
public function exists(): bool
{
return !empty($this->rowId);
}
}

View File

@ -0,0 +1,14 @@
<?php
use Core\Db;
/** Ïðåäìåòû êîòîðûå íèêîìó íå ïðèíàäëåæàò. Íå ïåðåïóòàé! */
class ItemModel
{
public static function getItemData(int $id): string
{
return Db::getValue('select data from items_main_data where items_id = ?', [$id]);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace Location;
use Core\Db;
use DTO\KnowledgeTempleItem;
use User;
class KnowledgeTemple
{
private string $error = '';
/** Ïëàâêà ïðåäìåòà
* @param int $id id ïðåäìåòà
* @return string ñòàòóñ ñîáûòèÿ
*/
public function smeltItem(int $id): string
{
$item = new KnowledgeTempleItem(User\ItemsModel::getOwnedItemById(User::start()->info['id'], $id));
if (!$this->isSmeltable($item)) {
return $this->error;
}
User\ItemsModel::delete($id);
return 'Óäà÷íî ðàñòâîðåí ïðåäìåò "' . $item->name . '"!' . self::addReputation(1);
}
private function isSmeltable(KnowledgeTempleItem $item): bool
{
$reputation = User::start()->rep['rep1'];
if (!$item->exists()) {
$this->error = 'Ïðåäìåò íå íàéäåí.';
} elseif ($item->level < 4 && $item->id != 1035) {
$this->error = 'Ïðåäìåò äîëæåí áûòü 4-ãî è âûøå óðîâíÿ';
} elseif (
!in_array($item->type, [1, 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22]) &&
$item->id != 1035
) {
$this->error = 'Õðåí âàì, à íå ðóíû! Êóäà êèäàåøü ïðåäìåò? Íå ïîäõîäèò îí! Ïðèõîäè êàê áóäåò ÷òî-òî ñòîþùåå!';
} elseif ($item->level >= 7 && $reputation < 0) {
$this->error = 'Äëÿ ðàñòâîðåíèÿ ïðåäìåòîâ 7-ãî è ñòàðøå óðîâíÿ òðåáóåòñÿ çíàê Õðàìà Çíàíèé ïåðâîãî êðóãà';
} elseif ($item->level >= 9 && $reputation < 1000) {
$this->error = 'Äëÿ ðàñòâîðåíèÿ ïðåäìåòîâ 9-ãî è ñòàðøå óðîâíÿ òðåáóåòñÿ çíàê Õðàìà Çíàíèé âòîðîãî êðóãà';
} elseif ($item->level >= 10 && $reputation < 10000) {
$this->error = 'Äëÿ ðàñòâîðåíèÿ ïðåäìåòîâ 10-ãî è ñòàðøå óðîâíÿ òðåáóåòñÿ çíàê Õðàìà Çíàíèé òðåòüåãî êðóãà';
}
return empty($this->error);
}
public static function addReputation(int $value): string
{
if ($value < 1) {
trigger_error(self::class . '::addReputation - $value can not be below zero.');
}
Db::sql('update rep set rep1 = rep1 + ? where id = ?', [$value, User::start()->info['id']]);
User::start()->rep['rep1'] += $value;
return "Ïîëó÷åíî ðåïóòàöèè: +$value åä.";
}
}

View File

@ -0,0 +1,26 @@
<?php
class Status
{
private static array $messages = [];
public static function set(string $message)
{
self::$messages[] = $message;
}
public static function get(): string
{
return implode('<br>', self::$messages);
}
public static function print()
{
echo self::get();
}
public static function exists(): bool
{
return !empty(self::$messages);
}
}

View File

@ -935,62 +935,6 @@ class User
return $r;
}
//Переплавка вещей \ рун
public function plavka($id, $type): string
{
$e = '';
$rn = 1;
$pl = mysql_fetch_array(
mysql_query(
'SELECT
`im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,
`iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl`
FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;'
)
);
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['item_id'] . '" LIMIT 1'
)
);
$po = ConversionHelper::dataStringToArray($d['data']);
if ($pl['level'] == 0) {
$pl['level'] = 0 + $po['tr_lvl'];
}
if ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035) {
$e = 'Предмет должен быть 4-го и выше уровня';
} elseif ($pl['type'] != 1 && $pl['type'] != 3 && $pl['type'] != 5 && $pl['type'] != 6 && $pl['type'] != 8 && $pl['type'] != 9 && $pl['type'] != 10 && $pl['type'] != 11 && $pl['type'] != 12 && $pl['type'] != 14 && $pl['type'] != 15 && $pl['type'] != 18 && $pl['type'] != 19 && $pl['type'] != 20 && $pl['type'] != 21 && $pl['type'] != 22 && $pl['type'] != 13 && $pl['item_id'] != 1035) {
$e = 'Хрен вам, а не руны! Куда кидаешь предмет? Не подходит он! Приходи как будет что-то стоющее!';
} elseif ($po['tr_lvl'] >= 7 && $this->rep['rep1'] < 0)//100
{
$e = 'Для растворения предметов 7-го и старше уровня требуется знак Храма Знаний первого круга';
} elseif ($po['tr_lvl'] >= 9 && $this->rep['rep1'] < 1000) {
$e = 'Для растворения предметов 9-го и старше уровня требуется знак Храма Знаний второго круга';
} elseif ($po['tr_lvl'] >= 10 && $this->rep['rep1'] < 10000) {
$e = 'Для растворения предметов 10-го и старше уровня требуется знак Храма Знаний третьего круга';
} elseif ($rn > 0) {
if (isset($pl['id'], $d['id'])) {
$pl['rep'] = 1;
//вероятность выпадения руны
$e = 'Удачно растворен предмет "' . $pl['name'] . '"! Получено репутации: +' . $pl['rep'] . ' ед.';
mysql_query(
'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$this->rep['rep1'] += $pl['rep'];
mysql_query(
'UPDATE `rep` SET `rep1` = "' . $this->rep['rep1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
} else {
$e = 'Предмет не найден, либо не подходит ' . $pl['item_id'] . '...';
}
} else {
$e = 'Не удалось переплавить, рецепты рун были потеряны ...';
}
return $e;
}
//Выводим вещи котоыре нужно отремонтировать
public function info_remont(): string
{
@ -1018,7 +962,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
}
//Расчет урона от оружия
public function weaponAtc($item, $st, $x)
private function weaponAtc($item, $st, $x)
{
$tp = 0;
if (isset($item['id'])) {
@ -7397,6 +7341,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
public function itemsX($id, $uid = null, $item_id = null)
{
$item = mysql_fetch_array(
mysql_query(
'SELECT `iu`.`id`,`iu`.`item_id`,`iu`.`uid`,`iu`.`inGroup`,`iu`.`inShop` FROM `items_users` AS `iu` WHERE `iu`.`delete` = "0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1 '
@ -11433,72 +11378,6 @@ LIMIT 1'
return [$sh, $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']];
}
public function set_cl_item($id, $user, $cl): string
{
$item_ = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "' . $user['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" AND `iu`.`id` = "' . $id . '" LIMIT 1'
)
);
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
if (isset($item_['id'])) {
$po = ConversionHelper::dataStringToArray($item_['data']);
if (isset($po['toclan'])) {
$po['toclan1'] = explode('#', $po['toclan']);
$po['toclan1'] = $po['toclan1'][0];
}
if (isset($po['sudba']) && $po['sudba'] != '0') {
$r = '<font color="#FF0000"><strong>Предмет связан с вами судьбой</strong></font><br>';
} elseif (isset($po['toclan']) && $po['toclan1'] != $user['clan']) {
$r = '<font color="#FF0000"><strong>Предмет и так пренадлежит клану...</strong></font><br>';
} elseif ($user['inTurnir'] > 0 || $user['inTurnirnew'] > 0) {
$r = '<font color="#FF0000"><strong>Во время участия в турнире запрещено использовать клановое хранилище.</strong></font><br>';
} else {
if ((isset($po['sudba']) && $po['sudba'] != '0') || isset($po['icos']) || isset($po['frompisher']) || isset($po['fromlaba']) || ($item_['gift'] != '' && $item_['gift'] != 0)) {
$r = 'Не удалось';
} elseif (!isset($po['toclan'])) {
$po['toclan'] = $user['clan'] . '#' . $user['id'];
$item_['data'] = ConversionHelper::arrayToDataString($po);
if (mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $user['clan'] . '", `data` = "' . $item_['data'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
)) {
$r = '<font color="#FF0000"><strong>Вы успешно пожертвовали предмет &quot;' . $item_['name'] . '&quot; клану</strong></font><br />';
$col = $this->itemsX(((int)$id));
$this->addDelo(
2, $user['id'],
'&quot;<font color="green">System.transfer.MONEY</font>&quot;: Предмет &quot;' . $item_['name'] . '&quot; (#id : "' . $id . '") (x' . $col . ') был пожертвован клану &quot;' . $res['name'] . '&quot; (' . $res['id'] . ').',
time(), $user['city'], 'System.transfer.clan', 0, 0
);
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "4", "' . $user['login'] . '", "' . $item_['name'] . ' (x' . $col . ') Ид : [' . $id . ']", "' . $user['id'] . '")'
);
} else {
$r = '<font color="#FF0000"><strong>Не удалось...</strong></font><br>';
}
} else {
if (mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
)) {
$col = $this->itemsX(((int)$id));
mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "3", "' . $user['login'] . '", "' . $item_['name'] . '" (x' . $col . ') Ид : [' . $id . '], "' . $user['id'] . '")'
);
$r = '<font color="#FF0000"><strong>Вы успешно вернули предмет &quot;' . $item_['name'] . '&quot; в хранилище клана</strong></font><br />';
} else {
$r = '<font color="#FF0000"><strong>Не удалось...</strong></font><br>';
}
}
}
} else {
$r = '<font color="#FF0000"><strong>Предмет не найден.</strong></font><br>';
}
return $r;
}
public function ungive_itm_cl($id, $user, $cl): string
{

View File

@ -146,4 +146,20 @@ class ItemsModel
}
return $rt;
}
/** Выбор предмета в инвентаре.
* @param int $itemId
* @param int $ownerId
* @return array
*/
public static function getOwnedItemById(int $itemId, int $ownerId): array
{
return Db::getRow('select * from items_users left join items_main on item_id = items_main.id where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]);
}
public static function delete(int $id)
{
Db::sql('update items_users set `delete` = unix_timestamp() where id = ?', [$id]);
}
}

View File

@ -4,9 +4,8 @@ if(!defined('GAME'))
die();
}
if( $itm['id'] > 0 ) {
$u->deleteItem($itm['id']);
mysql_query('update `rep` set `rep1` = `rep1` + 100 WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
$u->error = 'Вы повысили репутацию Храма Знаний на +100 ед.';
if($itm['id'] <= 0) {
return;
}
?>
$u->deleteItem($itm['id']);
$u->error = \Location\KnowledgeTemple::addReputation(100);

View File

@ -67,7 +67,7 @@ $filter = new Filter();
$q = new Quests;
$code = PassGen::intCode(); //для ссылок вида ?rnd=XXXXXX, вроде как-то борется с кешированием, но это не точно.
$training_manager = TrainingManager::getInstance($u->info['id']);
//$training_manager = TrainingManager::getInstance($u->info['id']);
/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */
Db::exec(

View File

@ -16,6 +16,8 @@ if (!isset($_GET['events']) && !isset($_GET['diplom']) && !isset($_GET['control'
$_GET['events'] = 1;
}
$storage = new \Clan\ItemStorage();
//Возможности текущего титула
$tt = [
0 => ['000000000', 'Доступные каналы'],
@ -2294,7 +2296,7 @@ if ($u->info['clan_prava'] != 'glava') {
if ($itmc >= $lvl_prava[$res['level']][5]) {
echo '<font color="#FF0000"><b>Хранилище переполнено</b></font><br>';
} elseif (isset($itm['id'])) {
echo $u->set_cl_item($_GET['give_itm'], $u->info, $res['id']);
echo $storage->put($_GET['give_itm'], $res['id']);
}
}
if ($tt[4][0] == 1) {

File diff suppressed because it is too large Load Diff

View File

@ -142,7 +142,7 @@ function thisInfRm($id, $tp = null, $json = false)
}
if (isset($_GET['loc'])) {
$training_manager = \DarksLight2\Training\TrainingManager::getInstance();
// $training_manager = \DarksLight2\Training\TrainingManager::getInstance();
$go = mysql_fetch_array(
mysql_query(
@ -152,11 +152,9 @@ if (isset($_GET['loc'])) {
)
);
if (in_array(
$go['file'],
$training_manager->getRegistered(
)[$training_manager->getCurrentStepName()]->allowedToMove()
) || $u->info['admin'] > 0) {
// if (in_array(
// $go['file'], $training_manager->getRegistered()[$training_manager->getCurrentStepName()]->allowedToMove()
// ) || $u->info['admin'] > 0) {
$tr_pl = mysql_fetch_array(
mysql_query(
@ -371,9 +369,9 @@ if (isset($_GET['loc'])) {
} else {
$re = 'Проход не существует';
}
} else {
$re = 'Вам запрещено передвигаться до окончания обучения!!!';
}
// } else {
// $re = 'Вам запрещено передвигаться до окончания обучения!!!';
// }
}
if ($u->info['room'] == 209) {

View File

@ -1,5 +1,6 @@
<?php
use Location\KnowledgeTemple;
use User\StatsModel;
if (!defined('GAME') || $u->room['file'] != 'ab/hram') {
@ -9,14 +10,12 @@ if (!defined('GAME') || $u->room['file'] != 'ab/hram') {
require_once $_SERVER['DOCUMENT_ROOT'] . '/_incl_data/class/Insallah/Runes/Runes.php';
$qst_hram = true;
$kt = new KnowledgeTemple();
if (isset($_GET['itm']) && $qst_hram && $_GET['itm'] > 0) {
if (isset($_GET['itm']) && $_GET['itm'] > 0) {
if ($_GET['r'] == 1) {
$_GET['itm'] = (int)$_GET['itm'];
//Переплавка вещей
$resz = $u->plavka($_GET['itm'], 1);
$re = '<font color=red><b>' . $resz . '</b></font>';
unset($resz);
$re = $kt->smeltItem($_GET['itm']);
} elseif ($_GET['r'] == 2) {
//Переплавка рун
$resz = '';
@ -81,7 +80,7 @@ if (isset($_GET['itm']) && $qst_hram && $_GET['itm'] > 0) {
$resz = 'Удачно преобразованы руны &quot;' . $itm1['name'] . '&quot;,&quot;' . $itm2['name'] . '&quot; и &quot;' . $itm3['name'] . '&quot; в &quot;' . $itm4['name'] . '&quot;.';
}
$re = '<font color=red><b>' . $resz . '</b></font>';
$re = $resz;
unset($resz);
}
@ -147,9 +146,7 @@ if (isset($_GET['itm']) && $qst_hram && $_GET['itm'] > 0) {
} elseif ($_GET['r'] == 1) {
echo ', Алтарь предметов';
} ?></div>
<div align="left"><?php if ($re != '') {
echo '<font color="red"><b>' . $re . '</b></font>';
} ?></div>
<div align="left"><?= $re ??= '' ?></div>
<td width="280" valign="top" align="right">
<table align="right" cellpadding="0" cellspacing="0">
<tr>

View File

@ -1,394 +0,0 @@
<?php
if(!defined('GAME'))
{
die();
}
/*$qst_hram = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "'.$u->info['id'].'" AND `var` = "qsthram1" AND `val` = 1 LIMIT 1'));
if(isset($qst_hram['id'])) {
$qst_hram = true;
}else{
$qst_hram = false;
unset($_GET['r']);
}*/
$qst_hram = true;
if($u->room['file']=='ab/hram')
{
if(isset($_GET['itm']) && $qst_hram == true)
{
if($_GET['itm']>0)
{
if($_GET['r']==1)
{
$_GET['itm'] = (int)$_GET['itm'];
//Переплавка вещей
$resz = $u->plavka($_GET['itm'],1);
$re = '<font color=red><b>'.$resz.'</b></font>';
unset($resz);
}elseif( $_GET['r'] == 2 ){
//Переплавка рун
$resz = '';
$itm123 = explode('x',$_GET['itm']);
$itm1 = round((int)$itm123[0]);
$itm2 = round((int)$itm123[1]);
$itm3 = round((int)$itm123[2]);
$itm1 = mysql_fetch_array(mysql_query('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` = "'.mysql_real_escape_string($itm1).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1'));
$itm2 = mysql_fetch_array(mysql_query('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` = "'.mysql_real_escape_string($itm2).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1'));
$itm3 = mysql_fetch_array(mysql_query('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` = "'.mysql_real_escape_string($itm3).'" AND `a`.`uid` = "'.$u->info['id'].'" AND `a`.`delete` = 0 AND `a`.`inShop` = 0 AND `a`.`inTransfer` = 0 LIMIT 1'));
if($itm1['iid'] == $itm2['iid'] || $itm2['iid'] == $itm3['iid'] || $itm1['iid'] == $itm3['iid'] ) {
$resz = 'Не удалось расплавить одну руну, она сгорела.';
mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$itm3['iid'].'" OR `id` = "'.$itm2['iid'].'" OR `id` = "'.$itm1['iid'].'"');
}elseif(!isset($itm1['id']) || !isset($itm2['id']) || !isset($itm3['id'])) {
$resz = 'Недостаточно компонентов для преобразования.';
}elseif( $itm1['level'] != $itm2['level'] || $itm1['level'] != $itm3['level'] ) {
$resz = 'Руны должны быть одного уровня.';
}elseif( $itm1['level'] == 1 ) {
//$resz = 'Унируны нельзя преобразовывать';
$itm4 = array();
$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'].'"');
$u->rep['rep1'] += 10;
mysql_query('UPDATE `rep` SET `rep1` = "'.$u->rep['rep1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
\User\ItemsModel::addItem($itm4['id'],$u->info['id']);
$resz = 'Удачно преобразованы руны &quot;'.$itm1['name'].'&quot;,&quot;'.$itm2['name'].'&quot; и &quot;'.$itm3['name'].'&quot; в &quot;'.$itm4['name'].'&quot;.';
$resz .= '<Br>Добавлена репутация Храма Знаний +10';
}else{
$itm4 = array();
$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'].'"');
$u->rep['rep1'] += 1;
mysql_query('UPDATE `rep` SET `rep1` = "'.$u->rep['rep1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
\User\ItemsModel::addItem($itm4['id'],$u->info['id']);
$resz = 'Удачно преобразованы руны &quot;'.$itm1['name'].'&quot;,&quot;'.$itm2['name'].'&quot; и &quot;'.$itm3['name'].'&quot; в &quot;'.$itm4['name'].'&quot;.';
$resz .= '<Br>Добавлена репутация Храма Знаний +1';
}
$re = '<font color=red><b>'.$resz.'</b></font>';
unset($resz);
}
}
}
?>
<style type="text/css">
.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;
}
</style>
<div id="hint3" style="visibility:hidden"></div>
<?php if(isset($_GET['r'])) { ?>
<TABLE width="100%" cellspacing="0" cellpadding="0">
<tr><td valign="top">
<div align="center" class="pH3">Храм Знаний <?php if($_GET['r']==2){ echo ', Алтарь рун'; }elseif($_GET['r']==1){ echo ', Алтарь предметов'; } ?></div>
<div align="left"><?php if($re!=''){ echo '<font color="red"><b>'.$re.'</b></font>'; } ?></div>
<td width="280" valign="top" align="right"><table align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">&nbsp;</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=3.180.0.267&rnd=<?= $code; ?>';" title="<?php thisInfRm('3.180.0.267',1); ?>">Центральная площадь</a></td>
</tr>
</table></td>
</tr> <tr>
<td nowrap="nowrap">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<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!=false){ 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 '<font color="red"><b>'.$re.'</b></font>'; } ?>
<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 language="javascript" type="text/javascript">
<!--
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.323'); ?> src="//img.new-combats.tech/city/ap_exit.gif" width="57" height="26" class="aFilter" /></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" width="120" height="220" class="aFilter" title="Диалог с Арквиерро" /></div>
<div style="position: absolute; left: 30px; top: 127px; width: 48px; height: 33px; z-index: 94;"><img <?php if($qst_hram==false){ echo 'onclick="alert(\'Арквиерро: Вы не допущены к котлам! (Выполните задание)\');"'; }else{ ?> onclick="location.href='main.php?r=1'" <?php } ?> title="Алтарь Предметов" src="//img.new-combats.tech/city/ap_altar1.gif" width="147" height="93" class="aFilter" /></div>
<div style="position: absolute; left: 333px; top: 129px; width: 48px; height: 33px; z-index: 94;"><img <?php if($qst_hram==false){ echo 'onclick="alert(\'Арквиерро: Вы не допущены к котлам! (Выполните задание)\');"'; }else{ ?> onclick="location.href='main.php?r=2'" <?php } ?> title="Алтарь Рун" src="//img.new-combats.tech/city/ap_altar2.gif" width="147" height="93" class="aFilter" /></div>
<div style="position: absolute; left: 437px; top: 96px; width: 48px; height: 33px; z-index: 94;"><img <?php thisInfRm('3.180.0.267'); ?> src="//img.new-combats.tech/city/ap_exit.gif" width="57" height="26" class="aFilter" /></div>
<div id="snow"></div>
<?= $goline; ?> </div></td>
</tr>
</table>
<div style="display:none; height:0px " id="moveto"></div>
<INPUT class="btn" onclick="window.open('/forum?read=974&rnd=1', 'help', 'height=500,width=1024,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')" value="Подсказка для новичков" style="color:red;" type="button">
</small></div></td>
<td><!-- <br /><span class="menutop"><nobr>Комната для новичков</nobr></span>--></td>
</tr>
</table>
<small>
<hr />
<br />
<strong>Внимание!</strong> Никогда и никому не говорите пароль от своего персонажа. Не вводите пароль на других сайтах, типа &quot;новый город&quot;, &quot;лотерея&quot;, &quot;там, где все дают на халяву&quot;. Пароль не нужен ни паладинам, ни кланам, ни администрации, <U>только взломщикам</U> для кражи вашего героя.<br />
<em>Администрация.</em></small> <br />
<?= $rowonmax; ?><br />
</div></td>
</tr>
</table>
<?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 align="center" bgcolor="#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>
<br /><br /><center><span id="use_item">Предмет не выбран</span><br /><br />
<input class="btn" type="button" value="Растворить" onclick="location = '?r=<?=$_GET['r'].'&rnd='.$code.'&itm=';?>'+urlras;" /></center>
<br />
<br /><small>
<font color="red">Внимание!</font><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 }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 ORDER BY `lastUPD` DESC');
if($itmAll[0]==0){
$itmAllSee = '<tr><td align="center" bgcolor="#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>
<font color="red">Внимание!</font><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 } } ?>

View File

@ -1,48 +1,47 @@
<?php
if(!defined('GAME'))
{
if (!defined('GAME')) {
die();
}
if($u->room['file']=='hram')
{
if(isset($_GET['itm']))
{
$_GET['itm'] = (int)$_GET['r'];
if($_GET['itm']>0)
{
if($_GET['r']!=1)
{
//Переплавка вещей
$resz = $u->plavka($_GET['itm'],1);
echo '<font color=red><b>'.$resz.'</b></font>';
unset($resz);
}else{
//Переплавка рун
if ($u->room['file'] != 'hram') {
return;
}
$smeltItemId = (int)$_GET['itm'] ?? 0;
$re = null;
if ($smeltItemId > 0) {
$re = (new \Location\KnowledgeTemple())->smeltItem($smeltItemId);
}
}
}
?>
<style type="text/css">
<style>
.pH3 {
COLOR: #8f0000;
FONT-FAMILY: Arial;
FONT-SIZE: 12pt;
FONT-WEIGHT: bold;
}
.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;
@ -50,11 +49,13 @@ if($u->room['file']=='hram')
background-color: #659BA3;
font-size: 10px;
}
.class_old {
font-weight: bold;
color: #919191;
cursor: pointer;
}
.class__old {
font-weight: bold;
color: #FFFFFF;
@ -64,44 +65,73 @@ if($u->room['file']=='hram')
}
</style>
<div align="right"><?php if($re!=''){ echo '<font color="red"><b>'.$re.'</b></font>'; } ?></div>
<div align="right"><?= $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">Храм Знаний <?php if($_GET['r']==1){ echo ', Алтарь рун'; }else{ echo ', Алтарь предметов'; } ?></div>
<td width="280" valign="top"><table align="right" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<div align="center" class="pH3">Храм Знаний <?php if ($_GET['r'] == 1) {
echo ', Алтарь рун';
} else {
echo ', Алтарь предметов';
} ?></div>
<td width="280" valign="top">
<table align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">&nbsp;</td>
<td><table border="0" cellpadding="0" cellspacing="0">
<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">
<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=3.180.0.267&rnd=<?= $code; ?>';" title="<?php thisInfRm('3.180.0.267',1); ?>">Центральная площадь</a></td>
<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=3.180.0.267&rnd=<?= $code; ?>';"
title="<?php thisInfRm(
'3.180.0.267',
1
); ?>">Центральная
площадь</a></td>
</tr>
</table></td>
</tr> <tr>
</table>
</td>
</tr>
<tr>
<td nowrap="nowrap">&nbsp;</td>
</tr>
</table></td>
</table>
</td>
</tr>
</table></td>
</table>
</td>
</tr>
</table>
<br/><br/>
<input type="button" value="Алтарь предметов" onclick="location = '?r=0';" /> &nbsp; <input type="button" value="Алтарь рун" onclick="location = '?r=1';" />
<input type="button" value="Алтарь предметов" onclick="location = '?r=0';"/> &nbsp; <input type="button"
value="Алтарь рун"
onclick="location = '?r=1';"/>
</td>
</table>
<div id="textgo" style="visibility:hidden;"></div>
<?php if ($_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" ORDER BY `lastUPD` DESC');
if($itmAll[0]==0)
{
$itmAll = '';
$itmAllSee = '';
$itmAll = $u->genInv(
11,
'`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC'
);
if ($itmAll[0] == 0) {
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ПУСТО (нет подходящих предметов)</td></tr>';
} else {
$itmAllSee = $itmAll[2];
@ -109,10 +139,8 @@ if($u->room['file']=='hram')
//Удачно растворен предмет "Укрепленный Костыль". Получена руна "Моно Бауни".
?>
<script>
function takeItRun(img,id,vl)
{
if(id!=urlras)
{
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>';
document.getElementById('add_rep').innerHTML = ' + ' + vl;
@ -120,20 +148,24 @@ if($u->room['file']=='hram')
cancelItRun();
}
}
function 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="10">
<tr>
<td width="300" valign="top">
<b>Репутация: <?= 0 + $u->info['rep1']; ?></b><span id="add_rep"></span>
<br /><br /><center><span id="use_item">Предмет не выбран</span><br /><br />
<input type="button" value="Растворить" onclick="location = '?r=<?=$_GET['r'].'&rnd='.$code.'&itm=';?>'+urlras;" /></center>
<br/><br/>
<center><span id="use_item">Предмет не выбран</span><br/><br/>
<input type="button" value="Растворить"
onclick="location = '?r=<?= $_GET['r'] . '&rnd=' . $code . '&itm='; ?>'+urlras;"/>
</center>
<br/>
<br/><small>
<font color="red">Внимание!</font><br/>
@ -142,7 +174,11 @@ if($u->room['file']=='hram')
<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>'; } ?>
<?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>
@ -150,4 +186,4 @@ if($u->room['file']=='hram')
</table>
<?php } else { ?>
&nbsp; По всей видимости Алтарь рун был разрушен... <b>Лорд разрушитель</b> не дремлет...
<?php } } ?>
<?php } ?>