Code:
-----------------------------
-- Spell control --
-----------------------------
cities = S{"Ru'Lude Gardens","Upper Jeuno","Lower Jeuno","Port Jeuno","Port Windurst","Windurst Waters","Windurst Woods","Windurst Walls","Heavens Tower",
"Port San d'Oria","Northern San d'Oria","Southern San d'Oria","Chateau d'Oraguille","Port Bastok","Bastok Markets","Bastok Mines","Metalworks",
"Aht Urhgan Whitegate","Tavnazian Safehold","Nashmau","Selbina","Mhaura","Norg","Eastern Adoulin","Western Adoulin","Kazham"}
transportation_spells = S{'Escape','Recall-Jugner','Recall-Meriph','Recall-Pashh','Retrace','Teleport-Altep','Teleport-Dem','Teleport-Holla','Teleport-Mea',
'Teleport-Vahzl','Teleport-Yhoat','Warp','Warp II'}
unusable_buff = {spell={'Charm','Mute','Omerta','Petrification','Silence','Sleep','Stun','Terror'},
ability={'Amnesia','Charm','Impairment','Petrification','Sleep','Stun','Terror'}}
--check_recast('ability',spell.recast_id) check_recast('spell',spell.recast_id)
function check_recast(typ,id) --if spell can be cast(not in recast) return true
local recasts = windower.ffxi['get_'..typ..'_recasts']()
if id and recasts[id] and recasts[id] == 0 then
return true
else
return false
end
end
--return true if spell is unable to be cast at this time
function spell_stopper(spell)
--Stops spell if your in mog house
if world.in_mog_house or world.mog_house then
return true
elseif spell.type == "Item" then
return false
--Stops spell if you do not have a target
elseif spell.target.name == nil and not spell.target.raw:contains("st") then
return true
--Stops spell if a blocking buff is active
elseif spell.action_type == 'Ability' and (has_any_buff_of(unusable_buff.ability) or not check_recast('ability',spell.recast_id)) then
return true
elseif spell.action_type == 'Magic' and (has_any_buff_of(unusable_buff.spell)
or not check_recast('spell',spell.recast_id)) then
return true
--Stops spell if you do not have enuf mp/tp to use
elseif spell.tp_cost and spell.tp_cost > player.tp then
return true
elseif spell.mp_cost and spell.mp_cost > player.mp and not has_any_buff_of({'Manawell','Manafont'}) then
return true
elseif spell.type == 'WeaponSkill' and player.tp < 1000 then
return true
--Stops all spells but teleport spells in cities
elseif not transportation_spells:contains(spell.en) and cities:contains(world.area) then
return true
end
--Calculate how many finishin moves your char has up to 6
local fm_count = 0
for i, v in pairs(buffactive) do
if tostring(i):startswith('finishing move') or tostring(i):startswith('フィニシングムーブ') then
fm_count = tonumber(string.match(i, '%d+')) or 1
end
end
--Stops flourishes if you do not have enuf finishin moves
local min_fm_for_flourishes = {['Animated Flourish']=1,['Desperate Flourish']=1,['Violent Flourish']=1,['Reverse Flourish']=1,['Building Flourish']=1,
['Wild Flourish']=2,['Climactic Flourish']=1,['Striking Flourish']=2,['Ternary Flourish']=3,}
if min_fm_for_flourishes[spell.en] then
if min_fm_for_flourishes[spell.en] > fm_count and not buffactive[507] then
return true
end
end
--Reomves Sneak when casting Spectral Jig
if spell.en == 'Spectral Jig' then
send_command('cancel 71')
end
if spell.name == 'Utsusemi: Ichi' and overwrite and buffactive['Copy Image (3)'] then
return true
end
if spell.type == 'WeaponSkill' and (player.target and player.target.distance and player.target.distance > 8) then
msg("Weapon Skill Canceled Target Out of Range")
return true
end
end
also here is a good piece of advice