Example #1
0
function render_full_text($dbc, $text, $keywords, $verbs)
{
    $query = "SELECT * FROM resource WHERE description like '%{$text}%' ";
    $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query);
    //echo "<p>" . $text . "</p>";
    if (mysqli_num_rows($result) != 0) {
        while ($row = mysqli_fetch_array($result)) {
            //echo "<p>" . $row[description] . "</p>";
            $id = $row[id];
            $index = mb_strpos($row[description], $text, 0, 'utf-8');
            $description = mb_substr($row[description], max(0, $index - 200), 200 + strlen($text), 'utf-8');
            //$description = str_replace( $text, '<font color = "red">' . $text . '</font>', $row[description]);
            $colored_text = get_colored_text($text, $verbs, 'green');
            $colored_text = get_colored_text($colored_text, $keywords, 'red');
            $description = str_replace($text, '<font  style="background-color:yellow;">' . $colored_text . '</font>', $description);
            $remained_keywords = array();
            foreach ($keywords as $keyword) {
                // echo $text . $keyword . mb_strpos($text, $keyword, 0, 'utf-8');
                if (mb_strpos($text, $keyword, 0, 'utf-8') === false) {
                    $remained_keywords[] = $keyword;
                }
            }
            $description = get_colored_text($description, $remained_keywords, 'red');
            echo '<blockquote>......' . $description . '...... <a href="annotation.php?text_id=' . $id . '"><span class="glyphicon glyphicon-search"></span></a>' . '</blockquote><br>';
            //echo strrpos ($row[description], $text);
        }
    } else {
        echo '<blockquote>......' . $text . '</blockquote>';
    }
}
Example #2
0
 public function generate()
 {
     $argv = $this->args;
     $this->controller = $argv['controller'];
     $this->view_format = $argv['view_format'];
     $this->module_name = $argv['module_name'];
     $this->uri = $argv['uri'];
     $generate_module = new Generate_Module_Script(array("module_name" => $this->module_name));
     $generate_module->generate();
     $this->save_class();
     $this->save_test();
     echo __("update __module__ file :\t");
     $this->update_module();
     echo get_colored_text(__("Ok."), "blue", "white") . "\r\nDone.";
 }
 $dead_ppl->unlock();
 if ($debug) {
     print "<p>report any errors on that page to spock</p>";
 }
 // create player object
 // JUST FOR READING!!!
 // DO NOT CHANGE SOMETHING IN THERE!
 $killed = new SMR_PLAYER($killed_id, SmrSession::$game_id);
 $killer = new SMR_PLAYER($killer_id, SmrSession::$game_id);
 // is one of the dead guys the original attacker or defender?
 if ($killed_id == $defender_id || $killed_id == $attacker_id) {
     $container["continue"] = "No";
 }
 // save some time here
 $killer_name = get_colored_text($killer->alignment, $killer->player_name);
 $killed_name = get_colored_text($killed->alignment, $killed->player_name);
 if ($debug) {
     print "newbie turns<br>";
 }
 $db->query("UPDATE player SET newbie_turns = 100 WHERE account_id = {$killed_id} AND game_id = {$player->game_id}");
 if ($debug) {
     print "insurance<br>";
 }
 // 1/4 of ship value -> insurance
 $db->query("SELECT cost, speed FROM player, ship_type " . "WHERE player.ship_type_id = ship_type.ship_type_id AND " . "account_id = {$killed_id} AND " . "game_id = {$player->game_id}");
 if ($db->next_record()) {
     $credits = round($db->f("cost") / 4);
     // never less than 5k credits
     if ($credits < 5000) {
         $credits = 5000;
     }
Example #4
0
        print_submit_style("Increase", "background-color:green;");
    } else {
        print_submit("Increase");
    }
    print "&nbsp;";
    if ($voted_for_race == $race_id && $voted_for == "DEC") {
        print_submit_style("Decrease", "background-color:green;");
    } else {
        print_submit("Decrease");
    }
    print "</td>";
    print "</form>";
    $relation = $player->relations_global[$race_id];
    print "<td align=\"center\">" . get_colored_text($relation, $relation) . "</td>";
    $relation = $player->relations_global_rev[$race_id];
    print "<td align=\"center\">" . get_colored_text($relation, $relation) . "</td>";
    print "</tr>";
}
print "</table>";
print "<p>&nbsp;</p>";
$curr_time = time();
$db->query("SELECT * FROM race_has_voting " . "WHERE {$curr_time} < end_time AND " . "game_id = {$player->game_id} AND " . "race_id_1 = {$player->race_id}");
if ($db->nf() > 0) {
    print "<table border=\"0\" class=\"standard\" cellspacing=\"0\" align=\"center\" width=\"65%\">";
    print "<tr>";
    print "<th>Race</th>";
    print "<th>Treaty</th>";
    print "<th>Option</th>";
    print "<th>Currently</th>";
    print "<th>End Time</th>";
    print "</tr>";
Example #5
0
    if ($db->f("account_id") == $leader_id) {
        echo '*';
    }
    echo $count++;
    echo '</td><td>';
    // player name
    $db2->query('SELECT level_name
				FROM level
				WHERE requirement<=' . $db->f('experience') . '
				ORDER BY requirement DESC LIMIT 1');
    $db2->next_record();
    echo $db2->f('level_name');
    echo '&nbsp;';
    $container['body'] = 'trader_search_result.php';
    $container["player_id"] = $db->f('player_id');
    print_link($container, get_colored_text($db->f("alignment"), stripslashes($db->f('player_name')) . '&nbsp;(' . $db->f('player_id') . ')'));
    echo '</td><td class="center shrink">';
    // race name (colored)
    $container['body'] = 'council_list.php';
    $container["race_id"] = $db->f("race_id");
    $container["race_name"] = $races[$db->f("race_id")];
    unset($container['player_id']);
    print_link($container, $player->get_colored_race($db->f("race_id")));
    // xp
    echo '</td><td class="shrink center">';
    echo $db->f('experience');
    echo '</td>';
    // Roles
    if ($var['action'] == 'Show Alliance Roles') {
        echo '<td class="shrink right">';
        $db2 = new SmrMySqlDatabase();
Example #6
0
print "<table>";
$db->query("SELECT race_name, race.race_id as race_id, relation FROM race_has_relation, race " . "WHERE race_has_relation.race_id_2 = race.race_id AND " . "race_has_relation.race_id_1 = {$race_id} AND " . "race_has_relation.race_id_1 != race_has_relation.race_id_2 AND " . "race_has_relation.relation >= 300 AND " . "race_has_relation.game_id = {$player->game_id}");
while ($db->next_record()) {
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "council_send_message.php";
    $container["race_id"] = $db->f("race_id");
    print "<tr><td align=\"center\">";
    print_link($container, get_colored_text($db->f("relation"), $db->f("race_name")));
    print "</td></tr>";
}
print "</table>";
print "</td>";
// war
print "<td align=\"center\" valign=\"top\">";
print "<table>";
$db->query("SELECT race_name, race.race_id as race_id, relation FROM race_has_relation, race " . "WHERE race_has_relation.race_id_2 = race.race_id AND " . "race_has_relation.race_id_1 = {$race_id} AND " . "race_has_relation.race_id_1 != race_has_relation.race_id_2 AND " . "race_has_relation.relation <= -300 AND " . "race_has_relation.game_id = {$player->game_id}");
while ($db->next_record()) {
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "council_send_message.php";
    $container["race_id"] = $db->f("race_id");
    print "<tr><td align=\"center\">";
    print_link($container, get_colored_text($db->f("relation"), $db->f("race_name")));
    print "</td></tr>";
}
print "</table>";
print "</td>";
print "</tr>";
print "</table>";
print "</div>";
Example #7
0
 echo '<input class="center" type="text" name="maxValue" size="3" value="' . $maxValue . '">';
 echo '</td><td>';
 echo $form['submit'];
 echo '</td></tr></table></form>';
 echo '<table cellspacing="0" cellpadding="0"class="standard inset"><tr><th>#</th><th>Date</th><th>Trader</th><th>Withdrawal</th><th>&nbsp;&nbsp;Deposit&nbsp;&nbsp</th></tr>';
 $container = array();
 $container["url"] = "skeleton.php";
 $container["body"] = "trader_search_result.php";
 while ($db->next_record()) {
     echo '<tr><td class="shrink center">';
     echo $db->f('transaction_id');
     echo '</td><td class="shrink center nowrap">';
     echo date('n/j/Y\\<b\\r /\\>g:i:s A', $db->f('time'));
     echo '</td><td>';
     $container["player_id"] = $db->f('player_id');
     print_link($container, get_colored_text($db->f('alignment'), stripslashes($db->f('player_name'))));
     echo '</td><td class="shrink right">';
     if ($db->f('transaction') == 'Payment') {
         echo number_format($db->f('amount'));
     } else {
         echo '&nbsp;';
     }
     echo '</td><td class="shrink right">';
     if ($db->f('transaction') == 'Deposit') {
         print number_format($db->f('amount'));
     } else {
         echo '&nbsp;';
     }
     echo '</td></tr>';
 }
 echo '<tr>';
Example #8
0
     $container["owner_id"] = $account_id;
     $container["take_scout_drones"] = 1;
     print_link($container, "&nbsp;<b>-</b>&nbsp;");
 } else {
     echo $current_force[5];
 }
 echo '<td class="shrink nowrap center">';
 if ($allow_alter) {
     echo '<span class="green">' . date('n/j/Y\\<b\\r /\\>g:i:s A', $current_force[7]) . '</span>';
 } else {
     echo '<span style="color:red;"><b>WAR</b></span>';
 }
 echo '</td>';
 echo '<td>';
 $container1["player_id"] = $current_force[0];
 print_link($container1, get_colored_text($current_force[3], $current_force[1] . ' (' . $current_force[0] . ')'));
 echo '<br />(';
 if ($current_force[2]) {
     $container = array();
     $container["url"] = "skeleton.php";
     $container["body"] = "alliance_roster.php";
     $container["alliance_id"] = $current_force[2];
     print_link($container, $alliances[$current_force[2]]);
 } else {
     echo $alliances[$current_force[2]];
 }
 echo ')</td>';
 print "<td align=\"center\" class=\"shrink nowrap center\">";
 $container = array();
 $container["url"] = "skeleton.php";
 if ($allow_alter) {
Example #9
0
            }
        }
        if ($message_count - $unread_messages > 25) {
            $query = 'SELECT alignment, player_id, sender_id, player_name AS sender, count( message_id ) AS number, min( send_time ) as first, max( send_time) as last 
					FROM message, player 
					WHERE player.account_id = message.sender_id 
					AND message.account_id = ' . $player->account_id . '
					AND message.game_id = ' . $player->game_id . '
					AND player.game_id = ' . $player->game_id . '
					AND message_type_id = ' . $var["folder_id"] . '
					AND msg_read = "TRUE" 
					GROUP BY sender_id 
					ORDER BY send_time DESC';
            $db->query($query);
            while ($db->next_record()) {
                $playerName = get_colored_text($db->f('alignment'), stripslashes($db->f('sender')) . ' (' . $db->f('player_id') . ')');
                $message = 'Your forces have spotted ' . $playerName . ' passing your forces ' . $db->f("number") . ' times.';
                displayGrouped($playerName, $db->f("player_id"), $db->f("sender_id"), $message, $db->f("first"), $db->f("last"), FALSE);
            }
        } else {
            $query = 'SELECT * FROM message 
					WHERE account_id = ' . $player->account_id . ' AND
					game_id = ' . $player->game_id . '
					AND message_type_id = ' . $var["folder_id"] . '
					AND msg_read = "TRUE"
					ORDER BY send_time DESC';
            $db->query($query);
            while ($db->next_record()) {
                displayMessage($db->f("message_id"), $db->f("sender_id"), stripslashes($db->f("message_text")), $db->f("send_time"), $db->f("msg_read"), $var['folder_id']);
            }
        }
Example #10
0
$PHP_OUTPUT .= '<table width="60%" class="standard">';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th valign="top" width="50%">Relations (Global)</th>';
$PHP_OUTPUT .= '<th valign="top" width="50%">Relations (Personal)</th>';
$PHP_OUTPUT .= '</tr>';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<td valign="top" width="50%">';
$PHP_OUTPUT .= '<p>';
$RACES =& Globals::getRaces();
foreach ($RACES as $raceID => $race) {
    if ($raceID == 1) {
        continue;
    }
    $otherRaceRelations = Globals::getRaceRelations($player->getGameID(), $raceID);
    $PHP_OUTPUT .= $race['Race Name'] . ' : ' . get_colored_text($otherRaceRelations[$player->getRaceID()], $otherRaceRelations[$player->getRaceID()]) . '<br />';
}
$PHP_OUTPUT .= '</p>';
$PHP_OUTPUT .= '</td>';
$PHP_OUTPUT .= '<td valign="top">';
$PHP_OUTPUT .= '<p>';
foreach ($RACES as $raceID => $race) {
    if ($raceID == 1) {
        continue;
    }
    $PHP_OUTPUT .= $race['Race Name'] . ' : ' . get_colored_text($player->getPureRelation($raceID), $player->getPureRelation($raceID)) . '<br />';
}
$PHP_OUTPUT .= '</p>';
$PHP_OUTPUT .= '</td>';
$PHP_OUTPUT .= '</tr>';
$PHP_OUTPUT .= '</table>';
$PHP_OUTPUT .= '</p>';
function players_init(&$attackers, &$defenders)
{
    global $db, $session, $var, $player, $account;
    // Get the player we're attacking
    $db->query('SELECT land_on_planet,newbie_turns,dead,sector_id,account_id,player_id,player_name,race_id,alignment,ship_type_id,experience,alliance_id,credits,turns FROM player WHERE account_id=' . $var['target'] . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
    $db->next_record();
    if ($player->turns < 3) {
        $container = array();
        $container['url'] = 'skeleton.php';
        $container['body'] = 'current_sector.php';
        $container['msg'] = '<span class="red bold">ERROR:</span> You have insufficient turns to perform that action.';
        forward($container);
        exit;
    } else {
        if ($db->f('dead') == 'TRUE') {
            $container = array();
            $container['url'] = 'skeleton.php';
            $container['body'] = 'current_sector.php';
            $container['msg'] = '<span class="red bold">ERROR:</span> Target already dead.';
            forward($container);
            exit;
        } else {
            if ($db->f('sector_id') != $player->sector_id) {
                $container = array();
                $container['url'] = 'skeleton.php';
                $container['body'] = 'current_sector.php';
                $container['msg'] = '<span class="red bold">ERROR:</span> Target is no longer in this sector.';
                forward($container);
                exit;
            } else {
                if ($db->f('newbie_turns')) {
                    $container = array();
                    $container['url'] = 'skeleton.php';
                    $container['body'] = 'current_sector.php';
                    $container['msg'] = '<span class="red bold">ERROR:</span> Target is under newbie protection.';
                    forward($container);
                    exit;
                } else {
                    if ($db->f('land_on_planet') == 'TRUE') {
                        $container = array();
                        $container['url'] = 'skeleton.php';
                        $container['body'] = 'current_sector.php';
                        $container['msg'] = '<span class="red bold">ERROR:</span> Target is protected by planetary shields.';
                        forward($container);
                        exit;
                    }
                }
            }
        }
    }
    $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
    // Insert our own player into the players array
    $players[SmrSession::$old_account_id] = array((int) $player->player_id, get_colored_text($player->alignment, $player->player_name . ' (' . $player->player_id . ')'), (int) $player->alliance_id, (int) $player->race_id, (int) $player->credits, (int) $player->turns, (int) $player->alignment, (int) $player->ship_type_id, (int) $player->experience, 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
    // remove newbie gals
    //	// Get the galaxy name and id
    //	$db->query('SELECT
    //	galaxy_id
    //	FROM sector
    //	WHERE sector_id=' . $player->sector_id . '
    //	AND game_id=' . SmrSession::$game_id . '
    //	LIMIT 1');
    //
    //	$db->next_record();
    //	if($db->f('galaxy_id') < 9) {
    //		$protection = TRUE;
    //	}
    //	else {
    $protection = FALSE;
    //	}
    if ($player->alliance_id || $players[$var['target']][ALLIANCE_ID]) {
        //get treaty info
        $treaties_attacker = array(array(), array(), array());
        $treaties_defender = array(array(), array(), array());
        $db->query("SELECT alliance_id_1, alliance_id_2, trader_assist, trader_defend, trader_nap FROM alliance_treaties\n\t\t\t\t\tWHERE game_id = {$player->game_id}\n\t\t\t\t\tAND (alliance_id_1 = " . $players[$var['target']][ALLIANCE_ID] . " OR alliance_id_1 = {$player->alliance_id}\n\t\t\t\t\tOR alliance_id_2 = " . $players[$var['target']][ALLIANCE_ID] . " OR alliance_id_2 = {$player->alliance_id})\n\t\t\t\t\tAND (trader_assist = 1 OR trader_defend = 1)\n\t\t\t\t\tAND official = 'TRUE'");
        while ($db->next_record()) {
            if ($db->f("alliance_id_1") == $player->alliance_id) {
                if ($db->f("trader_nap")) {
                    $treaties_attacker[NAP][$db->f("alliance_id_2")] = $db->f("alliance_id_2");
                }
                if ($db->f("trader_assist")) {
                    $treaties_attacker[ASSIST][$db->f("alliance_id_2")] = $db->f("alliance_id_2");
                }
            } elseif ($db->f("alliance_id_2") == $player->alliance_id) {
                if ($db->f("trader_nap")) {
                    $treaties_attacker[NAP][$db->f("alliance_id_1")] = $db->f("alliance_id_1");
                }
                if ($db->f("trader_assist")) {
                    $treaties_attacker[ASSIST][$db->f("alliance_id_1")] = $db->f("alliance_id_1");
                }
            } elseif ($db->f("alliance_id_1") == $players[$var['target']][ALLIANCE_ID]) {
                if ($db->f("trader_nap")) {
                    $treaties_defender[NAP][$db->f("alliance_id_2")] = $db->f("alliance_id_2");
                }
                if ($db->f("trader_defend")) {
                    $treaties_defender[DEFEND][$db->f("alliance_id_2")] = $db->f("alliance_id_2");
                }
            } elseif ($db->f("alliance_id_2") == $players[$var['target']][ALLIANCE_ID]) {
                if ($db->f("trader_nap")) {
                    $treaties_defender[NAP][$db->f("alliance_id_1")] = $db->f("alliance_id_1");
                }
                if ($db->f("trader_defend")) {
                    $treaties_defender[DEFEND][$db->f("alliance_id_1")] = $db->f("alliance_id_1");
                }
            }
        }
        $attackers[] = $player->alliance_id;
        $defenders[] = $players[$var['target']][ALLIANCE_ID];
        foreach ($treaties_attacker[ASSIST] as $allID) {
            if (!isset($treaties_defender[NAP][$allID])) {
                $attackers[] = $allID;
            }
        }
        foreach ($treaties_defender[DEFEND] as $allID) {
            if (!isset($treaties_attacker[NAP][$allID])) {
                $defenders[] = $allID;
            }
        }
        $query = '
		SELECT 
		player.account_id as account_id,
		player.player_id as player_id,
		player.player_name as player_name,
		player.race_id as race_id,
		player.alignment as alignment,
		player.ship_type_id as ship_type_id,
		player.experience as experience,
		player.credits as credits,
		player.turns as turns,
		player.alliance_id as alliance_id
		FROM player';
        if ($protection) {
            $query .= ',account_has_stats,account	
				WHERE account.account_id = player.account_id
				AND account_has_stats.account_id = player.account_id';
            if ($account->get_rank() > BEGINNER || $account->veteran == 'TRUE') {
                $query2 = ' AND (
				(account_has_stats.kills >= 15 OR account_has_stats.experience_traded >= 60000) OR 
				(account_has_stats.kills >= 10 AND account_has_stats.experience_traded >= 40000)
				OR account.veteran="TRUE")';
            } else {
                $query2 = ' AND (
				(account_has_stats.kills < 15 AND account_has_stats.experience_traded < 60000) OR 
				(account_has_stats.kills < 10 AND account_has_stats.experience_traded < 40000)
				) AND account.veteran="FALSE"';
            }
            $query2 .= ' AND ';
        } else {
            $query2 = ' WHERE ';
        }
        $query .= $query2 . 'player.sector_id=' . $player->sector_id . '
			AND player.account_id!=' . SmrSession::$old_account_id . '
			AND player.account_id!=' . $var['target'] . '
			AND player.game_id=' . SmrSession::$game_id . ' 
			AND player.land_on_planet="FALSE" 
			AND player.newbie_turns=0
			AND player.last_active>' . (time() - 259200);
        if ($player->alliance_id && $players[$var['target']][ALLIANCE_ID]) {
            $query .= ' AND (player.alliance_id IN (' . implode(',', $attackers) . ')';
            $query .= ' OR player.alliance_id IN (' . implode(',', $defenders) . '))';
        } else {
            if ($player->alliance_id) {
                $query .= ' AND player.alliance_id IN (' . implode(',', $attackers) . ')';
            } else {
                if ($players[$var['target']][ALLIANCE_ID]) {
                    $query .= ' AND player.alliance_id IN (' . implode(',', $defenders) . ')';
                }
            }
        }
        $db->query($query);
        while ($db->next_record()) {
            $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
        }
    }
    // Figure out everyone's level
    $db->query('SELECT level_id,requirement FROM level ORDER BY requirement DESC');
    while ($db->next_record()) {
        $levels[$db->f('level_id')] = $db->f('requirement');
    }
    $num_players = count($players);
    $player_ids = array_keys($players);
    $num_levels = count($levels);
    $level_ids = array_keys($levels);
    for ($i = 0; $i < $num_players; ++$i) {
        for ($j = 0; $j < $num_levels; ++$j) {
            if ($levels[$level_ids[$j]] <= $players[$player_ids[$i]][EXPERIENCE]) {
                $players[$player_ids[$i]][LEVEL] = $level_ids[$j];
                break;
            }
        }
    }
    // Everyone involved gets decloaked if they fire or not
    $db->query('DELETE FROM ship_is_cloaked WHERE account_id IN (' . implode(',', $player_ids) . ') AND game_id=' . SmrSession::$game_id);
    return $players;
}
Example #12
0
}
if ($relations <= -300) {
    create_error('We will not trade with our enemies!');
}
if ($port->refresh_defense > time()) {
    create_error('We are still repairing damage caused during the last raid.');
}
// topic
print_topic("PORT IN SECTOR #{$player->sector_id}");
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "council_send_message.php";
$container["race_id"] = $port->race_id;
$container["race_name"] = $port->race_name;
print "<p>This is a level {$port->level} port and run by the " . create_link($container, $player->get_colored_race($port->race_id)) . ".<br>";
print "Your relations with them are " . get_colored_text($relations, $relations) . ".</p>";
print "<p>&nbsp;</p>";
$account->log(6, "Player examines port", $player->sector_id);
//The player is sent here after trading and sees this if his offer is accepted.
//You have bought/sold 300 units of Luxury Items for 1738500 credits. For your excellent trading skills you receive 220 experience points!
if (!empty($var["traded_xp"]) || !empty($var["traded_amount"]) || !empty($var["traded_good"]) || !empty($var["traded_credits"]) || !empty($var["traded_transaction"])) {
    print "<p>You have just " . $var["traded_transaction"] . " <span style=\"color:yellow;\">" . $var["traded_amount"] . "</span> units ";
    print "of <span style=\"color:yellow;\">" . $var["traded_good"] . "</span> for ";
    print "<span style=\"color:yellow;\">" . $var["traded_credits"] . "</span> credits.<br>";
    if ($var["traded_xp"] > 0) {
        print "<p>For your excellent trading skills you have gained <span style=\"color:blue;\">" . $var["traded_xp"] . "</span> experience points!</p>";
    }
    // test if we are searched. (but only if we hadn't a previous trade here
} elseif ($player->controlled != $player->sector_id) {
    $db->query("SELECT * FROM port_has_goods " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id} AND " . "(good_id = 5 OR good_id = 9 OR good_id = 12)");
    $base_chance = 15 - $db->nf() * 4;
Example #13
0
					&nbsp;
					<input type="submit" name="action" value="Decrease" id="InputFields"<?php 
    if ($VoteInfo['Decreased']) {
        ?>
 style="background-color:green"<?php 
    }
    ?>
 />
				</form>
			</td>
			<td align="center"><?php 
    echo get_colored_text($VoteInfo['RelationToThem']);
    ?>
</td>
			<td align="center"><?php 
    echo get_colored_text($VoteInfo['RelationToUs']);
    ?>
</td>
		</tr><?php 
}
?>
</table>

<p>&nbsp;</p><?php 
if ($VoteTreaties) {
    ?>
	<div class="center bold">Diplomatic Treaties</div><br />
	<div class="center standard">Each council member is granted one vote per treaty.<br />  Both racial presidents have the right to veto (remove) a Peace vote.</div><br />
	<table class="standard" align="center" width="65%">
		<tr>
			<th>Race</th>
function players_init(&$attackers, &$defenders)
{
    global $db, $session, $var, $player, $account;
    // Get the player we're attacking
    $db->query('SELECT land_on_planet,newbie_turns,dead,sector_id,account_id,player_id,player_name,race_id,alignment,ship_type_id,experience,alliance_id,credits,turns FROM player WHERE account_id=' . $var['target'] . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
    $db->next_record();
    if ($player->getTurns() < 3) {
        $container = array();
        $container['url'] = 'skeleton.php';
        $container['body'] = 'current_sector.php';
        $container['msg'] = '<span class="red bold">ERROR:</span> You have insufficient turns to perform that action.';
        forward($container);
        exit;
    } else {
        if ($db->f('dead') == 'TRUE') {
            $container = array();
            $container['url'] = 'skeleton.php';
            $container['body'] = 'current_sector.php';
            $container['msg'] = '<span class="red bold">ERROR:</span> Target already dead.';
            forward($container);
            exit;
        } else {
            if ($db->f('sector_id') != $player->getSectorID()) {
                $container = array();
                $container['url'] = 'skeleton.php';
                $container['body'] = 'current_sector.php';
                $container['msg'] = '<span class="red bold">ERROR:</span> Target is no longer in this sector.';
                forward($container);
                exit;
            } else {
                if ($db->f('newbie_turns')) {
                    $container = array();
                    $container['url'] = 'skeleton.php';
                    $container['body'] = 'current_sector.php';
                    $container['msg'] = '<span class="red bold">ERROR:</span> Target is under newbie protection.';
                    forward($container);
                    exit;
                } else {
                    if ($db->f('land_on_planet') == 'TRUE') {
                        $container = array();
                        $container['url'] = 'skeleton.php';
                        $container['body'] = 'current_sector.php';
                        $container['msg'] = '<span class="red bold">ERROR:</span> Target is protected by planetary shields.';
                        forward($container);
                        exit;
                    }
                }
            }
        }
    }
    $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
    // Insert our own player into the players array
    $players[SmrSession::$account_id] = array((int) $player->getPlayerID(), get_colored_text($player->getAlignment(), $player->getPlayerName() . ' (' . $player->getPlayerID() . ')'), (int) $player->getAllianceID(), (int) $player->getRaceID(), (int) $player->getCredits(), (int) $player->getTurns(), (int) $player->getAlignment(), (int) $player->getShipID(), (int) $player->getExperience(), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
    if ($player->getAllianceID() || $players[$var['target']][ALLIANCE_ID]) {
        //get treaty info
        $treaties_attacker = array(array(), array(), array());
        $treaties_defender = array(array(), array(), array());
        $db->query('SELECT alliance_id_1, alliance_id_2, trader_assist, trader_defend, trader_nap FROM alliance_treaties
					WHERE game_id = ' . $player->getGameID() . '
					AND (alliance_id_1 = ' . $players[$var['target']][ALLIANCE_ID] . ' OR alliance_id_1 = ' . $player->getAllianceID() . '
					OR alliance_id_2 = ' . $players[$var['target']][ALLIANCE_ID] . ' OR alliance_id_2 = ' . $player->getAllianceID() . ')
					AND (trader_assist = 1 OR trader_defend = 1)
					AND official = \'TRUE\'');
        while ($db->next_record()) {
            if ($db->f('alliance_id_1') == $player->getAllianceID()) {
                if ($db->f('trader_nap')) {
                    $treaties_attacker[NAP][$db->f('alliance_id_2')] = $db->f('alliance_id_2');
                }
                if ($db->f('trader_assist')) {
                    $treaties_attacker[ASSIST][$db->f('alliance_id_2')] = $db->f('alliance_id_2');
                }
            } elseif ($db->f('alliance_id_2') == $player->getAllianceID()) {
                if ($db->f('trader_nap')) {
                    $treaties_attacker[NAP][$db->f('alliance_id_1')] = $db->f('alliance_id_1');
                }
                if ($db->f('trader_assist')) {
                    $treaties_attacker[ASSIST][$db->f('alliance_id_1')] = $db->f('alliance_id_1');
                }
            } elseif ($db->f('alliance_id_1') == $players[$var['target']][ALLIANCE_ID]) {
                if ($db->f('trader_nap')) {
                    $treaties_defender[NAP][$db->f('alliance_id_2')] = $db->f('alliance_id_2');
                }
                if ($db->f('trader_defend')) {
                    $treaties_defender[DEFEND][$db->f('alliance_id_2')] = $db->f('alliance_id_2');
                }
            } elseif ($db->f('alliance_id_2') == $players[$var['target']][ALLIANCE_ID]) {
                if ($db->f('trader_nap')) {
                    $treaties_defender[NAP][$db->f('alliance_id_1')] = $db->f('alliance_id_1');
                }
                if ($db->f('trader_defend')) {
                    $treaties_defender[DEFEND][$db->f('alliance_id_1')] = $db->f('alliance_id_1');
                }
            }
        }
        $attackers[] = $player->getAllianceID();
        $defenders[] = $players[$var['target']][ALLIANCE_ID];
        foreach ($treaties_attacker[ASSIST] as $allID) {
            if (!isset($treaties_defender[NAP][$allID])) {
                $attackers[] = $allID;
            }
        }
        foreach ($treaties_defender[DEFEND] as $allID) {
            if (!isset($treaties_attacker[NAP][$allID])) {
                $defenders[] = $allID;
            }
        }
        $query = '
		SELECT 
		player.account_id as account_id,
		player.player_id as player_id,
		player.player_name as player_name,
		player.race_id as race_id,
		player.alignment as alignment,
		player.ship_type_id as ship_type_id,
		player.experience as experience,
		player.credits as credits,
		player.turns as turns,
		player.alliance_id as alliance_id
		FROM player WHERE player.sector_id=' . $player->getSectorID() . '
			AND player.account_id!=' . SmrSession::$account_id . '
			AND player.account_id!=' . $var['target'] . '
			AND player.game_id=' . SmrSession::$game_id . ' 
			AND player.land_on_planet=\'FALSE\' 
			AND player.newbie_turns=0
			AND player.last_active>' . (time() - 259200);
        if ($player->getAllianceID() && $players[$var['target']][ALLIANCE_ID]) {
            $query .= ' AND (player.alliance_id IN (' . implode(',', $attackers) . ')';
            $query .= ' OR player.alliance_id IN (' . implode(',', $defenders) . '))';
        } else {
            if ($player->getAllianceID()) {
                $query .= ' AND player.alliance_id IN (' . implode(',', $attackers) . ')';
            } else {
                if ($players[$var['target']][ALLIANCE_ID]) {
                    $query .= ' AND player.alliance_id IN (' . implode(',', $defenders) . ')';
                }
            }
        }
        $db->query($query);
        while ($db->next_record()) {
            $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0, array(), 0, 0, 0, 0);
        }
    }
    // Figure out everyone's level
    $db->query('SELECT level_id,requirement FROM level ORDER BY requirement DESC');
    while ($db->next_record()) {
        $levels[$db->f('level_id')] = $db->f('requirement');
    }
    $num_players = count($players);
    $player_ids = array_keys($players);
    $num_levels = count($levels);
    $level_ids = array_keys($levels);
    for ($i = 0; $i < $num_players; ++$i) {
        for ($j = 0; $j < $num_levels; ++$j) {
            if ($levels[$level_ids[$j]] <= $players[$player_ids[$i]][EXPERIENCE]) {
                $players[$player_ids[$i]][LEVEL] = $level_ids[$j];
                break;
            }
        }
    }
    // Everyone involved gets decloaked if they fire or not
    $db->query('DELETE FROM ship_is_cloaked WHERE account_id IN (' . implode(',', $player_ids) . ') AND game_id=' . SmrSession::$game_id);
    return $players;
}
Example #15
0
 protected function get_class_of_table($table)
 {
     global $db;
     $class_name = YZE_Object::format_class_name(rtrim($table, "s"), "Model");
     if (class_exists($class_name)) {
         return $class_name;
     }
     if (@self::$chain_tables[$table]) {
         //之前已经处理过了
         return self::$chain_tables[$table];
     }
     clear_terminal();
     echo wrap_output(sprintf(__("    ================================================================\r\n\t\t\r\n    未能识别关联表%s的Model类,请输入该类所在的module名(默认当前模块):"), $table));
     $module = get_input();
     if (!$module) {
         $module = $this->module_name;
     }
     self::$chain_tables[$table] = $module;
     if (class_exists("\\app\\{$module}\\{$class_name}")) {
         return "\\app\\{$module}\\{$class_name}";
     }
     echo get_colored_text(wrap_output(sprintf(__("    开始生成 %s..."), "\\app\\{$module}\\{$class_name}")), "blue", "white") . "\r\n";
     $object = new \yangzie\Generate_Model_Script(array("cmd" => "model", "base" => "table", "module_name" => $module, "class_name" => preg_replace('/_model$/i', "", $class_name), "table_name" => $table));
     $object->generate();
     echo "\r\n" . get_colored_text(wrap_output(sprintf(__("    生成结束 %s ."), "\\app\\{$module}\\{$class_name}")), "blue", "white") . "\r\n";
     return "\\app\\{$module}\\{$class_name}";
 }
Example #16
0
print "</tr>";
print "<tr>";
print "<td valign=\"top\" width=\"50%\">";
print "<p>";
$db->query("SELECT * FROM race");
while ($db->next_record()) {
    $race_id = $db->f("race_id");
    if ($race_id == 1) {
        continue;
    }
    $race_name = $db->f("race_name");
    print "{$race_name} : " . get_colored_text($player->relations_global_rev[$race_id], $player->relations_global_rev[$race_id]) . "<br>";
}
print "</p>";
print "</td>";
print "<td valign=\"top\">";
print "<p>";
$db->query("SELECT * FROM race");
while ($db->next_record()) {
    $race_id = $db->f("race_id");
    if ($race_id == 1) {
        continue;
    }
    $race_name = $db->f("race_name");
    print "{$race_name} : " . get_colored_text($player->relations[$race_id], $player->relations[$race_id]) . "<br>";
}
print "</p>";
print "</td>";
print "</tr>";
print "</table>";
print "</p>";
Example #17
0
 }
 echo '<br><br>Race : ' . $player->race_name;
 echo '<br>Turns : ' . $player->turns . '<br>';
 if ($player->newbie_turns > 0) {
     echo 'Newbie Turns Left: <span style="color:#';
     if ($player->newbie_turns > 20) {
         echo '00BB00';
     } else {
         echo 'BB0000';
     }
     echo ';">' . $player->newbie_turns . '</span><br>';
 }
 echo 'Cash : ' . number_format($player->credits) . '<br>';
 echo 'Experience : ' . number_format($player->experience) . '<br>';
 echo 'Level : ' . $player->level_id;
 echo '<br>Alignment : ' . get_colored_text($player->alignment, $player->alignment);
 echo '<br>Alliance : ' . $player->alliance_name;
 if ($player->alliance_id > 0) {
     echo ' (' . $player->alliance_id . ')';
 }
 echo '<br><br><b style="color:yellow;">' . $ship->ship_name . '</b><br>';
 $db->query("SELECT ship_name FROM ship_has_name WHERE game_id = {$player->game_id} AND " . "account_id = {$player->account_id} LIMIT 1");
 if ($db->next_record()) {
     //they have a name so we print it
     echo stripslashes($db->f("ship_name"));
 }
 echo 'Rating : ' . $ship->attack_rating() . '/' . $ship->defense_rating() . '<br>';
 // ******* Shields *******
 isset($ship->hardware[1]) ? $am = $ship->hardware[1] : ($am = 0);
 echo 'Shields : ';
 if ($under_attack_shields) {
Example #18
0
File: yze.php Project: ydhl/yangzie
 public function create_file($file_path, $content, $force = false)
 {
     if (file_exists($file_path) && !$force) {
         echo get_colored_text("file exists", "red", "white") . "\r\n";
         return;
     }
     $f = fopen($file_path, 'w+');
     if (empty($f)) {
         echo get_colored_text("can not open file:{$file_path}");
         return;
     }
     chmod($file_path, 0777);
     fwrite($f, $content);
     fclose($f);
     echo get_colored_text("OK.", "blue", "white") . "\r\n";
 }
Example #19
0
include get_file_loc('menue.inc');
print_trader_menue();
echo 'Bounties awaiting collection.<br><br>';
echo '<table cellspacing="0" cellpadding="0" class="standard fullwidth"><tr><th>Federal</th><th>Underground</th></tr>';
$bounties['HQ'] = array();
$bounties['UG'] = array();
$ids = array();
$db->query('SELECT amount,account_id,type FROM bounty WHERE claimer_id=' . SmrSession::$old_account_id . ' AND game_id=' . SmrSession::$game_id);
while ($db->next_record()) {
    $bounties[$db->f('type')][] = array($db->f('account_id'), $db->f('amount'));
    $ids[] = $db->f('account_id');
}
if (count($ids)) {
    $db->query('SELECT account_id,player_name,player_id,alignment FROM player WHERE account_id IN (' . implode(',', $ids) . ') AND game_id=' . SmrSession::$game_id . ' LIMIT ' . count($ids));
    while ($db->next_record()) {
        $players[$db->f('account_id')] = get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')');
    }
}
echo '<tr><td style="width:50%" class="top">';
if (count($bounties['HQ']) > 0) {
    foreach ($bounties['HQ'] as $bounty) {
        echo $players[$bounty[0]];
        echo ' : <span class="yellow">';
        echo number_format($bounty[1]);
        echo '</span>';
        echo '<br>';
    }
} else {
    echo 'None';
}
echo '</td><td style="width:50%" class="top">';
Example #20
0
// include helper file
require_once 'shop_goods.inc';
// create object from port we can work with
$port =& $player->getSectorPort();
$tradeable = checkPortTradeable($port, $player);
if ($tradeable !== true) {
    create_error($tradeable);
}
$portRelations = Globals::getRaceRelations($player->getGameID(), $port->getRaceID());
$relations = $player->getRelation($port->getRaceID());
// topic
$template->assign('PageTopic', 'Port In Sector #' . $player->getSectorID());
$container = create_container('skeleton.php', 'council_list.php');
$container['race_id'] = $port->getRaceID();
$PHP_OUTPUT .= '<p>This is a level ' . $port->getLevel() . ' port and run by the ' . create_link($container, $player->getColouredRaceName($port->getRaceID())) . '.<br />';
$PHP_OUTPUT .= 'Your relations with them are ' . get_colored_text($relations, $relations) . '.</p>';
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$account->log(LOG_TYPE_TRADING, 'Player examines port', $player->getSectorID());
//The player is sent here after trading and sees this if his offer is accepted.
//You have bought/sold 300 units of Luxury Items for 1738500 credits. For your excellent trading skills you receive 220 experience points!
if (!empty($var['traded_xp']) || !empty($var['traded_amount']) || !empty($var['traded_good']) || !empty($var['traded_credits']) || !empty($var['traded_transaction'])) {
    $PHP_OUTPUT .= '<p>You have just ' . $var['traded_transaction'] . ' <span class="yellow">' . $var['traded_amount'] . '</span> units ';
    $PHP_OUTPUT .= 'of <span class="yellow">' . $var['traded_good'] . '</span> for ';
    $PHP_OUTPUT .= '<span class="creds">' . $var['traded_credits'] . '</span> credits.<br />';
    if ($var['traded_xp'] > 0) {
        $PHP_OUTPUT .= '<p>For your excellent trading skills you have gained <span class="exp">' . $var['traded_xp'] . '</span> experience points!</p>';
    }
    // test if we are searched. (but only if we hadn't a previous trade here
} elseif ($player->getLastPort() != $player->getSectorID()) {
    $allGoods = $port->getGoodsAll();
    $base_chance = 15;
function getPlayerArray()
{
    if (DEBUG) {
        print "Entered player array<br>";
    }
    global $db, $session, $player, $account;
    //insert our trigger into the players array
    $query = "SELECT * FROM player WHERE account_id = " . $player->account_id . " AND game_id = " . $player->game_id;
    $db->query($query);
    $db->next_record();
    $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0);
    // remove newbie gals
    //	// Get the galaxy name and id
    //	$db->query('SELECT
    //	galaxy_id
    //	FROM sector
    //	WHERE sector_id=' . $player->sector_id . '
    //	AND game_id=' . SmrSession::$game_id . '
    //	LIMIT 1');
    //
    //	$db->next_record();
    //	if($db->f('galaxy_id') < 9) {
    //		$protection = TRUE;
    //	}
    //	else {
    $protection = FALSE;
    //	}
    //get treaty info
    $helperAlliances = array($player->alliance_id);
    $db->query("SELECT * FROM alliance_treaties \n\t\t\t\tWHERE game_id = {$player->game_id}\n\t\t\t\tAND (alliance_id_1 = {$player->alliance_id} OR alliance_id_2 = {$player->alliance_id})\n\t\t\t\tAND raid_assist = 1 AND official = 'TRUE'");
    while ($db->next_record()) {
        if ($db->f("alliance_id_1") == $player->alliance_id) {
            $helperAlliances[] = $db->f("alliance_id_2");
        } else {
            $helperAlliances[] = $db->f("alliance_id_1");
        }
    }
    if ($player->alliance_id) {
        $query = '
		SELECT 
		player.account_id as account_id,
		player.player_id as player_id,
		player.player_name as player_name,
		player.race_id as race_id,
		player.alignment as alignment,
		player.ship_type_id as ship_type_id,
		player.experience as experience,
		player.credits as credits,
		player.turns as turns,
		player.alliance_id as alliance_id
		FROM player';
        if ($protection) {
            $query .= ',account_has_stats,account	
				WHERE account.account_id = player.account_id
				AND account_has_stats.account_id = player.account_id';
            if ($account->get_rank() > BEGINNER || $account->veteran == 'TRUE') {
                $query2 = ' AND (
				(account_has_stats.kills >= 15 OR account_has_stats.experience_traded >= 60000) OR 
				(account_has_stats.kills >= 10 AND account_has_stats.experience_traded >= 40000)
				OR account.veteran="TRUE")';
            } else {
                $query2 = ' AND (
				(account_has_stats.kills < 15 AND account_has_stats.experience_traded < 60000) OR 
				(account_has_stats.kills < 10 AND account_has_stats.experience_traded < 40000)
				) AND account.veteran="FALSE"';
            }
            $query2 .= ' AND ';
        } else {
            $query2 = ' WHERE ';
        }
        $query .= $query2 . 'player.sector_id=' . $player->sector_id . '
			AND player.account_id!=' . SmrSession::$old_account_id . '
			AND player.game_id=' . SmrSession::$game_id . ' 
			AND player.land_on_planet="FALSE" 
			AND player.newbie_turns=0
			AND player.last_active>' . (TIME - 259200);
        $query .= ' AND player.alliance_id IN (' . implode(',', $helperAlliances) . ')';
        $db->query($query);
        while ($db->next_record()) {
            $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0);
        }
    }
    // Figure out everyone's level
    $db->query('SELECT level_id,requirement FROM level ORDER BY requirement DESC');
    while ($db->next_record()) {
        $levels[$db->f('level_id')] = $db->f('requirement');
    }
    $num_players = count($players);
    $player_ids = array_keys($players);
    $num_levels = count($levels);
    $level_ids = array_keys($levels);
    for ($i = 0; $i < $num_players; ++$i) {
        for ($j = 0; $j < $num_levels; ++$j) {
            if ($levels[$level_ids[$j]] <= $players[$player_ids[$i]][EXPERIENCE]) {
                $players[$player_ids[$i]][LEVEL] = $level_ids[$j];
                break;
            }
        }
    }
    // Everyone involved gets decloaked if they fire or not
    $db->query('DELETE FROM ship_is_cloaked WHERE account_id IN (' . implode(',', $player_ids) . ') AND game_id=' . SmrSession::$game_id);
    return $players;
}
Example #22
0
    if ($player->alliance_id && $players[$var['target']][ALLIANCE_ID]) {
        $query .= ' AND (player.alliance_id IN (' . implode(',', $attackers) . ')';
        $query .= ' OR player.alliance_id IN (' . implode(',', $defenders) . '))';
    } else {
        if ($player->alliance_id) {
            $query .= ' AND player.alliance_id IN (' . implode(',', $attackers) . ')';
        } else {
            if ($players[$var['target']][ALLIANCE_ID]) {
                $query .= ' AND player.alliance_id IN (' . implode(',', $defenders) . ')';
            }
        }
    }
    $query .= ' AND ship_type.ship_type_id = player.ship_type_id';
    $db->query($query);
    while ($db->next_record()) {
        $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), (int) $db->f('alignment'), 0, 0, 0, 0, array(), stripslashes($db->f("ship_name")), 0, 0, 0, 0);
    }
}
// Figure out everyone's level
$db->query('SELECT level_id,requirement,level_name FROM level ORDER BY requirement DESC');
while ($db->next_record()) {
    $levels[$db->f('level_id')] = $db->f('requirement');
    $levelNames[$db->f("level_id")] = $db->f("level_name");
}
$db->query("SELECT * FROM race");
while ($db->next_record()) {
    $races[$db->f("race_id")] = stripslashes($db->f("race_name"));
}
$num_players = count($players);
$player_ids = array_keys($players);
$num_levels = count($levels);
Example #23
0
    echo $Experience;
    ?>
/<?php 
    echo $NextLevelExperience;
    ?>
" alt="<?php 
    echo $Experience;
    ?>
/<?php 
    echo $NextLevelExperience;
    ?>
" /><br />
													</span>
												
												Alignment: <span id="align"><?php 
    echo get_colored_text($ThisPlayer->getAlignment(), number_format($ThisPlayer->getAlignment()));
    ?>
</span><br />
												
												Alliance: <span id="alliance"><a href="<?php 
    echo Globals::getAllianceHREF($ThisPlayer->getAllianceID());
    ?>
"><?php 
    echo $ThisPlayer->getAllianceName();
    if ($ThisPlayer->hasAlliance()) {
        echo '(' . number_format($ThisPlayer->getAllianceID()) . ')';
    }
    ?>
</a></span>
											</div>
										</td>
function getPlayerArray()
{
    if (DEBUG) {
        $PHP_OUTPUT .= 'Entered player array<br>';
    }
    global $db, $session, $player, $account;
    //insert our trigger into the players array
    $query = 'SELECT * FROM player WHERE account_id = ' . $player->getAccountID() . ' AND game_id = ' . $player->getGameID();
    $db->query($query);
    $db->next_record();
    $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0);
    //get treaty info
    $helperAlliances = array($player->getAllianceID());
    $db->query('SELECT * FROM alliance_treaties 
				WHERE game_id = ' . $player->getGameID() . '
				AND (alliance_id_1 = ' . $player->getAllianceID() . ' OR alliance_id_2 = ' . $player->getAllianceID() . ')
				AND raid_assist = 1 AND official = \'TRUE\'');
    while ($db->next_record()) {
        if ($db->f('alliance_id_1') == $player->getAllianceID()) {
            $helperAlliances[] = $db->f('alliance_id_2');
        } else {
            $helperAlliances[] = $db->f('alliance_id_1');
        }
    }
    if ($player->getAllianceID()) {
        $query = '
		SELECT 
		player.account_id as account_id,
		player.player_id as player_id,
		player.player_name as player_name,
		player.race_id as race_id,
		player.alignment as alignment,
		player.ship_type_id as ship_type_id,
		player.experience as experience,
		player.credits as credits,
		player.turns as turns,
		player.alliance_id as alliance_id
		FROM player WHERE player.sector_id=' . $player->getSectorID() . '
			AND player.account_id!=' . SmrSession::$account_id . '
			AND player.game_id=' . SmrSession::$game_id . ' 
			AND player.land_on_planet=\'FALSE\' 
			AND player.newbie_turns=0
			AND player.last_active>' . (TIME - 259200);
        $query .= ' AND player.alliance_id IN (' . implode(',', $helperAlliances) . ')';
        $db->query($query);
        while ($db->next_record()) {
            $players[$db->f('account_id')] = array((int) $db->f('player_id'), get_colored_text($db->f('alignment'), stripslashes($db->f('player_name')) . ' (' . $db->f('player_id') . ')'), (int) $db->f('alliance_id'), (int) $db->f('race_id'), (int) $db->f('credits'), (int) $db->f('turns'), (int) $db->f('alignment'), (int) $db->f('ship_type_id'), (int) $db->f('experience'), 0, 0, 0, 0, 0, false, array(), array(), 0, 0, 0);
        }
    }
    // Figure out everyone's level
    $db->query('SELECT level_id,requirement FROM level ORDER BY requirement DESC');
    while ($db->next_record()) {
        $levels[$db->f('level_id')] = $db->f('requirement');
    }
    $num_players = count($players);
    $player_ids = array_keys($players);
    $num_levels = count($levels);
    $level_ids = array_keys($levels);
    for ($i = 0; $i < $num_players; ++$i) {
        for ($j = 0; $j < $num_levels; ++$j) {
            if ($levels[$level_ids[$j]] <= $players[$player_ids[$i]][EXPERIENCE]) {
                $players[$player_ids[$i]][LEVEL] = $level_ids[$j];
                break;
            }
        }
    }
    // Everyone involved gets decloaked if they fire or not
    $db->query('DELETE FROM ship_is_cloaked WHERE account_id IN (' . implode(',', $player_ids) . ') AND game_id=' . SmrSession::$game_id);
    return $players;
}