battles/main.php

1722 lines
91 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
ob_start("ob_gzhandler");
session_start();
$errkom = '';
2019-02-15 22:31:18 +00:00
$get = filter_input(INPUT_SERVER, 'QUERY_STRING');
if ($get === 'exit') {
2019-02-15 22:33:58 +00:00
session_destroy();
header("Location: fight.php");
}
2020-06-23 08:49:49 +00:00
if (!isset($_SESSION['uid'])) {
header("Location: index.php");
}
2020-06-23 14:43:14 +00:00
echo 'main.php.start';
2019-01-18 12:25:27 +00:00
require_once 'functions.php';
2018-01-28 16:40:49 +00:00
$tmaz = time();
2020-06-23 13:13:25 +00:00
try {
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']);
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
2018-03-03 20:56:05 +00:00
if ($user['battle'] != 0) {
2018-03-02 14:33:58 +00:00
header('location: fbattle.php');
die();
}
2018-01-28 16:40:49 +00:00
/* === проверяем соответствие комнаты и скрипта === */
if (in_array($user['room'], [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) {
header('Location: city.php');
die();
}
if ($user['room'] == 22) {
header('Location: shop.php');
die();
}
if ($user['room'] == 23) {
header('Location: repair.php');
die();
}
if ($user['room'] == 25) {
header('Location: comission.php');
die();
}
if ($user['room'] == 27) {
header('Location: post.php');
die();
}
if ($user['room'] == 29) {
header('Location: bank.php');
die();
}
if ($user['room'] == 31) {
header('Location: tower.php');
die();
}
if ($user['room'] == 30) {
header('Location: clan_create.php');
die();
}
if ($user['room'] == 34) {
header('Location: fshop.php');
die();
}
if ($user['room'] == 42) {
header('Location: lotery.php');
die();
}
if ($user['room'] == 43) {
header('Location: znahar.php');
die();
}
if ($user['room'] == 44) {
header('Location: new_year.php');
die();
}
if ($user['room'] == 45) {
header('Location: clan_castle.php');
die();
}
if ($user['room'] == 47) {
header('Location: wall_build.php');
die();
}
if ($user['room'] == 49) {
header('Location: dig.php');
die();
}
if ($user['room'] == 50) {
header('Location: ashop.php');
die();
}
if ($user['room'] == 53) {
header('Location: library.php');
die();
}
if ($user['room'] == 61) {
header('Location: akadem.php');
die();
}
if ($user['room'] == 650) {
header('Location: ul_clans.php');
die();
}
//БС
if ($user['in_tower'] == 1) {
header('Location: towerin.php');
die();
}
//Храм древнх
if ($user['room'] == 203) {
header('Location: church.php');
die();
}
//ЦХ
if ($user['room'] == 600) {
header('Location: c_haos.php');
die();
}
if ($user['room'] == 601) {
header('Location: c_haos_in.php');
die();
}
if ($user['room'] == 602) {
header('Location: c_park.php');
die();
}
if ($user['room'] == 603) {
header('Location: aren_of_angels.php');
die();
}
if ($user['room'] == 620) {
header('Location: enter_cave.php');
die();
}
if ($user['room'] == 621) {
header('Location: cave.php');
die();
}
if ($user['room'] == 660) {
header('Location: hostel.php');
die();
}
if ($user['room'] == 661) {
header('Location: hostel_room.php');
die();
}
if ($user['room'] == 662) {
header('Location: quest_room.php');
die();
}
if ($user['room'] == 760) {
header('Location: c_forest.php');
die();
}
if ($user['room'] == 1000) {
header('Location: solib/enterbezdna.php');
die();
}
if ($user['room'] == 1001) {
header('Location: solib/dungeon.php');
die();
}
if ($user['room'] == 1051) {
header('Location: lab_enter.php');
die();
}
if ($user['room'] == 1052) {
header('Location: labirint.php');
die();
}
if ($user['room'] == 402) {
header('Location: vxod.php');
die();
}
if ($user['room'] == 403) {
header('Location: canalizaciya.php');
die();
}
if ($user['room'] == 1054) {
header('Location: fontan_luck.php');
die();
}
if ($user['room'] == 1055) {
header('Location: group_arena.php');
die();
}
if ($user['room'] == 666) {
header('Location: jail.php');
die();
}
function sum_mf($u)
{
2020-06-23 13:13:25 +00:00
try {
$sum = db::c()->query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_mf` > 0 AND `owner` = ?i', $u);
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
2020-06-23 08:49:49 +00:00
if ($sum->fetch_assoc() > 0) {
return $sum;
} else {
return 0;
}
}
function sum_dmg($u)
{
2020-06-23 13:13:25 +00:00
try {
$sum = db::c()->query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_uron` > 0 AND `owner` = ?i', $u);
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
2020-06-23 08:49:49 +00:00
if ($sum->fetch_assoc() > 0) {
return $sum;
} else {
return 0;
}
}
function sum_bron($u)
{
2020-06-23 13:13:25 +00:00
try {
$sum = db::c()->query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_bron` > 0 AND `owner` = ?i', $u);
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
2020-06-23 08:49:49 +00:00
if ($sum->fetch_assoc() > 0) {
return $sum;
} else {
return 0;
}
}
function bron_ads($a1, $a2, $a3, $a4, $col)
{
2019-01-18 12:25:27 +00:00
return ['a1' => round(($a1 / 100) * $col), 'a2' => round(($a2 / 100) * $col), 'a3' => round(($a3 / 100) * $col), 'a4' => round(($a4 / 100) * $col)];
}
function max_mf()
{
$r = '';
$mfs = countmf();
if (($mfs['fkrit'] > $mfs['fakrit']) && ($mfs['fkrit'] > $mfs['fuvorot']) && ($mfs['fkrit'] > $mfs['fauvorot'])) {
$r = 'fkrit';
} elseif (($mfs['fakrit'] > $mfs['fkrit']) && ($mfs['fakrit'] > $mfs['fuvorot']) && ($mfs['fakrit'] > $mfs['fauvorot'])) {
$r = 'fakrit';
} elseif (($mfs['fuvorot'] > $mfs['fkrit']) && ($mfs['fuvorot'] > $mfs['fakrit']) && ($mfs['fuvorot'] > $mfs['fauvorot'])) {
$r = 'fuvorot';
} elseif (($mfs['fauvorot'] > $mfs['fkrit']) && ($mfs['fauvorot'] > $mfs['fakrit']) && ($mfs['fauvorot'] > $mfs['fuvorot'])) {
$r = 'fauvorot';
}
return $r;
}
function stack($it_id)
{
global $user;
$it_id = (int)$it_id;
2019-09-16 14:01:59 +00:00
$stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']);
if (db::c()->getAffectedRows() === 1) {
$stack = $stack->fetch_assoc();
$similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)"));
if ($similar[0] >= 1) {
mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1");
mysql_query("DELETE FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `dressed` = 0 AND `goden` = 0 AND `koll` >= 1 AND `setsale` = 0 AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `laba` = '" . $stack['laba'] . "' AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2)=FORMAT(" . $stack['cost'] / $stack['koll'] . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2) ");
}
}
}
function unstack($it_id, $it_count)
{
global $user;
$it_id = (int)$it_id;
$it_count = (int)$it_count;
$it_count = abs($it_count);
2020-06-23 13:31:58 +00:00
try {
$dress = db::c()->query('SELECT * FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $it_id)->fetch_assoc_array();
}
catch(\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
if (isset($dress['id'])) {
if ($it_count <= $dress['koll'] && $it_count > 0) {
if ($dress['koll'] == $it_count) {
2020-06-23 13:31:58 +00:00
db::c()->query('DELETE FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $dress['id']);
} else {
mysql_query("UPDATE `inventory` SET `cost` = (`cost`-`cost`/`koll`*" . $it_count . "), `point` = (`point`-`point`/`koll`*" . $it_count . "), `bcost` = (`bcost`-`bcost`/`koll`*" . $it_count . "), `massa` = (`massa`-`massa`/`koll`*" . $it_count . "), `koll` = (`koll`-" . $it_count . ") WHERE `id` = '$dress[id]' AND `owner` = '$user[id]' LIMIT 1");
}
mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')");
return mysql_insert_id();
2020-06-23 08:49:49 +00:00
} else {
return false;
}
} else {
return false;
}
}
function del_efs($uid, $id, $type)
{
global $user;
$arr = [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20];
2020-06-23 08:49:49 +00:00
if ($uid == $user['id'] && $id != null) {
if (!in_array($type, $arr)) {
db::c()->query('DELETE FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $uid, $id);
if ($type == 1022) {
db::c()->query('UPDATE `users` SET `invis` = ?i WHERE `id` = ?i', 0, $uid);
$user['invis'] = 0;
}
2020-06-23 08:49:49 +00:00
err('Эффект удалён.');
} else {
err('Данный эффект нельзя удалить.');
}
}
}
function countmf()
{ //TODO пересчитать модификаторы
global $user;
function GetWeaponType($idwep)
{
if ($idwep == 0 || $idwep == null || $idwep == '') {
return "kulak";
}
$wep = db::c()->query('SELECT `otdel`, `minu` FROM `inventory` WHERE `id` = ?i', $idwep)->fetch_row();
if ($wep[0] == '1') {
return "noj";
} elseif ($wep[0] == '12') {
return "dubina";
} elseif ($wep[0] == '11') {
return "topor";
} elseif ($wep[0] == '13') {
return "mech";
} elseif ($wep[1] > 0) {
return "buket";
} else {
return "kulak";
}
}
2019-09-17 14:59:16 +00:00
$zo = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 201 AND `owner` = ?i', $user['id'])->getNumRows();
$sokr = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 202 AND `owner` = ?i', $user['id'])->getNumRows();
2019-09-17 14:59:16 +00:00
$bmfud = $bmfbron = 0;
2020-06-23 08:49:49 +00:00
if (!empty($sokr)) {
$bmfud += 5;
}
if (!empty($zo)) {
$bmfbron += 25;
}
2019-01-18 12:25:27 +00:00
$mf = [];
$user_dress = db::c()->query('SELECT SUM(`minu`), SUM(`maxu`), SUM(`mfkrit`), SUM(`mfakrit`), SUM(`mfuvorot`), SUM(`mfauvorot`), SUM(`bron1`), SUM(`bron2`), SUM(`bron3`), SUM(`bron4`) FROM `inventory` WHERE `dressed` = 1 AND `owner` = ?i', $user['id'])->fetch_row();
$user_dress[6] = $bmfbron;
$user_dress[7] = $bmfbron;
$user_dress[8] = $bmfbron;
$user_dress[9] = $bmfbron;
$user_dress[6] += $user['ubron1'];
$user_dress[7] += $user['ubron2'];
$user_dress[8] += $user['ubron3'];
$user_dress[9] += $user['ubron4'];
$mykrit = $user_dress[2] + ($user['inta'] * 2.95);
$myakrit = $user_dress[3] + ($user['inta'] * 2.75);
$myuvorot = $user_dress[4] + ($user['lovk'] * 5);
$myauvorot = $user_dress[5] + ($user['lovk'] * 4);
2019-01-18 12:25:27 +00:00
$mf['me'] = ['udar' => (floor($user['sila'] / 3) + 1 + $user_dress[0]), 'maxudar' => (floor($user['sila'] / 3) + 4 + $user_dress[1])];
if ($mf['me']['udar'] < 0) {
$mf['me']['udar'] = 0;
}
$weap_b = 0;
switch (GetWeaponType($user['weap'])) {
case "noj":
$weap_b += $user['noj'];
break;
case "dubina":
$weap_b += $user['dubina'];
break;
case "topor":
$weap_b += $user['topor'];
break;
case "mech":
$weap_b += $user['mec'];
break;
2020-06-23 08:49:49 +00:00
default:
$weap_b = 0;
break;
}
2019-01-18 12:25:27 +00:00
return ['minu' => $mf['me']['udar'] + $bmfud + $weap_b, 'maxu' => $mf['me']['maxudar'] + $bmfud + $weap_b, 'fkrit' => round($mykrit, 0), 'fakrit' => round($myakrit, 0), 'fuvorot' => round($myuvorot, 0), 'fauvorot' => round($myauvorot, 0), 'bron1' => $user_dress[6], 'bron2' => $user_dress[7], 'bron3' => $user_dress[8], 'bron4' => $user_dress[9]];
}
// одеть предмет
function dressitem($id)
{
global $user;
$item = db::c()->query('SELECT * FROM `inventory` WHERE `duration` < `maxdur` AND `id` = ?i AND `owner` = ?i AND `dressed` = 0', $id, $user['id'])->fetch_assoc();
switch ($item['type']) {
case 1:
$slot1 = 'sergi';
break;
case 2:
$slot1 = 'kulon';
break;
case 3:
$slot1 = 'weap';
break;
case 4:
$slot1 = 'bron';
break;
case 5:
$slot1 = 'r1';
break;
case 6:
$slot1 = 'r2';
break;
case 7:
$slot1 = 'r3';
break;
case 8:
$slot1 = 'helm';
break;
case 9:
$slot1 = 'perchi';
break;
case 10:
$slot1 = 'shit';
break;
case 11:
$slot1 = 'boots';
break;
case 12:
$slot1 = 'm1';
break;
case 22:
$slot1 = 'rybax';
break;
case 23:
$slot1 = 'plaw';
break;
2019-09-17 15:15:17 +00:00
default:
$slot1 = '';
break;
}
if ($item['type'] == 5) {
2020-06-23 08:49:49 +00:00
if (!$user['r1']) {
$slot1 = 'r1';
} elseif (!$user['r2']) {
$slot1 = 'r2';
} elseif (!$user['r3']) {
$slot1 = 'r3';
} else {
$slot1 = 'r1';
dropitem(5);
}
} elseif ($item['type'] == 12) {
2020-06-23 08:49:49 +00:00
if (!$user['m1']) {
$slot1 = 'm1';
} elseif (!$user['m2']) {
$slot1 = 'm2';
} elseif (!$user['m3']) {
$slot1 = 'm3';
} elseif (!$user['m4']) {
$slot1 = 'm4';
} elseif (!$user['m5']) {
$slot1 = 'm5';
} elseif (!$user['m6']) {
$slot1 = 'm6';
} elseif (!$user['m7']) {
$slot1 = 'm7';
} elseif (!$user['m8']) {
$slot1 = 'm8';
} elseif (!$user['m9']) {
$slot1 = 'm9';
} elseif (!$user['m10']) {
$slot1 = 'm10';
} else {
$slot1 = 'm1';
dropitem(12);
}
2020-06-23 08:49:49 +00:00
} else {
dropitem($item['type']);
}
if (!($item['type'] == 12 && $user['level'] < 4)) {
2020-06-23 08:49:49 +00:00
if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i', $slot1, $id, $id, $user['id'], $al, $user['align'], $user['id'])) {
$user[$slot1] = $item['id'];
2020-06-23 08:49:49 +00:00
}
return true;
2020-06-23 08:49:49 +00:00
} else {
return false;
}
}
2019-09-17 14:37:44 +00:00
// Входим и выходим если можем.
if (isset($_GET['goto'])) {
$imove = true;
$d = db::c()->query('SELECT SUM(`massa`) AS `summ` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $user['id'])->fetch_assoc();
$eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type` = 14 OR `type` = 13) LIMIT 1', $user['id'])->fetch_assoc();
if ($d['summ'] > get_meshok() && $_GET['got']) {
err('У вас переполнен рюкзак, вы не можете передвигаться...');
$imove = false;
}
if (isset($eff['id']) && $_GET['got']) {
err('У вас тяжелая травма, вы не можете передвигатся...');
$imove = false;
}
2020-06-23 08:49:49 +00:00
if ($_GET['goto'] == 'plo' && empty($user['zayavka']) && $imove === true) {
2019-09-17 14:37:44 +00:00
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
header('Location: city.php');
die("<i>Топ-топ-топ...</i>");
2020-06-23 08:49:49 +00:00
} else {
err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
}
if ($_GET['goto'] == 'arena' && $user['room'] === 20 && $imove === true) {
2019-09-17 14:37:44 +00:00
db::c()->query('UPDATE `users`, `online` SET `users`.`room` = 1, `online`.`room` = 1 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
header('Location: main.php');
die("<i>Топ-топ-топ...</i>");
}
}
if (isset($_GET['use'])) {
usemagic($_GET['use'], $_POST['target']);
}
/**
* Отображение персонажа в main.php
2019-01-18 12:25:27 +00:00
*
* @param $id
2020-06-23 08:49:49 +00:00
*
2019-09-17 14:59:16 +00:00
* @throws \Krugozor\Database\Mysql\Exception
*/
function showpersinv($id)
{
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
$dressed = [];
2018-11-01 16:44:20 +00:00
$r = db::c()->query('SELECT * FROM `inventory` WHERE
`id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR
`id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR
`id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i',
$user['helm'], $user['weap'], $user['plaw'], $user['bron'], $user['rybax'],
$user['sergi'], $user['kulon'], $user['r1'], $user['r2'], $user['r3'], $user['perchi'],
$user['shit'], $user['boots'], $user['m1'], $user['m2'], $user['m3'], $user['m4'],
$user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10']);
2018-11-01 16:44:20 +00:00
while ($rec = $r->fetch_assoc()) {
$dressed[$rec['id']] = $rec;
}
?>
2020-06-23 08:49:49 +00:00
<div style="text-align: center;">
2019-01-18 12:25:27 +00:00
<?php nick::id($_SESSION['uid']); ?>
<?= showProgressBar($user['hp'], $user['maxhp']); ?>
<TABLE cellspacing=0 cellpadding=0>
<?
if ($user['level'] > 3) { ?>
<TR>
<TD colspan=3>
<? // TODO Сделать один запрос из десяти!
if ($user['m1'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m1'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=12"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m2'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m2'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=13"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m3'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m3'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=14"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m4'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m4'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=15"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m5'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m5'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=16"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
?>
</TD>
</TR>
<TR>
<TD colspan=3>
<?
if ($user['m6'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m6'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=17"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m7'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m7'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=18"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m8'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m8'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=19"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m9'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m9'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=20"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m10'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['m10'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=21"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
?>
</TD>
</TR>
<?
} ?>
<TR>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=1"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=20></a>';
} else {
echo '<img src="i/w1.gif" width=60 height=20 class=\'tooltip\' title=\'<b>Пустой слот Серьги</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=2"><img src="i/sh/' . $dress['img'] . '" width=60 height=20 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
echo '<img src="i/w2.gif" width=60 height=20 class=\'tooltip\' title=\'<b>Пустой слот Ожерелье</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['weap'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=3"><img src="i/sh/' . $dress['img'] . '" width=60 height=60 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
echo '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title=\'<b>Пустой слот Оружие</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
2019-09-17 15:15:17 +00:00
$d = $n = 0;
if ($user['plaw']) {
$d = $user['plaw'];
$n = 23;
} elseif ($user['bron']) {
$d = $user['bron'];
$n = 4;
} elseif ($user['rybax']) {
$d = $user['rybax'];
$n = 22;
}
$dress = $dressed[$d];
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=' . $n . '"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=80></a>';
} else {
echo '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title=\'<b>Пустой слот Броня</b>\' />';
}
?></TD>
</TR>
<TR>
<TD>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<td><?php
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=5"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></td>
<td><?php
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a class=\'tooltip\' title=\'' . $mess . '\' href="?edit=1&drop=6"><img src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img src="i/w6.gif" width=20 height=20 class=\'tooltip\' title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></td>
<td><?php
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=7"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></td>
</tr>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
<TD valign=top><img src="i/shadow/<?= $user['shadow'] ?>" width=76 height=209
alt="<?= $user['login'] ?>"></TD>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['helm'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=8"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
echo '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title=\'<b>Пустой слот Шлем</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['perchi'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=9"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
echo '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 title=\'<b>Пустой слот Перчатки</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['shit'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=10"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
echo '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title=\'<b>Пустой слот Щит</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if
($user['boots'] > 0) {
$dress = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
$mess = '<span style="min-width: 350px;">Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '</span>';
echo '<a href="?edit=1&drop=11"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
echo '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title=\'<b>Пустой слот Обувь</b>\' />';
}
?></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
2020-06-23 08:49:49 +00:00
</div> <?php
}
2018-03-02 14:33:58 +00:00
function updstats()
{
global $user;
2018-11-01 16:44:20 +00:00
$u1 = db::c()->query('SELECT
`sila`, `lovk`, `inta`, `intel`, `noj`, `mec`, `topor`, `dubina`,
`mfire`, `mwater`, `mair`, `mearth`, `mlight`, `mgray`, `mdark`, `hp`, `maxhp`
FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
2018-03-02 14:33:58 +00:00
foreach ($u1 as $k => $v) {
$user[$k] = $v;
}
2018-01-28 16:40:49 +00:00
}
unset($_SESSION['stackall']);
2018-01-28 16:40:49 +00:00
2018-03-23 21:47:46 +00:00
if (isset($_GET["stack"])) {
2018-03-02 14:33:58 +00:00
$_GET["stack"] = (int)$_GET["stack"];
$rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0', $_GET['stack'], $user['id'])->fetch_assoc();
2018-03-02 14:33:58 +00:00
if (isset($rec['id'])) {
stack($rec['id']);
unset($rec);
}
2018-01-28 16:40:49 +00:00
}
2018-03-23 21:47:46 +00:00
if (isset($_GET['unstack'])) {
2018-03-02 14:33:58 +00:00
unstack((int)$_GET['unstack'], (int)$_POST["qty"]);
}
2018-03-23 20:36:35 +00:00
function setShadow($image)
{
global $user;
$shadows = [
'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10',
'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10',
2018-03-23 20:36:35 +00:00
'person'
];
if (in_array($image, $shadows)) {
2018-03-23 20:36:35 +00:00
$i = $image . '.png';
db::c()->query('UPDATE `users` SET `shadow` = "?s" WHERE `id` = ?i', $i, $user['id']);
2020-06-23 08:49:49 +00:00
} else {
err('Ошибка!');
}
2018-01-28 16:40:49 +00:00
}
$obraz = filter_input(INPUT_GET, 'obraz');
2018-03-23 20:36:35 +00:00
if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) {
setShadow($obraz);
}
2018-01-28 16:40:49 +00:00
2020-06-23 08:49:49 +00:00
if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) {
$pl = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc();
if (isset($pl['id'])) {
del_efs($user['id'], $pl['id'], $pl['type']);
} else {
2020-06-23 09:13:55 +00:00
echo "<span class='error'>Эффект не найден!</span>";
2018-01-28 16:40:49 +00:00
}
}
2018-03-02 14:33:58 +00:00
if (isset($_GET['modif_bron'])) {
$brons = $_GET['modif_bron'];
$ids = $_GET['ids'];
2020-06-23 13:31:58 +00:00
try {
$cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $ids)->fetch_assoc();
}
catch (\Krugozor\Database\Mysql\Exception $e) {
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
}
if ($cur['free_bron'] > 0 && $cur[$brons] > 0) {
2020-06-23 08:49:49 +00:00
mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
2020-06-23 09:13:55 +00:00
echo "<span class='success'>Параметр брони увеличен!</span>";
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
if (isset($_GET['modif_stat'])) {
$stats = $_GET['modif_stat'];
$ids = $_GET['ids'];
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
2020-06-23 08:49:49 +00:00
if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) {
mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
2020-06-23 09:13:55 +00:00
echo "<span class='success'>Параметр увеличен!</span>";
2018-01-28 16:40:49 +00:00
}
}
2018-03-02 14:33:58 +00:00
if (isset($_GET['modif_mf'])) {
$mfs = $_GET['modif_mf'];
$ids = $_GET['ids'];
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
2020-06-23 08:49:49 +00:00
if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
2020-06-23 09:13:55 +00:00
echo "<span class='success'>Параметр увеличен!</span>";
2018-01-28 16:40:49 +00:00
}
}
if (input::post('setshadow')) {
2018-03-02 14:33:58 +00:00
?>
2020-06-23 08:49:49 +00:00
<!doctype html>
2019-09-17 14:37:44 +00:00
<html lang="ru">
<head>
2018-03-02 15:31:43 +00:00
<link rel=stylesheet href="css/main.css">
<meta charset="utf-8">
2019-09-17 14:37:44 +00:00
<title></title>
</head>
2018-03-02 15:31:43 +00:00
<body>
2018-03-02 14:33:58 +00:00
<table width=100%>
<tr>
2018-03-02 15:31:43 +00:00
<td><h3>Выбрать образ персонажа</h3></td>
2018-03-02 14:33:58 +00:00
<td align=right><INPUT TYPE=button value="Вернуться"
onClick="location.href='main.php?edit=0.467837356797105';"></td>
</tr>
<tr>
<td align=center style="color:red;">Внимание! Образ персонажа выбирается только один раз.</td>
</tr>
</table>
<table style="padding:5px; margin:auto;">
<caption><b>Общие образы</b></caption>
<tr>
2019-09-17 14:59:16 +00:00
<td><a href="?edit=1&obraz=m1"><img alt="m01" src="i/shadow/m1.gif"></a></a></td>
<td><a href="?edit=1&obraz=m2"><img alt="m02" src="i/shadow/m2.gif"></a></td>
<td><a href="?edit=1&obraz=m3"><img alt="m03" src="i/shadow/m3.gif"></a></td>
<td><a href="?edit=1&obraz=m4"><img alt="m04" src="i/shadow/m4.gif"></a></td>
<td><a href="?edit=1&obraz=m5"><img alt="m05" src="i/shadow/m5.gif"></a></td>
<td><a href="?edit=1&obraz=m6"><img alt="m06" src="i/shadow/m6.gif"></a></td>
<td><a href="?edit=1&obraz=m7"><img alt="m07" src="i/shadow/m7.gif"></a></td>
<td><a href="?edit=1&obraz=m8"><img alt="m08" src="i/shadow/m8.gif"></a></td>
<td><a href="?edit=1&obraz=m9"><img alt="m09" src="i/shadow/m9.gif"></a></td>
<td><a href="?edit=1&obraz=m10"><img alt="m10" src="i/shadow/m10.gif"></a></td>
</tr>
<tr>
2019-09-17 14:59:16 +00:00
<td><a href="?edit=1&obraz=f1"><img alt="f01" src="i/shadow/f1.gif"></a></a></td>
<td><a href="?edit=1&obraz=f2"><img alt="f02" src="i/shadow/f2.gif"></a></td>
<td><a href="?edit=1&obraz=f3"><img alt="f03" src="i/shadow/f3.gif"></a></td>
<td><a href="?edit=1&obraz=f4"><img alt="f04" src="i/shadow/f4.gif"></a></td>
<td><a href="?edit=1&obraz=f5"><img alt="f05" src="i/shadow/f5.gif"></a></td>
<td><a href="?edit=1&obraz=f6"><img alt="f06" src="i/shadow/f6.gif"></a></td>
<td><a href="?edit=1&obraz=f7"><img alt="f07" src="i/shadow/f7.gif"></a></td>
<td><a href="?edit=1&obraz=f8"><img alt="f08" src="i/shadow/f8.gif"></a></td>
<td><a href="?edit=1&obraz=f9"><img alt="f09" src="i/shadow/f9.gif"></a></td>
<td><a href="?edit=1&obraz=f10"><img alt="f10" src="i/shadow/f10.gif"></a></td>
2018-03-02 14:33:58 +00:00
</tr>
</table>
</body>
</html>
<?php
die();
}
header("Cache-Control: no-cache");
if (input::get('edit')) {
2018-01-28 16:40:49 +00:00
2020-06-23 08:49:49 +00:00
if (input::get('ups')) {
addOnePoint(input::get('ups'), 'stat');
}
2018-01-28 16:40:49 +00:00
2020-06-23 08:49:49 +00:00
if (input::get('upm')) {
addOnePoint(input::get('upm'), 'mastery');
}
if (input::get('drop')) {
dropitem(input::get('drop'));
2018-03-02 14:33:58 +00:00
updstats();
}
2018-01-28 16:40:49 +00:00
if (input::get('dress')) {
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('dress'), $_SESSION['uid']);
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
2018-03-02 14:33:58 +00:00
dressitem($id);
} else {
dressitem(input::get('dress'));
2018-03-02 14:33:58 +00:00
}
updstats();
2020-06-23 08:49:49 +00:00
} else {
err('Ошибка: предмет не найден!');
}
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
if (input::get('destruct')) {
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct'));
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if (empty($q['dressed'])) {
destructitem($q['id']);
addToDelo($user['login'] . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")");
err('Предмет ' . $q['name'] . ' выброшен.');
2020-06-23 08:49:49 +00:00
} else {
err('Ошибка: нельзя выбросить одетый предмет!');
}
} else {
err('Ошибка: предмет не найден!');
}
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
if (input::get('use')) {
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']);
if ($q->getNumRows()) {
$q = $q->fetch_assoc();
if ($q['koll'] > 1) {
$id = unstack($q['id'], 1);
2018-03-02 14:33:58 +00:00
usemagic($id, $_POST['target']);
} else {
usemagic($_GET['use'], $_POST['target']);
}
2020-06-23 08:49:49 +00:00
} else {
err('Ошибка: предмет не найден!');
}
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
if (input::get('undress')) {
undressall($_SESSION['uid']);
2018-03-02 14:33:58 +00:00
updstats();
}
if (input::get('delcomplect')) {
db::c()->query('DELETE FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('delcomplect'), $_SESSION['uid']);
2018-03-02 14:33:58 +00:00
}
if (input::get('complect')) {
2018-03-02 14:33:58 +00:00
$hp = $user['hp'];
undressall($_SESSION['uid']);
$q = db::c()->query('SELECT `items` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('complect'), $_SESSION['uid'])->fetch_assoc();
$items_in_set = [];
$items_in_set = explode(';', $q['items']);
2020-06-23 08:49:49 +00:00
foreach ($items_in_set as $iis) {
dressitem($iis);
2020-06-23 08:49:49 +00:00
}
db::c()->query('UPDATE `users` SET `hp` = ?i WHERE `id` = ?i', $hp, $_SESSION['uid']);
// Если здоровье становится выше максимума - выравниваем:
db::c()->query('UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = ?i', $_SESSION['uid']);
$user = (new users_row($_SESSION['uid']))->result(); # Нахера перевыгружать О_о)?!
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
ref_drop();
if (input::get('savecomplect')) {
if (preg_match('/^[- \p{L}\d]+$/u', input::get('savecomplect'))) {
$q = db::c()->query('SELECT `id` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('savecomplect'), $_SESSION['uid'])->getNumRows();
if (empty($q)) {
$items = [];
2019-01-18 10:55:07 +00:00
$q2 = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i OR `id` = ?i',
$user['sergi'], $user['kulon'], $user['perchi'], $user['weap'],
$user['bron'], $user['rybax'], $user['r1'], $user['r2'], $user['r3'],
$user['helm'], $user['shit'], $user['m1'], $user['m2'], $user['m3'],
$user['m4'], $user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10'],
2019-01-18 10:55:07 +00:00
$user['boots'], $user['plaw']);
2020-06-23 08:49:49 +00:00
while ($res = $q2->fetch_assoc()) {
$items[] = $res['id'];
}
2018-03-02 14:33:58 +00:00
$t_items = implode(";", $items);
2018-12-11 16:23:21 +00:00
db::c()->query('INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ("?s",?i,"?s")', input::get('savecomplect'), $_SESSION['uid'], $t_items);
err('Комплект ' . $name . ' сохранён.');
2020-06-23 08:49:49 +00:00
} else {
err('Ошибка: такое название комплекта уже используется!');
}
} else {
err('Ошибка: запрещённые символы!');
}
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
2019-01-18 12:25:27 +00:00
if (!in_array(input::get('mZeAjax'), ['mZeInventory', 'mZeFilter'])): ?>
2020-06-23 08:49:49 +00:00
<!doctype html>
<HTML lang="ru">
2018-03-02 14:33:58 +00:00
<HEAD>
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/tooltip.css"/>
<script src="js/jquery.plugins.js"></script>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.simplemodal.js"></script>
<script src="js/jquery.ui.js?100"></script>
<script src="js/tooltip.js"></script>
<script type="text/javascript" src="js/funcs.js"></script>
<script>
$(function () {
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
});
function saveComplect() {
new miDialog({title: 'Сохранить комплект'}, {edit: 1}, function () {
document.location = '/main.php?' + $.param(this.data);
},
$('<div>Название комплекта :<br /><div style="font-size: smaller;"><b>может содеражать только буквы (англ / русс) и цифры.</b></div></div>').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250});
}
2020-06-23 09:13:55 +00:00
let Hint3Name = '';
2018-03-02 14:33:58 +00:00
function okno(title, script, name, coma, errk) {
2020-06-23 09:13:55 +00:00
let errkom = '';
let com = '';
2019-09-16 14:01:59 +00:00
if (errk === 1) {
2018-03-02 14:33:58 +00:00
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
com = coma
}
2019-09-16 14:01:59 +00:00
if (errk === 2) {
2018-03-02 14:33:58 +00:00
errkom = 'Такой комплект уже существует<br>';
com = coma
}
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
2020-06-23 09:13:55 +00:00
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
errkom + '</span>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '" value="' + com + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100';
document.getElementById(name).focus();
2018-03-02 14:33:58 +00:00
Hint3Name = name;
}
2020-06-23 09:13:55 +00:00
const delay = 30;
let TimerOn = -1, tkHP, maxHP, speed = 750;
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
2018-03-02 14:33:58 +00:00
function setHPlocal() {
tkHP > maxHP && (tkHP = maxHP);
2020-06-23 13:13:25 +00:00
let a = Math.round(tkHP) + "/" + maxHP;
2020-06-23 09:13:55 +00:00
a = stLen - (a.length + 2) * 7;
2020-06-23 13:13:25 +00:00
const b = Math.round((a - 1) / maxHP * tkHP);
2018-03-02 14:33:58 +00:00
a -= b;
2020-06-23 13:13:25 +00:00
const HP = document.getElementById("hp_value");
const HP1 = document.getElementById("HP1");
const HP2 = document.getElementById("HP2");
2018-03-02 14:33:58 +00:00
if (HP) {
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
}
tkHP += maxHP / 53 / 230 * (speed / 100);
TimerOn = tkHP < maxHP ? setTimeout("setHPlocal()", delay * 100) : -1
}
<? echo topsethp(); ?>
$(document).ready(function () {
$('a').live('click', function () {
2019-09-16 14:01:59 +00:00
if ($(this).attr('ajax') !== undefined) {
2020-06-23 09:13:55 +00:00
const ajaxModule = $(this).attr('ajax');
2018-03-02 14:33:58 +00:00
switch (ajaxModule) {
case'mZeInventory':
2020-06-23 08:49:49 +00:00
$('#mZeInventory').html('<div align="center" style="padding:10px;background-color:#d4d2d2;color:grey;"><b>Загрузка...</b></div>');
$.ajax({
url: $(this).attr('href') + '&mZeAjax=' + ajaxModule,
cache: false,
dataType: 'html',
success: function (html) {
$('#mZeInventory').html(html);
2018-03-02 14:33:58 +00:00
}
});
break;
}
return false;
}
});
});
</script>
2020-06-23 09:13:55 +00:00
<style>
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
border: 2px groove threedface;
background: #E6E6E6 !important;
}
.jGrowl .jGrowl-notification, .jGrowl div.jGrowl-closer {
margin: 10px;
}
.jGrowl div.jGrowl-notification {
min-height: 40px;
}
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
background-color: #000;
opacity: .85;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85);
zoom: 1;
width: 235px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 1em;
text-align: left;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
</style>
2020-06-23 13:13:25 +00:00
<title></title>
2018-03-02 14:33:58 +00:00
</HEAD>
<body>
<div id=hint3 class=ahint></div>
<div id="hint4" style="position: absolute;"></div>
<div id="chpassbank" style="display:none; position:absolute; top:50px; left:250px;"></div>
<FORM METHOD=POST ACTION="main.php?edit=1">
2018-12-11 17:40:12 +00:00
<table width=100%>
2018-03-02 14:33:58 +00:00
<TR>
2018-12-11 17:40:12 +00:00
<td style="vertical-align: top; width: 250px"><? showpersinv($user['id']) ?> <!-- Первый столбец -->
2018-12-11 16:23:21 +00:00
<div align="center">
2018-03-02 14:33:58 +00:00
<a href='main.php?edit=1&undress=all'>Снять все</a><BR>
<a href="javascript: void(0);" onclick="saveComplect(); return false;">Запомнить комплект</a><br/>
2018-12-11 17:40:12 +00:00
<?php
//Выгребаем все комплекты перса
$u_all_kompl = db::c()->query("SELECT `name` FROM komplekt WHERE `owner` = ?i", $user['id']);
while ($u_k = $u_all_kompl->fetch_assoc()) {
$k_name = $u_k['name'];
echo "<a onclick=\"if (!confirm('Вы уверены, что хотите удалить комплект?')) { return false; }\" href='main.php?edit=1&delcomplect=" . $k_name . "'>
2018-03-02 14:33:58 +00:00
<img src='i/clear.gif'></a>
<a href='main.php?edit=1&complect=" . $k_name . "'>Надеть \"" . $k_name . "\"</a><BR>";
2018-12-11 17:40:12 +00:00
}
?>
<div class="effectList" style="padding-top: 15px; max-height: 150px; width: 220px;">
<? echo show_eff_inf($user['id'], 2); ?>
</div>
</div>
<br>
2018-03-02 14:33:58 +00:00
</td>
2018-12-11 17:40:12 +00:00
<TD style="vertical-align: top; width: 207px"> <!-- Второй столбец -->
<div>
<br>Уровень: <b><?= $user['level'] ?></b>
<br>Опыт: <b><?= $user['exp'] ?></b> (<?= $user['nextup'] ?>)
<br>Побед: <b><?= $user['win'] ?></b>
<br>Поражений: <b><?= $user['lose'] ?></b>
<br>Ничьих: <b><?= $user['nich'] ?></b>
<br>Деньги: <b><?= $user['money'] ?></b> кр.
<br>Репутация: <b><?= $user['doblest'] ?></b> реп.
<HR>
</div>
2018-03-02 14:33:58 +00:00
<!--Параметры-->
2018-12-11 17:40:12 +00:00
<div>
<div class="container">
Сила: <?= $user['sila'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=sila'">
<?php endif; ?>
<br>
Ловкость: <?= $user['lovk'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=lovk'">
<?php endif; ?>
<br>
Интуиция: <?= $user['inta'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=inta'">
<?php endif; ?>
<br>
Выносливость: <?= $user['vinos'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=vinos'">
<?php endif; ?>
<br>
Интеллект: <?= $user['intel'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=intel'">
<?php endif; ?>
<br>
Мудрость: <?= $user['mudra'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&ups=mudra'">
<?php endif; ?>
<br>
<small style="color: darkgreen;">Возможных увеличений: <?= $user['stats'] ?></small>
<br><br>
</div>
2018-12-11 17:40:12 +00:00
<?
$mf = countmf();
$min_dmg = 0;
$max_dmg = 0;
2018-12-11 17:40:12 +00:00
$item_mf = db::c()->query('SELECT `id` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 1 AND `add_proc_mf` > 0', $_SESSION['uid'])->fetch_assoc();
$item_damage = db::c()->query('SELECT `id` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 1 AND `add_proc_uron` > 0', $_SESSION['uid'])->fetch_assoc();
$item_bron = db::c()->query('SELECT `id` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 1 AND `add_proc_bron` > 0', $_SESSION['uid'])->fetch_assoc();
if (isset($item_mf['id'])) {
$max_mf = max_mf();
$add_mf = sum_mf($user['id']);
if ($max_mf == 'fkrit') {
$var_mf = round(($mf['fkrit'] / 100) * $add_mf);
$mf['fkrit'] += $var_mf;
} elseif ($max_mf == 'fakrit') {
$var_mf = round(($mf['fakrit'] / 100) * $add_mf);
$mf['fakrit'] += $var_mf;
} elseif ($max_mf == 'fuvorot') {
$var_mf = round(($mf['fuvorot'] / 100) * $add_mf);
$mf['fuvorot'] += $var_mf;
} elseif ($max_mf == 'fauvorot') {
$var_mf = round(($mf['fauvorot'] / 100) * $add_mf);
$mf['fauvorot'] += $var_mf;
2018-12-11 17:40:12 +00:00
}
}
if (isset($item_damage['id'])) {
$add_dmg = sum_dmg($user['id']);
$min_dmg = round(($mf['minu'] / 100) * $add_dmg);
$max_dmg = round(($mf['maxu'] / 100) * $add_dmg);
}
2018-03-02 14:33:58 +00:00
if (isset($item_bron['id'])) {
$add_bron = sum_bron($user['id']);
$var_brons = bron_ads($mf['bron1'], $mf['bron2'], $mf['bron3'], $mf['bron4'], $add_bron);
} else {
2019-01-18 12:25:27 +00:00
$var_brons = ['a1' => 0, 'a2' => 0, 'a3' => 0, 'a4' => 0];
2018-12-11 17:40:12 +00:00
}
?>
2018-03-02 14:33:58 +00:00
<SPAN title='Усредненный по всем типам повреждений для вашего урона, без учета брони и защиты противника.'>Урон: <b><?= $mf['minu'] + $min_dmg ?>
- <?= $mf['maxu'] + $max_dmg ?></b> <? if (isset($item_damage['id'])) {
echo '<span style=\'color: Green;\'>(' . $add_dmg . '%)</span>';
} ?></span><br>
<SPAN title='Мф. крит. удара позволяет нанести критический удар, наносящий дополнительные повреждения даже сквозь блок.'>Шанс крита: <?= $mf['fkrit'] ?> <? if (isset($item_mf['id']) && $max_mf == 'fkrit') {
echo '<span style=\'color: Green;\'>(' . $add_mf . '%)</span>';
} ?></span><br>
<SPAN title='Мф. против крит. удара снижает вероятность получения крит. удара'>Шанс антикрита: <?= $mf['fakrit'] ?> <? if (isset($item_mf['id']) && $max_mf == 'fakrit') {
echo '<span style=\'color: Green;\'>(' . $add_mf . '%)</span>';
} ?></span><br>
<SPAN title='Мф. увертывания позволяет вам уклониться от атаки противника, полностью игнорируя ее.'>Шанс уворота: <?= $mf['fuvorot'] ?> <? if (isset($item_mf['id']) && $max_mf == 'fuvorot') {
echo '<span style=\'color: Green;\'>(' . $add_mf . '%)</span>';
} ?></span><br>
<SPAN title='Мф. против увертывания снижает шансы противника уклониться от вашей атаки'>Шанс антиуворота: <?= $mf['fauvorot'] ?> <? if (isset($item_mf['id']) && $max_mf == 'fauvorot') {
echo '<span style=\'color: Green;\'>(' . $add_mf . '%)</span>';
} ?></span><br>
<div class="container">
<b>Владение оружием:</b>
<br>Кинжалами: <?= $user['noj'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=noj'">
<?php endif; ?>
<br>Мечами: <?= $user['mec'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mec'">
<?php endif; ?>
<br>Дубинами: <?= $user['dubina'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=dubina'">
<?php endif; ?>
<br>Топорами: <?= $user['topor'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=topor'">
<?php endif; ?>
<br><br>
<b>Владение магией:</b>
<br>Магия огня: <?= $user['mfire'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mfire'">
<?php endif; ?>
<br>Магия воды: <?= $user['mwater'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mwater'">
<?php endif; ?>
<br>Магия воздуха: <?= $user['mair'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mair'">
<?php endif; ?>
<br>Магия земли: <?= $user['mearth'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mearth'">
<?php endif; ?>
<br>Магия света: <?= $user['mlight'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mlight'">
<?php endif; ?>
<br>Магия серости: <?= $user['mgray'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mgray'">
<?php endif; ?>
<br>Магия тьмы: <?= $user['mdark'] ?>
<?php if (!empty($user['stats'])): ?>
<img src=i/up.gif onclick="location.href='?edit=1&upm=mdark'">
<?php endif; ?>
<br>
<small style="color: darkgreen;">Возможных увеличений: <?= $user['master'] ?></small>
<br><br>
</div>
<div class="container">
Броня головы: <?= $mf['bron1'] + $var_brons['a1'] ?><? if (isset($item_bron['id'])) {
echo '<span style=\'color: Green;\'>(' . $add_bron . '%)</span>';
} ?><BR>
Броня корпуса: <?= $mf['bron2'] + $var_brons['a2'] ?><? if (isset($item_bron['id'])) {
echo '<span style=\'color: Green;\'>(' . $add_bron . '%)</span>';
} ?><BR>
Броня пояса: <?= $mf['bron3'] + $var_brons['a3'] ?><? if (isset($item_bron['id'])) {
echo '<span style=\'color: Green;\'>(' . $add_bron . '%)</span>';
} ?><BR>
Броня ног: <?= $mf['bron4'] + $var_brons['a4'] ?><? if (isset($item_bron['id'])) {
echo '<span style=\'color: Green;\'>(' . $add_bron . '%)</span>';
} ?><BR>
</div>
2018-03-02 14:33:58 +00:00
<?php
# Отображение (только отображение!) бонусов за количество статов.
$bonus['fkrit'] = $bonus['fakrit'] = $bonus['fuvorot'] = $bonus['fauvorot'] = $bonus['uminu'] = $bonus['umaxu'] = 0;
2018-03-02 14:33:58 +00:00
if (($user['sila']) >= 25) {
$bonus['fauvorot'] += round($user['sila'] / 3);
$bonus['fakrit'] += round($user['sila'] / 3);
}
2020-06-23 08:49:49 +00:00
// if (($user['sila']) >=100) {
// $bonus['uminu'] += round($user['sila'] / 25);
// $bonus['umaxu'] += round($bonus['uminu'] + $user['sila'] / 100);
// }
if (($user['lovk']) >= 25) {
$bonus['fuvorot'] += round($user['lovk'] / 2);
2019-09-18 09:48:30 +00:00
$bonus['fauvorot'] += round($user['lovk'] / 3);
}
if (($user['inta']) >= 25) {
$bonus['fkrit'] += round($user['inta'] / 2);
$bonus['fakrit'] += round($user['inta'] / 3);
}
2020-06-23 08:49:49 +00:00
if ($user['sila'] >= 25 || $user['lovk'] >= 25 || $user['inta'] >= 25 || $user['vinos'] >= 25) {
echo 'Бонусы за статы:<br>';
2020-06-23 08:49:49 +00:00
if (!empty($bonus['fkrit'])) {
echo "Шанс крита: +" . $bonus['fkrit'] . "<br>";
}
if (!empty($bonus['fakrit'])) {
echo "Шанс антикрита: +" . $bonus['fakrit'] . "<br />";
}
if (!empty($bonus['fuvorot'])) {
echo "Шанс уворота: +" . $bonus['fuvorot'] . "<br />";
}
if (!empty($bonus['fauvorot'])) {
echo "Шанс антиуворота: +" . $bonus['fauvorot'] . "<br />";
}
// if (!empty($bonus['uminu'])) echo "Бонус урона: +" . $bonus['uminu'] . "-" . $bonus['umaxu'];
2018-12-11 17:40:12 +00:00
}
?>
</div>
2018-03-02 14:33:58 +00:00
</TD>
<!--Меню-->
<TD valign=top>
<link rel="stylesheet" href="css/btn.css" type="text/css">
2018-03-02 14:33:58 +00:00
<div align=right class="btn-control inventory">
<FORM METHOD=POST ACTION="?edit=1" name=f1>
2020-06-23 08:49:49 +00:00
<? if ($user['shadow'] == '0.gif' || $user['admin'] == 1): ?>
2018-03-02 14:33:58 +00:00
<INPUT class="button-mid btn" TYPE="submit" name="setshadow" value="Образы" title="Образы">
<? endif; ?>
2018-03-02 14:33:58 +00:00
<INPUT class="button-mid btn" TYPE=button name=combats value="Поединки"
onClick="location.href='zayavka.php';" style="font-weight:bold;">
<INPUT class="button-mid btn" TYPE=button name=combats value="Состояние"
onClick="location.href='module_quest.php';" style="font-weight:bold;">
<INPUT class="button-mid btn" TYPE="button" onClick="location.href='main.php';" value="Вернуться"
title="Вернуться">
</div>
2018-01-28 16:40:49 +00:00
2018-03-02 14:33:58 +00:00
<div id="jGrowl" class="top-right jGrowl">
<div class="jGrowl-notification"></div>
</div>
<div id="mZeInventory">
<?php endif; ?>
<?php
2018-03-30 19:28:22 +00:00
2020-06-23 08:49:49 +00:00
if (in_array(input::get('razdel'), [0, 1, 2, 3, 4, 5])) {
$_SESSION['razdel'] = input::get('razdel');
}
2018-03-02 14:33:58 +00:00
?>
<table class="allzeroes" style="background-color: #a5a5a5;">
2018-03-02 14:33:58 +00:00
<tr>
<td>
2020-06-23 08:49:49 +00:00
<table class="allzeroes" style="background-color: #d4d2d2;">
2018-03-02 14:33:58 +00:00
<tr>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == null) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=0" ajax="mZeInventory">Амуниция</a></td>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == 1) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=1" ajax="mZeInventory">Заклинания</a></td>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == 3) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=3" ajax="mZeInventory">Ресурсы</a></td>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == 4) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=4" ajax="mZeInventory">Подарки</a></td>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == 5) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=5" ajax="mZeInventory">Квестовые вещи</a></td>
<td align=center bgcolor="<?= ($_SESSION['razdel'] == 2) ? "#A5A5A6" : "#C7C7C8" ?>"><a
href="?edit=1&razdel=2" ajax="mZeInventory">Прочее</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=center><B>Рюкзак (масса : <?= getItemsMassaInfo() ?>)</B>
2018-03-02 14:33:58 +00:00
</td>
</tr>
<tr>
<td align=center>
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
2019-01-10 00:02:03 +00:00
<?php if (!empty($user['money'])): ?>
2019-01-10 00:07:44 +00:00
<tr bgcolor="#C7C7C7">
2019-01-10 19:28:18 +00:00
<td width="100" align="center"><img src="i/sh/money-bag.png"></td>
2019-01-09 23:57:42 +00:00
<td valign="top">Мешок денег (Масса: 0)<br><b><?= $user['money'] ?> кр.</b></td>
</tr>
<?php endif;
2018-03-02 14:33:58 +00:00
if ($_SESSION['razdel'] == null) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` < 12 OR `type` = 22 OR `type` = 23 OR `type` = 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
2018-03-02 14:33:58 +00:00
}
if ($_SESSION['razdel'] == 1) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 12 AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
2018-03-02 14:33:58 +00:00
}
if ($_SESSION['razdel'] == 2) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` > 12 OR `type` != 22 OR `type` != 23 OR `type` != 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
2018-03-02 14:33:58 +00:00
}
if ($_SESSION['razdel'] == 3) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` >= 80 AND `type` <= 89 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
2018-03-02 14:33:58 +00:00
}
if ($_SESSION['razdel'] == 4) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 200 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
2018-03-02 14:33:58 +00:00
}
if ($_SESSION['razdel'] == 5) {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 199 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
2018-03-02 14:33:58 +00:00
}
2018-12-10 20:29:30 +00:00
$groupNum = [];
$viewInventory = [];
$getItems = [];
$row = [];
$iteminfo = [];
#while ($row = $data->fetch_assoc()) showitem($row, null, "edit=1&razdel=$_SESSION[razdel]");
#while ($row = $data->fetch_assoc()) showitem($row);
2020-06-23 08:49:49 +00:00
while ($row = $data->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row);
}
foreach ($iteminfo as $ii) {
echo "<tr><td width='100' align='center' bgcolor='#d3d3d3'>";
$ii->printImage();
$ii->printControls();
echo "</td>";
echo "<td valign='top' bgcolor='#d3d3d3'>";
$ii->printInfo();
echo "</td></tr>";
}
2018-03-02 14:33:58 +00:00
if ($viewInventory and $getItems) {
foreach ($viewInventory as $viewCategiryes) {
echo $viewCategiryes['header'];
foreach ($viewCategiryes['ids'] as $viewItem) {
echo $getItems[$viewItem];
}
echo $viewCategiryes['fooder'];
}
}
2020-06-23 08:49:49 +00:00
if ($data->getNumRows() == 0) {
echo "<tr><th colspan='3' align=center bgcolor=#C7C7C7>Пусто</th></tr>";
}
2018-03-02 14:33:58 +00:00
?>
</table>
</td>
</tr>
</table>
2019-01-18 12:25:27 +00:00
<?php if (!in_array(input::get('mZeAjax'), ['mZeInventory', 'mZeFilter'])): ?>
2018-03-02 14:33:58 +00:00
</div>
</td>
</form>
</tr>
</table>
2018-03-30 18:40:55 +00:00
2018-03-02 14:33:58 +00:00
</body>
</html>
<?php
2018-03-02 14:33:58 +00:00
endif;
die();
2018-01-28 16:40:49 +00:00
}
?>
2019-09-17 14:37:44 +00:00
<HTML lang="ru">
2018-03-02 14:33:58 +00:00
<HEAD>
2018-03-08 22:14:29 +00:00
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/btn.css">
<meta charset="utf-8">
<link rel="stylesheet" href="css/tooltip.css">
<script src="js/jquery-1.7.2.min.js"></script>
2018-03-02 14:33:58 +00:00
<script src="js/tooltip.js"></script>
<script>
$(function () {
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
});
</script>
<script>
2020-06-23 09:13:55 +00:00
let Hint3Name = '';
2018-03-02 14:33:58 +00:00
// Заголовок, название скрипта, имя поля с логином
function findlogin(title, script, name) {
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
2018-03-02 14:33:58 +00:00
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2>' +
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100';
document.getElementById(name).focus();
2018-03-02 14:33:58 +00:00
Hint3Name = name;
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
// Заголовок, название скрипта, имя поля с шмоткой
2019-09-17 15:15:17 +00:00
function okno(title, script, name) {
2020-06-23 09:13:55 +00:00
const errkom = '';
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
2020-06-23 09:13:55 +00:00
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
errkom + '</span>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100';
document.getElementById(name).focus();
2018-03-02 14:33:58 +00:00
Hint3Name = name;
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
function closehint3() {
2019-09-17 15:15:17 +00:00
document.getElementById("hint3").style.visibility = "hidden";
2018-03-02 14:33:58 +00:00
Hint3Name = '';
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
2020-06-23 09:13:55 +00:00
const delay = 30;
let TimerOn = -1, tkHP, maxHP, speed = 750;
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
2018-03-02 14:33:58 +00:00
function setHP(a, b, c) {
tkHP = a;
maxHP = b;
TimerOn >= 0 && (clearTimeout(TimerOn), TimerOn = -1);
speed = c;
setHPlocal()
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
function setHPlocal() {
tkHP > maxHP && (tkHP = maxHP);
2020-06-23 13:13:25 +00:00
let a = Math.round(tkHP) + "/" + maxHP;
2020-06-23 09:13:55 +00:00
a = stLen - (a.length + 2) * 7;
2020-06-23 13:13:25 +00:00
const b = Math.round((a - 1) / maxHP * tkHP);
2018-03-02 14:33:58 +00:00
a -= b;
2020-06-23 13:13:25 +00:00
const HP = document.getElementById("hp_value");
const HP1 = document.getElementById("HP1");
const HP2 = document.getElementById("HP2");
2018-03-02 14:33:58 +00:00
if (HP) {
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
tkHP += maxHP / 53 / 230 * (speed / 100);
TimerOn = tkHP < maxHP ? setTimeout("setHPlocal()", delay * 100) : -1
2018-01-28 16:40:49 +00:00
}
2018-03-02 14:33:58 +00:00
</script>
2019-09-17 14:37:44 +00:00
<title></title>
2018-01-28 16:40:49 +00:00
</HEAD>
2018-03-02 14:33:58 +00:00
<body onLoad="<?= topsethp(); ?>">
2019-09-17 14:37:44 +00:00
<?php $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60)); ?>
2018-01-28 16:40:49 +00:00
<div id=hint3 class=ahint></div>
<table class="allzeroes">
2018-03-02 14:33:58 +00:00
<tr>
<td style="width:250px;">
2018-03-08 21:53:15 +00:00
<?php showpersout(); ?>
2018-03-02 14:33:58 +00:00
</td>
<td>&nbsp;</td>
<TD style="text-align: right;">
2020-06-23 08:49:49 +00:00
<div class="hint-text">Сейчас в игре: <strong><?= $online->getNumRows() ?></strong> чел.</div>
<button onclick="gotohref('zayavka.php')">Поединки</button>
<br>
<button onclick="gotohref('main.php?edit=1')">Инвентарь</button>
<br>
<button onclick="gotohref('module_quest.php')">Активные задания</button>
<br>
<?php if ($user['room'] === 20): ?>
<button onclick="gotohref('main.php?goto=arena')">Войти внутрь</button><br>
<?php else: ?>
<button onclick="gotohref('main.php?goto=plo')">Выйти на улицу</button><br>
2020-06-23 08:49:49 +00:00
<?php endif; ?>
2019-09-17 15:15:17 +00:00
<button onclick="gotohref('main.php')">Обновить страницу</button>
2018-03-02 14:33:58 +00:00
</TD>
</tr>
2018-01-28 16:40:49 +00:00
</table>
<script>
function gotohref(filename) {
location.href = filename;
}
</script>
2018-01-28 16:40:49 +00:00
</BODY>
2020-06-23 14:43:14 +00:00
</HTML>
<?= 'main.php.end'; ?>