Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:
- /*
- *
- *
- * [Script] - Extract the coordinated of villages as you click on the map
- */
- if (game_data.player.premium == false) {
- alert("Premium Account is necessary to use this script");
- end();
- }
- javascript:var win = (window.frames.length > 0) ? window.main : window;
- var coords = [];
- var outputID = 'villageList';
- var encodeID = 'cbBBEncode';
- var isEncoded = true;
- function fnRefresh()
- {
- $("#coord_picker").draggable();
- // win.$('#' + outputID).attr('value', coords.map(function(e)
- // {console.log(isEncoded ? '[coord]' + e + '[\/coord]' : e);
- // return isEncoded ? '[coord]' + e + '[\/coord]' : e;
- // //return 'OK';
- // }
- // ).join(isEncoded ? '\n' : ' '));
- win.$('#' + outputID).text(
- coords.map(function(e) {
- return isEncoded ? '[coord]' + e + '[\/coord]' : e;
- }).join(isEncoded ? '\n' : ' ')
- );
- }
- win.$(win.document).ready(function()
- {
- if (win.$('#' + outputID).length <= 0)
- {
- if (win.game_data.screen == 'map')
- {
- var srcHTML = '<div id="coord_picker" style="z-index: 99; position: absolute; top: 90px; width: auto; height: auto; background-color:#CEBC98; background-image: url(../graphic/index/bg-tile.jpg); border:2px solid; visibility: visible; cursor:pointer">' + '<center><span style="color:blue;text-decoration:underline;align:center;">Extract Coordinates from the Map</span><br/><br/>' + '<center><input type="checkbox" id="cbBBEncode" onClick="isEncoded=this.checked;fnRefresh();"' + (isEncoded ? 'checked' : '') + '/>BB-Codes<br/>' + '<center><input type="radio" id="drag" onClick="drag=this.checked;fnRefresh();"' + (isEncoded ? '' : '') + '/>Release (select to be able to drag the window)<br/>' + '<textarea id="' + outputID + '" cols="40" rows="10"resize="none" value="" onFocus="this.select();"></textarea><br/><input type=button value="Close Window" onClick="document.getElementById(\'coord_picker\').style.display=\'none\'">' + '</div>';
- //ele = win.$('body').append(win.$('#villageList').css('background-color', 'red'));
- ele = win.$('body').append(win.$(srcHTML));
- win.TWMap.map._handleClick = function(e)
- {
- //console.log(e);
- var pos = this.coordByEvent(e);
- //console.log(pos);
- var coord = pos.join("|");
- //console.log(coord);
- var ii = coords.indexOf(coord);
- if (ii >= 0)
- {
- coords.splice(ii, 1);
- }
- else
- {
- coords.push(coord);
- }
- fnRefresh();
- return false;
- }
- ;
- }
- else
- {
- alert("The script only works on the map screen, you'll be redirected now");
- self.location = win.game_data.link_base_pure.replace(/screen\=\w*/i, "screen=map");
- }
- }
- }
- );
- void(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement