Example #1
0
 $ship_name = $api["ship"]->{"name"};
 $ship_health = number_format($api["ship"]->{"health"}->{"hull"} / 10000, 1);
 $ship_fuel = number_format($api["ship"]->{"fuel"}->{"main"}->{"level"} / $api["ship"]->{"fuel"}->{"main"}->{"capacity"} * 100, 1);
 $ship_cargo_cap = $api["ship"]->{"cargo"}->{"capacity"};
 $ship_cargo_used = $api["ship"]->{"cargo"}->{"qty"};
 /**
  * additional ship info
  */
 $ship_value = number_format($api["ship"]->{"value"}->{"total"});
 $ship_hull_value = number_format($api["ship"]->{"value"}->{"hull"});
 $ship_modules_value = number_format($api["ship"]->{"value"}->{"modules"});
 if (isset($api["stored_ships"])) {
     $stored_ships = "<br /><br /><strong>Stored ships</strong><br />";
     foreach ($api["stored_ships"] as $shipId => $stored_ship) {
         if ($shipId != $api["commander"]->{"currentShipId"}) {
             $ship_name = ship_name($stored_ship->{"name"});
             $docked_at_station = $stored_ship->{"station"}->{"name"};
             $docked_at_system = $stored_ship->{"starsystem"}->{"name"};
             $distance = get_distance($docked_at_system);
             $stored_ships .= $ship_name . ' (' . $distance . ')<br />';
             $stored_ships .= $docked_at_station . ' at <a href="/System?system_name=' . urlencode($docked_at_system) . '">';
             $stored_ships .= $docked_at_system . '</a><br /><br />';
         }
     }
 }
 $additional = '<div id="ship_status_mi" style="display:none">';
 $additional .= '<strong>Ship value:</strong> ' . $ship_value . ' CR<br />';
 $additional .= 'Hull: ' . $ship_hull_value . ' CR<br />';
 $additional .= 'Modules: ' . $ship_modules_value . ' CR' . $stored_ships;
 $additional .= '</div>';
 $data["ship_status"] = '<img src="/style/img/ship.png" class="icon" alt="Ship hull" />' . $ship_health . ' %';
Example #2
0
        if ($search == "balance") {
            $info = number_format($api["commander"]["credits"]);
        } elseif ($search == "rank" && isset($_GET["of"])) {
            $info = get_rank($_GET["of"], $api["commander"]["rank"][$_GET["of"]], false);
        }
    }
}
/**
 * ship data
 */
if (isset($_GET["ship"])) {
    $search = $_GET["ship"];
    if (isset($api["ship"])) {
        switch ($search) {
            case "name":
                $info = ship_name($api["ship"]["name"]);
                break;
            case "health":
                $info = number_format($api["ship"]["health"]["hull"] / 10000, 1);
                break;
            case "fuel":
                $info = number_format($api["ship"]["fuel"]["main"]["level"] / $api["ship"]["fuel"]["main"]["capacity"] * 100, 1);
                break;
            case "cargo_capacity":
                $info = $api["ship"]["cargo"]["capacity"];
                break;
            case "cargo_used":
                $info = $api["ship"]["cargo"]["qty"];
                break;
            case "value":
                $info = number_format($api["ship"]["value"]["total"]);
Example #3
0
    $ship_name = $api["ship"]["name"];
    $ship_health = number_format($api["ship"]["health"]["hull"] / 10000, 1);
    $ship_fuel = number_format($api["ship"]["fuel"]["main"]["level"] / $api["ship"]["fuel"]["main"]["capacity"] * 100, 1);
    $ship_cargo_cap = $api["ship"]["cargo"]["capacity"];
    $ship_cargo_used = $api["ship"]["cargo"]["qty"];
    /*
     *	additional ship info
     */
    $ship_value = number_format($api["ship"]["value"]["total"]);
    $ship_hull_value = number_format($api["ship"]["value"]["hull"]);
    $ship_modules_value = number_format($api["ship"]["value"]["modules"]);
    if (isset($api["stored_ships"])) {
        $stored_ships = "<br /><br /><strong>Stored ships</strong><br />";
        foreach ($api["stored_ships"] as $shipId => $stored_ship) {
            if ($shipId != $api["commander"]["currentShipId"]) {
                $ship_name = ship_name($stored_ship["name"]);
                $docked_at_station = $stored_ship["station"]["name"];
                $docked_at_system = $stored_ship["starsystem"]["name"];
                $distance = get_distance($docked_at_system);
                $stored_ships .= '' . $ship_name . ' (' . $distance . ')<br />' . $docked_at_station . ' at <a href="/system.php?system_name=' . urlencode($docked_at_system) . '">' . $docked_at_system . '</a><br /><br />';
            }
        }
    }
    $additional = '<div id="ship_status_mi" style="display:none"><strong>Ship value:</strong> ' . $ship_value . ' CR<br />Hull: ' . $ship_hull_value . ' CR<br />Modules: ' . $ship_modules_value . ' CR' . $stored_ships . '</div>';
    $data['ship_status'] = '<img src="/style/img/ship.png" style="margin-right:6px" alt="Ship hull" />' . $ship_health . ' %<img src="/style/img/fuel.png" style="margin-right:6px;margin-left:6px;margin-bottom:4px" alt="Ship fuel" />' . $ship_fuel . ' %<img src="/style/img/cargo.png" style="margin-right:6px;margin-left:6px" alt="Ship cargo" />' . $ship_cargo_used . '/' . $ship_cargo_cap . '' . $additional . '';
}
/*
*	write to cache
*/
if (!file_put_contents("" . $_SERVER["DOCUMENT_ROOT"] . "/cache/cmdr_status.html", $data["cmdr_status"])) {
    $error = error_get_last();
Example #4
0
        if ($search == "balance") {
            $info = number_format($api["commander"]->{"credits"});
        } elseif ($search == "rank" && isset($_GET["of"])) {
            $info = get_rank($_GET["of"], $api["commander"]->{"rank"}->{$_GET["of"]}, false);
        }
    }
}
/**
 * ship data
 */
if (isset($_GET["ship"])) {
    $search = $_GET["ship"];
    if (isset($api["ship"])) {
        switch ($search) {
            case "name":
                $info = ship_name($api["ship"]->{"name"});
                break;
            case "health":
                $info = number_format($api["ship"]->{"health"}->{"hull"} / 10000, 1);
                break;
            case "fuel":
                $info = number_format($api["ship"]->{"fuel"}->{"main"}->{"level"} / $api["ship"]->{"fuel"}->{"main"}->{"capacity"} * 100, 1);
                break;
            case "cargo_capacity":
                $info = $api["ship"]->{"cargo"}->{"capacity"};
                break;
            case "cargo_used":
                $info = $api["ship"]->{"cargo"}->{"qty"};
                break;
            case "value":
                $info = number_format($api["ship"]->{"value"}->{"total"});