beeki

Reborn by Beeki e Ritter

Jun 6th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.96 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5.  
  6. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)                end
  7. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)             end
  8. function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg)        end
  9. function onThink()                          npcHandler:onThink()                            end
  10.  
  11. local config = {
  12.  
  13. --[Vocation] = ( Nova Vocation, New Outfit )
  14.     [21] = { 22, 137},
  15.     [254] = { 255, 351},
  16.     [36] = { 37, 148},
  17.     [51] = { 52, 144},
  18.     [65] = { 66, 152},
  19.     [378] = { 379, 451},
  20.     [80] = { 81, 150},
  21.     [93] = { 94, 150},
  22.     [107] = { 108, 509},
  23.     [118] = { 119, 118},
  24.     [131] = { 132, 34},
  25.     [144] = { 145, 15},
  26.     [155] = { 156, 15},
  27.     [167] = { 168, 173},
  28.     [179] = { 180, 178},
  29.     [191] = { 192, 184},
  30.     [205] = { 206, 190},
  31.     [217] = { 218, 221},
  32.     [229] = { 230, 281},
  33.     [242] = { 243, 60},
  34.     [254] = { 255, 351},
  35.     [265] = { 266, 334},
  36.     [275] = { 276, 80},
  37.     [286] = { 287, 338},
  38.     [296] = { 297, 198},
  39.    
  40. }
  41.  
  42. function creatureSayCallback(cid, type, msg)
  43.  
  44.     if(not npcHandler:isFocused(cid)) then
  45.         return false
  46.     end
  47.    
  48.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  49.    
  50.     if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30025) == 4 then
  51.         selfSay('You are reborn.', cid)
  52.         focus = 0
  53.         talk_start = 0
  54.    
  55.     elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then
  56.         selfSay('Hehe, I say If you READY. You do not have 250 level.', cid)
  57.    
  58.     elseif msgcontains(msg, 'reborn') then
  59.         selfSay('Are you sure? {yes}', cid)
  60.         talkState[talkUser] = 2
  61.    
  62.     elseif msgcontains(msg, 'yes') and talkState[talkUser] ==2 and getPlayerLevel(cid) == 250 then
  63.         local voc = config[getPlayerVocation(cid)]
  64.         doPlayerSetVocation(cid, voc[1])
  65.         local outfit = {lookType = voc[2]}
  66.         doCreatureChangeOutfit(cid, outfit)
  67.         doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
  68.         setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+20000)
  69.         setCreatureMaxMana(cid, getCreatureMaxMana(cid)+30000)
  70.         doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  71.         doCreatureAddMana(cid, getCreatureMaxMana(cid))
  72.         setPlayerStorageValue(cid,30025,4)
  73.         talkState[talkUser] = 0
  74.    
  75.     elseif msgcontains(msg, 'yes') and getPlayerLevel(cid) ~= 250 then
  76.         selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid)
  77.         talkState[talkUser] = 0
  78.    
  79.     elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
  80.         selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', cid)
  81.         talkState[talkUser] = 0
  82.    
  83.     elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
  84.         selfSay('Good bye.', cid)
  85.         focus = 0
  86.         talk_start = 0
  87.     end
  88.    
  89. return true
  90. end
  91.  
  92. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  93. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment