Bug - Fixed 1337 7r0uZ0RZ generates "unknown item" message on transfer.

fronobulax

Developer
Staff member
When I move one 1337 7r0uZ0RZ from the DC to my inventory using DC Manager it gets flagged as an unknown item in the gCLI.
Removing items from display case...
You acquire 1337 7r0uZ0RZ
You acquire (unknown item 0) (1,337)
Updating display case...
Requests complete.

Similar message occurs when using take_display in a script.

(One pair of pants was all I tried to transfer. Do not know if things change when I transfer multiple pairs of pants or when I transfer multiple item types).

Session counts, inventory and so on seem to be correct so the the FR would be to not not label a known item as unknown in the gCLI.

r9415 and as far as I can tell there are no data override files.

Thanks.
 
This looks like a regexp error. KoLmafia's getting confused and thinking that 1337 is a quantity when it's actually part of the item name.
 

slyz

Developer
It looks like the problem is in TransferItemRequest.java. When you take items from your DC, this function is called to extract the list of items from the response text:
PHP:
ArrayList getItemList( final String responseText, final Pattern itemPattern )
In KoL messages, items with their associated amounts can be displayed as:
Code:
1337 7r0uZ0RZ (2)
or
Code:
2 1337 7r0uZ0RZ

Of course, if you have only one 1337 7r0uZ0RZ, the matcher for the second form with think that there are 1337 of an item named 7r0uZ0RZ.

The problem, I think, is that getItemList() first tries to find all the items with a matcher for the first form, then also uses the second matcher whether the first one succeeded or not.

In your example, that means it correctly finds that you obtained one 1337 7r0uZ0RZ. But it also tries to use the second matcher, and think you obtained 1337 of an unknown "7r0uZ0RZ" item.

Am I making any sense? Maybe it would be simpler for you to just look at lines 581-612 of TransferItemRequest.java, which is called from line 190 of DisplayCaseRequest.java.
 

Veracity

Developer
Staff member
Ha ha ha.

In order to incorporate your fancy Stash matcher, I modified TransferItemRequest so that you can use either a count/item matcher, an item/count matcher, or both. The "both" case was the original code you were looking at.

The Clan stash now uses only a count/item matcher - with your fancy pattern.
It looks like the Display case should use only an item/count matcher.

That should be doable, now.
 

slyz

Developer
Well, that wound up being an easy fix indeed: r9429.
Code:
> display take 1 1337 7r0uZ0RZ

Removing items from display case...
You acquire 1337 7r0uZ0RZ

It looks like TransferItemRequest.getItemList() is only used by ClanStashRequest and DisplayCaseRequest, so I guess that's a wrap.
 
Top