Facebook
From MÅ‚ody, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 112
  1. // ==UserScript==
  2. // @name         Zapisywanie na red mapach
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       adi wilk
  7. // @match        *://*/
  8. // @match        *://www.margonem.pl/*
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. ((_parseInput) => {
  13.     window.parseInput = (data, b, c) => {
  14.         if (data.hasOwnProperty("npc") && data.npc !== undefined && window.map.pvp === 2) {
  15.             for (const [id, npc] of Object.entries(data.npc)) {
  16.                 if (window.g.npc[id] !== undefined && npc.hasOwnProperty("del") && npc.del === 1) {
  17.                     const {x, y} = window.g.npc[id];
  18.  
  19.                     if(Math.hypot(window.hero.x - x, window.hero.y - y) > 16){
  20.                         delete data.npc[id];
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.  
  26.         _parseInput(data, b, c);
  27.     }
  28. })(window.parseInput)