I believe I have found the issue. The function mall_quant determines the number of mall items needed to restore. It returns a floating point (unlike the function used for looking at inventory inside ronin which returns an integer).
So, if you are trying to heal 50 HP (an amount that is passed to the mall_quant function), the item bullpup tent which restores 1000 HP will return 50/1000 = 0.05 bull pup tent quantity needed to restore 50 HP.
The function is used in 3 places. In meat_to_mp function where it is rounded up via ceil.
In the function to actually use the item where it is rounded up
And in the function that determines the best mall item "best_mall" which fails to round it up
So in the above scenario where bullpup tent costs 1900, "best_mall" will, for determining which item is best, internally calculate that the cost to heal 50 HP using a quantity of bullpup tents as = 1900 * 0.05 = 95 meat
However, the cost to restore is not 95 meat because you cannot consume a fraction of an item, it is 1900. This item should not be the chosen result of the best_mall function. And costs should not be calculated based on fractions of an item. The function was obviously designed with multi using items that heal much much less.
Because it does get rounded up for MP restoring, and skills are used by default when possible, this is only an issue if someone is playing in casual, aftercore, or after ronin, and has 0 known healing skills. As such, it was not really noticed until I started a brand new multi that tried to use this script from day 1 of the account existing.
I am currently trying to decide exactly how to fix it while ensuring I don't break anything else. I am honestly not sure what the point is in having mall_quant return a floating point instead of having it automatically ceil inside the function itself. It gets ceil in every usage except one... in which case it should have been ceil and the fact it isn't is the cause of this bug...
Incidentally, it is quite lucky I had my multi stuck in a super long glover HC ascension (I was trying to see the worst glover one can have... HC with 0 skills permed)
I am going to have to make sure NOT to perm a healing skill, and ascend into softcore in order to test possible fixes for this issue
Also, because the way the logic works this is very much an edge case, not a common issue like I thought. And not exactly easy to test since perming a healing skill is one of the first thing people often do. edit: its only an edge case for HP recovery, it actually does affect the MP recovery functionality too.
Also, it will take days (and an annoying inefficient detour, I need to not perm a healing skill, and ascend into casual or get into aftercore without buying a healing skill in run) before my multi is even set up such that I can even start testing fixes. So I will get back to this when I have it set up.