I have noticed that my characters often buy certain items (scrolls, keys, ...) multiple times even though shift + buy should take care of that. The result is having more than 12 keys or having to sell the extra scroll. I guess that's why the function Town.clearScrolls() exists.
I have tested the following fix and it seems to work perfectly (file: d2bs.kolbot.libs.common.Prototypes):
Unit.prototype.buy = function (shiftBuy, gamble) {
if (Config.PacketShopping) {
return Packet.buyItem(this, shiftBuy, gamble);
}
if (this.type !== 4) { // Check if it's an item we want to buy
throw new Error("Unit.buy: Must be used on items.");
}
if (!getUIFlag(0xC) || (this.getParent() && this.getParent().gid !== getInteractedNPC().gid)) { // Check if it's an item belonging to a NPC
throw new Error("Unit.buy: Must be used in shops.");
}
if (me.getStat(14) + me.getStat(15) < this.getItemCost(0)) { // Can we afford the item?
return false;
}
var i = 0, result;
do {
result = this.shop(shiftBuy ? 6 : 2);
delay(500);
i += 1;
} while (i < 3 && !result);
return result;
};
I have noticed that my characters often buy certain items (scrolls, keys, ...) multiple times even though shift + buy should take care of that. The result is having more than 12 keys or having to sell the extra scroll. I guess that's why the function Town.clearScrolls() exists.
I have tested the following fix and it seems to work perfectly (file: d2bs.kolbot.libs.common.Prototypes):