Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- buffer ascension_history_context = relevant_ascension_history(ascension_index);
- /*
- regex backreference...reference:
- ascension number \1
- date of prism break \2\3\4
- class \5
- moonsign \6
- turns at ascension \7
- turns at prism break \8
- days at ascension \9
- days at prism break \10
- */
- //have you accepted group_string() as your Lord and Savior recently? Now is a good time for that.
- 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>");
- 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];
- int daycount = holy_shit_what_even_is_this_shit[0][10].to_int();
- int turncount = holy_shit_what_even_is_this_shit[0][8].to_int();
- string likely_start_date;
- //oh no. this isn't easy.
- int year = holy_shit_what_even_is_this_shit[0][4].to_int();
- int month = holy_shit_what_even_is_this_shit[0][2].to_int();
- int day = holy_shit_what_even_is_this_shit[0][3].to_int() - (daycount + 1);
- //Borrow from the...months' place? What the fuck.
- while(day <= 0){
- month += -1;
- if( ( ( month < 8 ) && ( month % 2 ) == 1 ) || ( month >= 8 && ( month % 2 ) == 0 ) ){
- day += 31
- }
- else{
- if(month == 0){
- year += -1;
- month += 12;
- day += 31;
- }
- else{
- if(month == 2){
- //Jesus fuck. Leap years? Why does time suck so much?
- if((year %4) == 0){
- day += 29;
- }
- else{
- day += 28;
- }
- }
- else{
- day += 30;
- }
- }
- }
- }
- string year_but_stringier;
- string month_but_stringier;
- string day_but_stringier;
- if(year < 10){
- year_but_stringier = "0"+(year.to_string();
- }
- else{
- year_but_stringier = year.to_string();
- }
- if(month < 10){
- month_but_stringier = "0"+(month.to_string();
- }
- else{
- month_but_stringier = month.to_string();
- }
- if(day < 10){
- day_but_stringier = "0"+(day.to_string();
- }
- else{
- day_but_stringier = day.to_string();
- }
- likely_start_date = "20"+year_but_stringier+month_but_stringier+day_but_stringier;
Advertisement
Add Comment
Please, Sign In to add comment