JimblyCakes
New member
I'm a long time user of KolMafia, but a first time contributor. Can I have check-in access? My SourceForge username is jonandersen, if that helps. And yes, I've tested the patch and it works.
Patch:
Add support for considering foldability in the modifier maximizer. Got tired of manually squeezing a stinky cheese diaper every day.
Diff attached as well.
Diff:
Patch:
Add support for considering foldability in the modifier maximizer. Got tired of manually squeezing a stinky cheese diaper every day.
Diff attached as well.
Diff:
Code:
Index: src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java (revision 9545)
+++ src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java (working copy)
@@ -367,10 +367,6 @@
MaximizerFrame.boosts.clear();
if ( equipLevel != 0 )
{
- if ( equipLevel > 1 )
- {
- MaximizerFrame.boosts.add( new Boost( "", "(folding equipment is not considered yet)", -1, null, 0.0f ) );
- }
MaximizerFrame.best = new Spec();
MaximizerFrame.best.getScore();
// In case the current outfit scores better than any tried combination,
@@ -1648,8 +1644,23 @@
count += (buy << Evaluator.NPCBUYABLE_SHIFT) | buy;
}
- // TODO: check foldability
-
+ // consider folding
+ int fold = 0;
+ String name = ItemDatabase.getCanonicalName(id);
+ ArrayList foldGroup = ItemDatabase.getFoldGroup(name);
+ if (foldGroup != null)
+ {
+ // if the item can be folded, add up the number of other items we have within the same fold group
+ Integer foldcost = (Integer) foldGroup.get(0);
+ for (int j=1; j<foldGroup.size(); j++)
+ {
+ if (name.equals(foldGroup.get(j))) continue; // don't add the item we are considering folding
+ fold += InventoryManager.getAccessibleCount(ItemDatabase.getItemId((String)foldGroup.get(j)));
+ }
+
+ count += (fold << Evaluator.FOLDABLE_SHIFT) | fold;
+ }
+
if ( (count & Evaluator.TOTAL_MASK) >= 3 || equipLevel < 3 )
{
return ItemPool.get( id, count );
Attachments
Last edited by a moderator: