Feature extend fold gcli command to consider closet items if autoSatisfyWithCloset is 'true'

If autoSatisfyWithCloset is 'true' and the fold command finds no relevant foldable in inventory it would be delightful if it would check the closet as well. :)
 

Bale

Minion
Actually, I think that it should check the closet if autoSatisfyWithCloset is 'true'. It even checks your equipped items after all. Not checking the closet sounds like unintended behavior.

Perhaps I should change this from "feature" to "bug"?
 
Perhaps this should be it's own feature request, I don't know:
Another extension of the fold command would be to have it consider foldable items equipped on familiars in your terrarium.
 
Last edited:
Okay, so I've got some working code for this. What are everyone's opinions on the order of where it looks for the item?

The update I'm using checks for the foldable in this order:
inventory, closet (if 'autoSatisfyWithCloset' is true), terrarium, equipped equipment

I finally figured out how to make a diff file! And it only took one hour. This is my first time trying to edit the KoLmafia source code or program in java at all, so it probably needs some refinement. I just adapted code from the InventoryManager.

I didn't know what to do with FAMEQUIP_REMOVER. I wasn't sure if it would be better to make it a public function in the InventoryManager where I copied it from.

Here's some relevant gCLI output from the version I'm using:
> set autoSatisfyWithCloset = false

autoSatisfyWithCloset => false

> own legion

Loathing Legion electric knife (1 closet)

> fold electric knife

You don't have anything transformable into that item!

> set autoSatisfyWithCloset = true

autoSatisfyWithCloset => true

> fold electric knife

Removing items from closet...
You acquire an item: Loathing Legion electric knife
Requests complete.
> own legion

Loathing Legion helicopter (1 terrarium)

> fold electric knife

Stealing Loathing Legion helicopter from Iseijin-san the Li'l Xenomorph...
You acquire an item: Loathing Legion electric knife
Requests complete.
 

Attachments

  • fold.diff
    4.1 KB · Views: 42

slyz

Developer
I was going to post that we might as well make a call to ItemManager.retrieveItem() directly, but I had forgotten about the mall. Maybe the different steps ItemManager.retrieveItem() takes to obtain an item could be separated in their own functions so that they can be accessed independently?
 

roippi

Developer
I finally figured out how to make a diff file! And it only took one hour. This is my first time trying to edit the KoLmafia source code or program in java at all, so it probably needs some refinement. I just adapted code from the InventoryManager.

If you're not coding in an IDE already, I suggest netbeans. It's free and pretty awesome.
 

slyz

Developer
There are better ways of programming than opening files in notepad and praying the end result will compile?
 

roippi

Developer
Heh. I'm known to code quick things (in everything from BASH to java to Matlab) in vim. Anything sufficiently complicated and I'll of course fire up an IDE.
 

fronobulax

Developer
Staff member
There are better ways of programming than opening files in notepad and praying the end result will compile?

*snicker*

Two windows. One with the editor of choice. One with a command line so you can compile. Extra credit for a second command line to run the program. Worked for me for many years....
 

Veracity

Developer
Staff member
Two windows. One with the editor of choice. One with a command line so you can compile.
This is my technique, too.

One window is emacs, my text editor of choice. Within emacs, I will use up to two frames: one with the file I'm currently editing, the other with a list of notes, a debug log, a file to compare, whatever. Within emacs, I can run grep over a directory or the entire tree, visit each grep hit, find and replace, compare two versions of a file, and so on.

One window is a Terminal window, my Unix (OS X) shell. I type "ant" to compile and "java -jar ..." to execute. Unexpected errors produce stack traces there. Debug prints that I insert also go there.

No debugger. No IDE.

Don't try this at home. :)
 

heeheehee

Developer
Staff member
This is my technique, too.

One window is emacs, my text editor of choice. Within emacs, I will use up to two frames: one with the file I'm currently editing, the other with a list of notes, a debug log, a file to compare, whatever. Within emacs, I can run grep over a directory or the entire tree, visit each grep hit, find and replace, compare two versions of a file, and so on.

One window is a Terminal window, my Unix (OS X) shell. I type "ant" to compile and "java -jar ..." to execute. Unexpected errors produce stack traces there. Debug prints that I insert also go there.

No debugger. No IDE.

Don't try this at home. :)

Better yet, M-x shell. One window. :D
 
Top