Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile(getDataDir() .. 'global/greeting.lua')
- dofile(getDataDir() .. 'global/items-config.lua')
- 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
- function creatureSayCallback(cid, type, msg)
- if(npcHandler.focus ~= cid) then
- return false
- end
- msg = msg:lower()
- creaturepos1 = {x=32921, y=32074, z=9}
- creaturepos2 = {x=32923, y=32074, z=9}
- creaturepos3 = {x=32921, y=32076, z=9}
- creaturepos4 = {x=32923, y=32076, z=9}
- keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is not of your concern."})
- keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That's only my business, not yours."})
- keywordHandler:addKeyword({'david'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I never heard that name and now get lost."})
- keywordHandler:addKeyword({'brassacres'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I never heard that name and now get lost."})
- if getPlayerStorageValue(cid, 5209) == 1 and msgcontains(msg, 'hat') then
- selfSay('What? My hat?? Theres... nothing special about it!')
- talk_state = 1
- -- Without Value --
- elseif getPlayerStorageValue(cid, 5209) == -1 and msgcontains(msg, 'bill') then
- selfSay('Thats not my concern, you are probably looking for someone else and now get lost!')
- talk_state = 0
- npcHandler:releaseFocus()
- elseif getPlayerStorageValue(cid, 5209) == -1 and msgcontains(msg, 'hat') then
- selfSay('Get lost!')
- npcHandler:releaseFocus()
- talk_state = 0
- -- Without Value --
- -- After Quest Questions --
- elseif msgcontains(msg, 'david') and getPlayerStorage(cid, 5211) == 1 then
- selfSay('Yes, yes... Its me .. you exposed me! Stop nagging me with that.')
- talk_state = 0
- elseif msgcontains(msg, 'brassacres') and getPlayerStorage(cid, 5211) == 1 then
- selfSay('Yes, yes... Its me .. you exposed me! Stop nagging me with that.')
- talk_state = 0
- -- After Quest Questions --
- elseif talk_state == 1 and msgcontains(msg, 'hat') then
- selfSay('Stop bugging me about that hat, do you listen?')
- talk_state = 2
- elseif msgcontains(msg, 'hat') and talk_state == 2 then
- selfSay('Hey! Don\'t touch that hat! Leave it alone!!! Don\'t do this!!!!')
- talk_state = 3
- elseif msgcontains(msg, 'hat') and talk_state == 3 then
- selfSay('Noooooo! Argh, ok, ok, I guess I can\'t deny it anymore, I am David Brassacres, the magnificent, so what do you want?')
- doSummonCreature("Rat", creaturepos1)
- doSummonCreature("Rat", creaturepos2)
- doSummonCreature("Rat", creaturepos3)
- doSummonCreature("Rat", creaturepos4)
- setPlayerStorageValue(cid, 5210, 1)
- talk_state = 4
- elseif getPlayerStorageValue(cid, 5210) == 1 and msgcontains(msg, 'bill') and talk_state == 4 then
- selfSay('A bill? Oh boy so you are delivering another bill to poor me?')
- talk_state = 5
- elseif msgcontains(msg, 'yes') then
- if talk_state == 5 then
- selfSay('Ok, ok, I\'ll take it. I guess I have no other choice anyways. And now leave me alone in my misery please.')
- setPlayerStorageValue(cid, 5211, 1)
- doPlayerRemoveItem(cid, 2329, 1)
- talk_state = 6
- else
- selfSay('Ha Ha! You have none!! Naanaanaanaaanaaaa!')
- npcHandler:releaseFocus()
- end
- elseif talk_state ~= 0 then
- selfSay('')
- selfGotoIdle()
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement