Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = aura_env.config
- local allTypes = {
- "INTERRUPT",
- "HARDCC", "STHARDCC",
- "SOFTCC", "STSOFTCC",
- "DISPEL", "DEFMDISPEL",
- "EXTERNAL", "HEALING",
- "UTILITY",
- "PERSONAL", "IMMUNITY",
- "DAMAGE",
- "TANK"
- }
- aura_env.types = {}
- for _,type in ipairs(allTypes) do
- if config["enabled"..type] then
- aura_env.types[type] = true
- end
- end
- local prioritizedSpellIDs = {
- [183752] = true, -- Disrupt
- }
- local sortVars = {}
- local sortVarsIndex = {}
- for v = 1,5 do
- local var = config["sortVar"..v]
- if var and var ~= 1 then
- if not sortVarsIndex[var] then
- local index = #sortVars + 1
- sortVars[index] = var
- sortVarsIndex[var] = index
- end
- end
- end
- local isAvail = (config["sortOrder"] == 1) and 0 or 1
- local isUnavail = (config["sortOrder"] == 1) and 1 or 0
- aura_env.initSortIndex = function(state)
- state.sortValues = {}
- for index,var in ipairs(sortVars) do
- if var == 2 then -- Type Priority
- local priority = config["priority"..state.type]
- if config["sortOrder"] == 2 then
- priority = 99 - priority
- end
- state.sortValues[index] = ("%02d"):format(priority)
- elseif var == 3 then -- Spell ID
- state.sortValues[index] = ("%06d"):format(state.spellId)
- elseif var == 4 then -- Member Class
- state.sortValues[index] = ("%02d"):format(state.member.classID)
- elseif var == 5 then -- Member Name
- state.sortValues[index] = ("%-12s"):format(state.member.name)
- elseif var == 6 then -- Availability
- local availValue = isAvail
- local isPrioritized = prioritizedSpellIDs[state.spellId]
- local timeValue = state.duration - (isPrioritized and 0.001 or 0)
- if config["sortOrder"] == 2 then
- timeValue = 9999999999.999 - timeValue
- end
- state.sortValues[index] = ("%d%010.3f"):format(availValue, timeValue)
- end
- end
- state.index = table.concat(state.sortValues)
- end
- aura_env.updateSortIndex = function(state)
- local index = sortVarsIndex[6]
- if index then
- local prevSortValue = state.sortValues[index]
- local isPrioritized = prioritizedSpellIDs[state.spellId]
- local availValue
- local timeValue
- if state.stacks then
- if state.stacks > 0 then
- availValue = isAvail
- timeValue = state.duration - (isPrioritized and 0.001 or 0)
- else
- availValue = isUnavail
- timeValue = state.expirationTime
- end
- elseif state.expirationTime > GetTime() then
- availValue = isUnavail
- timeValue = state.expirationTime
- else
- availValue = isAvail
- timeValue = state.duration - (isPrioritized and 0.001 or 0)
- end
- if config["sortOrder"] == 2 then
- timeValue = 9999999999.999 - timeValue
- end
- state.sortValues[index] = ("%d%010.3f"):format(availValue, timeValue)
- if state.sortValues[index] ~= prevSortValue then
- state.index = table.concat(state.sortValues)
- return true
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement