display higher hp mobs first, add ignore list filter
This commit is contained in:
+6
-1
@@ -93,7 +93,9 @@ L:RegisterTranslations("enUS", function()
|
||||
["Order applied"] = true,
|
||||
["Expiring soonest -> latest"] = true,
|
||||
["Expiring latest -> soonest"] = true,
|
||||
|
||||
["Not ignored"] = true,
|
||||
["Ignored Mobs List (Enter to save)"] = true,
|
||||
["Comma separated list of strings to ignore if found in the unit name"] = true,
|
||||
|
||||
-- spells
|
||||
["Rank"] = true,
|
||||
@@ -279,6 +281,9 @@ L:RegisterTranslations("zhCN", function()
|
||||
["Order applied"] = "应用顺序",
|
||||
["Expiring soonest -> latest"] = "即将到期->最新",
|
||||
["Expiring latest -> soonest"] = "最新->即将到期",
|
||||
["Not ignored"] = "不被忽略",
|
||||
["Ignored Mobs List (Enter to save)"] = "忽略的怪物列表(回车保存)",
|
||||
["Comma separated list of strings to ignore if found in the unit name"] = "如果在单位名称中找到,则忽略的字符串列表,用半角逗号分隔",
|
||||
|
||||
-- spells
|
||||
["Rank"] = "等级",
|
||||
|
||||
@@ -124,3 +124,10 @@ All commands will ignore targets with the following CCs on them:
|
||||
|
||||
Multicurse will only ever target enemies that are already in combat (except if you target a mob directly first) to
|
||||
prevent pulling things you didn't intend like marked patrols.
|
||||
|
||||
Mobs with raid marks or your current target will be displayed first.
|
||||
|
||||
Mobs will higher max hp will be displayed first before lower max hp mobs. The way this works to improve performance is that it just calculates the average max hp of active mobs and displays anything over the average first.
|
||||
|
||||
You can ignore mobs based on their unit name using the ignored mob list filter. It is comma separated and you need to press enter to get it to save. For example can do:
|
||||
`whelp,scarab` to ignore all mobs with those strings in their name.
|
||||
|
||||
+23
-1
@@ -2,7 +2,8 @@ if not Cursive.superwow then
|
||||
return
|
||||
end
|
||||
|
||||
local filter = {}
|
||||
local filter = {
|
||||
}
|
||||
|
||||
filter.attackable = function(unit)
|
||||
return UnitCanAttack("player", unit) and true or false
|
||||
@@ -51,6 +52,23 @@ filter.hostile = function(unit)
|
||||
return UnitIsEnemy("player", unit) and true or false
|
||||
end
|
||||
|
||||
filter.notignored = function(unit)
|
||||
if not Cursive.db.profile.ignorelist or table.getn(Cursive.db.profile.ignorelist) == 0 then
|
||||
return true
|
||||
end
|
||||
|
||||
local unitName = UnitName(unit)
|
||||
if not unitName then
|
||||
return true
|
||||
end
|
||||
for _, str in ipairs(Cursive.db.profile.ignorelist) do
|
||||
if string.find(string.lower(unitName), string.lower(str)) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
Cursive.filter = filter
|
||||
|
||||
function Cursive:ShouldDisplayGuid(guid)
|
||||
@@ -107,5 +125,9 @@ function Cursive:ShouldDisplayGuid(guid)
|
||||
shouldDisplay = shouldDisplay and filter.player(guid)
|
||||
end
|
||||
|
||||
if Cursive.db.profile.filterignored then
|
||||
shouldDisplay = shouldDisplay and filter.notignored(guid)
|
||||
end
|
||||
|
||||
return shouldDisplay
|
||||
end
|
||||
|
||||
@@ -40,6 +40,9 @@ Cursive:RegisterDefaults("profile", {
|
||||
filterrange = false,
|
||||
filterraidmark = false,
|
||||
filterhascurse = false,
|
||||
filterignored = true,
|
||||
|
||||
ignorelist = {},
|
||||
})
|
||||
|
||||
local barOptions = {
|
||||
@@ -334,6 +337,38 @@ local mobFilters = {
|
||||
Cursive.db.profile.filterhascurse = v
|
||||
end,
|
||||
},
|
||||
["notignored"] = {
|
||||
type = "toggle",
|
||||
name = L["Not ignored"],
|
||||
desc = L["Not ignored"],
|
||||
order = 67,
|
||||
get = function()
|
||||
return Cursive.db.profile.filterignored
|
||||
end,
|
||||
set = function(v)
|
||||
Cursive.db.profile.filterignored = v
|
||||
end,
|
||||
},
|
||||
["ignorelist"] = {
|
||||
type = "text",
|
||||
name = L["Ignored Mobs List (Enter to save)"],
|
||||
desc = L["Comma separated list of strings to ignore if found in the unit name"],
|
||||
usage = "whelp, black dragonkin, player3",
|
||||
order = 68,
|
||||
get = function()
|
||||
if Cursive.db.profile.ignorelist and table.getn(Cursive.db.profile.ignorelist) > 0 then
|
||||
return table.concat(Cursive.db.profile.ignorelist, ",") or ""
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
set = function(v)
|
||||
if not v or v == "" then
|
||||
Cursive.db.profile.ignorelist = {}
|
||||
else
|
||||
Cursive.db.profile.ignorelist = string.split(v, ",");
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Cursive.cmdtable = {
|
||||
|
||||
@@ -524,7 +524,7 @@ ui:SetScript("OnUpdate", function()
|
||||
if (this.tick or 1) > GetTime() then
|
||||
return
|
||||
else
|
||||
this.tick = GetTime() + .1
|
||||
this.tick = GetTime() + 0.1
|
||||
end
|
||||
|
||||
if not ui.rootBarFrame then
|
||||
@@ -543,14 +543,38 @@ ui:SetScript("OnUpdate", function()
|
||||
local col = 1
|
||||
local maxBarsDisplayed = false
|
||||
|
||||
for i = 1, 2 do
|
||||
local totalMaxHp = 0
|
||||
local numDisplayed = 0
|
||||
|
||||
local averageMaxHp = 0
|
||||
|
||||
local consideredGuids = {};
|
||||
|
||||
local _, currentTargetGuid = UnitExists("target")
|
||||
|
||||
for i = 1, 3 do
|
||||
if i == 2 then
|
||||
-- calculate average max hp
|
||||
if numDisplayed > 0 then
|
||||
averageMaxHp = math.floor(totalMaxHp / numDisplayed)
|
||||
end
|
||||
end
|
||||
|
||||
for guid, time in pairs(Cursive.core.guids) do
|
||||
-- apply filters
|
||||
local shouldDisplay = Cursive:ShouldDisplayGuid(guid)
|
||||
|
||||
local hasIcon = filter.icon(guid)
|
||||
local hasIcon = filter.icon(guid) or currentTargetGuid == guid
|
||||
|
||||
if (i == 1 and hasIcon) or (i == 2 and not hasIcon) then
|
||||
if (i == 1 and shouldDisplay) then
|
||||
totalMaxHp = totalMaxHp + UnitHealthMax(guid)
|
||||
numDisplayed = numDisplayed + 1
|
||||
end
|
||||
|
||||
if (i == 1 and hasIcon) or
|
||||
(i == 2 and not hasIcon and UnitHealthMax(guid) >= averageMaxHp) or
|
||||
(i == 3 and not consideredGuids[guid]) then
|
||||
consideredGuids[guid] = true
|
||||
-- display element if filters allow it
|
||||
if shouldDisplay and not maxBarsDisplayed then
|
||||
-- display guid
|
||||
|
||||
Reference in New Issue
Block a user