示例#1
0
         $targetAlliance = new alliance();
         if ($targetAlliance->get('id', $targetUser->data['alliance']) == 'done' && $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']) == 'done') {
             $war = $alliance->getWar($targetAlliance->data['id']);
             if (isset($war['type'])) {
                 $gotStatic = false;
                 $data = array();
                 $data['input']['attacker']['focus'] = $_POST['attackerFocus'];
                 $data['input']['attacker']['faction'] = $node->data['faction'];
                 foreach ($_POST['attackerGroupUnitIds'] as $key => $unitId) {
                     $data['input']['attacker']['groups'][$key] = array('unitId' => $unitId, 'quantity' => $_POST['attackerGroups'][$key]);
                     if (!$game['units'][$node->data['faction']][$unitId]['speed']) {
                         $gotStatic = true;
                     }
                 }
                 if (!$gotStatic) {
                     $status = $node->addCombat($target->data['id'], $data);
                 } else {
                     $status = 'cannotSendStatic';
                 }
                 $message = $ui[$status];
             } else {
                 $message = $ui['noWar'];
             }
         } else {
             $message = $ui['noAlliance'];
         }
     } else {
         $message = $ui['noUser'];
     }
 } else {
     $message = $ui['noNode'];