Files
Leviathan/GameServer/AziaMafiaScriptsBackup/Funzone/npc/Autu_NpC.lua
T
2026-06-01 12:46:52 +02:00

186 lines
7.4 KiB
Lua

function NPC_card_up()
dlg_title( "By AziaMafia" )
text = "Enchantement SkillCard Automatique <br> Choisir Votre Type : Cube"
dlg_text( text )
dlg_menu( "<#f7a2ab>".. get_item_name_by_code(700401) , "NPC_card_up_select_protect(700401)" )
dlg_menu( "<#f7a2ab>".. get_item_name_by_code(700402) , "NPC_card_up_select_protect(700402)" )
dlg_menu( "@90010002", '' )
dlg_show()
end
function NPC_card_up_select_protect(cube)
dlg_title( "By AziaMafia" )
text = "Enchantement SkillCard Automatique <br> Choisir Votre Type : Protection"
dlg_text( text )
dlg_menu( "<#f7a2ab>Aucune", "NPC_card_up_select_enchant(".. cube .. ", 0 )" )
if find_item( 950083 ) > 0 then
dlg_menu( "<#f7a2ab>".. get_item_name_by_code(950083) , "NPC_card_up_select_enchant(".. cube .. ", 950083 )" )
end
dlg_menu( "@90010002", '' )
dlg_show()
end
function NPC_card_up_select_enchant(cube, protect )
dlg_title( "By AziaMafia" )
text = "Enchantement SkillCard Automatique <br> Choisir Votre Enchantement Cible"
dlg_text( text )
for i = 2 , 10 do
dlg_menu( "<#f7a2ab>+".. i .. "", "NPC_card_up_recap(".. cube .. ",".. protect ..",".. i .." )" )
end
dlg_menu( "@90010002", '' )
dlg_show()
end
function NPC_card_up_recap(cube, protect , enchant )
--700401 cube compétence
--700402 cube compétence ancien
--950083 carte protection
text_cube = get_item_name_by_code(cube)
if protect > 0 then
text_protect = get_item_name_by_code(protect)
else
text_protect = "Aucune"
end
text = sconv("<size:12><br><b>Enchantement SkillCard Automatique <br><br> Cube =</b> <1> <br><b>Protection =</b> <2> <br><b>Enchantement =</b> +<3> <br>", "<1>" , text_cube , "<2>" , text_protect , "<3>" , enchant )
cmd = "NPC_card_up_craft(".. cube .. ",".. protect ..",".. enchant .." ) "
dlg_special('confirm_window', cmd , text )
end
function NPC_card_up_craft(cube,protect,enchant)
local arraypvp
arraypvp = {502001,502011,502012,502013,502014,502018,502019,502020,502021,502022,502031,502032,502033,502034,502041,502043,502044,502045,502046,502303,502304,502311,502312,502313,502315,502501,502502,502503,502601,502602,502611,502621,502622,502623,502624,502626,502631,502635,502641,502642,503001,503002,503003,503004,503011,503012,503013,503014,503015,503016,503017,503021,503022,503023,503024,503025,503201,503202,503203,503204,503205,503211,503212,503222,503401,503402,503411,503412,503423,503424,503425,503426,503427,503428,503429,503430,503431,503601,503602,503603,504001,504002,504003,504012,504201,504202,504211,504402,504412,504413,504612,504613,504614,504801,504802,502645,503005,503185,503210,502051,502052,502053,502055,502056,502058,502060,502061,502063,502064,502067,502068,502070,502071,502074,502075,502076,502077,502078,502082,502321,502322,502326,502328,502331,502332,502333,502334,502337,502339,502340,502615,502616,502617,502620,502630,502637,502638,502639,502649,502655,502656,502661,502662,502663,502664,502668,502671,502672,502673,502676,502677,502678,502679,502681,502682,503027,503030,503033,503035,503037,503040,503103,503151,503156,503181,503183,503186,503187,503188,503209,503220,503224,503435,503454,503458,503460,503461,503472,503492,503607,503608,503613,503614,503616,503621,503622,503750,503751,503752,503753,503754,503803,503806,503810,503811,503814,503815,503901,504207,504901,522001,522002,522003,522301,522302,522303,522304,522501,523001,523002,523003,523004,523005,523006,523007,523008,523201,523202,523203,523401,523402,523403,523404,523405,523406,523407,523408,523409,523410,523411,523412,523413,523414,523415,523416,523417,523418,523419,523420,523421,523422,523423,523424,523425,523426,523427,523428,523429,523430,23431,523601,523602,523603,523604,523605,523606,524001,524002,524201,524202,524203,524204,524801,524802,524803,524804,522004,522005,522006,522007,522008,522009,522010,522011,522012,522305,522306,522307,523009,523010,523011,523012,523013,523014,23015,523016,523017,523204,523205,523206,523432,523433,523434,523435,523436,523437,523438,523439,523441,523442,523443,523444,523445,523801,523802,524401,524402,524403,524404,524405,524406,524407,524805,550101,550102,550201,550301,550401,506010,521124,521302,521304,521308,521320,521417,521427,521504,521506,521524,521525,521526,521527,531105,531108,531116,531117,531124,531204,531208,531308,531314,531315,531320,531329,531407,531504,531505,531524,531526,541107,541124,541224,541225,541306,541315,541329,541330,541406,541413,541506,541513,541523,521103,521112,521121,521201,521202,521211,521311,521319,521322,521401,521402,521411,521420,521501,521502,521511,521520,531102,531111,531120,531202,531220,531312,531324,531402,531411,531422,531423,531502,531512,531521,541101,541102,541111,541120,541202,541211,541302,541311,541320,541402,541411,541419,541502,541521}
mix_chance= {100,100,90,80,70,60,55,45,40,35}
chance_mix = mix_chance[enchant]
protct = false
if protect > 0 then
protct = true
end
for ipvp = 1, table.getn(arraypvp) do
temp2 = nil
nosucces = 0
succes = 0
use1 = 0
use2 = 0
if find_item(arraypvp[ipvp]) > 0 then
id_card = arraypvp[ipvp]
handle_list = get_item_handle_list(id_card) --temp2
for d = 1 , table.getn(handle_list) do
--cprint( sconv(" name +enchant quantity " , "name" , get_item_name_by_code(id_card) , "enchant" , get_item_enhance(handle_list[d]) , "quantity" , get_item_count(handle_list[d]) ) )
if get_item_enhance(handle_list[d]) == (enchant-1) then temp2 = handle_list[d] end
end
--create_countnacard = math.floor( get_item_count( temp2 ) ) --nombre de carte + X get_item_count( temp2 )
--create_countncube = math.floor( find_item( cube )) -- cube compétence / ancien find_item( cube )
--create_countnprotect = math.floor( find_item( protect )) --carte protection find_item( protect )
if temp2 ~= nil and temp2 ~= '' then
while get_item_count( temp2 ) >= 2 do
-- initialisation des condition de craft
if find_item( cube ) < 1 then
break
end
if find_item( protect ) < 1 and protct == true then
break
end
-- fin initialisation
local hasard = math.random ( 0, 100 )
if hasard <= chance_mix then
delete_item(temp2,2)
insert_item(id_card, 1, enchant, 1, 2)
delete_item(get_item_handle(cube),1)
succes = succes +1
use1 = use1 +1
if protct == true then
delete_item(get_item_handle(protect),1)
end
else
delete_item(temp2,1)
delete_item(get_item_handle(cube),1)
nosucces = nosucces +1
use1 = use1 +1
if protct == true then
delete_item(get_item_handle(protect),1)
end
end
end
end
-- FINAL LOG
if nosucces > 0 or succes > 0 then
local name_id = get_item_name_by_code(id_card)
message("LOG Auto Enchant Card")
--560403 Vous avez obtenu :
text_use = "Vous avez utilisé : <1> x<2>"
text_give = "Vous avez obtenu : <1> x<2>"
message( sconv("<b>Vous avez obtenu : <1> " , "<1>" , name_id .. " +" .. enchant .. " x" .. succes ) )
--Vous avez utilisé :
message( sconv("<b>Vous avez utilisé : <1> " , "<1>" , name_id .. " +" .. enchant-1 .. " x" .. nosucces ) )
if protct == true then
message( sconv("<b>Vous avez utilisé : <1> " , "<1>" , get_item_name_by_code(cube) .. " x" .. use1 ) )
message( sconv("<b>Vous avez utilisé : <1> " , "<1>" , get_item_name_by_code(protect) .. " x" .. use1 ) )
else
message( sconv("<b>Vous avez utilisé : <1> " , "<1>" , get_item_name_by_code(cube) .. " x" .. use1 ) )
end
end
end
end
end