2011-07-22 00:26:32 +02:00
|
|
|
regionConstructors['Residence'] = function(dynmap, configuration) {
|
|
|
|
// Helper function.
|
|
|
|
function createBoxFromArea(area, boxCreator) {
|
|
|
|
return boxCreator(area.X1, area.X2, area.Y1, area.Y2, area.Z1, area.Z2);
|
|
|
|
}
|
2011-04-14 02:58:25 +02:00
|
|
|
|
2011-07-28 05:42:55 +02:00
|
|
|
$.getJSON('standalone/res_' + configuration.worldName + '.json', function(data) {
|
2011-07-22 00:26:32 +02:00
|
|
|
var boxLayers = [];
|
2011-07-21 02:16:00 +02:00
|
|
|
$.each(data, function(name, residence) {
|
2011-07-28 05:42:55 +02:00
|
|
|
if(configuration.worldName == residence.Permissions.World) {
|
2011-07-22 00:26:32 +02:00
|
|
|
$.each(residence.Areas, function(name, area) {
|
|
|
|
var boxLayer = configuration.createBoxLayer(area.X1, area.X2, area.Y1, area.Y2, area.Z1, area.Z2);
|
|
|
|
|
|
|
|
boxLayer.bindPopup(configuration.createPopupContent(name, $.extend(residence, {
|
|
|
|
owners: { players: [residence.Permissions.Owner] },
|
2011-07-28 05:42:55 +02:00
|
|
|
flags: residence.Permissions.AreaFlags
|
2011-07-22 00:26:32 +02:00
|
|
|
})));
|
|
|
|
|
|
|
|
boxLayers.push(boxLayer);
|
|
|
|
});
|
2011-07-21 02:16:00 +02:00
|
|
|
}
|
2011-04-14 02:58:25 +02:00
|
|
|
});
|
2011-07-22 00:26:32 +02:00
|
|
|
configuration.result(new L.LayerGroup(boxLayers));
|
2011-07-21 02:16:00 +02:00
|
|
|
|
2011-04-14 02:58:25 +02:00
|
|
|
});
|
2011-07-21 02:16:00 +02:00
|
|
|
};
|