Bug - Fixed Visiting the workshed removes workshed item from ASH's get_campground()

Ezandora

Member
r13917, OS X 10.9.2

Steps to reproduce:
-Have DNA-splicing lab or warbear induction oven (probably any workshed item) installed
-Run get_campground() after logging in. Workshed item appears in listing.
-Click on the workshed. ( campground.php?action=workshed )
-Run get_campground() again. Workshed item no longer in results.

Examples:

Login:
Code:
> ash get_campground();

Returned: aggregate int [item]
bartender-in-the-box => 1
Certificate of Participation => 1
clockwork maid => 1
Dramatic™ range => 1
ice harvest => 3
Little Geneticist DNA-Splicing Lab => 1
pagoda plans => 1
Queue Du Coq cocktailcrafting kit => 1
Visited workshed:
Code:
> ash get_campground();

Returned: aggregate int [item]
bartender-in-the-box => 1
Certificate of Participation => 1
clockwork maid => 1
Dramatic™ range => 1
ice harvest => 3
pagoda plans => 1
Queue Du Coq cocktailcrafting kit => 1

On another character:
Login:
Code:
> ash get_campground();

Returned: aggregate int [item]
bartender-in-the-box => 1
Certificate of Participation => 1
clockwork maid => 1
Dramatic™ range => 1
pagoda plans => 1
Queue Du Coq cocktailcrafting kit => 1
warbear induction oven => 1
Visited workshed:
Code:
> ash get_campground();

Returned: aggregate int [item]
bartender-in-the-box => 1
Certificate of Participation => 1
clockwork maid => 1
Dramatic™ range => 1
pagoda plans => 1
Queue Du Coq cocktailcrafting kit => 1


This may be due to CampgroundRequest.java, setCurrentWorkshedItem(), line 985, which calls removeCampgroundItem().

What I think happens:

-campground.php?action=workshed visited
-parseWorkshed() called
-Line 868 runs, findImage() matches on genelab.gif, calls setCampgroundItem()
-setCampgroundItem() adds the workshed item to the KoLConstants.campground list. If it's already in the list, this doesn't do anything. (max count of one)
-Line 870 calls setCurrentWorkshedItem(), which has possible two paths:
--First time/on login: getCurrentWorkshedItem() is null, so it doesn't call removeCampgroundItem(). Workshed item remains in campground list, shows up in get_campground() initially as above.
--After that: getCurrentWorkshedItem() is set, so call removeCampgroundItem(). This removes the addition from findImage(); workshed item no longer in campground list.

So change setCurrentWorkshedItem() to call setCampgroundItem? Or change the test from
Code:
if ( CampgroundRequest.getCurrentWorkshedItem() != null )

to

Code:
if ( CampgroundRequest.getCurrentWorkshedItem() != null && !CampgroundRequest.getCurrentWorkshedItem().equals(workshedItem) )

Not sure if that'll work in all cases, my understanding of KoLMafia's code is very limited.
 
Top