diff options
Diffstat (limited to 'Data/BuiltIn/Libraries/lua-addons/addons/GearSwap/libs/Mote-Globals.lua')
-rw-r--r-- | Data/BuiltIn/Libraries/lua-addons/addons/GearSwap/libs/Mote-Globals.lua | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/GearSwap/libs/Mote-Globals.lua b/Data/BuiltIn/Libraries/lua-addons/addons/GearSwap/libs/Mote-Globals.lua new file mode 100644 index 0000000..d7b2e04 --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/GearSwap/libs/Mote-Globals.lua @@ -0,0 +1,114 @@ +------------------------------------------------------------------------------------------------------------------- +-- Tables and functions for commonly-referenced gear that job files may need, but +-- doesn't belong in the global Mote-Include file since they'd get clobbered on each +-- update. +-- Creates the 'gear' table for reference in other files. +-- +-- Note: Function and table definitions should be added to user, but references to +-- the contained tables via functions (such as for the obi function, below) use only +-- the 'gear' table. +------------------------------------------------------------------------------------------------------------------- + +------------------------------------------------------------------------------------------------------------------- +-- Modify the sets table. Any gear sets that are added to the sets table need to +-- be defined within this function, because sets isn't available until after the +-- include is complete. It is called at the end of basic initialization in Mote-Include. +------------------------------------------------------------------------------------------------------------------- + +function define_global_sets() + -- Special gear info that may be useful across jobs. + + -- Staffs + gear.Staff = {} + gear.Staff.HMP = 'Chatoyant Staff' + gear.Staff.PDT = 'Earth Staff' + + -- Dark Rings + gear.DarkRing = {} + gear.DarkRing.physical = {name="Dark Ring",augments={'Magic dmg. taken -3%','Spell interruption rate down -5%','Phys. dmg. taken -6%'}} + gear.DarkRing.magical = {name="Dark Ring", augments={'Magic dmg. taken -6%','Breath dmg. taken -5%'}} + + -- Default items for utility gear values. + gear.default.weaponskill_neck = "Asperity Necklace" + gear.default.weaponskill_waist = "Caudata Belt" + gear.default.obi_waist = "Cognition Belt" + gear.default.obi_back = "Toro Cape" + gear.default.obi_ring = "Strendu Ring" + gear.default.fastcast_staff = "" + gear.default.recast_staff = "" +end + +------------------------------------------------------------------------------------------------------------------- +-- Functions to set user-specified binds, generally on load and unload. +-- Kept separate from the main include so as to not get clobbered when the main is updated. +------------------------------------------------------------------------------------------------------------------- + +-- Function to bind GearSwap binds when loading a GS script. +function global_on_load() + send_command('bind f9 gs c cycle OffenseMode') + send_command('bind ^f9 gs c cycle HybridMode') + send_command('bind !f9 gs c cycle RangedMode') + send_command('bind @f9 gs c cycle WeaponskillMode') + send_command('bind f10 gs c set DefenseMode Physical') + send_command('bind ^f10 gs c cycle PhysicalDefenseMode') + send_command('bind !f10 gs c toggle Kiting') + send_command('bind f11 gs c set DefenseMode Magical') + send_command('bind ^f11 gs c cycle CastingMode') + send_command('bind f12 gs c update user') + send_command('bind ^f12 gs c cycle IdleMode') + send_command('bind !f12 gs c reset DefenseMode') + + send_command('bind ^- gs c toggle selectnpctargets') + send_command('bind ^= gs c cycle pctargetmode') +end + +-- Function to revert binds when unloading. +function global_on_unload() + send_command('unbind f9') + send_command('unbind ^f9') + send_command('unbind !f9') + send_command('unbind @f9') + send_command('unbind f10') + send_command('unbind ^f10') + send_command('unbind !f10') + send_command('unbind f11') + send_command('unbind ^f11') + send_command('unbind !f11') + send_command('unbind f12') + send_command('unbind ^f12') + send_command('unbind !f12') + + send_command('unbind ^-') + send_command('unbind ^=') +end + +------------------------------------------------------------------------------------------------------------------- +-- Global event-handling functions. +------------------------------------------------------------------------------------------------------------------- + +-- Global intercept on precast. +function user_precast(spell, action, spellMap, eventArgs) + cancel_conflicting_buffs(spell, action, spellMap, eventArgs) + refine_waltz(spell, action, spellMap, eventArgs) +end + +-- Global intercept on midcast. +function user_midcast(spell, action, spellMap, eventArgs) + -- Default base equipment layer of fast recast. + if spell.action_type == 'Magic' and sets.midcast and sets.midcast.FastRecast then + equip(sets.midcast.FastRecast) + end +end + +-- Global intercept on buff change. +function user_buff_change(buff, gain, eventArgs) + -- Create a timer when we gain weakness. Remove it when weakness is gone. + if buff:lower() == 'weakness' then + if gain then + send_command('timers create "Weakness" 300 up abilities/00255.png') + else + send_command('timers delete "Weakness"') + end + end +end + |