smd111

test

Jun 8th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.51 KB | None | 0 0
  1. menu.text = {font='Segoe UI Symbol',size=9}
  2. menu.bg = {alpha = 200}
  3. menu.flags = {draggable=true}
  4. min_window = {text={font='Segoe UI Symbol',size=9},bg={alpha=200},flags={draggable=false},pos={x=0,y=300}}
  5. tab_type = {'Job Settings','Weapon Settings','Armor Settings','System Settings','Include Settings'}
  6. load_include(true, 'more/Display_sub.lua')
  7. -- auto_hide_cycle = 0
  8. --display functions---------------------------------------------------------------------------------------------------------------
  9. menu_set = 1
  10. window = texts.new(menu)
  11. button = texts.new(min_window)
  12. function initialize(text, settings, name)
  13.     local line = L{}
  14.     if name == 'window' then
  15.         line:append('${listm}\nGearswap   \\cs(255,255,0)${hid|HIDE}\\cr')
  16.         if menu_set == 1 then
  17.             line:append('--Job Settings--')
  18.             if player.main_job == 'DNC' or player.sub_job == 'DNC' then
  19.                 line:append('-Steps-\n   Max Step = ${stepm}\n   Stop Steps   ${ssteps}')
  20.             end
  21.             if lvlwatch then
  22.                 line:append('${mjob}\n   lvl = ${mjob_lvl}')
  23.             end
  24.             if skillwatch and Registered_Events then
  25.                 line:append('${skill}\n   lvl = ${skill_lvl|Updating}')
  26.             end
  27.             if (player.main_job == 'NIN' or player.sub_job == 'NIN') and Ninw then
  28.                 line:append('Nin Wheel\n Start LVL = ${ninstartlvl}\n Start ELE = ${ninstartele}\n Start Type = ${ninstarttype}\n ${ninstart|Stoped}')
  29.             end
  30.             if show_aggro then
  31.             line:append('-Aggro Count-\n   Player = ${pagro|0}\n   Party = ${pragro|0}\n   Alliance = ${aagro|0}')
  32.                 if jobs.pet:contains(player.main_job) or jobs.pet:contains(player.sub_job) then
  33.                     line:append('   Pet = ${ptgro|0}')
  34.                 end
  35.             end
  36.             line:append('Reset Aggro #${reagro}')
  37.         elseif menu_set == 2 then
  38.             line:append('--Weapon Settings--')
  39.             line:append('Weapon Type = \\cs(255,255,0)${wept}\\cr\nRange Type = \\cs(255,255,0)${rwept}\\cr\nChange WS Head   ${wshead}\nAuto WS AOE ${wsaoe}')
  40.             if jobs.magic:contains(player.main_job) and WSi then
  41.                 line:append('-Mage Staves-\n   Auto Change   ${cstaff}\n   Type \\cs(255,255,0)${ustaff}\\cr')
  42.             end
  43.         elseif menu_set == 3 then
  44.             line:append('--Armor Settings--\nMode = \\cs(255,255,0)${amode}\\cr')
  45.             if Conquest_Gear then
  46.                 line:append('-Conquest Gear-\n  Change Neck   ${cneckc}\n  Neck Type = \\cs(255,255,0)${cneck}\\cr\n'..
  47.                             '  Change Ring   ${cringc}\n  Ring Type = \\cs(255,255,0)${cring}\\cr')
  48.             end
  49.         elseif menu_set == 4 then
  50.             line:append('--System Settings--\nWatch midaction()  ${watchmid}')
  51.             if jobs.pet:contains(player.main_job) or jobs.pet:contains(player.sub_job) then
  52.                 line:append('Watch pet_midaction()   ${watchpetmid}')
  53.             end
  54.             line:append('CP XP ring = ${axpcpring}')
  55.             if auto_ring then
  56.                 line:append('Ring = ${xpcpring}')
  57.             end
  58.             line:append('Auto Shard Use   ${ashard}')
  59.             if Registered_Events then
  60.                 line:append('-Show-\n  MJob and LVL   ${tmjl}\n  Skill Level   ${tskill}\n  Aggro Count  ${aggroenable}')
  61.             end
  62.             if Debug then
  63.                 line:append('Show Debug  ${dbenable}')
  64.                 if full_debug then
  65.                     line:append('  in = ${debugtype}')
  66.                 end
  67.             end
  68.             if File_Write then
  69.                 line:append('${filew|Force File Write}')
  70.             end
  71.             line:append('Show Swaps   ${tswap}\nDebug Mode   ${debugm}\n${gsex1|Gearswap Export}\n${regs|Reload Gearswap}')
  72.         elseif menu_set == 5 then
  73.             line:append('--Include Settings--')
  74.             if player.main_job == "NIN" or player.sub_job == "NIN" then
  75.                 line:append('Ninja Wheel   ${tninw}')
  76.             end
  77.             if jobs.ammo:contains(player.main_job) then
  78.                 line:append('Ammo   ${tammo}')
  79.             end
  80.             if jobs.magic:contains(player.main_job) then
  81.                 line:append('Mage Stave   ${tmsi}')
  82.             end
  83.             line:append('Special Weapons   ${tswi}\nConquest Gear   ${tcgi}\nDebug   ${tdebug}\nMain Job   ${tmji}\nSub Job   ${tsji}\nRegistered Events   ${trei}\nFile Write   ${tfwi}')
  84.         elseif menu_set == 6 then --custom menu
  85.             line:append('--Custom Menu--')
  86.             for i,v in pairs(custom_menu_build()) do
  87.                 if type(v) == 'string' then
  88.                     line:append(v)
  89.                 end
  90.             end
  91.         end
  92.     elseif name == 'button' then
  93.         if Registered_Events then
  94.             if lvlwatch then
  95.                 line:append('${mjob}   lvl = ${mjob_lvl}')
  96.             end
  97.             if skillwatch then
  98.                 line:append('${skill}   lvl = ${skill_lvl|Updating}')
  99.             end
  100.             if show_aggro then
  101.                 line:append('Aggro Count Total = ${totalagro}')
  102.             end
  103.         end
  104.         if #line == 0 then
  105.             line:append('\n > \n ')
  106.             --line:append('STR:${STR} +${STRb} \n DEX:${DEX} +${DEXb} \n VIT:${VIT} +${VITb} \n AGI:${AGI} +${AGIb} \n INT:${INT} +${INTb} \n MND:${MND} +${MNDb} \n CHR:${CHR} +${CHR}')
  107.         end
  108.     else
  109.         local menu_initialize = get_vars(name,"menu")
  110.         line:append(menu_initialize[name][1])
  111.         for i, v in ipairs(loadstring('return user_env.'..menu_initialize[name][2])()) do
  112.             if menu_initialize[name][4] then
  113.                 if sets[menu_initialize[name][4]][v] then
  114.                     line:append('${'..menu_initialize[name][3]..''..i..'|'..string.gsub(v, "_", " ")..'}')
  115.                 end
  116.             else
  117.                 line:append('${'..menu_initialize[name][3]..''..i..'|'..string.gsub(v, "_", " ")..'}')
  118.             end
  119.         end
  120.         if custom_menu_update and custom_menu_build and custom_menu_commands and name == 'tab_select_window' then
  121.             line:append('${tab6|Custom Menu}')
  122.         end
  123.     end
  124.     text:clear()
  125.     text:append(line:concat('\n'))
  126.     grab_switches(name,line)
  127. end
  128. function updatedisplay()
  129.     local menu_list ={'[J]  W  A  S  I  C','J  [W]  A  S  I  C','J  W  [A]  S  I  C','J  W  A  [S]  I  C','J  W  A  S  [I]  C','J  W  A  S  I  [C]'}
  130.     local c_m = '\\cs(0,255,0)☑\\cr'
  131.     local n_c = '\\cs(255,255,0)☐\\cr'
  132.     initialize(window, menu, 'window') initialize(button, min_window, 'button')
  133.     local i = {}
  134.     if Conquest_Gear and conquest then
  135.         i.cneckc = conquest.neck.change and c_m or n_c
  136.         i.cneck = conq_gear.neck.case[conquest.neck.case_id]
  137.         i.cringc = conquest.ring.change and c_m or n_c
  138.         i.cring = conq_gear.ring.case[conquest.ring.case_id]
  139.     end
  140.     if Registered_Events then
  141.         i.aagro = aggro_count('alliance')
  142.         i.pragro = aggro_count('party')
  143.         i.pagro = aggro_count('player')
  144.         i.ptgro = aggro_count('pet')
  145.         i.totalagro = aggro_count()
  146.     end
  147.     if reg_event and reg_event.skill and Registered_Events then
  148.         i.skill = reg_event.skill_type[skill_count]
  149.         i.skill_lvl = (reg_event.skill[reg_event.skill_type[skill_count]..' Capped'] and "Capped" or reg_event.skill[reg_event.skill_type[skill_count]..' Level'])
  150.     end
  151.     if Debug and fdebug then
  152.         i.debugtype = string.gsub(fdebug.type[fdebug.count], "_", " ")
  153.     end
  154.     if Ninw and ninja_wheel then
  155.         i.ninstartele = ninja_wheel.element_list[ninja_wheel.element_count]
  156.         i.ninstartlvl = ninja_wheel.start_lvl
  157.         i.ninstart = (ninja_wheel.super_tog or ninja_wheel.tog) and '\\cs(0,255,0)Started\\cr' or '\\cs(255,255,0)Stoped\\cr'
  158.         i.ninstarttype = ninja_wheel.start_type and 'Super' or 'Normal'
  159.     end
  160.     i.stepm = Stepmax
  161.     i.ssteps = Stopsteps and c_m or n_c
  162.     i.listm = menu_list[menu_set]
  163.     i.wsaoe = Enable_auto_WS_aoe and c_m or n_c
  164.     i.watchmid = Watch_midaction and c_m or n_c
  165.     i.watchpetmid = Watch_pet_midaction and c_m or n_c
  166.     i.aggroenable = show_aggro and c_m or n_c
  167.     i.tmji = MJi and c_m or n_c
  168.     i.tsji = SJi and c_m or n_c
  169.     i.tmsi = MSi and c_m or n_c
  170.     i.twsi = WSi and c_m or n_c
  171.     i.tammo = Ammo and c_m or n_c
  172.     i.tfwi = File_Write and c_m or n_c
  173.     i.tswi = Special_Weapons and c_m or n_c
  174.     i.tcgi = Conquest_Gear and c_m or n_c
  175.     i.trei = Registered_Events and c_m or n_c
  176.     i.tdebug = Debug and c_m or n_c
  177.     i.tmjl = lvlwatch and c_m or n_c
  178.     i.tskill = skillwatch and c_m or n_c
  179.     i.tswap = _settings.show_swaps and c_m or n_c
  180.     i.debugm = _settings.debug_mode and c_m or n_c
  181.     i.dbenable = full_debug and c_m or n_c
  182.     i.ashard = auto_use_shards and c_m or n_c
  183.     i.tninw = Ninw and c_m or n_c
  184.     i.swhp = s_waltz_h_a and c_m or n_c
  185.     i.axpcpring = auto_ring and c_m or n_c
  186.     i.wshead = ws_head and c_m or n_c
  187.     -- i.STR = Player['STR']
  188.     -- i.STRb = Player['STR+']
  189.     -- i.DEX = Player['DEX']
  190.     -- i.DEXb = Player['DEX+']
  191.     -- i.VIT = Player['VIT']
  192.     -- i.VITb = Player['VIT+']
  193.     -- i.AGI = Player['AGI']
  194.     -- i.AGIb = Player['AGI+']
  195.     -- i.INT = Player['INT']
  196.     -- i.INTb = Player['INT+']
  197.     -- i.MND = Player['MND']
  198.     -- i.MNDb = Player['MND+']
  199.     -- i.CHR = Player['CHR']
  200.     -- i.CHRb = Player['CHR+']
  201.     if weapon_types_count > #weapon_types then
  202.         weapon_types_count = 1
  203.     end
  204.     i.wept = string.gsub(weapon_types[weapon_types_count], "_", " ")
  205.     if range_types_count > #range_types then
  206.         range_types_count = 1
  207.     end
  208.     i.rwept = string.gsub(range_types[range_types_count], "_", " ")
  209.     if armor_types_count > #armor_types then
  210.         armor_types_count = 1
  211.     end
  212.     i.amode = string.gsub(armor_types[armor_types_count], "_", " ")
  213.     if rings_count > #rings then
  214.         rings_count = 1
  215.     end
  216.     i.xpcpring = string.gsub(rings[rings_count], "_", " ")
  217.     i.mjob = player.main_job_full
  218.     i.mjob_lvl = player.main_job_level
  219.     if menu_set == 6 then
  220.         for i2,v2 in pairs(custom_menu_update()) do
  221.             i[i2] = v2
  222.         end
  223.     end
  224.     window:update(i)
  225.     button:update(i)
  226.     if not window_hidden then
  227.         window:show()
  228.     else
  229.         button:show()
  230.     end
  231. end
  232. function extra_display(x,y,loc,hy,check)
  233.     for i, v in pairs(check) do
  234.         if v[1] then
  235.             local tab = {}
  236.             for k, v in  string.gmatch(v[3], "([%w_]+)%.([%w_]+)") do
  237.                 tab[1] = k tab[2] = v
  238.             end
  239.             if _G[v[3]] then
  240.                 _G[v[3]] = set_loc(loc,hy,v[2],get_vars(v[2],"code")) or 1
  241.             else
  242.                 _G[tab[1]][tab[2]] = set_loc(loc,hy,v[2],get_vars(v[2],"code")) or 1
  243.             end
  244.             kill_window(v[2])
  245.             switch[v[2]] = nil
  246.             windower.prim.set_visibility('window_button', false)
  247.             if file_write and file_write.write then
  248.                 file_write.write()
  249.             end
  250.         end
  251.     end
  252.     updatedisplay()
  253. end
  254. function mouse(mtype, x, y, delta, blocked)
  255.     local check_windows = get_vars('nil',"check",x,y)
  256.     local my, mx, button_lines, hx, hy = get_window_pos(x,y,check_windows)
  257.     if button_lines == 0 then
  258.         windower.prim.set_visibility('window_button', false)
  259.         return
  260.     end
  261.     local location = {}
  262.     location.offset = my / button_lines
  263.     location[1] = {}
  264.     location[1].ya = 1
  265.     location[1].yb = location.offset
  266.     local count = 2
  267.     while count <= button_lines do
  268.         location[count] = {}
  269.         location[count].ya = location[count - 1].yb
  270.         location[count].yb = location[count - 1].yb + location.offset
  271.         count = count + 1
  272.     end
  273.     if button:hover(x, y) and button:visible() and min_window.flags.draggable then
  274.         print(min_window.pos.x, min_window.pos.y)
  275.     end
  276.     if mtype == 0 then
  277.         if button:hover(x, y) and button:visible() then
  278.             windower.prim.set_position('window_button', min_window.pos.x, min_window.pos.y)
  279.             windower.prim.set_size('window_button', mx, my)
  280.             windower.prim.set_visibility('window_button', true)
  281.         else
  282.             for i, v in pairs(check_windows) do
  283.                 if v[1] then
  284.                     set_prim_loc(location,v[2],i,mx,hy)
  285.                 end
  286.             end
  287.         end
  288.     elseif mtype == 2 then
  289.         if window:hover(x, y) and window:visible() then
  290.             for i, v in ipairs(location) do
  291.                 if (hy > v.ya and hy < v.yb) then
  292.                     if type(switch['window'][i]) == 'table' then
  293.                         if switch['window'][i][1] then
  294.                             menu_commands(switch['window'][i][1])
  295.                             updatedisplay()
  296.                         end
  297.                     end
  298.                 end
  299.             end
  300.         elseif button:hover(x, y) and button:visible() then
  301.             windower.prim.set_visibility('window_button', false)
  302.             button:hide()
  303.             window_hidden = false
  304.             window:show()
  305.         else
  306.             extra_display(x,y,location,hy,check_windows)
  307.         end
  308.     end
  309. end
  310. function menu_commands(com)
  311.     ----Include Rules----
  312.     if com == "{stepm}" then
  313.         Stepmax = (Stepmax % (player.main_job == "DNC" and 6 or 5)) + 1
  314.     elseif com == "{ssteps}" then
  315.         Stopsteps = not Stopsteps
  316.     elseif com == "{cstaff}" then
  317.         Changestaff = not Changestaff
  318.     elseif com == "{ustaff}" then
  319.         Usestaff = (Usestaff=='Atk' and 'Acc' or 'Atk')
  320.     elseif com == "{cneckc}" then
  321.         conquest.neck.change = not conquest.neck.change
  322.     elseif com == "{cringc}" then
  323.         conquest.ring.change = not conquest.ring.change
  324.     elseif com == "{cneck}" then
  325.         conquest.neck.case_id = (conquest.neck.case_id % #conq_gear.neck.case) + 1
  326.     elseif com == "{cring}" then
  327.         conquest.ring.case_id = (conquest.ring.case_id % #conq_gear.ring.case) + 1
  328.     elseif com == "{ninstartele}" then
  329.         ninja_wheel.element_count = (ninja_wheel.element_count % #ninja_wheel.element_list) + 1 ninja_wheel.start_element = ninja_wheel.element_list[ninja_wheel.element_count]
  330.     elseif com == '{ninstartlvl}' then
  331.         ninja_wheel.start_lvl = (ninja_wheel.start_lvl % 3) + 1
  332.     elseif com == '{ninstarttype}' then
  333.         ninja_wheel.start_type = not ninja_wheel.start_type
  334.     elseif com == '{ninstart|Stoped}' then
  335.         if ninja_wheel.start_type then
  336.             send_command("gs c startnin snw")
  337.         else
  338.             send_command("gs c startnin nw")
  339.         end
  340.     elseif com == '{watchmid}' then
  341.         Watch_midaction = not Watch_midaction
  342.     elseif com == "{watchpetmid}" then
  343.         Watch_pet_midaction = not Watch_pet_midaction
  344.     elseif com == '{tmjl}' then
  345.         lvlwatch = not lvlwatch
  346.     elseif com == "{tskill}" then
  347.         skillwatch = not skillwatch
  348.     elseif com == '{dbenable}' then
  349.         full_debug = not full_debug
  350.     elseif com == '{aggroenable}' then
  351.         show_aggro = not show_aggro
  352.     elseif com == '{ashard}' then
  353.         auto_use_shards = not auto_use_shards
  354.     elseif com == "{swhp}" then
  355.         s_waltz_h_a = not s_waltz_h_a
  356.     elseif com == "{hid|HIDE}" then
  357.         window:hide()
  358.         window_hidden = true
  359.         button:show()
  360.         windower.prim.set_visibility('window_button', false)
  361.         local kill={"gear_select_window","tab_select_window","skill_select_window","weapon_select_window","range_select_window","debug_select_window",
  362.                     "xpcpring_select_window"}
  363.         for i,v in ipairs(kill) do
  364.             if _G[v] then
  365.                 kill_window(v)
  366.             end
  367.         end
  368.     elseif com == "{wsaoe}" then
  369.         Enable_auto_WS_aoe = not Enable_auto_WS_aoe
  370.     elseif com == "{filew|Force File Write}" then
  371.         file_write.write()
  372.     elseif com == "{reagro}" then
  373.         reg_event.clear_aggro_count()
  374.     elseif com == "{axpcpring}" then
  375.         auto_ring = not auto_ring
  376.     elseif com == "{wshead}" then
  377.         ws_head = not ws_head
  378.     ----Gearswap Controls----
  379.     elseif com == "{tswap}" then
  380.         show_swaps((not _settings.show_swaps))
  381.     elseif com == "{debugm}" then
  382.         debug_mode((not _settings.debug_mode))
  383.     elseif com == "{regs|Reload Gearswap}" then
  384.         send_command("lua reload gearswap")--gearswap.refresh_user_env()
  385.     elseif com == "{gsex1|Gearswap Export}" then
  386.         gearswap.export_set({'mainjob','overwrite'})
  387.     else
  388.         ----Window Open/Close Rules----
  389.         if S{"{amode}","{listm}","{skill}","{wept}","{rwept}","{debugtype}","{xpcpring}"}:contains(com) then
  390.             local ctext = {text = {font='Segoe UI Symbol',size=9},bg={alpha=200},flags={draggable=false},pos={x=(menu.pos.x - 120),y=(menu.pos.y)}}
  391.             local menu_open = get_vars(com,"command")
  392.             for i,v in pairs(menu_open) do
  393.                 if com == i then
  394.                     if not _G[v[1]] then
  395.                         _G[v[2]] = v[3]
  396.                         _G[v[1]] = texts.new(_G[v[2]])
  397.                         initialize(_G[v[1]],
  398.                         _G[v[2]], v[1])
  399.                         _G[v[1]]:show()
  400.                     else
  401.                         kill_window(v[1])
  402.                     end
  403.                     if com == "{xpcpring}" then
  404.                         schedule_xpcp_ring()
  405.                     end
  406.                 elseif _G[v[1]] then
  407.                     kill_window(v[1])
  408.                 end
  409.             end
  410.         end
  411.         ----Include Enable/Disable Rules----
  412.         local include_switch = {["{tmji}"]={[1]="MJi",[2]='mjob/main_job_'..player.main_job..'.lua',[3]="mji"},
  413.                                 ["{tsji}"]={[1]="SJi",[2]='sjob/sub_job_'..player.sub_job..'.lua',[3]="sji"},
  414.                                 ["{tfwi}"]={[1]="File_Write",[2]='more/File_Write.lua',[3]="file_write"},
  415.                                 ["{tswi}"]={[1]="Special_Weapons",[2]="more/Special_Weapons.lua",[3]="s_weapon"},
  416.                                 ["{tcgi}"]={[1]="Conquest_Gear",[2]="more/Conquest_Gear.lua",[3]="conq_gear"},
  417.                                 ["{trei}"]={[1]="Registered_Events",[2]="more/Registered_Events.lua",[3]="reg_event"},
  418.                                 ["{tdebug}"]={[1]="Debug",[2]="more/Debug.lua",[3]="fdebug"},
  419.                                 ["{tmsi}"]={[1]="MSi",[2]='more/MSi.lua',[3]="msi"},
  420.                                 ["{tammo}"]={[1]="Ammo",[2]='more/Ammo.lua',[3]="ammo"},
  421.                                 ["{tninw}"]={[1]="Ninw",[2]='more/Ninja_Wheel.lua',[3]="ninja_wheel"},}
  422.         if include_switch[com] then
  423.             _G[include_switch[com][1]] = not _G[include_switch[com][1]]
  424.             if _G[include_switch[com][1]] and not Disable_All and gearswap.pathsearch({"SMDinclude/includes/"..include_switch[com][2]}) then
  425.                 load_include(true,include_switch[com][2])
  426.             elseif _G[include_switch[com][1]] and not gearswap.pathsearch({"SMDinclude/includes/"..include_switch[com][2]}) then
  427.                 _G[include_switch[com][1]] = false
  428.                 add_to_chat(cc.mc, "Unable to load "..('SMDinclude/includes/'..include_switch[com][2]):color(cc.r1,cc.mc).." as it does not exist.")
  429.             elseif not _G[include_switch[com][1]] then
  430.                 remove_functions(include_switch[com][3],include_switch[com][1])
  431.             end
  432.         end
  433.     end
  434.     if custom_menu_commands then
  435.         custom_menu_commands(com)
  436.     end
  437.     if file_write and file_write.write then
  438.         file_write.write()
  439.     end
  440. end
  441. mouse_id = windower.raw_register_event('mouse', mouse)
Advertisement
Add Comment
Please, Sign In to add comment