Hello OTLanders!
My objective is to make runes stackable but I'm having trouble with the shop module
I'm using the following npc system: GitHub - peonso/tibialegacyserver: Tibia Legacy Server is a OpenTibia 7.72 real map server. (https://github.com/peonso/tibialegacyserver)
I changed the items.otb file to support stackable runes, also I changed the spells.cpp and recompiled
Also i changed the spells.xml and changed all rune charges value to 1x, so there are no funky errors on stacking 1x and 3x runes
spells.cpp:2271
Everything works fine, the runes work as intended, but now, when reaching the NPC to buy a rune:
Seems that the NPC is selling the items unstacked and referred to the amount typed by the user
Found something at npc/scripts/lib/npcsystem/modules.lua
modules.lua:636
I tried deleting the isItemRune(itemid) condition, but no success, any suggestion?
Help is appreciated, thanks.
My objective is to make runes stackable but I'm having trouble with the shop module
I'm using the following npc system: GitHub - peonso/tibialegacyserver: Tibia Legacy Server is a OpenTibia 7.72 real map server. (https://github.com/peonso/tibialegacyserver)
I changed the items.otb file to support stackable runes, also I changed the spells.cpp and recompiled
Also i changed the spells.xml and changed all rune charges value to 1x, so there are no funky errors on stacking 1x and 3x runes
spells.cpp:2271
C++:
int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1);
g_game.transformItem(item, item->getID(), newCount);
Everything works fine, the runes work as intended, but now, when reaching the NPC to buy a rune:
Example 1: | Example 2: |
Input:: buy 2 sd Output:: container shows 1x sd and 2x sd | Input:: buy 3 sd Output:: container shows 1x sd, 2x sd, 3x sd |
Seems that the NPC is selling the items unstacked and referred to the amount typed by the user
Found something at npc/scripts/lib/npcsystem/modules.lua
modules.lua:636
Lua:
function ShopModule:addBuyableItem(names, itemid, cost, charges, realname)
for i, name in pairs(names) do
local parameters = {
itemid = itemid,
cost = cost,
eventType = SHOPMODULE_BUY_ITEM,
module = self
}
if(realname ~= nil) then
parameters.realname = realname
end
if(isItemRune(itemid) == true or isItemFluidContainer(itemid) == true) then
parameters.charges = charges
end
keywords = {}
table.insert(keywords, name)
local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
node:addChildKeywordNode(self.yesNode)
node:addChildKeywordNode(self.noNode)
end
end
I tried deleting the isItemRune(itemid) condition, but no success, any suggestion?
Help is appreciated, thanks.