NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name LakeDex // @namespace https://openuserjs.org/scripts/mineminemine/LakeDex // @version 1.0 // @description Like Pokédex, but for Lake Kindred on Gaia Online // @author Lookism // @updateURL https://openuserjs.org/meta/mineminemine/LakeDex.meta.js // @include http://www.gaiaonline.com/pets* // @resource bootstrapCSS https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css // @require http://code.jquery.com/jquery-3.2.1.min.js // @require https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/mouse0270-bootstrap-notify/3.1.7/bootstrap-notify.min.js // @run-at document-start // ==/UserScript== // To add the CSS file to header $("head").append ( '<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css">' ); // About $.notify("LakeDex version: " + GM_info.script.version + "<br>Created by: Lookism"); // Global variables var enemyText, kinText; // Catches requests in LK (function(open) { XMLHttpRequest.prototype.open = function() { this.addEventListener("load", function() { myAjaxHandler(this); }, false); open.apply(this, arguments); }; })(XMLHttpRequest.prototype.open); // Handles the requests function myAjaxHandler(requestData) { if (requestData.responseType == 'text' || requestData.responseType === '') { // Catch enemy info when selected environment if (requestData.responseURL.includes('selectenv')) { enemyText = requestData.responseText; notifyEnem(); } // Catch kindred info when selected pet if (requestData.responseURL.includes('selectpet')) { kinText = requestData.responseText; notifyKin(); } } } // Notification on Enemy Info function notifyEnem() { var parsedText = JSON.parse(enemyText); var name = parsedText.data.enemy.name, element = parsedText.data.enemy.type, level = parsedText.data.enemy.level, rarity = parsedText.data.enemy.rarity, life = parsedText.data.enemy.life, magic = parsedText.data.enemy.magic, damage = parsedText.data.enemy.damage, stamina = parsedText.data.enemy.stamina, resist = parsedText.data.enemy.resist, accuracy = parsedText.data.enemy.accuracy; $.notify({ // options title: '<strong>Enemy Info</strong>', icon: parsedText.data.enemy.images.thumbnail, message: '<br>Name: ' + name + '<br>Level: ' + level + '<br>Element: ' + typeCheck(element) + '<br>Life: ' + life + '<br>Magic: ' + magic + '<br>Damage: ' + damage + '<br>Resist: ' + resist + '<br>Accuracy: ' + accuracy + '<br>Stamina: ' + stamina + '<br>Rarity: ' + rarity + '<br>' }, { // settings newest_on_top: true, type: 'danger', mouse_over: 'pause', icon_type: 'image', animate: { enter: 'animated bounceIn', exit: 'animated bounceOut' } }); } // Notification on Kindred/Pet Info function notifyKin() { var parsedText = JSON.parse(kinText); var name = parsedText.data.pet.name, element = parsedText.data.pet.type, level = parsedText.data.pet.level, rarity = parsedText.data.pet.rarity, life = parsedText.data.pet.life, magic = parsedText.data.pet.magic, damage = parsedText.data.pet.damage, stamina = parsedText.data.pet.stamina, resist = parsedText.data.pet.resist, accuracy = parsedText.data.pet.accuracy; $.notify({ // options title: '<strong>Enemy Info</strong>', icon: parsedText.data.pet.images.thumbnail, message: '<br>Name: ' + name + '<br>Level: ' + level + '<br>Element: ' + typeCheck(element) + '<br>Life: ' + life + '<br>Magic: ' + magic + '<br>Damage: ' + damage + '<br>Resist: ' + resist + '<br>Accuracy: ' + accuracy + '<br>Stamina: ' + stamina + '<br>Rarity: ' + rarity + '<br>' }, { // settings newest_on_top: true, type: 'success', mouse_over: 'pause', icon_type: 'image', placement: { align: 'left' }, animate: { enter: 'animated bounceIn', exit: 'animated bounceOut' } }); } // Check for kindred element type function typeCheck(id) { if (id == 1) { return 'Wood'; } else if (id == 2) { return 'Water'; } else if (id == 3) { return 'Fire'; } else if (id == 4) { return 'Stone'; } else { return 'Metal'; } }