World 7 Maps do yourself

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Re: World 7 Maps do yourself

Postby AmrothAnarion » Wed Aug 07, 2013 8:37 pm

That may be my problem, I searched and I do not have a file named map.html
Image
User avatar
AmrothAnarion
 
Posts: 26
Joined: Thu Jul 18, 2013 9:41 pm

Re: World 7 Maps do yourself

Postby borka » Thu Aug 08, 2013 2:12 am

take a look into cave folder...
map.html
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>H&amp;H current session map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
   html { height: 100% }
   body { height: 100%; margin: 0px; padding: 0px }
   #map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">

var currentSession = 0;

function myProjection() {
   var MAP_RANGE = 51200;
   this.worldOrigin_ = new google.maps.Point(0, 0);
   this.pixelsPerLonDegree_ = MAP_RANGE / 360;
   this.pixelsPerLatDegree_ = MAP_RANGE / 180;
};
 
myProjection.prototype.fromLatLngToPoint = function(latLng) {
   var origin = this.worldOrigin_;
   var x = origin.x + latLng.lng() * this.pixelsPerLonDegree_;
   var y = origin.y + latLng.lat() * this.pixelsPerLatDegree_;
   return new google.maps.Point(x, y);
};
 
myProjection.prototype.fromPointToLatLng = function(point) {
   var origin = this.worldOrigin_;
   var lng = (point.x - origin.x) / this.pixelsPerLonDegree_;
   var lat = (point.y - origin.y) / this.pixelsPerLatDegree_;
   return new google.maps.LatLng(lat, lng);
};

function CoordMapType(tileSize) {
   this.tileSize = tileSize;
}

CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
   var div = ownerDocument.createElement('DIV');
   div.innerHTML = coord;
   div.style.width = this.tileSize.width + 'px';
   div.style.height = this.tileSize.height + 'px';
   div.style.fontSize = '16px';
   div.style.borderStyle = 'solid';
   div.style.borderWidth = '1px';
   div.style.borderColor = 'yellow';
   div.style.color = 'yellow';
   return div;
};

function HomeControl(controlDiv, map) {
   controlDiv.style.padding = '5px';
   var controlUI = document.createElement('DIV');
   controlUI.style.backgroundColor = 'white';
   controlUI.style.borderStyle = 'solid';
   controlUI.style.borderWidth = '2px';
   controlUI.style.cursor = 'pointer';
   controlUI.style.textAlign = 'center';
   controlUI.title = 'Click to go to start point';
   controlDiv.appendChild(controlUI);
   var controlText = document.createElement('DIV');
   controlText.style.fontFamily = 'Arial,sans-serif';
   controlText.style.fontSize = '12px';
   controlText.style.paddingLeft = '4px';
   controlText.style.paddingRight = '4px';
   controlText.innerHTML = 'Go to start point';
   controlUI.appendChild(controlText);
   google.maps.event.addDomListener(controlUI, 'click', function() {
      map.setCenter(new google.maps.LatLng(0, 0))
   });
}

function GridControl(controlDiv, map) {
   controlDiv.style.padding = '5px';
   var controlUI = document.createElement('DIV');
   controlUI.style.backgroundColor = 'white';
   controlUI.style.borderStyle = 'solid';
   controlUI.style.borderWidth = '2px';
   controlUI.style.cursor = 'pointer';
   controlUI.style.textAlign = 'center';
   controlUI.title = 'Click to show or hide grid';
   controlDiv.appendChild(controlUI);
   var controlText = document.createElement('DIV');
   controlText.style.fontFamily = 'Arial,sans-serif';
   controlText.style.fontSize = '12px';
   controlText.style.paddingLeft = '4px';
   controlText.style.paddingRight = '4px';
   controlText.innerHTML = 'Show/Hide grid';
   controlUI.appendChild(controlText);
   google.maps.event.addDomListener(controlUI, 'click', function() {
      if (map.overlayMapTypes.getLength()) {
         map.overlayMapTypes.pop();
      }
      else {
         map.overlayMapTypes.push(new CoordMapType(new google.maps.Size(100, 100)))
      }
   });
}


function initialize() {

   var map;

   var myMapType = new google.maps.ImageMapType({
      tileSize: new google.maps.Size(100, 100),
      minZoom: 9,
      maxZoom: 9,
      getTileUrl: function(coord, zoom) {
         return currentSession + '/tile_' + coord.x + '_' + coord.y + '.png';
      },
      isPng: true
   });

   myMapType.projection = new myProjection();

   var mapOptions = {
      center: new google.maps.LatLng(0, 0),
      mapTypeControl: false,
      backgroundColor: '#E0C191',
      zoom: 9
   }

   map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
   map.mapTypes.set('myMapType', myMapType);
   map.setMapTypeId('myMapType');

   var homeControlDiv = document.createElement('DIV');
   var homeControl = new HomeControl(homeControlDiv, map);
   homeControlDiv.index = 1;
   map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
   var gridControlDiv = document.createElement('DIV');
   var gridControl = new GridControl(gridControlDiv, map);
   gridControlDiv.index = 2;
   map.controls[google.maps.ControlPosition.TOP_RIGHT].push(gridControlDiv);
}

</script>
<script type="text/javascript" src="currentsession.js"></script>
</head>
<body onload="initialize()">
   <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
User avatar
borka
 
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Game Client modified by Ender

Postby ygfwwashere » Sat Aug 17, 2013 11:25 pm

Hey, great mod, but I'm having a problem.

The minimap in the top right records all of the tiles I visit, and it displays them there. But, when I log out, I lose all of those explored areas from my map. If I check the game files, I can see that it saved a png of each tile, but I can't get a map from it. If I open up map.html, it only displays tiles when I am logged in, and it only displays what I can see in the minimap, anyway.

Is there a way I can get the minimap to retrieve these saved png images of each tile? Or is there a way I can compile them into a map?
ygfwwashere
 
Posts: 1
Joined: Sat Aug 17, 2013 11:23 pm

Re: World 7 Maps do yourself

Postby borka » Sun Aug 18, 2013 12:24 am

if you're using the map.html with currentsession.js you have to be online as it's based on google maps

in this thread you'll find some informations about doing local maps for yourself

I was told the tool in the OP (first post) works offline aswell - i'm not using it myself as don't install newer .Net stuff ... so i work with stitched maps, map.html online and screenshots of areas on- and offline ...
Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
User avatar
borka
 
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Previous

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 8 guests