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)
shopModule:addBuyableItem({'copper ore'}, 22702, 9, 'copper ore')
shopModule:addBuyableItem({'gold ore'}, 22703, 95000, 'gold ore')
shopModule:addBuyableItem({'iron ore'}, 22704, 3, 'iron ore')
shopModule:addBuyableItem({'mithril ore'}, 22705, 500000, 'mithril ore')
shopModule:addBuyableItem({'silver ore'}, 22706, 900, 'silver ore')
shopModule:addBuyableItem({'copper ingot'}, 22712, 10, 'copper ingot')
shopModule:addBuyableItem({'gold ingot'}, 22713, 100000, 'gold ingot')
shopModule:addBuyableItem({'iron ingot'}, 22714, 5, 'iron ingot')
shopModule:addBuyableItem({'mithril ingot'}, 22715, 500000, 'mithril ingot')
shopModule:addBuyableItem({'silver ingot'}, 22716, 1000, 'silver ingot')
shopModule:addBuyableItem({'coal'}, 13757, 5, 'coal')
shopModule:addBuyableItem({'raw amethyst'}, 22707, 200, 'raw amethyst')
shopModule:addBuyableItem({'raw diamond'}, 22708, 20000, 'raw diamond')
shopModule:addBuyableItem({'raw emerald'}, 22709, 2000, 'raw emerald')
shopModule:addBuyableItem({'raw ruby'}, 22710, 6000, 'raw ruby')
shopModule:addBuyableItem({'raw sapphire'}, 22711, 10000, 'raw sapphire')
shopModule:addBuyableItem({'amethyst'}, 2150, 1000, 'amethyst')
shopModule:addBuyableItem({'diamond'}, 2145, 100000, 'diamond')
shopModule:addBuyableItem({'emerald'}, 2149, 10000, 'emerald')
shopModule:addBuyableItem({'ruby'}, 2147, 30000, 'ruby')
shopModule:addBuyableItem({'sapphire'}, 2146, 50000, 'sapphire')
shopModule:addBuyableItem({'wood'}, 22701, 10, 'wood')
shopModule:addBuyableItem({'leather'}, 5878, 25, 'leather')
shopModule:addBuyableItem({'arrow head'}, 22719, 1, 'arrow head')
shopModule:addBuyableItemContainer({'bag of feathers', 'bags of feathers', 'feather', 'feathers'}, 1987, 5890, 80, 1, 'bag of feathers')
shopModule:addSellableItem({'copper ore'}, 22702, 6, 'copper ore')
shopModule:addSellableItem({'gold ore'}, 22703, 85000, 'gold ore')
shopModule:addSellableItem({'iron ore'}, 22704, 1, 'iron ore')
shopModule:addSellableItem({'mithril ore'}, 22705, 500000, 'mithril ore')
shopModule:addSellableItem({'silver ore'}, 22706, 800, 'silver ore')
shopModule:addSellableItem({'copper ingot'}, 22712, 10, 'copper ingot')
shopModule:addSellableItem({'gold ingot'}, 22713, 100000, 'gold ingot')
shopModule:addSellableItem({'iron ingot'}, 22714, 3, 'iron ingot')
shopModule:addSellableItem({'mithril ingot'}, 22715, 500000, 'mithril ingot')
shopModule:addSellableItem({'silver ingot'}, 22716, 1000, 'silver ingot')
shopModule:addSellableItem({'coal'}, 13757, 4, 'coal')
shopModule:addSellableItem({'raw amethyst'}, 22707, 100, 'raw amethyst')
shopModule:addSellableItem({'raw diamond'}, 22708, 10000, 'raw diamond')
shopModule:addSellableItem({'raw emerald'}, 22709, 1000, 'raw emerald')
shopModule:addSellableItem({'raw ruby'}, 22710, 3000, 'raw ruby')
shopModule:addSellableItem({'raw sapphire'}, 22711, 5000, 'raw sapphire')
shopModule:addSellableItem({'amethyst'}, 2150, 800, 'amethyst')
shopModule:addSellableItem({'diamond'}, 2145, 95000, 'diamond')
shopModule:addSellableItem({'emerald'}, 2149, 9500, 'emerald')
shopModule:addSellableItem({'ruby'}, 2147, 28500, 'ruby')
shopModule:addSellableItem({'sapphire'}, 2146, 47500, 'sapphire')
shopModule:addSellableItem({'wood'}, 22701, 5, 'wood')
shopModule:addSellableItem({'leather'}, 5878, 15, 'leather')
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'list') or msgcontains(msg, 'wares') or msgcontains(msg, 'help')) then
selfSay('I am a raw materials merchant. I trade in such things as raw ore, ingots, raw gems, refined gems, and some other materials.', cid)
elseif(msgcontains(msg, 'ore')) then
selfSay('I will buy or sell iron, copper, silver, gold, and mithril ore. I do not see mithril all that much, though..', cid)
elseif(msgcontains(msg, 'ingot') or msgcontains(msg, 'ingots')) then
selfSay('I buy and sell iron, copper, silver, gold, and mithril ingots.', cid)
elseif(msgcontains(msg, 'raw gem') or msgcontains(msg, 'raw gems')) then
selfSay('Raw gems, huh? I buy and sell raw amethysts, emeralds, rubies, sapphires, and diamonds.', cid)
elseif(msgcontains(msg, 'refined gem') or msgcontains(msg, 'refined gems') or msgcontains(msg, 'cut gem') or msgcontains(msg, 'cut gems')) then
selfSay('Interested in refined gemstones? I will buy or sell refined amethysts, emeralds, rubies, sapphires, and diamonds.', cid)
elseif(msgcontains(msg, 'other') or msgcontains(msg, 'material') or msgcontains(msg, 'materials')) then
selfSay('Hmm.. other things I trade... I can buy or sell wood, leather, and coal. I also sell bags of feathers and arrow heads, but I do not buy them.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())