Exemplo n.º 1
0
function get_global_SVGTransform($uid, $type = 0, $sid = 0, $innerHeight = 0, $innerWidth = 0)
{
    $homeWorld = get_homeworld($uid);
    $homeSystem = get_sid_by_pid($homeWorld);
    $homeCoords = get_system_coords($homeSystem, 2);
    $homeX = $homeCoords[x];
    $homeY = $homeCoords[y];
    if ($type == 1) {
        $systemCoords = get_system_coords($sid, 2);
        $systemX = $systemCoords[x];
        $systemY = $systemCoords[y];
        if ($innerWidth < 800) {
            $systemCoords = $systemX - $homeX + $innerWidth / 3 . " " . ($systemY - $homeY + $innerHeight / 2);
        } else {
            $systemCoords = $systemX - $homeX + $innerWidth / 2 . " " . ($systemY - $homeY + $innerHeight / 2);
        }
        return $systemCoords;
    } else {
        if ($innerWidth < 800) {
            $systemCoords = -$homeX + $innerWidth / 3 . " " . (-$homeY + $innerHeight / 2);
        } else {
            $systemCoords = -$homeX + $innerWidth / 2 . " " . (-$homeY + $innerHeight / 2);
        }
        return $systemCoords;
    }
}
Exemplo n.º 2
0
function proc_leave()
{
    global $uid;
    if (has_alliance_lock($uid)) {
        show_message("You can't use any alliance options due to an alliance lock!");
        return false;
    }
    $sth = mysql_query("select u.alliance from users u, alliance a where a.id = u.alliance and u.id not in (a.milminister, a.leader, a.forminister, a.devminister) and u.id=" . $uid);
    if (!$sth) {
        show_message("Database Failure C1");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        show_message("AgaFu Bloeck");
        return 0;
    }
    if (!remove_from_alliance($uid)) {
        show_error("ERR::REMOVE FROM ALLIANCE");
        return false;
    }
    $homeworld = get_homeworld($uid);
    // mop: eigentlich suboptimal. dann kommt die ganze flotte zum heimatplaneten (also auch kriegsschiffe)
    $sth = mysql_query("update fleet_info set sid=" . get_sid_by_pid($homeworld) . ",pid={$homeworld} where uid={$uid}");
    if (!$sth) {
        show_error("Database failure!");
    }
    show_message("Your fleets have been moved to your homeplanet!");
    show_message("You have left the alliance");
}
Exemplo n.º 3
0
function startup()
{
    global $uid;
    global $ses;
    global $globalTranslate;
    $availHeight = $_GET["availHeight"];
    $availWidth = $_GET["availWidth"];
    $globalTranslate = get_global_SVGTransform($uid, 0, 0, $availHeight, $availWidth);
    $ses->reg("globalTranslate");
    $universe = new universe();
    $cids = $universe->get_surrounding_constellations(get_cid_by_sid(get_sid_by_pid(get_homeworld($uid))));
    $GLOBALS["map_info"] = new map_info($uid, $cids);
    get_svg_stars_of_cids($cids, $fleet_symbols, $fleet_routes, $scans, $systems);
    echo "<g id=\"startranslate\" transform=\"translate(" . $globalTranslate . ")\">";
    // runelord: zuerst die scans, damit die nix verdecken
    echo "<g id=\"fleet_scans\">\n";
    echo $scans;
    echo "</g>\n";
    // mop: dann die constellationen malen, damit die sterne drüberliegen können
    echo "<g id=\"constellationgrid\">";
    constellation_grid();
    echo "</g>";
    echo "<g id=\"stars\">";
    echo $systems;
    echo "</g>";
    echo "<g id=\"flottenpfade\">\n";
    echo $fleet_routes;
    echo "</g>\n";
    echo "<g id=\"fleet_symbols\">\n";
    echo $fleet_symbols;
    echo "</g>\n";
    echo "</g>";
    $coords = $universe->get_coords_by_cids($cids);
    $translate = explode(" ", $globalTranslate);
    echo "\n<!-- " . ($coords[0] + $translate[0]) . " " . ($coords[1] + $translate[0]) . " " . ($coords[2] + $translate[1]) . " " . ($coords[3] + $translate[1]) . " -->";
}