I was writing this big long post to Byrth and Mote this morning about how I was trying to do an includes file for my mages (BLM, SCH, GEO) to consolidate updates in gear and it wasn't working. I tried for hours last night and went to sleep frustrated. I was going to ask for help, but when I was typing my big long post I realized that I never returned the table from the include file...
If you are interested, I added a get_spell_element_mappings() method to your include Mote.
Code:
function _MageInclude.get_spell_element_mappings()
local mappings = T{
['Fire'] = { ['Helix'] = 'Pyrohelix', ['Storm'] = 'Firestorm', ['Single Target'] = 'Fire', ['Ancient Magic'] = 'Flare', ['AOE Target'] = 'Firaga', ['AOE JA'] = 'Firaja', ['AOE Self'] = 'Fira' },
['Earth'] = { ['Helix'] = 'Geohelix', ['Storm'] = 'Sandstorm', ['Single Target'] = 'Stone', ['Ancient Magic'] = 'Quake', ['AOE Target'] = 'Stonega', ['AOE JA'] = 'Stoneja', ['AOE Self'] = 'Stonara' },
['Water'] = { ['Helix'] = 'Hydrohelix', ['Storm'] = 'Rainstorm', ['Single Target'] = 'Water', ['Ancient Magic'] = 'Flood', ['AOE Target'] = 'Waterga', ['AOE JA'] = 'Waterja', ['AOE Self'] = 'Watera' },
['Wind'] = { ['Helix'] = 'Anemohelix', ['Storm'] = 'Windstorm', ['Single Target'] = 'Aero', ['Ancient Magic'] = 'Tornado', ['AOE Target'] = 'Aeroga', ['AOE JA'] = 'Aeroja', ['AOE Self'] = 'Aerora' },
['Ice'] = { ['Helix'] = 'Cryohelix', ['Storm'] = 'Hailstorm', ['Single Target'] = 'Blizzard', ['Ancient Magic'] = 'Freeze', ['AOE Target'] = 'Blizzaga', ['AOE JA'] = 'Blizzaja', ['AOE Self'] = 'Blizzara' },
['Thunder'] = { ['Helix'] = 'Ionohelix', ['Storm'] = 'Thunderstorm', ['Single Target'] = 'Thunder', ['Ancient Magic'] = 'Burst', ['AOE Target'] = 'Thundaga', ['AOE JA'] = 'Thundaja', ['AOE Self'] = 'Thundara' },
['Light'] = { ['Helix'] = 'Geohelix', ['Storm'] = 'Sandstorm', ['Single Target'] = 'Stone', ['Ancient Magic'] = 'Quake', ['AOE Target'] = 'Stonega', ['AOE JA'] = 'Stoneja', ['AOE Self'] = 'Stonara' },
['Dark'] = { ['Helix'] = 'Geohelix', ['Storm'] = 'Sandstorm', ['Single Target'] = 'Stone', ['Ancient Magic'] = 'Quake', ['AOE Target'] = 'Stonega', ['AOE JA'] = 'Stoneja', ['AOE Self'] = 'Stonara' }
}
if world.area:find('(U)') then
mappings[world.day_element] = mappings['Fire']
end
return mappings
end
And then I added this to the self_command method
Code:
function _MageInclude.self_command(command)
cmd = command:split(' ')
if T{'helix', 'storm', 'st', 'aoet', 'aoeja', 'aoes'}:contains(cmd[1].lower() then
spell_type = ''
tier = 0
if cmd[1].lower() == 'helix' then
spell_type = 'Helix'
elseif cmd[1].lower() == 'storm' then
spell_type = 'Storm'
elseif cmd[1].lower() == 'st' then
spell_type = 'Single Target'
tier = cmd[2] or 1
elseif cmd[1].lower() == 'aoet' then
spell_type = 'AOE Target'
tier = cmd[2] or 3
elseif cmd[1].lower() == 'aoeja' then
spell_type = 'AOE JA'
elseif cmd[1].lower() == 'aoes' then
spell_type = 'AOE Self'
tier = cmd[2] or 2
end
cast_mapped_spell(spell_type, tier)
end
end
function _MageInclude.cast_mapped_spell(spell_type, tier)
if spellmappings.element[world.day_element]:contains(spell_type) then
command = spellmappings.element[world.day_element][spell_type]
if spell_type == 'Storm' or spell_type == 'Helix' then
command = command .. ' me'
elseif spell_type == 'AOE JA' then
command = command .. ' t'
elseif spell_type == 'Single Target' then
if T{2,3,4,5}:contains(tier) then
command = command .. tier
elseif not tier == 1 then
windower.add_to_chat(123, 'Invalid Tier passed to function for spell type ' .. spell_type .. '. Defaulting to tier 1.')
end
command = command .. ' t'
elseif spell_type == 'Ancient Magic' then
if tier == 2 then
command = command .. tier
elseif not tier == 1 then
windower.add_to_chat(123, 'Invalid Tier passed to function for spell type ' .. spell_type .. '. Defaulting to tier 2.')
command = command .. '2'
end
command = command .. ' t'
elseif spell_type == 'AOE Target' then
if T{2,3}:contains(tier) then
command = command .. tier
elseif not tier == 1 then
windower.add_to_chat(123, 'Invalid Tier passed to function for spell type ' .. spell_type .. '. Defaulting to tier 3.')
command = command .. '3'
end
command = command .. ' t'
elseif spell_type == 'AOE Self'
if tier == 2 then
command = command .. tier
elseif not tier == 1 then
windower.add_to_chat(123, 'Invalid Tier passed to function for spell type ' .. spell_type .. '. Defaulting to tier 2.')
command = command .. '2'
end
command = command .. ' me'
end
windower.send_command(command)
end
end