Skip to content

Instantly share code, notes, and snippets.

@Err0r404
Last active May 3, 2017 16:15
Show Gist options
  • Save Err0r404/d9e52047caf3591d9bfe88b53ca9c350 to your computer and use it in GitHub Desktop.
Save Err0r404/d9e52047caf3591d9bfe88b53ca9c350 to your computer and use it in GitHub Desktop.
Highlight Pokemon with minimum IV
// ==UserScript==
// @name Highlight Pokemon with minimum IV
// @namespace http://tampermonkey.net/
// @version 0.8
// @description [DISABLED] Add a bouncing animation to Pokemon with IV greater or equal to your choice
// @author Err0r404
// @match https://www.pokemontpellier.fr/
// @grant none
// @downloadURL https://gist.githubusercontent.com/Err0r404/d9e52047caf3591d9bfe88b53ca9c350/raw/
// @updateURL https://gist.githubusercontent.com/Err0r404/0671325344725f5faa4656a1f8b7a87e/raw/
// ==/UserScript==
(function() {
'use strict';
/*
Userscript is disabled because Niantic no longer provides same IV for all players
// Vars
var name, atk, def, sta, iv, ivMin, id, expire, $img;
var timeInterval = 20000; // 20 seconds
var excludeArray = ["Roucool", "Rattata", "Fouinette"]; // Exclude some pokemon from console log
// Add animation library
$("head").append('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">');
ivMin = 100;
if(localStorage.getItem("iv")){
ivMin = localStorage.getItem("iv");
}
// Add input to settings' modal
var $formGroup = $("<div/>", {class: "form-group"}).prependTo($("div.panel.panel-default.settings-panel[data-panel=filters]>div.panel-body"));
$("<label/>", {for: "iv", html: "IV minimum à mettre en avant"}).appendTo($formGroup);
var $input = $("<input/>", {class: "form-control", type: "number", max: 100, min: 80, value: ivMin, placeholder: "IV minimum à mettre en avant"}).appendTo($formGroup);
// Save IV to local storage
$input.on("change", function(){
localStorage.setItem("iv", $(this).val());
ivMin = $(this).val();
});
// Add animation to a Pokemon
var highlightPokemon = function(id, expire){
$(".remaining_text[data-expire="+expire+"]").each(function(){
$img = $(this).prev(".pokeimg").find("img");
if($img.attr("src") == "/static/monocle-icons/icons/"+id+".png"){
$img.addClass("animated infinite bounce ivMin");
}
});
};
// Check IV regulary
var checkIvInterval = setInterval(function(){
$(".ivMin").removeClass("animated infinite bounce ivMin");
$.ajax({
url: "./data",
dataType: "JSON",
success: function(data){
console.clear();
for(var i in data){
name = data[i].name;
atk = data[i].atk;
def = data[i].def;
sta = data[i].sta;
id = data[i].pokemon_id;
expire = data[i].expires_at;
if(atk !== undefined && def !== undefined && sta !== undefined){
iv = atk + def + sta;
iv = (iv/45)*100;
iv = Math.round(iv);
if(iv >= ivMin || ivMin == 0){
if(iv == 0)
console.info(name+" > "+iv+"%");
else if(iv == 100)
console.warn(name+" > "+iv+"%");
else if(excludeArray.indexOf(name) == -1)
console.log(name+" > "+iv+"%");
highlightPokemon(id, expire);
}
}
}
}
});
},timeInterval);
*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment