Bug extract_items() does not understand item names mangled by the sword behind

I ran into this while using FirstThingsFirst, and Zarqon suggested it might count as an actual bug:

Intriguing little error:
Code:
[1917] Haunted Billiards Room
Encounter: A Shark's Chum
Encounter: hustled spectre
Strategy: /Users/blwalker/Library/Application Support/KoLmafia/ccs/qualex.ccs [default]
Round 0: qualex wins initiative!
Round 1: Eyestalks is looking a little thin.
Round 1: qualex tries to steal an item!
[B]You acquire an item: cube of billiard chalk
Unrecognized item found: cube out billiard chalk
You snatched 1 none![/B]

Why yes, I was wearing that dratted sword.

(Looking at the code, it's possible this should be a bug report about extract_items(), but since I think that's mainly meant for kmail where the sword doesn't fire, I can understand why it doesn't correct for the dang thing.)

The issue is that FirstThingsFirst is using extract_items() on the page text to figure out what item I have pickpocketed; while Mafia recognizes the item correctly even though I am wearing a sword, extract_items() does not.

If extract_items() is not intended to be used for arbitrary text (from adventures, etc.), this report can be safely ignored... or turned into a feature request, because it would be pretty handy -- at least to Zarqon!
 

StDoodle

Minion
At least when I wrote the wiki entry, that's exactly what I thought extract_items() was for, so I'd appreciate any additional input as well into how it should be used, and whether or not haiku / sword behind / etc are supposed to be handled.
 

Veracity

Developer
Staff member
extract_items uses ResultProcessor.processResults() to look for "You acquire" type messages on the text it is given. (It calls that function with a parameter that says the text did NOT come from a fight, but that shouldn't matter, since ResultProcessor only cares about that parameter if it's actually adding items to inventory, not if it is just parsing items into a list.)

When we process an actual fight.php page - normal, haiku, or anapestic - we use a different mechanism for recognizing items.

ResultProcess.processItem( boolean combatResults, StringTokenizer parsedResults, String acquisition, List data ) could/should presumably be changed to find item names regardless of prepositional munging. We do have code to do that, somewhere.
 
Top