function get_module_name()
return "NPC_ReincarnationGoddess"
end
-- Generic functions;
-- ################################################################################## --
function removeTokens(amount)
delete_item(get_item_handle(1500), amount)
cprint("You've given x" ..amount.. " [Reincarnation Tokens] to the Reincarnation Goddess.")
end
function validateTokens(amount)
local tokCnt = find_item(1500)
if tokCnt >= amount then
return true
else
return false
end
end
function amountTokens()
return find_item(1500)
end
function rbChar(resetMC)
-- Increment total reinc count;
set_flag("reinc", get_flag("reinc")+1)
if resetMC == 0 then
-- Give random wings;
notice("Reincarnation Goddess has performed an incomplete reincarnation on "..gv("name").."! He now has a total of "..tostring(get_flag("reinc")).." reincarnations ("..gv("lv").."/150)!")
else
dlg_title("Reincarnation Goddess")
dlg_text("Complete reincarnation? Kudos. The more time use the reincarnation the higher are the rewards!!!")
dlg_menu( "@90010002", " " )
do
end
notice("Reincarnation Goddess has performed a complete reincarnation on "..gv("name").."! He now has a total of "..tostring(get_flag("reinc")).." reincarnations ("..gv("lv").."/150)!")
end
if resetMC == 1 then
-- Reset skills back to stock;
reset_skill(0)
-- Set job back to stock;
reset_job(0)
---Clear items
clear_wear()
end
-- Give CM and tokens;
local cmPrize = (gv("lv") - 150) * 15
local tokPrize = (gv("lv") - 150) * 50
if tokPrize == 0 then
tokPrize = 150
end
if resetMC == 0 then
tokPrize = tokPrize * 2
cmPrize = cmPrize * 3
end
if cmPrize > 0 and tokPrize > 150 then
cprint("You earned x"..tostring(cmPrize).." [Challenge Marks] and x"..tostring(tokPrize).." [Reincarnation Tokens] with this reincarnation.")
elseif cmPrize == 0 and tokPrize > 150 then
cprint("You earned x150 (+"..tostring(tokPrize-150)..") [Reincarnation Tokens] with this reincarnation.")
elseif cmPrize > 0 and tokPrize == 150 then
cprint("You earned x"..tostring(cmPrize).." [Challenge Marks] and x"..tostring(tokPrize).." [Reincarnation Tokens] with this reincarnation.")
elseif cmPrize == 0 and tokPrize == 150 then
cprint("You earned "..tostring(tokPrize).." [Reincarnation Tokens] with this reincarnation.")
end
if cmPrize > 0 then
insert_item(2021300, cmPrize, 0, 1, 2)
end
insert_item(1500, tokPrize, 0, 1, 2)
-- Reset level, tp and jp;
sv("lv", 19)
if resetMC == 1 then
sv("jp", 20000)
sv("tp", 0)
clear_wear()
end
end
-- ################################################################################## --
function ReincGod_Initiate()
-- Fetch char level;
local lv = gv("lv")
-- See if user has reincarnation entry;
if get_flag("reinc") == "" then
set_flag("reinc","0")
end
dlg_title("Reincarnation Goddess")
dlg_text("If only you've lived as long as I have..")
dlg_menu("<#e74c3c>[ Reincarnate ]", "ReincGod_doReinc(0)")
dlg_menu("<#ffd700>[ Token store ]", "ReincGod_tokenStore()")
dlg_menu("<#ffd700>[ Trade tokens for CM ]", "ReincGod_tradeTokensForCM()")
dlg_menu("<#ffd700>[ My reincarnations ]", "ReincGod_ask(2)")
dlg_menu("<#ffd700>[ Questions ]", "ReincGod_ask(1)")
dlg_menu("[ Close ]", "")
dlg_show()
end
function ReincGod_tokenStore()
dlg_title("Reincarnation Goddess")
dlg_text("I can offer you plenty of items for those tokens.")
dlg_menu("<#ffd700>[ Function ]", "ReincGod_listStore(1)")
dlg_menu("<#ffd700>[ Decorative outfits ]", "ReincGod_listStore(3)")
dlg_menu("<#ffd700>[ Consumables ]", "ReincGod_listStore(2)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_Initiate()")
dlg_menu("<#ffd700>[ Close ]", "")
dlg_show()
end
function ReincGod_listStore(qCode)
dlg_title("Reincarnation Goddess")
if qCode == 1 then
dlg_text("Yes, I do provide those Items, but they require a certain amount of reincarnations.")
dlg_menu("<#ffd700>[ Boss Loot Pets ]", "ReincGod_listStore(100)")
dlg_menu("<#ffd700>[ Decorative Capes ]", "ReincGod_listStore(200)")
-----dlg_menu("<#ffd700>[ New Pieces ]", "ReincGod_listStore(300)")-----
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore()")
elseif qCode == 100 then
if get_flag("reinc") >= 0 then
dlg_text("Yes, I can trade you these.")
dlg_menu("<#ffd700>[ Oforia Pet (200 Tokens) ]", "ReincGod_buyStore(200,690543,1)")
dlg_menu("<#ffd700>[ Abhuva Pet (200 Tokens) ]", "ReincGod_buyStore(200,690544,1)")
dlg_menu("<#ffd700>[ Primal Scream Pet (200 Tokens) ]", "ReincGod_buyStore(200,690545,1)")
dlg_menu("<#ffd700>[ Taranida Pet (200 Tokens) ]", "ReincGod_buyStore(200,690546,1)")
dlg_menu("<#ffd700>[ Crustalino Pet (200 Tokens) ]", "ReincGod_buyStore(200,690547,1)")
dlg_menu("<#ffd700>[ Likirus Pet (200 Tokens) ]", "ReincGod_buyStore(200,690548,1)")
dlg_menu("<#ffd700>[ Soul Seeker Pet (200 Tokens) ]", "ReincGod_buyStore(200,690549,1)")
dlg_menu("<#ffd700>[ Takin Pet (200 Tokens) ]", "ReincGod_buyStore(200,690550,1)")
dlg_menu("<#ffd700>[ Betrayal Pet (200 Tokens) ]", "ReincGod_buyStore(200,690551,1)")
dlg_menu("<#ffd700>[ Ashmaw Pet (200 Tokens) ]", "ReincGod_buyStore(200,690552,1)")
dlg_menu("<#ffd700>[ Sand Lord Kynish Pet (200 Tokens) ]", "ReincGod_buyStore(200,690553,1)")
dlg_menu("<#ffd700>[ Bear Mother Pet (200 Tokens) ]", "ReincGod_buyStore(200,690554,1)")
dlg_menu("<#ffd700>[ Silex Pet (200 Tokens) ]", "ReincGod_buyStore(200,690555,1)")
dlg_menu("<#ffd700>[ Aurumis Pet (200 Tokens) ]", "ReincGod_buyStore(200,690556,1)")
dlg_menu("<#ffd700>[ Draka Pet (200 Tokens) ]", "ReincGod_buyStore(200,690557,1)")
dlg_menu("<#ffd700>[ Obsidikar Pet (200 Tokens) ]", "ReincGod_buyStore(200,690558,1)")
dlg_menu("<#ffd700>[ Butkadah Pet (200 Tokens) ]", "ReincGod_buyStore(200,690559,1)")
dlg_menu("<#ffd700>[ Neo Red Paper Pet (200 Tokens) ]", "ReincGod_buyStore(200,690560,1)")
dlg_menu("<#ffd700>[ Neo Blue Paper Pet (200 Tokens) ]", "ReincGod_buyStore(200,690561,1)")
else
dlg_text("You would have to reincarnate once to be able to trade for these items.")
end
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_listStore(1)")
elseif qCode == 200 then
if get_flag("reinc") >= 0 then
dlg_text("Yes, I can trade you these.")
dlg_menu("<#ffd700>[ Jolly Roger Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2011280,1)")
dlg_menu("<#ffd700>[ Yin-Yang Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2012942,1)")
dlg_menu("<#ffd700>[ Cloak of Kindness (300 Tokens) ]", "ReincGod_buyStore(300,2012225,1)")
dlg_menu("<#ffd700>[ Korean Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2011004,1)")
dlg_menu("<#ffd700>[ China Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010996,1)")
dlg_menu("<#ffd700>[ Canada Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010992,1)")
dlg_menu("<#ffd700>[ Brazil Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010988,1)")
dlg_menu("<#ffd700>[ Australia Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010984,1)")
dlg_menu("<#ffd700>[ Spain Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010937,1)")
dlg_menu("<#ffd700>[ Poland Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010933,1)")
dlg_menu("<#ffd700>[ Netherlands Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010929,1)")
dlg_menu("<#ffd700>[ Italy Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010925,1)")
dlg_menu("<#ffd700>[ Germany Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010913,1)")
dlg_menu("<#ffd700>[ USA Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010895,1)")
dlg_menu("<#ffd700>[ UK Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010891,1)")
dlg_menu("<#ffd700>[ Turkey Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010887,1)")
dlg_menu("<#ffd700>[ Singapore Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010883,1)")
dlg_menu("<#ffd700>[ Malaysia Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2010879,1)")
dlg_menu("<#ffd700>[ Honduras Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2011272,1)")
dlg_menu("<#ffd700>[ Belarus Cloak (300 Tokens) ]", "ReincGod_buyStore(300,2011276,1)")
else
dlg_text("You would have to reincarnate twice to be able to trade for these items.")
end
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_listStore(1)")
elseif qCode == 300 then
if get_flag("reinc") >= 0 then
dlg_text("Yes, I can trade you these.")
dlg_menu("<#ffd700>[ Stasis Cowl (500 Tokens) ]", "ReincGod_buyStore(500,302741,1)")
dlg_menu("<#ffd700>[ Sandspike Helm (500 Tokens) ]", "ReincGod_buyStore(500,302733,1)")
dlg_menu("<#ffd700>[ Aurelian Helm (500 Tokens) ]", "ReincGod_buyStore(500,37,1)")
dlg_menu("<#ffd700>[ Amberscale Veil (500 Tokens) ]", "ReincGod_buyStore(500,302745,1)")
else
dlg_text("You would have to reincarnate at least three times to be able to trade for these items.")
end
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_listStore(1)")
elseif qCode == 2 then
dlg_text("<#ffd700>I do have some of these and some of those lying here if you're particulary interested..")
dlg_menu("<#ffd700>[ x1 Expert's Bag (150 Tokens) ]", "ReincGod_buyStore(150,3800101,1)")
dlg_menu("<#ffd700>[ x1 Ancient Chaos Stone (55 Tokens) ]", "ReincGod_buyStore(55,3620137,1)")
dlg_menu("<#ffd700>[ x1 Emblem-Magic (55 Tokens) ]", "ReincGod_buyStore(55,603105,1)")
dlg_menu("<#ffd700>[ x1 Gender Change Potion (55 Tokens) ]", "ReincGod_buyStore(55,960123,1)")
dlg_menu("<#ffd700>[ x50 Creature Spellbook (100 Tokens) ]", "ReincGod_buyStore(100,920001,50)")
dlg_menu("<#ffd700>[ x200 Rebirth Scroll (200 Tokens) ]", "ReincGod_buyStore(200,920008,1)")
dlg_menu("<#ffd700>[ x400 Homonculus Heart (400 Tokens) ]", "ReincGod_buyStore(400,601100284,1)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore()")
elseif qCode == 3 then
dlg_text("Decorative? Phhh.. Real warriors look fierce and tought.")
dlg_menu("<#ffd700>[ Decorative: Darkcaster ]", "ReincGod_listStore(400)")
dlg_menu("<#ffd700>[ Decorative: Tribal ]", "ReincGod_listStore(500)")
dlg_menu("<#ffd700>[ Decorative: Gladiator ]", "ReincGod_listStore(600)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore()")
elseif qCode == 400 then
dlg_text("Yeah.. Go ahead.")
dlg_menu("<#ffd700>[ Darkcaster Suit Helmet (75 Tokens) ]", "ReincGod_buyStore(75,1400,1)")
dlg_menu("<#ffd700>[ Darkcaster Suit Boots (75 Tokens) ]", "ReincGod_buyStore(75,1401,1)")
dlg_menu("<#ffd700>[ Darkcaster Suit Gloves (75 Tokens) ]", "ReincGod_buyStore(75,1402,1)")
dlg_menu("<#ffd700>[ Darkcaster Suit Armor (125 Tokens) ]", "ReincGod_buyStore(125,1403,1)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore(3)")
elseif qCode == 500 then
dlg_text("Yeah.. Go ahead.")
dlg_menu("<#ffd700>[ Tribal Helmet (75 Tokens) ]", "ReincGod_buyStore(75,1404,1)")
dlg_menu("<#ffd700>[ Tribal Boots (75 Tokens) ]", "ReincGod_buyStore(75,1405,1)")
dlg_menu("<#ffd700>[ Tribal Gloves (75 Tokens) ]", "ReincGod_buyStore(75,1406,1)")
dlg_menu("<#ffd700>[ Tribal Costume (125 Tokens) ]", "ReincGod_buyStore(125,1407,1)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore(3)")
elseif qCode == 600 then
dlg_text("Yeah.. Go ahead.")
dlg_menu("<#ffd700>[ Gladiator Helmet (75 Tokens) ]", "ReincGod_buyStore(75,1408,1)")
dlg_menu("<#ffd700>[ Gladiator Boots (75 Tokens) ]", "ReincGod_buyStore(75,1409,1)")
dlg_menu("<#ffd700>[ Gladiator Gloves (75 Tokens) ]", "ReincGod_buyStore(75,1410,1)")
dlg_menu("<#ffd700>[ Gladiator Armor (125 Tokens) ]", "ReincGod_buyStore(125,1411,1)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_tokenStore(3)")
end
dlg_menu("<#ffd700>[ Close ]", "")
dlg_show()
end
function ReincGod_buyStore(tokens,id,count)
if validateTokens(tokens) == false then
cprint("You do not have enough [Reincarnation Tokens] to purchase that.")
return
end
removeTokens(tokens)
insert_item(id, count)
cprint("You have bought x"..tostring(count).." "..get_item_name_by_code(id)..".")
end
function ReincGod_tradeTokensForCM()
dlg_title("Reincarnation Goddess")
dlg_text("Reincarnation is a challenge, correct? I can trade you x3 [ Reincarnation Tokens] for x1 [ Challenge Marks ].")
for i = 30, 300, 30
do
if validateTokens(i) == true then
dlg_menu("<#ffd700>[ Trade x"..tostring(i).." Tokens ]", "ReincGod_commenceTokensForCM("..i..")")
end
end
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_Initiate()")
dlg_menu("<#ffd700>[ Close ]", "")
dlg_show()
end
function ReincGod_commenceTokensForCM(amount)
removeTokens(amount)
insert_item(2021300, amount/3, 0, 1, 2)
cprint("Reincarnation Goddess has given you x"..tostring(amount/3).." [Challenge Marks] in return.")
end
function ReincGod_confirmSwap(id,handle_1,handle_2,tokens)
dlg_title("Reincarnation Goddess")
dlg_text("Are you sure you want to trade your "..get_item_name_by_code(get_item_code(handle_1)).."<#38261a> for "..get_item_name_by_code(id).."<#38261a>?")
dlg_menu("<#ffd700>[ Yes (x"..tostring(tokens).." tokens) ]", "ReincGod_wingSwap("..id..","..handle_1..","..handle_2..","..tokens..")")
dlg_menu("<#ffd700>[ Trade something else ]", "ReincGod_wingTrade()")
dlg_menu("<#ffd700>[ Close ]", "")
dlg_show()
end
function ReincGod_wingSwap(id,handle_1,handle_2,tokens)
-- Message,
cprint("You have traded your "..get_item_name_by_code(get_item_code(handle_1)).."<#fdddb0> for "..get_item_name_by_code(id).."<#fdddb0>.")
-- Remove 2 previous wings;
delete_item(handle_1,1)
delete_item(handle_2,1)
insert_item(id, 1, 0, 1, 2)
removeTokens(tokens)
end
function ReincGod_ask(qCode)
dlg_title("Reincarnation Goddess")
if qCode == 1 then
dlg_text("Yes, what is it? What is it that you want to know about?")
dlg_menu("<#ffd700>[ Reincarnation effects ]", "ReincGod_ask(4)")
dlg_menu("<#ffd700>[ Overleveling ]", "ReincGod_ask(6)")
elseif qCode == 2 then
dlg_text("You currently have "..tostring(get_flag("reinc")).." reincarnations in this life.")
elseif qCode == 4 then
dlg_text("Reincarnation resets your class, skills, sets your level to 20 and provides you with 20k job points. Reincarnation is permanent and can not be undone.")
elseif qCode == 6 then
dlg_text("You can reincarnate at level 150 and receive 150 [Reincarnation tokens] for it, but for every level over 150 you will gain bonus x15 [Challenge Marks] and x50 [Reincarnation tokens].")
end
if qCode == 1 or qCode == 2 then
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_Initiate()")
else
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_ask(1)")
end
dlg_menu("<#ffd700>[ Close ]", "")
dlg_show()
end
function ReincGod_doReinc(cCode)
local lv = gv("lv")
dlg_title("Reincarnation Goddess")
if gv("job_depth") ~= 2 then
dlg_text("Weakling.. Return to me when you have changed your class.")
dlg_menu("[ Close ]", "")
dlg_show()
return
end
if cCode == 0 then
dlg_text("Which reincarnation option would you like to do?")
dlg_menu("<#ffd700>[ Complete reincarnation ]", "ReincGod_doReinc(1)")
dlg_menu("<#ffd700>[ Incomplete reincarnation ]", "ReincGod_doReinc(2)")
dlg_menu("<#ffd700>[ Go back ]", "ReincGod_Initiate()")
elseif cCode == 1 then
dlg_text("Complete reincarnation resets your level back to 20 and rebirths you. Are you sure you want to reincarnate?")
dlg_menu("<#ffd700>[ Yes, do it! ]", "ReincGod_doReinc(3)")
dlg_menu("<#ffd700>[ Level 20? No thanks. ]", "ReincGod_Initiate()")
elseif cCode == 2 then
dlg_text("Incomplete reincarnation resets your level back to 20, but keeps your skills and class. Are you sure you want to reincarnate?")
dlg_menu("<#ffd700>[ Yes, do it! ]", "ReincGod_doReinc(4)")
dlg_menu("<#ffd700>[ Level 20? No thanks. ]", "ReincGod_Initiate()")
elseif cCode == 3 then
dlg_text("Are you prepared for a complete reincarnation?")
dlg_menu("<#ffd700>[ Just do it! ]", "rbChar(1)")
dlg_menu("<#ffd700>[ No.. ]", "ReincGod_Initiate()")
elseif cCode == 4 then
dlg_text("Are you prepared for an incomplete reincarnation?")
dlg_menu("<#ffd700>[ Just do it! ]", "rbChar(0)")
dlg_menu("<#ffd700>[ No.. ]", "ReincGod_Initiate()")
end
dlg_show()
end
-----When you reincarnate, call following function:----
function clear_wear()
for i=0,19 do
if get_wear_item_handle(i) ~= 0 then
putoff_item(get_wear_item_handle(i))
end
end
end