Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions addons/GearSwap/helper_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,30 @@ function spell_complete(rline)
return rline
end

-----------------------------------------------------------------------------------
--Name: find_monster_skill(abil)
--Desc: Takes a monster ability name and finds the corresponding monster_skills
-- resource line for the player's current species
--Args:
---- abil - ability name
-----------------------------------------------------------------------------------
--Returns:
---- rline - resource line
-----------------------------------------------------------------------------------
function find_monster_skill(abil)
local rline = false
if player.species and player.species.tp_moves then
-- Iterates over currently available monster TP moves instead of using validabils
for i, v in pairs(player.species.tp_moves) do
if res.monster_skills[i][language]:lower() == abil then
rline = copy_entry(res.monster_skills[i])
break
end
end
end
return rline
end

-----------------------------------------------------------------------------------
--Name: logit()
--Args:
Expand Down
19 changes: 1 addition & 18 deletions addons/GearSwap/triggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ windower.register_event('outgoing text', function(original, modified)
return modified
end

local abil
local abil, r_line
local r_name = res_prefix_map[unified_prefix]
local targ = splitline[3]
if unified_prefix == '/ra' then
Expand Down Expand Up @@ -99,23 +99,6 @@ windower.register_event('outgoing text', function(original, modified)

refresh_globals()

local r_line, find_monster_skill

function find_monster_skill(abil)
local line = false
if player.species and player.species.tp_moves then
-- Iterates over currently available monster TP moves instead of using validabils
for i, v in pairs(player.species.tp_moves) do
if res.monster_skills[i][language]:lower() == abil then
line = copy_entry(res.monster_skills[i])
break
end
end
end
return line
end


if unified_prefix == '/ms' then
r_line = find_monster_skill(abil)
else
Expand Down