Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 CacheMap = {}
- local QuestValue = function(k)
- if CacheMap[k] then
- return CacheMap[k]
- end
- CacheMap[k] = getPlayerStorageValue(npcHandler.focus, k)
- return CacheMap[k]
- end
- local SetQuestValue = function(k, v)
- setPlayerStorageValue(npcHandler.focus, k, v)
- CacheMap[k] = v
- end
- function greetCallback(cid)
- Topic = nil
- return true
- end
- function creatureSayCallback(cid, type, msg)
- if npcHandler.focus ~= cid then
- return false
- end
- local n
- if Topic == 23 then
- if msgcontains(msg, 'yes') then
- local s = QuestValue(249)
- if s == 2 then
- npcHandler:say("I grant you the title of postman. You are now a full member of our guild. Here have your own officers hat and wear it with pride.")
- SetQuestValue(250,2)
- doPlayerAddItem(cid, 2665, 1)
- elseif s == 3 then
- npcHandler:say("From now on it shall be known that you are a grand postman. You are now a privileged member until the end of days. Most captains around the world have an agreement with our guild to transport our privileged members, like you, for less gold.")
- SetQuestValue(250,3)
- elseif s == 4 then
- npcHandler:say("From now on you are a grand postman for special operations. You are an honoured member of our guild and earned the privilege of your own post horn. Here, take it.")
- SetQuestValue(250,4)
- doPlayerAddItem(cid, 2078, 1)
- elseif s == 5 then
- npcHandler:say("I grant you the title of archpostman. You are a legend in our guild. As privilege of your newly aquired status you are allowed to make use of certain mailboxes in dangerous areas. Just look out for them and you'll see.")
- SetQuestValue(250,5)
- end
- end -- no else
- elseif msgcontains(msg, 'special') and msgcontains(msg, 'operations') then
- if QuestValue(250) < 4 then
- npcHandler:say("Sorry but I won't talk about this matter with someone of your rank.")
- else
- npcHandler:say("We have a secret branch, called 'the stamps of the gods'. They secretly supervise our members reliability and have an eye on certain groups of interest that want to gain influence over our guild.")
- end
- elseif msgcontains(msg, 'member') then
- if QuestValue(227) == -1 then
- npcHandler:say("We have high standards for our members. To rise in our guild is a difficult but rewarding task. Why do you ask? Are you interested in joining?")
- n = 1
- else
- npcHandler:say("You are already a member, " .. getCreatureName(cid) .. ".")
- end
- elseif msgcontains(msg, "mission") then
- if QuestValue(248) == 1 and QuestValue(250) < QuestValue(249) then
- npcHandler:say("Your eagerness is a virtue, young one, but first lets talk about advancement.")
- elseif QuestValue(246) == 1 and QuestValue(244) == -1 then
- npcHandler:say("So are you ready for another Mission?")
- n = 20
- elseif QuestValue(243) == -1 and QuestValue(242) == 1 then
- npcHandler:say("You are not done with your current mission. Search for the whereabout of Postofficer Waldo. Please report back when you are ready.")
- elseif QuestValue(234) > 0 and QuestValue(234) < 7 then
- npcHandler:say("You are not done with your current mission. We still need the measurements of several postofficers. Please report back when you are ready.")
- elseif QuestValue(233) > 0 and QuestValue(233) < 10 then
- npcHandler:say("You are not done with your current mission. Make sure Hugo chief is tailoring our new uniforms. Please report back when you are ready.")
- elseif QuestValue(229) > 0 and QuestValue(229) < 3 then
- npcHandler:say("You are not done with your current mission. Find David Brassacres and hand him that bill. Report when you are ready.")
- elseif QuestValue(230) > 1 and QuestValue(230) < 20 then
- npcHandler:say("Do you bring a bone for our officers' safety fund?")
- n = 12
- elseif QuestValue(230) > 1 and QuestValue(230) == 20 then
- npcHandler:say("Do you bring a bone for our officers' safety fund?")
- n = 22
- elseif QuestValue(227) == -1 then
- npcHandler:say("You are not a member of our guild yet! We have high standards for our members. To rise in our guild is a difficult but rewarding task. Are you interested in joining?")
- n = 1
- elseif QuestValue(248) == 1 then
- npcHandler:say("You have mastered all our current missions. There's nothing left to be done ... for now.")
- elseif QuestValue(245) == 1 then
- npcHandler:say("You are not done with your current mission. Deliver that letter to king Markwin. Please report back when you are ready.")
- elseif QuestValue(245) == 2 then
- npcHandler:say("You have delivered that letter? You are a true postofficer. All over the land bards shall praise your name. There are no missions for you left right now.")
- SetQuestValue(248,1)
- SetQuestValue(249,5)
- elseif QuestValue(244) == 1 then
- npcHandler:say("You are not done with your current mission. Deliver those letters to Santa. Please report back when you are ready.")
- elseif QuestValue(244) == 2 then
- npcHandler:say("You did it? I hope you did not catch a flu in the cold! However theres another mission for you. Are you interested?")
- n = 21
- elseif QuestValue(243) == 1 then
- npcHandler:say("So Waldo is dead? This is grave news indeed. Did you recover his posthorn?")
- n = 19
- elseif QuestValue(234) == 7 then
- npcHandler:say("Once more you have impressed me! Are you willing to do another job?")
- n = 17
- elseif QuestValue(233) == 10 then
- npcHandler:say("Excellent! Another job well done! Would you accept another mission?")
- SetQuestValue(249,3)
- n = 16
- elseif QuestValue(231) == 1 then
- npcHandler:say("You are not done with your current mission. Deliver that present to Fibula. Please report back when you are ready.")
- elseif QuestValue(231) == 2 then
- npcHandler:say("Splendid, I knew we could trust you. I would like to ask for your help in another matter. Are you interested?")
- n = 14
- elseif QuestValue(230) == 1 then
- npcHandler:say("Do you bring ONE bone for our officers' safety fund or ALL bones at once?")
- n = 24
- elseif QuestValue(230) > 20 then
- npcHandler:say("You have made it! We have enough bones for the fund! You remind me of myself when I was young! Interested in another mission?")
- n = 13
- elseif QuestValue(229) == 3 then
- npcHandler:say("You truly got him? Quite impressive. You are a very prommising candidate! I think I have another mission for you. Are you interested?")
- n = 11
- elseif QuestValue(228) == 1 then
- npcHandler:say("You are not done with your current mission. The mailbox is still not fixed. Report if you are ready.")
- elseif QuestValue(228) == 2 then
- npcHandler:say("Excellent, you got it fixed! This will teach this mailbox a lesson indeed! Are you interested in another assignment?")
- n = 9
- elseif QuestValue(227) < 5 then
- npcHandler:say("You are not done with your current mission. Make sure all the passages are secure. Report if you are ready.")
- elseif QuestValue(227) == 5 then
- npcHandler:say("So you have finally made it! I did not think that you would have it in you ... However: are you ready for another assignment?")
- n = 8
- end
- elseif msgcontains(msg, 'advancement') then
- if QuestValue(250) < QuestValue(249) then
- npcHandler:say("You are worthy indeed. Do you want to advance in our guild?")
- n = 23
- else
- npcHandler:say("Sorry, but you are not yet ready for advancement.")
- end
- elseif msgcontains(msg, 'dress') and msgcontains(msg, 'pattern') and QuestValue(233) == 8 then
- npcHandler:say("Fine, fine. I think that should do it. Tell Hugo that we order those uniforms. The completed dress pattern will soon arrive in Venore. Report to me when you have talked to him.")
- SetQuestValue(233,9)
- elseif ((msgcontains(msg, 'dress') and msgcontains(msg, 'pattern')) or msgcontains(msg, 'uniform')) and QuestValue(233) == 6 then
- npcHandler:say("The queen has sent me the samples we needed. The next part is tricky. We need the uniforms to emanate some odor that dogs hate.The dog with the best 'taste' in that field is Noodles, the dog of King Tibianus. Do you understand so far?")
- n = 15
- elseif msgcontains(msg, 'dress') and msgcontains(msg, 'pattern') and QuestValue(233) == 2 then
- npcHandler:say("Oh yes, where did we get that from ...? Let's see, first ask the great technomancer in Kazordoon for the technical details. Return here afterwards.")
- SetQuestValue(233,3)
- elseif msgcontains(msg, 'dress') and msgcontains(msg, 'pattern') and QuestValue(233) == 4 then
- npcHandler:say("The mail with Talphion's instructions just arrived. I remember we asked Queen Eloise of Carlin for the perfect colours. Go there, ask her about the UNIFORMS and report back here.")
- SetQuestValue(233,5)
- elseif Topic == 21 and msgcontains(msg, 'yes') then
- npcHandler:say("Excellent. Here is a letter for you to deliver. Well, to be honest, no one else volunteered. It's a letter from the mother of Markwin, the king of Mintwallin. Deliver that letter to him, but note that you will not be welcome there.")
- SetQuestValue(245,1)
- doPlayerAddItem(cid, 2333, 1)
- elseif Topic == 19 then
- if msgcontains(msg, 'yes') then
- if doPlayerRemoveItem(cid, 2332, 1) == TRUE then
- npcHandler:say("Thank you. We will honour this. Your next mission will be a very special one. Good thing you are a special person as well. Are you ready?")
- SetQuestValue(246,1)
- SetQuestValue(249,4)
- n = 20
- else
- npcHandler:say("Hm, no, you don't have it. Too bad, go and look for it.")
- end
- else
- npcHandler:say("Too bad, go and look for it.")
- end
- elseif Topic == 20 and msgcontains(msg, 'yes') then
- if QuestValue(250) < QuestValue(249) then
- npcHandler:say("Your eagerness is a virtue, young one, but first lets talk about advancement.")
- else
- npcHandler:say("So listen well. Behind the lower left door you will find a bag. The letters in the bag are for none other than Santa Claus! Deliver them to his house on the isle of Vega, USE the bag on his mailbox and report back here.")
- SetQuestValue(244,1)
- end
- elseif Topic == 17 and msgcontains(msg, 'yes') then
- npcHandler:say("Ok but your next assignment might be dangerous. Our Courier Waldo has been missing for a while. I must assume he is dead. Can you follow me so far?")
- n = 18
- elseif Topic == 18 then
- if msgcontains(msg, 'yes') then
- npcHandler:say("Find out about his whereabouts and retrieve him or at least his posthorn. He was looking for a new underground passage that is rumoured to be found underneath the troll-infested Mountain east of Thais.")
- SetQuestValue(242,1)
- else
- npcHandler:say("Too bad, perhaps you will try some other time then.")
- end
- elseif Topic == 16 and msgcontains(msg, 'yes') then
- if QuestValue(250) < QuestValue(249) then
- npcHandler:say("Your eagerness is a virtue, young one, but first let's talk about advancement.")
- else
- npcHandler:say("Good, so listen. Hugo Chief informed me that he needs the measurements of our postofficers. Go and bring me the measurements of Ben, Lokur, Dove, Liane, Chrystal and Olrik.")
- SetQuestValue(234,1)
- end
- elseif Topic == 15 then
- if msgcontains(msg, 'yes') then
- npcHandler:say("Good. Go there and find out what taste he dislikes most: moldy cheese, a piece of fur or a bananaskin. Tell him to SNIFF, then the object. Show him the object and ask 'Do you like that?'. DONT let the guards know what you are doing.")
- SetQuestValue(233,7)
- SetQuestValue(251,math.random(3))
- else
- npcHandler:say("Too bad, perhaps you can try doing it some other time then.")
- end
- elseif Topic == 14 and msgcontains(msg, 'yes') then
- npcHandler:say("Ok. We need a new set of uniforms, and only the best will do for us. Please travel to Venore and negotiate with Hugo Chief a contract for new uniforms.")
- SetQuestValue(233,1)
- elseif Topic == 13 and msgcontains(msg, 'yes') then
- if QuestValue(250) < QuestValue(249) then
- npcHandler:say("Your eagerness is a virtue, young one, but first lets talk about advancement.")
- else
- npcHandler:say("Since I am convinced I can trust you, this time you must deliver a valuable present to Dermot on Fibula. Do NOT open it!!! You will find the present behind the door here on the lower right side of this room.")
- SetQuestValue(231,1)
- end
- elseif Topic == 12 then
- if msgcontains(msg, 'yes') and doPlayerRemoveItem(cid, 2230, 1) == TRUE then
- SetQuestValue(230,QuestValue(230)+1)
- npcHandler:say("Excellent! You have collected " .. QuestValue(230)-1 .. " bones. Just report about your mission again if you find more.")
- else
- npcHandler:say("You have no suitable bone with you. Too bad, but you surely will find some more.")
- end
- elseif Topic == 22 then
- if msgcontains(msg, 'yes') and doPlayerRemoveItem(cid, 2230, 1) == TRUE then
- SetQuestValue(230,QuestValue(230)+1)
- npcHandler:say("You have collected all the " .. QuestValue(230)-1 .. " bones needed. Excellent! Now let's talk about further missions if you are interested.")
- SetQuestValue(249,2)
- else
- npcHandler:say("You have no suitable bone with you. Too bad, but you surely will find some more.")
- end
- elseif Topic == 24 and msgcontains(msg, 'one') and doPlayerRemoveItem(cid, 2230, 1) == TRUE then
- SetQuestValue(230,QuestValue(230)+1)
- npcHandler:say("Excellent! You have collected " .. QuestValue(230)-1 .. " bones. Just report about your mission again if you find more.")
- elseif Topic == 24 and msgcontains(msg, 'all') then -- don't combine!
- npcHandler:say("Are you sure you have collected all the 20 bones needed?")
- n = 25
- elseif Topic == 25 then
- if msgcontains(msg, 'yes') and doPlayerRemoveItem(cid, 2230, 20) == TRUE then
- SetQuestValue(230,21)
- npcHandler:say("You have collected all the 20 bones needed. Excellent! Now let's talk about further missions if you are interested.")
- SetQuestValue(249,2)
- else
- npcHandler:say("You have not enough bones with you. Too bad, but you surely will find some more.")
- end
- elseif Topic == 11 and msgcontains(msg, 'yes') then
- npcHandler:say("Ok, listen: we have some serious trouble with agressive dogs lately. We have accumulated some bones as a sort of pacifier but we need more. Collect 20 Bones like the one in my room to the left and report here.")
- SetQuestValue(230,1)
- elseif Topic == 9 and msgcontains(msg, 'yes') then
- npcHandler:say("For your noble deeds I grant you the title Assistant Postofficer. All Postofficers will charge you less money from now on. After every second mission ask me for an ADVANCEMENT. Your next task will be a bit more challenging. Do you feel ready for it?")
- SetQuestValue(250,1)
- SetQuestValue(249,1)
- n = 10
- elseif Topic == 10 and msgcontains(msg, 'yes') then
- npcHandler:say("I need you to deliver a bill to the stage magician David Brassacres. He's hiding from his creditors somewhere in Venore. It's likely you will have to trick him somehow to reveal his identity. Report back when you delivered this bill.")
- doPlayerAddItem(cid, 2329, 1)
- SetQuestValue(229,1)
- elseif isInArray({9,10,11,13,14,16,17,20,21}, Topic) == TRUE then
- npcHandler:say("Too bad, perhaps another time then.")
- elseif Topic == 8 and msgcontains(msg, 'yes') then
- npcHandler:say("I am glad to hear that. One of our mailboxes was reported to be jammed. It is located on the so called 'mountain' on the isle Folda. Get a crowbar and fix the mailbox. Report about your mission when you have done so.")
- SetQuestValue(228,1)
- elseif Topic == 1 and msgcontains(msg, 'yes') then
- npcHandler:say("Hm, I might consider your proposal, but first you will have to prove your worth by doing some tasks for us. Are you willing to do that?")
- n = 2
- elseif Topic == 2 and msgcontains(msg, 'yes') then
- npcHandler:say("Excellent! Your first task will be quite simple. But you should better write my instructions down anyways. You can read and write?")
- n = 3
- elseif Topic == 3 then
- if msgcontains(msg, 'yes') then
- npcHandler:say("So listen, you will check certain tours our members have to take to see if there is some trouble. First travel with Captain Bluebear's ship from Thais to Carlin, understood?")
- n = 4
- else
- npcHandler:say("I am sorry, but being illiterate disqualifies you from joining.")
- end
- elseif Topic == 4 and msgcontains(msg, 'yes') then
- npcHandler:say("Excellent! Once you have done that you will travel with Uzon to Edron. You will find him in the Femor Hills. Understood?")
- n = 5
- elseif Topic == 5 and msgcontains(msg, 'yes') then
- npcHandler:say("Fine, fine! Next, travel with Captain Seahorse to the city of Venore. Understood?")
- n = 6
- elseif Topic == 6 and msgcontains(msg, 'yes') then
- npcHandler:say("Good! Finally, find the technomancer Brodrosch and travel with him to the Isle of Cormaya. After this passage report back to me here. Understood?")
- n = 7
- elseif Topic == 7 and msgcontains(msg, 'yes') then
- npcHandler:say("Ok, remember: the Tibian mail service puts trust in you! Don't fail and report back soon. Just tell me about your MISSION.")
- SetQuestValue(227,1)
- elseif isInArray({1,2,4,5,6,7,8}, Topic) == TRUE then
- npcHandler:say("I thought so. The mail service is not for just anyone.")
- elseif msgcontains(msg, 'name') then
- npcHandler:say("My name is Kevin. Kevin Postner, that is.")
- elseif msgcontains(msg, 'job') then
- npcHandler:say("I am the head of the Tibian Postmaster's Guild.")
- elseif msgcontains(msg, 'guild') or msgcontains(msg, 'postmaster') then
- npcHandler:say("We are a powerful organisation that is vital part of Tibian society. It's a honour and a privilege to be a member.")
- elseif msgcontains(msg, 'academy') then
- npcHandler:say("Ah, yes! One day I will found a postofficers academy. Perhaps with the help of our most able members. But rhats a task for another day.")
- elseif msgcontains(msg, 'wally') then
- npcHandler:say("Wally is my right hand, so to say. He is the head to our guilds office branch.")
- elseif msgcontains(msg, 'branch') then
- npcHandler:say("Well, thers the depot branch, the office brance, the delivery branch and some officers for special operations.")
- end
- Topic = n
- CacheMap = {}
- return true
- end
- npcHandler:setMessage(MESSAGE_GREET, 'Greetings |PLAYERNAME|, what brings you here?')
- npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
- npcHandler:setMessage(MESSAGE_WALKAWAY, 'How rude!')
- npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, 'Please wait a moment.')
- npcHandler:setCallback(CALLBACK_GREET, greetCallback)
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment