Greasy Fork

Greasy Fork is available in English.

hwmmapmove

перемещение по карте в один клик, скрипт для ГВД

当前为 2014-12-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// (c) 2008-2010, xo4yxa
// (c) 2014, Ded Moroz
//
// ==UserScript==
// @name          hwmmapmove
// @namespace     ded_moroz
// @description   перемещение по карте в один клик, скрипт для ГВД
// @version       2.6
// @homepage      http://greasyfork.icu/users/7571-ded-moroz
// @include       http://www.heroeswm.ru/map.php*
// @grant         GM_getValue
// @grant         GM_setValue
// @grant         GM_xmlhttpRequest
// ==/UserScript==

if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported") > -1))
{
	this.GM_getValue = function(key, def)
	{
		return localStorage[key] || def;
	};
	this.GM_setValue = function(key, value)
	{
		return localStorage[key] = value;
	};
	this.GM_deleteValue = function(key)
	{
		return delete localStorage[key];
	};
}

var coop = '<center style="font-size:10px;">&#169; <a href="http://www.heroeswm.ru/pl_info.php?id=130" style="font-size:10px;">xo4yxa</a>, <a href="mailto:[email protected]" style="font-size:10px;" target="_top">Ded Moroz</a> <a href="http://greasyfork.icu/users/7571-ded-moroz" style="font-size:10px;">hwm map move</a> v. ' + GM_info.script.version + '. <span style="text-decoration:underline;cursor:pointer;font-weight:bold;" id="hwmmm_options">Настройки</span></center>';

var url = 'http://www.heroeswm.ru/';
var loc_merc = [2, 6, 16, 21];
var road = [];

/*
0 - cur place
1 - view place
2-10 - have move
11 - gO
12 - gV
13 - gN
14 - loc from move (only move)
15 - last time move (only move)
16 - all time move (only move)
17 - have transport with complex path
18 - magic number for moving
19 - ?
20 - clan id
*/
var MapParams = {
	LOC_CURRENT : 0,
	LOC_VIEW : 1,
	LOC_MOVE_FIRST : 2,
	LOC_MOVE_LAST : 10,
	HUNT : 11,
	THIEF : 12,
	MERC : 13,
	LOC_FROM : 14,
	LAST_TIME : 15,
	COMPLEX_PATH : 17,
	MAGIC_NUMBER : 18
};

// get flash map params
var els = document.getElementsByTagName('param');
for (i = 0; i < els.length; i++)
{
    if (els[i].getAttribute('value').contains('map.swf'))
    {
    	var par = els[i + 1].getAttribute('value').split('=')[1].split(':');
        var ems = els[i + 1].parentNode;
        var map_url = els[i].getAttribute('value');
		
		// when moving with advanced thansport COMPLEX_PATH is undefined
		if (par.length < MapParams.MAGIC_NUMBER) par[MapParams.COMPLEX_PATH] = 1;
		
        break;
    }
}

// вступать в бой ГР
if (par[MapParams.LOC_FROM] == 0 && document.getElementsByTagName('body')[0].innerHTML.indexOf('ranger_attack.php') > 0 && GM_getValue("checkgv", 0) == 1)
	window.location.href = url + 'ranger_attack.php';

// locations and its explicit paths
var loc =
[
//     name,               row, col, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27
	[], // 00
	[[ "Empire Capital",      2, 2], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 00, 00, 11, 00, 00, 00, 00, 00, 00, 00, 00, 05, 00], // 01
	[[ "East River",          2, 3], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 00, 15, 15, 00, 00, 19, 19, 00, 00, 00, 00, 00], // 02
	[[ "Tiger's Lake",        1, 2], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 05, 00], // 03
	[[ "Rogue's Wood",        1, 3], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 15, 15, 00, 00, 00, 19, 19, 00, 00, 00, 00, 00], // 04
	[[ "Wolf's Dale",         3, 2], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 00, 00, 11, 00, 10, 10, 10, 10, 00, 00, 00, 00, 00], // 05
	[[ "Peaceful Camp",       0, 2], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 05, 00], // 06
	[[ "Lizard's Lowland",    3, 1], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 00, 00, 11, 00, 00, 00, 00, 00, 00, 00, 00, 05, 00], // 07
	[[ "Green Wood",          2, 1], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 00, 00, 11, 00, 00, 00, 00, 00, 00, 00, 00, 05, 00], // 08
	[[ "Eagle's Nest",        0, 1], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 09
	[[ "Portal's ruins",      4, 2]                                                                                                            ], // 10
	[[ "Dragon's Caves",      3, 3], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 19, 19, 00, 00, 00, 00, 00], // 11
	[[ "Shining Spring",      1, 1], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 12
	[[ "Sunny City",          1, 0], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 13
	[[ "Magma Mines",         2, 4], 11, 15, 15, 15, 00, 15, 00, 11, 15, 00, 00, 15, 15, 00, 00, 00, 00, 15, 00, 00, 11, 11, 00, 00, 00, 00, 11], // 14
	[[ "Bear' Mountain",      1, 4]                                                                                                            ], // 15
	[[ "Fairy Trees",         0, 4], 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 15, 15, 00, 00, 15, 15, 00, 15, 15], // 16
	[[ "Port City",           2, 5], 00, 15, 00, 00, 14, 00, 14, 00, 00, 14, 14, 00, 00, 00, 00, 00, 00, 00, 14, 14, 14, 14, 00, 00, 00, 14, 00], // 17
	[[ "Mythril Coast",       1, 5], 15, 15, 00, 00, 15, 15, 15, 15, 15, 15, 15, 00, 00, 15, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 00, 15, 15], // 18
	[[ "Great Wall",          4, 3], 11, 00, 11, 00, 11, 11, 10, 11, 11, 00, 00, 11, 11, 11, 11, 11, 11, 11, 00, 00, 00, 00, 11, 00, 00, 00, 10], // 19
	[[ "Titans' Valley",      5, 3], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 11, 11, 11, 11, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 20
	[[ "Fishing village",     5, 4], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 11, 11, 11, 11, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 21
	[[ "Kingdom Castle",      6, 4], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, 11, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 22
	[[ "Ungovernable Steppe", 0, 0], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00], // 23
	[[ "Crystal Garden",      0, 3], 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 00, 00, 00, 00, 19, 19, 00, 00, 00, 00, 00], // 24
	[], // 25
	[[ "The Wilderness",      4, 1], 00, 00, 00, 00, 00, 00, 05, 05, 05, 00, 00, 05, 05, 00, 00, 00, 00, 00, 00, 10, 10, 10, 05, 00, 00, 00, 05], // 26
	[[ "Sublime Arbor",       2, 0]                                                                                                            ], // 27
];

// choose the right transport
if (par[MapParams.COMPLEX_PATH] == 0)
{
	var transp = GM_getValue("transport", 0);
	if (transp >= 3)
	{
		// set default simple transport
		GM_setValue("transport", 0);
		transp = 0;
	}
}
else
{
	var transp = GM_getValue("transport", 3);
	if (transp < 3)
	{
		// set default advanced transport
		GM_setValue("transport", 3);
		transp = 3;
	}
}

var map_square = 
[
//    0   1   2   3   4   5
	[23, 09, 06, 24, 16, 00], // 0
	[13, 12, 03, 04, 15, 18], // 1
	[27, 08, 01, 02, 14, 17], // 2
	[00, 07, 05, 11, 00, 00], // 3
	[00, 26, 10, 19, 00, 00], // 4
	[00, 00, 00, 20, 21, 00], // 5
	[00, 00, 00, 00, 22, 00]  // 6
];

// generate html code for the map
var map_html = "";
for (i = 0; i < map_square.length; i++)
{
	map_html += '<tr>';
	for (j = 0; j < map_square[i].length; j++)
	{
		if (map_square[i][j] == 0) map_html += '<td></td>';
		else map_html += '<td><div id="loc_' + map_square[i][j] + '"></div></td>';		
	}
	map_html += '</tr>';
}

var dm = document.createElement('div');
dm.innerHTML = '<br><center><a href="http://www.heroeswm.ru/ranger_guild.php"><img src="http://im.heroeswm.ru/i/houses/ranger.gif" border="0" title="Гильдия Рейнджеров"></a> <a href="http://www.heroeswm.ru/hunter_guild.php"><img src="http://im.heroeswm.ru/i/houses/hunter.gif" border="0" title="Гильдия Охотников"></a> <a href="http://www.heroeswm.ru/mercenary_guild.php"><img src="http://im.heroeswm.ru/i/houses/merc.gif" border="0" title="Гильдия Наёмников"></a> <a href="http://www.heroeswm.ru/thief_guild.php"><img src="http://im.heroeswm.ru/i/houses/thief.gif" border="0" title="Гильдия Воров"></a></center><table>' + map_html + '</table><br>' + coop + '<br>';

if (par[MapParams.COMPLEX_PATH] == 0 && GM_getValue("hwm_map_move") == 1)
{
	/* Continue moving along the complex path */
	move(parseInt(par[MapParams.LOC_CURRENT]), GM_getValue("hwm_map_move_mz"), false);
}
else
{
	init();
}

function init()
{
	nado = ems.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;

	// hide map
	if (GM_getValue("checkvm") == 1) ems.style.display = 'none';

	if (par[MapParams.LOC_FROM] != 0)
	{
		// currently moving, just update the destination info
		dst = GM_getValue("hwm_map_move_mz");
		cur = '<br><table><tr><td>Перемещение в:<td><b>' + loc[par[MapParams.LOC_CURRENT]][0][0] + '</b>';
		
		if (par[MapParams.LOC_CURRENT] != dst && par[MapParams.COMPLEX_PATH] == 0)
		{
			cancel = ' [<a href="javascript: void(0)" id="a_stop_move">отмена</a>]';
			div	= document.createElement('div');
			div.innerHTML = cur + '<tr><td>Пункт назначения:<td><div id="hint_move"><b>' + loc[dst][0][0] + '</b>' + cancel + '</div></table><br>' + coop;
			link = document.getElementsByTagName('a');
			link = link[link.length - 1].parentNode;
			link.appendChild(div);
			
			$('a_stop_move').addEventListener("click", function(){stop(); $('hint_move').innerHTML = '<b>' + loc[par[MapParams.LOC_CURRENT]][0][0] + '</b>';}, false);
		}
		else
		{
			div	= document.createElement('div');
			div.innerHTML = cur + '<tr><td>Пункт назначения:<td><b>' + loc[par[MapParams.LOC_CURRENT]][0][0] + '</b></table><br>' + coop;
			link = document.getElementsByTagName('a');
			link = link[link.length - 1].parentNode;
			link.appendChild(div);
		}
		
		$("hwmmm_options").addEventListener("click", setting, false);
		update_time(new Date().getTime(), document.title);
	}
	else
	{
		// currently not moving

		// report completed mercenary task if needed
		if (GM_getValue("checkgn", 0) == 1 && par[MapParams.MERC] == -1 && loc_merc.indexOf(parseInt(par[MapParams.LOC_CURRENT])) != -1)
		{
			window.location.href = url + 'mercenary_guild.php';
			return;
		}

		nado.appendChild(dm);
		$("hwmmm_options").addEventListener("click", setting, false);

		// create a grid of map locations with the moving links
		for (l = 1; l < loc.length; l++)
		{
			var d = $('loc_' + l);
			if (d == null) continue;
			
			d.parentNode.style.textAlign = 'center';
			d.style.padding = '1px 3px';
			d.style.fontSize = '11px';
			d.parentNode.style.border = par[MapParams.LOC_VIEW] == l ? '1px solid #00f' : '1px solid #abc';

			if (l == par[MapParams.LOC_CURRENT])
			{
				d.style.fontWeight = 'bold';
				d.parentNode.style.backgroundColor = 'FFF8DC';
				if (l == par[MapParams.MERC]) d.style.color = 'FF0000';
				d.innerHTML = loc[l][0][0];
			}
			else
			{
				a = document.createElement('a');
				a.style.fontSize = '11px';
				a.href = 'http://www.heroeswm.ru/move_sector.php?id=' + l;
				if (l == par[MapParams.MERC]) a.style.color = 'FF0000';
				a.innerHTML = loc[l][0][0];
				a.setAttribute('tz', l);
				
				// do not generate links when we have advanced transport
				if (par[MapParams.COMPLEX_PATH] == 0)
				{
					a.href = 'javascript: void(0)';
					a.addEventListener("click", setMXY, false);
				}

				a.addEventListener("mouseover", viewPath, false);
				a.addEventListener("mouseout", hidePath, false);

				d.appendChild(a);
			}

			// highlight locations with mercenary guild
			if (par[MapParams.MERC] == -1 && loc_merc.indexOf(l) != -1)
			{		
				b = document.createElement('b');
				b.style.color = '#00F';
				b.innerHTML = ' X';
				d.appendChild(b);
			}

			// view sector
			if (GM_getValue("checkvs") && par[MapParams.LOC_VIEW] != l)
			{
				a = document.createElement('a');
				a.href= 'http://www.heroeswm.ru/map.php?cx=' + (48 + loc[l][0][2]) + '&cy=' + (48 + loc[l][0][1]);
				a.style.display = 'block';
				a.style.width = '100%';
				a.title = 'Осмотреть сектор ' + loc[l][0][0];
				vi = document.createElement('img');
				vi.src = "data:image/gif,GIF89a%10%00%10%00%D5%00%00B%40B%15%15%18((-PPUzz%7FHHJ%5D%5D_--.zz%7BWWX23%3BEHS%80%88%A2rx%8C%DA%DD%E7bj%80sx%87%88%8C%97%7D%85%98HO_%7D%85%97%88%8C%95psz%DC%DD%DF%D4%D5%D7x%7F%8C%2B-0%C2%DF%FF%DF%F4%FFMOPmop%EF%F1%F2%E7%F9%FF%EA%FD%FF%E7%FF%FF%13%15%15%E9%FF%FF%18%1A%1A%FA%FF%FFmoo%FC%FF%FF%FD%FF%FFZ%5B%5B%5D%5D%5B%40%3F%3F%FF%FF%FF%16%16%16%10%10%10%05%05%05%00%00%00%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%002%00%2C%00%00%00%00%10%00%10%00%00%06%5C%40%99pH%2C%12%13%01%8D%80e%24%02ZP%A8%A2)k%C8%A2%D1As%01Ma'%CDF%D4%14%7D4!-%94%A8%95%BAJ%9A%07P%8B%E4mm%2C%D4H(%CA%A9%AC%A82%05%19%0C%14%041*%17%80E0%1D%18%8AD%2F%06%89%8FB%25'%1F%94B.%08-%992%23%1E%9ECA%00%3B";
				vi.style.border = '0px';
				a.appendChild(vi);
				d.parentNode.appendChild(a);
			}
		}
	}
}

function update_time(start, title)
{
	s = par[MapParams.LAST_TIME] - ~~((new Date().getTime() - start) / 1000);
	if (s < 0) return;
	m = ~~(s / 60);
	s = s % 60;

	if (s < 10)	s = "0" + s;
	if (m < 10)	m = "0" + m;

	document.title = " [" + m + ":" + s + "] " + title;
	setTimeout(function(){update_time(start, title);}, 1000);
}

function move(from, to, force_move)
{
	if (par[MapParams.LOC_FROM] != 0)
	{
		// currently moving
		init();
		return;
	}
	
	if (to == from)
	{
		// arrived
		stop();

		// report completed mercenary task if needed
		if (par[MapParams.MERC] == -1 && loc_merc.indexOf(from) != -1 && GM_getValue("checkgn", 0) == 1)
		{
			window.location.href = url + 'mercenary_guild.php';
			return;
		}

		init();
		return;
	}

	// stop if hunt is available
	if (par[MapParams.HUNT] != '' && GM_getValue("checkgo", 0) == 1 && !force_move)
	{
		stop();
		init();
		return;
	}

	new_id = loc[from][to];
	if (new_id && new_id > 0)
	{
		move(from, new_id, force_move);
		return;
	}

	A = loc[from][0];
	B = loc[to][0];

	row = B[1] > A[1] ? A[1] + 1 : (B[1] == A[1] ? A[1] : A[1] - 1);
	col = B[2] > A[2] ? A[2] + 1 : (B[2] == A[2] ? A[2] : A[2] - 1);
	
	go(map_square[row][col]);
}

var warned = false;
function go(to)
{
	// check if move is legal
	if (par.slice(MapParams.LOC_MOVE_FIRST, MapParams.LOC_MOVE_LAST + 1).indexOf(to.toString()) != -1)
	{
		GM_xmlhttpRequest({
			method: "GET",
			url: map_url,
			onload: function (response)
			{
				/* ! Map checks enabled by default. Do NOT change it unless you know what you are doing. */
				map_swf_passed = false;
				
				/* Flash-map which generates links as below */
				old_size = 220039;
				old_hash = "b441f0ac541408a809ec907b54cc0060";
				
				new_size = response.responseText.length;
				
				if (new_size == old_size)
				{
					new_hash = CryptoJS.MD5(response.responseText);
					if (new_hash == old_hash) map_swf_passed = true;				
				}
				
				if (map_swf_passed)
				{
					rand = ((par[MapParams.LOC_CURRENT] * 153 + to * 234) % 333 * 234 + par[MapParams.MAGIC_NUMBER] % 346234 - 142) % 10000 / 10000;
					window.location.href = url + 'move_sector.php?id=' + to + '&rand=' + rand;
					return;
				}
				else
				{
					if (new_size != old_size) console.log("New map size: " + response.responseText.length + "\nOld map size: " + old_size);
					else console.log("New map hash: " + new_hash + "\nOld map hash: " + old_hash);
					
					if (!warned)
					{
						nado = ems.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
						warn = document.createElement('div');
						warn.innerHTML += "<center style='font-size:10px;color:red;'>Flash-карта была изменена, генерация ссылок для перемещения отключена</center>";
						nado.appendChild(warn);
						
						warned = true;
					}
				}
			}
		});
	}
	else
	{
		alert('Нет пути из ' + par[MapParams.LOC_CURRENT] + ' в ' + to);
	}

	// reset path
	stop();
}

function setMXY()
{
	GM_setValue("hwm_map_move_mz", this.getAttribute('tz'))
	GM_setValue("hwm_map_move", 1);
	move(parseInt(par[MapParams.LOC_CURRENT]), GM_getValue("hwm_map_move_mz"), true);
}

function stop()
{
	GM_setValue("hwm_map_move", 0);
	GM_setValue("hwm_map_move_mz", 0);
}

function setCheck()
{
	name = this.getAttribute('id');
	if (GM_getValue(name) && GM_getValue(name) == 1)
		GM_setValue(name, 0);
	else
		GM_setValue(name, 1);
}

function setTransport(id)
{
	$("transp" + transp).style.background="#F6F3EA";
	$("transp" + id).style.background="#0000ff";
		
	GM_setValue("transport", id);
	transp = id;
}

function viewPath()
{
	travel_time = [120, 84, 60, 36, 24, 12];
	to = this.getAttribute('tz');
	
	this.title = loc[to][0][0] + ' (' + path(par[MapParams.LOC_CURRENT], to, 0) + ')';
	function path(from, to, t)
	{
		// return time if reached destination
		if (to == from)
		{
			myT = new Date(t * 1000);
			myTs = myT.getSeconds();
			return myT.getMinutes() + ':' + (myTs < 10 ? '0' : '') + myTs;
		}

		A = loc[from][0];
		B = loc[to][0];
		
		new_id = loc[from][to];
		if (new_id && new_id > 0) B = loc[new_id][0];
		
		drow = B[1] > A[1] ? 1 : (B[1] == A[1] ? 0 : -1);
		dcol = B[2] > A[2] ? 1 : (B[2] == A[2] ? 0 : -1);
		
		t = (drow == 0 || dcol == 0) ? t + travel_time[transp] : t + ~~(travel_time[transp] * 1.41);
		id = map_square[A[1] + drow][A[2] + dcol];

		td = $('loc_' + id)
		td.parentNode.style.backgroundColor = 'F0E68C';
		road[road.length] = id;
		
		return path(id, to, t);
	}
	return;
}

function hidePath()
{
	for (i = 0; i < road.length; i ++)
	{
		$('loc_' + road[i]).parentNode.style.backgroundColor = 'DDD9CD';
	}
	road = [];
}


//+ закрытие форм
function form_close()
{
	bg = $('bgOverlay');
	bgc = $('bgCenter');
	if (bg)
	{
		bg.style.display = bgc.style.display = 'none';
	}
}
//-


//+ форма настроек
function setting()
{
	bg = $('bgOverlay');
	bgc = $('bgCenter');
	if (!bg)
	{
		bg = document.createElement('div');
		bg.id = 'bgOverlay';
		document.body.appendChild(bg);
		bg.style.position = 'absolute';
		bg.style.left = '0';
		bg.style.width = '100%';
		bg.style.height = '100%';
		bg.style.background = "#000000";
		bg.style.opacity = "0.5";
		bg.addEventListener("click", form_close, false);

		bgc = document.createElement('div');
		bgc.id = 'bgCenter';
		document.body.appendChild(bgc);
		bgc.style.position = 'absolute';
		bgc.style.width = '400px';
		bgc.style.background = "#F6F3EA";
		bgc.style.left = ((document.body.offsetWidth - 400) / 2) + 'px';
	}

	text = '<div style="border:1px solid #abc;padding:5px;margin:2px;"><div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_close" title="Close">x</div><center><table><tr><td><b>Настройки</b></td></tr><tr><td>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkgo"> останавливаться при охоте</label></div>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkgn"> сдавать задания Гильдии Наемников</label></div>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkgv"> вступать в бои Гильдии Рейнджеров</label></div>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkgvn"> заходить в Гильдию Рейнджеров с дороги</label></div>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkvm"> не отображать flash-карту</label></div>' +
	'<div><label style="cursor:pointer;"><input type="checkbox" id="checkvs"> отображать кнопки осмотра секторов</label></div>' +
	'<br><div>Ваш транспорт (<a href="http://www.heroeswm.ru/shop.php?cat=transport">транспорт в магазине</a>):<br><table><tr>';
	
	spl_transp = '<td style="padding:5px;cursor:pointer;" id="transp0"><img src="https://cdn1.iconfinder.com/data/icons/disable-sign/300/Leader-dog-48.png" style="background-color:#E2CC9D;"></td><td style="padding:5px;cursor:pointer;" id="transp1"><img src="http://www.heroeswm.ru/i/transport/1.jpg"></td><td style="padding:5px;cursor:pointer;" id="transp2"><img src="http://www.heroeswm.ru/i/transport/2.jpg"></td></tr></table></div></td></tr></table></center></div>';
	
	adv_transp = '<td style="padding:5px;cursor:pointer;" id="transp3"><img src="http://www.heroeswm.ru/i/transport/3.jpg"></td><td style="padding:5px;cursor:pointer;" id="transp4"><img src="http://www.heroeswm.ru/i/transport/4.jpg"></td><td style="padding:5px;cursor:pointer;" id="transp5"><img src="http://www.heroeswm.ru/i/transport/5.jpg"></td></tr></table></div></td></tr></table></center></div>';

	if (par[MapParams.COMPLEX_PATH] == 0)
	{
		bgc.innerHTML = text + spl_transp;
		$("transp0").addEventListener("click", function(){setTransport(0)}, false);
		$("transp1").addEventListener("click", function(){setTransport(1)}, false);
		$("transp2").addEventListener("click", function(){setTransport(2)}, false);
	}
	else
	{
		bgc.innerHTML = text + adv_transp;
		$("transp3").addEventListener("click", function(){setTransport(3)}, false);
		$("transp4").addEventListener("click", function(){setTransport(4)}, false);
		$("transp5").addEventListener("click", function(){setTransport(5)}, false);
	}	

	$("transp" + transp).style.background="#0000ff";
	$("bt_close").addEventListener("click", form_close, false);
	
	check_id = ['checkgo', 'checkgn', 'checkgv', 'checkgvn', 'checkvm', 'checkvs'];
	for (i = 0; i < check_id.length; i++)
	{
		checkbox = $(check_id[i]);
		checkbox.checked = GM_getValue(check_id[i], 0) == 1 ? 'checked' : '';
		checkbox.addEventListener("click", setCheck, false);
	}

	bg.style.top = (-document.body.scrollTop) + 'px';
	bgc.style.top = (document.body.scrollTop + 150) + 'px';
	bg.style.display = 	bgc.style.display = 'block';
}
//-

function $(id) { return document.getElementById(id); }

/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(s,p){var m={},l=m.lib={},n=function(){},r=l.Base={extend:function(b){n.prototype=this;var h=new n;b&&h.mixIn(b);h.hasOwnProperty("init")||(h.init=function(){h.$super.init.apply(this,arguments)});h.init.prototype=h;h.$super=this;return h},create:function(){var b=this.extend();b.init.apply(b,arguments);return b},init:function(){},mixIn:function(b){for (var h in b)b.hasOwnProperty(h)&&(this[h]=b[h]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}},
q=l.WordArray=r.extend({init:function(b,h){b=this.words=b||[];this.sigBytes=h!=p?h:4*b.length},toString:function(b){return(b||t).stringify(this)},concat:function(b){var h=this.words,a=b.words,j=this.sigBytes;b=b.sigBytes;this.clamp();if (j%4)for (var g=0;g<b;g++)h[j+g>>>2]|=(a[g>>>2]>>>24-8*(g%4)&255)<<24-8*((j+g)%4);else if (65535<a.length)for (g=0;g<b;g+=4)h[j+g>>>2]=a[g>>>2];else h.push.apply(h,a);this.sigBytes+=b;return this},clamp:function(){var b=this.words,h=this.sigBytes;b[h>>>2]&=4294967295<<
32-8*(h%4);b.length=s.ceil(h/4)},clone:function(){var b=r.clone.call(this);b.words=this.words.slice(0);return b},random:function(b){for (var h=[],a=0;a<b;a+=4)h.push(4294967296*s.random()|0);return new q.init(h,b)}}),v=m.enc={},t=v.Hex={stringify:function(b){var a=b.words;b=b.sigBytes;for (var g=[],j=0;j<b;j++){var k=a[j>>>2]>>>24-8*(j%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join("")},parse:function(b){for (var a=b.length,g=[],j=0;j<a;j+=2)g[j>>>3]|=parseInt(b.substr(j,
2),16)<<24-4*(j%8);return new q.init(g,a/2)}},a=v.Latin1={stringify:function(b){var a=b.words;b=b.sigBytes;for (var g=[],j=0;j<b;j++)g.push(String.fromCharCode(a[j>>>2]>>>24-8*(j%4)&255));return g.join("")},parse:function(b){for (var a=b.length,g=[],j=0;j<a;j++)g[j>>>2]|=(b.charCodeAt(j)&255)<<24-8*(j%4);return new q.init(g,a)}},u=v.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(g){throw Error("Malformed UTF-8 data");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},
g=l.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(b){"string"==typeof b&&(b=u.parse(b));this._data.concat(b);this._nDataBytes+=b.sigBytes},_process:function(b){var a=this._data,g=a.words,j=a.sigBytes,k=this.blockSize,m=j/(4*k),m=b?s.ceil(m):s.max((m|0)-this._minBufferSize,0);b=m*k;j=s.min(4*b,j);if (b){for (var l=0;l<b;l+=k)this._doProcessBlock(g,l);l=g.splice(0,b);a.sigBytes-=j}return new q.init(l,j)},clone:function(){var b=r.clone.call(this);
b._data=this._data.clone();return b},_minBufferSize:0});l.Hasher=g.extend({cfg:r.extend(),init:function(b){this.cfg=this.cfg.extend(b);this.reset()},reset:function(){g.reset.call(this);this._doReset()},update:function(b){this._append(b);this._process();return this},finalize:function(b){b&&this._append(b);return this._doFinalize()},blockSize:16,_createHelper:function(b){return function(a,g){return(new b.init(g)).finalize(a)}},_createHmacHelper:function(b){return function(a,g){return(new k.HMAC.init(b,
g)).finalize(a)}}});var k=m.algo={};return m}(Math);
(function(s){function p(a,k,b,h,l,j,m){a=a+(k&b|~k&h)+l+m;return(a<<j|a>>>32-j)+k}function m(a,k,b,h,l,j,m){a=a+(k&h|b&~h)+l+m;return(a<<j|a>>>32-j)+k}function l(a,k,b,h,l,j,m){a=a+(k^b^h)+l+m;return(a<<j|a>>>32-j)+k}function n(a,k,b,h,l,j,m){a=a+(b^(k|~h))+l+m;return(a<<j|a>>>32-j)+k}for (var r=CryptoJS,q=r.lib,v=q.WordArray,t=q.Hasher,q=r.algo,a=[],u=0;64>u;u++)a[u]=4294967296*s.abs(s.sin(u+1))|0;q=q.MD5=t.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},
_doProcessBlock:function(g,k){for (var b=0;16>b;b++){var h=k+b,w=g[h];g[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var b=this._hash.words,h=g[k+0],w=g[k+1],j=g[k+2],q=g[k+3],r=g[k+4],s=g[k+5],t=g[k+6],u=g[k+7],v=g[k+8],x=g[k+9],y=g[k+10],z=g[k+11],A=g[k+12],B=g[k+13],C=g[k+14],D=g[k+15],c=b[0],d=b[1],e=b[2],f=b[3],c=p(c,d,e,f,h,7,a[0]),f=p(f,c,d,e,w,12,a[1]),e=p(e,f,c,d,j,17,a[2]),d=p(d,e,f,c,q,22,a[3]),c=p(c,d,e,f,r,7,a[4]),f=p(f,c,d,e,s,12,a[5]),e=p(e,f,c,d,t,17,a[6]),d=p(d,e,f,c,u,22,a[7]),
c=p(c,d,e,f,v,7,a[8]),f=p(f,c,d,e,x,12,a[9]),e=p(e,f,c,d,y,17,a[10]),d=p(d,e,f,c,z,22,a[11]),c=p(c,d,e,f,A,7,a[12]),f=p(f,c,d,e,B,12,a[13]),e=p(e,f,c,d,C,17,a[14]),d=p(d,e,f,c,D,22,a[15]),c=m(c,d,e,f,w,5,a[16]),f=m(f,c,d,e,t,9,a[17]),e=m(e,f,c,d,z,14,a[18]),d=m(d,e,f,c,h,20,a[19]),c=m(c,d,e,f,s,5,a[20]),f=m(f,c,d,e,y,9,a[21]),e=m(e,f,c,d,D,14,a[22]),d=m(d,e,f,c,r,20,a[23]),c=m(c,d,e,f,x,5,a[24]),f=m(f,c,d,e,C,9,a[25]),e=m(e,f,c,d,q,14,a[26]),d=m(d,e,f,c,v,20,a[27]),c=m(c,d,e,f,B,5,a[28]),f=m(f,c,
d,e,j,9,a[29]),e=m(e,f,c,d,u,14,a[30]),d=m(d,e,f,c,A,20,a[31]),c=l(c,d,e,f,s,4,a[32]),f=l(f,c,d,e,v,11,a[33]),e=l(e,f,c,d,z,16,a[34]),d=l(d,e,f,c,C,23,a[35]),c=l(c,d,e,f,w,4,a[36]),f=l(f,c,d,e,r,11,a[37]),e=l(e,f,c,d,u,16,a[38]),d=l(d,e,f,c,y,23,a[39]),c=l(c,d,e,f,B,4,a[40]),f=l(f,c,d,e,h,11,a[41]),e=l(e,f,c,d,q,16,a[42]),d=l(d,e,f,c,t,23,a[43]),c=l(c,d,e,f,x,4,a[44]),f=l(f,c,d,e,A,11,a[45]),e=l(e,f,c,d,D,16,a[46]),d=l(d,e,f,c,j,23,a[47]),c=n(c,d,e,f,h,6,a[48]),f=n(f,c,d,e,u,10,a[49]),e=n(e,f,c,d,
C,15,a[50]),d=n(d,e,f,c,s,21,a[51]),c=n(c,d,e,f,A,6,a[52]),f=n(f,c,d,e,q,10,a[53]),e=n(e,f,c,d,y,15,a[54]),d=n(d,e,f,c,w,21,a[55]),c=n(c,d,e,f,v,6,a[56]),f=n(f,c,d,e,D,10,a[57]),e=n(e,f,c,d,t,15,a[58]),d=n(d,e,f,c,B,21,a[59]),c=n(c,d,e,f,r,6,a[60]),f=n(f,c,d,e,z,10,a[61]),e=n(e,f,c,d,j,15,a[62]),d=n(d,e,f,c,x,21,a[63]);b[0]=b[0]+c|0;b[1]=b[1]+d|0;b[2]=b[2]+e|0;b[3]=b[3]+f|0},_doFinalize:function(){var a=this._data,k=a.words,b=8*this._nDataBytes,h=8*a.sigBytes;k[h>>>5]|=128<<24-h%32;var l=s.floor(b/
4294967296);k[(h+64>>>9<<4)+15]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;k[(h+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;a.sigBytes=4*(k.length+1);this._process();a=this._hash;k=a.words;for (b=0;4>b;b++)h=k[b],k[b]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return a},clone:function(){var a=t.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=t._createHelper(q);r.HmacMD5=t._createHmacHelper(q)})(Math);