Bug 1:
How is it:
The vials that have subtype are appearing to sell in npc, but when we click to sell, npc says that we do not have the item.
Fix would be:
Or do not show these items or be able to sell them.
Print:
https://imgur.com/vR7fhTT
script inside some seller/buyer npc:
<parameter key="shop_sellable" value="Spellwand,7735,299; Vial,2006,5" />
Bug 2:
How it is:
The item appears in npc for sell, but we don't have any items in our backpack
print:
http://prntscr.com/k2vuow
script:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Satsu" script="Satsu.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="158" head="78" body="96" legs="118" feet="96" addons="0" />
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value="
wine,2006,10,15;
cocktail glass of beer,10150,52,3;
cocktail glass of fruit juice,10150,52,21;
cocktail glass of lemonade,10150,52,5;
cocktail glass of mead,10150,52,43;
cocktail glass of milk,10150,52,6;
cocktail glass of rum,10150,52,27;
cocktail glass of tea,10150,52,35;
cocktail glass of water,10150,52,1;
cocktail glass of wine,10150,52,15;" />
<parameter key="shop_sellable" value="cocktail glass,10150,50;" />
</parameters>
</npc>
can confirm this. The error is in npc buy/sell module, I don't recall exactly but it checks for specific type if it's given, otherwise it only buys for type = 0
Another bug is that if you put a golden cup in a monster's drop, it will drop with type = 1 (water).
When you try to sell to the npc, since the golden cup isn't empty, it will say you don't have the item.
The second bug no need put in monster, just create this npc script and say trade without any item in your backpack.
yea, that was exactly what I've said, that's why I put
Another bug is that if you put a golden cup in a monster's drop, it will drop with type = 1 (water)`
Do you intend to submit a PR to fix this?
@DSpeichert I don't have the solution, I found this bug on my own server but didn't fixed it yet, just cataloged it. But as far as I tracked it, it's an error in buy/sell module because it have a weird logic when it comes to subtype:
if the subtype is given in npc xml, everything ok, it will only buy/sell from the specific subtype.
else, it just buy/sells from subtype 0 (empty).
what should be changed is for the else case, it accepts the item regardless of subtype but I didn't know if it could have any side-effect.
And the other bug I've mentioned: items in monster's drop behave a little differently, when the subtype is not specified they are added like "doCreateItem(item, count/subtype)" and therefore when there's no subtype specified they come with subtype 1 (water) because the count is always 1 when not specified.
This has to be re-made in source (I don't really know where) to check if item can hold a fluid, then the subtype is always 0 unless specified otherwise.
It's a client limitation bound to client id of the items. There isn't much that can be done besides writing a new protocol for npc trading in otclient.
Most helpful comment
And the other bug I've mentioned: items in monster's drop behave a little differently, when the subtype is not specified they are added like "doCreateItem(item, count/subtype)" and therefore when there's no subtype specified they come with subtype 1 (water) because the count is always 1 when not specified.
This has to be re-made in source (I don't really know where) to check if item can hold a fluid, then the subtype is always 0 unless specified otherwise.