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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
-----------------------------------dark blade-------------------------------------
if msgcontains(msg, 'super dark blade') then
selfSay("Do you want buy a super dark blade for 100 blue orbs?", cid)
talkState[cid] = 1
end
if talkState[cid] == 1
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,7632) >= 100
doPlayerRemoveItem(cid,7632,100)
doPlayerAddItem(cid,2404)
selfSay("Ok, here you are.", cid)
talkState[cid] = 0
else
selfSay("Sorry, you don´t have enough blue orbs.", cid)
talkState[cid] = 0
end
end
end
-----------------------------------------dark shield------------------------------
if msgcontains(msg, 'super dark shield') then
selfSay("Do you want buy a super dark shield for 100 blue orbs?", cid)
talkState[cid] = 2
end
if talkState[cid] == 2
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,7632) >= 100
doPlayerRemoveItem(cid,7632,100)
doPlayerAddItem(cid,2512)
selfSay("Ok, here you are.", cid)
talkState[cid] = 0
else
selfSay("Sorry, you don´t have enough blue orbs.", cid)
talkState[cid] = 0
end
end
end
--------------------------------------dark staff----------------------------------
if msgcontains(msg, 'super dark staff') then
selfSay("Do you want buy a super dark staff for 100 blue orbs?", cid)
talkState[cid] = 3
end
if talkState[cid] == 3
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,7632) >= 100
doPlayerRemoveItem(cid,7632,100)
doPlayerAddItem(cid,3966)
selfSay("Ok, here you are.", cid)
talkState[cid] = 0
else
selfSay("Sorry, you don´t have enough blue orbs.", cid)
talkState[cid] = 0
end
end
end
--------------------------------------dark pedra----------------------------------
if msgcontains(msg, 'super dark pedra') then
selfSay("Do you want buy a super dark pedra for 100 blue orbs?", cid)
talkState[cid] = 4
end
if talkState[cid] == 4
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,7632) >= 100
doPlayerRemoveItem(cid,7632,100)
doPlayerAddItem(cid,1294)
selfSay("Ok, here you are.", cid)
talkState[cid] = 0
else
selfSay("Sorry, you don´t have enough blue orbs.", cid)
talkState[cid] = 0
end
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())