IronTetsubo
Member
At least, that's my theory. Here's the situation. I was running into an issue where maximizing mainstat (as zombie) with "pullable/buyable" selected in ronin happened to pick up a "mesh hat" as the right item for me - but, instead of listing it as "pull & equip...", it listed it as "acquire & equip...", and then trying to actually execute that maximizer line would fail (as I'm in ronin still, so acquiring of course won't work).
So, that's the actual bug - now, here's my logic/conclusions, some or all of which may be faulty.
After poking around further (and some false starts), it turns out that I happen to have 16 mesh caps in storage. The maximizer uses bitflags as a part of the item count to pass around how to treat items, specifically 4-bit ranges... and my theory (hence the bug report above) is because it's using 4 bit fields and I happened to have 16 items, I've "overflowed" the proper range for pullable and ended up in the buyable range. Attached is a patch which fixes this, by "clamping" the count - it forces the count to 1 for the flag, regardless of your actual count. I think this is okay, as for all equipment you're just pulling 1 anyways, and for potions and the like you generally don't want to pull more as well. And I don't think potions and the like are even checked as a pullable thing? not sure about that, though. I'm not really sure if this is the right fix (or we should clamp to no more than 15, so as to not overflow the bitfield but still preserve some level of the count?), but it's at least a starting point for the discussion. the other route to go, which of course is an extremely painful/unlikely one, is to throw out the bitfields entirely which would of course bypass this issue.
One other minor point/bug - in theory this is an issue for the other flags out there, but I just looked at pullable. View attachment fix_maximizer_pull_flag.patch
So, that's the actual bug - now, here's my logic/conclusions, some or all of which may be faulty.

After poking around further (and some false starts), it turns out that I happen to have 16 mesh caps in storage. The maximizer uses bitflags as a part of the item count to pass around how to treat items, specifically 4-bit ranges... and my theory (hence the bug report above) is because it's using 4 bit fields and I happened to have 16 items, I've "overflowed" the proper range for pullable and ended up in the buyable range. Attached is a patch which fixes this, by "clamping" the count - it forces the count to 1 for the flag, regardless of your actual count. I think this is okay, as for all equipment you're just pulling 1 anyways, and for potions and the like you generally don't want to pull more as well. And I don't think potions and the like are even checked as a pullable thing? not sure about that, though. I'm not really sure if this is the right fix (or we should clamp to no more than 15, so as to not overflow the bitfield but still preserve some level of the count?), but it's at least a starting point for the discussion. the other route to go, which of course is an extremely painful/unlikely one, is to throw out the bitfields entirely which would of course bypass this issue.
One other minor point/bug - in theory this is an issue for the other flags out there, but I just looked at pullable. View attachment fix_maximizer_pull_flag.patch