Code:
[28/04/2014 10:07:43] [Error - Npc interface]
[28/04/2014 10:07:43] data/npc/scripts/default.lua
[28/04/2014 10:07:43] Description:
[28/04/2014 10:07:43] data/npc/lib/npcsystem/modules.lua:1093: attempt to index local 'v' (a boolean value)
[28/04/2014 10:07:43] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Alesar" script="default.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="80" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
<parameter key="message_greet" value="What do you want from me, |PLAYERNAME|?" />
<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="dark armor,2489,1500;dark helmet,2490,1000;ancient shield,2532,5000"/>
<parameter key="shop_sellable" value="dragon hammer,2434,2000;giant sword,2393,17000;knight axe,2430,2000;poison dagger,2411,50;scimitar,2419,150;serpent sword,2409,900;skull staff,2436,6000;dark armor,2489,400;knight armor,2476,5000;dark helmet,2490,250;mystic turban,2663,150;strange helmet,2479,500;warrior helmet,2475,5000;knight legs,2477,5000;ancient shield,2532,900;black shield,2529,800;tower shield,2528,8000;vampire shield,2534,15000"/>
</parameters>
</npc>
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:addModule(FocusModule:new())
Code:
-- Adds a new sellable item.
-- names = A table containing one or more strings of alternative names to this item. Used only by old buy/sell system.
-- itemid = The itemid of the sellable item
-- cost = The price of one single item
-- realName - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (getItemNameById will be used)
function ShopModule:addSellableItem(names, itemid, cost, realName)
local v = getItemInfo(itemid)
if(SHOPMODULE_MODE ~= SHOPMODULE_MODE_TALK) then
local item = {
id = itemid,
buy = -1,
sell = cost,
subType = ((v.charges > 0 and v.stackable) and v.charges or 0),
name = realName or v.name
}
for i, shopItem in ipairs(self.npcHandler.shopItems) do
if(shopItem.id == item.id and shopItem.subType == item.subType) then
if(item.buy ~= shopItem.buy) then
item.buy = shopItem.buy
end
self.npcHandler.shopItems[i] = item
item = nil
break
end
end
if(item ~= nil) then
table.insert(self.npcHandler.shopItems, item)
end
end