All pastes #1632382 Raw Edit

Something

public text v1 · immutable
#1632382 ·published 2009-10-20 11:11 UTC
rendered paste body
javascript:
var galaxyId;
var systemName = '';
galaxyId = 1;
var radius = 400;
var mydiv = document.getElementById("mapDet");
if (mydiv !== null) {
	mydiv.parentNode.removeChild(mydiv);
}
var divPlanets = document.createElement("textarea");
divPlanets.setAttribute("id", "mapDet");
divPlanets.setAttribute("align", "right");
divPlanets.setAttribute("width", "800px");
divPlanets.style.zIndex = 20000;
divPlanets.style.position = "absolute";
divPlanets.style.textAlign = "left";
divPlanets.style.bottom = "62px";
divPlanets.style.left = "5px";
divPlanets.style.width = "800px";
divPlanets.display = "";
divPlanets.readOnly=true;
var mapMessage = 'x,y,idx,player_name,planet_name,planet_type,planet_inhabitants,planet_alliance,solar,wind,water,thermal\n';
for (var systemName in mapData) {
	for (var j = 0; j < 9; j++)	{
		var idx = '0' + j;
		var op = systemName + idx;
		if (typeof((mapData[systemName].planets)[op]) != 'undefined') {
			var planet = (mapData[systemName].planets)[op];
			var systemId = Math.floor(op / 100);
			var y = radius - Math.floor(systemId / (radius * 2 + 1));
			var x = systemId - (radius + 1) - (radius - y) * (radius * 2 + 1);
			mapMessage = mapMessage + x + ',' + y + ',' + idx + ',';
			var planet_type = planet.planet_type_id;
			if (planet_type == 6) { planet_type = 'volcanic'; }
			else if (planet_type == 5) { planet_type = 'desert'; }
			else if (planet_type == 4) { planet_type = 'earthlike'; }
			else if (planet_type == 3) { planet_type = 'aquatic'; }
			else if (planet_type == 2) { planet_type = 'ice'; }
			else if (planet_type == 1) { planet_type = 'gas giant'; }
			if (planet.player_name !== null) {
				mapMessage += planet.player_name + ',' + planet.planet_name + ',' + planet_type + ',' + planet.inhabitants + ',' + planet.alliance_name + ',,,,,\n';
			}
			else {
			    mapMessage += ',,' + planet_type + ',,,' + planet.climate.solar + ',' + planet.climate.wind + ',' + planet.climate.water + ',' + planet.climate.thermal + ',\n';
			}
		}
	}
}  
divPlanets.innerHTML = mapMessage;
document.body.appendChild(divPlanets);

var mydiv = document.getElementById("mapComets");
if (mydiv !== null) {
	mydiv.parentNode.removeChild(mydiv);
}
var divComets = document.createElement("textarea");
divComets.setAttribute("id", "mapComets");
divComets.setAttribute("align", "right");
divComets.setAttribute("width", "800px");
divComets.style.zIndex = 20000;
divComets.style.position = "absolute";
divComets.style.textAlign = "left";
divComets.style.bottom = "5px";
divComets.style.left = "5px";
divComets.style.width = "800px";
divComets.display = "";
divComets.readOnly=true;
var mapComets = 'x,y,name,metal,crystal,deuterium\n';
for (var systemName in mapData) {
	var cometA = mapData[systemName].comets;
	if (typeof(cometA) != 'undefined') {
		var y = radius - Math.floor(systemName / (radius * 2 + 1));
		var x = systemName - (radius + 1) - (radius - y) * (radius * 2 + 1);
		for (var i = 0; i < cometA.length; i++) {
			mapComets += x+','+y+','+cometA[i].name+','+cometA[i].r1+','+cometA[i].r2+','+cometA[i].r3+'\n';
		}
	}
}
divComets.innerHTML = mapComets;
document.body.appendChild(divComets);

void 0;