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
local begin_storage = 2000
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if getPlayerStorageValue(cid, begin_storage) == -1 and getCreatureCondition(cid, drunk) then
if msgcontains(msg, 'sober') then
npcHandler:say("I wish there was like a potion which makes you sober in an instant. Dwarven rings wear off so fast. <hicks>", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'potion') and talkState[talkUser] == 1 then
npcHandler:say("It's so hard to know the exact time when to stop drinking. <hicks> C-could you help me to brew such a potion?", cid)
talkState[talkUser] = 2
end
end
if msgcontains(msg, '30 beholder eyes') getPlayerStorageValue(cid, begin_storage) == 0 then
npcHandler:say("Have you really managed to bring me 30 beholder eyes? <hicks>", cid)
talkState[talkUser] = 4
elseif msgcontains(msg, '10 red dragon scales') getPlayerStorageValue(cid, begin_storage) == 1 then
npcHandler:say("D-did you get all of the 10 red dragon scales? <hicks>", cid)
talkState[talkUser] = 5
elseif msgcontains(msg, '30 lizard scales') getPlayerStorageValue(cid, begin_storage) == 2 then
npcHandler:say("Ah, are those - <hicks> - the 30 lizard scales?", cid)
talkState[talkUser] = 6
elseif msgcontains(msg, '20 fish fin') getPlayerStorageValue(cid, begin_storage) == 3 then
npcHandler:say("Eww, is that disgusting smell coming from the 20 fish fins? <burps>", cid)
talkState[talkUser] = 7
elseif msgcontains(msg, '20 vampire dust') getPlayerStorageValue(cid, begin_storage) == 4 then
npcHandler:say("Have you collected 20 ounces of vampire d-dust? <hicks>", cid)
talkState[talkUser] = 8
elseif msgcontains(msg, '10 demon dust') getPlayerStorageValue(cid, begin_storage) == 5 then
npcHandler:say("Have you slain enough d-demons to gather 10 ounces of demon dust? <hicks>", cid)
talkState[talkUser] = 9
elseif msgcontains(msg, 'Warrior\'s sweat') getPlayerStorageValue(cid, begin_storage) == 6 then
npcHandler:say("This s-smells even worse than the fish fins. Is that warrior's sweat?", cid)
talkState[talkUser] = 10
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 2 then
doNPCTalkALot({"You're a true buddy. I promise I will t-try to avoid killing you even if someone asks me to. <hicks> ...", "Listen, I have this old formula from my grandma. <hicks> It says... 30 beholder eyes... 10 red dragon scales. ...", "Then 30 lizard scales... 20 fish fins - ew, this sounds disgusting, I wonder if this is really a potion or rather a cleaning agent. ...", "Add 20 ounces of vampire dust, 10 ounces of demon dust and mix well with one flask of warrior's sweat. <hicks> ...", "Okayyy, this is a lot... we'll take this step by step. <hicks> Will you help me gathering 30 beholder eyes?"}, 10000, cid)
talkState[talkUser] = 3
elseif talkState[talkUser] == 3 then
npcHandler:say("G-good. Go get them, I'll have a beer in the meantime.", cid)
setPlayerStorageValue(cid, begin_storage, 0)
elseif talkState[talkUser] == 4 and getPlayerItemCount(cid, 5898) >= 30 then
npcHandler:say("Aw-awsome! <hicks> Squishy! Now, please bring me 10 red dragon scales.", cid)
doPlayerRemoveItem(cid, 5898, 30)
setPlayerStorageValue(cid, begin_storage, 1)
elseif talkState[talkUser] == 5 and getPlayerItemCount(cid, 5882) >= 10 then
npcHandler:say("G-good work, ... wha-what's your name again? <hicks> Anyway... come back with 30 lizard scales.", cid)
doPlayerRemoveItem(cid, 5882, 10)
setPlayerStorageValue(cid, begin_storage, 2)
elseif talkState[talkUser] == 6 and getPlayerItemCount(cid, 5881) >= 30 then
npcHandler:say("This potion will become p-pretty scaly. I'm not sure yet if I want to d-drink that. I think the 20 fish fins which come next won't really improve it. <hicks>", cid)
doPlayerRemoveItem(cid, 5881, 30)
setPlayerStorageValue(cid, begin_storage, 3)
elseif talkState[talkUser] == 7 and getPlayerItemCount(cid, 5895) >= 20 then
npcHandler:say("Alrrrrrrright! Thanks for the f-fish. Get me the 20 ounces of vampire dust now. I'll have another b-beer.", cid)
doPlayerRemoveItem(cid, 5895, 20)
setPlayerStorageValue(cid, begin_storage, 4)
elseif talkState[talkUser] == 8 and getPlayerItemCount(cid, 5905) >= 20 then
npcHandler:say("Tha-thank you. Trolls are good for something a-after all. Bring me the 10 ounces of demon dust now. <hicks>", cid)
doPlayerRemoveItem(cid, 5905, 20)
setPlayerStorageValue(cid, begin_storage, 5)
elseif talkState[talkUser] == 9 and getPlayerItemCount(cid, 5906) >= 10 then
npcHandler:say("G-great. You're a reeeal k-killer like me, eh? I think I'll g-give you something fun when the potion is complete. But first, b-bring me warrior's sweat.", cid)
doPlayerRemoveItem(cid, 5906, 10)
setPlayerStorageValue(cid, begin_storage, 6)
elseif talkState[talkUser] == 10 and getPlayerItemCount(cid, 5885) >= 1 then
npcHandler:say("Yahaha! Here we g-go. I'll just take a small sip - <gulp>. Okay, this is disgusting, but it seems to work. I'll teach you something fun, remind me to tell you a secret sometime. ", cid)
doPlayerRemoveItem(cid, 5885, 1)
setPlayerStorageValue(cid, begin_storage, 7)
doPlayerAddOutfit(cid, 156, 2)
doPlayerAddOutfit(cid, 152, 2)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())