WIP: new battle

This commit is contained in:
Ivor Barhansky 2024-12-10 13:09:03 +02:00
parent 73862ca752
commit d41147da45
18 changed files with 1010 additions and 1111 deletions

View File

@ -0,0 +1,62 @@
<?php
namespace Battle;
use Core\Config;
use Helper\Conversion;
use User;
class BattleHTML
{
/**
* Генерирует HTML, который будет вставляться в javascript в файлах refresh{X}.php
*
* @return string
*/
public static function printMagicScrolls(): string
{
$sv = array_fill(1, 12, '<img class="nopriemuse" title="Пустой слот магия" src="' . Config::img() . '/i/items/w/w101.gif" alt="">');
foreach (User::start()->stats['items'] as $stat) {
if (!in_array($stat['inslot'], [40, 51])) {
continue;
}
if (empty($stat['useInBattle']) || $stat['btl_zd'] > 0 || $stat['iznosNOW'] >= $stat['iznosMAX'] || empty($stat['magic_inci'])) {
$vl = 'class="nopriemuse"';
} else {
$po = Conversion::dataStringToArray($stat['data']);
if ($po['useOnLogin'] == 1) {
$jsvars = "'{$stat['name']}','{$stat['id']}','{$stat['img']}',1,1,'','{$stat['useInBattle']}'";
} else {
$jsvars = "'{$stat['name']}','{$stat['id']}','{$stat['img']}',1,2";
}
$vl = 'style="cursor:pointer" onclick="top.useMagicBattle(' . $jsvars . ')"';
}
$iznos = "Долговечность: {$stat['iznosNOW']} / {$stat['iznosMAX']}";
$img = Config::img() . '/i/items/' . $stat['img'];
$sv[$stat['inOdet'] - 39] = '<img ' . $vl . ' title="' . $iznos . '" src="' . $img . '" alt="">';
}
return <<<HTML
<table style="border: 0; border-collapse: collapse; border-spacing: 0;">
<tr>
<td>$sv[1]</td>
<td>$sv[2]</td>
<td>$sv[3]</td>
<td>$sv[4]</td>
<td>$sv[5]</td>
<td>$sv[6]</td>
<td>$sv[7]</td>
<td>$sv[8]</td>
<td>$sv[9]</td>
<td>$sv[10]</td>
<td>$sv[11]</td>
<td>$sv[12]</td>
</tr>
</table>
HTML;
//Если сломается, применить str_replace('"', '\"', $r);
}
}

View File

@ -32,8 +32,11 @@ class Fighter
private int $firedefence;
private int $earthdefence;
private int $armor;
public function __construct(private readonly int $id, private readonly int $team) {
$u = User::start($id);
private int $team;
public function __construct(private readonly int $id)
{
$u = User::start($id, true);
$this->obraz = $u->info['sex'] . DIRECTORY_SEPARATOR . $u->info['obraz'];
$this->login = $u->info['login'];
$this->level = $u->info['level'];
@ -41,8 +44,8 @@ class Fighter
$this->mana = $u->stats['mpNow'];
$this->maxlife = $u->stats['hpAll'];
$this->maxmana = $u->stats['mpAll'];
$this->damage = 100500;
$this->armor = 35;
$this->damage = mt_rand(0, 100);
$this->armor = mt_rand(0, 5);
$this->damageMultiplier = $u->stats['m10'];
$this->critChance = $u->stats['m1'];
$this->critMultiplier = $u->stats['m3'];
@ -58,37 +61,49 @@ class Fighter
$this->waterdefence = $u->stats['zm3'];
$this->firedefence = $u->stats['zm1'];
$this->earthdefence = $u->stats['zm4'];
$this->team = $u->info['team'];
unset($u);
}
public function get(): object
{
return (object)[
'damage' => $this->damage,
'armor' => $this->armor + $this->defence,
'health' => $this->life,
'name' => $this->login,
'crit' => $this->critChance,
'evade' => $this->evadeChance,
];
}
public function __toString(): string
{
$dmg = Math::addPercent($this->damage, $this->damageMultiplier);
return <<<RETURN
$this->login [$this->level] id:$this->id <br>
Здоровье: $this->life / $this->maxlife <br>
Мана: $this->mana / $this->maxmana <br>
<img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
Броня: $this->armor <br>
Крит: $this->critChance% <br>
Антикрит $this->anticritChance% <br>
Мощность крита $this->critMultiplier% <br>
Уровот $this->evadeChance% <br>
Антиуворот $this->antievadeChance% <br>
Контрудар $this->counterstrikeChance% <br>
Парирование $this->parryChance% <br>
Блок щитом $this->shieldblockChance% <br>
Игнор брони $this->ignoreArmorChance% <br>
Защита от урона $this->defence <br>
Зашита от огня $this->firedefence <br>
Защита от воды $this->waterdefence <br>
Защита от воздуха $this->airdefence <br>
Защита от земли $this->earthdefence <br><br>
Сражается за команду: $this->team
RETURN;
$this->login [$this->level] <a href="/info/$this->id" target="_blank">id:$this->id</a> <br>
Здоровье: $this->life / $this->maxlife <br>
Мана: $this->mana / $this->maxmana <br><hr>
<!-- <img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>-->
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
Броня: $this->armor <br><hr>
Крит: $this->critChance% <br>
Антикрит $this->anticritChance% <br>
Мощность крита $this->critMultiplier% <br>
Уровот $this->evadeChance% <br>
Антиуворот $this->antievadeChance% <br>
Контрудар $this->counterstrikeChance% <br>
<!-- Парирование $this->parryChance% <br>-->
<!-- Блок щитом $this->shieldblockChance% <br>-->
<!-- Игнор брони $this->ignoreArmorChance% <br>-->
Защита от урона $this->defence <br>
Зашита от огня $this->firedefence <br>
Защита от воды $this->waterdefence <br>
Защита от воздуха $this->airdefence <br>
Защита от земли $this->earthdefence <br><hr>
Сражается за команду: $this->team
RETURN;
}
}

View File

@ -10,29 +10,103 @@ use User\ItemsModel;
class ItemStorage
{
private string $error = '';
public function put(int $itemId, int $clanId): string
private string $error = '';
private int $clanId;
private int $userId;
private string $userLogin;
public function __construct()
{
$user = User::start()->info;
$item = ItemsModel::getOwnedItemById($itemId, $user['id']);
$clanName = Db::getValue('select name from clan where id = ?', [$clanId]) ?? '';
$userinfo = User::start()->info;
$this->userId = $userinfo['id'];
$this->clanId = $userinfo['clan'];
$this->userLogin = $userinfo['login'];
}
public function take(int $itemId): string
{
$item = Db::getRows('select items_users.id, name, data from items_users inner join items_main on item_id = items_main.id where uid = ? and items_users.id = ?', ["-21$this->clanId", $itemId]);
if (!isset($item['id'])) {
return 'Предмет не найден.<br>' . $itemId;
}
$data = Conversion::dataStringToArray($item['data']);
$cls = isset($data['toclan']) ? explode('#', $data['toclan'])[1] : 0;
$col = ItemsModel::itemsX($itemId);
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ? where id = ?', [$this->userId, $itemId]);
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,5,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$item['name']} (x$col) Id:$itemId Хозяин: $cls", $this->userId]);
return "Вы успешно взяли предмет «{$item['name']}» из хранилища.";
}
public function remove(int $type): void
{
$storedItems = Db::getRows('select items_users.id, uid, name, data, inOdet from items_users inner join items_main on item_id = items_main.id where uid = ? or data like ?', ["-21$this->clanId", "%toclan=$this->clanId#%"]);
foreach ($storedItems as $storedItem) {
$data = Conversion::dataStringToArray($storedItem['data']);
$cls = isset($data['toclan']) ? explode('#', $data['toclan'])[1] : 0;
$col = ItemsModel::itemsX($storedItem['id']);
if ($cls == $this->userId) {
if ($storedItem['uid'] != $this->userId && $storedItem['inOdet'] != 0) {
Db::sql('update items_users set inOdet = 0 where id = ?', [$storedItem['id']]);
}
unset($data['toclan']);
$storedItem['data'] = Conversion::arrayToDataString($data);
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ?, data = ? where id = ?', [$this->userId, $storedItem['data'], $storedItem['id']]);
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,?,?,unix_timestamp(),?,?)', [$this->clanId, $type, $this->userLogin, "{$storedItem['name']} (x$col) Id:{$storedItem['id']}", $this->userId]);
} elseif ($storedItem['uid'] == $this->userId) {
Db::sql('update items_users set lastUPD = unix_timestamp(), uid = ? where id = ?', ["-21$this->clanId", $storedItem['id']]);
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,9,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$storedItem['name']} (x$col) Id:{$storedItem['id']}", $this->userId]);
}
}
}
public function backToOwner(int $itemId): string
{
$item = ItemsModel::getOwnedItemById($itemId, $this->userId, true);
if (empty($item)) {
return 'Предмет не найден.';
}
$ownerIsNotReal = !Db::getValue('select count(id) from stats where id = ? and (bot = 0 or clone = 0)', [$item['uid']]);
if ($ownerIsNotReal) {
return 'Вы не можете изьять данный предмет, он не принадлежит клану.';
}
$iw = $item['inOdet'] > 0 ? 'inOdet = 0' : '';
$col = ItemsModel::itemsX($itemId);
Db::sql('insert into clan_operations (clan, type, text, time, val, uid) values (?,6,?,unix_timestamp(),?,?)', [$this->clanId, $this->userLogin, "{$item['name']} (x$col) Id:$itemId У персонажа: {$item['uid']}", $this->userId]);
Db::sql("update items_users set lastUPD = unix_timestamp(), $iw, uid = ? where id = ?", ["-21$this->clanId", $itemId]);
return "Вы успешно изъяли предмет «{$item['name']}»";
}
public function put(int $itemId): string
{
$item = ItemsModel::getOwnedItemById($itemId, $this->userId);
$clanName = Db::getValue('select name from clan where id = ?', [$this->clanId]) ?? '';
if (empty($clanName)) {
return 'Клан не найден.';
}
if (!$this->isGoodForStorage($item, $user['clan'])) {
if (!$this->isGoodForStorage($item)) {
return $this->error;
}
$col = User::start()->itemsX(($itemId));
$col = ItemsModel::itemsX($itemId);
$idata = Conversion::dataStringToArray($item['data']);
if (!isset($idata['toclan'])) {
$idata['toclan'] = $user['clan'] . '#' . $user['id'];
$idata['toclan'] = $this->clanId . '#' . $this->userId;
$item['data'] = Conversion::arrayToDataString($idata);
Delo::add(
2,
'System.transfer.clan',
$user['id'],
'&quot;System.transfer.MONEY&quot;: Предмет &quot;' . $item['name'] . '&quot; (#id : "' . $itemId . '") (x' . $col . ') был пожертвован клану &quot;' . $clanName . '&quot; (' . $clanId . ').',
$this->userId,
'&quot;System.transfer.MONEY&quot;: Предмет &quot;' . $item['name'] . '&quot; (#id : "' . $itemId . '") (x' . $col . ') был пожертвован клану &quot;' . $clanName . '&quot; (' . $this->clanId . ').',
);
$sendType = 4;
} else {
@ -40,17 +114,17 @@ class ItemStorage
}
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']]
[$this->clanId, $sendType, $this->userLogin, $item['name'] . ("x$col Ид: [$itemId]"), $this->userId]
);
Db::sql(
'update items_users set lastUPD = unix_timestamp(), uid = ?, data = ? where id = ?',
['-21' . $user['clan'], $item['data'], $itemId]
['-21' . $this->clanId, $item['data'], $itemId]
);
return 'Вы передали предмет &quot;' . $item['name'] . '&quot; клану.';
}
private function isGoodForStorage(array $item, $userClanId): bool
private function isGoodForStorage(array $item): bool
{
if (empty($item['inslot']) || !empty($item['gift'])) {
$this->error = 'Предмет не найден.';
@ -64,118 +138,9 @@ class ItemStorage
) {
$this->error = 'Предмет не подходит.';
}
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $userClanId) {
if (!empty($idata['toclan']) && explode('#', $idata['toclan'])[0] == $this->clanId) {
$this->error = 'Предмет уже принадлежит клану.';
}
return empty($this->error);
}
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 = Conversion::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 = Conversion::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'] = Conversion::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

@ -2,10 +2,35 @@
use Core\Db;
use Helper\Conversion;
use Model\Constant\Stat;
use User\ItemsModel;
class ComissionShop
{
public function commisionShop($preview = 'full')
private array $info;
private array $stats;
private array $is;
private array $rep;
/**
* @var array|string[]
*/
private array $align_nm;
private array $items;
public function __construct()
{
$this->info = User::start()->info;
$this->rep = User::start()->rep;
$this->stats = User::start()->stats;
$this->is = User::start()->is;
$this->align_nm = User::start()->align_nm;
$itemStatNames = new Stat();
$itemStatNames->getBonus();
$itemStatNames->getRequirement();
$this->items['tr'] = $itemStatNames->sysRequirementNames;
}
public function commisionShop($preview = 'full'): void
{
global $code;
$typeOtdel = match ((int)$_GET['otdel']) {
@ -43,8 +68,8 @@ UNION ALL SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1pric
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string(
$typeOtdel
) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0
ORDER BY `1price`ASC , inGroupCount DESC'
) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0
ORDER BY `1price`, inGroupCount DESC'
);
} else {
$cl = mysql_query(
@ -56,7 +81,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
} else {
if ($preview == "full") {
$cl = mysql_query(
'SELECT
'SELECT
`items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
@ -67,11 +92,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'
`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
`items_main`.`lvl_aexp` , count(`items_users`.`id`) as inGroupCount
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0
UNION ALL
UNION ALL
SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
@ -82,15 +107,15 @@ SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item
`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30"
GROUP BY `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup = 0
ORDER BY `1price`ASC , inGroupCount DESC'
ORDER BY `1price`, inGroupCount DESC'
);
} else {
$cl = mysql_query(
'SELECT `items_users`.`id`, `items_users`.`id` AS `idu`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp` FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" GROUP BY `items_users`.`item_id` ORDER BY `items_main`.`id` DESC'
'select items_users.id, items_users.id as idu,items_users.item_id,items_users.`1price`,items_users.`2price`,items_users.uid,items_users.use_text,items_users.data,items_users.inOdet,items_users.inShop,items_users.`delete`,items_users.iznosNOW,items_users.iznosMAX,items_users.gift,items_users.gtxt1,items_users.gtxt2,items_users.kolvo,items_users.geniration,items_users.magic_inc,items_users.maidin,items_users.lastUPD,items_users.timeOver,items_users.overType,items_users.secret_id,items_users.time_create,items_users.inGroup,items_users.dn_delete,items_users.inTransfer,items_users.post_delivery,items_users.lbtl_,items_users.bexp,items_users.so,items_users.blvl,items_main.id,items_main.name,items_main.img,items_main.type,items_main.inslot,items_main.`2h`,items_main.`2too`,items_main.iznosMAXi,items_main.inRazdel,items_main.price1,items_main.price2,items_main.magic_chance,items_main.info,items_main.massa,items_main.level,items_main.magic_inci,items_main.overTypei,items_main.`group`,items_main.group_max,items_main.geni,items_main.ts,items_main.srok,items_main.class,items_main.class_point,items_main.anti_class,items_main.anti_class_point,items_main.max_text,items_main.useInBattle,items_main.lbtl,items_main.lvl_itm,items_main.lvl_exp,items_main.lvl_aexp from items_users left join items_main on (items_main.id = items_users.item_id) where (( items_users.time_create + items_main.srok) > unix_timestamp() or items_main.srok = "0") and items_users.`delete`="0" and items_users.inOdet="0" and items_users.inShop="30" and items_main.type != "18" and items_main.type != "19" and items_main.type != "20" and items_main.type != "21" and items_main.type != "22" and items_main.type != "15" and items_main.type != "12" and items_main.type != "4" and items_main.type != "5" and items_main.type != "6" and items_main.type != "1" and items_main.type != "3" and items_main.type != "8" and items_main.type != "14" and items_main.type != "13" and items_main.type != "9" and items_main.type != "10" and items_main.type != "11" and items_main.type != "29" and items_main.type != "30" group by items_users.item_id order by items_main.id desc'
);
}
}
@ -121,11 +146,9 @@ ORDER BY `1price`ASC , inGroupCount DESC'
} else {
$po = Helper\Conversion::dataStringToArray($pl['data']);
}
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
if ((($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) && $pl['inOdet'] != 14) {
//Зоны блока +
if ($pl['inOdet'] != 14) {
$po['zonb']++;
}
$po['zonb']++;
}
$is2 = '';
$is1 = '<img src="//img.new-combats.tech/i/items/' . $pl['img'] . '"><br>';
@ -136,7 +159,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
}
//название
$col = $this->itemsX($pl[0]);
$col = ItemsModel::itemsX($pl[0]);
if ($col > 1 && $pl['inGroup'] != 0 && $pl['inGroupCount'] > 1) {
$pl['kolvo'] = $col;
$pl['name'] .= ' (x' . $col . ')';
@ -145,7 +168,6 @@ ORDER BY `1price`ASC , inGroupCount DESC'
if ($pl['massa'] > 0 && $preview == "full") {
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
if ($pl['gift'] != '') {
$ttl = '';
if ($pl['gift'] == 1) {
$ttl = 'Вы не можете передать этот предмет кому-либо';
} else {
@ -154,16 +176,14 @@ ORDER BY `1price`ASC , inGroupCount DESC'
$is2 .= ' <img title="' . $ttl . '" src="//img.new-combats.tech/i/podarok.gif">';
}
if (isset($po['art'])) {
$is2 .= ' <img title="Артефакт" src="//img.new-combats.tech/i/artefact.gif">';
$is2 .= ' <img alt="Артефакт" title="Артефакт" src="//img.new-combats.tech/i/artefact.gif">';
}
if (isset($po['sudba'])) {
if ($po['sudba'] == '0') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">';
} elseif ($po['sudba'] == '1') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">';
} else {
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/desteny.gif">';
}
$is2 .= match ($po['sudba']) {
'0' => ' <img alt="" title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">',
'1' => ' <img alt="" title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/destiny0.gif">',
default => ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="//img.new-combats.tech/i/desteny.gif">',
};
}
}
//цена
@ -178,41 +198,38 @@ ORDER BY `1price`ASC , inGroupCount DESC'
}
//долговечность
if ($pl['iznosMAX'] > 0) {
$izcol = '';
if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
$izcol = 'brown';
}
}
$is2 .= '<br>Долговечность: ';
if ($preview == "preview") {
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor($steck[1]) . '/' . ceil(
$steck[2]
) . '</font>';
$durability = floor($steck[1]) . '/' . ceil($steck[2]);
} else {
if ($pl['iznosMAXi'] == 999999999) {
$is2 .= '<br>Долговечность: <font color="brown">неразрушимо</font>';
$durability = 'неразрушимо';
} else {
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor(
$pl['iznosNOW']
) . '/' . ceil($pl['iznosMAX']) . '</font>';
$durability = floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
}
}
if ($pl['iznosMAX'] > 0 && floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
$durability = "<span style='color: brown;'>$durability</span>";
}
$is2 .= $durability;
//Срок годности предмета
if ($po['srok'] > 0) {
$pl['srok'] = $po['srok'];
$is2 .= '<br>Срок годности: ';
}
if ($pl['srok'] > 0 and $preview != "preview") {
if ($pl['srok'] > 0 && $preview != "preview") {
if ($pl['time_create'] + $pl['srok'] < time()) {
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']) . ' (испорчен)';
$is2 .= $this->timeOut($pl['srok']) . ' (испорчен)';
} else {
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date(
'd.m.Y H:i', $pl['time_create'] + $pl['srok']
) . ')';
$is2 .= $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')';
}
} elseif ($pl['srok'] > 0) {
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']);
$is2 .= $this->timeOut($pl['srok']);
}
if ($pl['magic_chance'] > 0) {
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
}
@ -269,10 +286,8 @@ ORDER BY `1price`ASC , inGroupCount DESC'
} else {
$tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
}
if ($po['tr_' . $n] > $this->stats[$n]) {
if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
$tr .= '</font>';
}
if ($po['tr_' . $n] > $this->stats[$n] && ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n])) {
$tr .= '</font>';
}
}
$x++;
@ -292,7 +307,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
if ($po['add_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . $po['add_' . $n];
}
$x++;
}
@ -306,7 +321,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
if ($po['add_mab' . $i] < 0) {
$z = '';
}
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . $po['add_mab' . $i];
} else {
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx(
[$po['add_mib' . $i], $po['add_mab' . $i]]
@ -332,7 +347,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
if ($po['sv_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
}
$x++;
}
@ -390,7 +405,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
}
if (isset($po['free_stats']) && $po['free_stats'] > 0) {
$is2 .= '<br><strong>Распределение статов:</strong>';
$is2 .= '&bull; Возможных распределений: ' . $po['free_stats'] . '';
$is2 .= '&bull; Возможных распределений: ' . $po['free_stats'];
}
if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
$d[0] = 0;
@ -403,7 +418,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
//не отображается
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
$spc = mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` LIMIT 20'
);
while ($plc = mysql_fetch_array($spc)) {
$com1['name'] = $plc['name'];
@ -512,13 +527,11 @@ ORDER BY `1price`ASC , inGroupCount DESC'
if ($pl['dn_delete'] > 0) {
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
}
if (isset($po['zazuby']) && $po['zazuby'] > 0) {
$is2 .= '<div style="color:brown;">Предмет куплен за зубы</div>';
}
$is2 .= '</small>';
}
if ($preview == "preview") {
$kolvoprint = "<small style=\"float:right; color:grey;\" align=\"right\">Количество: <strong>$steck[0]</strong> шт.</small>";
$kolvoprint = "<small style=\"float:right; color:grey; text-align=right\">Количество: <strong>$steck[0]</strong> шт.</small>";
}
echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top">' . $kolvoprint . $is2 . '</td></tr>';
$i++;
@ -529,6 +542,28 @@ ORDER BY `1price`ASC , inGroupCount DESC'
}
}
private function timeOut(int|string $seconds): string
{
return Conversion::secondsToTimeout($seconds);
}
private function bronFx($br): string
{
$r = '';
if ($br[0] > 0) {
$r .= $br[0] - 1;
} else {
$r .= 0;
}
$r .= 'd';
if ($br[0] > 0) {
$r .= $br[1] - $br[0];
} else {
$r .= 0;
}
return $r;
}
public function buyItem(int $iid, User $u): string
{
$irow = Db::getRow('select items_users.id, uid, 1price, inGroup, inShop, data, item_id, login, items_main.name, price1
@ -547,7 +582,7 @@ ORDER BY `1price`ASC , inGroupCount DESC'
$u->addKr(-$price);
$u->addKr($price, $irow['uid']);
$col = $u->itemsX($iid);
$col = ItemsModel::itemsX($iid);
if ($col > 1) {
Db::sql('update items_users set uid = ?, inGroup = inGroup + 1000, 1price = ?, lastUPD = unix_timestamp(), inShop = 0
where inShop = 30 and inOdet = 0 and item_id = ? and uid = ? and inGroup = ? limit ?',
@ -568,56 +603,45 @@ ORDER BY `1price`ASC , inGroupCount DESC'
return '<div>' . $r . '</div>';
}
public function rent($action, int $iid, int $price, User $u)
public function rent($action, int $iid, int $price): void
{
if ($action == "Сдать в магазин" && $price > 0) {
$ChImtem = mysql_fetch_array(
mysql_query(
'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1'
)
);
$ChSudba = Conversion::dataStringToArray($ChImtem['data']);
if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) {
if (isset($ChImtem['inGroup']) && $ChImtem['inGroup'] > 0) {
$col = $u->itemsX($ChImtem['id']);
if ($col > 1) {
mysql_query(
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . ''
);
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query(
'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
}
$this->rentPut($iid, $price);
} elseif ($action == "Забрать") {
$i = mysql_fetch_array(
mysql_query(
'SELECT `im`.`price1`,
`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1'
)
);
if (isset($i['inGroup']) and $i['inGroup'] > 0) {
$col = $u->itemsX($i['id']);
if ($col > 1) {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . ''
);
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
);
}
$this->rentTake($iid);
}
}
}
private function rentPut(int $id, int $price): void
{
$item = Db::getRow('select id, item_id, data, ingroup, uid from items_users where id = ?', [$id]);
$data = Conversion::dataStringToArray($item['data']);
$col = ItemsModel::itemsX($item['id']);
if (isset($data['sudba']) || $data['sudba'] != 0 || isset($data['toclan'])) {
return;
}
if (!isset($item['ingroup']) || $item['ingroup'] <= 0 || $col < 2) {
Db::sql('update items_users set inShop = 30, 1price = ? where id = ? and uid = ? and inOdet = 0', [$price, $id, $item['uid']]);
return;
}
Db::sql('update items_users set inShop = 30, 1price = ? where item_id = ? and uid = ? and inGroup = ? limit ?', [$price, $item['id'], $item['uid'], $item['ingroup'], (int)$col]);
}
private function rentTake(int $id): void
{
$item = Db::getRow('select items_users.*, price1, inGroup from items_users inner join items_main on items_main.id = item_id where items_users.id = ? and inShop = 30 limit 1', [$id]);
if (!isset($item['inGroup']) || $item['inGroup'] <= 0) {
Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30', [$item['price1'], $id]);
return;
}
$col = ItemsModel::itemsX($item['id']);
if ($col > 1) {
Db::sql('update items_users set inShop = 0, 1price = ? where item_id = ? and uid = ? and inGroup = ? and inShop = 30 limit ?',
[$item['price1'], $item['item_id'], $item['uid'], $item['ingroup'], (int)$col]);
} else {
Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and uid = ? and inOdet = 0', [$item['price1'], $id, $item['uid']]);
}
}
}

View File

@ -40,7 +40,7 @@ class Magic
if (isset($itm['id'])) {
//Группа предметов
if ($itm['group'] == 1 && $u->itemsX($itm['id']) > 1) {
if ($itm['group'] == 1 && ItemsModel::itemsX($itm['id']) > 1) {
//вытаскиваем предмет из группы
$u->unstack($itm['id'], 1);
}

View File

@ -27,7 +27,7 @@ class ActionModel
[
$user['id'],
$time,
$user['city'],
'',
$user['room'],
$vars,
UserIp::get(),
@ -84,11 +84,6 @@ class ActionModel
return (int)Db::getValue($sql, $binds);
}
public function getByVals(string $vals)
{
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public function getLastByVals(string $vals)
{
return Db::getRow(
@ -115,16 +110,6 @@ class ActionModel
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public function getDailyQuest(): array
{
$filter = [
"uid = $this->uid",
"vars = 'day_quest'",
];
return self::get($filter);
}
public function getFinishedDailyQuestTasks(int $timeout): array
{
$arr = [];

File diff suppressed because it is too large Load Diff

View File

@ -81,12 +81,14 @@ class ItemsModel
/** Выбор предмета в инвентаре.
* @param int $itemId
* @param int $ownerId
* @param bool $includeWeared
* @return array
*/
public static function getOwnedItemById(int $itemId, int $ownerId): array
public static function getOwnedItemById(int $itemId, int $ownerId, bool $includeWeared = false): 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 and is_arrested = 0', [$ownerId, $itemId]);
$iw = $includeWeared ? 1 : 0;
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 = $iw and inShop = 0 and is_arrested = 0", [$ownerId, $itemId]);
}
public static function delete(int $id): void
@ -216,4 +218,22 @@ class ItemsModel
{
Db::sql('update items_users set iznosNOW = iznosNOW + 1 where id = ?', [$itemId]);
}
public static function itemsX(int $id, $uid = null, $item_id = null): bool|int
{
//fixme какая-то дичь тут.
$item = Db::getRow('select uid, item_id, ingroup, inshop from items_users where id = ?', [$id]);
if ($uid) {
$item['uid'] = $uid;
}
if ($item_id) {
$item['item_id'] = $item_id;
}
return Db::getValue(
'select count(id) from items_users where inshop = ? and item_id = ? and uid = ? and ingroup = ?',
[$item['inShop'], $item['item_id'], $item['uid'], $item['ingroup']]
);
}
}

View File

@ -1,6 +1,7 @@
<?php
use Core\Db;
use User\ItemsModel;
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
@ -34,7 +35,7 @@ where inShop = 30 and `delete` = 0';
foreach (Db::getRows($q) as $row) {
if ($row['inGroup']) {
$col = $u->itemsX($row['id']);
$col = ItemsModel::itemsX($row['id']);
if ($col > 1) {
$stmt = Db::prepare(
'update items_users set inShop = 0, 1price = ?

View File

@ -1,5 +1,6 @@
<?php
use Battle\BattleHTML;
use Core\Config;
use Core\Db;
@ -217,7 +218,7 @@ if (!$isBattle) {
$nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']);
$expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']);
$tmr = round(($btl->i->timeout / 60), 2);
$persMagic = $u->btlMagicList();
$persMagic = BattleHTML::printMagicScrolls();
$za = (int)$btl->stats[$btl->uids[$u->info['id']]]['zona'];
$zb = (int)$btl->testZonbVis();
$tactic1 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic1'];

View File

@ -1,5 +1,7 @@
<?php
use Battle\BattleHTML;
function e($t)
{
(new Chat())->debug($t, true);
@ -215,7 +217,7 @@ if (!$isBattle) {
{
document.getElementById("timer_out").innerHTML = "' . round(($btl->i->timeout / 60), 2) . '";
}
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
$(\'#pers_magic\').html("' . BattleHTML::printMagicScrolls() . '");
g_iCount = 30;
noconnect = 15;
connect = 1;

View File

@ -1,5 +1,7 @@
<?php
use Battle\BattleHTML;
function e($t)
{
(new Chat())->debug($t, true);
@ -47,8 +49,7 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i
if (!isset($CRON_CORE)) {
if ($u->info['online'] < time() - 30) {
mysql_query(
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time(
) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
);
}
}
@ -59,8 +60,7 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i
if ($u->info['battle'] == -1) {
//завершаем поединок
$upd = mysql_query(
'UPDATE `users` SET `battle` = "0",`online` = "' . time(
) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
'UPDATE `users` SET `battle` = "0",`online` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
if (!$upd) {
if (!isset($CRON_CORE)) {
@ -218,7 +218,7 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i
{
document.getElementById("timer_out").innerHTML = "' . round(($btl->i->timeout / 60), 2) . '";
}
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
$(\'#pers_magic\').html("' . BattleHTML::printMagicScrolls() . '");
g_iCount = 30;
noconnect = 15;
connect = 1;
@ -233,14 +233,14 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i
za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
refleshPoints();
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ')
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ')
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ')
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ')
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ')
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ')
smnpty=' . (0 + $u->info['smena']) . ';
mainstatus(' . $btl->mainStatus . ');
mainstatus(' . $btl->mainStatus . ')
tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
smena_alls = "0";
ggcode="' . $code . '";

View File

@ -444,7 +444,7 @@ if (isset($btl_last['id']) && $u->info['battle'] == 0) {
} elseif (isset($_GET['oid']) && isset($_GET['inv'])) {
$act = $u->odetItem($_GET['oid'], $u->info['id']);
} elseif (isset($_GET['item_rune']) && isset($_GET['inv'])) {
$u->runeItem(null);
$u->runeItem();
} elseif (isset($_GET['remitem'], $_GET['inv'])) {
$act = $u->snatItemAll($u->info['id']);
} elseif (isset($_GET['delete']) && isset($_GET['inv']) && $u->newAct($_GET['sd4'])) {

View File

@ -35,8 +35,6 @@ if (
$_GET['events'] = 1;
}
$storage = new ItemStorage();
//Возможности текущего титула
$tt = [
0 => ['000000000', 'Доступные каналы'],
@ -67,10 +65,10 @@ if ($u->info['clan_prava'] != 'glava') {
mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "' . $u->info['clan_prava'] . '" LIMIT 1')
);
if (!isset($utitl['id'])) {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 2 LIMIT 1'));
$utitl = mysql_fetch_array(mysql_query('select * from clan_tituls where id = 2 limit 1'));
}
} else {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 1 LIMIT 1'));
$utitl = mysql_fetch_array(mysql_query('select * from clan_tituls where id = 1 limit 1'));
}
if (isset($utitl['id'])) {
@ -379,18 +377,18 @@ $lvl_prava = [
<script>
function openMod(title, dat) {
var d = document.getElementById('useMagic');
if (d != undefined) {
document.getElementById('modtitle').innerHTML =
'<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
'<tr>' +
'<td valign="top">' + title + '</td>' +
'<td width="30" valign="top">' +
'<div align="right">' +
'<a title="Закрыть" onClick="closeMod(); return false;" href="#">x</a>' +
'</div>' +
'</td>' +
'</tr>' +
'</table>';
if (d) {
document.getElementById('modtitle').innerHTML = `
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">${title}</td>
<td width="30" valign="top">
<div align="right">
<a title="Закрыть" onClick="closeMod(); return false;" href="#">x</a>
</div>
</td>
</tr>
</table>`;
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
}
@ -398,7 +396,7 @@ $lvl_prava = [
function closeMod() {
var d = document.getElementById('useMagic');
if (d != undefined) {
if (d) {
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
@ -406,61 +404,25 @@ $lvl_prava = [
}
function addNewEvent() {
openMod('Добавить событие',
'<form method="post" action="main.php?clan&events&add=<?=$code?>">" +
"Заголовок: <input name="
titleadd
" value="
" style="
335
px;
" type="
text
"><br>" +
"<textarea name="
textadd
" style="
412
px;
" rows="
5
"></textarea><br>" +
"<div align="
right
"><input type="
submit
" value="
Добавить
событие
"></div>" +
"</form>');
const html = `
<form method="post" action="main.php?clan&events&add=<?=$code?>">
Заголовок: <input name="titleadd" style="335px;" type="text"><br>
<textarea name="textadd" style="412px;" rows="5"></textarea><br>
<div align="right"><input type="submit" value="Добавить событие"></div>
</form>
`;
openMod('Добавить событие', html);
}
function addNewTitul() {
openMod('Добавить титул',
'<form method="post" action="main.php?clan&titul&add=<?=$code?>">" +
"Название титула: <input name="
tituladd
" value="
" style="
235
px;
" type="
text
"><br>" +
"<small style="
left
">(не более 30-ти символов)</small>" +
"<input style="
right
" type="
submit
" value="
Добавить
титул
">" +
"</div>" +
"</form>');
const html = `
<form method="post" action="main.php?clan&titul&add=<?=$code?>">
Название титула: <input name="tituladd" style="235px;" type="text"><br>
<small style="left">(не более 30-ти символов)</small>
<input style="right" type="submit" value="Добавить титул">
</form>
`;
openMod('Добавить титул', html);
}
// С этим мигающим кулаком надо что-то делать..
@ -527,6 +489,8 @@ if (!$res) {
?>
<?php
$storage = new ItemStorage();
if ($u->info['clan_prava'] != 'glava') {
if (isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
if ($u->info['money'] >= 50) {
@ -547,7 +511,7 @@ if ($u->info['clan_prava'] != 'glava') {
'UPDATE `users` SET `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
}
$ar = $u->rem_itm_cl($u->info, $res['id'], 7);
$storage->remove(7);
} else {
echo '<script>setTimeout("alert(\'Для выхода из клана требуется наличие 50 кр.\');",500)</script>';
}
@ -1126,7 +1090,7 @@ if ($u->info['clan_prava'] != 'glava') {
} elseif ($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
echo '<font color="#FF0000"><b>Игрок старше вас по званию, либо звания совпадают</b></font><br>';
} else {
$ar = $u->rem_itm_cl($usr, $res['id'], 8);
$storage->remove(8);
if ($usr['level'] < 10) {
mysql_query(
'UPDATE `users` SET `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "0" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
@ -2346,7 +2310,7 @@ if ($u->info['clan_prava'] != 'glava') {
if ($u->testBattle($btlud['battle']) == true) {
echo '<font color="#FF0000"><b>Нельзя изымать предметы с персонажа в бою</b></font><br>';
} else {
echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
echo $storage->backToOwner($itm['id']);
}
}
} elseif (isset($_GET['take_itm']) && $tt[4][0] == 1) {
@ -2357,7 +2321,7 @@ if ($u->info['clan_prava'] != 'glava') {
)
);
if (isset($itm['id'])) {
echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
echo $storage->take($itm['id']);
}
} elseif (isset($_GET['give_itm'])) {
$itm = mysql_fetch_array(
@ -2369,7 +2333,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 $storage->put($_GET['give_itm'], $res['id']);
echo $storage->put($itm['id']);
}
}
if ($tt[4][0] == 1) {
@ -2421,7 +2385,7 @@ if ($u->info['clan_prava'] != 'glava') {
<?php } elseif (isset($_GET['titul']) && $tt[11][0] == 1) { ?>
<script>
function editTitul(id) {
if ($('#edpnltitul' + id).css('display') == 'none') {
if ($('#edpnltitul' + id).css('display') === 'none') {
$('#edpnltitul' + id).css({'display': ''});
} else {
$('#edpnltitul' + id).css({'display': 'none'});

View File

@ -69,12 +69,12 @@ if ($u->room['file'] == 'commision2') {
$itemkt['min'] = $itemkt['min'] * $itemcount['total'];
$itemkt['max'] = $itemkt['max'] * $itemcount['total'];
if ($_POST['summTR'] >= $itemkt['min'] && $_POST['summTR'] <= $itemkt['max']) {
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u);
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']);
} else {
$re = '<div align="left">Не удалось сдать предмет его цена может быть мин: ' . $itemkt['min'] . 'кр. макс: ' . $itemkt['max'] . 'кр. кол-во: ' . $itemcount['total'] . '</div>';
}
} else {
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u);
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']);
}
}

View File

@ -11,112 +11,164 @@ if (!defined('GAME')) {
die();
}
$am = new ActionModel($u->info['id']);
$dailyQuest = new class {
private int $uid;
private string $login;
private ActionModel $am;
private int $room;
private const ACT = 'day_quest';
private string $status = '';
private int $exp;
$txt ??= '';
if (isset($_GET['getq'])) {
$zadID = !$am->getDailyQuest() ? mt_rand(1, 7) : 0;
public function __construct()
{
$txt .= match ($zadID) {
1 => 'Говорят в городе завелись всякие Трупожоры. Пойди да убей двоих, порадуй бабушку.',
2 => 'Покажи на что способен! Поучаствуй в 10 хаотических поединках!',
3 => 'Необходимо исследовать для бабушки два любых подземелия, ей очень интересно что там внутри! Только гляди милок, пропуски не используй!',
4 => 'Сразись в хаотических поединках и получи 100 000 опыта!',
5 => 'Открой сундук Трупожора, порадуй бабушку!',
6 => 'Посети Излом Хаоса!',
7 => 'Выполни 3 любых задания в подземелиях! Бабушка будет очень довольна!',
8 => 'Сходи-ка милок в Башню Смерти! Да попробуй там свои силенки.',
default => 'Эх шустрый малец, получал задание уже сегодня! Завтра приходи, накормлю чем нибудь вкусным ну и задание дам!'
};
$txt = "<b>$txt</b>";
if ($zadID > 0) {
ActionModel::new($u->info, $zadID, 'day_quest');
sendSysChat($txt);
$this->uid = User::start()->info['id'];
$this->login = User::start()->info['login'];
$this->room = User::start()->info['room'];
$this->exp = User::start()->info['exp'];
$this->am = new ActionModel($this->uid);
}
}
function sendSysChat($message): void
{
global $u;
$cmsg = new ChatMessage();
$cmsg->setRoom($u->info['room']);
$cmsg->setTo($u->info['login']);
$cmsg->setType(6);
$cmsg->setText($message);
(new Chat())->sendMsg($cmsg);
}
private function getQuest(): array
{
return $this->am::get(["uid = $this->uid", 'vars = ' . self::ACT], 'val, vals, time');
}
function giveDailyQuestPrize(): void
{
global $u;
Db::sql('update actions set vals = 0 where vars = ? and uid = ?', ['day_quest', $u->info['id']]);
Db::sql('update users_achiv set zb = zb + 1 where id = ?', [$u->info['id']]);
ItemsModel::addItem(10020, $u->info['id'], '|sudba=' . $u->info['login']);
StatsModel::addRepexpById($u->info['id'], 50); //Репутация +20
private function sendSysChat(string $message): void
{
$cmsg = new ChatMessage();
$cmsg->setRoom($this->room);
$cmsg->setTo($this->login);
$cmsg->setType(6);
$cmsg->setText($message);
(new Chat())->sendMsg($cmsg);
}
public function get(): void
{
$questId = $this->getQuest() ? 0 : mt_rand(1, 7);
$this->status .= match ($questId) {
1 => 'Говорят в городе завелись всякие Трупожоры. Пойди да убей двоих, порадуй бабушку.',
2 => 'Покажи на что способен! Поучаствуй в 10 хаотических поединках!',
3 => 'Необходимо исследовать для бабушки два любых подземелия, ей очень интересно что там внутри! Только гляди милок, пропуски не используй!',
4 => 'Сразись в хаотических поединках и получи 100 000 опыта!',
5 => 'Открой сундук Трупожора, порадуй бабушку!',
6 => 'Посети Излом Хаоса!',
7 => 'Выполни 3 любых задания в подземелиях! Бабушка будет очень довольна!',
8 => 'Сходи-ка милок в Башню Смерти! Да попробуй там свои силенки.',
default => 'Эх шустрый малец, получал задание уже сегодня! Завтра приходи, накормлю чем нибудь вкусным ну и задание дам!'
};
$this->status = "<b>$this->status</b>";
if ($questId) {
$this->am::new(['id' => $this->uid, 'room' => $this->room], $questId, self::ACT);
$this->sendSysChat($this->status);
}
}
public function getControl(): string
{
$test = ActionModel::getOne(["uid = $this->uid", 'vars = ' . self::ACT], 'vals');
$q = [
'1' => 'Убийство Трупожоров',
'2' => 'Победы в хаотических боях',
'3' => 'Спуск в Подземелия',
'4' => 'Набрать в хаотических поединках 100 000 Опыта',
'5' => 'Открыть Сундук Трупожора',
'6' => 'Посетить Излом Хаоса',
'7' => 'Сдача 3 заданий в пещерах',
'8' => 'Поучаствовать в Башне Смерти',
];
$n = $test ? "<a href='/main.php?putq=1'>Сдать задание</a><br>" . $q[$test['vals']] : "<a href='/main.php?getq=1'>Получить задание</a>";
return "<b style='color:green'>$n</b>";
}
private function givePrize(): void
{
Db::sql('update actions set vals = 0 where vars = ? and uid = ?', [self::ACT, $this->uid]);
Db::sql('update users_achiv set zb = zb + 1 where id = ?', [$this->uid]);
ItemsModel::addItem(10020, $this->uid, '|sudba=' . $this->login);
StatsModel::addRepexpById($this->uid, 50); //Репутация +20
}
public function getStatus(): void
{
$quest = $this->getQuest();
if (!$quest) {
$this->status = 'У тебя нет задания милок, не юли! Хоть бабушка плохо видит но бабушка хорошо помнит.';
return;
}
$questId = $quest['vals'];
$finishedTasks = $this->am->getFinishedDailyQuestTasks($quest['time']);
$happy = 'Порадовал бабушку! ';
switch ($questId) {
case 1:
if ($finishedTasks['end_trup'] > 1) {
$this->status = $happy . 'Убил ипостата! Может на печи полежим? - Нет, ну держи жетончик!';
$this->givePrize();
} else {
$this->status = 'Победи в боях с Трупожором ' . $finishedTasks['end_trup'] . '/2.';
}
break;
case 2:
if ($finishedTasks['end_xaot'] > 9) {
$this->status = $happy . 'Поучаствовал в боях! А точно покушать не хочешь? - Нет, ну держи жетончик!';
$this->givePrize();
} else {
$this->status = 'Участия в хаотах ' . $finishedTasks['end_xaot'] . '/10.';
}
break;
case 3:
if ($finishedTasks['psh0'] > 1) {
$this->status = $happy . 'Хороший запах! А точно покушать не хочешь? - Нет, ну держи жетончик!';
$this->givePrize();
} else {
$this->status = 'Посещение Подземелий ' . $finishedTasks['psh0'] . '/2.';
}
break;
case 4:
if (($this->exp - $quest['val']) > 100000) {
$this->status = $happy . 'Подрос, подрос! держи жетончик!';
$this->givePrize();
} else {
$this->status = 'Получение ' . ($this->exp - $quest['val']) . '/100 000 опыта.';
}
break;
case 5:
if ($finishedTasks['trup_sun'] > 0) {
$this->status = $happy . 'Сундучек удачу принес? Нет? Ну держи жетончик!';
$this->givePrize();
} else {
$this->status = 'Открытие сундуков Трупожора 0/1';
}
break;
case 6:
if ($finishedTasks['izlom'] > 0) {
$this->status = $happy . 'Так пахнет гарью и смертью Ммммм ... За это тебе жетончик!';
$this->givePrize();
} else {
$this->status = 'Посещение Излома Хаоса 0/1';
}
break;
case 7:
if ($finishedTasks['win'] > 2) {
$this->status = $happy . 'Стало в мире светлее, но бабка как была слепая так и осталась... <br> Чуть не забыла жетончик!';
$this->givePrize();
} else {
$this->status = 'Выполни 3 задания в подземелиях. ' . $finishedTasks['win'] . '/3.';
}
break;
}
$this->sendSysChat("<b>$this->status</b>");
}
};
if (isset($_GET['getq'])) {
$dailyQuest->get();
}
if (isset($_GET['putq'])) {
$test = $am->getDailyQuest();
if (!$test) {
$txt .= 'У тебя нет задания милок, не юли! Хоть бабушка плохо видит но бабушка хорошо помнит.';
} else {
$zadID = $test['vals'];
$finishedTasks = $am->getFinishedDailyQuestTasks($test['time']);
if ($zadID == 1) {
if ($finishedTasks['end_trup'] > 1) {
$txt .= 'Порадовал бабушку! Убил ипостата! Может на печи полежим? - Нет, ну держи жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Победи в боях с Трупожором ' . $finishedTasks['end_trup'] . '/2.';
}
} elseif ($zadID == 2) {
if ($finishedTasks['end_xaot'] > 9) {
$txt .= 'Порадовал бабушку! Поучаствовал в боях! А точно покушать не хочешь? - Нет, ну держи жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Участия в хаотах ' . $finishedTasks['end_xaot'] . '/10.';
}
} elseif ($zadID == 3) {
if ($finishedTasks['psh0'] > 1) {
$txt .= 'Порадовал бабушку! Хороший запах! А точно покушать не хочешь? - Нет, ну держи жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Посещение Подземелий ' . $finishedTasks['psh0'] . '/2.';
}
} elseif ($zadID == 4) {
if (($u->info['exp'] - $test['val']) > 100000) {
$txt .= 'Порадовал бабушку! Подрос, подрос! держи жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Получение ' . ($u->info['exp'] - $test['val']) . '/100 000 опыта.';
}
} elseif ($zadID == 5) {
if ($finishedTasks['trup_sun'] > 0) {
$txt .= 'Порадовал бабушку! Сундучек удачу принес? Нет? Ну держи жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Открытие сундуков Трупожора 0/1';
}
} elseif ($zadID == 6) {
if ($finishedTasks['izlom'] > 0) {
$txt .= 'Порадовал бабушку! Так пахнет гарью и смертью Ммммм ... За это тебе жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Посещение Излома Хаоса 0/1';
}
} elseif ($zadID == 7) {
if ($finishedTasks['win'] > 2) {
$txt .= 'Порадовал бабушку! Стало в мире светлее, но бабка как была слепая так и осталась... <br> Чуть не забыла жетончик!';
giveDailyQuestPrize();
} else {
$txt .= 'Выполни 3 задания в подземелиях. ' . $finishedTasks['win'] . '/3.';
}
}
sendSysChat("<b>$txt</b>");
}
$dailyQuest->getStatus();
}
$nowby = Db::getValue('select good from pay_operation where uid = ? and good > 0 order by good desc limit 1', [$u->info['id']]);
@ -137,7 +189,7 @@ $repovo = $u->rep['rep3'] - $u->rep['rep3_buy'];
<a href="/main.php?skills=1&side=1">+ Способности</a><br>
<?php endif; ?>
&nbsp;<br>
<br>
Опыт:&nbsp;<a href="/exp" target="_blank"><?= number_format($u->info['exp'], 0, ",", " ") ?></a><br>
Уровень:&nbsp;<?= $u->info['level']; ?><br>
Побед:&nbsp;<?= number_format($u->info['win'], 0, ",", " ") ?><br>
@ -157,4 +209,4 @@ $repovo = $u->rep['rep3'] - $u->rep['rep3_buy'];
Воинственность:&nbsp;<b style="color:green"><?= $repovo; ?> ед.</b><br>
<?php endif; ?>
<br>
<?= $u->dayquest($u->info['id']) ?>
<?= $dailyQuest->getControl() ?>

View File

@ -12,9 +12,7 @@ if (!defined('GAME_VERSION')) {
use Core\{Config, Database, Db};
use User\Confirmation;
use User\Register;
use User\UserIp;
use User\{Confirmation, Register, UserIp};
Config::init();
Database::init();
@ -149,7 +147,6 @@ $errorMessage = $newUser->getError() ? "<h4>{$newUser->getError()}</h4>" : '';
<!DOCTYPE html>
<head>
<title><?= Config::GAMENAME ?>: Регистрация - создай персонажа в игре.</title>
<meta name="description" content="<?= Config::get('desc') ?>"/>
</head>

View File

@ -1,6 +1,7 @@
<?php
use Helper\Conversion;
use User\ItemsModel;
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
@ -139,7 +140,7 @@ if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$x = 0;
$uus = [];
while ($pl = mysql_fetch_array($sp)) {
$x = $u->itemsX($pl['id'], $pl['uid']);
$x = ItemsModel::itemsX($pl['id'], $pl['uid']);
$fu = $pl['uid'];
if ($pl['uid'] == $u->tfer['uid1']) {
$pl['uid'] = $u->tfer['uid2'];
@ -301,7 +302,7 @@ if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
function itmInfotf($pl, $cl)
{
global $u, $c, $code;
$x = $u->itemsX($pl['id'], $pl['uid']);
$x = ItemsModel::itemsX($pl['id'], $pl['uid']);
if ($x > 1) {
$x = ' (x' . $x . ')';
} else {