Skip to content

Commit

Permalink
Add support in auto bar groups for new cast by setting that includes …
Browse files Browse the repository at this point in the history
…only casters other than player, pet or target
  • Loading branch information
Tojaso committed Apr 21, 2021
1 parent 033b0ad commit 3952919
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Bars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1480,12 +1480,15 @@ end

-- Compare caster to enforce "cast by" restrictions
function MOD:CheckCastBy(caster, cb)
local isMine, isPet = (caster == "player"), (caster == "pet")
local isMine = (caster == "player")
local isPet = (caster == "pet")
local isOurs = isMine or isPet
local isTarget = UnitIsUnit("target", caster)
local isFocus = UnitIsUnit("focus", caster)
local isNother = not (isMine or isPet or isTarget)
if not cb then cb = "player" else cb = string.lower(cb) end -- for backward compatibility
return ((cb == "player") and isMine) or (cb == "anyone") or ((cb == "pet") and isPet) or ((cb == "other") and not isOurs) or ((cb == "ours") and isOurs) or
((cb == "target") and (caster ~= "unknown") and UnitIsUnit("target", caster)) or
((cb == "focus") and (caster ~= "unknown") and UnitIsUnit("focus", caster))
((cb == "nother") and isNother) or ((caster ~= "unknown") and (((cb == "target") and isTarget) or ((cb == "focus") and isFocus)))
end

-- Check if an action is in the associated filter bar group
Expand Down
3 changes: 3 additions & 0 deletions Localizations/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1058,9 +1058,11 @@ L["If checked, only add bars for buffs if cast by the player's pet."] = true
L["If checked, only add bars for buffs if cast by the target."] = true
L["If checked, only add bars for buffs if cast by the focus."] = true
L["If checked, only add bars for buffs if cast by anyone other than the player or pet."] = true
L["If checked, only add bars for buffs if cast by anyone other than player, pet or target."] = true
L["If checked, only add bars for buffs if cast by player or pet."] = true
L["If checked, add bars for buffs if cast by anyone, including player."] = true
L["Other"] = OTHER
L["Other, Not Target"] = "Other, Not Target"
L["Anyone"] = true
L["Include By Type"] = true
L["Include buff types string"] = "If checked, include only the selected types of buffs (note buffs may match multiple types)."
Expand Down Expand Up @@ -1151,6 +1153,7 @@ L["If checked, only add bars for debuffs if cast by the player's pet."] = true
L["If checked, only add bars for debuffs if cast by the target."] = true
L["If checked, only add bars for debuffs if cast by the focus."] = true
L["If checked, only add bars for debuffs if cast by anyone other than the player or pet."] = true
L["If checked, only add bars for debuffs if cast by anyone other than player, pet or target."] = true
L["If checked, only add bars for debuffs if cast by player or pet."] = true
L["If checked, add bars for debuffs if cast by anyone, including player."] = true
L["If checked, don't display any debuffs that are in the filter list."] = true
Expand Down
3 changes: 3 additions & 0 deletions Localizations/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,11 @@ L["If checked, only add bars for buffs if cast by the player's pet."] = "Есл
L["If checked, only add bars for buffs if cast by the target."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы целью."
L["If checked, only add bars for buffs if cast by the focus."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы фокусом."
L["If checked, only add bars for buffs if cast by anyone other than the player or pet."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы кем угодно, кроме игрока и питомца."
L["If checked, only add bars for buffs if cast by anyone other than player, pet or target."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы кем угодно, кроме игрока и питомца и целью."
L["If checked, only add bars for buffs if cast by player or pet."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы игроком или питомцем."
L["If checked, add bars for buffs if cast by anyone, including player."] = "Если отмечено, добавлять полосы для баффов, только когда они использованы кем угодно, включая игрока."
L["Other"] = OTHER
L["Other, Not Target"] = OTHER .. ", Не цели"
L["Anyone"] = "Кто угодно"
L["Include By Type"] = "Включать по типу"
L["Include buff types string"] = "Если отмечено, включать только выбранные типы баффов (заметьте, баффы могут соответствовать нескольким типам)." --"If checked, include only the selected types of buffs (note buffs may match multiple types)."
Expand Down Expand Up @@ -1155,6 +1157,7 @@ L["If checked, only add bars for debuffs if cast by the player's pet."] = "Ес
L["If checked, only add bars for debuffs if cast by the target."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных целью."
L["If checked, only add bars for debuffs if cast by the focus."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных фокусом."
L["If checked, only add bars for debuffs if cast by anyone other than the player or pet."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных кем угодно кроме игрока или питомца."
L["If checked, only add bars for debuffs if cast by anyone other than player, pet or target."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных кем угодно кроме игрока или питомца или целью."
L["If checked, only add bars for debuffs if cast by player or pet."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных игроком или питомцем."
L["If checked, add bars for debuffs if cast by anyone, including player."] = "Если отмечено, добавлять только полосы для дебаффов, наложенных кем угодно, включая игрока."
L["If checked, don't display any debuffs that are in the filter list."] = "Если отмечено, не отображать любые дебаффы из списка фильтов."
Expand Down
16 changes: 14 additions & 2 deletions Raven_Options/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6476,8 +6476,14 @@ MOD.OptionsTable = {
get = function(info) return GetBarGroupField("detectBuffsCastBy") == "other" end,
set = function(info, value) SetBarGroupField("detectBuffsCastBy", "other") end,
},
YourBuffNotTarget = {
type = "toggle", order = 35, name = L["Other, Not Target"],
desc = L["If checked, only add bars for buffs if cast by anyone other than player, pet or target."],
get = function(info) return GetBarGroupField("detectBuffsCastBy") == "nother" end,
set = function(info, value) SetBarGroupField("detectBuffsCastBy", "nother") end,
},
AnyBuff = {
type = "toggle", order = 35, name = L["Anyone"],
type = "toggle", order = 40, name = L["Anyone"],
desc = L["If checked, add bars for buffs if cast by anyone, including player."],
get = function(info) return GetBarGroupField("detectBuffsCastBy") == "anyone" end,
set = function(info, value) SetBarGroupField("detectBuffsCastBy", "anyone") end,
Expand Down Expand Up @@ -7155,8 +7161,14 @@ MOD.OptionsTable = {
get = function(info) return GetBarGroupField("detectDebuffsCastBy") == "other" end,
set = function(info, value) SetBarGroupField("detectDebuffsCastBy", "other") end,
},
YourBuffNotTarget = {
type = "toggle", order = 35, name = L["Other, Not Target"],
desc = L["If checked, only add bars for debuffs if cast by anyone other than player, pet or target."],
get = function(info) return GetBarGroupField("detectBuffsCastBy") == "nother" end,
set = function(info, value) SetBarGroupField("detectBuffsCastBy", "nother") end,
},
AnyBuff = {
type = "toggle", order = 35, name = L["Anyone"],
type = "toggle", order = 40, name = L["Anyone"],
desc = L["If checked, add bars for debuffs if cast by anyone, including player."],
get = function(info) return GetBarGroupField("detectDebuffsCastBy") == "anyone" end,
set = function(info, value) SetBarGroupField("detectDebuffsCastBy", "anyone") end,
Expand Down

0 comments on commit 3952919

Please sign in to comment.