ManageHoard

Adds buttons to select all but 1 for selling/converting and for selecting all Swipp/Baldwin items for sending to vault.

  1. // ==UserScript==
  2. // @name ManageHoard
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Adds buttons to select all but 1 for selling/converting and for selecting all Swipp/Baldwin items for sending to vault.
  6. // @author Fantazjor
  7. // @include http://flightrising.com/main.php?p=hoard*
  8. // @include http://flightrising.com/main.php?p=vault*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. $( "#btn1" ).remove();
  16. $( "#btn2" ).remove();
  17.  
  18. var rcss1="style='position:fixed;display:block;top:0;z-index:9999;background:rgba(3,169,244,0.8);width:100px;height:40px;left:0;'";
  19. var rcss2="style='position:fixed;display:block;top:0;z-index:9999;background:rgba(3,169,244,0.8);width:100px;height:40px;left:110px;'";
  20. var r1= $('<input id="btn1" '+rcss1+' type="button" value="All But 1"/>');
  21. var r2= $('<input id="btn2" '+rcss2+' type="button" value="All Special"/>');
  22. $("body").append(r1);
  23. $("body").append(r2);
  24.  
  25. $( '#btn1' ).click(function() {
  26. $( "span select" ).each(function( index ) {
  27. if ( $( this ).val() == "1" ) { } else {
  28. var v = $( this ).attr('name');
  29. var a = v.replace("v","a");
  30. var val = $( this ).val();
  31. var rel = $( this ).parent().find("a.clue").attr('rel');
  32. var img = $( this ).parent().find("img");
  33. var ibg = img.css( "background-color" );
  34.  
  35. var tab = "trinket";
  36. if (rel.search("food")>-1) { tab = "food"; }
  37. else if (rel.search("equipment")>-1) { tab = "equipment"; }
  38. else if (rel.search("familiar")>-1) { tab = "familiar"; }
  39. else if (rel.search("battle_items")>-1) { tab = "battle_items"; }
  40. else if (rel.search("skins")>-1) { tab = "skins"; }
  41. else { tab = "trinket"; }
  42.  
  43. var itm = parseInt(rel.replace("includes/itemajax.php?id=","").replace("&tab="+tab,""));
  44. var inp = $("[name='" + a + "']");
  45.  
  46. console.log( a + " " + itm + " " + val );
  47. if (ibg == "rgba(0, 0, 0, 0)") {
  48. if (itm > 4469 && itm < 4554) { } else {
  49. $( this ).val(val - 1);
  50. $( this ).css( "outline", "4px solid red" );
  51. inp[0].checked = true;
  52. }
  53. }
  54. }
  55. });
  56. console.log( "done" );
  57. //alert("done");
  58. });
  59.  
  60. $( "#btn2" ).click(function() {
  61. $( "select" ).each(function( index ) {
  62. var v = $( this ).attr('name');
  63. var a = v.replace("v","a");
  64. var img = $( this ).parent().find("img");
  65. var ibg = img.css( "background-color" );
  66. var inp = $("[name='" + a + "']");
  67. if (ibg != "rgba(0, 0, 0, 0)") {
  68. inp[0].checked = true;
  69. }
  70. });
  71. console.log( "done" );
  72. //alert("done");
  73. });
  74.  
  75. //keyboard shortcuts
  76. $("body").keyup(function(event){
  77. if(event.keyCode == 37){
  78. $("#invent div:first a:first").click();
  79. }else if(event.keyCode == 39){
  80. $("#invent div:first a:last").click();
  81. }else if(event.keyCode == 13){
  82. $("#yes").click();
  83. }else if(event.keyCode == 9){
  84. $("#no").click();
  85. $("#ret").click();
  86. }
  87. });
  88. })();