Commit 4c172446 authored by Azilroka's avatar Azilroka

@Simpy, This madness.

parent 5ff16411
......@@ -1780,29 +1780,6 @@ function E:DBConversions()
if E.global.uiScaleInformed then E.global.uiScaleInformed = nil end
if E.global.nameplatesResetInformed then E.global.nameplatesResetInformed = nil end
if E.global.userInformedNewChanges1 then E.global.userInformedNewChanges1 = nil end
-- cvar nameplate visibility stuff
if E.db.nameplates.visibility.nameplateShowAll ~= nil then
E.db.nameplates.visibility.showAll = E.db.nameplates.visibility.nameplateShowAll
E.db.nameplates.visibility.nameplateShowAll = nil
end
if E.db.nameplates.units.FRIENDLY_NPC.showAlways ~= nil then
E.db.nameplates.visibility.friendly.npcs = E.db.nameplates.units.FRIENDLY_NPC.showAlways
E.db.nameplates.units.FRIENDLY_NPC.showAlways = nil
end
if E.db.nameplates.units.FRIENDLY_PLAYER.minions ~= nil then
E.db.nameplates.visibility.friendly.minions = E.db.nameplates.units.FRIENDLY_PLAYER.minions
E.db.nameplates.units.FRIENDLY_PLAYER.minions = nil
end
if E.db.nameplates.units.ENEMY_NPC.minors ~= nil then
E.db.nameplates.visibility.enemy.minus = E.db.nameplates.units.ENEMY_NPC.minors
E.db.nameplates.units.ENEMY_NPC.minors = nil
end
if E.db.nameplates.units.ENEMY_PLAYER.minions ~= nil or E.db.nameplates.units.ENEMY_NPC.minions ~= nil then
E.db.nameplates.visibility.enemy.minions = E.db.nameplates.units.ENEMY_PLAYER.minions or E.db.nameplates.units.ENEMY_NPC.minions
E.db.nameplates.units.ENEMY_PLAYER.minions = nil
E.db.nameplates.units.ENEMY_NPC.minions = nil
end
end
local CPU_USAGE = {}
......
......@@ -4,6 +4,8 @@ local NP = E:GetModule('NamePlates')
local _G = _G
local pairs, unpack = pairs, unpack
local CreateFrame = CreateFrame
local GetCVar = GetCVar
local GetCVarBool = GetCVarBool
function NP:Construct_QuestIcons(nameplate)
local QuestIcons = CreateFrame('Frame', nameplate:GetDebugName()..'QuestIcons', nameplate)
......@@ -216,7 +218,7 @@ end
function NP:Update_Fader(nameplate)
local db = NP.db.units[nameplate.frameType]
if (not db.visibility) or db.visibility.showAlways then
if (nameplate.frameType ~= 'PLAYER') or nameplate.frameType == 'PLAYER' and GetCVarBool('NameplatePersonalShowAlways') then
if nameplate:IsElementEnabled('Fader') then
nameplate:DisableElement('Fader')
......@@ -238,9 +240,9 @@ function NP:Update_Fader(nameplate)
nameplate.Fader:SetOption('Casting', true)
end
nameplate.Fader:SetOption('PlayerTarget', db.visibility.showWithTarget)
nameplate.Fader:SetOption('Combat', db.visibility.showInCombat)
nameplate.Fader:SetOption('Delay', db.visibility.hideDelay)
nameplate.Fader:SetOption('PlayerTarget', GetCVarBool('NameplatePersonalShowWithTarget'))
nameplate.Fader:SetOption('Combat', GetCVarBool('NameplatePersonalShowInCombat'))
nameplate.Fader:SetOption('Delay', GetCVar('NameplatePersonalHideDelayAlpha'))
nameplate.Fader:ForceUpdate()
end
......
......@@ -15,6 +15,7 @@ local hooksecurefunc = hooksecurefunc
local CreateFrame = CreateFrame
local GetCVar = GetCVar
local GetCVarDefault = GetCVarDefault
local GetCVarBool = GetCVarBool
local GetInstanceInfo = GetInstanceInfo
local GetNumGroupMembers = GetNumGroupMembers
local GetNumSubgroupMembers = GetNumSubgroupMembers
......@@ -106,24 +107,7 @@ function NP:SetCVars()
SetCVar('nameplateOtherBottomInset', -1)
end
SetCVar('NameplatePersonalShowAlways', NP.db.units.PLAYER.visibility.showAlways and 1 or 0)
SetCVar('NameplatePersonalShowInCombat', NP.db.units.PLAYER.visibility.showInCombat and 1 or 0)
SetCVar('NameplatePersonalShowWithTarget', NP.db.units.PLAYER.visibility.showWithTarget and 1 or 0)
SetCVar('NameplatePersonalHideDelayAlpha', NP.db.units.PLAYER.visibility.hideDelay)
-- the order of these is important !!
SetCVar('nameplateShowAll', NP.db.visibility.showAll and 1 or 0)
SetCVar('nameplateShowSelf', (NP.db.units.PLAYER.useStaticPosition or not NP.db.units.PLAYER.enable) and 0 or 1)
SetCVar('nameplateShowEnemyMinions', NP.db.visibility.enemy.minions and 1 or 0)
SetCVar('nameplateShowEnemyGuardians', NP.db.visibility.enemy.guardians and 1 or 0)
SetCVar('nameplateShowEnemyMinus', NP.db.visibility.enemy.minus and 1 or 0)
SetCVar('nameplateShowEnemyPets', NP.db.visibility.enemy.pets and 1 or 0)
SetCVar('nameplateShowEnemyTotems', NP.db.visibility.enemy.totems and 1 or 0)
SetCVar('nameplateShowFriendlyMinions', NP.db.visibility.friendly.minions and 1 or 0)
SetCVar('nameplateShowFriendlyGuardians', NP.db.visibility.friendly.guardians and 1 or 0)
SetCVar('nameplateShowFriendlyNPCs', NP.db.visibility.friendly.npcs and 1 or 0)
SetCVar('nameplateShowFriendlyPets', NP.db.visibility.friendly.pets and 1 or 0)
SetCVar('nameplateShowFriendlyTotems', NP.db.visibility.friendly.totems and 1 or 0)
end
function NP:PLAYER_REGEN_DISABLED()
......
......@@ -452,23 +452,6 @@ P.nameplates = {
useThreatColor = true,
indicator = false,
},
visibility = {
showAll = true,
enemy = {
guardians = false,
minions = false,
minus = true,
pets = false,
totems = false,
},
friendly = {
guardians = false,
minions = false,
npcs = true,
pets = false,
totems = false,
},
},
cutaway = {
health = {
enabled = false,
......
......@@ -19,6 +19,7 @@ local GetSpellInfo = GetSpellInfo
local GetTalentInfo = GetTalentInfo
local SetCVar = SetCVar
local GetCVar = GetCVar
local GetCVarBool = GetCVarBool
local raidTargetIcon = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_%s:0|t %s"
local selectedNameplateFilter
......@@ -4381,15 +4382,11 @@ E.Options.args.nameplate = {
},
otherAtBase = {
order = 9,
type = "select",
type = "toggle",
name = L["Nameplate at Base"],
desc = L["Position other Nameplates at the base, rather than overhead."],
get = function() return tonumber(GetCVar('nameplateOtherAtBase')) end,
set = function(_, value) SetCVar('nameplateOtherAtBase', value) end,
values = {
[0] = L["Disable"],
[2] = L["Enable"],
},
get = function() return GetCVarBool('nameplateOtherAtBase') end,
set = function(_, value) SetCVar('nameplateOtherAtBase', value == true and 2 or 0) end,
},
lowHealthThreshold = {
order = 10,
......@@ -4440,44 +4437,45 @@ E.Options.args.nameplate = {
customWidth = 250,
name = L["UNIT_NAMEPLATES_AUTOMODE"],
desc = L["This option controls the Blizzard setting for whether or not the Nameplates should be shown."],
get = function(info) return E.db.nameplates.visibility.showAll end,
set = function(info, value) E.db.nameplates.visibility.showAll = value; NP:SetCVars() NP:ConfigureAll() end,
get = function() return GetCVarBool('nameplateShowAll') end,
set = function(info, value) SetCVar('nameplateShowAll', value == true and 1 or 0) NP:ConfigureAll() end,
},
showAlways = {
order = 1,
type = "toggle",
name = L["Always Show Player"],
disabled = function() return not E.db.nameplates.units.PLAYER.enable end,
get = function(info) return E.db.nameplates.units.PLAYER.visibility.showAlways end,
set = function(info, value) E.db.nameplates.units.PLAYER.visibility.showAlways = value; NP:SetCVars() NP:ConfigureAll() end,
get = function(info) return GetCVarBool('NameplatePersonalShowAlways') end,
set = function(_, value) SetCVar('NameplatePersonalShowAlways', value == true and 1 or 0) NP:ConfigureAll() end,
},
playerVisibility = {
order = 2,
type = "group",
guiInline = true,
name = L["Player"],
get = function(info) return E.db.nameplates.units.PLAYER.visibility[info[#info]] end,
set = function(info, value) E.db.nameplates.units.PLAYER.visibility[info[#info]] = value; NP:SetCVars(); NP:ConfigureAll() end,
disabled = function() return GetCVarBool('NameplatePersonalShowAlways') end,
args = {
showInCombat = {
order = 2,
type = "toggle",
name = L["Show In Combat"],
disabled = function() return not E.db.nameplates.units.PLAYER.enable or E.db.nameplates.units.PLAYER.visibility.showAlways end,
get = function(info) return GetCVarBool('NameplatePersonalShowInCombat') end,
set = function(_, value) SetCVar('NameplatePersonalShowInCombat', value == true and 1 or 0) NP:ConfigureAll() end,
},
showWithTarget = {
order = 2,
type = "toggle",
name = L["Show With Target"],
desc = L["When using Static Position, this option also requires the target to be attackable."],
disabled = function() return not E.db.nameplates.units.PLAYER.enable or E.db.nameplates.units.PLAYER.visibility.showAlways end,
get = function(info) return GetCVarBool('NameplatePersonalShowWithTarget') end,
set = function(_, value) SetCVar('NameplatePersonalShowWithTarget', value == true and 1 or 0) NP:ConfigureAll() end,
},
hideDelay = {
order = 4,
type = "range",
name = L["Hide Delay"],
min = 0, max = 20, step = 1,
disabled = function() return not E.db.nameplates.units.PLAYER.enable or E.db.nameplates.units.PLAYER.visibility.showAlways end,
get = function(info) return tonumber(GetCVar('NameplatePersonalHideDelayAlpha')) end,
set = function(_, value) SetCVar('NameplatePersonalHideDelayAlpha', value) NP:ConfigureAll() end,
},
},
},
......@@ -4486,33 +4484,34 @@ E.Options.args.nameplate = {
order = 3,
guiInline = true,
name = L["Enemy"],
disabled = function() return not E.db.nameplates.visibility.showAll end,
get = function(info) return E.db.nameplates.visibility.enemy[info[#info]] end,
set = function(info, value) E.db.nameplates.visibility.enemy[info[#info]] = value;
NP:SetCVars();
NP:ConfigureAll() end,
disabled = function() return not GetCVarBool('nameplateShowAll') end,
get = function(info) return GetCVarBool(info[#info]) end,
set = function(info, value)
SetCVar(info[#info], value == true and 1 or 0)
NP:ConfigureAll()
end,
args = {
guardians = {
nameplateShowEnemyGuardians = {
type = "toggle",
order = 1,
name = L["Guardians"],
},
minions = {
nameplateShowEnemyMinions = {
type = "toggle",
order = 2,
name = L["Minions"],
},
minus = {
nameplateShowEnemyMinus = {
type = "toggle",
order = 3,
name = L["Minus"],
},
pets = {
nameplateShowEnemyPets = {
type = "toggle",
order = 4,
name = L["Pets"],
},
totems = {
nameplateShowEnemyTotems = {
type = "toggle",
order = 5,
name = L["Totems"],
......@@ -4524,34 +4523,34 @@ E.Options.args.nameplate = {
order = 4,
guiInline = true,
name = L["Friendly"],
disabled = function() return not E.db.nameplates.visibility.showAll end,
get = function(info) return E.db.nameplates.visibility.friendly[info[#info]] end,
set = function(info, value) E.db.nameplates.visibility.friendly[info[#info]] = value;
NP:SetCVars()
disabled = function() return not GetCVarBool('nameplateShowAll') end,
get = function(info) return GetCVarBool(info[#info]) end,
set = function(info, value)
SetCVar(info[#info], value == true and 1 or 0)
NP:ConfigureAll()
end,
args = {
guardians = {
nameplateShowFriendlyGuardians = {
type = "toggle",
order = 1,
name = L["Guardians"],
},
minions = {
nameplateShowFriendlyMinions = {
type = "toggle",
order = 2,
name = L["Minions"],
},
npcs = {
nameplateShowFriendlyNPCs = {
type = "toggle",
order = 3,
name = L["NPC"],
},
pets = {
nameplateShowFriendlyPets = {
type = "toggle",
order = 4,
name = L["Pets"],
},
totems = {
nameplateShowFriendlyTotems = {
type = "toggle",
order = 5,
name = L["Totems"],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment