From 336243fb42f382e0cc97fc4067cf8184766485e5 Mon Sep 17 00:00:00 2001 From: smd111 Date: Mon, 5 Sep 2016 14:20:20 -0400 Subject: [PATCH] 9/5/2016 2:18 PM Reworked include loading ---wait till the display starts and your good to go from there added a function to check if your sub job can use Dual Wield ---dwsj() ---check my updated Main File Examples/WAR.lua to see how to use --- README.md | 4 +-- SMDinclude/Main File Examples/BLM.lua | 4 ++- SMDinclude/Main File Examples/BST.lua | 4 ++- SMDinclude/Main File Examples/COR.lua | 4 ++- SMDinclude/Main File Examples/GEO.lua | 4 ++- SMDinclude/Main File Examples/PUP.lua | 5 +++ SMDinclude/Main File Examples/RDM.lua | 4 ++- SMDinclude/Main File Examples/RNG.lua | 4 ++- SMDinclude/Main File Examples/WAR.lua | 10 +++--- SMDinclude/includes/Include.lua | 33 ++++++++++++++----- SMDinclude/includes/extra.lua | 29 +++++++++++----- SMDinclude/includes/map.lua | 2 +- SMDinclude/includes/more/Display.lua | 10 +++--- .../includes/more/Registered_Events.lua | 5 --- 14 files changed, 81 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 17d6034..fc354c8 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,7 @@ What the Display can do for you------------------------------------- -------------------------------------------------------------------- On loading----------------------------------------------------- -If you do not wait for the chat line "Smd111's Gearswap Include is ready for usee." -on Load or (if you load with your char in the mog house) when you Zone -this include will not function correctly +Once the display loads your good to go. -------------------------------------------------------------------- Reporting bug's----------------------------------------------------- diff --git a/SMDinclude/Main File Examples/BLM.lua b/SMDinclude/Main File Examples/BLM.lua index 7ab47ef..b865764 100644 --- a/SMDinclude/Main File Examples/BLM.lua +++ b/SMDinclude/Main File Examples/BLM.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Club'] = {main="Eminent Wand",sub="Eminent Dagger"} + if dwsj() then + sets.weapon['Club'] = {main="Eminent Wand",sub="Eminent Dagger"} + end sets.range['Other'] = {range="",ammo=""} sets.armor['Basic'] = {} sets.armor['Capacity_Points'] = {back="Aptitude Mantle +1",} diff --git a/SMDinclude/Main File Examples/BST.lua b/SMDinclude/Main File Examples/BST.lua index 2d64504..d894f12 100644 --- a/SMDinclude/Main File Examples/BST.lua +++ b/SMDinclude/Main File Examples/BST.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Axe'] = {main="Eminent Axe",sub="Eminent Dagger"} + if dwsj() then + sets.weapon['Axe'] = {main="Eminent Axe",sub="Eminent Dagger"} + end sets.weapon['None'] = {main=empty,sub=empty} sets.armor['Basic'] = {} sets.armor['Capacity_Points'] = {back="Aptitude Mantle +1",} diff --git a/SMDinclude/Main File Examples/COR.lua b/SMDinclude/Main File Examples/COR.lua index 23b2543..0737453 100644 --- a/SMDinclude/Main File Examples/COR.lua +++ b/SMDinclude/Main File Examples/COR.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Sword'] = {main="Eminent Scimitar",sub={ name="Firmament", augments={'Wind resistance-2 Earth resistance+2',}}} + if dwsj() then + sets.weapon['Sword'] = {main="Eminent Scimitar",sub={ name="Firmament", augments={'Wind resistance-2 Earth resistance+2',}}} + end sets.weapon['None'] = {main=empty,sub=empty} sets.range['Marksmanship'] = {range="Eminent Gun",ammo="Bullet"} sets.armor['Basic'] = {} diff --git a/SMDinclude/Main File Examples/GEO.lua b/SMDinclude/Main File Examples/GEO.lua index ba76c87..899c09e 100644 --- a/SMDinclude/Main File Examples/GEO.lua +++ b/SMDinclude/Main File Examples/GEO.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Club'] = {main="Rose Wand",sub="Rose Wand"} + if dwsj() then + sets.weapon['Club'] = {main="Rose Wand",sub="Rose Wand"} + end sets.weapon['None'] = {main=empty,sub=empty} sets.range['Handbells'] = {range="Matre Bell",ammo=empty} sets.armor['Basic'] = {} diff --git a/SMDinclude/Main File Examples/PUP.lua b/SMDinclude/Main File Examples/PUP.lua index 162c754..ddc6a40 100644 --- a/SMDinclude/Main File Examples/PUP.lua +++ b/SMDinclude/Main File Examples/PUP.lua @@ -113,6 +113,11 @@ function custom_menu_build() local custom_properties = L{} custom_properties:append('Enable Auto Pup ${eap}') if Enable_auto_pup then custom_properties:append('Auto Skill Up Maneuver\'s ${esku}') end + if player.sub_job == "DNC" then + custom_properties:append('DNC sub') + elseif player.sub_job == "COR" then + custom_properties:append('COR sub') + end return custom_properties end function custom_menu_commands(a) diff --git a/SMDinclude/Main File Examples/RDM.lua b/SMDinclude/Main File Examples/RDM.lua index c17838d..a760928 100644 --- a/SMDinclude/Main File Examples/RDM.lua +++ b/SMDinclude/Main File Examples/RDM.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Sword'] = {main="Eminent Scimitar",sub="Eminent Dagger"} + if dwsj() then + sets.weapon['Sword'] = {main="Eminent Scimitar",sub="Eminent Dagger"} + end sets.weapon['None'] = {main=empty,sub=empty} sets.range['Other'] = {range="",ammo=""} sets.armor['Basic'] = {} diff --git a/SMDinclude/Main File Examples/RNG.lua b/SMDinclude/Main File Examples/RNG.lua index 30e7fdd..5a128c3 100644 --- a/SMDinclude/Main File Examples/RNG.lua +++ b/SMDinclude/Main File Examples/RNG.lua @@ -12,7 +12,9 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for all Waltz - sets.weapon['Dagger'] = {main="Eminent Dagger",sub="Eminent Axe"} + if dwsj() then + sets.weapon['Dagger'] = {main="Eminent Dagger",sub="Eminent Axe"} + end sets.weapon['None'] = {main=empty,sub=empty} sets.range = {} sets.range['Archery'] = {range="Eminent Bow",ammo="Iron Arrow"} diff --git a/SMDinclude/Main File Examples/WAR.lua b/SMDinclude/Main File Examples/WAR.lua index 4bbe823..b6ee380 100644 --- a/SMDinclude/Main File Examples/WAR.lua +++ b/SMDinclude/Main File Examples/WAR.lua @@ -14,15 +14,17 @@ include('SMDinclude/includes/Include.lua') --Job functions function gear_setup() sets["Waltz"] = {} -- use this set for Waltz - sets.weapon['Axe'] = {main="Eminent Axe",sub="Eminent Scimitar"} - sets.weapon['Dagger'] = {main="Eminent Dagger",sub="Eminent Scimitar"} + if dwsj() then + sets.weapon['Axe'] = {main="Eminent Axe",sub="Eminent Scimitar"} + sets.weapon['Dagger'] = {main="Eminent Dagger",sub="Eminent Scimitar"} + sets.weapon['Sword'] = {main="Eminent Scimitar",sub="Eminent Dagger"} + end sets.weapon['Great_Axe'] = {main="Eminent Voulge",sub="Uther's Grip"} sets.weapon['Great_Sword'] = {main="Eminent Sword",sub="Uther's Grip"} sets.weapon['Hand-to-Hand'] = {main="Em. Baghnakhs",ammo=empty} sets.weapon['Scythe'] = {main="Eminent Sickle",sub="Uther's Grip"} - sets.weapon['Sword'] = {main="Eminent Scimitar",sub="Eminent Dagger"} sets.weapon['None'] = {main=empty,sub=empty} - sets.weapon['Great_Axe2'] = {main="Blurred Cleaver",sub="Uther's Grip"} + sets.weapon['Great_Axe Su2'] = {main="Blurred Cleaver",sub="Uther's Grip"} sets.range['Marksmanship'] = {range="Lion Crossbow",ammo="Crossbow Bolt"} sets.range['Throwing'] = {range="Snakeeye",ammo=empty} sets.armor['Basic'] = {} diff --git a/SMDinclude/includes/Include.lua b/SMDinclude/includes/Include.lua index 177937c..2d9b2a0 100644 --- a/SMDinclude/includes/Include.lua +++ b/SMDinclude/includes/Include.lua @@ -18,15 +18,19 @@ function gearswap.refresh_item_list(itemlist) end gearswap.parse.i[0x01D] = function (data) gearswap.refresh_globals() - if not loaded and not (world.in_mog_house or world.mog_house) then - send_command("gs reload") - add_to_chat(cc.mc,"Smd111's Gearswap Include is ready for use.") + if not loaded then + -- add_to_chat(cc.mc,"Smd111's Gearswap Include is ready for use.") loaded = true + include("SMDinclude/includes/Include.lua") end if auto_ring and check_ring_buff() then schedule_xpcp_ring() end end +if not loaded then + mf = {} + return +end include_setup() --Saved Variable Recovery --------------------------------------------------------------------------------------------------------- if gearswap.pathsearch({'SMDinclude/includes/map.lua'}) and gearswap.pathsearch({'SMDinclude/includes/extra.lua'}) then @@ -107,10 +111,10 @@ function get_sets() add_gear_modes(sets.range,'range_types') add_gear_modes(sets.armor,'armor_types') if update_display then - update_display:schedule(1.5) + update_display() end if mf.file_load then - mf.file_load:schedule(1.5) + mf.file_load() end if file_write and file_write.write then file_write.write() @@ -237,7 +241,17 @@ function indi_change(indi_table,gain) end end function sub_job_change(new,old) - send_command("gs reload") + if file_write and file_write.write then + file_write.write() + end + windower.prim.delete('window_button') + include('SMDinclude/includes/map.lua') + include('SMDinclude/includes/extra') + if gearswap.pathsearch({'Saves/job_'..player.main_job..'var.lua'}) then + include('Saves/job_'..player.main_job..'var.lua') + end + load_rings() + get_sets() end function self_command(com) local status = {end_event=false,stop_swapping_gear=true} @@ -254,7 +268,9 @@ function self_command(com) end end function file_unload(new_job) - mf.file_unload(new_job) + if mf.file_unload then + mf.file_unload(new_job) + end if file_write and file_write.write then file_write.write() end @@ -269,4 +285,5 @@ load_include(Conquest_Gear, 'more/Conquest_Gear.lua') load_include(Registered_Events, 'more/Registered_Events.lua') load_include(Debug, 'more/Debug.lua') load_include(Display, 'more/Display.lua') -load_include(File_Write, 'more/File_Write.lua') \ No newline at end of file +load_include(File_Write, 'more/File_Write.lua') +get_sets() \ No newline at end of file diff --git a/SMDinclude/includes/extra.lua b/SMDinclude/includes/extra.lua index 7a83d6d..e939e44 100644 --- a/SMDinclude/includes/extra.lua +++ b/SMDinclude/includes/extra.lua @@ -228,12 +228,23 @@ end function c_equip(delay, set, event)--delay equip return gearswap.equip_sets:schedule(delay, event..'_delayed_equip', nil, set) end -for _,ring in ipairs({"None","Vocation Ring","Trizek Ring","Capacity Ring","Undecennial Ring","Decennial Ring","Allied Ring","Novennial Ring","Kupofried's Ring", - "Anniversary Ring","Emperor Band","Empress Band","Chariot Band","Duodec. Ring","Expertise Ring"}) do - local item = item_to_bag(ring) - if item and not rings:contains(ring) then - rings:append(ring) - elseif not item and rings:contains(ring) then - rings:delete(ring) - end -end \ No newline at end of file +function dwsj() + if player.sub_job == "NIN" and player.sub_job_level >= 10 then + return true + elseif player.sub_job == "DNC" and player.sub_job_level >= 20 then + return true + end + return false +end +function load_rings() + for _,ring in ipairs({"None","Vocation Ring","Trizek Ring","Capacity Ring","Undecennial Ring","Decennial Ring","Allied Ring","Novennial Ring","Kupofried's Ring", + "Anniversary Ring","Emperor Band","Empress Band","Chariot Band","Duodec. Ring","Expertise Ring"}) do + local item = item_to_bag(ring) + if item and not rings:contains(ring) then + rings:append(ring) + elseif not item and rings:contains(ring) then + rings:delete(ring) + end + end +end +load_rings() \ No newline at end of file diff --git a/SMDinclude/includes/map.lua b/SMDinclude/includes/map.lua index b6caad3..94ea645 100644 --- a/SMDinclude/includes/map.lua +++ b/SMDinclude/includes/map.lua @@ -1,6 +1,6 @@ menu,auto_use_shards,File_Write,Registered_Events,ISr,tsstown = {pos = {x = 100,y = 100}},false,true,true,true,true weapon_types_count,range_types_count,armor_types_count,xpcpcoring,rings_count = 1,1,1,1,1 conquest = {ring={},neck={}} -sets.armor,sets.pet_aftercast,sets.weapon,mf,partynames,sets.pretarget,sets.precast,sets.midcast,sets.aftercast = {},{},{},{},{},{},{},{},{} +sets.armor,sets.pet_aftercast,sets.weapon,partynames,sets.pretarget,sets.precast,sets.midcast,sets.aftercast = {},{},{},{},{},{},{},{} sets.range,sets.building,sets.pet_midcast,cc = {['ThrowLVL.99+'] = {range="Halakaala",ammo=empty}},{},{},{mc=9,r1=11,r2=10,g1=158,g2=6,b1=5,b2=205,y1=36,y2=37} log_in_time = os.clock() equip_from_bags = {"inventory","wardrobe","wardrobe2","wardrobe3","wardrobe4"} diff --git a/SMDinclude/includes/more/Display.lua b/SMDinclude/includes/more/Display.lua index 1a319d3..3f595c2 100644 --- a/SMDinclude/includes/more/Display.lua +++ b/SMDinclude/includes/more/Display.lua @@ -50,21 +50,21 @@ function initialize(text, settings, name) ' Change Ring ${cringc}\n Ring Type = \\cs(255,255,0)${cring}\\cr') end elseif menu_set == 4 then - line:append('--System Settings--\nWatch midaction() ${watchmid}') + line:append('--System Settings--\nWatch midaction() ${watchmid}') if jobs.pet:contains(player.main_job) or jobs.pet:contains(player.sub_job) then line:append('Watch pet_midaction() ${watchpetmid}') end - line:append('CP XP ring = ${axpcpring}') + line:append('CP XP ring ${axpcpring}') if auto_ring then line:append(' Ring = ${xpcpring}') line:append(' ${resetring}') end - line:append('Auto Shard Use ${ashard}\nNo Spells in Town${sstown}') + line:append('Auto Shard Use ${ashard}\nNo Spells in Town ${sstown}') if Registered_Events then - line:append('-Show-\n MJob and LVL ${tmjl}\n Skill Level ${tskill}\n Aggro Count ${aggroenable}') + line:append('-Show-\n MJob and LVL ${tmjl}\n Skill Level ${tskill}\n Aggro Count ${aggroenable}') end if Debug then - line:append('Show Debug ${dbenable}') + line:append('Show Debug ${dbenable}') if full_debug then line:append(' in = ${debugtype}') end diff --git a/SMDinclude/includes/more/Registered_Events.lua b/SMDinclude/includes/more/Registered_Events.lua index f9214ff..7b18682 100644 --- a/SMDinclude/includes/more/Registered_Events.lua +++ b/SMDinclude/includes/more/Registered_Events.lua @@ -59,11 +59,6 @@ function reg_event.zone_change(new_id,old_id) --zone change event if mf.zone_change then mf.zone_change(new,old) end - if new_id == old_id and not (world.in_mog_house or world.mog_house) then - loaded = false - else - loaded = true - end end reg_event.zone_change_id = windower.raw_register_event('zone change', reg_event.zone_change) function reg_event.level_change() --updates display when player lvls up/down