diff --git a/cronjobs/cron.php b/cronjobs/cron.php index 980ea91..168e66e 100644 --- a/cronjobs/cron.php +++ b/cronjobs/cron.php @@ -5,8 +5,8 @@ * Project name: Battles-Game */ -include_once "../config.php"; -include_once "../functions.php"; +include_once '../config.php'; +include_once '../functions.php'; $tm = time(); ########## @@ -536,5 +536,4 @@ if(date("z-H-i") == date("z-H-i", $turnirstart['value'])) mysql_query("TRUNCATE TABLE `deztow_items`"); mysql_query("TRUNCATE TABLE `deztow_trap`"); } -mysql_query('UNLOCK TABLES'); -?> \ No newline at end of file +mysql_query('UNLOCK TABLES'); \ No newline at end of file diff --git a/cronjobs/cron_bots.php b/cronjobs/cron_bots.php index 09e442a..ec50a39 100644 --- a/cronjobs/cron_bots.php +++ b/cronjobs/cron_bots.php @@ -1,15 +1,20 @@ + * Project name: Battles-Game + */ -$r = mysql_query("SELECT `id`, `win` FROM `battle` WHERE `needbb` = 2 AND `win` = 3"); +include_once '../config.php'; +include_once '../functions.php'; + + +$r = db::c()->query('SELECT `id`, `win` FROM `battle` WHERE `needbb` = 2 AND `win` = 3'); $r2 = mysql_query("SELECT `id`, `win` FROM `battle` WHERE `needbb` = 1 AND `win` = 3 AND (`timeout`*90+`to1` < ".time()." OR `timeout`*90+`to2` < ".time().")"); -echo "SELECT `id`, `win` FROM `battle` WHERE `needbb` = 1 AND `win` = 3 AND (`timeout`*90+`to1` < ".time()." OR `timeout`*90+`to2` < ".time().")"; - -if(mysql_num_rows($r) > 0 || mysql_num_rows($r2) > 0) { include('fbattle.php'); } +if($r->getNumRows() > 0 || mysql_num_rows($r2) > 0) { include_once '../fbattle.php'; } $battles = array(); -while($rec = mysql_fetch_assoc($r)) { +while($rec = $r->fetch_assoc()) { $fbattles = new fbattle($rec['id']); foreach($fbattles->battle as $k => $v) { if($k > _BOTSEPARATOR_) { diff --git a/cronjobs/cron_bots_battle.php b/cronjobs/cron_bots_battle.php index ed5f6a4..98cccab 100644 --- a/cronjobs/cron_bots_battle.php +++ b/cronjobs/cron_bots_battle.php @@ -5,9 +5,9 @@ * Project name: Battles-Game */ -include('config.php'); -include('functions.php'); -include('cave/cave_bots.php'); +include_once '../config.php'; +include_once '../functions.php'; +include_once '../cave/cave_bots.php' ; $cavebots = $botnames; function addlogs($id, $log) { @@ -312,10 +312,6 @@ class fbattle { mysql_query('INSERT INTO `logs_arena` (`battle`, `user`, `uid`, `damage`, `team`) VALUES ("'.$this->battle_data['id'].'", "'.$this->t1[$k].'", "'.$v.'", "'.$this->damage[$v].'", "1")'); } - if($this->user['in_tower'] > 0) { - - } - if($this->user['x'] != 0 || $this->user['y'] != 0 && $this->user['laba'] > 0) { $lobj = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "'.$this->user['laba'].'" AND `x` = "'.$this->user['x'].'" AND `y` = "'.$this->user['y'].'" LIMIT 1')); if(isset($lobj['id'])) { @@ -1257,27 +1253,28 @@ class fbattle { } else { return ($mid-$min)*(1-$diff)+$min; } - $min = $min/100; - $max = $max/100; - $diffup = (1/(1+(abs($mf-$antimf)/(($max-$mid)*100)))); - $diffdown = (1/(1+(abs($mf-$antimf)/(($mid-$min)*100)))); - $ret = $mid; - if($mf > $antimf) { - $ret = $ret*(2-$diff); - } else { - $ret = $ret*$diff; - } - if($ret < $min) { - $ret = $min; - } - if($ret > $max) { - $ret = $max; - } - return (int)round($ret*100); + # До кода ниже невозможно достучаться. все варианты return перечислены выше. +// $min = $min/100; +// $max = $max/100; +// $diffup = (1/(1+(abs($mf-$antimf)/(($max-$mid)*100)))); +// $diffdown = (1/(1+(abs($mf-$antimf)/(($mid-$min)*100)))); +// $ret = $mid; +// if($mf > $antimf) { +// $ret = $ret*(2-$diff); +// } else { +// $ret = $ret*$diff; +// } +// if($ret < $min) { +// $ret = $min; +// } +// if($ret > $max) { +// $ret = $max; +// } +// return (int)round($ret*100); } function check_bonus($uid) { - $us = mysql_fetch_array(mysql_query('SELECT `id`, `sila`, `lovk`, `inta`, `vinos` FROM `users` WHERE `id` = "'.mysql_real_escape_string($uid).'" LIMIT 1')); + $us = db::c()->query('SELECT `id`, `sila`, `lovk`, `inta`, `vinos` FROM `users` WHERE `id` = ?i', $uid)->fetch_assoc(); $i_uminu = 0; $i_fkrit = 0; $i_fauvorot = 0; @@ -1422,8 +1419,6 @@ class fbattle { $mfs['me']['udar'] = round($mfs['me']['udar']); if($mfs['me']['udar'] < 1) { $mfs['me']['udar'] = 1; } - #$this->AddToLog('{Id = '.$uid_1['id'].'| No_Koef = '.$mfs['me']['udars'].'| Finish = '.$mfs['me']['udar'].'| Koef = '.$he_koef_armor.'| Armor = '.$this->enemy_dress[5+$attack].' | Um = '.$uron_vlad_me.'| Weap = '.$this->GetWeaponType($uid_1['weap']).'| Function = '.$mfs['me']['udars'].'-'.($this->enemy_dress[5+$attack]*$he_koef_armor).'| Min = '.(floor($uid_1['sila']/3)+$b_u_1['minu']+1+$this->user_dress[0]).'| Max = '.(floor($uid_1['sila']/3)+$b_u_1['maxu']+4+$this->user_dress[1]).'}
'); - $mykrits = floor($this->enemy_dress[2]+($uid_2['inta']*2.95)+$b_u_2['fkrit']); $heakrits = floor($this->user_dress[3]+($uid_1['inta']*2.75)+$b_u_1['fkrit']); $myuvorots = floor($this->enemy_dress[4]+$uid_2['lovk']*5); @@ -1448,9 +1443,6 @@ class fbattle { case "mech": $uron_vlad_he += $uid_2['mec']; break; } $mfs['he']['udar'] += $uron_vlad_he; - - #$this->AddToLog('{ Id = '.$uid_2['id'].'| URON_not_koef = '.$mfs['he']['udars'].'| Uron_finish = '.$mfs['he']['udar'].'| Koef_arm = '.$me_koef_armor.'| Armor = '.$this->user_dress[5+$this->battle[$user_2][$user_1][0]].' | Um = '.$uron_vlad_he.'| Weap = '.$this->GetWeaponType($uid_2['weap']).' }
'); - $mfs['he']['udar'] = round($mfs['he']['udar']); if($mfs['he']['udar'] < 1) { $mfs['he']['udar'] = 1; } @@ -1545,4 +1537,4 @@ while($rec = mysql_fetch_array($r)) { } else { echo '{No bb Id = |'.$rec['id'].'|}'; } -} +} \ No newline at end of file diff --git a/cronjobs/cron_bs.php b/cronjobs/cron_bs.php index e8d4d57..0893ed7 100644 --- a/cronjobs/cron_bs.php +++ b/cronjobs/cron_bs.php @@ -1,7 +1,11 @@ + * Project name: Battles-Game + */ -#phpinfo(); -file_get_contents('http://capitalcity.old-dark.ru/chats.php?id=6&user=10022'); -?> +#include_once 'config.php'; +#include_once 'functions.php'; + +file_get_contents(GAMEDOMAIN.'/chats.php?id=6&user=10022');