Bug - Fixed Error during session initialization

AlbinoRhino

Active member
Started getting this error today with r18954. Appears to be a division by 0 error in HermitRequest.java?

Code:
Done checking allowed items.
Session data refreshed.
6 days until     Feast of Boris, Moxie bonus today and yesterday.
Error during session     initialization

It appears to occur at login at the point that (normally) the price-sharing update happens (which doesn't seem to actually occur and/or complete). But the error also seemed to be re-occuring at various points while my normal login script(s) ran. Wasn't clear to me that any particular ASH command was triggering it or if several different ones were.
 

Attachments

  • DEBUG_20181024.txt
    112.5 KB · Views: 32
Last edited:

fronobulax

Developer
Staff member
I did not get this. My prices are updating normally, as expected. I have nothing in my environment that would automatically/explicitly visit the hermit except to get clovers and those are out today for me.
 

AlbinoRhino

Active member
I logged in with my other account and everything worked perfectly fine. I then tried my alternate account again and still got the error. Not sure what is going on but it appears it may be specific to one account. Puzzled...
 

AlbinoRhino

Active member
In SewerRequest.java if I add the bolded line:

Code:
    public static int currentWorthlessItemCost()
    {
        int x = SewerRequest.currentStarterItemCount();
        int gumPrice = SewerRequest.CHEWING_GUM.getPrice();
[B]        RequestLogger.printLine( "gumPrice = "+gumPrice+" | x = "+x );[/B]
        return (int) Math.ceil( ( gumPrice / 4.0 ) * ( 17 - x ) );
    }

I will get the result...

gumPrice = 50 | x = 17

So..if x = 17 ...this will return 0.

If I add the bolded...

Code:
    private static int currentItemCount( final AdventureResult[] items, final List<AdventureResult> list )
    {
        int count = 0;
        for ( AdventureResult item : items )
        {
            [B]RequestLogger.printLine( "currentItemCount: count = "+count+" | item = "+item+" | item.getCount = "+item.getCount( list ) );[/B]
            count += item.getCount( list );
            if ( list == KoLConstants.inventory && KoLCharacter.hasEquipped( item ) )
            {
                count += 1;
            }
        }
        return count;
    }

I will get...

currentItemCount: count = 0 | item = seal-skull helmet | item.getCount = 1
currentItemCount: count = 1 | item = seal-clubbing club | item.getCount = 2
currentItemCount: count = 3 | item = helmet turtle | item.getCount = 1
currentItemCount: count = 4 | item = turtle totem | item.getCount = 2
currentItemCount: count = 6 | item = ravioli hat | item.getCount = 1
currentItemCount: count = 7 | item = pasta spoon | item.getCount = 2
currentItemCount: count = 9 | item = Hollandaise helmet | item.getCount = 1
currentItemCount: count = 10 | item = saucepan | item.getCount = 1
currentItemCount: count = 11 | item = disco mask | item.getCount = 1
currentItemCount: count = 12 | item = disco ball | item.getCount = 2
currentItemCount: count = 14 | item = mariachi hat | item.getCount = 1
currentItemCount: count = 15 | item = stolen accordion | item.getCount = 1
currentItemCount: count = 16 | item = old sweatpants | item.getCount = 1
gumPrice = 50 | x = 17


Not sure why this is only happening with one character...it seems my other character must have multiples of some of these items too...everything worked just fine on one other test multi as well. Anyone have any ideas? I am kind of getting lost with the code beyond this point. I'm not clear what should be happening but it seems none of these items should be counted more than once?
 
Last edited:

AlbinoRhino

Active member
I autosold the pasta spoons and seal-clubbing clubs (-4 to the count) and was finally able to login without the error.
 

Veracity

Developer
Staff member
Well, pooh. StarterItemCount is supposed to return the number of unique items. Will fix.
 
Top