Hi guys!
I want to share my lua for Master class boxs opening.
Basically server that are epic 9.5 dosn't have option to open specific class box for example Marksman, so i did update a lua for npc "Coin Exchanger". Now you can open specific master class boxs with 1 click but opening is limited to 1000 at time to reduce lag ( you can easly change it in lua if you sure that server will handle it ).
Hope you like it.
Instalation
- Go to NPC_QuestClient.lua
- Delete/Replace those functions:
"NPC_dailyquest_9_2_exchang", "Coin_Exchange", "NPC_9_5_Alteration", "NPC_9_4_Cube", "NPC_9_4_OpenBox" ,"NPC_9_4_OpenBox_go" , "NPC_9_4_Coin_exchange_item"
- If 2 was REPLACE then: copy function "Master_box" and relace function name from "NPC_9_4_OpenBox_go" to "OpenBox" and do it in function "NPC_9_4_OpenBox" as well.
- If 2 was DELETE then: create new lua, name it however you want and copy my code ( create it in Script folder )
example place for it C:\Name of you folder \GameEngine\Game_bin\Resource\Script
Lua for NPC:
Code:
------------------------------------------------------
function NPC_dailyquest_9_2_exchang() -- Coin Exchange NPC
-----------------------------------------------------
dlg_title( "@690000128" )
dlg_text( "@90610872" )
dlg_menu( "@90610871", "Coin_Exchange()" )
dlg_menu( "@90610309", "NPC_9_4_OpenBox()" )
local state_code = get_local_info()
--if state_code == 1 then
dlg_menu( "@90610840", "NPC_9_4_Cube(0,0)" )
--end
if state_code == 1 or state_code == 256 or state_code == 8192 then
--dlg_menu( 705014, "NPC_9_5_Alteration(0,0)")
--dlg_menu( 705009, "NPC_9_5_Alteration(1,0)")
end
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" )
dlg_menu( "@90010002", " " )
dlg_show()
end
function Coin_Exchange() --Daily Coin echange menu
dlg_title( "@690000128" )
dlg_text( "@90610082\v#@number@#\v"..find_item(1000535))
dlg_menu( "@90610284", "NPC_9_4_Coin_exchange_item(2016098,50)" )
dlg_menu( "@90610244", "NPC_9_4_Coin_exchange_item(3800270,30)" )
dlg_menu( "@90610245", "NPC_9_4_Coin_exchange_item(3800273,30)" )
dlg_menu( "@90610246", "NPC_9_4_Coin_exchange_item(3800276,30)" )
dlg_menu( "@90610247", "NPC_9_4_Coin_exchange_item(1000484,20)" )
dlg_menu( "@90610248", "NPC_9_4_Coin_exchange_item(2016090,10)" )
dlg_menu( "@90610249", "NPC_9_4_Coin_exchange_item(2013705,10)" )
dlg_menu( "@90610250", "NPC_9_4_Coin_exchange_item(2013011,5)" )
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" )
dlg_menu( "@90010002", " " )
dlg_show()
end
--[[function NPC_9_5_Alteration(type,sel) - Alteration menu -- OFF
local psrc = { 705014, 705009 }
local pitem = { 705031,705032,705033,705034,705035, 705036,705037,705038,705039,705040, 705041,705042,705043,705044,705045,
705016,705017,705018,705019,705020, 705021,705022,705023,705024,705025, 705026,705027,705028,705029,705030 }
local item_src = psrc[type+1]
dlg_title( "@690000128" )
if (sel==0) then
dlg_text( "@90610865" ) -- 어떤 아이템으로 교환하겠습니까?
for i = 1, 15 do
dlg_menu( "@" .. 10000000 + pitem[type*15+i] , "NPC_9_5_Alteration(".. type .. "," .. i ..")" ) --돌아가기
end
elseif sel >=1 and sel <=15 then
dlg_text( "@90605296" ) -- 교환이 성공적으로 진행되었습니다.
local item_idx = pitem[type*15+sel]
delete_item( get_item_handle(item_src),1 )
insert_item(item_idx,1)
message( "<#00ffff>|" .. sconv( "@253", "#@item_name@#", "@"..tostring(get_item_name_id( item_idx ))) )
end
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) --대화 종료
dlg_show()
end]]
--[[function NPC_9_4_Cube(sel,cnt) --Cube exchange menu - OFF
dlg_title( "@690000128" )
local pcube = {700112,700212,700657,700757}
local ppart = {701001,702001,701003,702003}
local piron = {28,14,112,56}
if sel == 0 then
dlg_text( "@90610841" ) -- 어떤 아이템을 만드시겠습니까?
dlg_menu( "@10" .. pcube[1],"NPC_9_4_Cube(1,0)" )
dlg_menu( "@10" .. pcube[2],"NPC_9_4_Cube(2,0)" )
dlg_menu( "@10" .. pcube[3],"NPC_9_4_Cube(3,0)" )
dlg_menu( "@10" .. pcube[4],"NPC_9_4_Cube(4,0)" )
dlg_menu( "@90610842","NPC_9_4_Cube(5,0)" ) -- 스트라이크 큐브 10개를 축복받은 카벙클 큐브로
dlg_menu( "@90610843","NPC_9_4_Cube(6,0)" ) -- 디펜스큐브 10개를 축복받은 카벙클 큐브로
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
return
elseif sel == 5 or sel == 6 then
local ncube = pcube[sel-4] -- 1,2
local nout = pcube[sel-2] -- 3,4
local cnt_cube = find_item( ncube)
if cnt == 0 then
cnt = math.floor(cnt_cube / 10)
dlg_text("@90610867\v#@item1@#\v@".. 10000000+ncube.."\v#@number1@#\v"..cnt_cube.."\v#@item2@#\v@".. 10000000+nout.."\v#@number2@#\v"..cnt)
if cnt >= 100 then
dlg_menu("@90610294\v#@number@#\v100", "NPC_9_4_Cube("..sel..",100)" )
dlg_menu("@90610294\v#@number@#\v10", "NPC_9_4_Cube("..sel..",10)" )
elseif cnt >10 then
dlg_menu( "@90610294\v#@number@#\v"..cnt,"NPC_9_4_Cube("..sel..",".. cnt ..")" )
dlg_menu("@90610294\v#@number@#\v10", "NPC_9_4_Cube("..sel..",10)" )
elseif cnt >0 then
dlg_menu( "@90610294\v#@number@#\v"..cnt,"NPC_9_4_Cube("..sel..",".. cnt ..")" )
end
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
else
if cnt_cube < cnt*10 then
dlg_text( "@90610297" ) -- 재료가 부족합니다
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
return
end
delete_item( get_item_handle( ncube ), cnt * 10 )
insert_item( nout, cnt)
dlg_text( "@90610866" ) -- 교환하였습니다.
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
end
return
end
local niron = find_item( 1100103 )
local ciron = math.floor(niron/piron[sel])
local npart = find_item(ppart[sel]) -- 큐브 스트라이크 조각 7+14
local cpart = math.floor(npart/14)
if cnt == 0 then
cnt = cpart
if cpart > ciron then
cnt = ciron
end
cnt = math.floor(cnt)
--dlg_text( "연마된 강철: "..niron.."개 보유 (/"..piron[sel].."),<br> 큐브 조각: " .. npart .. "개 보유 (/14),<br>|@10" .. pcube[sel] .. "|최대 " .. cnt .. "개 제작 가능합니다." )
dlg_text("@90610868\v#@number1@#\v"..niron.."\v#@piron@#\v"..piron[sel].."\v#@number2@#\v"..npart.."\v#@item1@#\v@".. 10000000+pcube[sel].."\v#@number3@#\v"..cnt )
if cnt >= 100 then
dlg_menu( "@90610844\v#@number@#\v100", "NPC_9_4_Cube("..sel..",100)" )
dlg_menu( "@90610844\v#@number@#\v10", "NPC_9_4_Cube("..sel..",10)" )
elseif cnt > 10 then
dlg_menu( "@90610844\v#@number@#\v"..cnt,"NPC_9_4_Cube("..sel..",".. cnt ..")" )
dlg_menu( "@90610844\v#@number@#\v10", "NPC_9_4_Cube("..sel..",10)" )
elseif cnt > 0 then
dlg_menu( "@90610844\v#@number@#\v"..cnt,"NPC_9_4_Cube("..sel..",".. cnt ..")" )
end
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
elseif cnt > 0 and cnt <= 100 then
if ciron < cnt or cpart < cnt then
dlg_text( "@90610297" ) -- 재료가 부족합니다
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
return
end
delete_item( get_item_handle( ppart[sel] ), cnt*14 )
delete_item( get_item_handle( 1100103 ), cnt*piron[sel] )
insert_item( pcube[sel], cnt)
--dlg_text( "@10" .. pcube[sel] .. "|" .. cnt .. "|개 제작 하였습니다." )
dlg_text( "@90610869\v#@item1@#\v@".. 10000000+pcube[sel].."\v#@number1@#\v" .. cnt )
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" ) --돌아가기
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
end
end]]
function NPC_9_4_OpenBox() -- Gala open box menu
dlg_title( "@690000128" )
dlg_text( "@90610319" )
dlg_menu( "<#006aff>Open Master Class Boxes","Master_box()")
dlg_menu( "@11100405", "OpenBox(1)" )
dlg_menu( "@11100406", "OpenBox(2)" )
dlg_menu( "@11100407", "OpenBox(3)" )
dlg_menu( "@11100408", "OpenBox(4)" )
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" )
dlg_menu( "@90010002", " " )
dlg_show()
end
function OpenBox(num) -- Script that open boxes
dlg_title( "@690000128" )
local item_id = {1100405, 1100406, 1100407, 1100408, 1100410, 1100411, 1100412, 1100413, 1100414, 1100415, 1100416, 1100417, 1100417, 1100418, 1100419, 1100420, 1100421, 1100422, 1100423, 1100424}
local drop_group = {-3000406, -3000407, -3000408, -3000409, -5801200, -5801210, -5801220, -5801230, -5801240, -5802200, -5802210, -5802220, -5802230, -5802230, -5803200, -5803210, -5803220, -5803230, -5803240}
local count = find_item( item_id[num] )
if count == 0 then
dlg_text( "@90610321" )
elseif count > 1 then
dlg_text( "@90610320" )
if count > 1000 then
count = 1000
end
delete_item (get_item_handle(item_id[num]), count)
for i=1,count do
local item = pick_item_in_drop_group( drop_group[num] )
insert_item( item[1], item[2] )
end
end
dlg_menu( "@90010003", "NPC_9_4_OpenBox()" )
dlg_menu( "@90010002", " " )
dlg_show()
end
function Master_box() --Menu for MAster boxes
dlg_title( "@690000128" )
dlg_text( "@90610319" )
dlg_menu( "<#e6a800>Berserk", "OpenBox(5)" ) -- Bersek
dlg_menu( "<#e6a800>Marksman", "OpenBox(7)" ) -- Marksman
dlg_menu( "<#e6a800>Magus", "OpenBox(8)" ) -- Magus
dlg_menu( "<#e6a800>War Kahuna", "OpenBox(9)" ) -- War Kahuna
dlg_menu( "<#e6a800>Beast Master", "OpenBox(10)" ) -- Beast Master
dlg_menu( "<#00e6cf>Templar", "OpenBox(11)" ) -- Templar
dlg_menu( "<#00e6cf>Mercenary", "OpenBox(12)" ) -- Mercenary
dlg_menu( "<#00e6cf>Cardinal", "OpenBox(13)" ) -- Cardinal
dlg_menu( "<#00e6cf>Oracle", "OpenBox(14)" ) -- Oracle
dlg_menu( "<#00e6cf>Master Breeder", "OpenBox(15)" ) -- Master Breeder
dlg_menu( "<#a500e6>Slayer", "OpenBox(16)" ) -- Slayer
dlg_menu( "<#a500e6>Deadeye", "OpenBox(17)" ) -- Deadeye
dlg_menu( "<#a500e6>Void Mage", "OpenBox(18)" ) -- Void Mage
dlg_menu( "<#a500e6>Corruptor", "OpenBox(19)" ) -- Corruptor
dlg_menu( "<#a500e6>Overlord", "OpenBox(20)" ) -- Overlord
dlg_menu( "@90010003", "NPC_9_4_OpenBox()" )
dlg_menu( "@90010002", " " )
dlg_show()
end
function NPC_9_4_Coin_exchange_item( id, count ) --Script for coin exchange
dlg_title( "@690000128" )
if id == 1 then
local count = math.floor( find_item( 1000485 ) / 3 )
local del_count = math.floor( find_item( 1000485 ) / 3 ) * 3
if find_item( 1000485 ) >= 3 then
dlg_text( "@90610254" )
insert_item ( 1000535, count )
delete_item( get_item_handle( 1000485 ), del_count )
else
dlg_text( "@90610078" )
end
else
if find_item( 1000535 ) >= count then
dlg_text( "@90606002" )
insert_item ( id, 1 )
delete_item( get_item_handle( 1000535 ), count )
else
dlg_text( "@90610078" )
end
end
dlg_menu( "@90010003", "NPC_dailyquest_9_2_exchang()" )
dlg_menu( "@90010002", " " )
dlg_show()
end






