buffer gelnoob(buffer page) {
skill [int] bestGelnoob; // These skills are listed at the top of the order
foreach sk in $skills[Subcutaneous Fat,Profound Shame,Sweat Glands,
Central Hypothalamus,Rudimentary Alimentary Canal,Small Intestine,Stomach-Like Thing,Large Intestine,
Work Ethic,Sense of Purpose,Sense of Pride,Arrogance,
Vacuoles,Golgi Apparatus,
Right Eyeball,Optic Nerves,Saccade Reflex,Visual Cortex,
Pathological Greed,Kneecaps,Beating Human Heart,
Middle Fingers,Index Fingers,
Sunglasses,Ice Water In Your Veins]
bestGelnoob[ to_int(sk) ] = sk;
int i = index_of(page, '<div class="sk">');
if(i >= 0) {
buffer result;
string [int] gelskill;
matcher sk = create_matcher('<div class="sk">.+?value="(\\d+)".+?</div>', page);
while(sk.find())
gelskill[ to_int(sk.group(1)) ] = sk.group(0);
result.append(page.substring(0,i));
// First the skills that are on the approved list
foreach x,gel in gelskill
if(bestGelnoob contains x) {
result.append(gel);
remove gelskill[x];
}
// It's safe to assume the player learned at least one of those skills in a previous ascension, so lets add a line break
result.append("<br><hr><br>");
// Now the rest of the skills. In order.
foreach x,gel in gelskill
result.append(gel);
if((i = index_of(page,'<div style="clear:both;')) >= 0)
result.append(page.substring(i));
return result;
}
return page;
}
buffer special_pages(buffer page) {
if(page.contains_text("Welcome to the Kingdom, Gelatinous Noob"))
return gelnoob(page);
return page;
}
void main() {
visit_url().special_pages().write();
}