Ejemplo n.º 1
0
/********
PRINT THE FLEET DETAILS
*********/
echo '<table cellspacing=5 align=center>
    <tr>
      <td><b>Name</b></td>
      <td><b>Loc</b></td>
      <td><b>Destination</b></td>
      <td><b>Arrival Time</b></td>
    </tr><tr>
      <td>' . getFleetStat(name, $sid, $fid) . '</td>
      <td><a href="./planetdetails.php?id=' . getFleetStat(loc, $sid, $fid) . '">' . getPlanetStat(name, $sid, getFleetStat(loc, $sid, $fid)) . '</a></td>';
$destination = getFleetStat(destination, $sid, $fid);
if ($destination > 0) {
    echo '<td><a href="./planetdetails.php?id=' . getFleetStat(loc, $sid, $fid) . '">' . getPlanetStat(name, $sid, getFleetStat(destination, $sid, $fid)) . '</a></td>
      <td>' . timeLeft(getFleetStat(destinationtime, $sid, $fid)) . '</td>';
} else {
    echo '<td>None</td>
      <td>---</td>';
}
echo '</tr></table><br><hr><br>';
//Print the list of ships
echo '<form name="fleetadd" action="./fleetdetails.php?id=' . $fid . '" method="post">
  <table cellspacing=5 align=center>
    <tr>
      <td></td>
      <td><b>Type</b></td>
      <td><b>Attack</b></td>
      <td><b>Defence</b></td>
      <td><b>Amt</b></td>
      <td><b>Move</b></td>
Ejemplo n.º 2
0
    }
    if (!($num > 0)) {
        $num = 0;
    }
    return $num + getPlantStat(cannon, $sid, $pid);
}
$servercount = getServerNumber();
for ($sid = 1; $sid < $servercount + 1; $sid++) {
    $query = "SELECT id FROM fleet{$sid} WHERE probes>0";
    $result = @mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        //Get the probe fleet id
        $fid = $row[id];
        //Make sure time has elapsed and the person doesnt own the planet already
        $pid = getFleetStat(probes, $sid, $fid);
        if (timeLeft(getFleetStat(probetime, $sid, $fid)) < 1 && getFleetStat(ownerid, $sid, $fid) != getPlanetStat(ownerid, $sid, $pid)) {
            //Check if you already have a report
            if (getFleetStat(probetime, $sid, $fid) != -1) {
                //Generate probe report
                $sentry = getPlanetStat(sentry, $sid, $pid);
                $probe = getSpyNum($sid, $fid);
                $land = getPlanetStat(landused, $sid, $pid) - getPlanetStat(land, $sid, $pid);
                if ($probe < $sentry) {
                    $report = 'Your probes could not successfully penetrate the planet\'s radar scrambling.';
                } else {
                    if ($probe > $sentry + 40) {
                        $rand = rand(9, 11) / 10;
                        $def = floor(calcDef($sid, $pid) * $rand);
                        $report = 'Your probe report came back very positive. They report the estimated defensive capabilities are ' . $def . '. The estimated land remaining is ' . $land . '. This report is very accurate.';
                    } else {
                        if ($probe > $sentry + 25) {
Ejemplo n.º 3
0
        $result = mysql_query($query);
        $row = mysql_fetch_array($result);
        $hp += $row[0] * getShipStat(hp, $x);
    }
    return $hp;
}
$servercount = getServerNumber();
for ($sid = 1; $sid < $servercount + 1; $sid++) {
    $query = "SELECT id FROM fleet{$sid} WHERE combatid>0";
    $result = @mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        //Get the attacking fleet id
        $afid = $row[id];
        //Make sure time has elapsed and the person doesnt own the planet already
        $dpid = getFleetStat(destination, $sid, $afid);
        if (timeLeft(getFleetStat(destinationtime, $sid, $afid)) < 1 && getFleetStat(ownerid, $sid, $afid) != getPlanetStat(ownerid, $sid, $dpid)) {
            //Create a defending fleet with all fleets
            $first = true;
            $query = "SELECT id FROM fleet{$sid} WHERE loc={$dpid} AND destination=0";
            $result = mysql_query($query);
            while ($row = mysql_fetch_array($result)) {
                if ($first) {
                    $dfid = $row[id];
                    $first = false;
                } else {
                    for ($i = 1; $i < getShipNumber() + 1; $i++) {
                        $str = "ship" . $i;
                        $thisship = getFleetStat($str, $sid, $dfid);
                        $thisship += getFleetStat($str, $sid, $row[id]);
                        setFleetStat($str, $thisship, $sid, $dfid);
                        setFleetStat($str, 0, $sid, $row[id]);
Ejemplo n.º 4
0
************/
$query = "SELECT name,report,id,probetime FROM fleet{$sid} WHERE ownerid={$id} AND probes>0";
$result = mysql_query($query);
$num = mysql_num_rows($result);
echo '<div id="2" style="display:none">';
if ($num > 0) {
    echo '<table cellspacing="10" align="center">
			<tr>
				<td><b>Name</b></td>
				<td><b>Time Left</b></td>
				<td><b>Reload</b></td>
				<td><b>Report</b></td>
			</tr>';
}
while ($row = mysql_fetch_array($result)) {
    $timeleft = timeLeft($row[probetime]);
    if ($row[report] == "") {
        if ($timeleft > 0) {
            $name = "In Transit";
        } else {
            $name = "Processing";
        }
    } else {
        $name = '<a href="./report.php?id=' . $row[id] . '">Available</a>';
    }
    if ($timeleft < 0) {
        $timeleft = "Probing";
    }
    echo '<tr>
			<td>' . $row[name] . '</td>
			<td>' . $timeleft . '</td>
Ejemplo n.º 5
0
        }
        if ($dir == 'ASC') {
            $other_dir = 'DESC';
        } else {
            $other_dir = 'ASC';
        }
        $show_done = isset($_GET['show_done']) ? (int) $_GET['show_done'] : 0;
        if ($show_done == 0) {
            $show_done_not = 1;
            $where = "`state` != 2 AND (`userid`=0 OR `userid`=" . $login->currentUserID() . ")";
        } else {
            $show_done_not = 0;
            $where = "(`userid`=0 OR `userid`=" . $login->currentUserID() . ")";
        }
        $smarty->assign('show_done', $show_done);
        $smarty->assign('url_order_title', makeURL($mod, array('mode' => 'groupware', 'order' => 'title', 'dir' => $other_dir, 'show_done' => $show_done)));
        $smarty->assign('url_order_end', makeURL($mod, array('mode' => 'groupware', 'order' => 'end', 'dir' => $other_dir, 'show_done' => $show_done)));
        $smarty->assign('url_order_priority', makeURL($mod, array('mode' => 'groupware', 'order' => 'priority', 'dir' => $other_dir, 'show_done' => $show_done)));
        $smarty->assign('url_order_state', makeURL($mod, array('mode' => 'groupware', 'order' => 'state', 'dir' => $other_dir, 'show_done' => $show_done)));
        $smarty->assign('url_show_done', makeURL($mod, array('mode' => 'groupware', 'order' => $order, 'dir' => $dir, 'show_done' => $show_done_not)));
        $tasks = $db->selectList($tbl_groupware, "*", $where, "`" . $order . "` " . $dir);
        if (count($tasks) > 0) {
            foreach ($tasks as $i => $task) {
                $tasks[$i]['end'] = timeLeft($task['end']);
                $tasks[$i]['priority'] = $priority[$task['priority']];
                $tasks[$i]['state'] = $states[$task['state']];
                $tasks[$i]['url'] = makeURL($mod, array('mode' => 'groupware', 'action' => 'view', 'taskid' => $task['groupwareid']));
            }
        }
        $smarty->assign('tasks', $tasks);
}
Ejemplo n.º 6
0
function getNextEncounter($tournament, $userid)
{
    global $db;
    global $user;
    global $lang;
    require_once "./mod/default/tournament/participant.interface.php";
    require_once "./mod/default/tournament/singlePlayer.class.php";
    switch ($tournament['mode']) {
        // Group
        case 3:
            // Clan tournament -> user groupid as userid
            if ($tournament['playerperteam'] > 1) {
                $userid = $db->selectOneRow("tournamentgroupregister", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND `memberid`=" . $userid);
                $userid = $userid['groupid'];
            }
            $groupEnc = $db->selectOneRow("tournamentgroupenc", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND `participantid`=" . $userid, "`round` DESC");
            // Encounter is not yet finished
            if ($groupEnc['rank'] == 0 && 0 == $db->num_rows("tournamentgroupenc", "`tournamentid` = " . $tournament['tournamentid'] . " AND `round`=" . $groupEnc['round'] . " AND `group`=" . $groupEnc['group'] . " AND `rank`>0")) {
                $encounter = array('roundid' => $groupEnc['round'], 'state' => 0);
                $encounterUrl = makeHTMLUrl($lang->get('group') . " " . chr(65 + $groupEnc['group']), makeURL('tournament', array('mode' => 'table', 'tournamentid' => $tournament['tournamentid'], 'action' => 'submit', 'group' => $groupEnc['group'], 'round' => $groupEnc['round'])));
            } else {
                $encSettings = $db->selectOneRow("tournamentsettings", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND `settingid`= 1");
                $groupList = $db->selectList("tournamentgroupenc", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND `round`=" . $groupEnc['round'] . " AND `group`=" . $groupEnc['group'], "`rank` ASC", $encSettings['value']);
                // Check if the user is kickedout or just not yet forwarded
                $kickedout = true;
                $encounter['finished'] = false;
                foreach ($groupList as $player) {
                    if ($player['participantid'] == $userid) {
                        $kickedout = false;
                        $encounter['finished'] = true;
                        break;
                    }
                }
            }
            break;
            // Points
        // Points
        case 4:
            // Randomize
        // Randomize
        case 5:
            // Do nothing, as the tournament has no "rounds"
            $encounter = '';
            break;
            // Double Elimination
            // Single Elimination
            // King of the Hill
        // Double Elimination
        // Single Elimination
        // King of the Hill
        default:
            // Clan tournament
            if ($tournament['playerperteam'] > 1) {
                $group = $db->selectOneRow("tournamentgroupregister", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND `memberid`=" . $userid);
                $encounter = $db->selectOneRow("tournamentencounters", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND (`player1id`=" . $group['groupid'] . " OR `player2id`=" . $group['groupid'] . ")", "`roundid` DESC");
                // If the game is lost don't show next game
                if ($encounter['player1id'] == $group['groupid'] && $encounter['points1'] < $encounter['points2'] || $encounter['player2id'] == $group['groupid'] && $encounter['points2'] < $encounter['points1']) {
                    $kickedout = true;
                } else {
                    $player1 = makePlayerUrl($encounter['player1id'], false);
                    $player2 = makePlayerUrl($encounter['player2id'], false);
                    // If the encounter has two players, the "vs." becomes a link
                    if ($encounter['player1id'] > 0 && $encounter['player2id'] > 0) {
                        $versus = makeHTMLUrl("vs.", makeURL('tournament', array('mode' => 'view', 'tournamentid' => $tournament['tournamentid'], 'encid' => $encounter['encounterid'], 'roundid' => $encounter['roundid'])));
                    }
                }
                // Single tournament
            } else {
                $encounter = $db->selectOneRow("tournamentencounters", "*", "`tournamentid` = " . $tournament['tournamentid'] . " AND (`player1id`=" . $userid . " OR `player2id`=" . $userid . ")", "`roundid` DESC");
                // If the game is lost don't show next game
                if ($encounter['player1id'] == $userid && $encounter['points1'] < $encounter['points2'] || $encounter['player2id'] == $userid && $encounter['points2'] < $encounter['points1']) {
                    $kickedout = true;
                } else {
                    $player1 = makePlayerUrl($encounter['player1id']);
                    $player2 = makePlayerUrl($encounter['player2id']);
                    if ($encounter['player1id'] > 0 && $encounter['player2id'] > 0) {
                        $versus = makeHTMLUrl("vs.", makeURL('tournament', array('mode' => 'view', 'tournamentid' => $tournament['tournamentid'], 'encid' => $encounter['encounterid'], 'roundid' => $encounter['roundid'])));
                    }
                }
            }
            if (isset($player1)) {
                $encounterUrl = $player1 . " " . (!isset($versus) ? "vs." : $versus) . " " . $player2;
            }
            break;
    }
    // If there is no next enc return nothing
    if (!$encounter) {
        $encounter = '';
    } else {
        // If the user was defeated don't show next enc (as there is none)
        if (isset($kickedout) && $kickedout) {
            $encounter['kickedout'] = true;
        } else {
            // If the game is finished don't show next enc (as there is none)
            if (@$encounter['state'] == 1 || @$encounter['finished']) {
                $encounter['finished'] = true;
            } else {
                $maps = explode(";", $tournament['finalmappool']);
                $realround = $tournament['mode'] == 2 ? $encounter['roundid'] - 1 : $encounter['roundid'];
                $encounter['mapname'] = !isset($maps[$realround]) ? '' : $maps[$realround];
                $encounter['encounterUrl'] = $encounterUrl;
                if (isset($encounter['duration']) && $encounter['duration'] != 0) {
                    require_once "mod/default/tournament/tournament.eliminationencounter.class.php";
                    $curEnc = new EliminationEncounter($encounter['tournamentid'], $encounter['roundid'], $encounter['encounterid']);
                    $encounter['startTime'] = date("H:i", $encounter['start']);
                    $encounter['startTimeLeft'] = timeLeft($encounter['start']);
                    $encounter['endTime'] = date("H:i", $encounter['start'] + $encounter['duration']);
                    $encounter['timeState'] = $curEnc->getEncTimeState();
                }
                //Adjust DE rounds
                $encounter['roundid'] = makeRoundNr($encounter['roundid'], $tournament['mode']);
            }
        }
    }
    return $encounter;
}
Ejemplo n.º 7
0
<?php

global $current_language;
if ($this->isInstalled('calendar')) {
    $area['title'] = $lang->get('calendar');
    $area['content'] = '';
    if ($login->currentUser() === false) {
        $cal_list = $db->selectList('calendar', "*", "(`start` > " . time() . " AND `visible`=2)\r\n\t\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "5");
    } else {
        $cal_list = $db->selectList('calendar', "*", "(`start` > " . time() . " AND (`visible`=2 OR `visible`=1 OR (`visible`=0 AND `userid`=" . $login->currentUserId() . ")))\r\n\t\t\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "5");
    }
    if (null != $cal_list && count($cal_list) > 0) {
        foreach ($cal_list as $cal) {
            $time = time() > $cal['start'] ? timeElapsed($cal['start']) : timeLeft($cal['start']);
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($cal['title'], makeURL('calendar', array('calendarid' => $cal['calendarid'], 'mode' => 'view', 'day' => $cal['start']))) . ' (' . $time . ')</p>';
        }
    }
    $areas[] = $area;
}
Ejemplo n.º 8
0
  <br>
  <u>Current Construction</u>
  <br>
  <br>
  <table cellspacing=5>
    <tr>
      <td></td>
      <td>';
//Check if something is being built
if (getPlanetStat(constructionid, $sid, $pid) > 0) {
    echo getBuildStat(name, getPlanetStat(constructionid, $sid, $pid));
    //Check if building is finished
    if (timeLeft(getPlanetStat(constructiontime, $sid, $pid)) > 0) {
        echo ' finishing in <span id="btimeleft">' . timeLeft(getPlanetStat(constructiontime, $sid, $pid)) . '</span> seconds. <a href="javascript:confirmPost();">Cancel</a></td>';
        echo '<script language="JavaScript">
        countStart(' . timeLeft(getPlanetStat(constructiontime, $sid, $pid)) . ');
      </script>';
    } else {
        echo ' is being finalized. <a href="./build.php?id=' . $pid . '&f=1">Complete</a></td>';
    }
} else {
    //Nothing is being built
    echo 'Nothing in construction</td><td></td>';
}
echo '<table cellspacing=5>';
for ($tree = 0; $tree < 3; $tree++) {
    echo '<tr></tr><tr></tr><tr></tr><tr></tr>';
    if ($tree == 0) {
        echo '<tr><td></td><td><b><u>Economy</u></b>';
    } else {
        if ($tree == 1) {
Ejemplo n.º 9
0
<?php

//$lang->addModSpecificLocalization('events');
$table = MYSQL_TABLE_PREFIX . 'events';
$tbl_reg = MYSQL_TABLE_PREFIX . 'register';
$tbl_users = MYSQL_TABLE_PREFIX . 'users';
$e = $db->selectOneRow($table, "*", "`end`>" . time(), "`start` ASC", "1");
if (@$e['eventid'] == '') {
    $tpl_file = $template_dir . "/none.tpl";
} else {
    $e['url'] = makeURL('events', array('eventid' => $e['eventid']));
    //$e['start'] = date('d.m.Y / H:i', $e['start']);
    $e['start'] = time() > $e['start'] ? timeElapsed($e['start']) : timeLeft($e['start']);
    $e['end'] = date('d.m.Y / H:i', $e['end']);
    $e['registered'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid']);
    $e['payed'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed` > 0");
    $e['payed_pre'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed`!=0 AND `payed`!=2");
    $e['payed_box_office'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed`=2");
    $e['seats_free'] = $e['seats'] - $e['registered'];
    $bar_width = 100;
    // is user registered?
    $reg = $db->num_rows($tbl_reg, "`userid`=" . $login->currentUserID() . " \r\n\t\t\t\t\t\t\t\t\t\tAND `eventid`=" . $e['eventid']);
    $smarty->assign('box_events_reg', $reg);
    if ($reg == 1) {
        $smarty->assign('box_events_state', $lang->get('event_registered'));
    } else {
        $smarty->assign('box_events_state', $lang->get('event_not_registered'));
    }
    if ($e['free'] == 0) {
        $e['not_payed'] = $e['registered'] - $e['payed'];
    }
Ejemplo n.º 10
0
 function encounter($roundId, $encId)
 {
     global $breadcrumbs, $template_dir, $smarty, $tournamentList, $notify, $lang;
     $tournament = $tournamentList->getTournament($this->tournamentId);
     $smarty->assign('tournament', $tournament);
     $enc = new EliminationEncounter($this->tournamentId, $roundId, $encId);
     foreach ($this->participants as $participant) {
         if ($participant->getId() == $enc->getPlayer1id()) {
             $player1 = $participant;
         }
         if ($participant->getId() == $enc->getPlayer2id()) {
             $player2 = $participant;
         }
     }
     if (!isset($player1) || !isset($player2)) {
         $notify->add($lang->get('encounter'), $lang->get('ntfy_submit_err_player'));
     } else {
         $breadcrumbs->addElement($player1->getName() . " vs. " . $player2->getName(), makeURL('tournament', array('tournamentid' => $_GET['tournamentid'], 'encid' => $_GET['encid'], 'roundid' => $_GET['roundid'], 'mode' => 'view')));
         $smarty->assign('path', $template_dir . "/eliminationencounter_detail.tpl");
         $smarty->assign('player1', array('name' => $player1->getName(), 'url' => $player1->getUrl()));
         $smarty->assign('player2', array('name' => $player2->getName(), 'url' => $player2->getUrl()));
         $enc_arr['points1'] = $enc->getPoints1();
         $enc_arr['points2'] = $enc->getPoints2();
         $enc_arr['finished'] = $enc->isFinished();
         $enc_arr['winner'] = $enc->getPoints1() > $enc->getPoints2() ? 1 : 2;
         $enc_arr['map'] = $this->getMap($_GET['roundid'] + 1);
         if ($enc->getStart() != 0) {
             $enc_arr['start'] = $enc->getStart() > time() ? timeLeft($enc->getStart()) : formatTime($enc->getStart());
             $tEnd = $enc->getStart() + $enc->getDuration();
             $enc_arr['end'] = $enc->getStart() < time() && $tEnd > time() ? timeLeft($tEnd) : formatTime($tEnd);
             $enc_arr['duration'] = $enc->getDuration();
         }
         $smarty->assign('enc', $enc_arr);
         $smarty->assign('user_can_submit', $this->checkSubmitRights($enc, $player1, $player2));
     }
     $smarty->assign('path', $template_dir . "/eliminationencounter_detail.tpl");
     $smarty->assign('_GET', $_GET);
 }
Ejemplo n.º 11
0
}
if ($login->currentUser() !== false) {
    $list = $db->selectList($tbl, "*", "(`start`>" . time() . " AND ( (`visible` = 2 ) OR (`visible` = 0 AND `userid` = " . $login->currentUserID() . ") OR ( `visible` = 1) ))\r\n\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", $cnt);
} else {
    $list = $db->selectList($tbl, "*", "(`start`>" . time() . " AND `visible` = 2)\r\n\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", $cnt);
}
if ($config->get('calendar', 'current-event') == '1') {
    $refresh_time = (int) $config->get('calendar', 'current-event-refresh-time');
    if ($refresh_time <= 3) {
        $refresh_time = 15;
    }
    $smarty->assign('calendar_box_refresh_time', $refresh_time);
    $smarty->assign('calendar_box_show_counter', true);
    if ($login->currentUser() !== false) {
        $current_event = $db->selectOneRow('calendar', "*", "`start` < " . time() . " AND `end` > " . time() . " AND ( (`visible` = 2 ) OR (`visible` = 0 AND `userid` = " . $login->currentUserID() . ") OR ( `visible` = 1) )");
    } else {
        $current_event = $db->selectOneRow('calendar', "*", "`start` < " . time() . " AND `end` > " . time() . " AND `visible` = 2");
    }
    $current_event['url'] = makeURL('calendar', array('day' => $current_event['start'], 'calendarid' => $current_event['calendarid'], 'mode' => 'view'));
    $smarty->assign('calendar_box_current', $current_event);
}
if (count($list) > 0) {
    foreach ($list as $i => $l) {
        //$list[$i]['day'] = makeDate($l['start']);
        //$list[$i]['time'] = makeTime($l['start']);
        $list[$i]['timeleft'] = timeLeft($l['start']);
        $list[$i]['url'] = makeURL('calendar', array('day' => $l['start'], 'calendarid' => $l['calendarid'], 'mode' => 'view'));
    }
}
$smarty->assign('calendar_box_entries', $list);
$visible = true;
Ejemplo n.º 12
0
        $comments->add($mod, $login->currentUserID(), $_POST['text'], $contactid);
    }
    $smarty->assign('comments', $comments->get($mod, $contactid));
    if ($request['read'] == 0) {
        $request['read'] = 1;
        $db->update($tbl_contact, "`read`=1", "`contactid`=" . $contactid);
    }
    if (isset($_POST['done'])) {
        $db->update($tbl_contact, "`done`=" . $login->currentUserID(), "`contactid`=" . $contactid);
        $request['done'] = $login->currentUserID();
        $log->add($mod, 'contact entry ' . $contactid . ' marked as done');
    }
    if (isset($_POST['move_to_groupware'])) {
        $end = strtotime("+1 Hour");
        $db->insert($tbl_groupware, array('title', 'description', 'state', 'end', 'priority', 'contactid', 'userid'), array("'" . $request['subject'] . "'", "'" . $request['text'] . "'", 0, $end, 1, $contactid, 0));
        $notify->add($lang->get('groupware'), $lang->get('copy_to_groupware_done'));
        $request['isInGroupware'] = true;
    }
    $u = $user->getUserByID($request['userid']);
    $request['sender'] = makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $request['userid'])));
    $request['timestamp'] = timeLeft($request['timestamp']);
    $request['text'] = $bbcode->parse($request['text']);
    $request['read'] = intToYesNo($request['read']);
    if ($request['done'] > 0) {
        $u = $user->getUserByID($request['done']);
        $request['done_by'] = makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $u['userid'])));
    }
    $smarty->assign('delete_url', makeURL($mod, array('mode' => 'contact')));
    $smarty->assign('request', $request);
}
$smarty->assign('path', $template_dir . "/contact.tpl");
Ejemplo n.º 13
0
function landFleet($sid, $fid)
{
    //Check the time to see if can land
    $destination = getFleetStat(destination, $sid, $fid);
    if (timeLeft(getFleetStat(destinationtime, $sid, $fid)) < 0) {
        //$did is the owner id of the destination
        $did = getPlanetStat(ownerid, $sid, $destination);
        if (getFleetStat(combatid, $sid, $fid) > 0) {
            //Check to make sure the combat is still valid
            if ($did == getFleetStat(ownerid, $sid, $fid) || $did == 0) {
                setFleetStat(combatid, 0, $sid, $fid);
            } else {
                return false;
            }
        }
        //Check and see if it has a settler landing on an uninhabited planet
        if ($did != getFleetStat(ownerid, $sid, $fid) && $did > 0) {
            //Check to see if someone else owns the planet
            setFleetStat(combatid, 1, $sid, $fid);
            return false;
        }
        setFleetStat(destination, 0, $sid, $fid);
        setFleetStat(loc, $destination, $sid, $fid);
        if (getPlanetStat(ownerid, $sid, $destination) == 0) {
            $settlers = getFleetStat(ship5, $sid, $fid);
            if ($settlers > 0) {
                $settlers--;
                setFleetStat(ship5, $settlers, $sid, $fid);
                setPlanetStat(ownerid, getFleetStat(ownerid, $sid, $fid), $sid, $destination);
                addNotification('You have succesfully colonized <a href="planetdetails.php?id=' . $destination . '">' . getPlanetStat(name, $sid, $destination) . '</a>.', $sid, getFleetStat(ownerid, $sid, $fid));
            }
        }
        return true;
    }
    return false;
}
Ejemplo n.º 14
0
             if ($tournament['regcount'] < $tournament['playerlimit']) {
                 $groupid = $register->createGroup($_POST['creategroup_name'], $_POST['creategroup_password'], $tournamentid);
                 $register->joinGroup($tournament, $groupid, $_POST['creategroup_password']);
             }
         }
         if (isset($_POST['unjoin'])) {
             $register->leaveTournament($tournamentid);
         }
         if (isset($_POST['joingroup'])) {
             $register->joinGroup($tournament, $_POST['joingroup_groupid'], $_POST['joingroup_password']);
         }
         $smarty->assign('already_joined', $register->alreadyJoined($tournamentid));
         $smarty->assign('grouplist', $register->getPlayerList($tournament));
     }
     if ($tournament['start'] > time()) {
         $tournament['start_str'] = timeLeft($tournament['start']);
     } else {
         $tournament['start_str'] = timeElapsed($tournament['start']);
     }
     // Ranking of tournament
     if ($tournament['state'] == 2 || $tournament['state'] == 3) {
         $ranking = $tournament_obj->ranking();
         $smarty->assign('ranking', $ranking);
     }
     $tournament['regcount'] = $register->getRegCount($tournamentid);
     $smarty->assign('tournament', $tournament);
     break;
 case 'editstate':
     if (!$right['add_remove_edit']) {
         break;
     }
Ejemplo n.º 15
0
<?php

require_once './www.playconquest.com/db_connect.php';
$servercount = getServerNumber();
for ($x = 1; $x < $servercount + 1; $x++) {
    $query = "SELECT id FROM planets{$x} WHERE ownerid>0";
    $result = @mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $pid = $row[id];
        $sid = $x;
        $id = getPlanetStat(ownerid, $sid, $pid);
        //Check if something is actually building
        $cid = getPlanetStat(constructionid, $sid, $pid);
        if ($cid > 0 && $cid != 8) {
            //Check if it is finished
            if (timeLeft(getPlanetStat(constructiontime, $sid, $pid)) < 1) {
                if (getBuildStat(increases, $cid) != "none") {
                    $pstat = getPlanetStat(getBuildStat(increases, $cid), $sid, $pid);
                    $increase = getBuildStat(increaseamt, $cid);
                    $pstat = $pstat + $increase;
                    if (setPlanetStat(getBuildStat(increases, $cid), $pstat, $sid, $pid)) {
                        if (setPlanetStat(constructionid, 0, $sid, $pid)) {
                            addNotification(getBuildStat(name, $cid) . ' has finished building.', $sid, $id);
                        }
                    }
                } else {
                    if (setPlanetStat(constructionid, 0, $sid, $pid)) {
                        if (!galaxyControlled($sid, $pid)) {
                            $z = getPlanetStat(z, $sid, $pid);
                            $query = "UPDATE galaxy{$sid} SET ownerpid={$pid} WHERE id={$z}";
                            $result = @mysql_query($query);