local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
....
....
....
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Huntsman rank:1
shopModule:addSellableItem({'antlers'}, 11208, 50, 'antlers')
shopModule:addSellableItem({'bloody pincer'}, 10549, 100, 'bloody pincer')
shopModule:addSellableItem({'crab pincers'}, 11183, 35, 'crab pincers')
shopModule:addSellableItem({'cyclops toe'}, 10573, 55, 'cyclops toe')
shopModule:addSellableItem({'frosty ear of a troll'}, 10564, 30, 'frosty ear of a troll')
shopModule:addSellableItem({'hydra head'}, 11193, 600, 'hydra head')
shopModule:addSellableItem({'lancer beetle shell'}, 11366, 80, 'lancer beetle shell')
shopModule:addSellableItem({'mutated bat ear'}, 10578, 420, 'mutated bat ear')
shopModule:addSellableItem({'sabretooth'}, 11222, 400, 'sabretooth')
shopModule:addSellableItem({'sandcrawler shell'}, 11367, 20, 'sandcrawler shell')
shopModule:addSellableItem({'scarab pincers'}, 10547, 280, 'scarab pincers')
shopModule:addSellableItem({'terramite legs'}, 11365, 60, 'terramite legs')
shopModule:addSellableItem({'terramite shell'}, 11363, 170, 'terramite shell')
shopModule:addSellableItem({'terrorbird beak'}, 11184, 95, 'terrorbird beak')
function onTradeRequest(cid)
return getPlayerStorageValue(cid, 10000) >= 1
end
function storageSell(cid, itemid, ...)
local sellItems2 = {11208, 11205, 10549}
local sotrage = getPlayerStorageValue(cid, 10000)
if isInArray(sellItems2, itemid) and (sotrage < 2) then
-- check storages part
selfSay("You can not sell this item.", cid)
return false
end
return true
end
npcHandler:setCallback(CALLBACK_ONSELL, storageSell)
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())