Bug - Fixed GRIMACITE crafting method unequips hammer that needs to be worn for crafting

lostcalpolydude

Developer
Staff member
For recipes that need a depleted grimacite hammer (marked as GRIMACITE in concoctions.txt), the hammer needs to be worn. However, mafia tries to put one in your inventory instead (which is how I thought they worked until just a little bit ago, so it's not surprising). If you have exactly 1 hammer, mafia unequips it and crafting fails.

CreateItemRequest currently calls InventoryManager.retrieveItem, and it probably needs to use something in EquipmentRequest, though I don't know what change to make there.

If it's worth adding, the message you get when crafting fails due to not having a hammer equipped is "You must equip a grimacite hammer to make this item."
 

Bale

Minion
Wow. Here's another for the, "Cannot be tested by a dev" pile. Though not as outrageous as Bank of KoL's problem.
 

Veracity

Developer
Staff member
Well.....I own a Grimicite hammer, and I know all the recipes. I got them, oh, a year ago, precisely so that I could add those recipes to my Discoveries. I have had no reason to use any of them since then.

So, technically, I can test this. Unfortunately, I have to buy a no-longer-droppable item - a chunk of depleted Gramicite - in order to do so.

However, I can't say I have a lot of motivation to buy that limited item to try this out. Care to sent me some depleted Grimacite? I'll work on it for you. No? Probably not.
 

Bale

Minion
Compared to the price of the plans the depleted Grimacite is quite cheap. I suspect that lostcalpolydude can afford the price of a few chunks for science.
 

lostcalpolydude

Developer
Staff member
I only ran into this because it appears to be slightly profitable to make 1 depleted grimacite item per day. Removing the retrieveItem call at least means you can manually equip the hammer and tell mafia to craft an item. It looks like having mafia equip a hammer that you have is straightforward enough, it's all the error checking in case you don't have a hammer that makes it harder, though maybe if I look outside of autoRepairBoxServants to make changes it will be easier.

I'll mark this Won't Fix and reopen with a patch if I ever get that far. It's an incentive for me to learn more about writing code.
 

lostcalpolydude

Developer
Staff member
This patch works to equip the hammer and craft the item. It should recognize if you fail to equip the hammer, though maybe it should check to see if you can equip it first, which maybe would be better done by executing the CLI equip command where the logic already exists.
 

Attachments

  • depletedGrimacite.patch
    1.5 KB · Views: 52

Theraze

Active member
I'd probably suggest using the code from can_equip instead of having it call the CLI command...
Code:
EquipmentManager.canEquip( ItemDatabase.getItemName( item.intValue() ) )
 

lostcalpolydude

Developer
Staff member
That's one check. There's also the check to see if you have one to equip, and the check to see if you're already wearing it. Putting all of those checks into CreateItemRequest would speed up execution by a negligible amount when a depleted grimacite item is crafted (and not at other times, I think) at the cost of having more code in the file and more logic to follow if there is ever a reason to rewrite it.
 

lostcalpolydude

Developer
Staff member
I've been using the patch above for months with no problems. I just added a few lines to see if you have a hammer and can wear it (things that were always true when I tried crafting it before) to the attached patch. It shows up in Item Manager -> Creatable properly now (based on whether I move the hammer to my closet, with closet use off), but I have to refresh my inventory for that display to update.
 

Attachments

  • depletedGrimacite.patch
    1.6 KB · Views: 45
Top