Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Fix MiniMap
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Simple Fix MiniMap
- // @author Yuri
- // @match http://fantasy-world.pl/game
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- windowDisplay.displayMiniMap = function(data) {
- var scale = ((map.max_x / 23) > (map.max_y / 14)) ? (map.max_x / 23) : (map.max_y / 14);
- $('.mini-map-objects').html('');
- var size_map_x = (map.max_x * 32 / scale);
- var size_map_y = (map.max_y * 32 / scale);
- $('.frame-minimap').css('display', 'none');
- $('.div-miniap').css('left', (751 - size_map_x) / 2 + 'px');
- $("#mini-map-image").css({
- 'width': size_map_x + 'px',
- 'height': size_map_y + 'px'
- })
- $.each(data.teleports, function(key, v) {
- var left = ((v.x - 1) * 32 / scale);
- var top = ((v.y - 1) * 32 / scale);
- $('.mini-map-objects').append('<div class="minimap-teleport-' + v.x + '-' + v.y + '" data-tip="' + v.name + '" style="z-index: 15; width: ' + (32 / scale) + 'px; height: ' + (32 / scale) + 'px; top: ' + top + 'px; left:' + left + 'px; background: blue; position: absolute;" onclick="player.goToPosition(' + v.x + ',' + v.y + ')"></div>');
- });
- $(".my-minimap-position").css({
- 'width': (32 / scale) + 'px',
- 'height': (32 / scale) + 'px',
- 'z-index': 999
- });
- function myFunc() {
- $(".my-minimap-position").css({
- 'left': ((player.x - 1) * 32 / scale) + 'px',
- 'top': ((player.y - 1) * 32 / scale) + 'px'
- });
- if ($("#window_minimap").length > 0)
- setTimeout(myFunc, 200);
- }
- myFunc();
- function cloneMonsters() {
- $('.monster').each(function(index) {
- $(this).clone().css({
- 'background': 'white',
- 'width': (32 / scale) + 'px',
- 'height': (32 / scale) + 'px',
- 'left': ($(this).attr('data-x') * (32 / scale)) + 'px',
- 'top': ($(this).attr('data-y') * (32 / scale)) + 'px'
- }).appendTo('.div-miniap');
- });
- $('.div-miniap .monsters').remove();
- }
- cloneMonsters();
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement