diff options
Diffstat (limited to 'Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke')
-rw-r--r-- | Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/EasyNuke.lua | 253 | ||||
-rw-r--r-- | Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/readme.md | 81 |
2 files changed, 334 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/EasyNuke.lua b/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/EasyNuke.lua new file mode 100644 index 0000000..055bcfe --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/EasyNuke.lua @@ -0,0 +1,253 @@ +--[[ +Copyright © 2018, Nyarlko +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +* Neither the name of EasyNuke nor the +names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Nyarlko, or it's members, BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +]] + +_addon.name = 'EasyNuke' +_addon.author = 'Nyarlko' +_addon.version = '1.0.8' +_addon.command = "ez" + +require('sets') +require('tables') +require('strings') + +config = require('config') + +local defaults = T{} +defaults.current_element = "fire" +defaults.target_mode = "t" +settings = config.load(defaults) + +current_element = "fire" +target_mode = "t" + +elements = T{"fire","wind","thunder","light","ice","water","earth","dark"} +elements_dark = T{"ice","water","earth","dark"} +elements_light = T{"fire","wind","thunder","light"} +elements_index = 1 +other_modes = S{"drain","aspir","absorb","cure"} + +targets = T{"t","bt","stnpc",} +targets_index = 1 + +spell_tables = {} +spell_tables["fire"] = {"Fire","Fire II","Fire III","Fire IV","Fire V","Fire VI",} +spell_tables["fire"]["ga"] = {"Firaga","Firaga II","Firaga III","Firaja",} +spell_tables["fire"]["ra"] = {"Fira","Fira II","Fira III"} +spell_tables["fire"]["helix"] = {"Pyrohelix","Pyrohelix II"} +spell_tables["fire"]["am"] = {"Flare","Flare II"} +spell_tables["earth"] = {"Stone","Stone II","Stone III","Stone IV","Stone V","Stone VI",} +spell_tables["earth"]["ga"] = {"Stonega","Stonega II","Stonega III","Stoneja",} +spell_tables["earth"]["ra"] = {"Stonera","Stonera II","Stonera III"} +spell_tables["earth"]["helix"] = {"Geohelix","Geohelix II"} +spell_tables["earth"]["am"] = {"Quake","Quake II"} +spell_tables["wind"] = {"Aero","Aero II","Aero III","Aero IV","Aero V","Aero VI",} +spell_tables["wind"]["ga"] = {"Aeroga","Aeroga II","Aeroga III","Aeroja",} +spell_tables["wind"]["ra"] = {"Aerora","Aerora II","Aerora III"} +spell_tables["wind"]["helix"] = {"Anemohelix","Anemohelix II"} +spell_tables["wind"]["am"] = {"Tornado","Tornado II"} +spell_tables["water"] = {"Water","Water II","Water III","Water IV","Water V","Water VI",} +spell_tables["water"]["ga"] = {"Waterga","Waterga II","Waterga III","Waterja",} +spell_tables["water"]["ra"] = {"Watera","Watera II","Watera III"} +spell_tables["water"]["helix"] = {"Hydrohelix","Hydrohelix II"} +spell_tables["water"]["am"] = {"Flood","Flood II"} +spell_tables["ice"] = {"Blizzard","Blizzard II","Blizzard III","Blizzard IV","Blizzard V","Blizzard VI",} +spell_tables["ice"]["ga"] = {"Blizzaga","Blizzaga II","Blizzaga III","Blizzaja",} +spell_tables["ice"]["ra"] = {"Blizzara","Blizzara II","Blizzara III"} +spell_tables["ice"]["helix"] = {"Cryohelix","Cryohelix II"} +spell_tables["ice"]["am"] = {"Freeze","Freeze II"} +spell_tables["thunder"] = {"Thunder","Thunder II","Thunder III","Thunder IV","Thunder V","Thunder VI",} +spell_tables["thunder"]["ga"] = {"Thundaga","Thundaga II","Thundaga III","Thundaja",} +spell_tables["thunder"]["ra"] = {"Thundara","Thundara II","Thundara III"} +spell_tables["thunder"]["helix"] = {"Ionohelix","Ionohelix II"} +spell_tables["thunder"]["am"] = {"Burst","Burst II"} +spell_tables["light"] = {"Banish","Banish II","Holy","Banish III",} +spell_tables["light"]["ga"] = {"Banishga","Banishga II"} +spell_tables["light"]["helix"] = {"Luminohelix","Luminohelix II"} +spell_tables["dark"] = {"Impact"} +spell_tables["dark"]["ga"] = {"Comet"} +spell_tables["dark"]["helix"] = {"Noctohelix", "Noctohelix II"} +spell_tables["cure"] = {"Cure","Cure II","Cure III","Cure IV","Cure V","Cure VI"} +spell_tables["cure"]["ga"] = {"Curaga","Curaga II","Curaga III","Curaga IV","Curaga V",} +spell_tables["cure"]["ra"] = {"Cura","Cura II","Cura III"} +spell_tables["drain"] = {"Aspir","Aspir II","Aspir III","Drain","Drain II","Drain III"} +spell_tables["drain"]["ga"] = spell_tables["drain"] +spell_tables["drain"]["ra"] = spell_tables["drain"] +spell_tables["aspir"] = spell_tables["drain"] +spell_tables["aspir"]["ga"] = spell_tables["drain"] +spell_tables["aspir"]["ra"] = spell_tables["drain"] +spell_tables["absorb"] = {"Absorb-Acc","Absorb-TP","Absorb-Attri","Absorb-STR","Absorb-DEX","Absorb-VIT","Absorb-AGI","Absorb-INT","Absorb-MND","Absorb-CHR"} +spell_tables["absorb"]["ga"] = spell_tables["absorb"] +spell_tables["absorb"]["ra"] = spell_tables["absorb"] + +local indices = { + fire = 1, + wind = 2, + thunder = 3, + light = 4, + ice = 5, + water = 6, + earth = 7, + dark = 8, +} + +function execute_spell_cast(spell_type, arg) + local current_spell_table = nil + if spell_type == nil then + current_spell_table = spell_tables[current_element] + else + current_spell_table = spell_tables[current_element][spell_type] + end + if arg == nil then arg = 1 end + arg = tonumber(arg) + if current_spell_table == nil or arg > #current_spell_table then + windower.add_to_chat(206,"Invalid Spell.") return + end + windower.chat.input("/ma \""..current_spell_table[arg].."\" <"..target_mode..">") +end + +windower.register_event("unhandled command", function (command, arg) + if command == "boom" or command == "nuke" then + execute_spell_cast(nil, arg) + elseif command == "boomga" or command == "bga" then + execute_spell_cast("ga", arg) + elseif command == "boomra" or command == "bra" then + execute_spell_cast("ra", arg) + elseif command == "boomhelix" or command == "bhelix" then + execute_spell_cast("helix", arg) + elseif command == "boomam" or command == "bam" then + execute_spell_cast("am", arg) + end +end) + +windower.register_event('addon command', function (command, arg) + + if command == "boom" or command == "nuke" then + execute_spell_cast(nil, arg) + elseif command == "boomga" or command == "bga" then + execute_spell_cast("ga", arg) + elseif command == "boomra" or command == "bra" then + execute_spell_cast("ra", arg) + elseif command == "boomhelix" or command == "bhelix" then + execute_spell_cast("helix", arg) + elseif command == "boomam" or command == "bam" then + execute_spell_cast("am", arg) + + elseif command == "target" then + if arg then + arg = string.lower(arg) + target_mode = arg + else + targets_index = targets_index % #targets + 1 + target_mode = targets[targets_index] + end + windower.add_to_chat(206,"Target Mode is now: "..target_mode) + + elseif command == "element" or command == "mode" then + arg = string.lower(arg) + if elements:contains(arg) or other_modes:contains(arg) then + current_element = arg + windower.add_to_chat(206,"Element Mode is now: "..string.ucfirst(current_element)) + else + windower.add_to_chat(206,"Invalid element") + end + + elseif command == "cycle" then + if arg then + arg = string.lower(arg) + end + if arg == nil then + if not elements:contains(current_element) then + elements_index = 1 + else + elements_index = indices[current_element] + elements_index = elements_index % 8 + 1 + end + current_element = elements[elements_index] + elseif arg == "back" then + if not elements:contains(current_element) then + elements_index = 1 + else + elements_index = indices[current_element] + elements_index = elements_index - 1 + end + if elements_index < 1 then + elements_index = 8 + end + current_element = elements[elements_index] + elseif arg == "dark" then + if not elements_dark:contains(current_element) then + elements_index = 1 + else + elements_index = elements_index % 4 + 1 + end + current_element = elements_dark[elements_index] + elseif arg == "light" then + if not elements_light:contains(current_element) then + elements_index = 1 + else + elements_index = elements_index % 4 + 1 + end + current_element = elements_light[elements_index] + elseif arg == "fusion" or "fus" then + if current_element ~= "fire" and current_element ~= "light" then + current_element = "fire" + elseif current_element == "fire" then + current_element = "light" + elseif current_element == "light" then + current_element = "fire" + end + elseif arg == "distortion" or arg == "dist" then + if current_element ~= "ice" and current_element ~= "water" then + current_element = "ice" + elseif current_element == "ice" then + current_element = "water" + elseif current_element == "water" then + current_element = "ice" + end + elseif arg == "gravitation" or arg == "grav" then + if current_element ~= "earth" and current_element ~= "dark" then + current_element = "earth" + elseif current_element == "earth" then + current_element = "dark" + elseif current_element == "dark" then + current_element = "earth" + end + elseif arg == "fragmentation" or arg == "frag" then + if current_element ~= "thunder" and current_element ~= "wind" then + current_element = "thunder" + elseif current_element == "thunder" then + current_element = "wind" + elseif current_element == "wind" then + current_element = "thunder" + end + end + windower.add_to_chat(206, "Element Mode is now: "..string.ucfirst(current_element)) + elseif command == "show" or command == "current" or command == "showcurrent" then + windower.add_to_chat(206, "----- Element Mode: "..string.ucfirst(current_element).." --- Target Mode: < "..target_mode.." > -----") + end +end) diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/readme.md b/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/readme.md new file mode 100644 index 0000000..1d92b7b --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/EasyNuke/readme.md @@ -0,0 +1,81 @@ +EasyNuke provides universal commands for casting single target and area of effect BLM and GEO nukes, and WHM cures. + +Commands: + +#### element XXX +* Changes current element mode to XXX. + * EX: //ez element ice <<<< Sets mode to ice. + * Macro usage: /con ez element XXX + * Valid arguments: Fire, Wind, Thunder, Light, Ice, Water, Earth, Dark, Drain, Aspir, Absorb, Cure + * Cure Mode: Follows standard single/ga/ra pattern and usage + * Drain and Aspir Mode: Aspir, Aspir II, Aspir III, Drain, Drain II, Drain III + * Absorb Mode: Absorb-Acc, Absorb-TP, Absorb-Attri, Absorb-STR, Absorb-DEX, Absorb-VIT, Absorb-AGI, Absorb-INT, Absorb-MND, Absorb-CHR + * EX: //ez element absorb >>> //ez boom 4 <<<< Casts Absorb-STR + * Macro usage: /con ez element XXX + +#### cycle +* Cycles through element modes in the following left-to-right order: Fire, Wind, Thunder, Light, Ice, Water, Earth, Dark + * EX: //ez cycle <<<< If you were in Light mode, then you will change to Ice mode. + * Macro usage: /con ez cycle + +#### cycle back +* Same as "cycle", but goes in right-to-left order. + * EX: //ez cycle back <<<< If you were in Light mode, then you will change to Thunder mode. + * Macro usage: /con ez cycle back + +#### cycle dark +* Cycles through element modes in the following order: Ice, Water, Earth, Dark + * EX: //ez cycle dark <<<< If you were in Dark mode, then you will change to Ice mode. + * Macro usage: /con ez cycle dark + +#### cycle light +* Cycles through element modes in the following order: Fire, Wind, Thunder, Light + * EX: //ez cycle light <<<< If you were in Light mode, then you will change to Fire mode. + * Macro usage: /con ez cycle light + +#### cycle XXX +* Cycles between the two elements of a T2 skillchain. + * Valid commands: Elements included + * Fusion, Fus: Fire, Light + * Fragmentation, Frag: Thunder, Wind + * Distortion, Dist: Ice, Water + * Gravitation, Grav: Earth, Dark + * EX: //ez cycle dist <<<< If you were in Ice mode, will change you to Water mode. If you were in any other mode, will change you to Ice mode. + * Macro usage: /con ez cycle fragmentation + +#### target XXX +* Changes targeting mode to #. This sets what's between the < > brackets used for targeting in macros. + * EX: //ez target bt <<<< Spells will be cast using <bt>. + * There are no failsafes for this. Any given argument will be accepted, even if it does not function as a targeting argument. + * If no argument is given, then will cycle through target modes in the following order: t, bt, stnpc + * Macro usage: /con ez target # OR /con ez target + +#### showcurrent / show / current +* Echoes the current elemental and targeting modes in the chat log. + * EX: //ez showcurrent + * Macro usage: /con ez show + +#### boom XXX +* Casts a single target tierXXX nuke of the current element, and using the current targeting mode. + * EX: //ez boom 4 <<<< If Element Mode is Fire, and targeting mode is "t", you will cast Fire IV on your current target. + * EX2: //boom 6 <<<< If Element Mode is Ice, and targeting mode is "bt", you will cast Blizzard VI on the current battle target. + * Macro usage: /con ez boom # /OR/ /con boom # + +#### boomga XXX +* Casts an area of effect tierXXX nuke of the current element: BLM: -ga, -ga II, -ga III, -ja. (Also works for Curaga's while in Cure mode.) + * EX: //ez boomga 4 <<<< If Element Mode is Ice, and targeting mode is "t", will cast Blizzaja on your current target. + * EX2: //boomga 3 <<<< If Element Mode is Ice, and targeting mode is "bt", you will cast Blizzaga III on the current battle target. + * Macro usage: /con ez boomga # /OR/ /con boomga # + +#### boomra XXX +* Casts an area of effect nuke of tier XXX. GEO's -ra AOE nukes and WHM's Cura line + * EX: //ez boomra 3 <<<< If Element Mode is Ice, and mode is "bt", will cast Blizzara III on your current battle target. + * EX2: //boomra 2 <<<< If Element Mode is Cure, and mode is "me", you will cast Cura II on yourself. + * Macro usage: /con ez boomra # /OR/ /con boomra # + +#### boomhelix +* Casts the appropriate SCH Helix spell of tier XXX. + * EX: //ez boomhelix 2 <<<< If Element Mode is Ice, and target mode is "t", will cast Cryohelix II on your current target. + * EX2: //boomhelix <<<< If Element Mode is Fire, and target mode is "bt", will cast Pyrohelix on your current battle target. + * Macro usage: /con ez boomhelix # /OR/ /con boomhelix # +* Also supports a short version //bhelix # or //ez bhelix
\ No newline at end of file |