Kalish / SearchShrines

// ==UserScript==
// @name         SearchShrines
// @copyright    Kalish, 2020
// @namespace    http://tampermonkey.net/
// @version      1.0
// @license      MIT
// @description  Scraping the shrines
// @author       Kalish
// @match        https://*.crownofthegods.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let RmIden = {1001:"Inactive Shrine",1002:"Inactive Portal",1003:"Active Portal",1557:"Evara",1558:"Vexemis",1559:"Domdis",1560:"Cyndros",1561:"Merius",1562:"Ylanna",1563:"Ibria",1564:"Naera"};
        (open => {
            XMLHttpRequest.prototype.open = function() {
                this.addEventListener("readystatechange", function() {
                    if(this.readyState==4) {
                        if (this.responseURL.indexOf("rMp.php")!=-1) {
                            let RmData = JSON.parse(this.response);
                            Object.values(RmData).forEach(ArrD => {
                               Object.values(ArrD).forEach(TileIden => {
                                   Object.keys(RmIden).forEach(Key => {
                                       if(TileIden.includes(Key+"-")) console.log(RmIden[Key]+" "+(TileIden.split("-")[1].substr(0, 3)-100)+":"+(TileIden.split("-")[1].substr(3, 3)-100));
                                   });
                               });
                            });
                        }
                    }
                }, false);
                open.apply(this, arguments);
            };
        })(XMLHttpRequest.prototype.open);
})();