Advertisement
A-non-e-mouse

Event scripts

Aug 2nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         MCC Event Script
  3. // @namespace    MCC Tools
  4. // @version      1.0
  5. // @description  Auto event script
  6. // @author       Ryozu
  7. // @match        http://us-moe-app.amz-aws.jp/event/*
  8. // @exclude      http://us-moe-app.amz-aws.jp/event/mini_event/*
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function()
  13. {
  14.     'use strict';
  15.  
  16.     if (window.location.href.indexOf("/error.php") > -1)
  17.     {
  18.         window.history.go(-1);
  19.     }
  20.    
  21.     if (window.location.href.indexOf("no_life.php") > -1)
  22.     {
  23.         console.log("Over Stamina Usage");
  24.         //window.history.go(-1);
  25.     }
  26.  
  27.     if (window.location.href.indexOf("end.php") > -1)
  28.     {
  29.         console.log("Step Success");
  30.     }
  31.    
  32.    
  33.     var stamina = parseInt(document.querySelector(".shadow").innerHTML.trim());
  34.     console.log("Stamina: " + stamina);
  35.    
  36.     /* --------------------------------------------------------------------------- */
  37.     //var BP = 0;
  38.     //var Icons = document.images;
  39.     //for (var c = 0; c < Icons.length; c++)
  40.     //{
  41.     //  if (Icons[c].src.indexOf("battle_gauge_on.png") > -1)
  42.     //  {
  43.     //      BP++;
  44.     //  }
  45.     //}
  46.     //BP = BP / 2;
  47.     //console.log("Battle Pts: " + BP);
  48.     /* --------------------------------------------------------------------------- */
  49.    
  50.     /*
  51.     var Spa = document.getElementsByClassName("img_ninja2017_2 move_sub");
  52.     if (Spa.length > 0)
  53.     {
  54.         //Spa[0].click();
  55.     }
  56.    
  57.     if (window.location.href.indexOf("/spa/") > -1)
  58.     {
  59.         var Spar = document.getElementsByClassName("img_ninja2017_1");
  60.         if (Spar.length == 6)
  61.         {
  62.             Spar[5].click();
  63.         }
  64.     }
  65.     */
  66.    
  67.     if (window.location.href.indexOf("/quest/") > -1)
  68.     {
  69.         console.log("/quest/");
  70.        
  71.         if (window.location.href.indexOf("move_select.php") > -1)
  72.         {
  73.             console.log("move_select.php");
  74.             var links = document.getElementsByClassName("event_button");
  75.             //console.log(links.length);
  76.             for (var k = links.length - 1; k >= 0; k--)
  77.             {
  78.                 if (links[k].href.indexOf("move_conf.php") > -1)
  79.                 {
  80.                     //console.log(links[k].href);
  81.                     if (links[k].href.indexOf("roid=53823&") > -1)
  82.                     {
  83.                         //That's Kiria's roid=id, change for your own or whatever.
  84.                         console.log("Myroid Found in location");
  85.                         links[k].click();
  86.                     }
  87.                 }
  88.             }
  89.             console.log("Myroid not found");
  90.         }
  91.        
  92.        
  93.         var Encounter = document.getElementsByClassName("img_teruteru2017_1 move2").length;
  94.         Encounter += document.getElementsByClassName("img_teruteru2017_4 title_win").length;
  95.         Encounter += document.getElementsByClassName("img_teruteru2017_4 title_fever").length;
  96.         //Encounter++;
  97.  
  98.         //img_teruteru2017_4 title_win
  99.         //#quest_window > table:nth-child(7) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > a:nth-child(1)
  100.         var Pict = document.querySelector("#quest_window > table:nth-child(7) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > a:nth-child(1)");
  101.        
  102.         if (Pict != null)
  103.         {
  104.             if (Pict.text == "Take a Picture")
  105.             {
  106.                 Encounter += 1;
  107.             }
  108.         }
  109.        
  110.         if (((stamina >= 10) && (Encounter > 0)) || (stamina >= 85))
  111.         {
  112.             console.log("Stamina Good");
  113.             var Brights = document.getElementsByClassName("bright");
  114.             var buttons = document.getElementsByClassName("event_button");
  115.            
  116.             var selected = document.getElementsByClassName("bright")[0];
  117.            
  118.            
  119.             for (var i = 0; i < buttons.length; i++)
  120.             {
  121.                 //console.log(buttons[i].innerHTML);
  122.                 //Buttons you want to be clicked when you have enough stamina
  123.                 if ((buttons[i].innerHTML.indexOf("Call Out") > -1) ||
  124.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  125.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  126.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  127.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  128.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  129.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  130.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  131.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  132.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  133.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  134.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  135.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  136.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  137.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  138.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  139.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  140.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  141.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  142.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  143.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  144.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  145.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  146.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  147.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  148.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  149.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  150.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  151.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  152.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  153.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  154.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  155.                     (buttons[i].innerHTML.indexOf("xx") > -1))
  156.                 {
  157.                     selected = buttons[i];
  158.                     //break;
  159.                 }
  160.             }
  161.             if (selected == 0)
  162.             {
  163.                 console.log("No button found!");
  164.             }
  165.             else
  166.             {
  167.                 console.log("Clicking: " + selected.innerHTML.toString());
  168.                 selected.click();
  169.             }
  170.         }
  171.    
  172.         else
  173.         {
  174.             console.log("Not enough stamina");
  175.             var check0 = document.getElementsByName("mate0");
  176.             if (check0[0])
  177.             {
  178.                 check0[0].value = "99";
  179.             }
  180.             var check1 = document.getElementsByName("mate1")[0];
  181.             if (check1)
  182.             {
  183.                 check1.value = "99";
  184.             }
  185.             var check2 = document.getElementsByName("mate2")[0];
  186.             if (check2)
  187.             {
  188.                 check2.value = "99";
  189.             }
  190.            
  191.             var buttons = document.getElementsByClassName("event_button");
  192.             var selected = 0;
  193.            
  194.            
  195.             for (var i = 0; i < buttons.length; i++)
  196.             {
  197.                 //console.log(buttons[i].innerHTML);
  198.                
  199.                 if (window.location.href.indexOf("/spa/result_end.php") > -1)
  200.                 {
  201.                     var GoBack = document.querySelector("a.event_button:nth-child(10)");
  202.                     if (GoBack != "")
  203.                     {
  204.                         GoBack.click();
  205.                     }
  206.                 }
  207.                
  208.                
  209.                 //Buttons you want clicked even if you don't hit the stamina threshold.
  210.                 if ((buttons[i].innerHTML.indexOf("Call Out") > -1) ||
  211.                     (buttons[i].innerHTML.indexOf("Keep going") > -1) ||
  212.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  213.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  214.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  215.                     (buttons[i].innerHTML.indexOf("xx") > -1) ||
  216.                     (buttons[i].innerHTML.indexOf("xx") > -1))
  217.                 {
  218.                     selected = buttons[i];
  219.                     break;
  220.                 }
  221.             }
  222.             if (selected == 0)
  223.             {
  224.                 console.log("No button found!");
  225.             }
  226.             else
  227.             {
  228.                 console.log("Clicking: " + selected.innerHTML.toString());
  229.                 selected.click();
  230.             }
  231.         }
  232.     }
  233.    
  234. })();
  235.  
  236. console.log("Reloading page in a bit");
  237. setInterval(openUrl, 60000); // Wait x000 seconds
  238.  
  239. function openUrl()
  240. {
  241.     location.reload();
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement