game/cron/battle_finish.php

81 lines
3.2 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
const GAME = true;
2022-06-06 21:30:34 +00:00
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
/*
CRON <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
$hend = 2; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sp = mysql_query('SELECT * FROM `battle` WHERE `time_start` < "'.( time() - 1800*$hend ).'" AND `team_win` = -1 LIMIT 100');
while( $pl = mysql_fetch_array($sp) ) {
$test = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$pl['id'].'" ORDER BY `time` DESC LIMIT 1'));
if(!isset($test['id']) || $test['time'] < ( time() - 1800*$hend ) ) {
mysql_query('UPDATE `battle` SET `team_win` = "0",`time_over` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$pl['id'].'"');
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sp = mysql_query('SELECT * FROM `battle` WHERE `time_start` < "'.( time() - 180).'" AND `team_win` = -1 AND `typeBattle` = 9 LIMIT 100');
while( $pl = mysql_fetch_array($sp) ) {
$test = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) as count
FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle`= "'.$pl['id'].'"'));
if ($test['count'] < 8)
{
mysql_query('UPDATE `battle` SET `timeout` = "60" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
}
elseif ($test['count'] < 12)
2022-06-06 21:30:34 +00:00
{
mysql_query('UPDATE `battle` SET `timeout` = "120" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
} else {
mysql_query('UPDATE `battle` SET `timeout` = "180" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
2022-06-06 21:30:34 +00:00
}
}
// batle cache
mysql_query('DELETE FROM `battle_cache` WHERE `time` < "'.(time()-3600).'"');
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-5 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
$sp = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 33 AND `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0 ORDER BY `battle`.`time_over` DESC LIMIT 1'));
if (isset($sp['id']))
{
mysql_query('UPDATE `battle` SET `time_over` = `time_over` - 300 WHERE `id` = "'.$sp['id'].'" LIMIT 1');
$sps = mysql_query('SELECT * FROM `users` WHERE `mail` LIKE "haot@new-combats.com" AND `battle` = 0');
while( $pl = mysql_fetch_array($sps))
{
if (isset($pl['id']))
{
mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "'.$pl['id'].'" LIMIT 1');
mysql_query('DELETE FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
$sps = mysql_query('SELECT * FROM `users` WHERE `battle` > 0');
while( $pl = mysql_fetch_array($sps))
{
if (isset($pl['id']))
{
$test = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1'));
if (($test['time_over'] < (time()-600) && $test['time_over'] !=0) || !isset($test['id']))
{
mysql_query('UPDATE `users` SET `battle`= 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
mysql_query('UPDATE `stats` SET `battle_yron` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unset($sp,$sps,$pl,$test);