yojimbos_law

time is awful

Aug 10th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. buffer ascension_history_context = relevant_ascension_history(ascension_index);
  2.  
  3. /*
  4. regex backreference...reference:
  5. ascension number \1
  6. date of prism break \2\3\4
  7. class \5
  8. moonsign \6
  9. turns at ascension \7
  10. turns at prism break \8
  11. days at ascension \9
  12. days at prism break \10
  13. */
  14. //have you accepted group_string() as your Lord and Savior recently? Now is a good time for that.
  15. string[int][int] holy_shit_what_even_is_this_shit = ascension_history_context.group_string("<td class=small valign=center>(\\d+)\\s*</td><td height=30 class=small valign=center>(\\d+)/(\\d+)/(\\d+)\s*</td><td class=small valign=center><span title=\"Level at Ascension: \\d+\">\\d+</span>\\s*</td><td class=small valign=center><img src=\"https:/\/s3\\.amazonaws\\.com/images\\.kingdomofloathing\\.com/itemimages/[^\"]*\\.gif\" width=30 height=30 alt=\"[^\"]*\" title=\"([^\"]*)\"></td><td class=small valign=center>(\\w+(?:\\s\\w+)*)\\s*</td><td class=small valign=center><span title=\'Total Turns: ([\\d\\,]+)\'>([\\d\\,]+)</span></td><td class=small valign=center><span title=\'Total Days: ([\\d\\,]+)\'>([\\d\\,]+)</span>");
  16.  
  17. string likely_end_date = "20"+holy_shit_what_even_is_this_shit[0][4]+holy_shit_what_even_is_this_shit[0][3]+holy_shit_what_even_is_this_shit[0][2];
  18.  
  19. int daycount = holy_shit_what_even_is_this_shit[0][10].to_int();
  20.  
  21. int turncount = holy_shit_what_even_is_this_shit[0][8].to_int();
  22.  
  23. string likely_start_date;
  24. //oh no. this isn't easy.
  25. int year = holy_shit_what_even_is_this_shit[0][4].to_int();
  26. int month = holy_shit_what_even_is_this_shit[0][2].to_int();
  27. int day = holy_shit_what_even_is_this_shit[0][3].to_int() - (daycount + 1);
  28.  
  29. //Borrow from the...months' place? What the fuck.
  30. while(day <= 0){
  31. month += -1;
  32. if( ( ( month < 8 ) && ( month % 2 ) == 1 ) || ( month >= 8 && ( month % 2 ) == 0 ) ){
  33. day += 31
  34. }
  35. else{
  36. if(month == 0){
  37. year += -1;
  38. month += 12;
  39. day += 31;
  40. }
  41. else{
  42. if(month == 2){
  43. //Jesus fuck. Leap years? Why does time suck so much?
  44. if((year %4) == 0){
  45. day += 29;
  46. }
  47. else{
  48. day += 28;
  49. }
  50. }
  51. else{
  52. day += 30;
  53. }
  54. }
  55. }
  56. }
  57.  
  58. string year_but_stringier;
  59. string month_but_stringier;
  60. string day_but_stringier;
  61.  
  62. if(year < 10){
  63. year_but_stringier = "0"+(year.to_string();
  64. }
  65. else{
  66. year_but_stringier = year.to_string();
  67. }
  68.  
  69. if(month < 10){
  70. month_but_stringier = "0"+(month.to_string();
  71. }
  72. else{
  73. month_but_stringier = month.to_string();
  74. }
  75.  
  76. if(day < 10){
  77. day_but_stringier = "0"+(day.to_string();
  78. }
  79. else{
  80. day_but_stringier = day.to_string();
  81. }
  82.  
  83. likely_start_date = "20"+year_but_stringier+month_but_stringier+day_but_stringier;
Advertisement
Add Comment
Please, Sign In to add comment