IdlePixel Sigil Randomizer

Randomizes sigil after every message

  1. // ==UserScript==
  2. // @name IdlePixel Sigil Randomizer
  3. // @namespace lbtechnology.info
  4. // @version 1.2.0
  5. // @description Randomizes sigil after every message
  6. // @author Lux-Ferre
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play*
  9. // @grant none
  10. // @require https://greatest.deepsurf.us/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. let sigilList = []
  15.  
  16. function randInt(max) {
  17. return Math.floor(Math.random() * max);
  18. }
  19. class SigilPlugin extends IdlePixelPlusPlugin {
  20. constructor() {
  21. super("sigils", {
  22. about: {
  23. name: GM_info.script.name,
  24. version: GM_info.script.version,
  25. author: GM_info.script.author,
  26. description: GM_info.script.description
  27. },
  28. config: [{
  29. id: "activeNames",
  30. label: "List of your accounts that have the randomizer active (leave empty for all.)",
  31. type: "string",
  32. max: 2000,
  33. default: ""
  34. },
  35. {
  36. id: "randomizerEnabled",
  37. label: "Randomizer enabled?",
  38. type: "boolean",
  39. default: true
  40. }]
  41. });
  42. this.previous = "";
  43. }
  44. onChat(data) {
  45. const nameList = this.getConfig("activeNames");
  46. const randomizerEnabled = this.getConfig("randomizerEnabled");
  47. if(randomizerEnabled){
  48. if (nameList.includes(var_username) || nameList == "") {
  49. if (data.username === var_username){
  50. IdlePixelPlus.sendMessage('CHAT_SIGIL=' + sigilList[randInt(sigilList.length)])
  51. }
  52. }
  53. }
  54. }
  55. onLogin(){
  56. this.fetchSigils()
  57. }
  58.  
  59. fetchSigils(){
  60. const sigilSelection = $(`itembox[data-tooltip="sigil"]`).not(`itembox[style="display: none;"]`)
  61. sigilSelection.each((k, v)=> {sigilList.push($(v).data("item"))})
  62. }
  63. }
  64. const plugin = new SigilPlugin();
  65. IdlePixelPlus.registerPlugin(plugin);
  66. })();