hugmeir

Untitled

Jan 3rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. /* Spam graffiti on Lyle's tracks. He asked for it! */
  2.  
  3. int choice_number_by_text(string page_text, string identifier)
  4. {
  5. /* Stolen from Ezandora's lylefarm.ash */
  6. foreach s in $strings[?,(,)]
  7. identifier = identifier.replace_string(s, "\\" + s); //FIXME remove/escape other grepables
  8. string [int][int] matches = page_text.group_string("value=\"?([0-9]*)\"?><input [ ]*class=button type=submit value=\"" + identifier);
  9. int choice_id = matches[0][1].to_int();
  10. return choice_id;
  11. }
  12.  
  13. boolean run_choice_by_text(string page_text, string identifier)
  14. {
  15. int choice_id = choice_number_by_text(page_text, identifier);
  16. if ( choice_id <= 0 )
  17. return false;
  18. run_choice(choice_id);
  19. return true;
  20. }
  21.  
  22.  
  23. void main(string message, int chisels_to_use) {
  24. print_html("Going to Lyle's");
  25. buffer page_text =
  26. visit_url("place.php?whichplace=town_right&action=townright_lyle");
  27. print_html("Loaded Lyle's");
  28.  
  29. if ( !page_text.contains_text("Grab a Chisel.") ) {
  30. print_html("No option to use a chisel available. We are done!");
  31. run_choice_by_text(page_text, "\"No Thanks.\"");
  32. return;
  33. }
  34.  
  35. int grab_choice_id = choice_number_by_text(page_text, "Grab a Chisel.");
  36. print_html("grab a chisel option: " + grab_choice_id);
  37.  
  38. string url = "choice.php?whichchoice=1263&pwd&option=" + grab_choice_id;
  39. page_text = visit_url(url, true, false);
  40.  
  41. if ( !page_text.contains_text("Chisel It") ) {
  42. print_html("No Chisel It option -- no clue what's happening!");
  43. return;
  44. }
  45.  
  46. while ( chisels_to_use-- > 0 ) {
  47. buffer new_page = visit_url("choice.php?whichchoice=1268&option=1&pwd=" + my_hash() + "&m=" + url_encode(message), true, true);
  48. print_html(chisels_to_use + " left");
  49. waitq(1); // Don't hammer the servers, one chisel a second
  50. }
  51.  
  52. print_html("Done.");
  53. }
Advertisement
Add Comment
Please, Sign In to add comment