Ejemplo n.º 1
0
         if (!$staticData->getSectors()) {
             $sectorsArr = $sectorConn->getAllSectors();
             foreach ($sectorsArr as $sectorArr) {
                 $allSectors[] = new Sector($sectorArr[0], $sectorArr[1], $sectorArr[2], $sectorArr[3], $sectorArr[4], $sectorArr[5], $sectorArr[6], $sectorArr[7], explode(",", $sectorArr[8]), explode(",", $sectorArr[9]), $sectorArr[10]);
             }
             $staticData->setSectors($allSectors);
         }
         $attackerSectors = Sector::getOwnedSectors($staticData->getSectors(), $battle->getAttackerId());
         $maxDistance = Sector::getMaxDistance($attackerSectors);
         $playerId = $battle->getAttackerId();
         require HOME . 'controllers/batch/recalculate_manteinances.php';
     }
 } else {
     //$attacker = $allPlayers[array_shift($aux1)->getOwnerId()];
     //$defender = $allPlayers[array_shift($aux2)->getOwnerId()];
     $battle->setSector($sector);
     $battle->setAttackingDivisions($attackingDivisions);
     $battle->setDefendingDivisions($defendingDivisions);
     $attackDivisions = $battle->getAttackingDivisions();
     $defendDivisions = $battle->getDefendingDivisions();
     $passed = $now - $battle->getLastUpdate();
     $roundsMissed = floor($passed / ($round_time / 1000));
     $remainingTime = $passed % ($round_time / 1000);
     if ($roundsMissed >= 1) {
         for ($i = 0; $i < $roundsMissed; $i++) {
             $defendLog = $battle->doRound($defendDivisions, $attackDivisions, 1);
             $attackLog = $battle->doRound($attackDivisions, $defendDivisions, 0);
             if (!$defendLog) {
                 $defendLog = array();
             }
             if (!$attackLog) {