2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
if ( ! defined ( 'GAME' )) { die (); }
if ( $u -> room [ 'file' ] == 'bsenter' ) {
$r = 2 ;
if ( isset ( $_GET [ 'r' ])) {
$_GET [ 'r' ] = ( int ) $_GET [ 'r' ];
if ( $_GET [ 'r' ] == 7 || $_GET [ 'r' ] == 8 || $_GET [ 'r' ] == 9 || $_GET [ 'r' ] == 10 || $_GET [ 'r' ] == 11 ) { $r = round ( $_GET [ 'r' ] - 6 ); }
if ( $u -> info [ 'level' ] < $r + 6 ) { $r = 1 ; }
}
function changeSleep ( $uid , $sleep_action ){
global $u ;
if ( $sleep_action == 1 ){
//
mysql_query ( 'INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time () . '","1")' );
//
mysql_query ( " UPDATE `eff_users` SET `sleeptime`= " . time () . " ,`deactiveLast` = ( `deactiveTime` - " . time () . " ) WHERE `uid`=' " . mysql_real_escape_string ( $uid ) . " ' AND `no_Ace` = 0 AND `delete` = 0 " );
mysql_query ( 'UPDATE `items_users` SET `time_sleep` = "' . time () . '" WHERE `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"' );
$u -> addAction ( time (), 'sleep' , $u -> info [ 'city' ]);
//
} elseif ( $sleep_action == 2 ){
//
mysql_query ( 'INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time () . '","2")' );
//
$sp = mysql_query ( 'SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"' );
while ( $pl = mysql_fetch_array ( $sp ) ) {
$tm_add = time () - $pl [ 'time_sleep' ];
mysql_query ( 'UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "' . ( $pl [ 'time_create' ] + $tm_add ) . '" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
}
$sp = mysql_query ( 'SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "' . $uid . '" ORDER BY `timeUse` DESC' );
while ( $pl = mysql_fetch_array ( $sp )) {
mysql_query ( " UPDATE `eff_users` SET `deactiveTime` = " . ( time () + $pl [ 'deactiveLast' ]) . " WHERE `id`=' " . $pl [ 'id' ] . " ' " );
}
$sp = mysql_query ( 'SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="' . mysql_real_escape_string ( $uid ) . '" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0' );
while ( $pl = mysql_fetch_array ( $sp )) {
$timeUsen = time () - ( $pl [ 'sleeptime' ] - $pl [ 'timeUse' ]);
mysql_query ( " UPDATE `eff_users` SET `timeUse`=' " . $timeUsen . " ',`sleeptime`='0' WHERE `id`=' " . $pl [ 'id' ] . " ' " );
}
mysql_query ( 'UPDATE `actions` SET `vars` = "unsleep",`val` = "' . time () . '" WHERE `id` = "' . $sleep [ 'id' ] . '" LIMIT 1' );
}
//$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$uid.'" LIMIT 1', 1);
}
2023-01-10 16:29:32 +00:00
//Разморозка эффектов
2022-06-06 21:30:34 +00:00
/* $sp = mysql_fetch_array ( mysql_query ( 'SELECT COUNT(*) FROM `eff_users` WHERE `uid` = "' . $u -> info [ 'id' ] . '" AND `delete` = 0 AND `sleeptime` > 0 LIMIT 1' ));
if ( $sp [ 0 ] > 0 ) {
changeSleep ( $u -> info [ 'id' ], 2 );
} */
/* $sp = mysql_query ( 'SELECT * FROM `eff_users` WHERE `uid` = "' . $u -> info [ 'id' ] . '" AND `delete` = 0 AND `bs` = 1' );
while ( $pl = mysql_fetch_array ( $sp )) {
//$time = time()-$pl['sleeptime'];
//if( $pl['sleeptime'] == 0 ) {
// $time = 0;
//}
//$time = $pl['timeUse'] + $time;
//mysql_query('UPDATE `eff_users` SET `timeUse` = "'.$time.'",`sleeptime` = 0,`bs` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
} */
//
$t = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `bs_turnirs` WHERE `city` = "' . $u -> info [ 'city' ] . '" AND `level` = "' . (( int )( $r + 6 )) . '" LIMIT 1' ));
if ( isset ( $t [ 'id' ])) {
if ( $t [ 'time_start' ] > time ()) {
$tz = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `finish` = 0 LIMIT 1' ));
$tz_all = mysql_fetch_array ( mysql_query ( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `finish` <= "' . $t [ 'time_start' ] . '" LIMIT 1' ));
}
if ( isset ( $_POST [ 'coin' ]) && $t [ 'time_start' ] > time () ) {
$_POST [ 'coin' ] = round (( int ) $_POST [ 'coin' ], 2 );
if (( round (( int ) $tz [ 'money' ], 2 ) + $_POST [ 'coin' ]) > 3 * $u -> info [ 'level' ] || $tz_all [ 0 ] > 3 * $u -> info [ 'level' ]) {
2023-01-10 16:29:32 +00:00
$error = 'Вам нельзя делать ставку выше ' . ( 3 * $u -> info [ 'level' ]) . ' кр.' ;
2022-06-06 21:30:34 +00:00
} elseif (( $_POST [ 'coin' ] >= $t [ 'min_money' ] || ( isset ( $tz [ 'id' ]) && $_POST [ 'coin' ] >= 1 )) && $u -> info [ 'money' ] >= $_POST [ 'coin' ]) {
$t [ 'money' ] += $_POST [ 'coin' ];
$u -> info [ 'money' ] -= $_POST [ 'coin' ];
if ( isset ( $tz [ 'id' ])) {
$tz [ 'money' ] += $_POST [ 'coin' ];
mysql_query ( 'UPDATE `bs_zv` SET `money` = "' . $tz [ 'money' ] . '" WHERE `id` = "' . $tz [ 'id' ] . '" LIMIT 1' );
} else {
2023-01-10 16:29:32 +00:00
//создаем
2022-06-06 21:30:34 +00:00
$tz_all = mysql_fetch_array ( mysql_query ( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `finish` = "0" LIMIT 1' ));
$ins = mysql_query ( 'INSERT INTO `bs_zv` (`bsid`,`money`,`time`,`uid`) VALUES ("' . $t [ 'id' ] . '","' . mysql_real_escape_string ( $_POST [ 'coin' ]) . '","' . $t [ 'time_start' ] . '","' . $u -> info [ 'id' ] . '")' );
if ( $ins ) {
$tz_all = mysql_fetch_array ( mysql_query ( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `finish` = "0" LIMIT 1' ));
if ( $tz_all [ 0 ] > 0 ) {
$_POST [ 'coin' ] = $tz_all [ 0 ];
2023-01-10 16:29:32 +00:00
$error = 'Ваша ставка была возвращена. (' . round ( $_POST [ 'coin' ], 2 ) . ' кр.)' ;
2022-06-06 21:30:34 +00:00
}
$t [ 'users' ] ++ ;
$tz = array ( 'id' => 1 , 'bsid' => $t [ 'id' ], 'money' => $_POST [ 'coin' ], 'time' => $t [ 'time_start' ], 'finish' => 0 );
}
}
mysql_query ( 'UPDATE `bs_turnirs` SET `money` = "' . $t [ 'money' ] . '", `users` = "' . $t [ 'users' ] . '" WHERE `id` = "' . $t [ 'id' ] . '" LIMIT 1' );
mysql_query ( 'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
}
}
}
/* if ( $t [ 'time_start' ] <= time () && $t [ 'status' ] == 0 )
{
if ( $t [ 'users' ] > 1 )
{
2023-01-10 16:29:32 +00:00
//начало турнира
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `bs_turnirs` SET `status` = "1" WHERE `id` = "' . $t [ 'id' ] . '" LIMIT 1' );
$t [ 'status' ] = 1 ;
2023-01-10 16:29:32 +00:00
//создаем поход
mysql_query ( 'INSERT INTO `dungeon_now` (`id2`,`name`,`time_start`,`time_finish`,`uid`,`city`,`type`,`bsid`) VALUES ("6","Башня смерти","' . $t [ 'time_start' ] . '","0","' . $u -> info [ 'id' ] . '","' . $t [ 'city' ] . '","0","' . $t [ 'id' ] . '")' );
2022-06-06 21:30:34 +00:00
$zid = mysql_insert_id ();
2023-01-10 16:29:32 +00:00
//вселяем игроков в клонов и ставим на позиции
2022-06-06 21:30:34 +00:00
$exp2 = array (
1 => 30000 ,
2 => 300000
);
$st2s = array (
7 => array (
0 => 10 ,
1 => 64 ,
2 => 8
),
8 => array (
0 => 11 ,
1 => 78 ,
2 => 9
)
);
2023-01-10 16:29:32 +00:00
//раскидываем вещи по карте
2022-06-06 21:30:34 +00:00
$pid = 6 ; $map = array (); $obj = array (); $itms = array (); $usrs = array ();
$sp = mysql_query ( 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $pid . '" LIMIT 300' );
while ( $pl = mysql_fetch_array ( $sp ))
{
$map [ 'date' ][ count ( $map [ 'date' ])] = $pl [ 'id' ];
$map [ $pl [ 'x' ]][ $pl [ 'y' ]][ count ( $map [ $pl [ 'x' ]][ $pl [ 'y' ]])] = $pl [ 'id' ];
$map [ $pl [ 'id' ]] = $pl ;
}
2023-01-10 16:29:32 +00:00
//Добавляем обьекты
2022-06-06 21:30:34 +00:00
$vls = '' ;
$sp = mysql_query ( 'SELECT * FROM `dungeon_obj` WHERE `for_dn` = "' . $pid . '"' );
while ( $pl = mysql_fetch_array ( $sp ))
{
$vls .= '("' . $zid . '","' . $pl [ 'name' ] . '","' . $pl [ 'img' ] . '","' . $pl [ 'x' ] . '","' . $pl [ 'y' ] . '","' . $pl [ 'action' ] . '","' . $pl [ 'type' ] . '","' . $pl [ 'w' ] . '","' . $pl [ 'h' ] . '","' . $pl [ 's' ] . '","' . $pl [ 's2' ] . '","' . $pl [ 'os1' ] . '","' . $pl [ 'os2' ] . '","' . $pl [ 'os3' ] . '","' . $pl [ 'os4' ] . '","' . $pl [ 'type2' ] . '","' . $pl [ 'top' ] . '","' . $pl [ 'left' ] . '","' . $pl [ 'date' ] . '"),' ;
}
$vls = rtrim ( $vls , ',' );
if ( $vls != '' )
{
$ins2 = mysql_query ( 'INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES ' . $vls . '' );
}
$sp = mysql_query ( 'SELECT * FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" ORDER BY `money` DESC LIMIT 100' );
while ( $pl = mysql_fetch_array ( $sp ))
{
$ur = mysql_fetch_array ( mysql_query ( 'SELECT `id`,`login`,`room`,`name`,`sex` FROM `users` WHERE `id` = "' . $pl [ 'uid' ] . '" LIMIT 1' ));
if ( isset ( $ur [ 'id' ]))
{
mysql_query ( 'INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`) VALUES ("' . $ur [ 'login' ] . '","264","' . $ur [ 'name' ] . '","' . $ur [ 'sex' ] . '","' . $t [ 'level' ] . '")' );
$uri = mysql_insert_id ();
$iids = $map [ 'date' ][ rand ( 0 , count ( $map [ 'date' ]))];
$x1 = 0 + $map [ $iids ][ 'x' ];
$y1 = 0 + $map [ $iids ][ 'y' ];
mysql_query ( 'INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=' . $st2s [ $t [ 'level' ]][ 0 ] . '|s5=0|s6=0|rinv=40|m9=5|m6=10","' . $exp2 [ $t [ 'level' ]] . '","' . $st2s [ $t [ 'level' ]][ 1 ] . '","' . $st2s [ $t [ 'level' ]][ 2 ] . '",' . $x1 . ',' . $y1 . ')' );
mysql_query ( 'UPDATE `bs_zv` SET `inBot` = "' . $uri . '" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
mysql_query ( 'UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $pl [ 'uid' ] . '" LIMIT 1' );
2023-01-10 16:29:32 +00:00
//Добавляем эффекты скорость регена и запрет передвижения
2022-06-06 21:30:34 +00:00
}
}
2023-01-10 16:29:32 +00:00
//раскидываем архивариусов по карте
2022-06-06 21:30:34 +00:00
/* $vls0 = '' ;
$zi = 0 ;
$id_bots = array ( 0 => 159 , 1 => 160 , 2 => 160 , 3 => 160 );
while ( $zi < count ( $id_bots ))
{
if ( isset ( $id_bots [ $zi ]))
{
$iids = $map [ 'date' ][ rand ( 0 , count ( $map [ 'date' ]))];
$x1 = 0 + $map [ $iids ][ 'x' ];
$y1 = 0 + $map [ $iids ][ 'y' ];
$vls0 .= '("1","' . $zid . '","' . $id_bots [ $zi ] . '","1","","' . $x1 . '","' . $y1 . '","0",""),' ;
}
$zi ++ ;
}
$vls0 = rtrim ( $vls0 , ',' );
$ins1 = mysql_query ( 'INSERT INTO `dungeon_bots` (`go_bot`,`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`) VALUES ' . $vls0 . '' );
*/
/* $itbs = array (
0 => 1 , 1 => 131 , 2 => 130 , 3 => 6 , 4 => 7 , 5 => 129 , 6 => 128 , 7 => 127 , 8 => 126 , 9 => 125 , 10 => 124 , 11 => 123 , 12 => 122 , 13 => 121 , 14 => 120 , 15 => 119 , 16 => 118 , 17 => 117 , 18 => 116 , 19 => 115 , 20 => 114 , 21 => 113 , 22 => 112 , 23 => 111 , 24 => 110 , 25 => 109 , 26 => 108 , 27 => 107 , 28 => 106 , 29 => 105 , 30 => 104 , 31 => 103 , 32 => 102 , 33 => 101 , 34 => 100 , 35 => 99 , 36 => 98 , 37 => 97 , 38 => 96 , 39 => 95 , 40 => 94 , 41 => 93 , 42 => 92 , 43 => 91 , 44 => 90 , 45 => 89 , 46 => 88 , 47 => 87 , 48 => 84 , 49 => 85 , 50 => 86 , 51 => 73 , 52 => 74 , 53 => 76 , 54 => 83 , 55 => 82 , 56 => 81 , 57 => 132 , 58 => 133 , 59 => 134 , 60 => 135 , 61 => 136 , 62 => 137 , 63 => 138 , 64 => 139 , 65 => 140 , 66 => 141 , 67 => 142 , 68 => 143 , 69 => 144 , 70 => 145 , 71 => 146 , 72 => 147 , 73 => 148 , 74 => 149 , 75 => 150 , 76 => 151 , 77 => 152 , 78 => 153 , 79 => 154 , 80 => 155 , 81 => 156 , 82 => 157 , 83 => 158 , 84 => 159 , 85 => 160 , 86 => 161 , 87 => 162 , 88 => 163 , 89 => 164 , 90 => 165 , 91 => 166 , 92 => 167 , 93 => 168 , 94 => 169 , 95 => 170 , 96 => 171 , 97 => 172 , 98 => 173 , 99 => 174 , 100 => 175 , 101 => 176 , 102 => 177 , 103 => 178 , 104 => 179 , 105 => 180 , 106 => 181 , 107 => 182 , 108 => 183 , 109 => 184 , 110 => 185 , 111 => 186 , 112 => 187 , 113 => 188 , 114 => 189 , 115 => 190 , 116 => 191 , 117 => 192 , 118 => 193 , 119 => 194 , 120 => 195 , 121 => 196 , 122 => 197 , 123 => 198 , 124 => 199 , 125 => 200 , 126 => 201 , 127 => 202 , 128 => 203 , 129 => 204 , 130 => 205 , 131 => 206 , 132 => 207 , 133 => 208 , 134 => 209 , 135 => 210 , 136 => 211 , 137 => 212 , 138 => 213 , 139 => 214 , 140 => 215 , 141 => 216 , 142 => 217 , 143 => 218 , 144 => 219 , 145 => 220 , 146 => 221 , 147 => 222 , 148 => 223 , 149 => 224 , 150 => 225 , 151 => 226 , 152 => 227 , 153 => 228 , 154 => 229 , 155 => 230 , 156 => 231 , 157 => 232 , 158 => 233 , 159 => 234 , 160 => 235 , 161 => 236 , 162 => 237 , 163 => 238 , 164 => 239 , 165 => 240 , 166 => 241 , 167 => 242 , 168 => 243 , 169 => 244 , 170 => 245 , 171 => 246 , 172 => 247 , 173 => 248 , 174 => 249 , 175 => 250 , 176 => 251 , 177 => 252 , 178 => 253 , 179 => 254 , 180 => 255 , 181 => 256 , 182 => 257 , 183 => 258 , 184 => 259 , 185 => 260 , 186 => 261 , 187 => 262 , 188 => 263 , 189 => 264 , 190 => 265 , 191 => 266 , 192 => 267 , 193 => 268 , 194 => 269 , 195 => 270 , 196 => 271 , 197 => 272 , 198 => 273 , 199 => 274 , 200 => 275 , 201 => 276 , 202 => 277 , 203 => 278 , 204 => 279 , 205 => 280 , 206 => 281 , 207 => 282 , 208 => 283 , 209 => 284 , 210 => 285 , 211 => 286 , 212 => 287 , 213 => 288 , 214 => 289 , 215 => 290 , 216 => 291 , 217 => 292 , 218 => 293 , 219 => 294 , 220 => 295 , 221 => 296 , 222 => 297 , 223 => 298 , 224 => 299 , 225 => 300 , 226 => 301 , 227 => 302 , 228 => 304 , 229 => 305 , 230 => 306 , 231 => 307 , 232 => 308 , 233 => 309 , 234 => 310 , 235 => 311 , 236 => 312 , 237 => 313 , 238 => 314 , 239 => 315 , 240 => 316 , 241 => 317 , 242 => 318 , 243 => 319 , 244 => 320 , 245 => 321 , 246 => 322 , 247 => 323 , 248 => 324 , 249 => 325 , 250 => 326 , 251 => 327 , 252 => 328 , 253 => 329 , 254 => 330 , 255 => 331 , 256 => 332 , 257 => 333 , 258 => 334 , 259 => 335 , 260 => 336 , 261 => 337 , 262 => 338 , 263 => 339 , 264 => 340 , 265 => 341 , 266 => 342 , 267 => 343 , 268 => 344 , 269 => 345 , 270 => 346 , 271 => 347 , 272 => 348 , 273 => 349 , 274 => 350 , 275 => 351 , 276 => 352 , 277 => 353 , 278 => 354 , 279 => 355 , 280 => 356 , 281 => 357 , 282 => 358 , 283 => 359 , 284 => 360 , 285 => 361 , 286 => 362 , 287 => 363 , 288 => 364 , 289 => 365 , 290 => 366 , 291 => 367 , 292 => 368 , 293 => 369 , 294 => 370 , 295 => 371 , 296 => 372 , 297 => 373 , 298 => 374 , 299 => 375 , 300 => 376 , 301 => 377 , 302 => 378 , 303 => 379 , 304 => 380 , 305 => 381 , 306 => 382 , 307 => 383 , 308 => 384 , 309 => 385 , 310 => 386 , 311 => 387 , 312 => 388 , 313 => 389 , 314 => 390 , 315 => 391 , 316 => 392 , 317 => 393 , 318 => 394 , 319 => 395 , 320 => 396 , 321 => 397 , 322 => 398 , 323 => 399 , 324 => 400 , 325 => 401 , 326 => 402 , 327 => 403 , 328 => 404 , 329 => 405 , 330 => 406 , 331 => 407 , 332 => 408 , 333 => 409 , 334 => 410 , 335 => 411 , 336 => 412 , 337 => 413 , 338 => 414 , 339 => 415 , 340 => 416 , 341 => 417 , 342 => 418 , 343 => 419 , 344 => 420 , 345 => 421 , 346 => 422 , 347 => 423 , 348 => 424 , 349 => 425 , 350 => 426 , 351 => 427 , 352 => 428 , 353 => 429 , 354 => 430 , 355 => 431 , 356 => 432 , 357 => 433 , 358 => 434 , 359 => 435 , 360 => 436 , 361 => 437 , 362 => 438 , 363 => 439 , 364 => 440 , 365 => 441 , 366 => 442 , 367 => 443 , 368 => 444 , 369 => 445 , 370 => 446 , 371 => 447 , 372 => 448 , 373 => 449 , 374 => 450 , 375 => 451 , 376 => 452 , 377 => 453 , 378 => 454 , 379 => 455 , 380 => 456 , 381 => 457 , 382 => 458 , 383 => 459 , 384 => 46
);
$i = 0 ; $ii = 0 ; $cit = array (); $ins = '' ;
while ( $i < count ( $map [ 'date' ]))
{
if ( $map [ 'date' ][ $i ] > 0 )
{
$id = $map [ 'date' ][ $i ];
if ( rand ( 0 , 10000 ) > 3777 )
{
$j = 1 ; $jr = rand ( 100 , 300 ); $jr = floor ( $jr / 100 );
while ( $j <= $jr )
{
if ( rand ( 0 , 2 ) == 1 )
{
$iid = rand ( 0 , 744 );
} elseif ( rand ( 0 , 1 ) == 1 )
{
$iid = rand ( 144 , 544 );
} else {
$iid = ( 744 - rand ( 0 , 744 ));
}
if ( ! isset ( $cit [ $iid ]))
{
2023-01-10 16:29:32 +00:00
//добавляем предмет
2022-06-06 21:30:34 +00:00
$ins .= '("' . $zid . '","' . $itbs [ $iid ] . '","' . time () . '","' . $map [ $id ][ 'x' ] . '","' . $map [ $id ][ 'y' ] . '"),' ;
}
$ii ++ ;
$j ++ ;
}
}
}
$i ++ ;
}
//dn,item_id,time,x,y
$ins = rtrim ( $ins , ',' );
mysql_query ( 'INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ' . $ins . '' );
2023-01-10 16:29:32 +00:00
//раскидываем обьекты по карте
2022-06-06 21:30:34 +00:00
2023-01-10 16:29:32 +00:00
//сообщение в чат о начале турнира
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
//завершаем турнир
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `bs_turnirs` SET `status` = "0",`users_finish` = "0",`money` = "0",`time_start` = "' . ( time () + $t [ 'time_out' ] * 60 ) . '",`users` = "0" WHERE `id` = "' . $t [ 'id' ] . '" LIMIT 1' );
unset ( $tz );
$t [ 'status' ] = 0 ;
$t [ 'money' ] = 0 ;
$t [ 'users' ] = 0 ;
$t [ 'time_start' ] = ( time () + $t [ 'time_out' ] * 60 );
}
} elseif ( $t [ 'status' ] == 1 && ( $tn [ 'time_finish' ] > 0 || time () - $tn [ 'time_start' ] > 43200 || $t [ 'users' ] - $t [ 'users_finish' ] < 2 || ! isset ( $tn [ 'id' ])))
{
2023-01-10 16:29:32 +00:00
//завершаем турнир
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `bs_turnirs` SET `status` = "0",`users_finish` = "0",`money` = "0",`time_start` = "' . ( time () + $t [ 'time_out' ] * 60 ) . '",`users` = "0" WHERE `id` = "' . $t [ 'id' ] . '" LIMIT 1' );
2023-01-10 16:29:32 +00:00
//удаляем ботов в которых вселились
2022-06-06 21:30:34 +00:00
$sp = mysql_query ( 'SELECT * FROM `bs_zv` WHERE `bsid` = "' . $t [ 'id' ] . '" AND `time` = "' . $t [ 'time_start' ] . '" AND `finish` = "0" ORDER BY `money` DESC LIMIT 100' );
while ( $pl = mysql_fetch_array ( $sp ))
{
$ur = mysql_fetch_array ( mysql_query ( 'SELECT `id`,`login`,`room`,`name`,`sex`,`inUser` FROM `users` WHERE `id` = "' . $pl [ 'uid' ] . '" LIMIT 1' ));
if ( isset ( $ur [ 'id' ]))
{
//del
mysql_query ( 'DELETE FROM `users` WHERE `id` = "' . $ur [ 'inUser' ] . '" LIMIT 1' );
mysql_query ( 'DELETE FROM `stats` WHERE `id` = "' . $ur [ 'inUser' ] . '" LIMIT 1' );
mysql_query ( 'DELETE FROM `items_users` WHERE `uid` = "' . $ur [ 'inUser' ] . '" LIMIT 1' );
mysql_query ( 'DELETE FROM `eff_users` WHERE `uid` = "' . $ur [ 'inUser' ] . '" LIMIT 1' );
//upd
mysql_query ( 'UPDATE `bs_zv` SET `finish` = "' . time () . '" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
mysql_query ( 'UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pl [ 'uid' ] . '" LIMIT 1' );
}
}
mysql_query ( 'DELETE FROM `dungeon_now` WHERE `bsid` = "' . $t [ 'inUser' ] . '" AND `time_start` = "' . $t [ 'time_start' ] . '" LIMIT 1' );
2023-01-10 16:29:32 +00:00
//Визуальные обновления
2022-06-06 21:30:34 +00:00
unset ( $tz );
$t [ 'status' ] = 0 ;
$t [ 'money' ] = 0 ;
$t [ 'users' ] = 0 ;
$t [ 'time_start' ] = ( time () + $t [ 'time_out' ] * 60 );
} */
if ( $u -> info [ 'id' ] != 7 ) {
?>
< style >
body {
background - color : #dfdfdf;
2023-03-31 18:30:14 +00:00
background - image : url ( //img.new-combats.tech/i/misc/showitems/dungeon.jpg);
2022-06-06 21:30:34 +00:00
background - repeat : no - repeat ; background - position : top right ;
}
</ style >
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
if ( $re != '' ) {
echo '<div style="float:right"><font color=red><b>' . $re . '</b></font></div>' ;
}
?>
< table width = " 100% " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td >< div style = " padding-left:0px; " align = " center " >
2023-03-31 16:54:33 +00:00
< h3 >< ? = $u -> room [ 'name' ]; ?> </h3>
2022-06-06 21:30:34 +00:00
</ div ></ td >
< td width = " 200 " >< div align = " right " >
< table cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 100% " >& nbsp ; </ td >
< td >< table border = " 0 " cellpadding = " 0 " cellspacing = " 0 " >
< tr align = " right " valign = " top " >
< td ><!-- -->
2023-03-31 16:54:33 +00:00
< ? = $goLis ; ?>
2022-06-06 21:30:34 +00:00
<!-- -->
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td nowrap = " nowrap " >< table width = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 1 " bgcolor = " #DEDEDE " >
< tr >
2023-03-31 18:30:14 +00:00
< td bgcolor = " #D3D3D3 " >< img src = " //img.new-combats.tech/i/move/links.gif " width = " 9 " height = " 7 " /></ td >
2023-03-31 16:54:33 +00:00
< td bgcolor = " #D3D3D3 " nowrap = " nowrap " >< a href = " # " id = " greyText " class = " menutop " onClick = " location='main.php?loc=1.180.0.11&rnd=<?= $code ; ?>'; " title = " <?php thisInfRm('1.180.0.11',1); ?> " > Страшилкина ул .</ a ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
</ table ></ td >
</ tr >
</ table ></ td >
</ tr >
</ table ></ td >
</ tr >
</ table >
</ div ></ td >
</ tr >
</ table >
2023-01-10 16:29:32 +00:00
< center >< h4 >< font color = green > Поздравляем ! Вы успешно допускаетесь к турниру !</ font ></ h4 ></ center >< br >
< P align = right >< INPUT class = " btn " onclick = " window.open('/forum/', 'help', 'height=500,width=1024,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes') " value = " Подсказка " style = " color:red; " type = " button " >< INPUT TYPE = " button " class = " btn " onClick = " location = 'main.php?rnd=<?= $code ;?>'; " value = " Обновить " > & nbsp ; </ P >
2022-06-06 21:30:34 +00:00
< form method = " post " action = " main.php?rnd=<?= $code ;?> " >
< fieldset style = " padding: 5px; border:1px solid #CCC; " >
2023-03-31 16:54:33 +00:00
< legend style = 'font-weight:bold; color:#8F0000;' >< h4 >< ? php if ( $t [ 'status' ] == 0 ) { ?> Прием заявок на следующий турнир <?php } else { ?>Текущий турнир<?php } ?></h4></legend>
2022-06-06 21:30:34 +00:00
2023-01-10 16:29:32 +00:00
<!-- Уровень :
2022-06-06 21:30:34 +00:00
< select name = " level " onChange = " location='main.php?r='+this.value+'&rnd=<?= $code ;?>'; " >
2023-03-31 16:54:33 +00:00
< option value = " 11 " < ? php if ( $r == 5 ) { echo 'selected' ; } if ( $u -> info [ 'level' ] < 11 ) { echo 'disabled' ; } ?> disabled >11</option>
< option value = " 10 " < ? php if ( $r == 4 ) { echo 'selected' ; } if ( $u -> info [ 'level' ] < 10 ) { echo 'disabled' ; } ?> disabled >10</option>
< option value = " 9 " < ? php if ( $r == 3 ) { echo 'selected' ; } if ( $u -> info [ 'level' ] < 9 ) { echo 'disabled' ; } ?> disabled >9</option>
< option value = " 8 " < ? php if ( $r == 2 ) { echo 'selected' ; } if ( $u -> info [ 'level' ] < 8 ) { echo 'disabled' ; } ?> >8</option>
< option value = " 7 " < ? php if ( $r == 1 ) { echo 'selected' ; } ?> >7</option>
2022-06-06 21:30:34 +00:00
</ select >< br >-->
2023-03-31 16:54:33 +00:00
< ? php if ( ! isset ( $t [ 'id' ])) { echo '<br><center>К сожалению турниры данного типа не проводятся в этом городе</center><br>' ; } else {
2022-06-06 21:30:34 +00:00
if ( $t [ 'status' ] == 0 ) {
?>
2023-01-10 16:29:32 +00:00
Начало турнира в Башне Смерти : < span class = date >< ? = date ( 'd.m.Y H:i:' , $t [ 'time_start' ]); ?> 59</span><BR>
Призовой фонд на текущий момент : < B >< ? = round (( $t [ 'money' ] - ( $t [ 'money' ] / 100 * 15 )), 2 ); ?> </B> кр. и <B>1</B> екр.<BR>
В с е г о подано заявок : < B >< ? = $t [ 'users' ]; ?> </B><BR>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
if ( $error != '' ) {
echo '<font color=red><b>' . $error . '</b></font><Br>' ;
}
?>
2023-03-31 16:54:33 +00:00
< ? php if ( ! isset ( $tz [ 'id' ])) { ?>
< ? php if ( $u -> info [ 'exp' ] >= 250000 ) { ?>
2022-06-06 21:30:34 +00:00
2023-03-31 16:54:33 +00:00
Сколько ставите кредитов ? ( минимальная ставка < b >< ? = $t [ 'min_money' ]; ?> .00 кр.</B> у вас в наличии <b><?= floor($u->info['money']); ?> кр.</b>)<BR><input type="text" name="coin" value="20.00" size="8">
2023-01-10 16:29:32 +00:00
< input type = " submit " value = " Подать заявку " name = " docoin " >< BR >
Чем выше ваша ставка , тем больше шансов принять участие в турнире .< BR >
2022-06-06 21:30:34 +00:00
2023-03-31 16:54:33 +00:00
< ? php } elseif ( $u -> info [ 'exp' ] < 250000 ){ ?>
2022-06-06 21:30:34 +00:00
2023-03-31 16:54:33 +00:00
Для регистрации в турнире нужно : < span style = " color:green; " >< b > 250000 </ b ></ span > опыта у вас : < span style = " color:red; " >< b >< ? = $u -> info [ 'exp' ]; ?> </b></span> опыта<BR>
2023-01-10 16:29:32 +00:00
Вам нужно набраться опыта .< BR >
2022-06-06 21:30:34 +00:00
2023-03-31 16:54:33 +00:00
< ? php }} else { ?>
2022-06-06 21:30:34 +00:00
2023-03-31 16:54:33 +00:00
Вы уже сделали ставку < b >< ? = floor ( $tz [ 'money' ]); ?> кр.</b> (У вас в наличии <b><?= floor($u->info['money']); ?> кр.</b>) Сделать повторную ставку?<br />
2023-01-10 16:29:32 +00:00
< small >< b >< font color = red > Внимание ! Покинув помещение Башни Смерти все Ваши ставки будут потеряны !</ font ></ b ></ small >< br >
2022-06-06 21:30:34 +00:00
< input type = " text " name = " coin " value = " 1.00 " size = " 8 " id = " coin " />
2023-01-10 16:29:32 +00:00
< input type = " submit " value = " Увеличить ставку " name = " docoin2 " />
2023-03-31 16:54:33 +00:00
< ? php } } elseif ( $t [ 'status' ] == 1 ) { ?>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
$r = '' ; $p = '' ; $b = ' < table width = " 100% " cellpadding = " 0 " cellspacing = " 0 " border = " 0 " >
< tbody >
< tr valign = " top " >
2023-01-10 16:29:32 +00:00
< td valign = " bottom " nowrap = " " title = " " >< input onClick = " location=location; " style = " padding:5px; " type = " submit " name = " analiz2 " value = " Обновить " ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
</ tbody >
</ table > ' ;
$notowerlog = false ;
$log = mysql_fetch_array ( mysql_query ( 'SELECT `id`,`count_bs`,`m` FROM `bs_logs` WHERE `count_bs` = "' . mysql_real_escape_string ( $t [ 'count' ]) . '" ORDER BY `id` ASC LIMIT 1' ));
if ( ! isset ( $log [ 'id' ])) {
$notowerlog = true ;
2023-01-10 16:29:32 +00:00
$r = '<div>Скорее всего Архивариус снова потерял пергамент с хрониками турниров ...</div>' ;
2022-06-06 21:30:34 +00:00
} else {
$sp = mysql_query ( 'SELECT * FROM `bs_logs` WHERE `count_bs` = "' . $log [ 'count_bs' ] . '" ORDER BY `id` ASC' );
while ( $pl = mysql_fetch_array ( $sp ) ) {
$datesb = '' ;
if ( $pl [ 'type' ] == 2 ) {
$datesb = '2' ;
}
$r .= '<br><span class="date' . $datesb . '">' . date ( 'd.m.y H:i' , $pl [ 'time' ]) . '</span> ' . $pl [ 'text' ] . '' ;
}
$liveusers = '' ;
$sp = mysql_query ( 'SELECT `id` FROM `users` WHERE `inTurnir` = "' . $t [ 'id' ] . '"' );
while ( $plu = mysql_fetch_array ( $sp ) ) {
$pl = mysql_fetch_array ( mysql_query ( 'SELECT `id`,`login`,`align`,`clan`,`level` FROM `users` WHERE `inUser` = "' . $plu [ 'id' ] . '"' ));
if ( isset ( $pl [ 'id' ]) ) {
$alc = '' ;
if ( $pl [ 'align' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$alc .= '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $pl [ 'align' ] . '.gif >' ;
2022-06-06 21:30:34 +00:00
}
if ( $pl [ 'clan' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$alc .= '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $pl [ 'clan' ] . '.gif >' ;
2022-06-06 21:30:34 +00:00
}
2023-03-31 18:30:14 +00:00
$liveusers .= ', <b>' . $alc . $pl [ 'login' ] . '</b> [' . $pl [ 'level' ] . ']<a href=/info/' . $plu [ 'id' ] . ' target=_blank><img src=//img.new-combats.tech/i/inf_capitalcity.gif width=12 height=11 ></a>' ;
2022-06-06 21:30:34 +00:00
}
}
2023-01-10 16:29:32 +00:00
$r .= '<br><br>В с е г о живых участников на данный момент: <b>' . $t [ 'users' ] . '</b> (' . ltrim ( $liveusers , ', ' ) . ')' ;
2022-06-06 21:30:34 +00:00
unset ( $liveusers , $alc );
}
if ( $notowerlog == false ) { ?>
2023-01-10 16:29:32 +00:00
Призовой фонд : < b >< ? = $log [ 'm' ] ?> кр.</b>
2023-03-31 16:54:33 +00:00
< ? php } echo $r ; ?>
< ? php } } ?>
2022-06-06 21:30:34 +00:00
< BR >
</ fieldset >
</ form >
2023-01-10 16:29:32 +00:00
< h4 > Топ 10 игроков ( новая статистиика ) турнир 5 < ? //=$t['level']?> уровней</h4>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
$sp = mysql_query ( 'SELECT * FROM `users` WHERE `win_bs`>0 ORDER BY `win_bs` DESC LIMIT 10' );
$i = 1 ;
while ( $pl = mysql_fetch_array ( $sp )) {
2023-03-31 18:30:14 +00:00
$wuser = '<b>' . $pl [ 'login' ] . '</b> [' . $pl [ 'level' ] . ']<a href=/info/' . $pl [ 'id' ] . ' target=_blank ><img width=12 height=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'clan' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $pl [ 'clan' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
if ( $pl [ 'align' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $pl [ 'align' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
echo '<b>' . $i . '.</b> Место: ' . $wuser . ' побед: <b>' . $pl [ 'win_bs' ] . '</b><br>' ;
2022-06-06 21:30:34 +00:00
$i ++ ;
}
?>
2023-01-10 16:29:32 +00:00
< h4 > Победители 10 - ти предыдущих турниров для 5 < ? //=$t['level']?> уровней</h4>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
$sp = mysql_query ( 'SELECT * FROM `bs_statistic` WHERE `wuid` > 0 ORDER BY `id` DESC LIMIT 10' );
$i = 1 ;
while ( $pl = mysql_fetch_array ( $sp )) {
2023-03-31 18:30:14 +00:00
$wuser = '<b>' . $pl [ 'wlogin' ] . '</b> [' . $pl [ 'wlevel' ] . ']<a href=/info/' . $pl [ 'wuid' ] . ' target=_blank ><img width=12 height=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'wclan' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $pl [ 'wclan' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
if ( $pl [ 'walign' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $pl [ 'walign' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
echo $i . '. Победитель: ' . $wuser . ' Начало турнира <span class=date>' . date ( 'd.m.Y H:i' ,( $pl [ 'time_start' ] + 60 )) . '</span> продолжительность <span class=date>' . $u -> timeOut ( $pl [ 'time_sf' ] ) . '</span> приз: <b>' . $pl [ 'money' ] . '</b> <a target=_blank href=/towerlog.php?towerid=' . $pl [ 'bsid' ] . '&id=' . $pl [ 'count' ] . ' >История турнира »»</a><br>' ;
2022-06-06 21:30:34 +00:00
$i ++ ;
}
?>
2023-01-10 16:29:32 +00:00
< h4 > Максимальный выигрыш для 5 < ? //=$t['level']?> уровней</h4>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
$sp = mysql_query ( 'SELECT * FROM `bs_statistic` WHERE `wuid` > 0 ORDER BY `money` DESC LIMIT 1' );
$i = 1 ;
while ( $pl = mysql_fetch_array ( $sp )) {
2023-03-31 18:30:14 +00:00
$wuser = '<b>' . $pl [ 'wlogin' ] . '</b> [' . $pl [ 'wlevel' ] . ']<a href=/info/' . $pl [ 'wuid' ] . ' target=_blank ><img width=12 height=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'wclan' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $pl [ 'wclan' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
if ( $pl [ 'walign' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $pl [ 'walign' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
echo 'Победитель: ' . $wuser . ' Начало турнира <span class=date>' . date ( 'd.m.Y H:i' ,( $pl [ 'time_start' ] + 60 )) . '</span> продолжительность <span class=date>' . $u -> timeOut ( $pl [ 'time_sf' ] ) . '</span> приз: <b>' . $pl [ 'money' ] . '</b> <a target=_blank href=/towerlog.php?towerid=' . $pl [ 'bsid' ] . '&id=' . $pl [ 'count' ] . ' >История турнира »»</a><br>' ;
2022-06-06 21:30:34 +00:00
$i ++ ;
}
?>
2023-01-10 16:29:32 +00:00
< h4 > Самый продолжительный турнир для 5 < ? //=$t['level']?> уровней</h4>
2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
$sp = mysql_query ( 'SELECT * FROM `bs_statistic` WHERE `wuid` > 0 ORDER BY `time_sf` DESC LIMIT 1' );
$i = 1 ;
while ( $pl = mysql_fetch_array ( $sp )) {
2023-03-31 18:30:14 +00:00
$wuser = '<b>' . $pl [ 'wlogin' ] . '</b> [' . $pl [ 'wlevel' ] . ']<a href=/info/' . $pl [ 'wuid' ] . ' target=_blank ><img width=12 height=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'wclan' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $pl [ 'wclan' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
if ( $pl [ 'walign' ] > 0 ) {
2023-03-31 18:30:14 +00:00
$wuser = '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $pl [ 'walign' ] . '.gif>' . $wuser ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
echo 'Победитель: ' . $wuser . ' Начало турнира<span class=date>' . date ( 'd.m.Y H:i' ,( $pl [ 'time_start' ] + 60 )) . '</span> продолжительность <span class=date>' . $u -> timeOut ( $pl [ 'time_sf' ] ) . '</span> приз: <b>' . $pl [ 'money' ] . '</b> <a target=_blank href=/towerlog.php?towerid=' . $pl [ 'bsid' ] . '&id=' . $pl [ 'count' ] . ' >История турнира »»</a><br>' ;
2022-06-06 21:30:34 +00:00
$i ++ ;
}
?>
< br />< br />
2023-03-31 16:54:33 +00:00
< ? php } } ?>