Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Fix MiniMap
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Simple Fix MiniMap
  6. // @author Yuri
  7. // @match http://fantasy-world.pl/game
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. windowDisplay.displayMiniMap = function(data) {
  14. var scale = ((map.max_x / 23) > (map.max_y / 14)) ? (map.max_x / 23) : (map.max_y / 14);
  15.  
  16. $('.mini-map-objects').html('');
  17. var size_map_x = (map.max_x * 32 / scale);
  18. var size_map_y = (map.max_y * 32 / scale);
  19.  
  20. $('.frame-minimap').css('display', 'none');
  21. $('.div-miniap').css('left', (751 - size_map_x) / 2 + 'px');
  22. $("#mini-map-image").css({
  23. 'width': size_map_x + 'px',
  24. 'height': size_map_y + 'px'
  25. })
  26.  
  27. $.each(data.teleports, function(key, v) {
  28. var left = ((v.x - 1) * 32 / scale);
  29. var top = ((v.y - 1) * 32 / scale);
  30. $('.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>');
  31. });
  32.  
  33. $(".my-minimap-position").css({
  34. 'width': (32 / scale) + 'px',
  35. 'height': (32 / scale) + 'px',
  36. 'z-index': 999
  37. });
  38.  
  39. function myFunc() {
  40. $(".my-minimap-position").css({
  41. 'left': ((player.x - 1) * 32 / scale) + 'px',
  42. 'top': ((player.y - 1) * 32 / scale) + 'px'
  43. });
  44. if ($("#window_minimap").length > 0)
  45. setTimeout(myFunc, 200);
  46. }
  47. myFunc();
  48.  
  49. function cloneMonsters() {
  50. $('.monster').each(function(index) {
  51. $(this).clone().css({
  52. 'background': 'white',
  53. 'width': (32 / scale) + 'px',
  54. 'height': (32 / scale) + 'px',
  55. 'left': ($(this).attr('data-x') * (32 / scale)) + 'px',
  56. 'top': ($(this).attr('data-y') * (32 / scale)) + 'px'
  57. }).appendTo('.div-miniap');
  58. });
  59. $('.div-miniap .monsters').remove();
  60. }
  61.  
  62. cloneMonsters();
  63.  
  64.  
  65. };
  66.  
  67. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement