yojimbos_law

choice.1388.ash

Jul 9th, 2019
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. //requires that choice.php override ezan wrote to let people make make overrides for individual choice adventures.
  2. //the gist is that we get rid of waves because waves, add coordinates and image# to all images, and replace all images sharing the most common one's digit on the current beach with bonestars. God only knows whether any of these things matter for anything.
  3.  
  4.  
  5.  
  6. //try to make this only fire on the beach combing page.
  7. if(available_choice_options().count() <3 ){
  8. buffer page = visit_url();
  9. //get rid of waves because ugh.
  10. page = page.replace(page.index_of("var roll"),page.index_of("3050)\;")+6,"");
  11. //let's find image frequencies.
  12. int minfreq =69420;
  13. int maxfreq;
  14. int[string] number_of;
  15.  
  16. string[int][int] buttons_to_change = page.group_string("(<button style=\"border: 0; background: none; padding: 0\" name=\"coords\" value=\"(\\d{1,2}\\,\\d{2,5})\" type=\"submit\"><img title=\")[^\"]*(\" alt=\"[^\"]*\" src=\")[^\"]*/beachcomb/([^\\.]+)\\.png(\" /></button>)");
  17. /*
  18. group 1 is everything before title text
  19. group 2 is coords value
  20. group 3 is everything between title text and image
  21. group 4 is the image name
  22. group 5 is everything after the image
  23.  
  24. */
  25. foreach i,j in buttons_to_change{
  26. if(j==1){
  27. //last digit in image name.
  28. number_of[buttons_to_change[i][4].group_string("\\d(\\d)")[0][1]]++;
  29. }
  30. }
  31. foreach i in number_of{
  32. if(number_of[i] > maxfreq){
  33. maxfreq = number_of[i];
  34. }
  35.  
  36. if(number_of[i] < minfreq){
  37. minfreq = number_of[i];
  38. }
  39. }
  40. foreach i,j in buttons_to_change{
  41. if(j == 1){
  42. if(
  43. // number_of[buttons_to_change[i][4].group_string("\\d(\\d)")[0][1]] == minfreq
  44. // ||
  45. number_of[buttons_to_change[i][4].group_string("\\d(\\d)")[0][1]] == maxfreq
  46. ){
  47. page = page.replace_string(buttons_to_change[i][0],
  48.  
  49. buttons_to_change[i][1]
  50. +buttons_to_change[i][2]
  51. +":"+buttons_to_change[i][4].group_string("\\d+")[0][0]
  52. +buttons_to_change[i][3]
  53. //+"http:/\/127.0.0.1:60080/images/itemimages/asshat.gif"
  54. +"http:/\/127.0.0.1:60080/images/adventureimages/bonestar.gif\""
  55. //+"http:/\/127.0.0.1:60080/images/otherimages/main/map3.gif\""
  56. +" height=\"80"
  57. +buttons_to_change[i][5]
  58. );
  59. }
  60. }
  61. }
  62. //changing mouseover text for all sandy stuff because inspect element is dildos.
  63. buttons_to_change = page.group_string("(<button style=\"border: \\d; background: none; padding: 0\" name=\"coords\" value=\"(\\d{1,2}\\,\\d{2,5})\" type=\"submit\"><img title=\")[^\"]*(\" alt=\"[^\"]*\" src=\"[^\"]*\/beachcomb/(combed)?sand(castle)?(\\d+)\\.png\" /></button>)");
  64. /*
  65. group 1 is everything before title text
  66. group 2 is coords
  67. group 3 is everything after title text
  68. group 4 is "combed" or ""
  69. group 5 is "castle" or ""
  70. group 6 is the number in the image
  71. */
  72. if(buttons_to_change.count() > 0){
  73. foreach i,j in buttons_to_change{
  74. if(j==1 ){
  75.  
  76. page = page.replace_string(buttons_to_change[i][0] , buttons_to_change[i][1]
  77. +buttons_to_change[i][2]
  78. +":"+buttons_to_change[i][6]
  79. +buttons_to_change[i][3]
  80. );
  81. //print(buttons_to_change[i][2]);
  82. }
  83. }
  84. }
  85. page.write();
  86. }
Advertisement
Add Comment
Please, Sign In to add comment