local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
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 otswe = {
removeitem1 = itemid1, --leather boots
removeitem2 = itemid2, --money
prizeitem = itemid3 --steelboots
}
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'help') or msgcontains(msg, 'boots') or msgcontains(msg, 'upgrade') then
npcHandler:say('Hello i can upgrade your boots just.', cid)
npcHandler:say('Do you want to upgrade? {yes}.', cid)
elseif(msgcontains(msg, 'yes')) then
if doPlayerRemoveItem(cid, otswe.removeitem1, 1) and doPlayerRemoveItem(cid, otswe.removeitem2, 1) then
npcHandler:say('Thank you!', cid)
doPlayerAddItem(cid,otswe.prizeitem,1)
focus = 0
else
npcHandler:say('Are you kidding me ? I dont see any money or leather boots with you! You didn\'t get them! Grrr... come back when you\'ve got them.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())