Skip to content

Instantly share code, notes, and snippets.

@DamianDominoDavis
Last active August 22, 2022 21:55
Show Gist options
  • Save DamianDominoDavis/bce32c05229b0eadbc43efcd17a77a5e to your computer and use it in GitHub Desktop.
Save DamianDominoDavis/bce32c05229b0eadbc43efcd17a77a5e to your computer and use it in GitHub Desktop.
# abbreviate a number as thousands, millions, billions
string kmb_num(float x) {
if (x<0)
return '-'+kmb_num(0-x);
for i from 9 to 3
if (x >= 10**i)
return (x.to_float()/10**(3*(i/3))).to_string('%'+(i-(i%3))+'.'+(2-i%3)+'f') + string[]{'k','M','B'}[i/3-1];
return (x.to_int().to_float() != x && x.to_int().to_string('%d').length() < 3)
? x.to_string('%1.2f')
: x.to_int().to_string('%d');
}
# express a number in terms of Mr. Accessory
# optionally a fractional number of Misters Accessory
# else an integer number of A's, plus abbreviated change
string mra_num(float x, boolean frac) {
static int A = $item[Mr. Accessory].mall_price();
int left = x / A;
float right = x - left*A;
if (!frac)
return (left > 0? left+'A' : '')
+ (left > 0 && right >= 1000000? '+' : '')
+ (right >= 1000000 ? right.kmb_num() : '');
else {
return (x/(A).to_float()).to_string('%.1f') + 'A';
}
}
string mra_num(float x) {
return mra_num(x, false);
}
# is_unrestricted, but still works in aftercore, and respects path-specific restrictions in run
boolean is_standard(string it) {
static int year = format_date_time("yyyyMMdd", today_to_string(), "yyyy").to_int() - 2;
static buffer standard_php = visit_url(`standard.php?date={year}-01-02`, false);
return !contains_text(standard_php, it);
}
import <kmb_num.ash>
import <is_standard.ash>
boolean[item] mrstore = $items[
Mr. Accessory,Uncle Buck,Sister Accessory,Monster Manuel,Golden Mr. Accessory,Mr. Accessory Jr.,Fly-By-Knight Heraldry Form,Boosty Juice,Clan VIP Lounge invitation,
cursed magnifying glass,undrilled cosmic bowling ball,combat lovers locket lockbox,grey gosling,undamaged unbreakable umbrella,MayDay&trade; contract,packaged June cleaver,designer sweatpants (new old stock),unopened tiny stillsuit,
fresh can of paint,packaged miniature crystal ball,emotion chip,power seed,packaged backup camera,shortest-order cook,packaged familiar scrapbook,clan underground fireworks shop,Our Daily Candles&trade; order form,packaged industrial fire extinguisher,bottled Vampire Vintner,packaged Daylight Shavings Helmet,packaged cold medicine cabinet,
Retrospecs try-at-home kit,unopened Bird-a-Day calendar,mint-in-box Powerful Glove,Better Shrooms and Gardens catalog,sinistral homunculus,Guzzlr application,bag of Iunion stones,baby camelCalf,packaged SpinMaster&trade; lathe,Bagged Cargo Cultist Shorts,Comprehensive Cartographic Compendium,packaged knock-off retro superhero cape,box o' ghosts,
elf sleeper agent,Kramco Industries packing carton,mint condition Lil' Doctor&trade; bag,vampyric cloake pattern,PirateRealm membership packet,Fourth of May Cosplay Saber kit,rune-strewn spoon cocoon,Beach Comb Box,Distant Woods Getaway Brochure,packaged Pocket Professor,Unopened Eight Days a Week Pill Keeper,unopened diabolic pizza cube box,red-spotted snapper roe,
kerosene-soaked skip,January's Garbage Tote (unopened),Clan Carnival Game,Pok&eacute;fam Guide to Capturing All of Them,FantasyRealm membership packet,God Lobster Egg,SongBoom&trade; BoomBox Box,kitten burglar,Bastille Battalion control rig crate,Neverending Party invitation envelope,latte lovers club card,voter registration form,Boxing Day care package,
hopeful candle,space planula,heart-shaped crate,unpowered Robortender,Spacegate access badge,New-You Club Membership Form,suspicious package,LI-11 Motor Pool voucher,Pocket Meteor Guide,corked genie bottle,xo-skeleton-in-a-box,pantogram,locked mumming trunk,
basking robin,Batfellow comic,X-32-F snowman crate,LT&T telegraph office deed,Witchess Set,Clan Floundry,disconnected intergnat,Source terminal,detective school application,DIY protonic accelerator kit,Dear Past Self Package,li'l orphan tot,Granny Tood's Thanksgarden Catalog,Build-a-City Gingerbread kit,
golden monkey statuette,Professor of Spelunkology,Chateau Mantegna room key,bottle of lovebug pheromones,Ed the Undying exhibit crate,airplane charter: Dinseylandfill,portable Mayo Clinic,yellow puck,Pack of Every Card,airplane charter: That 70s Volcano,shrine to the Barrel god,haunted doghouse,airplane charter: The Glaciest,machine elf capsule,
praying Grim Brother,hibernating Grimstone Golem,Discontent&trade; Winter Garden Catalog,Buddy Bjorn,Sneaky Pete's leather jacket,Little Geneticist DNA-Splicing Lab,airplane charter: Spring Break Beach,still grill,Clan speakeasy,The Confiscator's Grimoire,Thor's Pliers,airplane charter: Conspiracy Island,fist turkey outline,Crimbo sapling,
avatar of the Unconscious Collective,dreaming Jung man,Snow Suit,GameInformPowerDailyPro subscription card,Jarlsberg's pan,Libram of Pulled Taffy,Order of the Green Thumb Order Form,adventurer clone egg,Clan hot dog stand,Folder Holder,KoLHS Pep Squad Box,deanimated reanimator's coffin,Pantsgiving,The Smith's Tome,
The Groose in the Hoose,The Kloop in the Coop,Libram of Resolutions,can of Rain-Doh,Small Medium,Boris's Helm,Olympic-sized Clan crate,Moping Artistic Goth Kid,Camp Scout backpack,Unagnimated Gnome,box of bear arms,Pete & Jackie's Dragon Tooth Emporium Catalog,deactivated nanobots,Thinknerd's Grimoire of Geeky Gifts,
rehearsing dramatic hedgehog,sleeping piano cat,Loathing Legion knife,a cute angel,Sorcerers of the Shore Grimoire,Alice's Army booster box,Clan shower,My Own Pen Pal kit,mysterious chest,Operation Patriot Shield,fairy-worn boots,Tome of Clip Art,Make-Your-Own-Vampire-Fangs kit,stuffed-shirt scarecrow,Mint Salton Pepper's Peppermint Seed Catalog,
hungover chauvinist pig,perfectly ordinary frog,stinky cheese ball,Libram of BRICKOs,Clan looking glass,panicked kernel,Crown of Thrones,glowing frisbee,Juju Mojo Mask,Schmalz's First Prize Beer,Greatest American Pants,organ grinder,Grumpy Bumpkin's Pumpkin Seed Catalog,hibernating robot reindeer,
uniclops egg,passed-out psychedelic bear,container of Spooky Putty,Libram of Love Songs,Apathargic Bandersnatch,tiny costume wardrobe,Elvish sunglasses,Clan pool table,infant sandworm,Bag o' Tricks,floaty stone sphere,Tome of Sugar Shummoning,squamous polyp,moveable feast,suspicious stocking,
unemployed hunchbacked minion,siesta-ing Casagnova gnome,Libram of Divine Favors,naughty origami kit,sane hatrack,Sp'n-Zor's Grimoire of &quot;Tasteful&quot; Gifts,packet of mayfly bait,llama lama cria,little box of fireworks,cotton candy cocoon,haiku katana,spooky rattling cigar box,Scratch 'n' Sniff Sticker Tome,candy cornucopia,
nervous tick egg,jitterbug larva,Great Ball of Frozen Fire,Libram of Candy Heart Summoning,dandy lion cub,bad penguin egg,Mayflower bouquet,bottled green pixie,bottle-rocket crossbow,wizard action figure,navel ring of navel gazing,class five ecto-larva,V for Vivala mask,Crimbo P. R. E. S. S. I. E.,
unwound cymbal-playing monkey,calm attention-deficit demon,Tome of Snowcone Summoning,iceberglet,March hat,McPhee's Grimoire of Hilarious Object Summoning,homeless hobo spirit,astral badger,jewel-eyed wizard hat,Comma Chameleon egg,Travoltan trousers,plastic pumpkin bucket,pilgrim shield,yuletide troll chrysalis,
Cheshire Bitten,coffee sprite,orphan baby yeti,silk garter snake,lucky Tam O'Shanter,emo roe,personal raindrop,miniature gravy-covered maypole,deflated inflatable dodecapede,wax lips,pygmy bugbear shaman,Jekyllin hide belt,doppelshifter egg,miniscule temporal rip,sweet nutcracker,
Dark Jill-O-Lantern,hand turkey outline,crimbo elfling,
cosmic bucket,jug of Sneaky Pete's Mojo,talisman of Seshat,Memories of Beanslinging,Memories of Cow Punching,Memories of Snake Oiling,Gummi-Memory,Lazenby's Life Lesson,time-twitching toolbelt,bucket of ancient Vampyre blood,
KoL Con 13 snowglobe,potted tea tree,Xi Receiver Unit,Gordon Beer's Beer Garden Catalog,Tome of Rad Libs,Gygaxian Libram,hippo tutu,
Gratitude chocolate (octopus-filled),Gratitude chocolate (thyme-filled),Gratitude chocolate (bourbon-filled),Subscription cocoa dispenser
];
# print table of items and their abbreviated prices
void k_disp(item[int] what, boolean std) {
for pow from 0 to 9 {
foreach i,it in what
if (!(std ^ it.is_standard()) && mall_price(it) >= 10**pow && mall_price(it) < 10**(pow+1))
print(`{it} -- {mall_price(it).kmb_num()}`);
print();
}
print();
}
# print table of items and their prices in Accessories
void a_disp(item[int] what, boolean std) {
int A = $item[Mr. Accessory].mall_price();
boolean[item] considered;
boolean paginate;
for x from 0 to 10**10 by A {
paginate = false;
foreach i,it in what
if (!(considered contains it) && (!std || it.is_standard()) && mall_price(it) + 1 >= x && mall_price(it) + 1 < x+A) {
print(`{mall_price(it).mra_num(true)} -- {it}`);
considered[it] = true;
paginate = true;
}
if (paginate)
print();
}
print();
}
void main(boolean only_standard) {
mall_prices('mrstoreitems');
item[int] them, zero, one;
int k = 0, line = 10;
foreach it in mrstore {
if (it.historical_age() >= 6)
mall_price(it);
k += 1;
if ((100*k)/count(mrstore) >= line) {
print(`{line}% searched...`);
line += 10;
}
if(mall_price(it) > 0)
them[them.count()] = it;
if(mall_price(it) == 0)
zero[zero.count()] = it;
if(mall_price(it) < 0)
one[one.count()] = it;
}
sort them by value.to_int();
sort them by value.mall_price();
print();
a_disp(them,only_standard);
k_disp(zero,only_standard);
k_disp(one,only_standard);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment