-- This file contains a default npc script based on Jiddo's npc system
-- NPCs that are made only in XML can use this file as their Lua file
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, "ikem") or msgcontains(msg, "goshak") then
selfSay('Ikem pashak porak, bata, dora. Ba goshak maruk?')
talk_state = 0
elseif msgcontains(msg, "porak") then
selfSay ('Ikem pashak charcha, burka, burka bata, hakhak. Ba goshak maruk?')
talk_state = 0
end
return true
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
--Do you want to buy a
--dagger
shopModule:addBuyableItem({'charcha'}, 2385, 25, 'charcha')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())