2018-01-28 16:40:49 +00:00
< ? php
2020-06-23 19:34:52 +00:00
ob_start ( " ob_gzhandler " );
2018-01-28 16:40:49 +00:00
session_start ();
2019-02-15 22:31:18 +00:00
$get = filter_input ( INPUT_SERVER , 'QUERY_STRING' );
2019-09-16 14:45:07 +00:00
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 19:34:52 +00:00
2020-06-23 18:19:52 +00:00
require_once 'functions.php' ;
2020-06-23 19:34:52 +00:00
2018-01-28 16:40:49 +00:00
$tmaz = time ();
2020-06-23 13:13:25 +00:00
try {
2020-07-06 07:13:14 +00:00
db :: c () -> query ( 'UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i' , time (), $user [ 'id' ]);
2020-06-23 13:13:25 +00:00
} catch ( \Krugozor\Database\Mysql\Exception $e ) {
2020-07-06 13:54:51 +00:00
echo " <div class='debug' '>Ошибка: " . $e -> getMessage () . " <br> Стек: " . $e -> getTraceAsString () . " </div> " ;
2018-03-02 14:33:58 +00:00
}
2020-07-06 19:54:50 +00:00
if ( ! empty ( $user [ 'battle' ])) {
2020-07-06 20:17:49 +00:00
header ( 'location: fbattle.php' );
die ();
}
2020-07-06 19:54:50 +00:00
//БС
2020-07-21 15:57:15 +00:00
if ( isset ( $user [ 'in_tower' ]) && $user [ 'in_tower' ] == 1 ) {
2020-07-06 19:54:50 +00:00
header ( 'Location: towerin.php' );
die ();
}
2018-01-28 16:40:49 +00:00
2019-09-18 14:06:05 +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 ();
}
2020-07-06 13:54:51 +00:00
2019-09-18 14:06:05 +00:00
//Храм древнх
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 ();
}
2018-07-02 15:35:25 +00:00
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 );
2020-07-06 15:21:52 +00:00
if ( $sum -> fetch_assoc () > 0 ) {
return $sum ;
} else {
return 0 ;
}
2020-06-23 13:13:25 +00:00
} catch ( \Krugozor\Database\Mysql\Exception $e ) {
echo " <div style='background-color: #ffaaaa;'>Ошибка: " . $e -> getMessage () . " <br> В файле: " . $e -> getFile () . " ( " . $e -> getLine () . " )</div> " ;
}
2018-07-02 15:35:25 +00:00
}
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 );
2020-07-06 15:21:52 +00:00
if ( $sum -> fetch_assoc () > 0 ) {
return $sum ;
} else {
return 0 ;
}
2020-06-23 13:13:25 +00:00
} catch ( \Krugozor\Database\Mysql\Exception $e ) {
echo " <div style='background-color: #ffaaaa;'>Ошибка: " . $e -> getMessage () . " <br> В файле: " . $e -> getFile () . " ( " . $e -> getLine () . " )</div> " ;
}
2018-07-02 15:35:25 +00:00
}
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 )];
2018-07-02 15:35:25 +00:00
}
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 ();
2018-07-02 15:35:25 +00:00
$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 ();
2020-07-06 19:54:50 +00:00
} catch ( \Krugozor\Database\Mysql\Exception $e ) {
2020-06-23 13:31:58 +00:00
echo " <div style='background-color: #ffaaaa;'>Ошибка: " . $e -> getMessage () . " <br> В файле: " . $e -> getFile () . " ( " . $e -> getLine () . " )</div> " ;
}
2018-07-02 15:35:25 +00:00
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' ]);
2018-07-02 15:35:25 +00:00
} else {
2018-12-12 20:50:32 +00:00
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 " );
2018-07-02 15:35:25 +00:00
}
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 ;
}
2018-07-02 15:35:25 +00:00
}
2020-07-06 19:02:04 +00:00
//FIXME id and uid together???
2018-07-02 15:35:25 +00:00
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 )) {
2020-07-06 19:02:04 +00:00
db :: c () -> query ( 'DELETE FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i' , $uid , $id );
2020-06-23 08:49:49 +00:00
if ( $type == 1022 ) {
db :: c () -> query ( 'UPDATE `users` SET `invis` = ?i WHERE `id` = ?i' , 0 , $uid );
$user [ 'invis' ] = 0 ;
2018-07-02 15:35:25 +00:00
}
2020-06-23 08:49:49 +00:00
err ( 'Эффект удалён.' );
} else {
err ( 'Данный эффект нельзя удалить.' );
2018-07-02 15:35:25 +00:00
}
}
}
// одеть предмет
function dressitem ( $id )
{
2020-08-29 12:25:07 +00:00
//FIXME Предметы не должны одеваться, если не соответствуют требованиям!
2020-08-29 11:15:29 +00:00
define ( 'HELMET' , 1 );
define ( 'ARMOR' , 2 );
define ( 'LEGS' , 3 );
define ( 'BOOTS' , 4 );
define ( 'GLOVES' , 5 );
define ( 'WEAPON' , 6 );
define ( 'SHIELD' , 7 );
define ( 'BELT' , 8 );
define ( 'RING' , 9 );
define ( 'AMULET' , 10 );
define ( 'ERROR_TOO_MANY_ITEMS_IN_SLOTS' , 'Критическая ошибка: Переполнение слота!' );
define ( 'ERROR_UNKNOWN_ITEM_TYPE' , 'Неизвестный тип предмета!' );
define ( 'ERROR_ITEM_NOT_FOUND' , 'Предмет не найден!' );
2020-07-22 14:04:15 +00:00
2020-08-29 11:15:29 +00:00
$selectedItemRow = db :: c () -> query ( 'SELECT item_type FROM `inventory` WHERE item_id = ?i AND owner_id = ?i AND `dressed_slot` = 0' , $id , $_SESSION [ 'uid' ]);
if ( $selectedItemRow -> getNumRows ()) {
$selectedItem = $selectedItemRow -> fetch_object ();
$itemInSlotRow = db :: c () -> query ( 'SELECT dressed_slot FROM inventory WHERE owner_id = ?i AND dressed_slot > 0 AND item_type = ?i' , $_SESSION [ 'uid' ], $selectedItem -> item_type );
$itemInSlotQuantity = $itemInSlotRow -> getNumRows ();
if ( $itemInSlotQuantity ) {
$itemInSlot = $itemInSlotRow -> fetch_assoc ();
2018-07-02 15:35:25 +00:00
}
2020-08-29 11:15:29 +00:00
if ( in_array ( $selectedItem -> item_type ,[ HELMET , ARMOR , LEGS , BOOTS , GLOVES , WEAPON , SHIELD , BELT , AMULET ])) {
//работаем с нормальными слотами
if ( ! $itemInSlotQuantity ) {
// просто одеваем предмет
2020-08-29 11:50:16 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i' , $id );
2020-08-29 11:15:29 +00:00
} elseif ( $itemInSlotQuantity === 1 ) {
// снимаем предмет и одеваем вместо
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i' , $itemInSlot [ 'dressed_slot' ]);
2020-08-29 11:50:16 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i' , $id );
2020-08-29 11:15:29 +00:00
} else {
// невозможная ситуация - два предмета в одиночном слоте. критическая ошибка, запись в лог, раздевание.
$error = ERROR_TOO_MANY_ITEMS_IN_SLOTS ;
2020-08-29 11:47:42 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i' , $_SESSION [ 'uid' ]);
2020-08-29 11:15:29 +00:00
}
2020-08-29 13:02:52 +00:00
} elseif ( $selectedItem -> item_type == RING ) {
2020-08-29 11:15:29 +00:00
// работаем с кольцами
if ( ! $itemInSlotQuantity ) {
// просто одеваем предмет в слот 9
2020-08-29 11:50:16 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 9 WHERE item_id = ?i' , $id );
2020-08-29 11:15:29 +00:00
} elseif ( $itemInSlotQuantity > 0 && $itemInSlotQuantity < 3 ) {
// Сравниваем массив колец и массив слотов для колец.
$emptyRingSlots = array_diff ([ 9 , 10 , 11 ], $itemInSlot );
// Сортируем массив свободных слотов по возрастанию.
sort ( $emptyRingSlots );
// Одеваем предмет в первый свободный слот.
2020-08-29 11:50:16 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i' , $emptyRingSlots [ 0 ], $id );
2020-08-29 11:15:29 +00:00
} elseif ( $itemInSlotQuantity === 3 ) {
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11' );
2020-08-29 11:50:16 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i' , $id );
2020-08-29 11:15:29 +00:00
// снимаем предмет из слота 11 и одеваем вместо
} else {
// невозможная ситуация - больше трёх предметов на три слота. критическая ошибка, запись в лог, раздевание.
$error = ERROR_TOO_MANY_ITEMS_IN_SLOTS ;
2020-08-29 11:47:42 +00:00
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i' , $_SESSION [ 'uid' ]);
2020-08-29 11:15:29 +00:00
}
2020-06-23 08:49:49 +00:00
} else {
2020-08-29 11:15:29 +00:00
//предмет вообще не должен одеваться, ошибка
$error = ERROR_UNKNOWN_ITEM_TYPE ;
2018-07-02 15:35:25 +00:00
}
2020-06-23 08:49:49 +00:00
} else {
2020-08-29 11:15:29 +00:00
//с предметом что-то сильно не ок, ошибка.
$error = ERROR_ITEM_NOT_FOUND ;
2020-06-23 08:49:49 +00:00
}
2018-07-02 15:35:25 +00:00
2020-08-29 11:15:29 +00:00
if ( isset ( $error )) {
return $error ;
2020-06-23 08:49:49 +00:00
} else {
2020-08-29 13:02:52 +00:00
return null ;
2020-06-23 08:49:49 +00:00
}
2018-07-02 15:35:25 +00:00
}
2020-08-29 11:47:42 +00:00
function undressallself ()
{
db :: c () -> query ( 'UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i' , $_SESSION [ 'uid' ]);
}
2019-09-17 14:37:44 +00:00
// Входим и выходим если можем.
if ( isset ( $_GET [ 'goto' ])) {
$imove = true ;
2020-07-21 11:52:39 +00:00
$d = db :: c () -> query ( 'SELECT SUM(`weight`) AS `sum_weight` FROM `inventory` WHERE `owner` = ?i AND `on_sale` = 0' , $user [ 'id' ]) -> fetch_assoc ();
2020-07-06 19:02:04 +00:00
$eff = db :: c () -> query ( 'SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)' , $user [ 'id' ]);
2020-07-21 11:52:39 +00:00
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . $showUser->strength * 4
if ( $d [ 'sum_weight' ] > $user [ 'strength' ] * 4 && $_GET [ 'got' ]) {
2019-09-17 14:37:44 +00:00
err ( 'У вас переполнен рюкзак, вы не можете передвигаться...' );
$imove = false ;
}
2020-07-06 19:02:04 +00:00
if ( $eff -> getNumRows () && $_GET [ 'got' ]) {
2019-09-17 14:37:44 +00:00
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' ]);
}
2018-12-11 14:26:27 +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 " ];
2018-12-11 13:00:16 +00:00
$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 = [
2018-03-30 20:21:35 +00:00
'm01' , 'm02' , 'm03' , 'm04' , 'm05' , 'm06' , 'm07' , 'm08' , 'm09' , 'm10' ,
'f01' , 'f02' , 'f03' , 'f04' , 'f05' , 'f06' , 'f07' , 'f08' , 'f09' , 'f10' ,
2020-07-06 19:54:50 +00:00
'person' ,
2018-03-23 20:36:35 +00:00
];
2018-03-30 20:21:35 +00:00
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
}
2018-03-30 20:21:35 +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 ) {
2020-07-06 19:02:04 +00:00
$pl = db :: c () -> query ( 'SELECT `id`, `type` FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i' , $user [ 'id' ], ( int ) $_GET [ 'efid' ]) -> fetch_assoc ();
2020-06-23 08:49:49 +00:00
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 ();
2020-07-06 19:54:50 +00:00
} catch ( \Krugozor\Database\Mysql\Exception $e ) {
2020-06-23 13:31:58 +00:00
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
}
}
2018-03-30 20:21:35 +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 " >
2018-03-30 20:21:35 +00:00
< 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 >
2018-03-30 20:21:35 +00:00
</ head >
2018-03-02 15:31:43 +00:00
< body >
2020-07-21 09:20:44 +00:00
< div style = " text-align: right; " >
< input type = button value = " Вернуться " onClick = " location.href='main.php?edit=<?= mt_rand() ?>'; " >
</ div >
2018-03-30 20:21:35 +00:00
< table style = " padding:5px; margin:auto; " >
2020-07-21 09:20:44 +00:00
< caption >< b style = " color: red; " > Внимание ! Образ персонажа выбирается только один раз .</ b ></ caption >
2018-03-30 20:21:35 +00:00
< tr >
2020-07-21 09:20:44 +00:00
< td >< a href = " ?edit=1&obraz=m1 " >< img alt = " m01 " src = " i/shadow/m1.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m2 " >< img alt = " m02 " src = " i/shadow/m2.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m3 " >< img alt = " m03 " src = " i/shadow/m3.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m4 " >< img alt = " m04 " src = " i/shadow/m4.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m5 " >< img alt = " m05 " src = " i/shadow/m5.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m6 " >< img alt = " m06 " src = " i/shadow/m6.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m7 " >< img alt = " m07 " src = " i/shadow/m7.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m8 " >< img alt = " m08 " src = " i/shadow/m8.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m9 " >< img alt = " m09 " src = " i/shadow/m9.gif " ></ a >
< td >< a href = " ?edit=1&obraz=m10 " >< img alt = " m10 " src = " i/shadow/m10.gif " ></ a >
2018-03-30 20:21:35 +00:00
< tr >
2020-07-21 09:20:44 +00:00
< td >< a href = " ?edit=1&obraz=f1 " >< img alt = " f01 " src = " i/shadow/f1.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f2 " >< img alt = " f02 " src = " i/shadow/f2.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f3 " >< img alt = " f03 " src = " i/shadow/f3.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f4 " >< img alt = " f04 " src = " i/shadow/f4.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f5 " >< img alt = " f05 " src = " i/shadow/f5.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f6 " >< img alt = " f06 " src = " i/shadow/f6.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f7 " >< img alt = " f07 " src = " i/shadow/f7.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f8 " >< img alt = " f08 " src = " i/shadow/f8.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f9 " >< img alt = " f09 " src = " i/shadow/f9.gif " ></ a >
< td >< a href = " ?edit=1&obraz=f10 " >< img alt = " f10 " src = " i/shadow/f10.gif " ></ a >
2018-03-02 14:33:58 +00:00
</ table >
</ body >
</ html >
< ? php
die ();
}
2020-07-21 15:03:46 +00:00
if ( isset ( $_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' );
}
2018-12-11 20:46:44 +00:00
2020-07-21 15:03:46 +00:00
if ( isset ( $_GET [ 'drop' ])) {
$items = new DressedItems ( $_SESSION [ 'uid' ]);
$items -> undressItem ( $_GET [ 'drop' ]);
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
2020-08-29 11:34:09 +00:00
//Пока что одеваем предмет отсюда.
2020-07-22 14:04:15 +00:00
if ( isset ( $_GET [ 'dress' ])) {
2020-08-29 12:52:09 +00:00
echo dressitem ( $_GET [ 'dress' ]);
2018-03-02 14:33:58 +00:00
}
2018-01-28 16:40:49 +00:00
2018-12-11 13:00:16 +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
2018-12-11 13:00:16 +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
2018-12-11 13:00:16 +00:00
if ( input :: get ( 'undress' )) {
2020-08-29 11:47:42 +00:00
undressallself ();
2018-03-02 14:33:58 +00:00
}
2020-07-21 15:57:15 +00:00
}
2018-03-02 14:33:58 +00:00
2020-07-21 15:57:15 +00:00
?>
2018-03-02 14:33:58 +00:00
2020-07-21 15:57:15 +00:00
<! doctype html >
< HTML lang = " ru " >
< HEAD >
< meta charset = " utf-8 " >
< link rel = " stylesheet " href = " css/main.css " >
< link rel = " stylesheet " href = " css/tooltip.css " >
< link rel = " stylesheet " href = " css/btn.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 src = " js/funcs.js " ></ script >
< script >
$ ( function () {
$ ( " .tooltip " ) . tipTip ({ maxWidth : " auto " , edgeOffset : 0 , fadeIn : 300 , fadeOut : 500 });
});
2018-03-02 14:33:58 +00:00
2020-07-21 15:57:15 +00:00
function gotohref ( filename ) {
location . href = filename ;
}
2018-03-02 14:33:58 +00:00
2020-07-21 15:57:15 +00:00
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-07-06 19:54:50 +00:00
2020-07-21 15:57:15 +00:00
let Hint3Name = '' ;
2020-07-06 19:54:50 +00:00
2020-07-21 15:57:15 +00:00
function okno ( title , script , name , coma , errk ) {
let errkom = '' ;
let com = '' ;
if ( errk === 1 ) {
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>' ;
com = coma
}
if ( errk === 2 ) {
errkom = 'Такой комплект уже существует<br>' ;
com = coma
}
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>' +
'<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>' ;
document . getElementById ( " hint3 " ) . style . visibility = " visible " ;
document . getElementById ( " hint3 " ) . style . left = '100' ;
document . getElementById ( " hint3 " ) . style . top = '100' ;
document . getElementById ( name ) . focus ();
Hint3Name = name ;
}
const delay = 30 ;
let TimerOn = - 1 , tkHP , maxHP , speed = 750 ;
const stLen = 185 , redHP = 0.33 , yellowHP = 0.66 ;
function setHPlocal () {
tkHP > maxHP && ( tkHP = maxHP );
let a = Math . round ( tkHP ) + " / " + maxHP ;
a = stLen - ( a . length + 2 ) * 7 ;
const b = Math . round (( a - 1 ) / maxHP * tkHP );
a -= b ;
const HP = document . getElementById ( " hp_value " );
const HP1 = document . getElementById ( " HP1 " );
const HP2 = document . getElementById ( " HP2 " );
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
}
2020-07-06 19:54:50 +00:00
2020-07-21 15:57:15 +00:00
$ ( document ) . ready ( function () {
$ ( 'a' ) . live ( 'click' , function () {
if ( $ ( this ) . attr ( 'ajax' ) !== undefined ) {
const ajaxModule = $ ( this ) . attr ( 'ajax' );
switch ( ajaxModule ) {
case 'mZeInventory' :
$ ( '#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 );
}
});
break ;
}
return false ;
2020-06-23 09:13:55 +00:00
}
2020-07-21 15:57:15 +00:00
});
});
</ script >
< title > Окно игры </ title >
</ HEAD >
< body >
< ? php
try {
$online = db :: c () -> query ( 'SELECT 1 FROM `online` WHERE `real_time` >= ?i' , ( time () - 60 ));
} catch ( Exception $e ) {
echo '<div class="debug">В таблице online нет ячейки real_time так как неясно что она делает. Ошибка обращения в базу.</div>' ;
}
?>
< 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 >
< table width = 100 %>
< TR >
< td style = " vertical-align: top; width: 350px " >
2020-07-06 15:21:52 +00:00
< ? php
$showUser = new User ( $_SESSION [ 'uid' ]);
2020-07-20 12:10:48 +00:00
$getItemsBonuses = new DressedItems ( $_SESSION [ 'uid' ]);
2020-07-06 19:54:50 +00:00
$showUser -> showUserDoll ( 0 , 1 );
2020-07-06 15:21:52 +00:00
?> <!-- Первый столбец -->
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 >
2018-12-11 17:40:12 +00:00
< div class = " effectList " style = " padding-top: 15px; max-height: 150px; width: 220px; " >
2020-08-29 11:47:42 +00:00
< ? = show_eff_inf ( $user [ 'id' ], 2 ) ?>
2018-12-11 17:40:12 +00:00
</ div >
</ div >
< br >
2018-03-02 14:33:58 +00:00
</ td >
2020-07-21 15:57:15 +00:00
< td style = " vertical-align: top; width: 250px " > <!-- Второй столбец -->
2018-12-11 17:40:12 +00:00
< div >
2020-07-06 15:21:52 +00:00
< br > Уровень : < strong >< ? = $showUser -> level ?> </strong>
< br > Опыт : < strong >< ? = $showUser -> experience ?> </strong>
< br > Побед : < strong >< ? = 'нет поля' ?> </strong>
< br > Поражений : < strong >< ? = 'нет поля' ?> </strong>
< br > Ничьих : < strong >< ? = 'нет поля' ?> </strong>
< br > Деньги : < strong >< ? = $showUser -> money ?> </strong> кр.
2018-12-11 17:40:12 +00:00
< HR >
</ div >
2018-03-02 14:33:58 +00:00
<!-- Параметры -->
2018-12-11 17:40:12 +00:00
< div >
2018-12-11 22:26:21 +00:00
< div class = " container " >
2020-07-22 14:04:15 +00:00
2020-07-22 14:24:06 +00:00
Сила : < ? = ( $showUser -> free_stat_points ? $showUser -> getStrength ( 1 ) . '(' . strval ( $showUser -> strength + $getItemsBonuses -> getStrengthBonus ()) . ')' : $showUser -> strength + $getItemsBonuses -> getStrengthBonus ()) ?>
2020-07-22 14:08:40 +00:00
< br >
2020-07-22 14:24:06 +00:00
Ловкость : < ? = ( $showUser -> free_stat_points ? $showUser -> getDexterity ( 1 ) . '(' . strval ( $showUser -> dexterity + $getItemsBonuses -> getDexterityBonus ()) . ')' : $showUser -> dexterity + $getItemsBonuses -> getDexterityBonus ()) ?>
2020-07-21 15:57:15 +00:00
< br >
2020-07-22 14:24:06 +00:00
Интуиция : < ? = ( $showUser -> free_stat_points ? $showUser -> getIntuition ( 1 ) . '(' . strval ( $showUser -> intuition + $getItemsBonuses -> getIntuitionBonus ()) . ')' : $showUser -> intuition + $getItemsBonuses -> getIntuitionBonus ()) ?>
2020-07-21 15:57:15 +00:00
< br >
2020-07-22 14:24:06 +00:00
Выносливость : < ? = ( $showUser -> free_stat_points ? $showUser -> getEndurance ( 1 ) . '(' . strval ( $showUser -> endurance + $getItemsBonuses -> getEnduranceBonus ()) . ')' : $showUser -> endurance + $getItemsBonuses -> getEnduranceBonus ()) ?>
2020-07-22 14:18:25 +00:00
< br >
2020-07-22 14:24:06 +00:00
Интеллект : < ? = ( $showUser -> free_stat_points ? $showUser -> getIntelligence ( 1 ) . '(' . strval ( $showUser -> intelligence + $getItemsBonuses -> getIntelliganceBonus ()) . ')' : $showUser -> intelligence + $getItemsBonuses -> getIntelliganceBonus ()) ?>
2020-07-22 14:18:25 +00:00
< br >
2020-07-22 14:27:52 +00:00
Мудрость : < ? = ( $showUser -> free_stat_points ? $showUser -> getWisdom ( 1 ) . '(' . strval ( $showUser -> wisdom + $getItemsBonuses -> getWisdomBonus ()) . ')' : $showUser -> wisdom + $getItemsBonuses -> getWisdomBonus ()) ?> <br>
2020-07-22 14:08:40 +00:00
< ? php if ( $showUser -> free_stat_points ) : ?>
< small style = " color: darkgreen; " > Возможных
увеличений : < ? = $showUser -> free_stat_points ?> </small><br>
< ? php endif ; ?>
2020-07-20 13:27:32 +00:00
< br >
2020-07-20 12:07:49 +00:00
Здоровье : < ? = $showUser -> getHealth () ?> <br>
2020-08-29 12:42:08 +00:00
Уворот : < ? = $getItemsBonuses -> getEvasionBonus () ?> <br>
Точность : < ? = $getItemsBonuses -> getAccuracyBonus () ?> <br>
Шанс крита : < ? = $getItemsBonuses -> getCriticalsBonus () ?> <br>
2020-08-29 12:15:31 +00:00
Урон : < ? = $showUser -> minDamage + $getItemsBonuses -> getMinPhysDamage () ?> - <?= $showUser->maxDamage + $getItemsBonuses->getMaxPhysDamage()?> <br>
2018-12-11 21:03:48 +00:00
< br >
2020-07-20 13:44:31 +00:00
< div style = " color: gray; " >
2020-07-20 13:27:32 +00:00
Защита от огня : ? ? < br >
Защита от воды : ? ? < br >
Защита от вохдуха : ? ? < br >
Защита от земли : ? ? < br >
Защита от яда : ? ? < br >
</ div >
Броня головы : < ? = $showUser -> headArmor ?> <br>
Броня корпуса : < ? = $showUser -> chestArmor ?> <br>
Броня ног : < ? = $showUser -> legArmor ?> <br>
2018-12-11 22:26:21 +00:00
</ div >
2019-09-17 13:46:18 +00:00
2018-12-11 17:40:12 +00:00
</ div >
2020-07-21 15:57:15 +00:00
</ td >
< td valign = top >
2020-07-22 08:43:14 +00:00
< div class = " button-container " > <!-- Меню - кнопки -->
2020-07-21 15:57:15 +00:00
< FORM METHOD = POST ACTION = " ?edit=1 " name = f1 >
< ? php if ( $user [ 'shadow' ] == '0.gif' || $user [ 'admin' ] == 1 ) : ?>
2020-07-22 14:08:40 +00:00
< INPUT class = " button primary icon user " TYPE = " submit " name = " setshadow " value = " Образы "
title = " Образы " >
2020-07-21 15:57:15 +00:00
< ? php endif ; ?>
2020-07-22 08:43:14 +00:00
< div class = " button-group " >
< button class = " button primary " onclick = " gotohref('zayavka.php') " > Поединки </ button >
< button class = " button " onclick = " gotohref('module_quest.php') " > Активные задания </ button >
< button class = " button " onclick = " gotohref('main.php?edit=1') " > Инвентарь </ button >
< ? php if ( $user [ 'room' ] === 20 ) : ?>
2020-07-22 09:01:45 +00:00
< button class = " button icon move " onclick = " gotohref('main.php?goto=arena') " > Войти внутрь
2020-07-22 08:43:14 +00:00
</ button >
< ? php else : ?>
2020-07-22 09:01:45 +00:00
< button class = " button icon move " onclick = " gotohref('main.php?goto=plo') " > Выйти на улицу
2020-07-22 08:43:14 +00:00
</ button >
< ? php endif ; ?>
2020-07-22 09:01:45 +00:00
< button class = " button icon loop " onclick = " gotohref('main.php') " > Обновить страницу </ button >
2020-07-22 08:43:14 +00:00
</ div >
2020-07-21 15:57:15 +00:00
</ div >
< div id = " mZeInventory " > <!-- рюкзак -->
2018-03-02 14:33:58 +00:00
< table BORDER = 0 WIDTH = 100 % CELLSPACING = " 1 " CELLPADDING = " 2 " BGCOLOR = " #A5A5A5 " >
2020-07-21 15:57:15 +00:00
< caption > Рюкзак
2020-07-22 14:04:15 +00:00
( масса : < ? = '?? /' . $showUser -> strength * 4 ?> )
2020-07-21 15:57:15 +00:00
</ caption >
< ? php
2020-07-21 09:49:26 +00:00
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0' ;
2020-07-20 15:06:18 +00:00
$data = db :: c () -> query ( $data_query , $_SESSION [ 'uid' ]);
2019-02-12 18:31:23 +00:00
2018-12-10 20:29:30 +00:00
$groupNum = [];
$viewInventory = [];
$getItems = [];
$row = [];
2019-09-16 14:45:07 +00:00
$iteminfo = [];
2020-06-23 08:49:49 +00:00
while ( $row = $data -> fetch_assoc ()) {
2020-07-21 15:57:15 +00:00
//FIXME Какая-то хуета. Зачем я каждый прежмет делал новым классом?
2020-06-23 08:49:49 +00:00
$iteminfo [] = new InventoryItem ( $row );
}
2019-02-12 18:31:23 +00:00
foreach ( $iteminfo as $ii ) {
2019-02-13 10:46:39 +00:00
echo " <tr><td width='100' align='center' bgcolor='#d3d3d3'> " ;
2019-02-12 18:31:23 +00:00
$ii -> printImage ();
$ii -> printControls ();
2019-02-13 10:46:39 +00:00
echo " <td valign='top' bgcolor='#d3d3d3'> " ;
2019-02-12 18:31:23 +00:00
$ii -> printInfo ();
}
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 ) {
2020-07-21 09:20:44 +00:00
echo " <tr><th colspan='3' align=center bgcolor=#C7C7C7>Пусто " ;
2020-06-23 08:49:49 +00:00
}
2018-03-02 14:33:58 +00:00
?>
</ table >
2020-07-06 19:54:50 +00:00
</ div >
2020-07-21 15:57:15 +00:00
</ td >
2018-03-02 14:33:58 +00:00
</ tr >
2018-01-28 16:40:49 +00:00
</ table >
2020-07-21 15:57:15 +00:00
</ body >
</ html >