-------------------------------------------HAROUN MADE BY FENOL, ALL RIGHT RESERVED------------------------------------------
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)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
-- use the real conversation? (true/false)
real = true
if real == true then
tradeMsg = 'I am willing to trade items with you.'
flaskMsg = 'Very noble, I can make warrior sweat from 4 warrior helmets. Would you like to trade?'
fightMsg = 'Great choice. I can make fighting spirit from 2 royal helmets. Do you want to trade?'
magicMsg = 'Fine, I will make magic sulphur for 3 fire swords, ok?'
wingsMsg = 'Ahh... Might chicken wings... I can give you one for each boots of haste, you accept that?'
giantMsg = 'I will give you spool of yarn for 10 giant spider silks, you want to trade?'
hasNoMsg = 'You do not have what I need.'
noMsg = 'As you wish, human.'
else
tradeMsg = 'I am willing to trade items with you.'
flaskMsg = 'Do you want to trade 4 warrior helmets for warrior sweat?'
fightMsg = 'Do you want to trade 2 royal helmets for fighting spirit?'
magicMsg = 'Do you want to trade 3 fire swords for magic sulphur?'
wingsMsg = 'Do you want to trade boots of haste for enchanted chicken wing?'
giantMsg = 'Do you want to trade 10 giant spider slik for spool of yarn?'
hasNoMsg = 'Come back when you have all ingredients.'
noMsg = 'Ok.'
end
if msgcontains(msg, 'help') or msgcontains(msg, 'item') or msgcontains(msg, 'forge') then
selfSay(tradeMsg)
elseif msgcontains(msg, 'warrior sweat') or msgcontains(msg, 'sweat') or msgcontains(msg, 'warrior helmet') or msgcontains(msg, 'warriors') or msgcontains(msg, 'uth\'kean') then
selfSay(flaskMsg)
talk_state = 1
elseif msgcontains(msg, 'fighting spirit') or msgcontains(msg, 'spirit') or msgcontains(msg, 'royal helmet') or msgcontains(msg, 'royal') or msgcontains(msg, 'za\'ralator') then
selfSay(fightMsg)
talk_state = 2
elseif msgcontains(msg, 'magic sulphur') or msgcontains(msg, 'sulphur') or msgcontains(msg, 'fire sword') or msgcontains(msg, 'fire swords') or msgcontains(msg, 'uth\'lokr') then
selfSay(magicMsg)
talk_state = 3
elseif msgcontains(msg, 'enchanted chicken wing') or msgcontains(msg, 'wing') or msgcontains(msg, 'wings') or msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') or msgcontains(msg, 'uth\'prta') then
selfSay(wingsMsg)
talk_state = 4
elseif msgcontains(msg, 'giant spider silk') or msgcontains(msg, 'spool of yarn') or msgcontains(msg, 'silk yarn') or msgcontains(msg, 'silk yarns') or msgcontains(msg, 'silks') then
selfSay(giantMsg)
talk_state = 5
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerItemCount(cid, 2475) >= 4 then
if doPlayerTakeItem(cid, 2475, 4) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid, 5885, 1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerItemCount(cid, 2498) >= 2 then
if doPlayerTakeItem(cid, 2498, 2) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid, 5884, 1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 3 then
if getPlayerItemCount(cid, 2392) >= 3 then
if doPlayerTakeItem(cid, 2392, 3) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid, 5904, 1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 4 then
if getPlayerItemCount(cid, 2195) >= 1 then
if doPlayerTakeItem(cid, 2195, 1) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid, 5891, 1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 5 then
if getPlayerItemCount(cid, 5879) >= 10 then
if doPlayerTakeItem(cid, 5879, 10) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid, 5886, 1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay(noMsg)
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())