";
}
function echo_chunkymap_controls() {
global $chunkymap_view_x;
global $chunkymap_view_z;
global $chunkymap_view_zoom;
global $chunkymap_view_max_zoom;
global $chunkymap_view_min_zoom;
global $chunkymap_anchor_name;
global $chunkymap_change_zoom_multiplier;
$is_in=false;
$is_out=false;
$in_img_name = "zoom_in.png";
$out_img_name = "zoom_out.png";
$in_zoom = $chunkymap_view_zoom;
if ($in_zoom<$chunkymap_view_max_zoom) {
$is_in=true;
$in_zoom = $chunkymap_view_zoom*$chunkymap_change_zoom_multiplier;
//echo "in:$in_zoom ";
}
else $in_img_name = "zoom_in_disabled.png";
$out_zoom = $chunkymap_view_zoom;
if ($out_zoom>$chunkymap_view_min_zoom) {
$is_out=true;
$out_zoom = ($chunkymap_view_zoom/$chunkymap_change_zoom_multiplier);
}
else $out_img_name = "zoom_out_disabled.png";
$zoom_clip = $chunkymap_view_max_zoom;
$found=false;
while ($zoom_clip>=$chunkymap_view_min_zoom) {
if ($out_zoom>$zoom_clip) {
$out_zoom=$zoom_clip*2;
$found=true;
break;
}
$zoom_clip = $zoom_clip/2;
}
if (!$found) {
$out_zoom=$chunkymap_view_min_zoom;
}
//if ($in_zoom>$chunkymap_view_max_zoom) {
// $in_zoom=$chunkymap_view_max_zoom;
// echo "";
//}
//elseif ($in_zoom>200) $in_zoom=400;
//elseif ($in_zoom>100) $in_zoom=200;
//elseif ($in_zoom>75) $in_zoom=100;
//if ($in_zoom>50) $in_zoom=75;
//elseif ($in_zoom>25) $in_zoom=50;
//elseif ($in_zoom>12) $in_zoom=25;
//elseif ($in_zoom>4) $in_zoom=12;
//elseif ($in_zoom>2) $in_zoom=4;
//elseif ($in_zoom>1) $in_zoom=2;
//else $in_zoom=$chunkymap_view_min_zoom; // if ($in_zoom>1) $in_zoom=5;
//echo "in:$in_zoom ";
// if ($out_zoom<$chunkymap_view_min_zoom) $out_zoom=$chunkymap_view_min_zoom;
// elseif ($out_zoom<2) $out_zoom=1;
// elseif ($out_zoom<4) $out_zoom=2;
// elseif ($out_zoom<12) $out_zoom=4;
// elseif ($out_zoom<25) $out_zoom=12;
// elseif ($out_zoom<50) $out_zoom=25;
// elseif ($out_zoom<75) $out_zoom=50;
// elseif ($out_zoom<100) $out_zoom=75;
//elseif ($out_zoom<200) $out_zoom=100;
//elseif ($out_zoom<$chunkymap_view_max_zoom) $out_zoom=(int)($chunkymap_view_max_zoom/2);
//else $out_zoom=$chunkymap_view_max_zoom; //if ($out_zoom>76) $out_zoom=100;
$zoom_clip=$chunkymap_view_min_zoom;
$found=false;
while ($zoom_clip<=$chunkymap_view_max_zoom) {
if ($in_zoom<($zoom_clip*2)) {
$in_zoom=$zoom_clip;
$found=true;
break;
}
$zoom_clip = $zoom_clip * 2;
}
if (!$found) $in_zoom=$chunkymap_view_max_zoom;
$in_html="";
$out_html="";
global $world_name;
$append_vars="";
if (isset($world_name)) {
$append_vars.="&"."world_name=$world_name";
}
if ($is_in) $in_html="$in_html";
if ($is_out) $out_html="$out_html";
echo $in_html;
echo $out_html;
}
function echo_decachunk_table() {
global $chunkymap_view_x;
global $chunkymap_view_z;
global $chunkymap_view_zoom;
global $chunkymap_view_max_zoom;
global $chunkymap_view_min_zoom;
global $showplayers;
global $decachunk_dot_and_ext;
global $decachunk_prefix_then_x_string;
global $td_decachunk_placeholder_content;
global $td_1px_placeholder_content;
global $chunkymap_camera_pan_delta;
check_world();
global $chunkymapdata_thisworld_path;
global $world_name;
global $chunkymapdata_worlds_path;
global $z_opener;
if ($chunkymap_view_zoom<$chunkymap_view_min_zoom) $chunkymap_view_zoom = $chunkymap_view_min_zoom;
if ($chunkymap_view_zoom>$chunkymap_view_max_zoom) $chunkymap_view_zoom = $chunkymap_view_max_zoom;
$decachunks_per_page = intval(6.0/$chunkymap_view_zoom);
if ($decachunks_per_page<1) {
$decachunks_per_page = 1;
}
$viewer_ratio = 16.0/9.0;
$world_camera_w = 6.0 * (1.0/$chunkymap_view_zoom);
$world_camera_h = $world_camera_w;
//$world_camera_w = (($decachunks_per_page*160.0));
//$world_camera_h = (($decachunks_per_page*160.0));
$view_left = (($chunkymap_view_x)) - (($world_camera_w/2.0));
$view_right = $view_left + $world_camera_w;
//z is cartesian still:
$view_top = (($chunkymap_view_z)) + (($world_camera_h/2.0));
$view_bottom = $view_top - $world_camera_h;
echo_chunkymap_anchor();
echo_chunkymap_controls();
echo "\r\n";
echo " ".($chunkymap_view_zoom*100.0)."%\r\n";//(string)((int)($chunkymap_view_zoom*100+.5));
//"chunkymapdata/images/compass_rose.png"
//"chunkymapdata/images/start.png"
$decachunky_min_x = get_decachunky_coord_from_location($view_left);
$decachunky_min_z = get_decachunky_coord_from_location($view_bottom);
$decachunky_max_x = get_decachunky_coord_from_location($view_right);
$decachunky_max_z = get_decachunky_coord_from_location($view_top);
$decachunky_count_x = $decachunky_max_x-$decachunky_min_x+1;
$decachunky_count_z = $decachunky_max_z-$decachunky_min_z+1;
//#region local vars
$generated_yml_path = $chunkymapdata_thisworld_path."/generated.yml";
//#endregion local vars
$decachunky_z=$decachunky_max_z;
//echo "
";
//echo "$decachunky_min_x:$decachunky_max_x,$decachunky_min_z:$decachunky_max_z
";
echo '
'."$td_decachunk_placeholder_content".' | '."\r\n"; echo "".''.' | '."\r\n"; echo ''."$td_decachunk_placeholder_content".' | '."\r\n"; echo '|||
".''.' | '."\r\n"; echo ''."\r\n";
echo '
| '."\r\n";
echo " ".''.' | '."\r\n"; echo '|||
'."$td_decachunk_placeholder_content".' | '."\r\n"; echo "".''.' | '."\r\n"; echo ''."$td_decachunk_placeholder_content".' | '."\r\n"; echo '
");
echo_hold(" "); //causes child's absolute position to be relative to this div's location, as per http://www.w3schools.com/css/tryit.asp?filename=trycss_position_absolute
$chunk_luid = "x".$x."z".$z;
$chunk_img_path = get_chunk_image_path_from_chunky_coords($x, $z);
if (is_file($chunk_img_path)) {
echo_hold( "");
}
else {
//echo_hold( " ");
}
if (isset($chunk_assoc[$chunk_luid]["players_count"])) {
echo "";
$nonprivate_name_beginning_char_count = 20;
for ($player_count=0; $player_count<$chunk_assoc[$chunk_luid]["players_count"]; $player_count++) {
$rel_x = $chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["rel_x"];
$rel_z = $chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["rel_z"];
$is_expired=false;
$is_idle=false;
if (isset($chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["file_path"])) {
$last_player_update_time=filemtime($chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["file_path"]);
if (time()-$last_player_update_time > $player_file_age_expired_max_seconds) {
$is_expired=true;
}
elseif (time()-$last_player_update_time > $player_file_age_idle_max_seconds) {
$is_idle=true;
}
}
$text = $chunk_assoc[$chunk_luid]["players"][$player_count]["text"];
if (strlen($chunk_assoc[$chunk_luid]["players"][$player_count]["text"])>$nonprivate_name_beginning_char_count) {
$text = substr($text, 0, $nonprivate_name_beginning_char_count)."*";
}
//show head full size (not zoomed):
$zoomed_head_w=$character_icon_w;//(int)((float)$character_icon_w*$scale+.5);
$zoomed_head_h=$character_icon_h;//(int)((float)$character_icon_h*$scale+.5);
$rel_x -= (int)($zoomed_head_w/2);
$rel_z -= (int)($zoomed_head_h/2);
//$img_style="position:absolute; ";
$img_style="";
$img_border_style="border: 1px solid white;";
$text_style="color:white;";
if ($is_expired==false) {
if ($is_idle==true) {
$img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
}
echo_hold( " ");
echo_hold( "$text " );
}
//$position_offset_x+=$character_icon_w;
}
}
else echo "";
if (isset($chunk_assoc[$chunk_luid]["markers_count"])) {
echo "";
$nonprivate_name_beginning_char_count = 20;
for ($marker_count=0; $marker_count<$chunk_assoc[$chunk_luid]["markers_count"]; $marker_count++) {
$rel_x = $chunk_assoc[$chunk_luid][ "markers" ][ $marker_count ]["rel_x"];
$rel_z = $chunk_assoc[$chunk_luid][ "markers" ][ $marker_count ]["rel_z"];
$is_expired=false;
$is_idle=false;
// if (isset($chunk_assoc[$chunk_luid][ "markers" ][ $marker_count ]["file_path"])) {
// $last_marker_update_time=filemtime($chunk_assoc[$chunk_luid][ "markers" ][ $marker_count ]["file_path"]);
// if (time()-$last_marker_update_time > $marker_file_age_expired_max_seconds) {
// $is_expired=true;
// }
// elseif (time()-$last_marker_update_time > $marker_file_age_idle_max_seconds) {
// $is_idle=true;
// }
// }
$text = $chunk_assoc[$chunk_luid]["markers"][$marker_count]["text"];
$image_path = "";
if (isset($chunk_assoc[$chunk_luid]["markers"][$marker_count]["image"])) {
$image_path = $chunk_assoc[$chunk_luid]["markers"][$marker_count]["image"];
}
if (strlen($chunk_assoc[$chunk_luid]["markers"][$marker_count]["text"])>$nonprivate_name_beginning_char_count) {
$text = substr($text, 0, $nonprivate_name_beginning_char_count)."*";
}
//show head full size (not zoomed):
//$zoomed_head_w=$character_icon_w;//(int)((float)$character_icon_w*$scale+.5);
//$zoomed_head_h=$character_icon_h;//(int)((float)$character_icon_h*$scale+.5);
$zoomed_image_w=16;
$zoomed_image_h=16;
$rel_x -= (int)($zoomed_image_w/2);
$rel_z -= (int)($zoomed_image_h/2);
//$img_style="position:absolute; ";
$img_style="";
$img_border_style="";
//$img_border_style="border: 1px solid white;";
$text_style="color:white;";
if ($is_expired==false) {
if ($is_idle==true) {
$img_border_style="";
//$img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
}
echo_hold( "$text " );
}
//$position_offset_x+=$character_icon_w;
}
}
else echo "";
//echo " ".$x.",0,".$z; echo_hold($alignment_comment); echo_hold(" | \r\n");
$x++;
}
echo_hold( "