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
if(msgcontains(msg, 'rebirth')) then
selfSay('Are you ready to rebirth and start a new life?', cid)
talkState[cid] = 1
elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
-------CONFIGS-------
local nuggets = 2
local level = 717217
------/CONFIGS-------
-----LOCALS-----
----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
local voc = getPlayerVocation(cid)
if voc >= 5 and voc <= 10 then
if doPlayerRemoveItem(cid, 2157, nuggets) then
local reb = getCreatureStorage(cid, 85989) + 1
doCreatureSetStorage(cid, 85989, reb)
doBroadcastMessage(getCreatureName(cid).." has rebirthed now he have "..reb.." rebirths", MESSAGE_STATUS_CONSOLE_RED)
if voc == 5 then -- MASTER SORCERER
setCreatureMaxHealth(cid, 1000000 * reb)
setCreatureMaxMana(cid, reb * 12000000)
elseif voc == 6 then -- ELDER DRUID
setCreatureMaxHealth(cid, 1600000 * reb)
setCreatureMaxMana(cid, reb * 14400000)
elseif voc == 10 then -- Wizard Of Thor
setCreatureMaxHealth(cid, 1 * reb)
setCreatureMaxMana(cid, reb * 8640000)
elseif voc == 7 then -- ROYAL PALADIN
setCreatureMaxHealth(cid, reb * 4000000)
setCreatureMaxMana(cid, 35)
elseif voc == 8 then -- ELITE KNIGHT
setCreatureMaxHealth(cid, reb * 8000000)
setCreatureMaxMana(cid, 35)
elseif voc == 9 then -- ROUGE KNIGHT
setCreatureMaxHealth(cid, reb * 6000000)
setCreatureMaxMana(cid, 35)
end
local id = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8,`experience` = 4200, `promotion` = 0, `blessings` = 0 WHERE `id` ='"..id.."';")
else
selfSay("You don't have enough gold nuggets you need "..nuggets.." nuggets", cid)
end
else
selfSay("Sorry you must buy promotion before you rebirth", cid)
end
else
selfSay("You don't have enough level you need to be 8M to rebirth", cid)
end
talkState[cid] = nil
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())