Guest User

Untitled

a guest
Oct 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.45 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. local talkState = {}
  6. local pirate = tasks["pirate ghost"]
  7. local questStatus = 72586
  8.  
  9. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
  10. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
  11. function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg)        end
  12. function onThink()                  npcHandler:onThink()                    end
  13.  
  14. function creatureSayCallback(cid, type, msg)
  15.     if(not npcHandler:isFocused(cid)) then
  16.         return false
  17.     end
  18.     if (msgcontains(msg, "task") and getPlayerStorageValue(cid, questStatus) == 4) then
  19.         selfSay('Fuck yeah!', cid)
  20.     end
  21.    
  22.     if (msgcontains(msg, "task") and getPlayerStorageValue(cid, pirate.storage) == -1) then
  23.         selfSay("The pirates on Nargor are becoming more and more of a threat to us each day. I wish someone could get rid of them once and for all, but unfortunately they just keep coming!", cid)
  24.         selfSay("Only a dead pirate is a good pirate. I think killing a large number of them would definitely help us to make Sabrehaven a safer place...", cid)
  25.         selfSay("It doesn't matter how long it takes, but... would you be willing to kill 3000 pirates for us?", cid)
  26.         talkState[cid] = 1
  27.         print("Estou aqui -> 01")
  28.    
  29.     elseif msgcontains(msg, "task") and getPlayerStorageValue(cid, pirate.storage) == pirate.amount and getPlayerStorageValue(cid, 14105) == -1 then
  30.         selfSay("Hey, great. You've done well! As a small reward I give you some coins from our treasure box. Also, let me tell you an interesting piece of information...", cid)
  31.         selfSay("One our of spies told us about a secret hideout somewhere on Nargor. Supposedly, one of the four pirate leaders can be found there sometimes. If you dare go there, you might be able to face him or her in one on one combat...", cid)
  32.         selfSay("Beware though - prepare yourself well and only flee if you must. This might be your only chance to get into there, so be careful and don't die!", cid)
  33.         if getPlayerStorageValue(cid, questStatus) == -1 then
  34.             setPlayerStorageValue(cid, questStatus, 1)
  35.         else
  36.             setPlayerStorageValue(cid, questStatus, getPlayerStorageValue(cid, questStatus) + 1)
  37.         end
  38.         setPlayerStorageValue(cid, 14105, 1) --storage necessário para entrar na sala dos pirates em Nargor.
  39.         talkState[cid] = 0
  40.         print("Estou aqui -> 02")
  41.        
  42.     elseif msgcontains(msg, "task") and getPlayerStorageValue(cid, 14105) == 2 then
  43.         setPlayerStorageValue(cid, pirate.storage, 3001) --Define [Completed] no QuestLog.
  44.         if getPlayerStorageValue(cid, questStatus) < 3 then
  45.             selfSay("So you went into the leaders' hideout? I hope you were successful and got what you were looking for! Thank you, my friend. Pirates still keep coming here, unfortunately", cid)
  46.             selfSay("Do you, by chance, would like to kill pirates again for us?", cid)
  47.             talkState[cid] = 2
  48.         else
  49.             selfSay('Ahh, thank you, my friend! What would we do without you? Here, take this reward for your efforts. If you want to continue to help us killing pirates, just ask me about that {task}.', cid)
  50.             setPlayerStorageValue(cid, questStatus, 4)
  51.             setPlayerStorageValue(cid, 14105, -1)
  52.             talkState[cid] = 0
  53.         end
  54.         print("Estou aqui -> 03")
  55.  
  56.     elseif (msgcontains(msg, "yes") and talkState[cid] == 1) then
  57.         selfSay("Perfect. I know it sounds a lot, but really, take your time. You won't do it for nothing, I promise.", cid)
  58.         if getPlayerStorageValue(cid, 14503) < 1 then --Habilitar o questLog.
  59.             setPlayerStorageValue(cid, 14503, 1)
  60.             setPlayerStorageValue(cid, 14501, 0)
  61.         end
  62.         setPlayerStorageValue(cid, 13500, pirate.storage)
  63.         setPlayerStorageValue(cid, pirate.storage, 0)
  64.         setPlayerStorageValue(cid, 14105, -1)
  65.         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your questlog has been updated.")
  66.         doPlayerSendTutorial(cid, 3)
  67.         print("Return do Estou aqui -> 01")
  68.         talkState[cid] = 0
  69.  
  70.     elseif (msgcontains(msg, "yes") and talkState[cid] == 2) then
  71.         selfSay("Perfect. I know it sounds a lot, but really, take your time. You won't do it for nothing, I promise.", cid)
  72.         setPlayerStorageValue(cid, 13500, pirate.storage)
  73.         setPlayerStorageValue(cid, pirate.storage, 0)
  74.         setPlayerStorageValue(cid, 14105, -1)
  75.         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your questlog has been updated.")
  76.         doPlayerSendTutorial(cid, 3)
  77.         talkState[cid] = 0
  78.         print("Return do Estou aqui -> 03")
  79.     end
  80. end
  81. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  82. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment