Skip to content

Commit

Permalink
Add priority as a selector for mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mbattersby committed Feb 12, 2025
1 parent 8bb3c91 commit 635977a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Mount.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ function LM.Mount.FilterToDisplay(f)
else
return TYPE .. " : " .. id
end
elseif f:match('^prio:%d+$') then
local _, p = string.split(':', f, 2)
return L.LM_PRIORITY .. " : " .. p
elseif LM.Options:IsGroup(f) then
return L.LM_GROUP .. ' : ' .. f
elseif LM.Options:IsFlag(f) then
Expand Down Expand Up @@ -126,6 +129,8 @@ function LM.Mount:MatchesOneFilter(flags, groups, f)
return self.mountTypeID == tonumber(f:sub(4))
elseif f:sub(1, 7) == 'family:' then
return ( self.family == f:sub(8) or L[self.family] == f:sub(8) )
elseif f:sub(1, 5) == 'prio:' then
return self:GetPriority() == tonumber(f:sub(6))
elseif f:sub(1, 1) == '~' then
return not self:MatchesOneFilter(flags, groups, f:sub(2))
elseif flags[f] ~= nil then
Expand Down
5 changes: 5 additions & 0 deletions UI/RuleEdit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ local function MountToInfo(m) return { val = m.spellID, text = m.name } end
local function GroupToInfo(v) return { val = v, text = LM.UIFilter.GetGroupText(v) } end
local function FlagToInfo(v) return { val = v, text = LM.UIFilter.GetFlagText(v) } end
local function FamilyToInfo(v) return { val = "family:"..v, text = LM.UIFilter.GetFamilyText(v) } end
local function PriorityToInfo(v) return { val = "prio:"..v, text = LM.UIFilter.GetPriorityText(v) } end
local function TypeToInfo(v) return { val = "mt:"..v, text = LM.UIFilter.GetTypeText(v) } end

local function MountArgsMenu()
Expand All @@ -322,13 +323,17 @@ local function MountArgsMenu()
local flagMenuList = LM.tMap(LM.UIFilter.GetFlags(), FlagToInfo)
flagMenuList.text = TYPE

local priorityMenuList = LM.tMap(LM.UIFilter.GetPriorities(), PriorityToInfo)
priorityMenuList.text = L.LM_PRIORITY

local mountMenuList = { text=MOUNT, val="PICKER" }

return {
nosort = true,
mountMenuList,
groupMenuList,
flagMenuList,
priorityMenuList,
-- typeMenuList,
-- familyMenuList,
{ val = "FAVORITES", text = FAVORITES:upper() },
Expand Down

0 comments on commit 635977a

Please sign in to comment.