//these two mafia CLI commands make the alii.
alias tcrsequips => ash float max = -10000000;float[item] list;foreach i in $items[]{if(i.numeric_modifier($string[%%]) != 0 && i.to_slot() != $slot[none]){list[i] = i.numeric_modifier($string[%%]);if( i.numeric_modifier($string[%%]) > max){max = i.numeric_modifier($string[%%]);}}}boolean[slot] empty;foreach i in $slots[]{empty[i] = true;}foreach i in list{empty[i.to_slot()] = false;}int[float] ordered;ordered[max] = 0;int index = 0;boolean include = true;boolean leftovers = true;while(leftovers){max = -10000000;foreach i in list{include = true;foreach j in ordered{if(list[i] >= j){include = false;}}if(include && list[i] > max){max = list[i];}}index++;ordered[max] = index;leftovers = false;foreach i in list{include = false;foreach j in ordered{if(list[i] == j){include = true;}}if(!include){leftovers = true;}}}foreach x in $slots[]{if(!empty[x]){print(x+":");for i from index to 0 by -1{foreach j in ordered{if(ordered[j] == i){foreach k in $items[]{if(k.numeric_modifier($string[%%]) == j && k.to_slot() == x)print_html(k+" gives "+k.numeric_modifier($string[%%])+" "+$string[%%]);}}}}print("=====================");}}
alias tcrspotions => ash float max = -10000000;float[effect] list;foreach i in $items[]{if(i.effect_modifier("effect").numeric_modifier($string[%%]) != 0){list[i.effect_modifier("effect")] = i.effect_modifier("effect").numeric_modifier($string[%%]);if( i.effect_modifier("effect").numeric_modifier($string[%%]) > max){max = i.effect_modifier("effect").numeric_modifier($string[%%]);}}}int[float] ordered;ordered[max] = 0;int index = 0;boolean include = true;boolean leftovers = true;while(leftovers){max = -10000000;foreach i in list{include = true;foreach j in ordered{if(list[i] >= j){include = false;}}if(include && list[i] > max){max = list[i];}}index++;ordered[max] = index;leftovers = false;foreach i in list{include = false;foreach j in ordered{if(list[i] == j){include = true;}}if(!include){leftovers = true;}}}for i from index to 0 by -1{foreach j in ordered{if(ordered[j] == i){foreach k in $items[]{if(k.effect_modifier("effect").numeric_modifier($string[%%]) == j)print(k.effect_modifier("effect")+" (from "+k+") gives "+k.effect_modifier("effect").numeric_modifier($string[%%])+" "+$string[%%]);}}}}
Edit:
//bonus alias for just printing everything that gives a specified effect, since that's often a fun thing to do.
alias tcrseffect => ash foreach i in $items[] if(i.effect_modifier("effect") == $string[%%].to_effect()) print(i);
===============================================================================
===============================================================================
===============================================================================
//examples of uses.
> tcrsequips muscle experience percent
hat:
stone baseball cap gives 10.0 muscle experience percent
Zombo's skullcap gives 10.0 muscle experience percent
crumpled felt fedora gives 10.0 muscle experience percent
Mark III Steam-Hat gives 10.0 muscle experience percent
very pointy crown gives 10.0 muscle experience percent
=====================
weapon:
black sword gives 10.0 muscle experience percent
ocarina of space gives 10.0 muscle experience percent
lead pipe gives 10.0 muscle experience percent
bad vibroknife gives 10.0 muscle experience percent
=====================
off-hand:
demon buckler gives 10.0 muscle experience percent
beach ball marble gives 10.0 muscle experience percent
The Necbromancer's Stein gives 10.0 muscle experience percent
oil lamp gives 10.0 muscle experience percent
studded sealhide shield gives 10.0 muscle experience percent
ox-head shield gives 10.0 muscle experience percent
=====================
shirt:
lemon shirt gives 10.0 muscle experience percent
=====================
pants:
The Necbromancer's Shorts gives 10.0 muscle experience percent
=====================
acc1:
infernal insoles gives 10.0 muscle experience percent
tiny plastic apathetic lizardman gives 10.0 muscle experience percent
tarrrnished charrrm bracelet gives 10.0 muscle experience percent
Chester's moustache gives 10.0 muscle experience percent
Pokëmann figurine: Vegemite gives 10.0 muscle experience percent
Pokëmann figurine: Frank gives 10.0 muscle experience percent
ornamental sextant gives 10.0 muscle experience percent
Former Sheriff Dan's tin star gives 10.0 muscle experience percent
=====================
Returned: void
> tcrspotions item drop
Ermine Eyes (from evil eyedrops of the ermine) gives 5.0 item drop
Lucky Cat is Lucky (from Elvish delight) gives 5.0 item drop
Capricorn Rising (from fancy chocolate car) gives 5.0 item drop
Ermine Eyes (from "DRINK ME" potion) gives 5.0 item drop
Lucky Cat is Lucky (from kumquat supersucker) gives 5.0 item drop
Object Detection (from handyman "hand soap") gives 5.0 item drop
Fortunate Resolve (from mafia aria) gives 10.0 item drop
Hip to Be Square Dancin' (from flask of peppermint schnapps) gives 10.0 item drop
Tingling Feeling (from turtle pheromones) gives 10.0 item drop
Pla-see-bo (from Black Body™ spray) gives 10.0 item drop
Pla-see-bo (from flask of hamethyst juice) gives 10.0 item drop
Fortunate Resolve (from jug of hamethyst juice) gives 10.0 item drop
Singer's Faithful Ocelot (from big dribbly candle) gives 10.0 item drop
Singer's Faithful Ocelot (from breath mint) gives 10.0 item drop
Fortunate Resolve (from wad of cotton) gives 10.0 item drop
Eye of the Seal (from Pain Dip) gives 10.0 item drop
Techno Bliss (from motivational poster) gives 10.0 item drop
Ichorous Eyesight (from gooey paste) gives 10.0 item drop
Singer's Faithful Ocelot (from gummi belemnite) gives 10.0 item drop
Your Interest is Peaked (from daub-breaker) gives 10.0 item drop
Eye of the Seal (from beet-flavored Mr. Mediocrebar) gives 10.0 item drop
Singer's Faithful Ocelot (from celestial carrot juice) gives 10.0 item drop
Aspect of the GravyPlum Fairy (from Mer-kin strongjuice) gives 10.0 item drop
Techno Bliss (from Gene Tonic: Insect) gives 10.0 item drop
Eggs-tra Sensory Perception (from Gene Tonic: Penguin) gives 10.0 item drop
Tingling Feeling (from cuppa Physicali tea) gives 10.0 item drop
Ocelot Eyes (from patent aggression tonic) gives 10.0 item drop
Singer's Faithful Ocelot (from eldritch alignment spray) gives 10.0 item drop
Your Interest is Peaked (from sweetened reindeer fat) gives 10.0 item drop
Your Interest is Peaked (from universal antivenin) gives 10.0 item drop
Chief Executive Optimism (from can of Red Minotaur) gives 15.0 item drop
Chief Executive Optimism (from flask of mining oil) gives 15.0 item drop
Joyful Resolve (from carton of gaspers) gives 15.0 item drop
Dancing Prowess (from diluted makeup) gives 15.0 item drop
Dance Interpreter (from Spam Witch sammich) gives 20.0 item drop
Rain Dancin' (from red striped oyster egg) gives 20.0 item drop
Fat Leon's Phat Loot Lyric (from STYX deodorant body spray) gives 20.0 item drop
Scavengers Scavenging (from scrap of shadow) gives 20.0 item drop
The Ballad of Richie Thingfinder (from Wax Flask) gives 20.0 item drop
Scavengers Scavenging (from penguin paste) gives 20.0 item drop
Quadrilled (from Sloe Comfortable Zoo on Fire) gives 20.0 item drop
The Ballad of Richie Thingfinder (from accidental mutton) gives 20.0 item drop
Disco Concentration (from Shrubble Bubble) gives 20.0 item drop
Eagle Eyes (from batarang) gives 20.0 item drop
Fat Leon's Phat Loot Lyric (from alien plant goo) gives 20.0 item drop
Disco Concentration (from brilliant oyster egg) gives 20.0 item drop
Uncucumbered (from lotion of hotness) gives 25.0 item drop
Brocolate Brostidigitation (from orange candy heart) gives 25.0 item drop
Slightly Cursed, Mostly Lucky (from cyclops eyedrops) gives 25.0 item drop
Wet and Greedy (from bottle of black cat tonic) gives 25.0 item drop
Your Eyes are Peeled! (from groupie spangles) gives 25.0 item drop
Slightly Cursed, Mostly Lucky (from traffic jam toast) gives 25.0 item drop
Wet and Greedy (from baggie of powdered sugar) gives 25.0 item drop
Your Eyes are Peeled! (from Flaming Knob) gives 25.0 item drop
Slightly Cursed, Mostly Lucky (from drop of water-37) gives 25.0 item drop
Turkey-Agitated (from good ash) gives 25.0 item drop
Serendipi Tea (from cabbage-flavored Mr. Mediocrebar) gives 25.0 item drop
Serendipi Tea (from pulled blue taffy) gives 25.0 item drop
Haunted Stomach (from Mer-kin saltsquid) gives 25.0 item drop
Super Vision (from Elizabeth's paintbrush) gives 25.0 item drop
Eyes for Miles (from Gene Tonic: Dude) gives 25.0 item drop
Haunted Stomach (from steampunk potion) gives 25.0 item drop
Brocolate Brostidigitation (from pygmy adder oil) gives 25.0 item drop
Serendipi Tea (from candy cigarette) gives 25.0 item drop
Super Vision (from experimental serum G-9) gives 25.0 item drop
Eyes for Miles (from loaf of soda bread) gives 25.0 item drop
Wet and Greedy (from cuppa Boo tea) gives 25.0 item drop
Dance of the Sugar Fairy (from twice-haunted screwdriver) gives 25.0 item drop
Stench Jellied (from sleaze nuggets) gives 30.0 item drop
Mmmmmelon (from phial of sleaziness) gives 30.0 item drop
Stench Jellied (from Gene Tonic: Horror) gives 30.0 item drop
Celestial Vision (from cuppa Proprie tea) gives 30.0 item drop
Hoity Toity (from potion of spiritual gunkifying) gives 30.0 item drop
I See Everything Thrice! (from drum of pomade) gives 33.0 item drop
I See Everything Thrice! (from candy chalk) gives 33.0 item drop
The Dinsey Spirit (from Hawking's Elixir of Brilliance) gives 40.0 item drop
Tremella Tremens (from resolution: be happier) gives 40.0 item drop
Mercenary (from eagle feather) gives 40.0 item drop
Tremella Tremens (from child-sized dracula cloak) gives 40.0 item drop
Voracious Gorging (from unusual oil) gives 40.0 item drop
Mercenary (from Inner Wisdom) gives 40.0 item drop
The Dinsey Spirit (from murderbot shield unit) gives 40.0 item drop
Salsa Satanica (from blood of the Wereseal) gives 50.0 item drop
Cautious Prowl (from Happy Birthday, Claude! cake) gives 50.0 item drop
Unusual Perspective (from glowing El Vibrato drone) gives 50.0 item drop
Clyde's Blessing (from Gummi-DNA) gives 50.0 item drop
Items Are Forever (from children of the candy corn) gives 50.0 item drop
Sucrose-Colored Glasses (from Marvin's marvelous pill) gives 50.0 item drop
Cautious Prowl (from fireclutch) gives 50.0 item drop
Items Are Forever (from Chakra Libre) gives 50.0 item drop
Beta Carotene Overdose (from disco horoscope (Leo)) gives 50.0 item drop
Unusual Perspective (from wind-up vampire teeth) gives 50.0 item drop
Beta Carotene Overdose (from fabric hardener) gives 50.0 item drop
Cautious Prowl (from airborne mutagen) gives 50.0 item drop
Sucrose-Colored Glasses (from hustler shades) gives 50.0 item drop
Cautious Prowl (from cuppa Loyal tea) gives 50.0 item drop
Always be Collecting (from patent alacrity tonic) gives 50.0 item drop
Polka Face (from voodoo glowskull) gives 55.0 item drop
Melancholy Burden (from bowl of Jeal-O) gives 60.0 item drop
One Very Clear Eye (from flask of rainwater) gives 100.0 item drop
Returned: void
Comments