Bug - Fixed get_stash() checks existence of shop instead of clan stash

philmasterplus

Active member
Just discovered this while looking at RuntimeLibrary.java in r20625:

Java:
public static Value get_stash( ScriptRuntime controller )
{
       MapValue value = new MapValue( DataTypes.ITEM_TO_INT_TYPE );

       if ( !KoLCharacter.hasStore() )
       {
              return value;
       }

The if-statement is erroneously checking for the existence of a shop, instead of the clan stash.

I verified the bug by selling my shop, logging out, logging back in, then calling get_stash(). Although I was in a clan with a large stash, the function returned an empty map.

I fixed the code like this:

Java:
public static Value get_stash( ScriptRuntime controller )
{
        MapValue value = new MapValue( DataTypes.ITEM_TO_INT_TYPE );

        String clanName = ClanManager.getClanName( false );
        if ( clanName == null || clanName.isEmpty() )
        {
            return value;
        }

...which makes the function check whether the player is in a clan.

I'm also attaching a patch for the fix.
 

Attachments

  • philmasterplus-get-stash-no-clan-fix.patch
    777 bytes · Views: 1
Top