add ability to choose curse ordering
This commit is contained in:
+11
-3
@@ -73,6 +73,10 @@ L:RegisterTranslations("enUS", function()
|
||||
["Max Curses"] = true,
|
||||
["Max Rows"] = true,
|
||||
["Max Columns"] = true,
|
||||
["Curse Ordering"] = true,
|
||||
["Order applied"] = true,
|
||||
["Expiring soonest -> latest"] = true,
|
||||
["Expiring latest -> soonest"] = true,
|
||||
|
||||
|
||||
-- spells
|
||||
@@ -141,7 +145,7 @@ L:RegisterTranslations("enUS", function()
|
||||
["Deadly Poison V"] = true,
|
||||
|
||||
-- shaman
|
||||
["Flame Shock"] = true,
|
||||
["Flame Shock"] = true,
|
||||
|
||||
-- warlock
|
||||
["Conflagrate"] = true,
|
||||
@@ -234,6 +238,10 @@ L:RegisterTranslations("zhCN", function()
|
||||
["Max Curses"] = "最大诅咒数",
|
||||
["Max Rows"] = "最大行数",
|
||||
["Max Columns"] = "最大列数",
|
||||
["Curse Ordering"] = "诅咒排序",
|
||||
["Order applied"] = "应用顺序",
|
||||
["Expiring soonest -> latest"] = "即将到期->最新",
|
||||
["Expiring latest -> soonest"] = "最新->即将到期",
|
||||
|
||||
-- spells
|
||||
["Rank 1"] = "等级 1",
|
||||
@@ -292,7 +300,7 @@ L:RegisterTranslations("zhCN", function()
|
||||
["Blind"] = "致盲",
|
||||
["Sap"] = "闷棍",
|
||||
["Gouge"] = "凿击",
|
||||
["Expose Armor"] = "破甲", -- no idea if right
|
||||
["Expose Armor"] = "破甲", -- no idea if right
|
||||
["Garrote"] = "锁喉", -- no idea if right
|
||||
["Deadly Poison"] = "致命毒药", -- no idea if right
|
||||
["Deadly Poison II"] = "致命毒药 II",
|
||||
@@ -301,7 +309,7 @@ L:RegisterTranslations("zhCN", function()
|
||||
["Deadly Poison V"] = "致命毒药 V",
|
||||
|
||||
-- shaman
|
||||
["Flame Shock"] = "烈焰震击", -- no idea if right
|
||||
["Flame Shock"] = "烈焰震击", -- no idea if right
|
||||
|
||||
-- warlock
|
||||
["Conflagrate"] = "引燃", -- no idea if right
|
||||
|
||||
@@ -31,6 +31,8 @@ Cursive:RegisterDefaults("profile", {
|
||||
maxcol = 1,
|
||||
textsize = 9,
|
||||
|
||||
curseordering = L["Order applied"],
|
||||
|
||||
filterincombat = true,
|
||||
filterhostile = true,
|
||||
filterattackable = true,
|
||||
@@ -164,6 +166,18 @@ local barOptions = {
|
||||
end
|
||||
end,
|
||||
},
|
||||
["curseordering"] = {
|
||||
type = "text",
|
||||
name = L["Curse Ordering"],
|
||||
desc = L["Curse Ordering"],
|
||||
get = function()
|
||||
return Cursive.db.profile.curseordering
|
||||
end,
|
||||
validate = { L["Order applied"], L["Expiring soonest -> latest"], L["Expiring latest -> soonest"] },
|
||||
set = function(v)
|
||||
Cursive.db.profile.curseordering = v
|
||||
end,
|
||||
},
|
||||
["spacing"] = {
|
||||
type = "range",
|
||||
name = L["Spacing"],
|
||||
|
||||
@@ -2,6 +2,8 @@ if not Cursive.superwow then
|
||||
return
|
||||
end
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("Cursive")
|
||||
|
||||
local utils = Cursive.utils
|
||||
local filter = Cursive.filter
|
||||
|
||||
@@ -401,6 +403,38 @@ local function GetBarCords(row, col)
|
||||
return x, y
|
||||
end
|
||||
|
||||
local function GetSortedCurses(guidCurses)
|
||||
-- Collect keys
|
||||
local curseNames = {}
|
||||
for key in pairs(guidCurses) do
|
||||
table.insert(curseNames, key)
|
||||
end
|
||||
|
||||
if Cursive.db.profile.curseordering == L["Order applied"] then
|
||||
table.sort(curseNames, function(a, b)
|
||||
return guidCurses[a].start < guidCurses[b].start
|
||||
end)
|
||||
elseif Cursive.db.profile.curseordering == L["Expiring soonest -> latest"] then
|
||||
table.sort(curseNames, function(a, b)
|
||||
return Cursive.curses:TimeRemaining(guidCurses[a]) < Cursive.curses:TimeRemaining(guidCurses[b])
|
||||
end)
|
||||
elseif Cursive.db.profile.curseordering == L["Expiring latest -> soonest"] then
|
||||
table.sort(curseNames, function(a, b)
|
||||
return Cursive.curses:TimeRemaining(guidCurses[a]) > Cursive.curses:TimeRemaining(guidCurses[b])
|
||||
end)
|
||||
end
|
||||
|
||||
-- Iterator function
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
local key = curseNames[i]
|
||||
if key then
|
||||
return key, guidCurses[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function DisplayGuid(guid, row, col)
|
||||
local unitFrame = ui.unitFrames[guid] or CreateBar(guid)
|
||||
|
||||
@@ -425,7 +459,7 @@ local function DisplayGuid(guid, row, col)
|
||||
|
||||
local guidCurses = Cursive.curses.guids[guid]
|
||||
if guidCurses then
|
||||
for curseName, curseData in pairs(guidCurses) do
|
||||
for curseName, curseData in GetSortedCurses(guidCurses) do
|
||||
if curseNumber > Cursive.db.profile.maxcurses then
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user