Scripting


9
Jan 10

Make Icon Function

With ever project there are always helper functions that do simple things. This function is something i created to help make icons for my WoWMap site. All you need to do is pass it an associative array (aka an object in JS) and it will return the google maps GIcon object customed with your options.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function makeIcon(options)
{
	var settings = $.extend({
		'image': 'icons/white.png',
		'shadow': 'shadow.png',
		'iconSize': [24,28],
		'shadowSize': [36,24],
		'iconAnchor': [12,27],
		'infoWindowAnchor': [20,3]
	}, options);
 
	var base_icon = new GIcon(G_DEFAULT_ICON);
	base_icon.image = 'assets/img/'+settings.image;
	base_icon.shadow = 'assets/img/'+settings.shadow;
	base_icon.iconSize = new GSize(settings.iconSize[0],settings.iconSize[1]);
	base_icon.shadowSize = new GSize(settings.shadowSize[0],settings.shadowSize[1]);
	base_icon.iconAnchor = new GPoint(settings.iconAnchor[0],settings.iconAnchor[1]);
	base_icon.infoWindowAnchor = new GPoint(settings.infoWindowAnchor[0],settings.infoWindowAnchor[1]);
 
	return base_icon;
}

I use the jQuery extend function to merge the any provided options with the default options.

If you want to use this with your site you will need to change the url for the image and shadow property on line 13 and 14. You can also extend this to edit the other properties of the GIcon object, these are just the basic ones needed to customize (at least for me).


13
Oct 09

WoW Map Zones

show_zonesA couple days ago, i added in a little helper function to my map that will add a polygon around each zone i have in my database. Just for shits and giggles. This is what it looks like, for Northrend at least. I think it looks kool.


5
Oct 09

Wowmap tiles update

A couple days ago i found out that the “map2″ ( Still need new names for the maps. ) tiles for Outland were not aligned correctly, so i reopened my old PSD files and did what was needed. I later relized i needed to find a way to get the coordinates for each zone.

Google API has a way to convert a exact pixel to a coordinate, and Photoshop can show you the pixel numbers. So i wrote a small function that would basically ask for a X pixel and a Y pixel and then use the API function fromPixelToLatLng() to return a set of LatLng coordinates, which i could use to convert in game coordinates to a map location.

So in result i redid and uploaded the new tiles last night, if you’ve see my map before, you might noticed it looks alot better then it did.

Now i just need to find a way to convert a map location to in-game coordinates. Not sure how ill do that, but till then ill be adding more location data.


30
Jul 09

My WoW Map

wowmapFor the last month or so, iv been working on a project that utilizes the Google Maps API to make a map from the mini map images in World of Warcraft. There are a couple other other sites that do the exact same thing that im trying to do. MapWoW.com and Wyrimaps.net/wow.

The main reason for me doing this project is because, if you go to Mapwow.com youll see there are ALOT of ads (mostly gold seller ads). And i wanted a site just the same but with out all the damn gold seller adds. And i also wanted a new project to keep me busy and not so bored. Its also a good learning experience for me ( if i remember the stuff i learn :P )

I’v got alot of ideas for things to do to this map and i hope to be able to do them.

Also just be aware that this is my live code, there is no production site. So you might come by and it not working. Most likely it is because im currently working on it, but dont worry about sending me a email about a problem you encounter or even missing marker for that set. Also take a look at my code, and if youve got any suggestions, dont hesitate to email me. Enjoy.

Justgizzmo’s WoW Map