コード例 #1
0
function umc_get_member_form($lot, $form = false)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    global $UMC_USER;
    $username = $UMC_USER['username'];
    $members = umc_get_active_members();
    $lot_members = umc_get_lot_members($lot);
    $out = '';
    if ($lot_members) {
        if ($form) {
            $out .= '<br>Check members you want to remove: ';
        }
        // make a form where existing members can be removed
        foreach ($lot_members as $UUID => $member) {
            // remoe all inactive members from the lot
            if (!isset($members[$UUID])) {
                XMPP_ERROR_trace("Removing inactive player {$UUID} from lot, list of active members:", $members);
                umc_lot_rem_player($UUID, $lot, 0);
            }
            if ($form) {
                $out .= "{$member} <input type=\"checkbox\" name=\"remove_member[{$UUID}]\">;";
            } else {
                $out .= "{$member}; ";
            }
        }
    } else {
        $out .= "No members";
    }
    if (!$form) {
        return $out;
    }
    $out .= "<br>Add member: <select name=\"new_member\">" . "<option value=\"none\">- none -</option>\n";
    foreach ($members as $member) {
        // do not add the lot owner
        if ($member == $username) {
            continue;
        }
        // do not add existing members again
        if (!$lot_members || !in_array($member, $lot_members)) {
            $out .= "<option value=\"{$member}\">{$member}</option>\n";
        }
    }
    $out .= "</select>";
    return $out;
}
コード例 #2
0
ファイル: info.inc.php プロジェクト: dani0010/uncovery_me
function umc_info_whereami()
{
    global $UMC_USER, $UMC_SETTING;
    $world = $UMC_USER['world'];
    $player = $UMC_USER['username'];
    $x = round($UMC_USER['coords']['x'], 1);
    $y = round($UMC_USER['coords']['y'], 1);
    $z = round($UMC_USER['coords']['z'], 1);
    // map coords
    $map_str = '';
    if (isset($UMC_SETTING['world_img_dim'][$world])) {
        $map = $UMC_SETTING['world_img_dim'][$world];
        $map_x = floor(conv_x($x, $map));
        $map_z = floor(conv_z($z, $map));
        $map_str = "{green}2D Map:{white} x: {$map_x}, z: {$map_z}";
    }
    $lot = umc_lot_get_from_coords($x, $z, $world);
    $lot_members = umc_get_lot_members($lot, false);
    $lot_owners = umc_get_lot_members($lot, true);
    if (!$lot) {
        $lot = 'No lot here';
    }
    // chunk
    $chunk_x = floor($x / 16);
    $chunk_z = floor($z / 16);
    // region
    $region_x = floor($x / 512);
    $region_z = floor($z / 512);
    // Yaw
    $yaw = round($UMC_USER['coords']['yaw'], 1);
    // -22.49969482421875 ?
    $yaw_arr = array(0 => 'South', 45 => 'SouthWest', 90 => 'West', 135 => 'NorthWest', 180 => 'North', 225 => 'NorthEast', 270 => 'East', 315 => 'SouthEast', 360 => 'South');
    $var = 22.5;
    $game_yaw = $yaw;
    if ($yaw < 0) {
        $yaw += 360;
    }
    $compass = false;
    foreach ($yaw_arr as $angle => $direction) {
        if ($yaw > $angle - $var && $yaw < $angle + $var) {
            $compass = $direction;
            break;
        }
    }
    // could not identify direction
    if (!$compass) {
        XMPP_ERROR_trigger("Could not idenfiy compass direction in /whereami");
        $compass = "******";
    }
    // time
    $date_today = umc_datetime();
    $today = $date_today->format('Y-m-d H:i:s');
    $world_str = ucwords($world);
    umc_header("Location for {$player}");
    umc_echo("{green}World:{white} {$world_str} {green}Lot:{white} {$lot} {green}Date:{white} {$today}");
    if ($lot_owners) {
        umc_echo("{green}Lot Owner:{white} " . implode(", ", $lot_owners));
        if ($lot_members) {
            umc_echo("{green}Lot Members:{white} " . implode(", ", $lot_members));
        }
    } else {
        umc_echo("{green}Lot Owner:{white} Unoccupied lot");
    }
    umc_echo("{green}Compass:{white} {$compass} {green}Yaw:{white} {$yaw} {green}Game-Yaw:{white} {$game_yaw}");
    umc_echo("{green}Coordinates:{white} x: {$x},  y: {$y},  z: {$z}");
    umc_echo("{green}Chunk:{white} x: {$chunk_x}, z: {$chunk_z} {green}Region:{white} x: {$region_x}, z: {$region_z} {$map_str}");
    umc_footer();
}