So.. A couple lsmates and I are working on making an addon which simplifies/unifies BLM nukes to single commands.
TBH, it's more like I explained what I wanted to do a few days ago, and they took off running with the idea.^^;;
The basics:
1) Set element mode by direct command or cycling thru elements.
2) Addon command like.. "//nuke3" casts a T3 nuke of the current element. Will also have aoe versions like "//nukega2" which does the same for aoe nukes.
The other guys working on this are professional programmers, but aren't too familiar with the LUA language, so we have that much running, but we've run into a snag. We'd like to include the functionality from a GS include that I made which handles spell degradation, (bumps your cast down a tier if the one you call for is on cooldown or you don't have enough MP to cast it,) but none of us are familiar enough w/ the language to easily convert GS code > addon code. Are there any good resources/documentation on how to do so? How much of GS syntax is tied directly to GS and is going to be difficult to replicate as a stand-alone addon?
I know that we could just include the include file with instructions on how to use it, but this has become a learning experience for us and want to know how to do what we want to do. ^^
My Dnc.lua has something like that for curing waltz, auto-casts what level of cure to do for the amount needed. and if i don't have enough tp it downgrades it.
-------------------------------------------------------------------------------------------------------------------
-- Utility functions for changing spells and target types in an automatic manner.
-------------------------------------------------------------------------------------------------------------------
local waltz_tp_cost = {['Curing Waltz'] = 200, ['Curing Waltz II'] = 350, ['Curing Waltz III'] = 500, ['Curing Waltz IV'] = 650, ['Curing Waltz V'] = 800}
-- Utility function for automatically adjusting the waltz spell being used to match HP needs and TP limits.
-- Handle spell changes before attempting any precast stuff.
function refine_waltz(spell, action, spellMap, eventArgs)
if spell.type ~= 'Waltz' then
return
end
-- Don't modify anything for Healing Waltz or Divine Waltzes
if spell.english == "Healing Waltz" or spell.english == "Divine Waltz" or spell.english == "Divine Waltz II" then
return
end
local newWaltz = spell.english
local waltzID
local missingHP
-- If curing ourself, get our exact missing HP
if spell.target.type == "SELF" then
missingHP = player.max_hp - player.hp
-- If curing someone in our alliance, we can estimate their missing HP
elseif spell.target.isallymember then
local target = find_player_in_alliance(spell.target.name)
local est_max_hp = target.hp / (target.hpp/100)
missingHP = math.floor(est_max_hp - target.hp)
end
-- If we have an estimated missing HP value, we can adjust the preferred tier used.
if missingHP ~= nil then
if player.main_job == 'DNC' then
if missingHP < 40 and spell.target.name == player.name then
-- Not worth curing yourself for so little.
-- Don't block when curing others to allow for waking them up.
add_to_chat(122,'Full HP!')
eventArgs.cancel = true
return
elseif missingHP < 200 then
newWaltz = 'Curing Waltz'
waltzID = 190
elseif missingHP < 600 then
newWaltz = 'Curing Waltz II'
waltzID = 191
elseif missingHP < 1100 then
newWaltz = 'Curing Waltz III'
waltzID = 192
elseif missingHP < 1500 then
newWaltz = 'Curing Waltz IV'
waltzID = 193
else
newWaltz = 'Curing Waltz V'
waltzID = 311
end
elseif player.sub_job == 'DNC' then
if missingHP < 40 and spell.target.name == player.name then
-- Not worth curing yourself for so little.
-- Don't block when curing others to allow for waking them up.
add_to_chat(122,'Full HP!')
eventArgs.cancel = true
return
elseif missingHP < 150 then
newWaltz = 'Curing Waltz'
waltzID = 190
elseif missingHP < 300 then
newWaltz = 'Curing Waltz II'
waltzID = 191
else
newWaltz = 'Curing Waltz III'
waltzID = 192
end
else
-- Not dnc main or sub; bail out
return
end
end
local tpCost = waltz_tp_cost[newWaltz]
local downgrade
-- Downgrade the spell to what we can afford
if player.tp < tpCost and not buffactive.trance then
--[[ Costs:
Curing Waltz: 200 TP
Curing Waltz II: 350 TP
Curing Waltz III: 500 TP
Curing Waltz IV: 650 TP
Curing Waltz V: 800 TP
Divine Waltz: 400 TP
Divine Waltz II: 800 TP
--]]
if player.tp < 200 then
add_to_chat(122, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
eventArgs.cancel = true
return
elseif player.tp < 350 then
newWaltz = 'Curing Waltz'
elseif player.tp < 500 then
newWaltz = 'Curing Waltz II'
elseif player.tp < 650 then
newWaltz = 'Curing Waltz III'
elseif player.tp < 800 then
newWaltz = 'Curing Waltz IV'
end
downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
end
if newWaltz ~= spell.english then
send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
if downgrade then
add_to_chat(122, downgrade)
end
eventArgs.cancel = true
return
end
if missingHP and missingHP > 0 then
add_to_chat(122,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
end
end