Skip to content

Instantly share code, notes, and snippets.

@DamianDominoDavis
Last active December 20, 2023 10:40
Show Gist options
  • Save DamianDominoDavis/56a43a3eacd5f825431705e92449a766 to your computer and use it in GitHub Desktop.
Save DamianDominoDavis/56a43a3eacd5f825431705e92449a766 to your computer and use it in GitHub Desktop.
boolean[string,item] loot = {
"0_outfits": $items[Crimbuccaneer tricorn,Crimbuccaneer fledges (mint),Crimbuccaneer breeches,Elf Guard patrol cap,Elf Guard hotpants,Elf Guard insignia (private)],
"1_currency": $items[Crimbuccaneer flotsam,Elf army machine parts,Elf Guard MPC,Crimbuccaneer Piece of 12],
"2_elvish_shop" : $items[mulled wine,canteen of eggnog,Swedish coffee,sugarplum ration,rum-soaked fruitcake,gingerbread nylons],
"3_pirate_shop" : $items[hot wine,flask of egggrog,Jamaican coffee,prank Crimbo card,Crimbuccaneer squirtblunderbuss,My First Paycheck envelope,barnacle-encrusted sweater,Crimbuccaneer nose ring,pet anchor,stuffed kraken,Crimbuccaneer tattoo gift certificate],
"4_others": $items[pickled bread,salted mutton,corned beet,peppermint donut,pirate encryption key alpha,pirate encryption key bravo,pirate encryption key charlie,pirate encryption key delta,military candy cane,groggipop,rigging knot,Elf Guard Field Manual: Culinary Arts (used),Cocktails of the Age of Sail (used),Elf Guard Field Manual: Extortion (used),The Encyclopedia of Fruit (used),Elf Guard Field Manual: Wilderness Sleeping (used)],
"5_elvish_common" : $items[Elf guard mouthknife,Kelflar vest,Elf Guard commandeering gloves,Elf Guard Officer's sidearm,Red and white claret,Sundae ration,Peppermint tack,Elf guard payroll bag,officer's nog,peppermint bomb,Elf guard eyedrops,military-grade peppermint oil,Elf Guard tinsel grenade],
"6_pirate_common" : $items[Crimbuccaneer shirt,Shipwright's hammer,sawed-off blunderbuss,Pegfinger,Cannonbomb,Whale cerebrospinal fluid,Whalesteak,old-school pirate grog,grog nuts,Crimbuccaneer rigging lasso,Crimbuccaneer whale oil,Crimbuccaneer mologrog cocktail,Crimbuccaneer captain's purse],
"7_crafted": $items[gunwale whalegun,wet tack,whalecake,red white and blue claret,yule grog,Crimbow Rainbo],
"8_elvish_rare" : $items[Elf Guard SCUBA tank,Elvish underarmor,Elf Guard red and white beret,ancient Elf dessert spoon,Elf Guard Field Manual: Culinary Arts,Elf Guard clipboard,Elf Guard Field Manual: Wilderness Sleeping,Elf Guard hangover cure,Elf Guard broom,Elf Guard Field Manual: Extortion,Elf Guard strategic map,Elf Guard insignia (general),Elf Guard fuel tank,massive wrench,Elf guard honor present],
"9_pirate_rare" : $items[Gunwale,Free boots,Crimbuccaneer runebone,The Encyclopedia of Fruit,Crimbuccaneer fledges (disintegrating),Whalegun,Crimbuccaneer tavern swab,Cocktails of the Age of Sail,punching mirror,baby rigging snake,Crimbuccaneer Lantern,Crimbuccaneer bombjacket,Crimbuccaneer premium booty sack,Crimbuccaneer invasion map,brown pirate pants],
};
// 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");
}
float avg_price(boolean[item] sample) {
float o = 0;
int i = 0;
foreach it in sample {
o += it.historical_price();
i++;
}
return (i>0) ? o/i : o;
}
void main() {
foreach category in loot {
print(category.to_upper_case(), "red");
string o = "";
foreach it in loot[category] {
o = `({it.available_amount()}) {it} --- @ {it.historical_price().kmb_num()}`;
o.print(it.available_amount() > 0 ? "green":"gray");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment