--- image: https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/International_Pok%C3%A9mon_logo.svg/375px-International_Pok%C3%A9mon_logo.svg.png --- ![Pokémon](https://i.imgur.com/rOaacos.png) # Pokémon scripts > [name=Ruei-fong Lyu] ## Preparation Please install [Tampermonkey (Chrome Extension)](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en) first. ## The script for "catch" page ```javascript= // ==UserScript== // @name Pokémon scripts (catch) // @namespace https://pokemon-of-the-week.firebaseapp.com/ // @version 1.0 // @description try to get more and more Pokémon! // @author Ruei-fong Lyu // @match https://pokemon-of-the-week.firebaseapp.com/pokemon/catch // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @require https://code.jquery.com/jquery-3.6.2.min.js // ==/UserScript== $(function() { 'use strict'; // Get All Ball Lists const getAllBallLists = () => { let lists = []; $('.ng-star-inserted>img[alt*="Ball"]').each(() => { lists.push($(this).attr('alt')); }); return lists; } // Click Ball const clickBall = (id) => { setTimeout(() => { $('.ng-star-inserted>img[alt*="Ball"]').eq(id).click(); }, 3000); } // Click THROW Button const clickThrowButton = () => { setTimeout(() => { timer = setInterval(() => { $('button.ng-star-inserted[mat-button][raised]').click(); // Throwing // Check the ball can't be throw const windowLength = $('.mat-mdc-snack-bar-container .mdc-snackbar__label').length; if (windowLength === 1) { clearInterval(timer); // stop current throw ballId++; ballLists = getAllBallLists(); if (ballId < ballLists.length - 1) { // Start throw another ball clickBall(ballId); clickThrowButton(); } } }, 1000); }, 3000); } const clickCatchAlreadyHaveButton = () => { setTimeout(() => { $('#mat-mdc-slide-toggle-2>div>button').click(); }, 3000); } /********** Start point **********/ var ballId = 0; var ballLists = []; var timer = null; const start = true; const catchAlreadyHaveFlag = true; if (start) { // Catch Pokémon you already have if (catchAlreadyHaveFlag) { clickCatchAlreadyHaveButton(); } // Click First Ball clickBall(ballId); // Start Throw First Ball clickThrowButton(); } })(); ``` ## The script for "release" page ```javascript= // ==UserScript== // @name Pokémon scripts (release) // @namespace https://pokemon-of-the-week.firebaseapp.com/ // @version 1.2 // @description try to get more and more Pokémon! // @author Ruei-fong Lyu // @match https://pokemon-of-the-week.firebaseapp.com/pokemon/release // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @require https://code.jquery.com/jquery-3.6.2.min.js // @require https://bililite.com/inc/bililiteRange.js // @require https://bililite.com/inc/jquery.sendkeys.js // ==/UserScript== $(function() { 'use strict'; // Clear Input const clearInput = () => { setTimeout(() => { for (var i=0; i<7; i++) { $('input.ng-valid.ng-star-inserted[type="search"]').sendkeys('{backspace}'); } }, 3000); } // Find Duplicate Pokémon const getDuplicateLists = (moreThenValue) => { let lists = []; $('sprite-pokemon>img').each(function() { const alt = $(this).attr('alt'); const length = $('sprite-pokemon>img[alt="' + alt + '"]').length; if (length > moreThenValue) { console.log(alt, length); lists.push(alt); } }); return lists.filter((item, index) => lists.indexOf(item) === index); } // Select Duplicate Pokémon const selectDuplicate = (moreThenValue) => { setTimeout(() => { let duplicateLists = getDuplicateLists(moreThenValue); console.log(duplicateLists); duplicateLists.forEach((alt) => { const $element = $('sprite-pokemon>img[alt="' + alt + '"]'); console.log('test', alt, $element.length); for (var i=moreThenValue; i<$element.length; i++) { $element.eq(i).click(); } }) }, 5000); } /********** Start point **********/ const start = true; const moreThenValue = 1; if (start) { // Clear RELEASE Input clearInput(); selectDuplicate(moreThenValue); } })(); ``` ## The script for "mart" page ```javascript= // ==UserScript== // @name Pokémon scripts (mart) // @namespace https://pokemon-of-the-week.firebaseapp.com/ // @version 1.1 // @description try to get more and more Pokémon! // @author Ruei-fong Lyu // @match https://pokemon-of-the-week.firebaseapp.com/items/mart // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @require https://code.jquery.com/jquery-3.6.2.min.js // ==/UserScript== $(function() { 'use strict'; // Select Item By Name const selectItemByName = (itemName) => { setTimeout(() => { console.log('selectItemByName', itemName); $('#card-sell .ng-star-inserted>sprite-item>img[alt="' + itemName + '"]').click(); }, 3000); } // Click Sell Button From Treasure Lists const clickSellButtonFromTreasureLists = (setionId) => { setTimeout(() => { console.log('clickSellButtonFromTreasureLists', setionId); $('#card-sell mart-button>button').eq(setionId).click(); const str = $('#card-sell mart-button>button').eq(setionId).next().text(); const total = Number(str.split('×')[1].split(' ')[0]); $('#card-sell mart-button>button').eq(setionId).next().find('[type="number"]').val(total); }, 3500); } /********** Start point **********/ const start = true; const treasureLists = [ 'Tiny Mushroom', 'Big Mushroom', 'Balm Mushroom', 'Nugget', 'Big Nugget', 'Pearl', 'Big Pearl', 'Pearl String', 'Stardust', 'Star Piece', 'Comet Shard', 'Rare Bone', 'Gold Teeth', 'Pretty Wing', 'Relic Vase', 'Relic Band', 'Relic Statue', 'Relic Crown', 'Pokéshi Doll', ]; let setionId = 9; let treasureListId = 0; if (start) { selectItemByName(treasureLists[treasureListId]); clickSellButtonFromTreasureLists(setionId); // When Click "Go!" Button $(document).on('mousedown', 'button', (element) => { const text = element.currentTarget.innerHTML; if (text === 'Go!') { treasureListId++; if (treasureListId < treasureLists.length) { console.log(text, treasureListId, treasureLists.length); selectItemByName(treasureLists[treasureListId]); clickSellButtonFromTreasureLists(setionId); } } }); } })(); ``` ## The script for "daycare" page ```javascript= // ==UserScript== // @name Pokémon scripts (daycare) // @namespace https://pokemon-of-the-week.firebaseapp.com/ // @version 1.0 // @description try to get more and more Pokémon! // @author Ruei-fong Lyu // @match https://pokemon-of-the-week.firebaseapp.com/multiplayer/daycare // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @require https://code.jquery.com/jquery-3.6.2.min.js // @require https://bililite.com/inc/bililiteRange.js // @require https://bililite.com/inc/jquery.sendkeys.js // ==/UserScript== $(function() { 'use strict'; // Open Dialog const openDialog = () => { $('#my-collection button.ng-star-inserted').eq(0).click(); } // Add Input Value const addInputValue = (pokemon) => { setTimeout(() => { $('input.ng-valid.ng-star-inserted[type="search"]').sendkeys(pokemon); selectPokemon(pokemon); }, 500); } // Select Pokemon const selectPokemon = (pokemon) => { setTimeout(() => { $('sprite-pokemon>img[alt="' + pokemon + '"]').eq(0).click(); }, 500); setTimeout(() => { $('dialog[open]>button').eq(0).click(); }, 1000); } // Click Button const clickButton = () => { setTimeout(() => { $('#my-collection>button').eq(0).click(); }, 500); } // Check Current Time const checkCurrentTime = (pokemon) => { setInterval(() => { const minutes = new Date().getMinutes(); const seconds = new Date().getSeconds(); console.log('current minutes', minutes); if (minutes === 0 && seconds < 5) { clickButton(); } if (minutes === 0 && seconds > 15 && seconds <= 20) { openDialog(); selectPokemon(pokemon); } }, 5000); } /********** Start point **********/ const start = true; const pokemon = 'Rattata' if (start) { setTimeout(() => { openDialog(); addInputValue(pokemon); checkCurrentTime(pokemon); }, 3000); } })(); ```