--[[Script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]
local config = {
minlevel = 250, --- level inical para resetar
price = 0, --- preço inicial para resetar
newlevel = 1, --- level após reset
priceByReset = 0, --- preço acrescentado por reset
percent = 99, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config
local cfg = {
--[vocation id] = {nova voc, looktype}
[1] = { 201, 137 }, -- GOKU
[10] = { 208, 148 }, -- GOHAN
[18] = { 215, 144 }, -- GOTEN
[24] = { 222, 152 }, -- VEGETA
[33] = { 229, 150 }, -- TRUNKS
[41] = { 236, 162 }, -- CHIBI TRUNKS
[47] = { 243, 173 }, -- PICCOLO
[53] = { 250, 221 }, -- DENDE
[58] = { 257, 60 }, -- BARDOCK
[65] = { 264, 84 }, -- BROOLY
[71] = { 271, 178 }, -- TSUFUL
[77] = { 278, 227 }, -- FREEZA
[85] = { 285, 190 }, -- COOLER
[92] = { 292, 15 }, -- ANDROID 17
[98] = { 299, 15 }, -- ANDROID 18
[104] = { 306, 34 }, -- BUU
[111] = { 313, 118 }, -- CELL
[117] = { 320, 341 }, -- SHIN
[122] = { 327, 102 }, -- PAN
[128] = { 334, 326 }, -- JANEMBA
[135] = { 341, 482 }, -- JENK
[142] = { 348, 500 }, -- TURLES
[500] = { 600, 521 }, -- KING VEGETTA
[506] = { 607, 198 }, -- SHENRON
[512] = { 614, 422 }, -- VEGETTO
[518] = { 621, 506 }, -- KAGOME
[524] = { 628, 547 } -- TAPION
}
function getResets(cid)
local resets = getPlayerStorageValue(cid, 378378)
if resets < 0 then
resets = 0
end
return resets
end
function addReset(cid)
local resets = getResets(cid)
setPlayerStorageValue(cid, 378378, resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
local hp = getCreatureMaxHealth(cid)
local resethp = hp*(config.percent/100)
local resetlevel = level*(config.resets+1)
setCreatureMaxHealth(cid, resethp)
local differencehp = (hp - resethp)
doCreatureAddHealth(cid, -differencehp)
local mana = getCreatureMaxMana(cid)
local resetmana = mana*(config.percent/100)
setCreatureMaxMana(cid, resetmana)
local differencemana = (mana - resetmana)
doCreatureAddMana(cid, -differencemana)
doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.newlevel))
return true
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
-- 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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if (not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)
if getPlayerLevel(cid) >= 602 then
return doPlayerSendCancel(cid, "Você só pode rebornar level 601-.")
end
if msgcontains(msg, 'reborn') then
if getResets(cid) == resets then
selfSay('Você tem certeza ?', cid)
talkState[talkUser] = 1
else
selfSay('I couldnt acess your bank of acess!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
elseif getPlayerLevel(cid) < newminlevel then
selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
else
local voc = cfg[getPlayerVocation(cid)]
if voc then
doPlayerSetVocation(cid, voc[1])
local outfit = {lookType = voc[2]}
doCreatureChangeOutfit(cid, outfit)
doPlayerRemoveMoney(cid,newPrice)
playerid = getPlayerGUID(cid)
addEvent(addReset, (0.1*1000), cid)
local msg ="---[Reborn: Yes]-- You have Reborned! Você vai ser desconectado em 1 segundo."
if doPlayerPopupFYI(cid, msg) then
end
else
selfSay('Reverta as transformções !', cid)
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())