PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 11ms app.codeStats 0ms

/ShadowedUF_Options/config.lua

https://bitbucket.org/Ahmil/wowmodmodsoriginals
Lua | 5514 lines | 5166 code | 262 blank | 86 comment | 417 complexity | e0dc3a3ceaf3b153276e4af0caeaa599 MD5 | raw file
  1. local Config = {}
  2. local AceDialog, AceRegistry, AceGUI, SML, registered, options
  3. local playerClass = select(2, UnitClass("player"))
  4. local modifyUnits, globalConfig = {}, {}
  5. local L = ShadowUF.L
  6. ShadowUF.Config = Config
  7. --[[
  8. The part that makes configuration a pain when you actually try is it gets unwieldly when you're adding special code to deal with
  9. showing help for certain cases, swapping tabs etc that makes it work smoothly.
  10. I'm going to have to split it out into separate files for each type to clean everything up but that takes time and I have other things
  11. I want to get done with first.
  12. ]]
  13. local unitCategories = {
  14. player = {"player", "pet"},
  15. general = {"target", "targettarget", "targettargettarget", "focus", "focustarget", "pettarget"},
  16. party = {"party", "partypet", "partytarget"},
  17. raid = {"raid", "raidpet", "boss", "bosstarget", "maintank", "maintanktarget", "mainassist", "mainassisttarget"},
  18. arena = {"arena", "arenapet", "arenatarget"}}
  19. local UNIT_DESC = {
  20. ["boss"] = L["Boss units are for only certain fights, such as Blood Princes or the Gunship battle, you will not see them for every boss fight."],
  21. ["mainassist"] = L["Main Assists's are set by the Blizzard Main Assist system or mods that use them such as oRA3."],
  22. ["maintank"] = L["Main Tank's are set by the Blizzard Main Tank system or mods that use them such as oRA3."],
  23. }
  24. local PAGE_DESC = {
  25. ["general"] = L["General configuration to all enabled units."],
  26. ["enableUnits"] = L["Various units can be enabled through this page, such as raid or party targets."],
  27. ["hideBlizzard"] = L["Hiding and showing various aspects of the default UI such as the player buff frames."],
  28. ["units"] = L["Configuration to specific unit frames."],
  29. ["visibility"] = L["Disabling unit modules in various instances."],
  30. ["tags"] = L["Advanced tag management, allows you to add your own custom tags."],
  31. ["filter"] = L["Simple aura filtering by whitelists and blacklists."],
  32. }
  33. local INDICATOR_NAMES = {["leader"] = L["Leader"], ["lfdRole"] = L["Dungeon role"], ["masterLoot"] = L["Master looter"], ["pvp"] = L["PvP Flag"], ["raidTarget"] = L["Raid target"], ["ready"] = L["Ready status"], ["role"] = L["Raid role"], ["status"] = L["Combat status"], ["class"] = L["Class icon"], ["resurrect"] = L["Resurrect status"], ["phase"] = L["Phase status"]}
  34. local AREA_NAMES = {["arena"] = L["Arenas"],["none"] = L["Everywhere else"], ["party"] = L["Party instances"], ["pvp"] = L["Battlegrounds"], ["raid"] = L["Raid instances"]}
  35. local INDICATOR_DESC = {
  36. ["leader"] = L["Crown indicator for group leaders."], ["lfdRole"] = L["Role the unit is playing in dungeons formed through the Looking For Dungeon system."],
  37. ["masterLoot"] = L["Bag indicator for master looters."], ["pvp"] = L["PVP flag indicator, Horde for Horde flagged pvpers and Alliance for Alliance flagged pvpers."],
  38. ["raidTarget"] = L["Raid target indicator."], ["ready"] = L["Ready status of group members."],
  39. ["role"] = L["Raid role indicator, adds a shield indicator for main tanks and a sword icon for main assists."], ["status"] = L["Status indicator, shows if the unit is currently in combat. For the player it will also show if you are rested."], ["class"] = L["Class icon for players."]}
  40. local TAG_GROUPS = {["classification"] = L["Classifications"], ["health"] = L["Health"], ["misc"] = L["Miscellaneous"], ["playerthreat"] = L["Player threat"], ["power"] = L["Power"], ["status"] = L["Status"], ["threat"] = L["Threat"], ["raid"] = L["Raid"], ["absorb"] = L["Absorb"]}
  41. local pointPositions = {["BOTTOM"] = L["Bottom"], ["TOP"] = L["Top"], ["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["TOPLEFT"] = L["Top Left"], ["TOPRIGHT"] = L["Top Right"], ["BOTTOMLEFT"] = L["Bottom Left"], ["BOTTOMRIGHT"] = L["Bottom Right"], ["CENTER"] = L["Center"]}
  42. local positionList = {["C"] = L["Center"], ["RT"] = L["Right Top"], ["RC"] = L["Right Center"], ["RB"] = L["Right Bottom"], ["LT"] = L["Left Top"], ["LC"] = L["Left Center"], ["LB"] = L["Left Bottom"], ["BL"] = L["Bottom Left"], ["BC"] = L["Bottom Center"], ["BR"] = L["Bottom Right"], ["TR"] = L["Top Right"], ["TC"] = L["Top Center"], ["TL"] = L["Top Left"]}
  43. local unitOrder = {}
  44. for order, unit in pairs(ShadowUF.unitList) do unitOrder[unit] = order end
  45. local fullReload = {["bars"] = true, ["auras"] = true, ["backdrop"] = true, ["font"] = true, ["classColors"] = true, ["powerColors"] = true, ["healthColors"] = true, ["xpColors"] = true, ["omnicc"] = true}
  46. local quickIDMap = {}
  47. -- Helper functions
  48. local function getPageDescription(info)
  49. return PAGE_DESC[info[#(info)]]
  50. end
  51. local function getFrameName(unit)
  52. if( unit == "raidpet" or unit == "raid" or unit == "party" or unit == "maintank" or unit == "mainassist" or unit == "boss" or unit == "arena" ) then
  53. return string.format("#SUFHeader%s", unit)
  54. end
  55. return string.format("#SUFUnit%s", unit)
  56. end
  57. local anchorList = {}
  58. local function getAnchorParents(info)
  59. local unit = info[2]
  60. for k in pairs(anchorList) do anchorList[k] = nil end
  61. if( ShadowUF.Units.childUnits[unit] ) then
  62. anchorList["$parent"] = string.format(L["%s member"], L.units[ShadowUF.Units.childUnits[unit]])
  63. return anchorList
  64. end
  65. anchorList["UIParent"] = L["Screen"]
  66. -- Don't let a frame anchor to a frame thats anchored to it already (Stop infinite loops-o-doom)
  67. local currentName = getFrameName(unit)
  68. for _, unitID in pairs(ShadowUF.unitList) do
  69. if( unitID ~= unit and ShadowUF.db.profile.positions[unitID] and ShadowUF.db.profile.positions[unitID].anchorTo ~= currentName ) then
  70. anchorList[getFrameName(unitID)] = string.format(L["%s frames"], L.units[unitID] or unitID)
  71. end
  72. end
  73. return anchorList
  74. end
  75. local function selectDialogGroup(group, key)
  76. AceDialog.Status.ShadowedUF.children[group].status.groups.selected = key
  77. AceRegistry:NotifyChange("ShadowedUF")
  78. end
  79. local function selectTabGroup(group, subGroup, key)
  80. AceDialog.Status.ShadowedUF.children[group].status.groups.selected = subGroup
  81. AceDialog.Status.ShadowedUF.children[group].children[subGroup].status.groups.selected = key
  82. AceRegistry:NotifyChange("ShadowedUF")
  83. end
  84. local function hideAdvancedOption(info)
  85. return not ShadowUF.db.profile.advanced
  86. end
  87. local function hideBasicOption(info)
  88. return ShadowUF.db.profile.advanced
  89. end
  90. local function isUnitDisabled(info)
  91. local unit = info[#(info)]
  92. local enabled = ShadowUF.db.profile.units[unit].enabled
  93. for _, visibility in pairs(ShadowUF.db.profile.visibility) do
  94. if( visibility[unit] ) then
  95. enabled = visibility[unit]
  96. break
  97. end
  98. end
  99. return not enabled
  100. end
  101. local function mergeTables(parent, child)
  102. for key, value in pairs(child) do
  103. if( type(parent[key]) == "table" ) then
  104. parent[key] = mergeTables(parent[key], value)
  105. elseif( type(value) == "table" ) then
  106. parent[key] = CopyTable(value)
  107. elseif( parent[key] == nil ) then
  108. parent[key] = value
  109. end
  110. end
  111. return parent
  112. end
  113. local function getName(info)
  114. local key = info[#(info)]
  115. if( ShadowUF.modules[key] and ShadowUF.modules[key].moduleName ) then
  116. return ShadowUF.modules[key].moduleName
  117. end
  118. return LOCALIZED_CLASS_NAMES_MALE[key] or INDICATOR_NAMES[key] or L.units[key] or TAG_GROUPS[key] or L[key]
  119. end
  120. local function getUnitOrder(info)
  121. return unitOrder[info[#(info)]]
  122. end
  123. local function isModifiersSet(info)
  124. if( info[2] ~= "global" ) then return false end
  125. for k in pairs(modifyUnits) do return false end
  126. return true
  127. end
  128. -- These are for setting simple options like bars.texture = "Default" or locked = true
  129. local function set(info, value)
  130. local cat, key = string.split(".", info.arg)
  131. if( key == "$key" ) then key = info[#(info)] end
  132. if( not key ) then
  133. ShadowUF.db.profile[cat] = value
  134. else
  135. ShadowUF.db.profile[cat][key] = value
  136. end
  137. if( cat and fullReload[cat] ) then
  138. ShadowUF.Layout:CheckMedia()
  139. ShadowUF.Layout:Reload()
  140. end
  141. end
  142. local function get(info)
  143. local cat, key = string.split(".", info.arg)
  144. if( key == "$key" ) then key = info[#(info)] end
  145. if( not key ) then
  146. return ShadowUF.db.profile[cat]
  147. else
  148. return ShadowUF.db.profile[cat][key]
  149. end
  150. end
  151. local function setColor(info, r, g, b, a)
  152. local color = get(info)
  153. color.r, color.g, color.b, color.a = r, g, b, a
  154. set(info, color)
  155. end
  156. local function getColor(info)
  157. local color = get(info)
  158. return color.r, color.g, color.b, color.a
  159. end
  160. -- These are for setting complex options like units.player.auras.buffs.enabled = true or units.player.portrait.enabled = true
  161. local function setVariable(unit, moduleKey, moduleSubKey, key, value)
  162. local configTable = unit == "global" and globalConfig or ShadowUF.db.profile.units[unit]
  163. -- For setting options like units.player.auras.buffs.enabled = true
  164. if( moduleKey and moduleSubKey and configTable[moduleKey][moduleSubKey] ) then
  165. configTable[moduleKey][moduleSubKey][key] = value
  166. ShadowUF.Layout:Reload(unit)
  167. -- For setting options like units.player.portrait.enabled = true
  168. elseif( moduleKey and not moduleSubKey and configTable[moduleKey] ) then
  169. configTable[moduleKey][key] = value
  170. ShadowUF.Layout:Reload(unit)
  171. -- For setting options like units.player.height = 50
  172. elseif( not moduleKey and not moduleSubKey ) then
  173. configTable[key] = value
  174. ShadowUF.Layout:Reload(unit)
  175. end
  176. end
  177. local function specialRestricted(unit, moduleKey, moduleSubKey, key)
  178. if( ShadowUF.fakeUnits[unit] and ( key == "colorAggro" or key == "aggro" or moduleKey == "incHeal" or moduleKey == "castBar" ) ) then
  179. return true
  180. elseif( moduleKey == "healthBar" and unit == "player" and key == "reaction" ) then
  181. return true
  182. end
  183. end
  184. local function setDirectUnit(unit, moduleKey, moduleSubKey, key, value)
  185. if( unit == "global" ) then
  186. for unit in pairs(modifyUnits) do
  187. if( not specialRestricted(unit, moduleKey, moduleSubKey, key) ) then
  188. setVariable(unit, moduleKey, moduleSubKey, key, value)
  189. end
  190. end
  191. setVariable("global", moduleKey, moduleSubKey, key, value)
  192. else
  193. setVariable(unit, moduleKey, moduleSubKey, key, value)
  194. end
  195. end
  196. local function setUnit(info, value)
  197. local unit = info[2]
  198. -- auras, buffs, enabled / text, 1, text / portrait, enabled
  199. local moduleKey, moduleSubKey, key = string.split(".", info.arg)
  200. if( not moduleSubKey ) then key = moduleKey moduleKey = nil end
  201. if( moduleSubKey and not key ) then key = moduleSubKey moduleSubKey = nil end
  202. if( moduleSubKey == "$parent" ) then moduleSubKey = info[#(info) - 1] end
  203. if( moduleKey == "$parent" ) then moduleKey = info[#(info) - 1] end
  204. if( tonumber(moduleSubKey) ) then moduleSubKey = tonumber(moduleSubKey) end
  205. setDirectUnit(unit, moduleKey, moduleSubKey, key, value)
  206. end
  207. local function getVariable(unit, moduleKey, moduleSubKey, key)
  208. local configTbl = unit == "global" and globalConfig or ShadowUF.db.profile.units[unit]
  209. if( moduleKey and moduleSubKey ) then
  210. return configTbl[moduleKey][moduleSubKey] and configTbl[moduleKey][moduleSubKey][key]
  211. elseif( moduleKey and not moduleSubKey ) then
  212. return configTbl[moduleKey] and configTbl[moduleKey][key]
  213. end
  214. return configTbl[key]
  215. end
  216. local function getUnit(info)
  217. local moduleKey, moduleSubKey, key = string.split(".", info.arg)
  218. if( not moduleSubKey ) then key = moduleKey moduleKey = nil end
  219. if( moduleSubKey and not key ) then key = moduleSubKey moduleSubKey = nil end
  220. if( moduleSubKey == "$parent" ) then moduleSubKey = info[#(info) - 1] end
  221. if( moduleKey == "$parent" ) then moduleKey = info[#(info) - 1] end
  222. if( tonumber(moduleSubKey) ) then moduleSubKey = tonumber(moduleSubKey) end
  223. return getVariable(info[2], moduleKey, moduleSubKey, key)
  224. end
  225. -- Tag functions
  226. local function getTagName(info)
  227. local tag = info[#(info)]
  228. if( ShadowUF.db.profile.tags[tag] and ShadowUF.db.profile.tags[tag].name ) then
  229. return ShadowUF.db.profile.tags[tag].name
  230. end
  231. return ShadowUF.Tags.defaultNames[tag] or tag
  232. end
  233. local function getTagHelp(info)
  234. local tag = info[#(info)]
  235. return ShadowUF.Tags.defaultHelp[tag] or ShadowUF.db.profile.tags[tag] and ShadowUF.db.profile.tags[tag].help
  236. end
  237. -- Module functions
  238. local function hideRestrictedOption(info)
  239. local unit = type(info.arg) == "number" and info[#(info) - info.arg] or info[2]
  240. local key = info[#(info)]
  241. if( ShadowUF.modules[key] and ShadowUF.modules[key].moduleClass and ShadowUF.modules[key].moduleClass ~= playerClass ) then
  242. return true
  243. elseif( key == "incHeal" and not ShadowUF.modules.incHeal ) then
  244. return true
  245. -- Non-standard units do not support color by aggro or incoming heal
  246. elseif( key == "colorAggro" or key == "incHeal" or key == "aggro" ) then
  247. return string.match(unit, "%w+target" )
  248. -- Fall back for indicators, no variable table so it shouldn't be shown
  249. elseif( info[#(info) - 1] == "indicators" ) then
  250. if( ( unit == "global" and not globalConfig.indicators[key] ) or ( unit ~= "global" and not ShadowUF.db.profile.units[unit].indicators[key] ) ) then
  251. return true
  252. end
  253. -- Fall back, no variable table so it shouldn't be shown
  254. elseif( ( unit == "global" and not globalConfig[key] ) or ( unit ~= "global" and not ShadowUF.db.profile.units[unit][key] ) ) then
  255. return true
  256. end
  257. return false
  258. end
  259. local function getModuleOrder(info)
  260. local key = info[#(info)]
  261. return key == "healthBar" and 1 or key == "powerBar" and 2 or key == "castBar" and 3 or 4
  262. end
  263. -- Expose these for modules
  264. Config.getAnchorParents = getAnchorParents
  265. Config.hideAdvancedOption = hideAdvancedOption
  266. Config.isUnitDisabled = isUnitDisabled
  267. Config.selectDialogGroup = selectDialogGroup
  268. Config.selectTabGroup = selectTabGroup
  269. Config.getName = getName
  270. Config.getUnitOrder = getUnitOrder
  271. Config.isModifiersSet = isModifiersSet
  272. Config.set = set
  273. Config.get = get
  274. Config.setUnit = setUnit
  275. Config.setVariable = setVariable
  276. Config.getUnit = getUnit
  277. Config.getVariable = getVariable
  278. Config.hideRestrictedOption = hideRestrictedOption
  279. Config.hideBasicOption = hideBasicOption
  280. --------------------
  281. -- GENERAL CONFIGURATION
  282. ---------------------
  283. local function loadGeneralOptions()
  284. SML = SML or LibStub:GetLibrary("LibSharedMedia-3.0")
  285. local MediaList = {}
  286. local function getMediaData(info)
  287. local mediaType = info[#(info)]
  288. MediaList[mediaType] = MediaList[mediaType] or {}
  289. for k in pairs(MediaList[mediaType]) do MediaList[mediaType][k] = nil end
  290. for _, name in pairs(SML:List(mediaType)) do
  291. MediaList[mediaType][name] = name
  292. end
  293. return MediaList[mediaType]
  294. end
  295. local barModules = {}
  296. for key, module in pairs(ShadowUF.modules) do
  297. if( module.moduleHasBar ) then
  298. barModules["$" .. key] = module.moduleName
  299. end
  300. end
  301. local addTextParent = {
  302. order = 4,
  303. type = "group",
  304. inline = true,
  305. name = function(info) return barModules[info[#(info)]] or string.sub(info[#(info)], 2) end,
  306. hidden = function(info)
  307. for _, text in pairs(ShadowUF.db.profile.units.player.text) do
  308. if( text.anchorTo == info[#(info)] ) then
  309. return false
  310. end
  311. end
  312. return true
  313. end,
  314. args = {},
  315. }
  316. local addTextLabel = {
  317. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) end,
  318. type = "description",
  319. width = "",
  320. fontSize = "medium",
  321. hidden = function(info)
  322. local id = tonumber(string.match(info[#(info)], "(%d+)"))
  323. if( not getVariable("player", "text", nil, id) ) then return true end
  324. return getVariable("player", "text", id, "anchorTo") ~= info[#(info) - 1]
  325. end,
  326. name = function(info)
  327. return getVariable("player", "text", tonumber(string.match(info[#(info)], "(%d+)")), "name")
  328. end,
  329. }
  330. local addTextSep = {
  331. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) + 0.75 end,
  332. type = "description",
  333. width = "full",
  334. hidden = function(info)
  335. local id = tonumber(string.match(info[#(info)], "(%d+)"))
  336. if( not getVariable("player", "text", nil, id) ) then return true end
  337. return getVariable("player", "text", id, "anchorTo") ~= info[#(info) - 1]
  338. end,
  339. name = "",
  340. }
  341. local addText = {
  342. order = function(info) return info[#(info)] + 0.5 end,
  343. type = "execute",
  344. width = "half",
  345. name = L["Delete"],
  346. hidden = function(info)
  347. local id = tonumber(info[#(info)])
  348. if( not getVariable("player", "text", nil, id) ) then return true end
  349. return getVariable("player", "text", id, "anchorTo") ~= info[#(info) - 1]
  350. end,
  351. disabled = function(info) return tonumber(info[#(info)]) <= 5 end,
  352. confirmText = L["Are you sure you want to delete this text? All settings for it will be deleted."],
  353. confirm = true,
  354. func = function(info)
  355. local id = tonumber(info[#(info)])
  356. for _, unit in pairs(ShadowUF.unitList) do
  357. table.remove(ShadowUF.db.profile.units[unit].text, id)
  358. end
  359. addTextParent.args[info[#(info)]] = nil
  360. ShadowUF.Layout:Reload()
  361. end,
  362. }
  363. local function validateSpell(info, spell)
  364. if( spell and spell ~= "" and not GetSpellInfo(spell) ) then
  365. return string.format(L["Invalid spell \"%s\" entered."], spell or "")
  366. end
  367. return true
  368. end
  369. local function setRange(info, spell)
  370. ShadowUF.db.profile.range[info[#(info)] .. playerClass] = spell and spell ~= "" and spell or nil
  371. ShadowUF.Layout:Reload()
  372. end
  373. local function getRange(info, spell)
  374. local spell = ShadowUF.db.profile.range[info[#(info)] .. playerClass]
  375. return spell and spell ~= "" and spell or ShadowUF.modules.range[info[#(info)]][playerClass]
  376. end
  377. local textData = {}
  378. local function writeTable(tbl)
  379. local data = ""
  380. for key, value in pairs(tbl) do
  381. local valueType = type(value)
  382. -- Wrap the key in brackets if it's a number
  383. if( type(key) == "number" ) then
  384. key = string.format("[%s]", key)
  385. -- Wrap the string with quotes if it has a space in it
  386. elseif( string.match(key, "[%p%s%c]") ) then
  387. key = string.format("['%s']", string.gsub(key, "'", "\\'"))
  388. end
  389. -- foo = {bar = 5}
  390. if( valueType == "table" ) then
  391. data = string.format("%s%s=%s;", data, key, writeTable(value))
  392. -- foo = true / foo = 5
  393. elseif( valueType == "number" or valueType == "boolean" ) then
  394. data = string.format("%s%s=%s;", data, key, tostring(value))
  395. -- foo = "bar"
  396. else
  397. data = string.format("%s%s='%s';", data, key, string.gsub(tostring(value), "'", "\\'"))
  398. end
  399. end
  400. return "{" .. data .. "}"
  401. end
  402. local layoutData = {positions = true, visibility = true, modules = false}
  403. local layoutManager = {
  404. type = "group",
  405. order = 7,
  406. name = L["Layout manager"],
  407. childGroups = "tab",
  408. hidden = hideAdvancedOption,
  409. args = {
  410. import = {
  411. order = 1,
  412. type = "group",
  413. name = L["Import"],
  414. hidden = false,
  415. args = {
  416. help = {
  417. order = 1,
  418. type = "group",
  419. inline = true,
  420. name = function(info) return layoutData.error and L["Error"] or L["Help"] end,
  421. args = {
  422. help = {
  423. order = 1,
  424. type = "description",
  425. name = function(info)
  426. if( ShadowUF.db:GetCurrentProfile() == "Import Backup" ) then
  427. return L["Your active layout is the profile used for import backup, this cannot be overwritten by an import. Change your profiles to something else and try again."]
  428. end
  429. return layoutData.error or L["You can import another Shadowed Unit Frame users configuration by entering the export code they gave you below. This will backup your old layout to \"Import Backup\".|n|nIt will take 30-60 seconds for it to load your layout when you paste it in, please by patient."]
  430. end
  431. },
  432. },
  433. },
  434. positions = {
  435. order = 2,
  436. type = "toggle",
  437. name = L["Import unit frame positions"],
  438. set = function(info, value) layoutData[info[#(info)]] = value end,
  439. get = function(info) return layoutData[info[#(info)]] end,
  440. width = "double",
  441. },
  442. visibility = {
  443. order = 3,
  444. type = "toggle",
  445. name = L["Import visibility settings"],
  446. set = function(info, value) layoutData[info[#(info)]] = value end,
  447. get = function(info) return layoutData[info[#(info)]] end,
  448. width = "double",
  449. },
  450. modules = {
  451. order = 4,
  452. type = "toggle",
  453. name = L["Import non-standard module settings"],
  454. desc = L["Will not import settings of modules that are not included with Shadowed Unit Frames by default."],
  455. set = function(info, value) layoutData[info[#(info)]] = value end,
  456. get = function(info) return layoutData[info[#(info)]] end,
  457. width = "double",
  458. },
  459. import = {
  460. order = 5,
  461. type = "input",
  462. name = L["Code"],
  463. multiline = true,
  464. width = "full",
  465. get = false,
  466. disabled = function() return ShadowUF.db:GetCurrentProfile() == "Import Backup" end,
  467. set = function(info, import)
  468. local layout, err = loadstring(string.format([[return %s]], import))
  469. if( err ) then
  470. layoutData.error = string.format(L["Failed to import layout, error:|n|n%s"], err)
  471. return
  472. end
  473. layout = layout()
  474. -- Strip position settings
  475. if( not layoutData.positions ) then
  476. layout.positions = nil
  477. end
  478. -- Strip visibility settings
  479. if( not layoutData.visibility ) then
  480. layout.visibility = nil
  481. end
  482. -- Strip any units we don't have included by default
  483. for unit in pairs(layout.units) do
  484. if( not ShadowUF.defaults.profile.units[unit] ) then
  485. layout.units[unit] = nil
  486. end
  487. end
  488. -- Strip module settings that aren't with SUF by default
  489. if( not layoutData.modules ) then
  490. local validModules = {["healthBar"] = true, ["powerBar"] = true, ["portrait"] = true, ["range"] = true, ["text"] = true, ["indicators"] = true, ["auras"] = true, ["incHeal"] = true, ["castBar"] = true, ["combatText"] = true, ["highlight"] = true, ["runeBar"] = true, ["totemBar"] = true, ["xpBar"] = true, ["fader"] = true, ["comboPoints"] = true, ["eclipseBar"] = true, ["soulShards"] = true, ["holyPower"] = true, ["altPowerBar"] = true}
  491. for _, unitData in pairs(layout.units) do
  492. for key, data in pairs(unitData) do
  493. if( type(data) == "table" and not validModules[key] and ShadowUF.modules[key] ) then
  494. unitData[key] = nil
  495. end
  496. end
  497. end
  498. end
  499. -- Check if we need move over the visibility and positions info
  500. layout.positions = layout.positions or CopyTable(ShadowUF.db.profile.positions)
  501. layout.visibility = layout.visibility or CopyTable(ShadowUF.db.profile.positions)
  502. -- Now backup the profile
  503. local currentLayout = ShadowUF.db:GetCurrentProfile()
  504. ShadowUF.layoutImporting = true
  505. ShadowUF.db:SetProfile("Import Backup")
  506. ShadowUF.db:CopyProfile(currentLayout)
  507. ShadowUF.db:SetProfile(currentLayout)
  508. ShadowUF.db:ResetProfile()
  509. ShadowUF.layoutImporting = nil
  510. -- Overwrite everything we did import
  511. ShadowUF:LoadDefaultLayout()
  512. for key, data in pairs(layout) do
  513. if( type(data) == "table" ) then
  514. ShadowUF.db.profile[key] = CopyTable(data)
  515. else
  516. ShadowUF.db.profile[key] = data
  517. end
  518. end
  519. ShadowUF:ProfilesChanged()
  520. end,
  521. },
  522. },
  523. },
  524. export = {
  525. order = 2,
  526. type = "group",
  527. name = L["Export"],
  528. hidden = false,
  529. args = {
  530. help = {
  531. order = 1,
  532. type = "group",
  533. inline = true,
  534. name = L["Help"],
  535. args = {
  536. help = {
  537. order = 1,
  538. type = "description",
  539. name = L["After you hit export, you can give the below code to other Shadowed Unit Frames users and they will get your exact layout."],
  540. },
  541. },
  542. },
  543. doExport = {
  544. order = 2,
  545. type = "execute",
  546. name = L["Export"],
  547. func = function(info)
  548. layoutData.export = writeTable(ShadowUF.db.profile)
  549. end,
  550. },
  551. export = {
  552. order = 3,
  553. type = "input",
  554. name = L["Code"],
  555. multiline = true,
  556. width = "full",
  557. set = false,
  558. get = function(info) return layoutData[info[#(info)]] end,
  559. },
  560. },
  561. },
  562. },
  563. }
  564. options.args.general = {
  565. type = "group",
  566. childGroups = "tab",
  567. name = L["General"],
  568. args = {
  569. general = {
  570. type = "group",
  571. order = 1,
  572. name = L["General"],
  573. set = set,
  574. get = get,
  575. args = {
  576. general = {
  577. order = 1,
  578. type = "group",
  579. inline = true,
  580. name = L["General"],
  581. args = {
  582. locked = {
  583. order = 1,
  584. type = "toggle",
  585. name = L["Lock frames"],
  586. desc = L["Enables configuration mode, letting you move and giving you example frames to setup."],
  587. set = function(info, value)
  588. set(info, value)
  589. ShadowUF.modules.movers:Update()
  590. end,
  591. arg = "locked",
  592. },
  593. sep = {
  594. order = 1.5,
  595. type = "description",
  596. name = "",
  597. width = "full",
  598. hidden = hideAdvancedOption,
  599. },
  600. advanced = {
  601. order = 2,
  602. type = "toggle",
  603. name = L["Advanced"],
  604. desc = L["Enabling advanced settings will give you access to more configuration options. This is meant for people who want to tweak every single thing, and should not be enabled by default as it increases the options."],
  605. arg = "advanced",
  606. },
  607. omnicc = {
  608. order = 2.5,
  609. type = "toggle",
  610. name = L["Disable OmniCC"],
  611. desc = L["Disables showing OmniCC timers in all Shadowed Unit Frame auras."],
  612. arg = "omnicc",
  613. hidden = hideAdvancedOption,
  614. },
  615. hideCombat = {
  616. order = 3,
  617. type = "toggle",
  618. name = L["Hide tooltips in combat"],
  619. desc = L["Prevents unit tooltips from showing while in combat."],
  620. arg = "tooltipCombat",
  621. },
  622. auraBorder = {
  623. order = 5,
  624. type = "select",
  625. name = L["Aura border style"],
  626. desc = L["Style of borders to show for all auras."],
  627. values = {["dark"] = L["Dark"], ["light"] = L["Light"], ["blizzard"] = L["Blizzard"], [""] = L["None"]},
  628. arg = "auras.borderType",
  629. },
  630. statusbar = {
  631. order = 6,
  632. type = "select",
  633. name = L["Bar texture"],
  634. dialogControl = "LSM30_Statusbar",
  635. values = getMediaData,
  636. arg = "bars.texture",
  637. },
  638. spacing = {
  639. order = 7,
  640. type = "range",
  641. name = L["Bar spacing"],
  642. desc = L["How much spacing should be provided between all of the bars inside a unit frame, negative values move them farther apart, positive values bring them closer together. 0 for no spacing."],
  643. min = -10, max = 10, step = 0.05, softMin = -5, softMax = 5,
  644. arg = "bars.spacing",
  645. hidden = hideAdvancedOption,
  646. },
  647. },
  648. },
  649. backdrop = {
  650. order = 2,
  651. type = "group",
  652. inline = true,
  653. name = L["Background/border"],
  654. args = {
  655. backgroundColor = {
  656. order = 1,
  657. type = "color",
  658. name = L["Background color"],
  659. hasAlpha = true,
  660. set = setColor,
  661. get = getColor,
  662. arg = "backdrop.backgroundColor",
  663. },
  664. borderColor = {
  665. order = 2,
  666. type = "color",
  667. name = L["Border color"],
  668. hasAlpha = true,
  669. set = setColor,
  670. get = getColor,
  671. arg = "backdrop.borderColor",
  672. },
  673. sep = {
  674. order = 3,
  675. type = "description",
  676. name = "",
  677. width = "full",
  678. },
  679. background = {
  680. order = 4,
  681. type = "select",
  682. name = L["Background"],
  683. dialogControl = "LSM30_Background",
  684. values = getMediaData,
  685. arg = "backdrop.backgroundTexture",
  686. },
  687. border = {
  688. order = 5,
  689. type = "select",
  690. name = L["Border"],
  691. dialogControl = "LSM30_Border",
  692. values = getMediaData,
  693. arg = "backdrop.borderTexture",
  694. },
  695. inset = {
  696. order = 5.5,
  697. type = "range",
  698. name = L["Inset"],
  699. desc = L["How far the background should be from the unit frame border."],
  700. min = -10, max = 10, step = 1,
  701. hidden = hideAdvancedOption,
  702. arg = "backdrop.inset",
  703. },
  704. sep2 = {
  705. order = 6,
  706. type = "description",
  707. name = "",
  708. width = "full",
  709. hidden = hideAdvancedOption,
  710. },
  711. edgeSize = {
  712. order = 7,
  713. type = "range",
  714. name = L["Edge size"],
  715. desc = L["How large the edges should be."],
  716. hidden = hideAdvancedOption,
  717. min = 0, max = 20, step = 1,
  718. arg = "backdrop.edgeSize",
  719. },
  720. tileSize = {
  721. order = 8,
  722. type = "range",
  723. name = L["Tile size"],
  724. desc = L["How large the background should tile"],
  725. hidden = hideAdvancedOption,
  726. min = 0, max = 20, step = 1,
  727. arg = "backdrop.tileSize",
  728. },
  729. clip = {
  730. order = 9,
  731. type = "range",
  732. name = L["Clip"],
  733. desc = L["How close the frame should clip with the border."],
  734. hidden = hideAdvancedOption,
  735. min = 0, max = 20, step = 1,
  736. arg = "backdrop.clip",
  737. },
  738. },
  739. },
  740. font = {
  741. order = 3,
  742. type = "group",
  743. inline = true,
  744. name = L["Font"],
  745. args = {
  746. color = {
  747. order = 1,
  748. type = "color",
  749. name = L["Default color"],
  750. desc = L["Default font color, any color tags inside individual tag texts will override this."],
  751. hasAlpha = true,
  752. set = setColor,
  753. get = getColor,
  754. arg = "font.color",
  755. hidden = hideAdvancedOption,
  756. },
  757. sep = {order = 1.25, type = "description", name = "", hidden = hideAdvancedOption},
  758. font = {
  759. order = 1.5,
  760. type = "select",
  761. name = L["Font"],
  762. dialogControl = "LSM30_Font",
  763. values = getMediaData,
  764. arg = "font.name",
  765. },
  766. size = {
  767. order = 2,
  768. type = "range",
  769. name = L["Size"],
  770. min = 1, max = 50, step = 1, softMin = 1, softMax = 20,
  771. arg = "font.size",
  772. },
  773. outline = {
  774. order = 3,
  775. type = "select",
  776. name = L["Outline"],
  777. values = {["OUTLINE"] = L["Thin outline"], ["THICKOUTLINE"] = L["Thick outline"], ["MONOCHROME"] = L["Monochrome"], [""] = L["None"]},
  778. arg = "font.extra",
  779. hidden = hideAdvancedOption,
  780. },
  781. },
  782. },
  783. bar = {
  784. order = 4,
  785. type = "group",
  786. inline = true,
  787. name = L["Bars"],
  788. hidden = hideAdvancedOption,
  789. args = {
  790. override = {
  791. order = 0,
  792. type = "toggle",
  793. name = L["Override color"],
  794. desc = L["Forces a static color to be used for the background of all bars"],
  795. set = function(info, value)
  796. if( value and not ShadowUF.db.profile.bars.backgroundColor ) then
  797. ShadowUF.db.profile.bars.backgroundColor = {r = 0, g = 0, b = 0}
  798. elseif( not value ) then
  799. ShadowUF.db.profile.bars.backgroundColor = nil
  800. end
  801. ShadowUF.Layout:Reload()
  802. end,
  803. get = function(info)
  804. return ShadowUF.db.profile.bars.backgroundColor and true or false
  805. end,
  806. },
  807. color = {
  808. order = 1,
  809. type = "color",
  810. name = L["Background color"],
  811. desc = L["This will override all background colorings for bars including custom set ones."],
  812. set = setColor,
  813. get = function(info)
  814. if( not ShadowUF.db.profile.bars.backgroundColor ) then
  815. return {r = 0, g = 0, b = 0}
  816. end
  817. return getColor(info)
  818. end,
  819. disabled = function(info) return not ShadowUF.db.profile.bars.backgroundColor end,
  820. arg = "bars.backgroundColor",
  821. },
  822. sep = { order = 2, type = "description", name = "", width = "full"},
  823. barAlpha = {
  824. order = 3,
  825. type = "range",
  826. name = L["Bar alpha"],
  827. desc = L["Alpha to use for bar."],
  828. arg = "bars.alpha",
  829. min = 0, max = 1, step = 0.05,
  830. isPercent = true
  831. },
  832. backgroundAlpha = {
  833. order = 4,
  834. type = "range",
  835. name = L["Background alpha"],
  836. desc = L["Alpha to use for bar backgrounds."],
  837. arg = "bars.backgroundAlpha",
  838. min = 0, max = 1, step = 0.05,
  839. isPercent = true
  840. },
  841. },
  842. },
  843. range = {
  844. order = 5,
  845. type = "group",
  846. inline = true,
  847. name = L["Range spells"],
  848. args = {
  849. friendly = {
  850. order = 0,
  851. type = "input",
  852. name = L["Friendly spell"],
  853. desc = L["Name of a friendly spell to check range on friendlies.|n|nThis is automatically set for your current class only."],
  854. validate = validateSpell,
  855. set = setRange,
  856. get = getRange,
  857. },
  858. hostile = {
  859. order = 1,
  860. type = "input",
  861. name = L["Hostile spell"],
  862. desc = L["Name of a hostile spell to check range on enemies.|n|nThis is automatically set for your current class only."],
  863. validate = validateSpell,
  864. set = setRange,
  865. get = getRange,
  866. },
  867. },
  868. },
  869. },
  870. },
  871. color = {
  872. order = 2,
  873. type = "group",
  874. name = L["Colors"],
  875. args = {
  876. health = {
  877. order = 1,
  878. type = "group",
  879. inline = true,
  880. name = L["Health"],
  881. set = setColor,
  882. get = getColor,
  883. args = {
  884. green = {
  885. order = 1,
  886. type = "color",
  887. name = L["High health"],
  888. desc = L["Health bar color used as the transitional color for 100% -> 50% on players, as well as when your pet is happy."],
  889. arg = "healthColors.green",
  890. },
  891. yellow = {
  892. order = 2,
  893. type = "color",
  894. name = L["Half health"],
  895. desc = L["Health bar color used as the transitional color for 100% -> 0% on players, as well as when your pet is mildly unhappy."],
  896. arg = "healthColors.yellow",
  897. },
  898. red = {
  899. order = 3,
  900. type = "color",
  901. name = L["Low health"],
  902. desc = L["Health bar color used as the transitional color for 50% -> 0% on players, as well as when your pet is very unhappy."],
  903. arg = "healthColors.red",
  904. },
  905. friendly = {
  906. order = 4,
  907. type = "color",
  908. name = L["Friendly"],
  909. desc = L["Health bar color for friendly units."],
  910. arg = "healthColors.friendly",
  911. },
  912. neutral = {
  913. order = 5,
  914. type = "color",
  915. name = L["Neutral"],
  916. desc = L["Health bar color for neutral units."],
  917. arg = "healthColors.neutral",
  918. },
  919. hostile = {
  920. order = 6,
  921. type = "color",
  922. name = L["Hostile"],
  923. desc = L["Health bar color for hostile units."],
  924. arg = "healthColors.hostile",
  925. },
  926. static = {
  927. order = 7,
  928. type = "color",
  929. name = L["Static"],
  930. desc = L["Color to use for health bars that are set to be colored by a static color."],
  931. arg = "healthColors.static",
  932. },
  933. inc = {
  934. order = 8,
  935. type = "color",
  936. name = L["Incoming heal"],
  937. desc = L["Health bar color to use to show how much healing someone is about to receive."],
  938. arg = "healthColors.inc",
  939. },
  940. enemyUnattack = {
  941. order = 9,
  942. type = "color",
  943. name = L["Unattackable hostile"],
  944. desc = L["Health bar color to use for hostile units who you cannot attack, used for reaction coloring."],
  945. hidden = hideAdvancedOption,
  946. arg = "healthColors.enemyUnattack",
  947. }
  948. },
  949. },
  950. power = {
  951. order = 2,
  952. type = "group",
  953. inline = true,
  954. name = L["Power"],
  955. set = setColor,
  956. get = getColor,
  957. args = {
  958. MANA = {
  959. order = 0,
  960. type = "color",
  961. name = L["Mana"],
  962. hasAlpha = true,
  963. width = "half",
  964. arg = "powerColors.MANA",
  965. },
  966. RAGE = {
  967. order = 1,
  968. type = "color",
  969. name = L["Rage"],
  970. hasAlpha = true,
  971. width = "half",
  972. arg = "powerColors.RAGE",
  973. },
  974. FOCUS = {
  975. order = 2,
  976. type = "color",
  977. name = L["Focus"],
  978. hasAlpha = true,
  979. arg = "powerColors.FOCUS",
  980. width = "half",
  981. },
  982. ENERGY = {
  983. order = 3,
  984. type = "color",
  985. name = L["Energy"],
  986. hasAlpha = true,
  987. arg = "powerColors.ENERGY",
  988. width = "half",
  989. },
  990. RUNIC_POWER = {
  991. order = 6,
  992. type = "color",
  993. name = L["Runic Power"],
  994. hasAlpha = true,
  995. arg = "powerColors.RUNIC_POWER",
  996. },
  997. ECLIPSE_MOON = {
  998. order = 7,
  999. type = "color",
  1000. name = L["Eclipse (Moon)"],
  1001. desc = L["Bar coloring for the moon portion of the eclipse bar."],
  1002. hidden = function(info) return select(2, UnitClass("player")) ~= "DRUID" end,
  1003. hasAlpha = true,
  1004. arg = "powerColors.ECLIPSE_MOON",
  1005. },
  1006. ECLIPSE_SUN = {
  1007. order = 8,
  1008. type = "color",
  1009. name = L["Eclipse (Sun)"],
  1010. desc = L["Bar coloring for the moon portion of the eclipse bar."],
  1011. hidden = function(info) return select(2, UnitClass("player")) ~= "DRUID" end,
  1012. hasAlpha = true,
  1013. arg = "powerColors.ECLIPSE_SUN",
  1014. },
  1015. AMMOSLOT = {
  1016. order = 9,
  1017. type = "color",
  1018. name = L["Ammo"],
  1019. hasAlpha = true,
  1020. arg = "powerColors.AMMOSLOT",
  1021. hidden = hideAdvancedOption,
  1022. },
  1023. FUEL = {
  1024. order = 10,
  1025. type = "color",
  1026. name = L["Fuel"],
  1027. hasAlpha = true,
  1028. arg = "powerColors.FUEL",
  1029. hidden = hideAdvancedOption,
  1030. },
  1031. COMBOPOINTS = {
  1032. order = 11,
  1033. type = "color",
  1034. name = L["Combo points"],
  1035. hasAlpha = true,
  1036. arg = "powerColors.COMBOPOINTS",
  1037. },
  1038. HOLYPOWER = {
  1039. order = 12,
  1040. type = "color",
  1041. name = L["Holy Power"],
  1042. hasAlpha = true,
  1043. arg = "powerColors.HOLYPOWER",
  1044. hidden = function(info) return select(2, UnitClass("player")) ~= "PALADIN" end,
  1045. },
  1046. SOULSHARDS = {
  1047. order = 13,
  1048. type = "color",
  1049. name = L["Soul Shards"],
  1050. hasAlpha = true,
  1051. arg = "powerColors.SOULSHARDS",
  1052. hidden = function(info) return select(2, UnitClass("player")) ~= "WARLOCK" end,
  1053. },
  1054. },
  1055. },
  1056. cast = {
  1057. order = 3,
  1058. type = "group",
  1059. inline = true,
  1060. name = L["Cast"],
  1061. set = setColor,
  1062. get = getColor,
  1063. args = {
  1064. cast = {
  1065. order = 0,
  1066. type = "color",
  1067. name = L["Casting"],
  1068. desc = L["Color used when an unit is casting a spell."],
  1069. arg = "castColors.cast",
  1070. },
  1071. channel = {
  1072. order = 1,
  1073. type = "color",
  1074. name = L["Channelling"],
  1075. desc = L["Color used when a cast is a channel."],
  1076. arg = "castColors.channel",
  1077. },
  1078. sep = {
  1079. order = 2,
  1080. type = "description",
  1081. name = "",
  1082. hidden = hideAdvancedOption,
  1083. width = "full",
  1084. },
  1085. finished = {
  1086. order = 3,
  1087. type = "color",
  1088. name = L["Finished cast"],
  1089. desc = L["Color used when a cast is successfully finished."],
  1090. hidden = hideAdvancedOption,
  1091. arg = "castColors.finished",
  1092. },
  1093. interrupted = {
  1094. order = 4,
  1095. type = "color",
  1096. name = L["Cast interrupted"],
  1097. desc = L["Color used when a cast is interrupted either by the caster themselves or by another unit."],
  1098. hidden = hideAdvancedOption,
  1099. arg = "castColors.interrupted",
  1100. },
  1101. uninterruptible = {
  1102. order = 5,
  1103. type = "color",
  1104. name = L["Cast uninterruptible"],
  1105. desc = L["Color used when a cast cannot be interrupted, this is only used for PvE mobs."],
  1106. arg = "castColors.uninterruptible",
  1107. },
  1108. },
  1109. },
  1110. auras = {
  1111. order = 3.5,
  1112. type = "group",
  1113. inline = true,
  1114. name = L["Aura borders"],
  1115. set = setColor,
  1116. get = getColor,
  1117. hidden = hideAdvancedOption,
  1118. args = {
  1119. removableColor = {
  1120. order = 0,
  1121. type = "color",
  1122. name = L["Stealable or Removable"],
  1123. desc = L["Border coloring of stealable or removable auras."],
  1124. arg = "auraColors.removable",
  1125. }
  1126. }
  1127. },
  1128. classColors = {
  1129. order = 4,
  1130. type = "group",
  1131. inline = true,
  1132. name = L["Classes"],
  1133. set = setColor,
  1134. get = getColor,
  1135. args = {}
  1136. },
  1137. },
  1138. },
  1139. profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ShadowUF.db, true),
  1140. text = {
  1141. type = "group",
  1142. order = 6,
  1143. name = L["Text management"],
  1144. hidden = false,
  1145. args = {
  1146. help = {
  1147. order = 0,
  1148. type = "group",
  1149. inline = true,
  1150. name = L["Help"],
  1151. args = {
  1152. help = {
  1153. order = 0,
  1154. type = "description",
  1155. name = L["You can add additional text with tags enabled using this configuration, note that any additional text added (or removed) effects all units, removing text will reset their settings as well.|n|nKeep in mind, you cannot delete the default text included with the units."],
  1156. },
  1157. },
  1158. },
  1159. add = {
  1160. order = 1,
  1161. name = L["Add new text"],
  1162. inline = true,
  1163. type = "group",
  1164. set = function(info, value) textData[info[#(info)] ] = value end,
  1165. get = function(info, value) return textData[info[#(info)] ] end,
  1166. args = {
  1167. name = {
  1168. order = 0,
  1169. type = "input",
  1170. name = L["Text name"],
  1171. desc = L["Text name that you can use to identify this text from others when configuring."],
  1172. },
  1173. parent = {
  1174. order = 1,
  1175. type = "select",
  1176. name = L["Text parent"],
  1177. desc = L["Where inside the frame the text should be anchored to."],
  1178. values = barModules,
  1179. },
  1180. add = {
  1181. order = 2,
  1182. type = "execute",
  1183. name = L["Add"],
  1184. disabled = function() return not textData.name or textData.name == "" or not textData.parent end,
  1185. func = function(info)
  1186. -- Verify we entered a good name
  1187. textData.name = string.trim(textData.name)
  1188. textData.name = textData.name ~= "" and textData.name or nil
  1189. -- Add the new entry
  1190. for _, unit in pairs(ShadowUF.unitList) do
  1191. table.insert(ShadowUF.db.profile.units[unit].text, {enabled = true, name = textData.name or "??", text = "", anchorTo = textData.parent, x = 0, y = 0, anchorPoint = "C", size = 0, width = 0.50})
  1192. end
  1193. -- Add it to the GUI
  1194. local id = tostring(#(ShadowUF.db.profile.units.player.text))
  1195. addTextParent.args[id .. ":label"] = addTextLabel
  1196. addTextParent.args[id] = addText
  1197. addTextParent.args[id .. ":sep"] = addTextSep
  1198. options.args.general.args.text.args[textData.parent] = options.args.general.args.text.args[textData.parent] or addTextParent
  1199. local parent = string.sub(textData.parent, 2)
  1200. Config.tagWizard[parent] = Config.tagWizard[parent] or Config.parentTable
  1201. Config.tagWizard[parent].args[id] = Config.tagTextTable
  1202. Config.tagWizard[parent].args[id .. ":adv"] = Config.advanceTextTable
  1203. quickIDMap[id .. ":adv"] = #(ShadowUF.db.profile.units.player.text)
  1204. -- Reset
  1205. textData.name = nil
  1206. textData.parent = nil
  1207. end,
  1208. },
  1209. },
  1210. },
  1211. },
  1212. },
  1213. layout = layoutManager,
  1214. },
  1215. }
  1216. -- Load text
  1217. for id, text in pairs(ShadowUF.db.profile.units.player.text) do
  1218. addTextParent.args[id .. ":label"] = addTextLabel
  1219. addTextParent.args[tostring(id)] = addText
  1220. addTextParent.args[id .. ":sep"] = addTextSep
  1221. options.args.general.args.text.args[text.anchorTo] = addTextParent
  1222. end
  1223. Config.classTable = {
  1224. order = 0,
  1225. type = "color",
  1226. name = getName,
  1227. hasAlpha = true,
  1228. width = "half",
  1229. arg = "classColors.$key",
  1230. }
  1231. for classToken in pairs(RAID_CLASS_COLORS) do
  1232. options.args.general.args.color.args.classColors.args[classToken] = Config.classTable
  1233. end
  1234. options.args.general.args.color.args.classColors.args.PET = Config.classTable
  1235. options.args.general.args.color.args.classColors.args.VEHICLE = Config.classTable
  1236. options.args.general.args.profile.order = 4
  1237. end
  1238. ---------------------
  1239. -- HIDE BLIZZARD FRAMES CONFIGURATION
  1240. ---------------------
  1241. local function loadHideOptions()
  1242. Config.hideTable = {
  1243. order = function(info) return info[#(info)] == "buffs" and 1 or 2 end,
  1244. type = "toggle",
  1245. name = function(info)
  1246. local key = info[#(info)]
  1247. return L.units[key] and string.format(L["Hide %s frames"], string.lower(L.units[key])) or string.format(L["Hide %s"], key == "cast" and L["player cast bar"] or key == "runes" and L["rune bar"] or key == "buffs" and L["buff frames"] or key == "playerAltPower" and L["player alt. power"])
  1248. end,
  1249. set = function(info, value)
  1250. set(info, value)
  1251. if( value ) then ShadowUF:HideBlizzardFrames() end
  1252. end,
  1253. hidden = false,
  1254. get = get,
  1255. arg = "hidden.$key",
  1256. }
  1257. options.args.hideBlizzard = {
  1258. type = "group",
  1259. name = L["Hide Blizzard"],
  1260. desc = getPageDescription,
  1261. args = {
  1262. help = {
  1263. order = 0,
  1264. type = "group",
  1265. name = L["Help"],
  1266. inline = true,
  1267. args = {
  1268. description = {
  1269. type = "description",
  1270. name = L["You will need to do a /console reloadui before a hidden frame becomes visible again.|nPlayer and other unit frames are automatically hidden depending on if you enable the unit in Shadowed Unit Frames."],
  1271. width = "full",
  1272. },
  1273. },
  1274. },
  1275. hide = {
  1276. order = 1,
  1277. type = "group",
  1278. name = L["Frames"],
  1279. inline = true,
  1280. args = {
  1281. buffs = Config.hideTable,
  1282. cast = Config.hideTable,
  1283. runes = Config.hideTable,
  1284. party = Config.hideTable,
  1285. raid = Config.hideTable,
  1286. player = Config.hideTable,
  1287. pet = Config.hideTable,
  1288. target = Config.hideTable,
  1289. focus = Config.hideTable,
  1290. boss = Config.hideTable,
  1291. arena = Config.hideTable,
  1292. playerAltPower = Config.hideTable,
  1293. },
  1294. },
  1295. }
  1296. }
  1297. end
  1298. ---------------------
  1299. -- UNIT CONFIGURATION
  1300. ---------------------
  1301. local function loadUnitOptions()
  1302. -- This makes sure we don't end up with any messed up positioning due to two different anchors being used
  1303. local function fixPositions(info)
  1304. local unit = info[2]
  1305. local key = info[#(info)]
  1306. if( key == "point" or key == "relativePoint" ) then
  1307. ShadowUF.db.profile.positions[unit].anchorPoint = ""
  1308. ShadowUF.db.profile.positions[unit].movedAnchor = nil
  1309. elseif( key == "anchorPoint" ) then
  1310. ShadowUF.db.profile.positions[unit].point = ""
  1311. ShadowUF.db.profile.positions[unit].relativePoint = ""
  1312. end
  1313. -- Reset offset if it was a manually positioned frame, and it got anchored
  1314. -- Why 100/-100 you ask? Because anything else requires some sort of logic applied to it
  1315. -- and this means the frames won't directly overlap too which is a nice bonus
  1316. if( key == "anchorTo" ) then
  1317. ShadowUF.db.profile.positions[unit].x = 100
  1318. ShadowUF.db.profile.positions[unit].y = -100
  1319. end
  1320. end
  1321. -- Hide raid option in party config
  1322. local function hideRaidOrAdvancedOption(info)
  1323. if( info[2] == "party" and ShadowUF.db.profile.advanced ) then return false end
  1324. return info[2] ~= "raid" and info[2] ~= "raidpet" and info[2] ~= "maintank" and info[2] ~= "mainassist"
  1325. end
  1326. local function hideRaidOption(info)
  1327. return info[2] ~= "raid" and info[2] ~= "raidpet" and info[2] ~= "maintank" and info[2] ~= "mainassist"
  1328. end
  1329. local function hideSplitOrRaidOption(info)
  1330. if( info[2] == "raid" and ShadowUF.db.profile.units.raid.frameSplit ) then
  1331. return true
  1332. end
  1333. return hideRaidOption(info)
  1334. end
  1335. -- Not every option should be changed via global settings
  1336. local function hideSpecialOptions(info)
  1337. local unit = info[2]
  1338. if( unit == "global" or unit == "partypet" ) then
  1339. return true
  1340. end
  1341. return hideAdvancedOption(info)
  1342. end
  1343. local function checkNumber(info, value)
  1344. return tonumber(value)
  1345. end
  1346. local function setPosition(info, value)
  1347. ShadowUF.db.profile.positions[info[2]][info[#(info)]] = value
  1348. fixPositions(info)
  1349. if( info[2] == "raid" or info[2] == "raidpet" or info[2] == "maintank" or info[2] == "mainassist" or info[2] == "party" or info[2] == "boss" or info[2] == "arena" ) then
  1350. ShadowUF.Units:ReloadHeader(info[2])
  1351. else
  1352. ShadowUF.Layout:Reload(info[2])
  1353. end
  1354. end
  1355. local function getPosition(info)
  1356. return ShadowUF.db.profile.positions[info[2]][info[#(info)]]
  1357. end
  1358. local function setNumber(info, value)
  1359. local unit = info[2]
  1360. local key = info[#(info)]
  1361. local id = unit .. key
  1362. -- Apply effective scaling if it's anchored to UIParent
  1363. if( ShadowUF.db.profile.positions[unit].anchorTo == "UIParent" ) then
  1364. value = value * (ShadowUF.db.profile.units[unit].scale * UIParent:GetScale())
  1365. end
  1366. setPosition(info, tonumber(value))
  1367. end
  1368. local function getString(info)
  1369. local unit = info[2]
  1370. local key = info[#(info)]
  1371. local id = unit .. key
  1372. local coord = getPosition(info)
  1373. -- If the frame is created and it's anchored to UIParent, will return the number modified by scale
  1374. if( ShadowUF.db.profile.positions[unit].anchorTo == "UIParent" ) then
  1375. coord = coord / (ShadowUF.db.profile.units[unit].scale * UIParent:GetScale())
  1376. end
  1377. -- OCD, most definitely.
  1378. -- Pain to check coord == math.floor(coord) because floats are handled oddly with frames and return 0.99999999999435
  1379. return string.gsub(string.format("%.2f", coord), "%.00$", "")
  1380. end
  1381. -- TAG WIZARD
  1382. local tagWizard = {}
  1383. Config.tagWizard = tagWizard
  1384. do
  1385. -- Load tag list
  1386. Config.advanceTextTable = {
  1387. order = 1,
  1388. name = function(info) return getVariable(info[2], "text", quickIDMap[info[#(info)]], "name") end,
  1389. type = "group",
  1390. inline = true,
  1391. hidden = function(info)
  1392. if( not getVariable(info[2], "text", nil, quickIDMap[info[#(info)]]) ) then return true end
  1393. return string.sub(getVariable(info[2], "text", quickIDMap[info[#(info)]], "anchorTo"), 2) ~= info[#(info) - 1]
  1394. end,
  1395. set = function(info, value)
  1396. info.arg = string.format("text.%s.%s", quickIDMap[info[#(info) - 1]], info[#(info)])
  1397. setUnit(info, value)
  1398. end,
  1399. get = function(info)
  1400. info.arg = string.format("text.%s.%s", quickIDMap[info[#(info) - 1]], info[#(info)])
  1401. return getUnit(info)
  1402. end,
  1403. args = {
  1404. anchorPoint = {
  1405. order = 1,
  1406. type = "select",
  1407. name = L["Anchor point"],
  1408. values = {["LC"] = L["Left Center"], ["RT"] = L["Right Top"], ["RB"] = L["Right Bottom"], ["LT"] = L["Left Top"], ["LB"] = L["Left Bottom"], ["RC"] = L["Right Center"],["TRI"] = L["Inside Top Right"], ["TLI"] = L["Inside Top Left"], ["CLI"] = L["Inside Center Left"], ["C"] = L["Inside Center"], ["CRI"] = L["Inside Center Right"], ["TR"] = L["Top Right"], ["TL"] = L["Top Left"], ["BR"] = L["Bottom Right"], ["BL"] = L["Bottom Left"]},
  1409. hidden = hideAdvancedOption,
  1410. },
  1411. sep = {
  1412. order = 2,
  1413. type = "description",
  1414. name = "",
  1415. width = "full",
  1416. hidden = hideAdvancedOption,
  1417. },
  1418. width = {
  1419. order = 3,
  1420. name = L["Width weight"],
  1421. desc = L["How much weight this should use when figuring out the total text width."],
  1422. type = "range",
  1423. min = 0, max = 10, step = 0.1,
  1424. hidden = false,
  1425. },
  1426. size = {
  1427. order = 4,
  1428. name = L["Size"],
  1429. desc = L["Let's you modify the base font size to either make it larger or smaller."],
  1430. type = "range",
  1431. min = -20, max = 20, step = 1, softMin = -5, softMax = 5,
  1432. hidden = false,
  1433. },
  1434. x = {
  1435. order = 5,
  1436. type = "range",
  1437. name = L["X Offset"],
  1438. min = -1000, max = 1000, step = 1, softMin = -100, softMax = 100,
  1439. hidden = false,
  1440. },
  1441. y = {
  1442. order = 6,
  1443. type = "range",
  1444. name = L["Y Offset"],
  1445. min = -1000, max = 1000, step = 1, softMin = -100, softMax = 100,
  1446. hidden = false,
  1447. },
  1448. },
  1449. }
  1450. Config.parentTable = {
  1451. order = 0,
  1452. type = "group",
  1453. hidden = false,
  1454. name = function(info) return getName(info) or string.sub(info[#(info)], 1) end,
  1455. hidden = function(info) return not getVariable(info[2], info[#(info)], nil, "enabled") end,
  1456. args = {}
  1457. }
  1458. local function hideBlacklistedTag(info)
  1459. local unit = info[2]
  1460. local tag = info[#(info)]
  1461. if( unit == "global" ) then
  1462. for unit in pairs(modifyUnits) do
  1463. if( ShadowUF.Tags.unitRestrictions[tag] == unit ) then
  1464. return false
  1465. end
  1466. end
  1467. end
  1468. if( ShadowUF.Tags.unitRestrictions[tag] and ShadowUF.Tags.unitRestrictions[tag] ~= unit ) then
  1469. return true
  1470. end
  1471. return false
  1472. end
  1473. local function hideBlacklistedGroup(info)
  1474. local unit = info[2]
  1475. local tagGroup = info[#(info)]
  1476. if( unit ~= "global" ) then
  1477. if( ShadowUF.Tags.unitBlacklist[tagGroup] and string.match(unit, ShadowUF.Tags.unitBlacklist[tagGroup]) ) then
  1478. return true
  1479. end
  1480. else
  1481. -- If the only units that are in the global configuration have the tag filtered, then don't bother showing it
  1482. for unit in pairs(modifyUnits) do
  1483. if( not ShadowUF.Tags.unitBlacklist[tagGroup] or not string.match(unit, ShadowUF.Tags.unitBlacklist[tagGroup]) ) then
  1484. return false
  1485. end
  1486. end
  1487. end
  1488. return false
  1489. end
  1490. local savedTagTexts = {}
  1491. local function selectTag(info, value)
  1492. local unit = info[2]
  1493. local id = tonumber(info[#(info) - 2])
  1494. local tag = info[#(info)]
  1495. local text = getVariable(unit, "text", id, "text")
  1496. local savedText
  1497. if( value ) then
  1498. if( unit == "global" ) then
  1499. table.wipe(savedTagTexts)
  1500. -- Set special tag texts based on the unit, so targettarget won't get a tag that will cause errors
  1501. local tagGroup = ShadowUF.Tags.defaultCategories[tag]
  1502. for unit in pairs(modifyUnits) do
  1503. savedTagTexts[unit] = getVariable(unit, "text", id, "text")
  1504. if( not ShadowUF.Tags.unitBlacklist[tagGroup] or not string.match(unit, ShadowUF.Tags.unitBlacklist[tagGroup]) ) then
  1505. if( not ShadowUF.Tags.unitRestrictions[tag] or ShadowUF.Tags.unitRestrictions[tag] == unit ) then
  1506. if( text == "" ) then
  1507. savedTagTexts[unit] = string.format("[%s]", tag)
  1508. else
  1509. savedTagTexts[unit] = string.format("%s[( )%s]", savedTagTexts[unit], tag)
  1510. end
  1511. savedTagTexts.global = savedTagTexts[unit]
  1512. end
  1513. end
  1514. end
  1515. else
  1516. if( text == "" ) then
  1517. text = string.format("[%s]", tag)
  1518. else
  1519. text = string.format("%s[( )%s]", text, tag)
  1520. end
  1521. end
  1522. -- Removing a tag from global config, need to make sure we can do it
  1523. -- Hack, clean up later
  1524. elseif( unit == "global" ) then
  1525. table.wipe(savedTagTexts)
  1526. for unit in pairs(modifyUnits) do
  1527. if( not ShadowUF.Tags.unitBlacklist[tagGroup] or not string.match(unit, ShadowUF.Tags.unitBlacklist[tagGroup]) ) then
  1528. if( not ShadowUF.Tags.unitRestrictions[tag] or ShadowUF.Tags.unitRestrictions[tag] == unit ) then
  1529. local text = getVariable(unit, "text", id, "text")
  1530. for matchedTag in string.gmatch(text, "%[(.-)%]") do
  1531. local safeTag = "[" .. matchedTag .. "]"
  1532. if( string.match(safeTag, "%[" .. tag .. "%]") or string.match(safeTag, "%)" .. tag .. "%]") or string.match(safeTag, "%[" .. tag .. "%(") or string.match(safeTag, "%)" .. tag .. "%(") ) then
  1533. text = string.gsub(text, "%[" .. string.gsub(string.gsub(matchedTag, "%)", "%%)"), "%(", "%%(") .. "%]", "")
  1534. text = string.gsub(text, " ", "")
  1535. text = string.trim(text)
  1536. break
  1537. end
  1538. end
  1539. savedTagTexts[unit] = text
  1540. savedTagTexts.global = text
  1541. end
  1542. end
  1543. end
  1544. -- Removing a tag from a single unit, super easy :<
  1545. else
  1546. -- Ugly, but it works
  1547. for matchedTag in string.gmatch(text, "%[(.-)%]") do
  1548. local safeTag = "[" .. matchedTag .. "]"
  1549. if( string.match(safeTag, "%[" .. tag .. "%]") or string.match(safeTag, "%)" .. tag .. "%]") or string.match(safeTag, "%[" .. tag .. "%(") or string.match(safeTag, "%)" .. tag .. "%(") ) then
  1550. text = string.gsub(text, "%[" .. string.gsub(string.gsub(matchedTag, "%)", "%%)"), "%(", "%%(") .. "%]", "")
  1551. text = string.gsub(text, " ", "")
  1552. text = string.trim(text)
  1553. break
  1554. end
  1555. end
  1556. end
  1557. if( unit == "global" ) then
  1558. for unit in pairs(modifyUnits) do
  1559. if( savedTagTexts[unit] ) then
  1560. setVariable(unit, "text", id, "text", savedTagTexts[unit])
  1561. end
  1562. end
  1563. setVariable("global", "text", id, "text", savedTagTexts.global)
  1564. else
  1565. setVariable(unit, "text", id, "text", text)
  1566. end
  1567. end
  1568. local function getTag(info)
  1569. local text = getVariable(info[2], "text", tonumber(info[#(info) - 2]), "text")
  1570. local tag = info[#(info)]
  1571. -- FUN WITH PATTERN MATCHING
  1572. if( string.match(text, "%[" .. tag .. "%]") or string.match(text, "%)" .. tag .. "%]") or string.match(text, "%[" .. tag .. "%(") or string.match(text, "%)" .. tag .. "%(") ) then
  1573. return true
  1574. end
  1575. return false
  1576. end
  1577. Config.tagTextTable = {
  1578. type = "group",
  1579. name = function(info) return getVariable(info[2], "text", nil, tonumber(info[#(info)])) and getVariable(info[2], "text", tonumber(info[#(info)]), "name") or "" end,
  1580. hidden = function(info)
  1581. if( not getVariable(info[2], "text", nil, tonumber(info[#(info)])) ) then return true end
  1582. return string.sub(getVariable(info[2], "text", tonumber(info[#(info)]), "anchorTo"), 2) ~= info[#(info) - 1] end,
  1583. set = false,
  1584. get = false,
  1585. args = {
  1586. text = {
  1587. order = 0,
  1588. type = "input",
  1589. name = L["Text"],
  1590. width = "full",
  1591. hidden = false,
  1592. set = function(info, value) setUnit(info, string.gsub(value, "||", "|")) end,
  1593. get = function(info) return string.gsub(getUnit(info), "|", "||") end,
  1594. arg = "text.$parent.text",
  1595. },
  1596. },
  1597. }
  1598. local function getCategoryOrder(info)
  1599. return info[#(info)] == "health" and 1 or info[#(info)] == "power" and 2 or info[#(info)] == "misc" and 3 or 4
  1600. end
  1601. for _, cat in pairs(ShadowUF.Tags.defaultCategories) do
  1602. Config.tagTextTable.args[cat] = Config.tagTextTable.args[cat] or {
  1603. order = getCategoryOrder,
  1604. type = "group",
  1605. inline = true,
  1606. name = getName,
  1607. hidden = hideBlacklistedGroup,
  1608. set = selectTag,
  1609. get = getTag,
  1610. args = {},
  1611. }
  1612. end
  1613. Config.tagTable = {
  1614. order = 0,
  1615. type = "toggle",
  1616. hidden = hideBlacklistedTag,
  1617. name = getTagName,
  1618. desc = getTagHelp,
  1619. }
  1620. local tagList = {}
  1621. for tag in pairs(ShadowUF.Tags.defaultTags) do
  1622. local category = ShadowUF.Tags.defaultCategories[tag] or "misc"
  1623. Config.tagTextTable.args[category].args[tag] = Config.tagTable
  1624. end
  1625. for tag, data in pairs(ShadowUF.db.profile.tags) do
  1626. local category = data.category or "misc"
  1627. Config.tagTextTable.args[category].args[tag] = Config.tagTable
  1628. end
  1629. local parentList = {}
  1630. for id, text in pairs(ShadowUF.db.profile.units.player.text) do
  1631. parentList[text.anchorTo] = parentList[text.anchorTo] or {}
  1632. parentList[text.anchorTo][id] = text
  1633. end
  1634. local nagityNagNagTable = {
  1635. order = 0,
  1636. type = "group",
  1637. name = L["Help"],
  1638. inline = true,
  1639. hidden = false,
  1640. args = {
  1641. help = {
  1642. order = 0,
  1643. type = "description",
  1644. name = L["Selecting a tag text from the left panel to change tags. Truncating width, sizing, and offsets can be done in the current panel."],
  1645. },
  1646. },
  1647. }
  1648. for parent, list in pairs(parentList) do
  1649. parent = string.sub(parent, 2)
  1650. tagWizard[parent] = Config.parentTable
  1651. Config.parentTable.args.help = nagityNagNagTable
  1652. for id in pairs(list) do
  1653. tagWizard[parent].args[tostring(id)] = Config.tagTextTable
  1654. tagWizard[parent].args[tostring(id) .. ":adv"] = Config.advanceTextTable
  1655. quickIDMap[tostring(id) .. ":adv"] = id
  1656. end
  1657. end
  1658. end
  1659. local function disableAnchoredTo(info)
  1660. local auras = getVariable(info[2], "auras", nil, info[#(info) - 1])
  1661. return auras.anchorOn or not auras.enabled
  1662. end
  1663. local function disableSameAnchor(info)
  1664. local buffs = getVariable(info[2], "auras", nil, "buffs")
  1665. local debuffs = getVariable(info[2], "auras", nil, "debuffs")
  1666. local anchor = buffs.enabled and buffs.prioritize and "buffs" or "debuffs"
  1667. if( not getVariable(info[2], "auras", info[#(info) - 1], "enabled") ) then
  1668. return true
  1669. end
  1670. if( ( info[#(info)] == "x" or info[#(info)] == "y" ) and ( info[#(info) - 1] == "buffs" and buffs.anchorOn or info[#(info) - 1] == "debuffs" and debuffs.anchorOn ) ) then
  1671. return true
  1672. end
  1673. if( anchor == info[#(info) - 1] or buffs.anchorOn or debuffs.anchorOn ) then
  1674. return false
  1675. end
  1676. return buffs.anchorPoint == debuffs.anchorPoint
  1677. end
  1678. local defaultAuraList = {["BL"] = L["Bottom"], ["TL"] = L["Top"], ["LT"] = L["Left"], ["RT"] = L["Right"]}
  1679. local advancedAuraList = {["BL"] = L["Bottom Left"], ["BR"] = L["Bottom Right"], ["TL"] = L["Top Left"], ["TR"] = L["Top Right"], ["RT"] = L["Right Top"], ["RB"] = L["Right Bottom"], ["LT"] = L["Left Top"], ["LB"] = L["Left Bottom"]}
  1680. local function getAuraAnchors()
  1681. return ShadowUF.db.profile.advanced and advancedAuraList or defaultAuraList
  1682. end
  1683. local function hideStealable(info)
  1684. if( not ShadowUF.db.profile.advanced ) then return true end
  1685. if( info[2] == "player" or info[2] == "pet" or info[#(info) - 1] == "debuffs" ) then return true end
  1686. return false
  1687. end
  1688. Config.auraTable = {
  1689. type = "group",
  1690. inline = true,
  1691. hidden = false,
  1692. name = function(info) return info[#(info)] == "buffs" and L["Buffs"] or L["Debuffs"] end,
  1693. order = function(info) return info[#(info)] == "buffs" and 1 or 2 end,
  1694. disabled = function(info) return not getVariable(info[2], "auras", info[#(info) - 1], "enabled") end,
  1695. args = {
  1696. enabled = {
  1697. order = 1,
  1698. type = "toggle",
  1699. name = function(info) if( info[#(info) - 1] == "buffs" ) then return L["Enable buffs"] end return L["Enable debuffs"] end,
  1700. disabled = false,
  1701. arg = "auras.$parent.enabled",
  1702. },
  1703. anchorOn = {
  1704. order = 2,
  1705. type = "toggle",
  1706. name = function(info) return info[#(info) - 1] == "buffs" and L["Anchor to debuffs"] or L["Anchor to buffs"] end,
  1707. desc = L["Allows you to anchor the aura group to another, you can then choose where it will be anchored using the position.|n|nUse this if you want to duplicate the default ui style where buffs and debuffs are separate groups."],
  1708. set = function(info, value)
  1709. setVariable(info[2], "auras", info[#(info) - 1] == "buffs" and "debuffs" or "buffs", "anchorOn", false)
  1710. setUnit(info, value)
  1711. end,
  1712. arg = "auras.$parent.anchorOn",
  1713. },
  1714. prioritize = {
  1715. order = 2.25,
  1716. type = "toggle",
  1717. name = L["Prioritize buffs"],
  1718. desc = L["Show buffs before debuffs when sharing the same anchor point."],
  1719. hidden = function(info) return info[#(info) - 1] == "debuffs" end,
  1720. disabled = function(info)
  1721. if( not getVariable(info[2], "auras", info[#(info) - 1], "enabled") ) then return true end
  1722. local buffs = getVariable(info[2], "auras", nil, "buffs")
  1723. local debuffs = getVariable(info[2], "auras", nil, "debuffs")
  1724. return buffs.anchorOn or debuffs.anchorOn or buffs.anchorPoint ~= debuffs.anchorPoint
  1725. end,
  1726. arg = "auras.$parent.prioritize",
  1727. },
  1728. sep2 = {
  1729. order = 6,
  1730. type = "description",
  1731. name = "",
  1732. width = "full",
  1733. },
  1734. enlargeStealable = {
  1735. order = 6.5,
  1736. type = "toggle",
  1737. name = L["Enlarge removable auras"],
  1738. desc = L["If you can Spellsteal or remove an aura, then it will be shown scaled using the scaled aura size option."],
  1739. arg = "auras.$parent.enlargeStealable",
  1740. hidden = hideStealable,
  1741. },
  1742. player = {
  1743. order = 7,
  1744. type = "toggle",
  1745. name = L["Show your auras only"],
  1746. desc = L["Filter out any auras that you did not cast yourself."],
  1747. arg = "auras.$parent.player",
  1748. },
  1749. raid = {
  1750. order = 8,
  1751. type = "toggle",
  1752. name = function(info) return info[#(info) - 1] == "buffs" and L["Show castable on other auras only"] or L["Show curable only"] end,
  1753. desc = function(info) return info[#(info) - 1] == "buffs" and L["Filter out any auras that you cannot cast on another player, or yourself."] or L["Filter out any aura that you cannot cure."] end,
  1754. width = "double",
  1755. arg = "auras.$parent.raid",
  1756. hidden = function(info) return not hideStealable(info) end,
  1757. },
  1758. raid2 = {
  1759. order = 8,
  1760. type = "toggle",
  1761. name = function(info) return info[#(info) - 1] == "buffs" and L["Show castable on other auras only"] or L["Show curable only"] end,
  1762. desc = function(info) return info[#(info) - 1] == "buffs" and L["Filter out any auras that you cannot cast on another player, or yourself."] or L["Filter out any aura that you cannot cure."] end,
  1763. arg = "auras.$parent.raid",
  1764. hidden = hideStealable,
  1765. },
  1766. sep3 = {
  1767. order = 9,
  1768. type = "description",
  1769. name = "",
  1770. width = "full",
  1771. },
  1772. selfTimers = {
  1773. order = 9.5,
  1774. type = "toggle",
  1775. name = L["Timers for self auras only"],
  1776. desc = L["Hides the cooldown ring for any auras that you did not cast."],
  1777. hidden = hideAdvancedOption,
  1778. arg = "auras.$parent.selfTimers",
  1779. },
  1780. enlargeSelf = {
  1781. order = 10,
  1782. type = "toggle",
  1783. name = L["Enlarge your auras"],
  1784. desc = L["If you casted the aura, then the buff icon will be increased in size to make it more visible."],
  1785. arg = "auras.$parent.enlargeSelf",
  1786. },
  1787. selfScale = {
  1788. order = 11,
  1789. type = "range",
  1790. name = L["Scaled aura size"],
  1791. desc = L["Scale for auras that you casted or can Spellsteal, any number above 100% is bigger than default, any number below 100% is smaller than default."],
  1792. min = 1, max = 3, step = 0.10,
  1793. isPercent = true,
  1794. disabled = function(info) return not getVariable(info[2], "auras", info[#(info) - 1], "enlargeSelf") end,
  1795. hidden = hideAdvancedOption,
  1796. arg = "auras.$parent.selfScale",
  1797. },
  1798. selfTimersDouble = {
  1799. order = 11,
  1800. type = "toggle",
  1801. name = L["Timers for self auras only"],
  1802. desc = L["Hides the cooldown ring for any auras that you did not cast."],
  1803. hidden = hideBasicOption,
  1804. arg = "auras.$parent.selfTimers",
  1805. width = "double",
  1806. },
  1807. sep4 = {
  1808. order = 12,
  1809. type = "description",
  1810. name = "",
  1811. width = "full",
  1812. },
  1813. perRow = {
  1814. order = 13,
  1815. type = "range",
  1816. name = function(info)
  1817. local anchorPoint = getVariable(info[2], "auras", info[#(info) - 1], "anchorPoint")
  1818. if( ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "LEFT" or ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "RIGHT" ) then
  1819. return L["Per column"]
  1820. end
  1821. return L["Per row"]
  1822. end,
  1823. desc = L["How many auras to show in a single row."],
  1824. min = 1, max = 100, step = 1, softMin = 1, softMax = 50,
  1825. disabled = disableSameAnchor,
  1826. arg = "auras.$parent.perRow",
  1827. },
  1828. maxRows = {
  1829. order = 14,
  1830. type = "range",
  1831. name = L["Max rows"],
  1832. desc = L["How many rows total should be used, rows will be however long the per row value is set at."],
  1833. min = 1, max = 10, step = 1, softMin = 1, softMax = 5,
  1834. disabled = disableSameAnchor,
  1835. hidden = function(info)
  1836. local anchorPoint = getVariable(info[2], "auras", info[#(info) - 1], "anchorPoint")
  1837. if( ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "LEFT" or ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "RIGHT" ) then
  1838. return true
  1839. end
  1840. return false
  1841. end,
  1842. arg = "auras.$parent.maxRows",
  1843. },
  1844. maxColumns = {
  1845. order = 14,
  1846. type = "range",
  1847. name = L["Max columns"],
  1848. desc = L["How many auras per a column for example, entering two her will create two rows that are filled up to whatever per row is set as."],
  1849. min = 1, max = 100, step = 1, softMin = 1, softMax = 50,
  1850. hidden = function(info)
  1851. local anchorPoint = getVariable(info[2], "auras", info[#(info) - 1], "anchorPoint")
  1852. if( ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "LEFT" or ShadowUF.Layout:GetColumnGrowth(anchorPoint) == "RIGHT" ) then
  1853. return false
  1854. end
  1855. return true
  1856. end,
  1857. disabled = disableSameAnchor,
  1858. arg = "auras.$parent.maxRows",
  1859. },
  1860. size = {
  1861. order = 15,
  1862. type = "range",
  1863. name = L["Size"],
  1864. min = 1, max = 30, step = 1,
  1865. arg = "auras.$parent.size",
  1866. },
  1867. sep5 = {
  1868. order = 16,
  1869. type = "description",
  1870. name = "",
  1871. width = "full",
  1872. },
  1873. anchorPoint = {
  1874. order = 17,
  1875. type = "select",
  1876. name = L["Position"],
  1877. desc = L["How you want this aura to be anchored to the unit frame."],
  1878. values = getAuraAnchors,
  1879. disabled = disableAnchoredTo,
  1880. arg = "auras.$parent.anchorPoint",
  1881. },
  1882. x = {
  1883. order = 18,
  1884. type = "range",
  1885. name = L["X Offset"],
  1886. min = -1000, max = 1000, step = 1, softMin = -100, softMax = 100,
  1887. disabled = disableSameAnchor,
  1888. hidden = hideAdvancedOption,
  1889. arg = "auras.$parent.x",
  1890. },
  1891. y = {
  1892. order = 19,
  1893. type = "range",
  1894. name = L["Y Offset"],
  1895. min = -1000, max = 1000, step = 1, softMin = -100, softMax = 100,
  1896. disabled = disableSameAnchor,
  1897. hidden = hideAdvancedOption,
  1898. arg = "auras.$parent.y",
  1899. },
  1900. },
  1901. }
  1902. local function hideBarOption(info)
  1903. local module = info[#(info) - 1]
  1904. if( ShadowUF.modules[module].moduleHasBar or getVariable(info[2], module, nil, "isBar") ) then
  1905. return false
  1906. end
  1907. return true
  1908. end
  1909. local function disableIfCastName(info)
  1910. return not getVariable(info[2], "castBar", "name", "enabled")
  1911. end
  1912. Config.barTable = {
  1913. order = getModuleOrder,
  1914. name = getName,
  1915. type = "group",
  1916. inline = true,
  1917. hidden = function(info) return hideRestrictedOption(info) or not getVariable(info[2], info[#(info)], nil, "enabled") end,
  1918. args = {
  1919. enableBar = {
  1920. order = 1,
  1921. type = "toggle",
  1922. name = L["Show as bar"],
  1923. desc = L["Turns this widget into a bar that can be resized and ordered just like health and power bars."],
  1924. hidden = function(info) return ShadowUF.modules[info[#(info) - 1]].moduleHasBar end,
  1925. arg = "$parent.isBar",
  1926. width = "full",
  1927. },
  1928. background = {
  1929. order = 1.5,
  1930. type = "toggle",
  1931. name = L["Show background"],
  1932. desc = L["Show a background behind the bars with the same texture/color but faded out."],
  1933. hidden = hideBarOption,
  1934. arg = "$parent.background",
  1935. },
  1936. sep2 = {order = 1.75, type = "description", name = "", hidden = function(info)
  1937. local moduleKey = info[#(info) - 1]
  1938. return ( moduleKey ~= "healthBar" and moduleKey ~= "powerBar" and moduleKey ~= "druidBar" ) or not ShadowUF.db.profile.advanced
  1939. end},
  1940. invert = {
  1941. order = 2,
  1942. type = "toggle",
  1943. name = L["Invert colors"],
  1944. desc = L["Flips coloring so the bar color is shown as the background color and the background as the bar"],
  1945. hidden = function(info) return ( info[#(info) - 1] ~= "healthBar" and info[#(info) - 1] ~= "powerBar" and info[#(info) - 1] ~= "druidBar" ) or not ShadowUF.db.profile.advanced end,
  1946. arg = "$parent.invert",
  1947. },
  1948. order = {
  1949. order = 4,
  1950. type = "range",
  1951. name = L["Order"],
  1952. min = 0, max = 100, step = 5,
  1953. hidden = hideBarOption,
  1954. arg = "$parent.order",
  1955. },
  1956. height = {
  1957. order = 5,
  1958. type = "range",
  1959. name = L["Height"],
  1960. desc = L["How much of the frames total height this bar should get, this is a weighted value, the higher it is the more it gets."],
  1961. min = 0, max = 10, step = 0.1,
  1962. hidden = hideBarOption,
  1963. arg = "$parent.height",
  1964. },
  1965. },
  1966. }
  1967. Config.indicatorTable = {
  1968. order = 0,
  1969. name = function(info)
  1970. if( info[#(info)] == "status" and info[2] == "player" ) then
  1971. return L["Combat/resting status"]
  1972. end
  1973. return getName(info)
  1974. end,
  1975. desc = function(info) return INDICATOR_DESC[info[#(info)]] end,
  1976. type = "group",
  1977. hidden = hideRestrictedOption,
  1978. args = {
  1979. enabled = {
  1980. order = 0,
  1981. type = "toggle",
  1982. name = L["Enable indicator"],
  1983. hidden = false,
  1984. arg = "indicators.$parent.enabled",
  1985. },
  1986. sep1 = {
  1987. order = 1,
  1988. type = "description",
  1989. name = "",
  1990. width = "full",
  1991. hidden = function() return not ShadowUF.db.profile.advanced end,
  1992. },
  1993. anchorPoint = {
  1994. order = 2,
  1995. type = "select",
  1996. name = L["Anchor point"],
  1997. values = positionList,
  1998. hidden = false,
  1999. arg = "indicators.$parent.anchorPoint",
  2000. },
  2001. size = {
  2002. order = 4,
  2003. type = "range",
  2004. name = L["Size"],
  2005. min = 1, max = 40, step = 1,
  2006. hidden = hideAdvancedOption,
  2007. arg = "indicators.$parent.size",
  2008. },
  2009. x = {
  2010. order = 5,
  2011. type = "range",
  2012. name = L["X Offset"],
  2013. min = -100, max = 100, step = 1, softMin = -50, softMax = 50,
  2014. hidden = false,
  2015. arg = "indicators.$parent.x",
  2016. },
  2017. y = {
  2018. order = 6,
  2019. type = "range",
  2020. name = L["Y Offset"],
  2021. min = -100, max = 100, step = 1, softMin = -50, softMax = 50,
  2022. hidden = false,
  2023. arg = "indicators.$parent.y",
  2024. },
  2025. },
  2026. }
  2027. Config.unitTable = {
  2028. type = "group",
  2029. childGroups = "tab",
  2030. order = getUnitOrder,
  2031. name = getName,
  2032. hidden = isUnitDisabled,
  2033. args = {
  2034. general = {
  2035. order = 1,
  2036. name = L["General"],
  2037. type = "group",
  2038. hidden = isModifiersSet,
  2039. set = setUnit,
  2040. get = getUnit,
  2041. args = {
  2042. vehicle = {
  2043. order = 1,
  2044. type = "group",
  2045. inline = true,
  2046. name = L["Vehicles"],
  2047. hidden = function(info) return info[2] ~= "player" and info[2] ~= "party" or not ShadowUF.db.profile.advanced end,
  2048. args = {
  2049. disable = {
  2050. order = 0,
  2051. type = "toggle",
  2052. name = L["Disable vehicle swap"],
  2053. desc = L["Disables the unit frame from turning into a vehicle when the player enters one."],
  2054. set = function(info, value)
  2055. setUnit(info, value)
  2056. local unit = info[2]
  2057. if( unit == "player" ) then
  2058. if( ShadowUF.Units.unitFrames.pet ) then
  2059. ShadowUF.Units.unitFrames.pet:SetAttribute("disableVehicleSwap", ShadowUF.db.profile.units[unit].disableVehicle)
  2060. end
  2061. if( ShadowUF.Units.unitFrames.player ) then
  2062. ShadowUF.Units:CheckVehicleStatus(ShadowUF.Units.unitFrames.player)
  2063. end
  2064. elseif( unit == "party" ) then
  2065. for frame in pairs(ShadowUF.Units.unitFrames) do
  2066. if( frame.unitType == "partypet" ) then
  2067. frame:SetAttribute("disableVehicleSwap", ShadowUF.db.profile.units[unit].disableVehicle)
  2068. elseif( frame.unitType == "party" ) then
  2069. ShadowUF.Units:CheckVehicleStatus(frame)
  2070. end
  2071. end
  2072. end
  2073. end,
  2074. arg = "disableVehicle",
  2075. },
  2076. },
  2077. },
  2078. portrait = {
  2079. order = 2,
  2080. type = "group",
  2081. inline = true,
  2082. hidden = false,
  2083. name = L["Portrait"],
  2084. args = {
  2085. portrait = {
  2086. order = 0,
  2087. type = "toggle",
  2088. name = string.format(L["Enable %s"], L["Portrait"]),
  2089. arg = "portrait.enabled",
  2090. },
  2091. portraitType = {
  2092. order = 1,
  2093. type = "select",
  2094. name = L["Portrait type"],
  2095. values = {["class"] = L["Class icon"], ["2D"] = L["2D"], ["3D"] = L["3D"]},
  2096. arg = "portrait.type",
  2097. },
  2098. alignment = {
  2099. order = 2,
  2100. type = "select",
  2101. name = L["Position"],
  2102. values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"]},
  2103. arg = "portrait.alignment",
  2104. },
  2105. },
  2106. },
  2107. fader = {
  2108. order = 3,
  2109. type = "group",
  2110. inline = true,
  2111. name = L["Combat fader"],
  2112. hidden = hideRestrictedOption,
  2113. args = {
  2114. fader = {
  2115. order = 0,
  2116. type = "toggle",
  2117. name = string.format(L["Enable %s"], L["Combat fader"]),
  2118. desc = L["Combat fader will fade out all your frames while they are inactive and fade them back in once you are in combat or active."],
  2119. hidden = false,
  2120. arg = "fader.enabled",
  2121. },
  2122. combatAlpha = {
  2123. order = 1,
  2124. type = "range",
  2125. name = L["Combat alpha"],
  2126. desc = L["Frame alpha while this unit is in combat."],
  2127. min = 0, max = 1.0, step = 0.1,
  2128. arg = "fader.combatAlpha",
  2129. hidden = false,
  2130. isPercent = true,
  2131. },
  2132. inactiveAlpha = {
  2133. order = 2,
  2134. type = "range",
  2135. name = L["Inactive alpha"],
  2136. desc = L["Frame alpha when you are out of combat while having no target and 100% mana or energy."],
  2137. min = 0, max = 1.0, step = 0.1,
  2138. arg = "fader.inactiveAlpha",
  2139. hidden = false,
  2140. isPercent = true,
  2141. },
  2142. }
  2143. },
  2144. range = {
  2145. order = 3,
  2146. type = "group",
  2147. inline = true,
  2148. name = L["Range indicator"],
  2149. hidden = hideRestrictedOption,
  2150. args = {
  2151. fader = {
  2152. order = 0,
  2153. type = "toggle",
  2154. name = string.format(L["Enable %s"], L["Range indicator"]),
  2155. desc = L["Fades out the unit frames of people who are not within range of you."],
  2156. arg = "range.enabled",
  2157. hidden = false,
  2158. },
  2159. inAlpha = {
  2160. order = 1,
  2161. type = "range",
  2162. name = L["In range alpha"],
  2163. desc = L["Frame alpha while this unit is in combat."],
  2164. min = 0, max = 1.0, step = 0.05,
  2165. arg = "range.inAlpha",
  2166. hidden = false,
  2167. isPercent = true,
  2168. },
  2169. oorAlpha = {
  2170. order = 2,
  2171. type = "range",
  2172. name = L["Out of range alpha"],
  2173. min = 0, max = 1.0, step = 0.05,
  2174. arg = "range.oorAlpha",
  2175. hidden = false,
  2176. isPercent = true,
  2177. },
  2178. }
  2179. },
  2180. highlight = {
  2181. order = 3.5,
  2182. type = "group",
  2183. inline = true,
  2184. name = L["Border highlighting"],
  2185. hidden = hideRestrictedOption,
  2186. args = {
  2187. mouseover = {
  2188. order = 3,
  2189. type = "toggle",
  2190. name = L["On mouseover"],
  2191. desc = L["Highlight units when you mouse over them."],
  2192. arg = "highlight.mouseover",
  2193. hidden = false,
  2194. },
  2195. attention = {
  2196. order = 4,
  2197. type = "toggle",
  2198. name = L["For target/focus"],
  2199. desc = L["Highlight units that you are targeting or have focused."],
  2200. arg = "highlight.attention",
  2201. hidden = function(info) return info[2] == "target" or info[2] == "focus" end,
  2202. },
  2203. aggro = {
  2204. order = 5,
  2205. type = "toggle",
  2206. name = L["On aggro"],
  2207. desc = L["Highlight units that have aggro on any mob."],
  2208. arg = "highlight.aggro",
  2209. hidden = function(info) return info[2] == "arena" or info[2] == "arenapet" or ShadowUF.fakeUnits[info[2]] end,
  2210. },
  2211. debuff = {
  2212. order = 6,
  2213. type = "toggle",
  2214. name = L["On curable debuff"],
  2215. desc = L["Highlight units that are debuffed with something you can cure."],
  2216. arg = "highlight.debuff",
  2217. hidden = function(info) return string.match(info[2], "^arena") or string.match(info[2], "^boss") end,
  2218. },
  2219. alpha = {
  2220. order = 7,
  2221. type = "range",
  2222. name = L["Border alpha"],
  2223. min = 0, max = 1, step = 0.05,
  2224. isPercent = true,
  2225. hidden = false,
  2226. arg = "highlight.alpha",
  2227. },
  2228. size = {
  2229. order = 8,
  2230. type = "range",
  2231. name = L["Border thickness"],
  2232. min = 0, max = 50, step = 1,
  2233. arg = "highlight.size",
  2234. hidden = false,
  2235. },
  2236. },
  2237. },
  2238. -- SOUL SHARDS
  2239. barSouls = {
  2240. order = 4,
  2241. type = "group",
  2242. inline = true,
  2243. name = L["Soul Shards"],
  2244. hidden = function(info) return playerClass ~= "WARLOCK" or not getVariable(info[2], "soulShards", nil, "isBar") or not getVariable(info[2], nil, nil, "soulShards") end,
  2245. args = {
  2246. enabled = {
  2247. order = 1,
  2248. type = "toggle",
  2249. name = string.format(L["Enable %s"], L["Soul Shards"]),
  2250. hidden = false,
  2251. arg = "soulShards.enabled",
  2252. },
  2253. growth = {
  2254. order = 2,
  2255. type = "select",
  2256. name = L["Growth"],
  2257. values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"]},
  2258. hidden = false,
  2259. arg = "soulShards.growth",
  2260. },
  2261. showAlways = {
  2262. order = 3,
  2263. type = "toggle",
  2264. name = L["Don't hide when empty"],
  2265. hidden = false,
  2266. arg = "soulShards.showAlways",
  2267. },
  2268. },
  2269. },
  2270. soulShards = {
  2271. order = 4,
  2272. type = "group",
  2273. inline = true,
  2274. name = L["Soul Shards"],
  2275. hidden = function(info) if( info[2] == "global" or getVariable(info[2], "soulShards", nil, "isBar") ) then return true end return hideRestrictedOption(info) end,
  2276. args = {
  2277. enabled = {
  2278. order = 0,
  2279. type = "toggle",
  2280. name = string.format(L["Enable %s"], L["Soul Shards"]),
  2281. hidden = false,
  2282. arg = "soulShards.enabled",
  2283. },
  2284. sep1 = {
  2285. order = 1,
  2286. type = "description",
  2287. name = "",
  2288. width = "full",
  2289. hidden = hideAdvancedOption,
  2290. },
  2291. growth = {
  2292. order = 2,
  2293. type = "select",
  2294. name = L["Growth"],
  2295. values = {["UP"] = L["Up"], ["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["DOWN"] = L["Down"]},
  2296. hidden = false,
  2297. arg = "soulShards.growth",
  2298. },
  2299. size = {
  2300. order = 2,
  2301. type = "range",
  2302. name = L["Size"],
  2303. min = 0, max = 50, step = 1, softMin = 0, softMax = 20,
  2304. hidden = hideAdvancedOption,
  2305. arg = "soulShards.size",
  2306. },
  2307. spacing = {
  2308. order = 3,
  2309. type = "range",
  2310. name = L["Spacing"],
  2311. min = -30, max = 30, step = 1, softMin = -15, softMax = 15,
  2312. hidden = hideAdvancedOption,
  2313. arg = "soulShards.spacing",
  2314. },
  2315. sep2 = {
  2316. order = 4,
  2317. type = "description",
  2318. name = "",
  2319. width = "full",
  2320. hidden = hideAdvancedOption,
  2321. },
  2322. anchorPoint = {
  2323. order = 5,
  2324. type = "select",
  2325. name = L["Anchor point"],
  2326. values = positionList,
  2327. hidden = false,
  2328. arg = "soulShards.anchorPoint",
  2329. },
  2330. x = {
  2331. order = 6,
  2332. type = "range",
  2333. name = L["X Offset"],
  2334. min = -30, max = 30, step = 1,
  2335. hidden = false,
  2336. arg = "soulShards.x",
  2337. },
  2338. y = {
  2339. order = 7,
  2340. type = "range",
  2341. name = L["Y Offset"],
  2342. min = -30, max = 30, step = 1,
  2343. hidden = false,
  2344. arg = "soulShards.y",
  2345. },
  2346. },
  2347. },
  2348. -- HOLY POWER
  2349. barHolyPower = {
  2350. order = 4,
  2351. type = "group",
  2352. inline = true,
  2353. name = L["Holy Power"],
  2354. hidden = function(info) return playerClass ~= "PALADIN" or not getVariable(info[2], "soulShards", nil, "isBar") or not getVariable(info[2], nil, nil, "soulShards") end,
  2355. args = {
  2356. enabled = {
  2357. order = 1,
  2358. type = "toggle",
  2359. name = string.format(L["Enable %s"], L["Holy Power"]),
  2360. hidden = false,
  2361. arg = "holyPower.enabled",
  2362. },
  2363. growth = {
  2364. order = 2,
  2365. type = "select",
  2366. name = L["Growth"],
  2367. values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"]},
  2368. hidden = false,
  2369. arg = "holyPower.growth",
  2370. },
  2371. showAlways = {
  2372. order = 3,
  2373. type = "toggle",
  2374. name = L["Don't hide when empty"],
  2375. hidden = false,
  2376. arg = "holyPower.showAlways",
  2377. },
  2378. },
  2379. },
  2380. holyPower = {
  2381. order = 4,
  2382. type = "group",
  2383. inline = true,
  2384. name = L["Holy Power"],
  2385. hidden = function(info) if( info[2] == "global" or getVariable(info[2], "holyPower", nil, "isBar") ) then return true end return hideRestrictedOption(info) end,
  2386. args = {
  2387. enabled = {
  2388. order = 0,
  2389. type = "toggle",
  2390. name = string.format(L["Enable %s"], L["Holy Power"]),
  2391. hidden = false,
  2392. arg = "holyPower.enabled",
  2393. },
  2394. sep1 = {
  2395. order = 1,
  2396. type = "description",
  2397. name = "",
  2398. width = "full",
  2399. hidden = hideAdvancedOption,
  2400. },
  2401. growth = {
  2402. order = 2,
  2403. type = "select",
  2404. name = L["Growth"],
  2405. values = {["UP"] = L["Up"], ["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["DOWN"] = L["Down"]},
  2406. hidden = false,
  2407. arg = "holyPower.growth",
  2408. },
  2409. size = {
  2410. order = 2,
  2411. type = "range",
  2412. name = L["Size"],
  2413. min = 0, max = 50, step = 1, softMin = 0, softMax = 20,
  2414. hidden = hideAdvancedOption,
  2415. arg = "holyPower.size",
  2416. },
  2417. spacing = {
  2418. order = 3,
  2419. type = "range",
  2420. name = L["Spacing"],
  2421. min = -30, max = 30, step = 1, softMin = -15, softMax = 15,
  2422. hidden = hideAdvancedOption,
  2423. arg = "holyPower.spacing",
  2424. },
  2425. sep2 = {
  2426. order = 4,
  2427. type = "description",
  2428. name = "",
  2429. width = "full",
  2430. hidden = hideAdvancedOption,
  2431. },
  2432. anchorPoint = {
  2433. order = 5,
  2434. type = "select",
  2435. name = L["Anchor point"],
  2436. values = positionList,
  2437. hidden = false,
  2438. arg = "holyPower.anchorPoint",
  2439. },
  2440. x = {
  2441. order = 6,
  2442. type = "range",
  2443. name = L["X Offset"],
  2444. min = -30, max = 30, step = 1,
  2445. hidden = false,
  2446. arg = "holyPower.x",
  2447. },
  2448. y = {
  2449. order = 7,
  2450. type = "range",
  2451. name = L["Y Offset"],
  2452. min = -30, max = 30, step = 1,
  2453. hidden = false,
  2454. arg = "holyPower.y",
  2455. },
  2456. },
  2457. },
  2458. -- COMBO POINTS
  2459. barComboPoints = {
  2460. order = 4,
  2461. type = "group",
  2462. inline = true,
  2463. name = L["Combo points"],
  2464. hidden = function(info) return not getVariable(info[2], "comboPoints", nil, "isBar") or not getVariable(info[2], nil, nil, "comboPoints") end,
  2465. args = {
  2466. enabled = {
  2467. order = 1,
  2468. type = "toggle",
  2469. name = string.format(L["Enable %s"], L["Combo points"]),
  2470. hidden = false,
  2471. arg = "comboPoints.enabled",
  2472. },
  2473. growth = {
  2474. order = 2,
  2475. type = "select",
  2476. name = L["Growth"],
  2477. values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"]},
  2478. hidden = false,
  2479. arg = "comboPoints.growth",
  2480. },
  2481. showAlways = {
  2482. order = 3,
  2483. type = "toggle",
  2484. name = L["Don't hide when empty"],
  2485. hidden = false,
  2486. arg = "comboPoints.showAlways",
  2487. },
  2488. },
  2489. },
  2490. comboPoints = {
  2491. order = 4,
  2492. type = "group",
  2493. inline = true,
  2494. name = L["Combo points"],
  2495. hidden = function(info) if( info[2] == "global" or getVariable(info[2], "comboPoints", nil, "isBar") ) then return true end return hideRestrictedOption(info) end,
  2496. args = {
  2497. enabled = {
  2498. order = 0,
  2499. type = "toggle",
  2500. name = string.format(L["Enable %s"], L["Combo points"]),
  2501. hidden = false,
  2502. arg = "comboPoints.enabled",
  2503. },
  2504. sep1 = {
  2505. order = 1,
  2506. type = "description",
  2507. name = "",
  2508. width = "full",
  2509. hidden = hideAdvancedOption,
  2510. },
  2511. growth = {
  2512. order = 2,
  2513. type = "select",
  2514. name = L["Growth"],
  2515. values = {["UP"] = L["Up"], ["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["DOWN"] = L["Down"]},
  2516. hidden = false,
  2517. arg = "comboPoints.growth",
  2518. },
  2519. size = {
  2520. order = 2,
  2521. type = "range",
  2522. name = L["Size"],
  2523. min = 0, max = 50, step = 1, softMin = 0, softMax = 20,
  2524. hidden = hideAdvancedOption,
  2525. arg = "comboPoints.size",
  2526. },
  2527. spacing = {
  2528. order = 3,
  2529. type = "range",
  2530. name = L["Spacing"],
  2531. min = -30, max = 30, step = 1, softMin = -15, softMax = 15,
  2532. hidden = hideAdvancedOption,
  2533. arg = "comboPoints.spacing",
  2534. },
  2535. sep2 = {
  2536. order = 4,
  2537. type = "description",
  2538. name = "",
  2539. width = "full",
  2540. hidden = hideAdvancedOption,
  2541. },
  2542. anchorPoint = {
  2543. order = 5,
  2544. type = "select",
  2545. name = L["Anchor point"],
  2546. values = positionList,
  2547. hidden = false,
  2548. arg = "comboPoints.anchorPoint",
  2549. },
  2550. x = {
  2551. order = 6,
  2552. type = "range",
  2553. name = L["X Offset"],
  2554. min = -30, max = 30, step = 1,
  2555. hidden = false,
  2556. arg = "comboPoints.x",
  2557. },
  2558. y = {
  2559. order = 7,
  2560. type = "range",
  2561. name = L["Y Offset"],
  2562. min = -30, max = 30, step = 1,
  2563. hidden = false,
  2564. arg = "comboPoints.y",
  2565. },
  2566. },
  2567. },
  2568. combatText = {
  2569. order = 5,
  2570. type = "group",
  2571. inline = true,
  2572. name = L["Combat text"],
  2573. hidden = hideRestrictedOption,
  2574. args = {
  2575. combatText = {
  2576. order = 0,
  2577. type = "toggle",
  2578. name = string.format(L["Enable %s"], L["Combat text"]),
  2579. desc = L["Shows combat feedback, last healing the unit received, last hit did it miss, resist, dodged and so on."],
  2580. arg = "combatText.enabled",
  2581. hidden = false,
  2582. },
  2583. sep = {
  2584. order = 1,
  2585. type = "description",
  2586. name = "",
  2587. width = "full",
  2588. hidden = hideAdvancedOption,
  2589. },
  2590. anchorPoint = {
  2591. order = 3,
  2592. type = "select",
  2593. name = L["Anchor point"],
  2594. values = positionList,
  2595. arg = "combatText.anchorPoint",
  2596. hidden = hideAdvancedOption,
  2597. },
  2598. x = {
  2599. order = 4,
  2600. type = "range",
  2601. name = L["X Offset"],
  2602. min = -50, max = 50, step = 1,
  2603. arg = "combatText.x",
  2604. hidden = hideAdvancedOption,
  2605. },
  2606. y = {
  2607. order = 5,
  2608. type = "range",
  2609. name = L["Y Offset"],
  2610. min = -50, max = 50, step = 1,
  2611. arg = "combatText.y",
  2612. hidden = hideAdvancedOption,
  2613. },
  2614. },
  2615. },
  2616. },
  2617. },
  2618. attributes = {
  2619. order = 1.5,
  2620. type = "group",
  2621. name = function(info) return L.units[info[#(info) - 1]] end,
  2622. hidden = function(info)
  2623. local unit = info[#(info) - 1]
  2624. return unit ~= "raid" and unit ~= "raidpet" and unit ~= "party" and unit ~= "mainassist" and unit ~= "maintank" and unit ~= "boss" and unit ~= "arena"
  2625. end,
  2626. set = function(info, value)
  2627. setUnit(info, value)
  2628. ShadowUF.Units:ReloadHeader(info[2])
  2629. ShadowUF.modules.movers:Update()
  2630. end,
  2631. get = getUnit,
  2632. args = {
  2633. show = {
  2634. order = 0.5,
  2635. type = "group",
  2636. inline = true,
  2637. name = L["Visibility"],
  2638. hidden = function(info) return info[2] ~= "party" and info[2] ~= "raid" end,
  2639. args = {
  2640. showPlayer = {
  2641. order = 0,
  2642. type = "toggle",
  2643. name = L["Show player in party"],
  2644. desc = L["The player frame will not be hidden regardless, you will have to manually disable it either entirely or per zone type."],
  2645. hidden = function(info) return info[2] ~= "party" end,
  2646. arg = "showPlayer",
  2647. },
  2648. hideSemiRaidParty = {
  2649. order = 1,
  2650. type = "toggle",
  2651. name = L["Hide in >5-man raids"],
  2652. desc = L["Party frames are hidden while in a raid group with more than 5 people inside."],
  2653. hidden = function(info) return info[2] ~= "party" end,
  2654. set = function(info, value)
  2655. if( value ) then
  2656. setVariable(info[2], nil, nil, "hideAnyRaid", false)
  2657. end
  2658. setVariable(info[2], nil, nil, "hideSemiRaid", value)
  2659. ShadowUF.Units:ReloadHeader(info[#(info) - 3])
  2660. end,
  2661. arg = "hideSemiRaid",
  2662. },
  2663. hideRaid = {
  2664. order = 2,
  2665. type = "toggle",
  2666. name = L["Hide in any raid"],
  2667. desc = L["Party frames are hidden while in any sort of raid no matter how many people."],
  2668. hidden = function(info) return info[2] ~= "party" end,
  2669. set = function(info, value)
  2670. if( value ) then
  2671. setVariable(info[2], nil, nil, "hideSemiRaid", false)
  2672. end
  2673. setVariable(info[2], nil, nil, "hideAnyRaid", value)
  2674. ShadowUF.Units:ReloadHeader(info[#(info) - 3])
  2675. end,
  2676. arg = "hideAnyRaid",
  2677. },
  2678. separateFrames = {
  2679. order = 3,
  2680. type = "toggle",
  2681. name = L["Separate raid frames"],
  2682. desc = L["Splits raid frames into individual frames for each raid group instead of one single frame.|nNOTE! You cannot drag each group frame individualy, but how they grow is set through the column and row growth options."],
  2683. hidden = function(info) return info[2] ~= "raid" end,
  2684. arg = "frameSplit",
  2685. },
  2686. hideSemiRaidRaid = {
  2687. order = 3.5,
  2688. type = "toggle",
  2689. name = L["Hide in <=5-man raids"],
  2690. desc = L["Raid frames are hidden while in a raid group with 5 or less people inside."],
  2691. hidden = function(info) return info[2] ~= "raid" end,
  2692. set = function(info, value)
  2693. setVariable(info[2], nil, nil, "hideSemiRaid", value)
  2694. ShadowUF.Units:ReloadHeader(info[#(info) - 3])
  2695. end,
  2696. arg = "hideSemiRaid"
  2697. },
  2698. showInRaid = {
  2699. order = 4,
  2700. type = "toggle",
  2701. name = L["Show party as raid"],
  2702. hidden = hideRaidOption,
  2703. set = function(info, value)
  2704. setUnit(info, value)
  2705. ShadowUF.Units:ReloadHeader("party")
  2706. ShadowUF.Units:ReloadHeader("raid")
  2707. ShadowUF.modules.movers:Update()
  2708. end,
  2709. arg = "showParty",
  2710. },
  2711. },
  2712. },
  2713. general = {
  2714. order = 1,
  2715. type = "group",
  2716. inline = true,
  2717. name = L["General"],
  2718. hidden = false,
  2719. args = {
  2720. offset = {
  2721. order = 2,
  2722. type = "range",
  2723. name = L["Row offset"],
  2724. desc = L["Spacing between each row"],
  2725. min = -10, max = 100, step = 1,
  2726. arg = "offset",
  2727. },
  2728. attribPoint = {
  2729. order = 3,
  2730. type = "select",
  2731. name = L["Row growth"],
  2732. desc = L["How the rows should grow when new group members are added."],
  2733. values = {["TOP"] = L["Down"], ["BOTTOM"] = L["Up"], ["LEFT"] = L["Right"], ["RIGHT"] = L["Left"]},
  2734. arg = "attribPoint",
  2735. set = function(info, value)
  2736. -- If you set the frames to grow left, the columns have to grow down or up as well
  2737. local attribAnchorPoint = getVariable(info[2], nil, nil, "attribAnchorPoint")
  2738. if( ( value == "LEFT" or value == "RIGHT" ) and attribAnchorPoint ~= "BOTTOM" and attribAnchorPoint ~= "TOP" ) then
  2739. ShadowUF.db.profile.units[info[2]].attribAnchorPoint = "BOTTOM"
  2740. elseif( ( value == "TOP" or value == "BOTTOM" ) and attribAnchorPoint ~= "LEFT" and attribAnchorPoint ~= "RIGHT" ) then
  2741. ShadowUF.db.profile.units[info[2]].attribAnchorPoint = "RIGHT"
  2742. end
  2743. setUnit(info, value)
  2744. local position = ShadowUF.db.profile.positions[info[2]]
  2745. if( position.top and position.bottom ) then
  2746. local point = ShadowUF.db.profile.units[info[2]].attribAnchorPoint == "RIGHT" and "RIGHT" or "LEFT"
  2747. position.point = (ShadowUF.db.profile.units[info[2]].attribPoint == "BOTTOM" and "BOTTOM" or "TOP") .. point
  2748. position.y = ShadowUF.db.profile.units[info[2]].attribPoint == "BOTTOM" and position.bottom or position.top
  2749. end
  2750. ShadowUF.Units:ReloadHeader(info[2])
  2751. ShadowUF.modules.movers:Update()
  2752. end,
  2753. },
  2754. sep2 = {
  2755. order = 4,
  2756. type = "description",
  2757. name = "",
  2758. width = "full",
  2759. hidden = false,
  2760. },
  2761. columnSpacing = {
  2762. order = 5,
  2763. type = "range",
  2764. name = L["Column spacing"],
  2765. min = -30, max = 100, step = 1,
  2766. hidden = hideRaidOrAdvancedOption,
  2767. arg = "columnSpacing",
  2768. },
  2769. attribAnchorPoint = {
  2770. order = 6,
  2771. type = "select",
  2772. name = L["Column growth"],
  2773. desc = L["How the frames should grow when a new column is added."],
  2774. values = function(info)
  2775. local attribPoint = getVariable(info[2], nil, nil, "attribPoint")
  2776. if( attribPoint == "LEFT" or attribPoint == "RIGHT" ) then
  2777. return {["TOP"] = L["Down"], ["BOTTOM"] = L["Up"]}
  2778. end
  2779. return {["LEFT"] = L["Right"], ["RIGHT"] = L["Left"]}
  2780. end,
  2781. hidden = hideRaidOrAdvancedOption,
  2782. set = function(info, value)
  2783. -- If you set the frames to grow left, the columns have to grow down or up as well
  2784. local attribPoint = getVariable(info[2], nil, nil, "attribPoint")
  2785. if( ( value == "LEFT" or value == "RIGHT" ) and attribPoint ~= "BOTTOM" and attribPoint ~= "TOP" ) then
  2786. ShadowUF.db.profile.units[info[2]].attribPoint = "BOTTOM"
  2787. end
  2788. setUnit(info, value)
  2789. ShadowUF.Units:ReloadHeader(info[2])
  2790. ShadowUF.modules.movers:Update()
  2791. end,
  2792. arg = "attribAnchorPoint",
  2793. },
  2794. sep3 = {
  2795. order = 7,
  2796. type = "description",
  2797. name = "",
  2798. width = "full",
  2799. hidden = false,
  2800. },
  2801. maxColumns = {
  2802. order = 8,
  2803. type = "range",
  2804. name = L["Max columns"],
  2805. min = 1, max = 20, step = 1,
  2806. arg = "maxColumns",
  2807. hidden = function(info) return info[2] == "boss" or info[2] == "arena" or hideSplitOrRaidOption(info) end,
  2808. },
  2809. unitsPerColumn = {
  2810. order = 8,
  2811. type = "range",
  2812. name = L["Units per column"],
  2813. min = 1, max = 40, step = 1,
  2814. arg = "unitsPerColumn",
  2815. hidden = function(info) return info[2] == "boss" or info[2] == "arena" or hideSplitOrRaidOption(info) end,
  2816. },
  2817. partyPerColumn = {
  2818. order = 9,
  2819. type = "range",
  2820. name = L["Units per column"],
  2821. min = 1, max = 5, step = 1,
  2822. arg = "unitsPerColumn",
  2823. hidden = function(info) return info[2] ~= "party" or not ShadowUF.db.profile.advanced end,
  2824. },
  2825. groupsPerRow = {
  2826. order = 8,
  2827. type = "range",
  2828. name = L["Groups per row"],
  2829. desc = L["How many groups should be shown per row."],
  2830. min = 1, max = 8, step = 1,
  2831. arg = "groupsPerRow",
  2832. hidden = function(info) return info[2] ~= "raid" or not ShadowUF.db.profile.units.raid.frameSplit end,
  2833. },
  2834. groupSpacing = {
  2835. order = 9,
  2836. type = "range",
  2837. name = L["Group row spacing"],
  2838. desc = L["How much spacing should be between each new row of groups."],
  2839. min = -50, max = 50, step = 1,
  2840. arg = "groupSpacing",
  2841. hidden = function(info) return info[2] ~= "raid" or not ShadowUF.db.profile.units.raid.frameSplit end,
  2842. },
  2843. },
  2844. },
  2845. sort = {
  2846. order = 2,
  2847. type = "group",
  2848. inline = true,
  2849. name = L["Sorting"],
  2850. hidden = function(info) return info[2] == "boss" or info[2] == "arena" or ( info[2] ~= "raid" and not ShadowUF.db.profile.advanced ) end,
  2851. args = {
  2852. sortMethod = {
  2853. order = 2,
  2854. type = "select",
  2855. name = L["Sort method"],
  2856. values = {["INDEX"] = L["Index"], ["NAME"] = L["Name"]},
  2857. arg = "sortMethod",
  2858. hidden = false,
  2859. },
  2860. sortOrder = {
  2861. order = 2,
  2862. type = "select",
  2863. name = L["Sort order"],
  2864. values = {["ASC"] = L["Ascending"], ["DESC"] = L["Descending"]},
  2865. arg = "sortOrder",
  2866. hidden = false,
  2867. },
  2868. },
  2869. },
  2870. raid = {
  2871. order = 3,
  2872. type = "group",
  2873. inline = true,
  2874. name = L["Groups"],
  2875. hidden = hideRaidOption,
  2876. args = {
  2877. groupBy = {
  2878. order = 4,
  2879. type = "select",
  2880. name = L["Group by"],
  2881. values = {["GROUP"] = L["Group number"], ["CLASS"] = L["Class"]},
  2882. arg = "groupBy",
  2883. hidden = hideSplitOrRaidOption,
  2884. },
  2885. sortMethod = {
  2886. order = 5,
  2887. type = "select",
  2888. name = L["Sort method"],
  2889. values = {["INDEX"] = L["Index"], ["NAME"] = L["Name"]},
  2890. arg = "sortMethod",
  2891. hidden = false,
  2892. },
  2893. sortOrder = {
  2894. order = 6,
  2895. type = "select",
  2896. name = L["Sort order"],
  2897. values = {["ASC"] = L["Ascending"], ["DESC"] = L["Descending"]},
  2898. arg = "sortOrder",
  2899. hidden = false,
  2900. },
  2901. selectedGroups = {
  2902. order = 7,
  2903. type = "multiselect",
  2904. name = L["Groups to show"],
  2905. values = {string.format(L["Group %d"], 1), string.format(L["Group %d"], 2), string.format(L["Group %d"], 3), string.format(L["Group %d"], 4), string.format(L["Group %d"], 5), string.format(L["Group %d"], 6), string.format(L["Group %d"], 7), string.format(L["Group %d"], 8)},
  2906. set = function(info, key, value)
  2907. local tbl = getVariable(info[2], nil, nil, "filters")
  2908. tbl[key] = value
  2909. setVariable(info[2], "filters", nil, tbl)
  2910. ShadowUF.Units:ReloadHeader(info[2])
  2911. ShadowUF.modules.movers:Update()
  2912. end,
  2913. get = function(info, key)
  2914. return getVariable(info[2], nil, nil, "filters")[key]
  2915. end,
  2916. hidden = function(info) return info[2] ~= "raid" and info[2] ~= "raidpet" end,
  2917. },
  2918. },
  2919. },
  2920. },
  2921. },
  2922. frame = {
  2923. order = 2,
  2924. name = L["Frame"],
  2925. type = "group",
  2926. hidden = isModifiersSet,
  2927. set = setUnit,
  2928. get = getUnit,
  2929. args = {
  2930. size = {
  2931. order = 0,
  2932. type = "group",
  2933. inline = true,
  2934. name = L["Size"],
  2935. hidden = false,
  2936. set = function(info, value)
  2937. setUnit(info, value)
  2938. ShadowUF.modules.movers:Update()
  2939. end,
  2940. args = {
  2941. scale = {
  2942. order = 0,
  2943. type = "range",
  2944. name = L["Scale"],
  2945. min = 0.25, max = 2, step = 0.01,
  2946. isPercent = true,
  2947. arg = "scale",
  2948. },
  2949. height = {
  2950. order = 1,
  2951. type = "range",
  2952. name = L["Height"],
  2953. min = 0, softMax = 100, step = 1,
  2954. arg = "height",
  2955. },
  2956. width = {
  2957. order = 2,
  2958. type = "range",
  2959. name = L["Width"],
  2960. min = 0, softMax = 300, step = 1,
  2961. arg = "width",
  2962. },
  2963. },
  2964. },
  2965. anchor = {
  2966. order = 1,
  2967. type = "group",
  2968. inline = true,
  2969. hidden = function(info) return info[2] == "global" end,
  2970. name = L["Anchor to another frame"],
  2971. set = setPosition,
  2972. get = getPosition,
  2973. args = {
  2974. anchorPoint = {
  2975. order = 0.50,
  2976. type = "select",
  2977. name = L["Anchor point"],
  2978. values = positionList,
  2979. hidden = false,
  2980. get = function(info)
  2981. local position = ShadowUF.db.profile.positions[info[2]]
  2982. if( ShadowUF.db.profile.advanced ) then
  2983. return position[info[#(info)]]
  2984. end
  2985. return position.movedAnchor or position[info[#(info)]]
  2986. end,
  2987. },
  2988. anchorTo = {
  2989. order = 1,
  2990. type = "select",
  2991. name = L["Anchor to"],
  2992. values = getAnchorParents,
  2993. hidden = false,
  2994. },
  2995. sep = {
  2996. order = 2,
  2997. type = "description",
  2998. name = "",
  2999. width = "full",
  3000. hidden = false,
  3001. },
  3002. x = {
  3003. order = 3,
  3004. type = "input",
  3005. name = L["X Offset"],
  3006. validate = checkNumber,
  3007. set = setNumber,
  3008. get = getString,
  3009. hidden = false,
  3010. },
  3011. y = {
  3012. order = 4,
  3013. type = "input",
  3014. name = L["Y Offset"],
  3015. validate = checkNumber,
  3016. set = setNumber,
  3017. get = getString,
  3018. hidden = false,
  3019. },
  3020. },
  3021. },
  3022. orHeader = {
  3023. order = 1.5,
  3024. type = "header",
  3025. name = L["Or you can set a position manually"],
  3026. hidden = function(info) if( info[2] == "global" or hideAdvancedOption() ) then return true else return false end end,
  3027. },
  3028. position = {
  3029. order = 2,
  3030. type = "group",
  3031. hidden = function(info) if( info[2] == "global" or hideAdvancedOption() ) then return true else return false end end,
  3032. inline = true,
  3033. name = L["Manual position"],
  3034. set = setPosition,
  3035. get = getPosition,
  3036. args = {
  3037. point = {
  3038. order = 0,
  3039. type = "select",
  3040. name = L["Point"],
  3041. values = pointPositions,
  3042. hidden = false,
  3043. },
  3044. anchorTo = {
  3045. order = 0.50,
  3046. type = "select",
  3047. name = L["Anchor to"],
  3048. values = getAnchorParents,
  3049. hidden = false,
  3050. },
  3051. relativePoint = {
  3052. order = 1,
  3053. type = "select",
  3054. name = L["Relative point"],
  3055. values = pointPositions,
  3056. hidden = false,
  3057. },
  3058. sep = {
  3059. order = 2,
  3060. type = "description",
  3061. name = "",
  3062. width = "full",
  3063. hidden = false,
  3064. },
  3065. x = {
  3066. order = 3,
  3067. type = "input",
  3068. name = L["X Offset"],
  3069. validate = checkNumber,
  3070. set = setNumber,
  3071. get = getString,
  3072. hidden = false,
  3073. },
  3074. y = {
  3075. order = 4,
  3076. type = "input",
  3077. name = L["Y Offset"],
  3078. validate = checkNumber,
  3079. set = setNumber,
  3080. get = getString,
  3081. hidden = false,
  3082. },
  3083. },
  3084. },
  3085. },
  3086. },
  3087. bars = {
  3088. order = 3,
  3089. name = L["Bars"],
  3090. type = "group",
  3091. hidden = isModifiersSet,
  3092. set = setUnit,
  3093. get = getUnit,
  3094. args = {
  3095. powerbar = {
  3096. order = 1,
  3097. type = "group",
  3098. inline = true,
  3099. name = L["Power bar"],
  3100. hidden = false,
  3101. args = {
  3102. powerBar = {
  3103. order = 1,
  3104. type = "toggle",
  3105. name = string.format(L["Enable %s"], L["Power bar"]),
  3106. arg = "powerBar.enabled",
  3107. },
  3108. predictPower = {
  3109. order = 2,
  3110. type = "toggle",
  3111. name = L["Enable quick power"],
  3112. desc = L["Turns fast updating of the power bar on giving you more up to date power information than normal."],
  3113. arg = "powerBar.predicted",
  3114. },
  3115. altPowerBar = {
  3116. order = 3,
  3117. type = "toggle",
  3118. name = string.format(L["Enable %s"], L["Alt. Power bar"]),
  3119. desc = L["Shows a bar for alternate power info (used in some encounters)"],
  3120. hidden = hideRestrictedOption,
  3121. arg = "altPowerBar.enabled",
  3122. },
  3123. sep = {
  3124. order = 4,
  3125. type = "description",
  3126. name = "",
  3127. width = "full",
  3128. hidden = false,
  3129. },
  3130. colorType = {
  3131. order = 5,
  3132. type = "select",
  3133. name = L["Color power by"],
  3134. desc = L["Primary means of coloring the power bar. Coloring by class only applies to players, for non-players it will default to the power type."],
  3135. values = {["class"] = L["Class"], ["type"] = L["Power Type"]},
  3136. arg = "powerBar.colorType",
  3137. }
  3138. },
  3139. },
  3140. classmiscbars = {
  3141. order = 2,
  3142. type = "group",
  3143. inline = true,
  3144. name = L["Class/misc bars"],
  3145. hidden = function(info)
  3146. local unit = info[2]
  3147. if( unit == "global" ) then
  3148. return not globalConfig.runeBar and not globalConfig.eclipseBar and not globalConfig.totemBar and not globalConfig.druidBar and not globalConfig.xpBar
  3149. else
  3150. return unit ~= "player"
  3151. end
  3152. end,
  3153. args = {
  3154. runeBar = {
  3155. order = 1,
  3156. type = "toggle",
  3157. name = string.format(L["Enable %s"], L["Rune bar"]),
  3158. desc = L["Adds rune bars and timers before runes refresh to the player frame."],
  3159. hidden = hideRestrictedOption,
  3160. arg = "runeBar.enabled",
  3161. },
  3162. eclipseBar = {
  3163. order = 1.25,
  3164. type = "toggle",
  3165. name = string.format(L["Enable %s"], L["Eclipse bar"]),
  3166. desc = L["Adds eclipse bars and how far into sun or moon eclipse is.."],
  3167. hidden = hideRestrictedOption,
  3168. arg = "eclipseBar.enabled",
  3169. },
  3170. totemBar = {
  3171. order = 1.5,
  3172. type = "toggle",
  3173. name = string.format(L["Enable %s"], ShadowUF.modules.totemBar.moduleName),
  3174. desc = function(info)
  3175. return select(2, UnitClass("player")) == "SHAMAN" and L["Adds totem bars with timers before they expire to the player frame."] or select(2, UnitClass("player")) == "DEATHKNIGHT" and L["Adds a bar indicating how much time is left on your ghoul timer, only used if you do not have a permanent ghoul."] or L["Adds a bar indicating how much time is left on your mushrooms."]
  3176. end,
  3177. hidden = hideRestrictedOption,
  3178. arg = "totemBar.enabled",
  3179. },
  3180. druidBar = {
  3181. order = 3,
  3182. type = "toggle",
  3183. name = string.format(L["Enable %s"], L["Druid mana bar"]),
  3184. desc = L["Adds another mana bar to the player frame when you are in Bear or Cat form showing you how much mana you have."],
  3185. hidden = hideRestrictedOption,
  3186. arg = "druidBar.enabled",
  3187. },
  3188. xpBar = {
  3189. order = 4,
  3190. type = "toggle",
  3191. name = string.format(L["Enable %s"], L["XP/Rep bar"]),
  3192. desc = L["This bar will automatically hide when you are at the level cap, or you do not have any reputations tracked."],
  3193. hidden = hideRestrictedOption,
  3194. arg = "xpBar.enabled",
  3195. },
  3196. },
  3197. },
  3198. healthBar = {
  3199. order = 2,
  3200. type = "group",
  3201. inline = true,
  3202. name = L["Health bar"],
  3203. hidden = false,
  3204. args = {
  3205. enabled = {
  3206. order = 1,
  3207. type = "toggle",
  3208. name = string.format(L["Enable %s"], L["Health bar"]),
  3209. arg = "healthBar.enabled",
  3210. },
  3211. sep = {
  3212. order = 3.5,
  3213. type = "description",
  3214. name = "",
  3215. },
  3216. healthColor = {
  3217. order = 4,
  3218. type = "select",
  3219. name = L["Color health by"],
  3220. desc = L["Primary means of coloring the health bar, color on aggro and color by reaction will override this if necessary."],
  3221. values = {["class"] = L["Class"], ["static"] = L["Static"], ["percent"] = L["Health percent"]},
  3222. arg = "healthBar.colorType",
  3223. },
  3224. reaction = {
  3225. order = 5,
  3226. type = "select",
  3227. name = L["Color by reaction on"],
  3228. desc = L["When to color the health bar by the units reaction, overriding the color health by option."],
  3229. arg = "healthBar.reactionType",
  3230. values = {["none"] = L["Never (Disabled)"], ["player"] = L["Players only"], ["npc"] = L["NPCs only"], ["both"] = L["Both"]},
  3231. hidden = function(info) return info[2] == "player" or info[2] == "pet" end,
  3232. },
  3233. colorAggro = {
  3234. order = 6,
  3235. type = "toggle",
  3236. name = L["Color on aggro"],
  3237. desc = L["Changes the health bar to the set hostile color (Red by default) when the unit takes aggro."],
  3238. arg = "healthBar.colorAggro",
  3239. hidden = hideRestrictedOption,
  3240. },
  3241. },
  3242. },
  3243. incHeal = {
  3244. order = 3,
  3245. type = "group",
  3246. inline = true,
  3247. -- name = L["Incoming heals and absorbs"],
  3248. name = L["Incoming heals"],
  3249. hidden = hideRestrictedOption,
  3250. disabled = function(info) return not getVariable(info[2], "healthBar", nil, "enabled") end,
  3251. args = {
  3252. heals = {
  3253. order = 1,
  3254. type = "toggle",
  3255. name = L["Show incoming heals"],
  3256. desc = L["Adds a bar inside the health bar indicating how much healing someone will receive."],
  3257. arg = "incHeal.heals",
  3258. hidden = false,
  3259. set = function(info, value)
  3260. setUnit(info, value)
  3261. setDirectUnit(info[2], "incHeal", nil, "enabled", getVariable(info[2], "incHeal", nil, "absorbs") or getVariable(info[2], "incHeal", nil, "heals"))
  3262. end
  3263. },
  3264. -- absorbs = {
  3265. -- order = 2,
  3266. -- type = "toggle",
  3267. -- name = L["Show current absorbs"],
  3268. -- desc = L["Adds a bar inside the health bar indicating how much damage absorbed they have."],
  3269. -- arg = "incHeal.absorbs",
  3270. -- hidden = false,
  3271. -- set = function(info, value)
  3272. -- setUnit(info, value)
  3273. -- setDirectUnit(info[2], "incHeal", nil, "enabled", getVariable(info[2], "incHeal", nil, "absorbs") or getVariable(info[2], "incHeal", nil, "heals"))
  3274. -- end
  3275. -- },
  3276. cap = {
  3277. order = 3,
  3278. type = "range",
  3279. name = L["Outside bar limit"],
  3280. desc = L["Percentage value of how far outside the unit frame the incoming heal bar can go. 130% means it will go 30% outside the frame, 100% means it will not go outside."],
  3281. min = 1, max = 1.50, step = 0.05, isPercent = true,
  3282. arg = "incHeal.cap",
  3283. hidden = false,
  3284. },
  3285. },
  3286. },
  3287. emptyBar = {
  3288. order = 4,
  3289. type = "group",
  3290. inline = true,
  3291. name = L["Empty bar"],
  3292. hidden = false,
  3293. args = {
  3294. enabled = {
  3295. order = 1,
  3296. type = "toggle",
  3297. name = string.format(L["Enable %s"], L["Empty bar"]),
  3298. desc = L["Adds an empty bar that you can put text into as a way of uncluttering other bars."],
  3299. arg = "emptyBar.enabled",
  3300. width = "full",
  3301. },
  3302. reaction = {
  3303. order = 2,
  3304. type = "select",
  3305. name = L["Color by reaction on"],
  3306. desc = L["When to color the empty bar by reaction, overriding the default color by option."],
  3307. arg = "emptyBar.reactionType",
  3308. values = {["none"] = L["Never (Disabled)"], ["player"] = L["Players only"], ["npc"] = L["NPCs only"], ["both"] = L["Both"]},
  3309. },
  3310. colorType = {
  3311. order = 3,
  3312. type = "toggle",
  3313. name = L["Color by class"],
  3314. desc = L["Players will be colored by class."],
  3315. arg = "emptyBar.class",
  3316. },
  3317. overrideColor = {
  3318. order = 4,
  3319. type = "color",
  3320. name = L["Background color"],
  3321. disabled = function(info)
  3322. local emptyBar = getVariable(info[2], nil, nil, "emptyBar")
  3323. return emptyBar.class and emptyBar.reaciton
  3324. end,
  3325. set = function(info, r, g, b)
  3326. local color = getUnit(info) or {}
  3327. color.r = r
  3328. color.g = g
  3329. color.b = b
  3330. setUnit(info, color)
  3331. end,
  3332. get = function(info)
  3333. local color = getUnit(info)
  3334. if( not color ) then
  3335. return 0, 0, 0
  3336. end
  3337. return color.r, color.g, color.b
  3338. end,
  3339. arg = "emptyBar.backgroundColor",
  3340. },
  3341. },
  3342. },
  3343. castBar = {
  3344. order = 5,
  3345. type = "group",
  3346. inline = true,
  3347. name = L["Cast bar"],
  3348. hidden = hideRestrictedOption,
  3349. args = {
  3350. enabled = {
  3351. order = 1,
  3352. type = "toggle",
  3353. name = string.format(L["Enable %s"], L["Cast bar"]),
  3354. desc = function(info) return ShadowUF.fakeUnits[info[2]] and string.format(L["Due to the nature of fake units, cast bars for %s are not super efficient and can take at most 0.10 seconds to notice a change in cast."], L.units[info[2]] or info[2]) end,
  3355. hidden = false,
  3356. arg = "castBar.enabled",
  3357. },
  3358. autoHide = {
  3359. order = 2,
  3360. type = "toggle",
  3361. name = L["Hide bar when empty"],
  3362. desc = L["Hides the cast bar if there is no cast active."],
  3363. hidden = false,
  3364. arg = "castBar.autoHide",
  3365. },
  3366. castIcon = {
  3367. order = 2.5,
  3368. type = "select",
  3369. name = L["Cast icon"],
  3370. arg = "castBar.icon",
  3371. values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["HIDE"] = L["Disabled"]},
  3372. hidden = false,
  3373. },
  3374. castName = {
  3375. order = 3,
  3376. type = "header",
  3377. name = L["Cast name"],
  3378. hidden = hideAdvancedOption,
  3379. },
  3380. nameEnabled = {
  3381. order = 4,
  3382. type = "toggle",
  3383. name = L["Show cast name"],
  3384. arg = "castBar.name.enabled",
  3385. hidden = hideAdvancedOption,
  3386. },
  3387. rankEnabled = {
  3388. order = 4.5,
  3389. type = "toggle",
  3390. name = L["Show cast rank"],
  3391. arg = "castBar.name.rank",
  3392. hidden = hideAdvancedOption,
  3393. disabled = disableIfCastName,
  3394. },
  3395. nameAnchor = {
  3396. order = 5,
  3397. type = "select",
  3398. name = L["Anchor point"],
  3399. desc = L["Where to anchor the cast name text."],
  3400. values = {["CLI"] = L["Inside Center Left"], ["CRI"] = L["Inside Center Right"]},
  3401. hidden = hideAdvancedOption,
  3402. arg = "castBar.name.anchorPoint",
  3403. },
  3404. nameSep = {
  3405. order = 6,
  3406. type = "description",
  3407. name = "",
  3408. width = "full",
  3409. hidden = hideAdvancedOption,
  3410. },
  3411. nameSize = {
  3412. order = 7,
  3413. type = "range",
  3414. name = L["Size"],
  3415. desc = L["Let's you modify the base font size to either make it larger or smaller."],
  3416. type = "range",
  3417. min = -10, max = 10, step = 1, softMin = -5, softMax = 5,
  3418. hidden = hideAdvancedOption,
  3419. arg = "castBar.name.size",
  3420. },
  3421. nameX = {
  3422. order = 8,
  3423. type = "range",
  3424. name = L["X Offset"],
  3425. min = -20, max = 20, step = 1,
  3426. hidden = hideAdvancedOption,
  3427. arg = "castBar.name.x",
  3428. },
  3429. nameY = {
  3430. order = 9,
  3431. type = "range",
  3432. name = L["Y Offset"],
  3433. min = -20, max = 20, step = 1,
  3434. hidden = hideAdvancedOption,
  3435. arg = "castBar.name.y",
  3436. },
  3437. castTime = {
  3438. order = 10,
  3439. type = "header",
  3440. name = L["Cast time"],
  3441. hidden = hideAdvancedOption,
  3442. },
  3443. timeEnabled = {
  3444. order = 11,
  3445. type = "toggle",
  3446. name = L["Show cast time"],
  3447. arg = "castBar.time.enabled",
  3448. hidden = hideAdvancedOption,
  3449. },
  3450. timeAnchor = {
  3451. order = 12,
  3452. type = "select",
  3453. name = L["Anchor point"],
  3454. desc = L["Where to anchor the cast time text."],
  3455. values = {["CLI"] = L["Inside Center Left"], ["CRI"] = L["Inside Center Right"]},
  3456. hidden = hideAdvancedOption,
  3457. arg = "castBar.time.anchorPoint",
  3458. },
  3459. timeSep = {
  3460. order = 13,
  3461. type = "description",
  3462. name = "",
  3463. width = "full",
  3464. hidden = hideAdvancedOption,
  3465. },
  3466. timeSize = {
  3467. order = 14,
  3468. type = "range",
  3469. name = L["Size"],
  3470. desc = L["Let's you modify the base font size to either make it larger or smaller."],
  3471. type = "range",
  3472. min = -10, max = 10, step = 1, softMin = -5, softMax = 5,
  3473. hidden = hideAdvancedOption,
  3474. arg = "castBar.time.size",
  3475. },
  3476. timeX = {
  3477. order = 15,
  3478. type = "range",
  3479. name = L["X Offset"],
  3480. min = -20, max = 20, step = 1,
  3481. hidden = hideAdvancedOption,
  3482. arg = "castBar.time.x",
  3483. },
  3484. timeY = {
  3485. order = 16,
  3486. type = "range",
  3487. name = L["Y Offset"],
  3488. min = -20, max = 20, step = 1,
  3489. hidden = hideAdvancedOption,
  3490. arg = "castBar.time.y",
  3491. },
  3492. },
  3493. },
  3494. },
  3495. },
  3496. widgetSize = {
  3497. order = 4,
  3498. name = L["Widget size"],
  3499. type = "group",
  3500. hidden = isModifiersSet,
  3501. set = setUnit,
  3502. get = getUnit,
  3503. args = {
  3504. help = {
  3505. order = 0,
  3506. type = "group",
  3507. name = L["Help"],
  3508. inline = true,
  3509. hidden = false,
  3510. args = {
  3511. help = {
  3512. order = 0,
  3513. type = "description",
  3514. name = L["Bars with an order higher or lower than the full size options will use the entire unit frame width.|n|nBar orders between those two numbers are shown next to the portrait."],
  3515. },
  3516. },
  3517. },
  3518. portrait = {
  3519. order = 0.5,
  3520. type = "group",
  3521. name = L["Portrait"],
  3522. inline = true,
  3523. hidden = false,
  3524. args = {
  3525. enableBar = {
  3526. order = 1,
  3527. type = "toggle",
  3528. name = L["Show as bar"],
  3529. desc = L["Changes this widget into a bar, you will be able to change the height and ordering like you can change health and power bars."],
  3530. arg = "$parent.isBar",
  3531. },
  3532. sep = {
  3533. order = 1.5,
  3534. type = "description",
  3535. name = "",
  3536. width = "full",
  3537. hidden = function(info) return getVariable(info[2], "portrait", nil, "isBar") end,
  3538. },
  3539. width = {
  3540. order = 2,
  3541. type = "range",
  3542. name = L["Width percent"],
  3543. desc = L["Percentage of width the portrait should use."],
  3544. min = 0, max = 1.0, step = 0.01, isPercent = true,
  3545. hidden = function(info) return getVariable(info[2], "portrait", nil, "isBar") end,
  3546. arg = "$parent.width",
  3547. },
  3548. before = {
  3549. order = 3,
  3550. type = "range",
  3551. name = L["Full size before"],
  3552. min = 0, max = 100, step = 5,
  3553. hidden = function(info) return getVariable(info[2], "portrait", nil, "isBar") end,
  3554. arg = "$parent.fullBefore",
  3555. },
  3556. after = {
  3557. order = 4,
  3558. type = "range",
  3559. name = L["Full size after"],
  3560. min = 0, max = 100, step = 5,
  3561. hidden = function(info) return getVariable(info[2], "portrait", nil, "isBar") end,
  3562. arg = "$parent.fullAfter",
  3563. },
  3564. order = {
  3565. order = 3,
  3566. type = "range",
  3567. name = L["Order"],
  3568. min = 0, max = 100, step = 5,
  3569. hidden = hideBarOption,
  3570. arg = "portrait.order",
  3571. },
  3572. height = {
  3573. order = 4,
  3574. type = "range",
  3575. name = L["Height"],
  3576. desc = L["How much of the frames total height this bar should get, this is a weighted value, the higher it is the more it gets."],
  3577. min = 0, max = 10, step = 0.1,
  3578. hidden = hideBarOption,
  3579. arg = "portrait.height",
  3580. },
  3581. },
  3582. },
  3583. },
  3584. },
  3585. auras = {
  3586. order = 5,
  3587. name = L["Auras"],
  3588. type = "group",
  3589. hidden = isModifiersSet,
  3590. set = setUnit,
  3591. get = getUnit,
  3592. args = {
  3593. temp = {
  3594. order = 0,
  3595. type = "group",
  3596. inline = true,
  3597. name = L["Temporary enchants"],
  3598. hidden = function(info) return info[2] ~= "player" end,
  3599. args = {
  3600. temporary = {
  3601. order = 0,
  3602. type = "toggle",
  3603. name = L["Enable temporary enchants"],
  3604. desc = L["Adds temporary enchants to the buffs for the player."],
  3605. disabled = function(info) return not getVariable(info[2], "auras", "buffs", "enabled") end,
  3606. arg = "auras.buffs.temporary",
  3607. width = "double",
  3608. },
  3609. },
  3610. },
  3611. buffs = Config.auraTable,
  3612. debuffs = Config.auraTable,
  3613. },
  3614. },
  3615. indicators = {
  3616. order = 5.5,
  3617. type = "group",
  3618. name = L["Indicators"],
  3619. hidden = isModifiersSet,
  3620. childGroups = "tree",
  3621. set = setUnit,
  3622. get = getUnit,
  3623. args = {
  3624. },
  3625. },
  3626. tag = {
  3627. order = 7,
  3628. name = L["Text/Tags"],
  3629. type = "group",
  3630. hidden = isModifiersSet,
  3631. childGroups = "tree",
  3632. args = tagWizard,
  3633. },
  3634. },
  3635. }
  3636. for _, indicator in pairs(ShadowUF.modules.indicators.list) do
  3637. Config.unitTable.args.indicators.args[indicator] = Config.indicatorTable
  3638. end
  3639. -- Check for unit conflicts
  3640. local function hideZoneConflict()
  3641. for _, zone in pairs(ShadowUF.db.profile.visibility) do
  3642. for unit, status in pairs(zone) do
  3643. if( L.units[unit] and ( not status and ShadowUF.db.profile.units[unit].enabled or status and not ShadowUF.db.profile.units[unit].enabled ) ) then
  3644. return nil
  3645. end
  3646. end
  3647. end
  3648. return true
  3649. end
  3650. options.args.enableUnits = {
  3651. type = "group",
  3652. name = L["Enabled units"],
  3653. desc = getPageDescription,
  3654. args = {
  3655. help = {
  3656. order = 1,
  3657. type = "group",
  3658. inline = true,
  3659. name = L["Help"],
  3660. hidden = function()
  3661. if( not hideZoneConflict() or hideBasicOption() ) then
  3662. return true
  3663. end
  3664. return nil
  3665. end,
  3666. args = {
  3667. help = {
  3668. order = 0,
  3669. type = "description",
  3670. name = L["The check boxes below will allow you to enable or disable units."],
  3671. },
  3672. },
  3673. },
  3674. zoneenabled = {
  3675. order = 1.5,
  3676. type = "group",
  3677. inline = true,
  3678. name = L["Zone configuration units"],
  3679. hidden = hideZoneConflict,
  3680. args = {
  3681. help = {
  3682. order = 1,
  3683. type = "description",
  3684. name = L["|cffff2020Warning!|r Some units have overrides set in zone configuration, and may show (or not show up) in certain zone. Regardless of the settings below."]
  3685. },
  3686. sep = {
  3687. order = 2,
  3688. type = "header",
  3689. name = "",
  3690. },
  3691. units = {
  3692. order = 3,
  3693. type = "description",
  3694. name = function()
  3695. local text = {}
  3696. for zoneType, zone in pairs(ShadowUF.db.profile.visibility) do
  3697. local errors = {}
  3698. for unit, status in pairs(zone) do
  3699. if( L.units[unit] ) then
  3700. if ( not status and ShadowUF.db.profile.units[unit].enabled ) then
  3701. table.insert(errors, string.format(L["|cffff2020%s|r units disabled"], L.units[unit]))
  3702. elseif( status and not ShadowUF.db.profile.units[unit].enabled ) then
  3703. table.insert(errors, string.format(L["|cff20ff20%s|r units enabled"], L.units[unit]))
  3704. end
  3705. end
  3706. end
  3707. if( #(errors) > 1 ) then
  3708. table.insert(text, string.format("|cfffed000%s|r have the following overrides: %s", AREA_NAMES[zoneType], table.concat(errors, ", ")))
  3709. elseif( #(errors) == 1 ) then
  3710. table.insert(text, string.format("|cfffed000%s|r has the override: %s", AREA_NAMES[zoneType], errors[1]))
  3711. end
  3712. end
  3713. return #(text) > 0 and table.concat(text, "|n") or ""
  3714. end,
  3715. },
  3716. },
  3717. },
  3718. enabled = {
  3719. order = 2,
  3720. type = "group",
  3721. inline = true,
  3722. name = L["Enable units"],
  3723. args = {},
  3724. },
  3725. },
  3726. }
  3727. local sort_units = function(a, b)
  3728. return a < b
  3729. end
  3730. options.args.units = {
  3731. type = "group",
  3732. name = L["Unit configuration"],
  3733. desc = getPageDescription,
  3734. args = {
  3735. help = {
  3736. order = 1,
  3737. type = "group",
  3738. inline = true,
  3739. name = L["Help"],
  3740. args = {
  3741. help = {
  3742. order = 0,
  3743. type = "description",
  3744. name = L["Wondering what all of the tabs for the unit configuration mean? Here's some information:|n|n|cfffed000General:|r Portrait, range checker, combat fader, border highlighting|n|cfffed000Frame:|r Unit positioning and frame anchoring|n|cfffed000Bars:|r Health, power, empty and cast bar, and combo point configuration|n|cfffed000Widget size:|r All bar and portrait sizing and ordering options|n|cfffed000Auras:|r All aura configuration for enabling/disabling/enlarging self/etc|n|cfffed000Indicators:|r All indicator configuration|n|cfffed000Text/Tags:|r Tag management as well as text positioning and width settings.|n|n|n*** Frequently looked for options ***|n|n|cfffed000Raid frames by group|r - Unit configuration -> Raid -> Raid -> Separate raid frames|n|cfffed000Class coloring:|r Bars -> Color health by|n|cfffed000Timers on auras:|r You need OmniCC for that|n|cfffed000Showing/Hiding default buff frames:|r Hide Blizzard -> Hide buff frames|n|cfffed000Percentage HP/MP text:|r Tags/Text tab, use the [percenthp] or [percentpp] tags|n|cfffed000Hiding party based on raid|r - Unit configuration -> Party -> Party -> Hide in 6-man raid/Hide in any raid"],
  3745. fontSize = "medium",
  3746. },
  3747. },
  3748. },
  3749. global = {
  3750. type = "group",
  3751. childGroups = "tab",
  3752. order = 0,
  3753. name = L["Global"],
  3754. args = {
  3755. test = {
  3756. order = 0,
  3757. type = "group",
  3758. name = L["Currently modifying"],
  3759. inline = true,
  3760. hidden = function()
  3761. for k in pairs(modifyUnits) do return false end
  3762. return true
  3763. end,
  3764. args = {
  3765. info = {
  3766. order = 0,
  3767. type = "description",
  3768. name = function()
  3769. local units = {};
  3770. for unit, enabled in pairs(modifyUnits) do
  3771. if( enabled ) then
  3772. table.insert(units, L.units[unit])
  3773. end
  3774. end
  3775. table.sort(units, sort_units)
  3776. return table.concat(units, ", ")
  3777. end,
  3778. }
  3779. }
  3780. },
  3781. units = {
  3782. order = 1,
  3783. type = "group",
  3784. name = L["Units"],
  3785. set = function(info, value)
  3786. local unit = info[#(info)]
  3787. if( IsShiftKeyDown() ) then
  3788. for _, unit in pairs(ShadowUF.unitList) do
  3789. if( ShadowUF.db.profile.units[unit].enabled ) then
  3790. modifyUnits[unit] = value and true or nil
  3791. if( value ) then
  3792. globalConfig = mergeTables(globalConfig, ShadowUF.db.profile.units[unit])
  3793. end
  3794. end
  3795. end
  3796. else
  3797. modifyUnits[unit] = value and true or nil
  3798. if( value ) then
  3799. globalConfig = mergeTables(globalConfig, ShadowUF.db.profile.units[unit])
  3800. end
  3801. end
  3802. -- Check if we have nothing else selected, if so wipe it
  3803. local hasUnit
  3804. for k in pairs(modifyUnits) do hasUnit = true break end
  3805. if( not hasUnit ) then
  3806. globalConfig = {}
  3807. end
  3808. AceRegistry:NotifyChange("ShadowedUF")
  3809. end,
  3810. get = function(info) return modifyUnits[info[#(info)]] end,
  3811. args = {
  3812. help = {
  3813. order = 0,
  3814. type = "group",
  3815. name = L["Help"],
  3816. inline = true,
  3817. args = {
  3818. help = {
  3819. order = 0,
  3820. type = "description",
  3821. name = L["Select the units that you want to modify, any settings changed will change every unit you selected. If you want to anchor or change raid/party unit specific settings you will need to do that through their options.|n|nShift click a unit to select all/unselect all."],
  3822. },
  3823. },
  3824. },
  3825. units = {
  3826. order = 1,
  3827. type = "group",
  3828. name = L["Units"],
  3829. inline = true,
  3830. args = {},
  3831. },
  3832. },
  3833. },
  3834. },
  3835. },
  3836. },
  3837. }
  3838. -- Load modules into the unit table
  3839. for key, module in pairs(ShadowUF.modules) do
  3840. local canHaveBar = module.moduleHasBar
  3841. for _, data in pairs(ShadowUF.defaults.profile.units) do
  3842. if( data[key] and data[key].isBar ~= nil ) then
  3843. canHaveBar = true
  3844. end
  3845. end
  3846. if( canHaveBar ) then
  3847. Config.unitTable.args.widgetSize.args[key] = Config.barTable
  3848. end
  3849. end
  3850. -- Load global unit
  3851. for k, v in pairs(Config.unitTable.args) do
  3852. options.args.units.args.global.args[k] = v
  3853. end
  3854. -- Load all of the per unit settings
  3855. local perUnitList = {
  3856. order = getUnitOrder,
  3857. type = "toggle",
  3858. name = getName,
  3859. hidden = isUnitDisabled,
  3860. desc = function(info)
  3861. return string.format(L["Adds %s to the list of units to be modified when you change values in this tab."], L.units[info[#(info)]])
  3862. end,
  3863. }
  3864. -- Enabled units list
  3865. local unitCatOrder = {}
  3866. local enabledUnits = {
  3867. order = function(info) return unitCatOrder[info[#(info)]] + getUnitOrder(info) end,
  3868. type = "toggle",
  3869. name = getName,
  3870. set = function(info, value)
  3871. local unit = info[#(info)]
  3872. for child, parent in pairs(ShadowUF.Units.childUnits) do
  3873. if( unit == parent and not value ) then
  3874. ShadowUF.db.profile.units[child].enabled = false
  3875. end
  3876. end
  3877. ShadowUF.modules.movers:Update()
  3878. ShadowUF.db.profile.units[unit].enabled = value
  3879. ShadowUF:LoadUnits()
  3880. -- Update party frame visibility
  3881. if( unit == "raid" and ShadowUF.Units.headerFrames.party ) then
  3882. ShadowUF.Units:SetHeaderAttributes(ShadowUF.Units.headerFrames.party, "party")
  3883. end
  3884. ShadowUF.modules.movers:Update()
  3885. end,
  3886. get = function(info)
  3887. return ShadowUF.db.profile.units[info[#(info)]].enabled
  3888. end,
  3889. desc = function(info)
  3890. local unit = info[#(info)]
  3891. local unitDesc = UNIT_DESC[unit] or ""
  3892. if( ShadowUF.db.profile.units[unit].enabled and ShadowUF.Units.childUnits[unit] ) then
  3893. if( unitDesc ~= "" ) then unitDesc = unitDesc .. "\n\n" end
  3894. return unitDesc .. string.format(L["This unit depends on another to work, disabling %s will disable %s."], L.units[ShadowUF.Units.childUnits[unit]], L.units[unit])
  3895. elseif( not ShadowUF.db.profile.units[unit].enabled ) then
  3896. for child, parent in pairs(ShadowUF.Units.childUnits) do
  3897. if( parent == unit ) then
  3898. if( unitDesc ~= "" ) then unitDesc = unitDesc .. "\n\n" end
  3899. return unitDesc .. L["This unit has child units that depend on it, you need to enable this unit before you can enable its children."]
  3900. end
  3901. end
  3902. end
  3903. return unitDesc ~= "" and unitDesc
  3904. end,
  3905. disabled = function(info)
  3906. local unit = info[#(info)]
  3907. if( ShadowUF.Units.childUnits[unit] ) then
  3908. return not ShadowUF.db.profile.units[ShadowUF.Units.childUnits[unit]].enabled
  3909. end
  3910. return false
  3911. end,
  3912. }
  3913. local unitCategory = {
  3914. order = function(info)
  3915. local cat = info[#(info)]
  3916. return cat == "playercat" and 50 or cat == "generalcat" and 100 or cat == "partycat" and 200 or cat == "raidcat" and 300 or 400
  3917. end,
  3918. type = "header",
  3919. name = function(info)
  3920. local cat = info[#(info)]
  3921. return cat == "playercat" and L["Player"] or cat == "generalcat" and L["General"] or cat == "raidcat" and L["Raid"] or cat == "partycat" and L["Party"] or cat == "arenacat" and L["Arena"]
  3922. end,
  3923. width = "full",
  3924. }
  3925. for cat, list in pairs(unitCategories) do
  3926. options.args.enableUnits.args.enabled.args[cat .. "cat"] = unitCategory
  3927. for _, unit in pairs(list) do
  3928. unitCatOrder[unit] = cat == "player" and 50 or cat == "general" and 100 or cat == "party" and 200 or cat == "raid" and 300 or 400
  3929. end
  3930. end
  3931. for order, unit in pairs(ShadowUF.unitList) do
  3932. options.args.enableUnits.args.enabled.args[unit] = enabledUnits
  3933. options.args.units.args.global.args.units.args.units.args[unit] = perUnitList
  3934. options.args.units.args[unit] = Config.unitTable
  3935. unitCatOrder[unit] = unitCatOrder[unit] or 100
  3936. end
  3937. end
  3938. ---------------------
  3939. -- FILTER CONFIGURATION
  3940. ---------------------
  3941. local function loadFilterOptions()
  3942. local hasWhitelist, hasBlacklist, rebuildFilters
  3943. local filterMap, spellMap = {}, {}
  3944. local manageFiltersTable = {
  3945. order = function(info) return info[#(info)] == "whitelists" and 1 or 2 end,
  3946. type = "group",
  3947. name = function(info) return info[#(info)] == "whitelists" and L["Whitelists"] or L["Blacklists"] end,
  3948. args = {
  3949. },
  3950. }
  3951. local function reloadUnitAuras()
  3952. for _, frame in pairs(ShadowUF.Units.unitFrames) do
  3953. if( UnitExists(frame.unit) and frame.visibility.auras ) then
  3954. ShadowUF.modules.auras:UpdateFilter(frame)
  3955. frame:FullUpdate()
  3956. end
  3957. end
  3958. end
  3959. local function setFilterType(info, value)
  3960. local filter = filterMap[info[#(info) - 2]]
  3961. local filterType = info[#(info) - 3]
  3962. ShadowUF.db.profile.filters[filterType][filter][info[#(info)]] = value
  3963. reloadUnitAuras()
  3964. end
  3965. local function getFilterType(info)
  3966. local filter = filterMap[info[#(info) - 2]]
  3967. local filterType = info[#(info) - 3]
  3968. return ShadowUF.db.profile.filters[filterType][filter][info[#(info)]]
  3969. end
  3970. --- Container widget for the filter listing
  3971. local filterEditTable = {
  3972. order = 0,
  3973. type = "group",
  3974. name = function(info) return filterMap[info[#(info)]] end,
  3975. hidden = function(info) return not ShadowUF.db.profile.filters[info[#(info) - 1]][filterMap[info[#(info)]]] end,
  3976. args = {
  3977. general = {
  3978. order = 0,
  3979. type = "group",
  3980. name = function(info) return filterMap[info[#(info) - 1]] end,
  3981. hidden = false,
  3982. inline = true,
  3983. args = {
  3984. add = {
  3985. order = 0,
  3986. type = "input",
  3987. name = L["Aura name"],
  3988. --dialogControl = "Aura_EditBox",
  3989. hidden = false,
  3990. set = function(info, value)
  3991. local filterType = info[#(info) - 3]
  3992. local filter = filterMap[info[#(info) - 2]]
  3993. ShadowUF.db.profile.filters[filterType][filter][value] = true
  3994. reloadUnitAuras()
  3995. rebuildFilters()
  3996. end,
  3997. },
  3998. delete = {
  3999. order = 1,
  4000. type = "execute",
  4001. name = L["Delete filter"],
  4002. hidden = false,
  4003. confirmText = L["Are you sure you want to delete this filter?"],
  4004. confirm = true,
  4005. func = function(info, value)
  4006. local filterType = info[#(info) - 3]
  4007. local filter = filterMap[info[#(info) - 2]]
  4008. ShadowUF.db.profile.filters[filterType][filter] = nil
  4009. -- Delete anything that used this filter too
  4010. local filterList = filterType == "whitelist" and ShadowUF.db.profile.filters.zonewhite or filterType == "blacklist" and ShadowUF.db.profile.filters.zoneblack
  4011. for id, filterUsed in pairs(filterList) do
  4012. if( filterUsed == filter ) then
  4013. filterList[id] = nil
  4014. end
  4015. end
  4016. reloadUnitAuras()
  4017. rebuildFilters()
  4018. end,
  4019. },
  4020. },
  4021. },
  4022. filters = {
  4023. order = 2,
  4024. type = "group",
  4025. inline = true,
  4026. hidden = false,
  4027. name = L["Aura types to filter"],
  4028. args = {
  4029. buffs = {
  4030. order = 4,
  4031. type = "toggle",
  4032. name = L["Buffs"],
  4033. desc = L["When this filter is active, apply the filter to buffs."],
  4034. set = setFilterType,
  4035. get = getFilterType,
  4036. },
  4037. debuffs = {
  4038. order = 5,
  4039. type = "toggle",
  4040. name = L["Debuffs"],
  4041. desc = L["When this filter is active, apply the filter to debuffs."],
  4042. set = setFilterType,
  4043. get = getFilterType,
  4044. },
  4045. },
  4046. },
  4047. spells = {
  4048. order = 3,
  4049. type = "group",
  4050. inline = true,
  4051. name = L["Auras"],
  4052. hidden = false,
  4053. args = {
  4054. },
  4055. },
  4056. },
  4057. }
  4058. -- Spell list for manage aura filters
  4059. local spellLabel = {
  4060. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) end,
  4061. type = "description",
  4062. -- Odd I know, AceConfigDialog-3.0 expands descriptions to full width if width is nil
  4063. -- on the other hand we can't set width to "normal" so tricking it
  4064. width = "",
  4065. fontSize = "medium",
  4066. name = function(info) return spellMap[info[#(info)]] end,
  4067. }
  4068. local spellRow = {
  4069. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) + 0.5 end,
  4070. type = "execute",
  4071. name = L["Delete"],
  4072. width = "half",
  4073. func = function(info)
  4074. local spell = spellMap[info[#(info)]]
  4075. local filter = filterMap[info[#(info) - 2]]
  4076. local filterType = info[#(info) - 3]
  4077. ShadowUF.db.profile.filters[filterType][filter][spell] = nil
  4078. rebuildFilters()
  4079. end
  4080. }
  4081. local noSpells = {
  4082. order = 0,
  4083. type = "description",
  4084. name = L["This filter has no auras in it, you will have to add some using the dialog above."],
  4085. }
  4086. -- The filter [View] widgets for manage aura filters
  4087. local filterLabel = {
  4088. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) end,
  4089. type = "description",
  4090. width = "", -- Odd I know, AceConfigDialog-3.0 expands descriptions to full width if width is nil
  4091. fontSize = "medium",
  4092. name = function(info) return filterMap[info[#(info)]] end,
  4093. }
  4094. local filterRow = {
  4095. order = function(info) return tonumber(string.match(info[#(info)], "(%d+)")) + 0.5 end,
  4096. type = "execute",
  4097. name = L["View"],
  4098. width = "half",
  4099. func = function(info)
  4100. local filterType = info[#(info) - 2]
  4101. AceDialog.Status.ShadowedUF.children.filter.children.filters.status.groups.groups[filterType] = true
  4102. selectTabGroup("filter", "filters", filterType .. "\001" .. string.match(info[#(info)], "(%d+)"))
  4103. end
  4104. }
  4105. local noFilters = {
  4106. order = 0,
  4107. type = "description",
  4108. name = L["You do not have any filters of this type added yet, you will have to create one in the management panel before this page is useful."],
  4109. }
  4110. -- Container table for a filter zone
  4111. local globalSettings = {}
  4112. local zoneList = {"none", "pvp", "arena", "party", "raid"}
  4113. local filterTable = {
  4114. order = function(info) return info[#(info)] == "global" and 1 or info[#(info)] == "none" and 2 or 3 end,
  4115. type = "group",
  4116. inline = true,
  4117. hidden = function() return not hasWhitelist and not hasBlacklist end,
  4118. name = function(info) return AREA_NAMES[info[#(info)]] or L["Global"] end,
  4119. set = function(info, value)
  4120. local filter = filterMap[info[#(info)]]
  4121. local zone = info[#(info) - 1]
  4122. local unit = info[#(info) - 2]
  4123. local filterKey = ShadowUF.db.profile.filters.whitelists[filter] and "zonewhite" or "zoneblack"
  4124. for _, zoneConfig in pairs(zoneList) do
  4125. if( zone == "global" or zoneConfig == zone ) then
  4126. if( unit == "global" ) then
  4127. globalSettings[zoneConfig .. filterKey] = value and filter or false
  4128. for _, unit in pairs(ShadowUF.unitList) do
  4129. ShadowUF.db.profile.filters[filterKey][zoneConfig .. unit] = value and filter or nil
  4130. end
  4131. else
  4132. ShadowUF.db.profile.filters[filterKey][zoneConfig .. unit] = value and filter or nil
  4133. end
  4134. end
  4135. end
  4136. if( zone == "global" ) then
  4137. globalSettings[zone .. unit .. filterKey] = value and filter or false
  4138. end
  4139. reloadUnitAuras()
  4140. end,
  4141. get = function(info)
  4142. local filter = filterMap[info[#(info)]]
  4143. local zone = info[#(info) - 1]
  4144. local unit = info[#(info) - 2]
  4145. if( unit == "global" or zone == "global" ) then
  4146. local id = zone == "global" and zone .. unit or zone
  4147. local filterKey = ShadowUF.db.profile.filters.whitelists[filter] and "zonewhite" or "zoneblack"
  4148. if( info[#(info)] == "nofilter" ) then
  4149. return globalSettings[id .. "zonewhite"] == false and globalSettings[id .. "zoneblack"] == false
  4150. end
  4151. return globalSettings[id .. filterKey] == filter
  4152. end
  4153. if( info[#(info)] == "nofilter" ) then
  4154. return not ShadowUF.db.profile.filters.zonewhite[zone .. unit] and not ShadowUF.db.profile.filters.zoneblack[zone .. unit]
  4155. end
  4156. return ShadowUF.db.profile.filters.zonewhite[zone .. unit] == filter or ShadowUF.db.profile.filters.zoneblack[zone .. unit] == filter
  4157. end,
  4158. args = {
  4159. nofilter = {
  4160. order = 0,
  4161. type = "toggle",
  4162. name = L["Don't use a filter"],
  4163. hidden = false,
  4164. set = function(info, value)
  4165. local filter = filterMap[info[#(info)]]
  4166. local zone = info[#(info) - 1]
  4167. local unit = info[#(info) - 2]
  4168. for _, zoneConfig in pairs(zoneList) do
  4169. if( zone == "global" or zoneConfig == zone ) then
  4170. if( unit == "global" ) then
  4171. globalSettings[zoneConfig .. "zonewhite"] = false
  4172. globalSettings[zoneConfig .. "zoneblack"] = false
  4173. for _, unit in pairs(ShadowUF.unitList) do
  4174. ShadowUF.db.profile.filters.zonewhite[zoneConfig .. unit] = nil
  4175. ShadowUF.db.profile.filters.zoneblack[zoneConfig .. unit] = nil
  4176. end
  4177. else
  4178. ShadowUF.db.profile.filters.zonewhite[zoneConfig .. unit] = nil
  4179. ShadowUF.db.profile.filters.zoneblack[zoneConfig .. unit] = nil
  4180. end
  4181. end
  4182. end
  4183. if( zone == "global" ) then
  4184. globalSettings[zone .. unit .. "zonewhite"] = false
  4185. globalSettings[zone .. unit .. "zoneblack"] = false
  4186. end
  4187. reloadUnitAuras()
  4188. end,
  4189. },
  4190. white = {
  4191. order = 1,
  4192. type = "header",
  4193. name = "|cffffffff" .. L["Whitelists"] .. "|r",
  4194. hidden = function(info) return not hasWhitelist end
  4195. },
  4196. black = {
  4197. order = 3,
  4198. type = "header",
  4199. name = L["Blacklists"], -- In theory I would make this black, but as black doesn't work with a black background I'll skip that
  4200. hidden = function(info) return not hasBlacklist end
  4201. },
  4202. },
  4203. }
  4204. -- Toggle used for set filter zones to enable filters
  4205. local filterToggle = {
  4206. order = function(info) return ShadowUF.db.profile.filters.whitelists[filterMap[info[#(info)]]] and 2 or 4 end,
  4207. type = "toggle",
  4208. name = function(info) return filterMap[info[#(info)]] end,
  4209. desc = function(info)
  4210. local filter = filterMap[info[#(info)]]
  4211. filter = ShadowUF.db.profile.filters.whitelists[filter] or ShadowUF.db.profile.filters.blacklists[filter]
  4212. if( filter.buffs and filter.debuffs ) then
  4213. return L["Filtering both buffs and debuffs"]
  4214. elseif( filter.buffs ) then
  4215. return L["Filtering buffs only"]
  4216. elseif( filter.debuffs ) then
  4217. return L["Filtering debuffs only"]
  4218. end
  4219. return L["This filter has no aura types set to filter out."]
  4220. end,
  4221. }
  4222. -- Load existing filters in
  4223. -- This needs to be cleaned up later
  4224. local filterID, spellID = 0, 0
  4225. local function buildList(type)
  4226. local manageFiltersTable = {
  4227. order = type == "whitelists" and 1 or 2,
  4228. type = "group",
  4229. name = type == "whitelists" and L["Whitelists"] or L["Blacklists"],
  4230. args = {
  4231. groups = {
  4232. order = 0,
  4233. type = "group",
  4234. inline = true,
  4235. name = function(info) return info[#(info) - 1] == "whitelists" and L["Whitelist filters"] or L["Blacklist filters"] end,
  4236. args = {
  4237. },
  4238. },
  4239. },
  4240. }
  4241. local hasFilters
  4242. for name, spells in pairs(ShadowUF.db.profile.filters[type]) do
  4243. hasFilters = true
  4244. filterID = filterID + 1
  4245. filterMap[tostring(filterID)] = name
  4246. filterMap[filterID .. "label"] = name
  4247. filterMap[filterID .. "row"] = name
  4248. manageFiltersTable.args[tostring(filterID)] = CopyTable(filterEditTable)
  4249. manageFiltersTable.args.groups.args[filterID .. "label"] = filterLabel
  4250. manageFiltersTable.args.groups.args[filterID .. "row"] = filterRow
  4251. filterTable.args[tostring(filterID)] = filterToggle
  4252. local hasSpells
  4253. for spellName in pairs(spells) do
  4254. if( spellName ~= "buffs" and spellName ~= "debuffs" ) then
  4255. hasSpells = true
  4256. spellID = spellID + 1
  4257. spellMap[tostring(spellID)] = spellName
  4258. spellMap[spellID .. "label"] = spellName
  4259. manageFiltersTable.args[tostring(filterID)].args.spells.args[spellID .. "label"] = spellLabel
  4260. manageFiltersTable.args[tostring(filterID)].args.spells.args[tostring(spellID)] = spellRow
  4261. end
  4262. end
  4263. if( not hasSpells ) then
  4264. manageFiltersTable.args[tostring(filterID)].args.spells.args.noSpells = noSpells
  4265. end
  4266. end
  4267. if( not hasFilters ) then
  4268. if( type == "whitelists" ) then hasWhitelist = nil else hasBlacklist = nil end
  4269. manageFiltersTable.args.groups.args.noFilters = noFilters
  4270. end
  4271. return manageFiltersTable
  4272. end
  4273. rebuildFilters = function()
  4274. for id in pairs(filterMap) do filterTable.args[id] = nil end
  4275. spellID = 0
  4276. filterID = 0
  4277. hasBlacklist = true
  4278. hasWhitelist = true
  4279. table.wipe(filterMap)
  4280. table.wipe(spellMap)
  4281. options.args.filter.args.filters.args.whitelists = buildList("whitelists")
  4282. options.args.filter.args.filters.args.blacklists = buildList("blacklists")
  4283. end
  4284. local unitFilterSelection = {
  4285. order = function(info) return info[#(info)] == "global" and 1 or (getUnitOrder(info) + 1) end,
  4286. type = "group",
  4287. name = function(info) return info[#(info)] == "global" and L["Global"] or getName(info) end,
  4288. disabled = function(info)
  4289. if( info[#(info)] == "global" ) then
  4290. return false
  4291. end
  4292. return not hasWhitelist and not hasBlacklist
  4293. end,
  4294. args = {
  4295. help = {
  4296. order = 0,
  4297. type = "group",
  4298. inline = true,
  4299. name = L["Help"],
  4300. hidden = function() return hasWhitelist or hasBlacklist end,
  4301. args = {
  4302. help = {
  4303. type = "description",
  4304. name = L["You will need to create an aura filter before you can set which unit to enable aura filtering on."],
  4305. width = "full",
  4306. }
  4307. },
  4308. },
  4309. header = {
  4310. order = 0,
  4311. type = "header",
  4312. name = function(info) return (info[#(info) - 1] == "global" and L["Global"] or L.units[info[#(info) - 1]]) end,
  4313. hidden = function() return not hasWhitelist and not hasBlacklist end,
  4314. },
  4315. global = filterTable,
  4316. none = filterTable,
  4317. pvp = filterTable,
  4318. arena = filterTable,
  4319. party = filterTable,
  4320. raid = filterTable,
  4321. }
  4322. }
  4323. local addFilter = {type = "whitelists"}
  4324. options.args.filter = {
  4325. type = "group",
  4326. name = L["Aura filters"],
  4327. childGroups = "tab",
  4328. desc = getPageDescription,
  4329. args = {
  4330. groups = {
  4331. order = 1,
  4332. type = "group",
  4333. name = L["Set filter zones"],
  4334. args = {
  4335. help = {
  4336. order = 0,
  4337. type = "group",
  4338. inline = true,
  4339. name = L["Help"],
  4340. args = {
  4341. help = {
  4342. type = "description",
  4343. name = L["You can set what unit frame should use what filter group and in what zone type here, if you want to change what auras goes into what group then see the \"Manage aura groups\" option."],
  4344. width = "full",
  4345. }
  4346. },
  4347. },
  4348. }
  4349. },
  4350. filters = {
  4351. order = 2,
  4352. type = "group",
  4353. name = L["Manage aura filters"],
  4354. childGroups = "tree",
  4355. args = {
  4356. manage = {
  4357. order = 1,
  4358. type = "group",
  4359. name = L["Management"],
  4360. args = {
  4361. help = {
  4362. order = 0,
  4363. type = "group",
  4364. inline = true,
  4365. name = L["Help"],
  4366. args = {
  4367. help = {
  4368. type = "description",
  4369. name = L["Whitelists will hide any aura not in the filter group.|nBlacklists will hide auras that are in the filter group."],
  4370. width = "full",
  4371. }
  4372. },
  4373. },
  4374. error = {
  4375. order = 1,
  4376. type = "group",
  4377. inline = true,
  4378. hidden = function() return not addFilter.error end,
  4379. name = L["Error"],
  4380. args = {
  4381. error = {
  4382. order = 0,
  4383. type = "description",
  4384. name = function() return addFilter.error end,
  4385. width = "full",
  4386. },
  4387. },
  4388. },
  4389. add = {
  4390. order = 2,
  4391. type = "group",
  4392. inline = true,
  4393. name = L["New filter"],
  4394. get = function(info) return addFilter[info[#(info)]] end,
  4395. args = {
  4396. name = {
  4397. order = 0,
  4398. type = "input",
  4399. name = L["Name"],
  4400. set = function(info, value)
  4401. addFilter[info[#(info)]] = string.trim(value) ~= "" and value or nil
  4402. addFilter.error = nil
  4403. end,
  4404. get = function(info) return addFilter.errorName or addFilter.name end,
  4405. validate = function(info, value)
  4406. local name = string.lower(string.trim(value))
  4407. for filter in pairs(ShadowUF.db.profile.filters.whitelists) do
  4408. if( string.lower(filter) == name ) then
  4409. addFilter.error = string.format(L["The whitelist \"%s\" already exists."], value)
  4410. addFilter.errorName = value
  4411. AceRegistry:NotifyChange("ShadowedUF")
  4412. return ""
  4413. end
  4414. end
  4415. for filter in pairs(ShadowUF.db.profile.filters.blacklists) do
  4416. if( string.lower(filter) == name ) then
  4417. addFilter.error = string.format(L["The blacklist \"%s\" already exists."], value)
  4418. addFilter.errorName = value
  4419. AceRegistry:NotifyChange("ShadowedUF")
  4420. return ""
  4421. end
  4422. end
  4423. addFilter.error = nil
  4424. addFilter.errorName = nil
  4425. return true
  4426. end,
  4427. },
  4428. type = {
  4429. order = 1,
  4430. type = "select",
  4431. name = L["Filter type"],
  4432. set = function(info, value) addFilter[info[#(info)]] = value end,
  4433. values = {["whitelists"] = L["Whitelist"], ["blacklists"] = L["Blacklist"]},
  4434. },
  4435. add = {
  4436. order = 2,
  4437. type = "execute",
  4438. name = L["Create"],
  4439. disabled = function(info) return not addFilter.name end,
  4440. func = function(info)
  4441. ShadowUF.db.profile.filters[addFilter.type][addFilter.name] = {buffs = true, debuffs = true}
  4442. rebuildFilters()
  4443. local id
  4444. for key, value in pairs(filterMap) do
  4445. if( value == addFilter.name ) then
  4446. id = key
  4447. break
  4448. end
  4449. end
  4450. AceDialog.Status.ShadowedUF.children.filter.children.filters.status.groups.groups[addFilter.type] = true
  4451. selectTabGroup("filter", "filters", addFilter.type .. "\001" .. id)
  4452. table.wipe(addFilter)
  4453. addFilter.type = "whitelists"
  4454. end,
  4455. },
  4456. },
  4457. },
  4458. },
  4459. },
  4460. },
  4461. },
  4462. },
  4463. }
  4464. options.args.filter.args.groups.args.global = unitFilterSelection
  4465. for _, unit in pairs(ShadowUF.unitList) do
  4466. options.args.filter.args.groups.args[unit] = unitFilterSelection
  4467. end
  4468. rebuildFilters()
  4469. end
  4470. ---------------------
  4471. -- TAG CONFIGURATION
  4472. ---------------------
  4473. local function loadTagOptions()
  4474. local tagData = {search = ""}
  4475. local function set(info, value, key)
  4476. local key = key or info[#(info)]
  4477. if( ShadowUF.Tags.defaultHelp[tagData.name] ) then
  4478. return
  4479. end
  4480. -- Reset loaded function + reload tags
  4481. if( key == "funct" ) then
  4482. ShadowUF.tagFunc[tagData.name] = nil
  4483. ShadowUF.Tags:Reload()
  4484. elseif( key == "category" ) then
  4485. local cat = ShadowUF.db.profile.tags[tagData.name][key]
  4486. if( cat and cat ~= value ) then
  4487. Config.tagTextTable.args[cat].args[tagData.name] = nil
  4488. Config.tagTextTable.args[value].args[tagData.name] = Config.tagTable
  4489. end
  4490. end
  4491. ShadowUF.db.profile.tags[tagData.name][key] = value
  4492. end
  4493. local function stripCode(text)
  4494. if( not text ) then
  4495. return ""
  4496. end
  4497. return string.gsub(string.gsub(text, "|", "||"), "\t", "")
  4498. end
  4499. local function get(info, key)
  4500. local key = key or info[#(info)]
  4501. if( key == "help" and ShadowUF.Tags.defaultHelp[tagData.name] ) then
  4502. return ShadowUF.Tags.defaultHelp[tagData.name] or ""
  4503. elseif( key == "events" and ShadowUF.Tags.defaultEvents[tagData.name] ) then
  4504. return ShadowUF.Tags.defaultEvents[tagData.name] or ""
  4505. elseif( key == "frequency" and ShadowUF.Tags.defaultFrequents[tagData.name] ) then
  4506. return ShadowUF.Tags.defaultFrequents[tagData.name] or ""
  4507. elseif( key == "category" and ShadowUF.Tags.defaultCategories[tagData.name] ) then
  4508. return ShadowUF.Tags.defaultCategories[tagData.name] or ""
  4509. elseif( key == "name" and ShadowUF.Tags.defaultNames[tagData.name] ) then
  4510. return ShadowUF.Tags.defaultNames[tagData.name] or ""
  4511. elseif( key == "funct" and ShadowUF.Tags.defaultTags[tagData.name] ) then
  4512. return ShadowUF.Tags.defaultTags[tagData.name] or ""
  4513. end
  4514. return ShadowUF.db.profile.tags[tagData.name] and ShadowUF.db.profile.tags[tagData.name][key] or ""
  4515. end
  4516. local function isSearchHidden(info)
  4517. return tagData.search ~= "" and not string.match(info[#(info)], tagData.search) or false
  4518. end
  4519. local function editTag(info)
  4520. tagData.name = info[#(info)]
  4521. if( ShadowUF.Tags.defaultHelp[tagData.name] ) then
  4522. tagData.error = L["You cannot edit this tag because it is one of the default ones included in this mod. This function is here to provide an example for your own custom tags."]
  4523. end
  4524. selectDialogGroup("tags", "edit")
  4525. end
  4526. -- Create all of the tag editor options, if it's a default tag will show it after any custom ones
  4527. local tagTable = {
  4528. type = "execute",
  4529. order = function(info) return ShadowUF.Tags.defaultTags[info[#(info)]] and 100 or 1 end,
  4530. name = getTagName,
  4531. desc = getTagHelp,
  4532. hidden = isSearchHidden,
  4533. func = editTag,
  4534. }
  4535. local tagCategories = {}
  4536. local function getTagCategories(info)
  4537. for k in pairs(tagCategories) do tagCategories[k] = nil end
  4538. for _, cat in pairs(ShadowUF.Tags.defaultCategories) do
  4539. tagCategories[cat] = TAG_GROUPS[cat]
  4540. end
  4541. return tagCategories
  4542. end
  4543. -- Tag configuration
  4544. options.args.tags = {
  4545. type = "group",
  4546. childGroups = "tab",
  4547. name = L["Add tags"],
  4548. desc = getPageDescription,
  4549. hidden = hideAdvancedOption,
  4550. args = {
  4551. general = {
  4552. order = 0,
  4553. type = "group",
  4554. name = L["Tag list"],
  4555. args = {
  4556. help = {
  4557. order = 0,
  4558. type = "group",
  4559. inline = true,
  4560. name = L["Help"],
  4561. hidden = function() return ShadowUF.db.profile.advanced end,
  4562. args = {
  4563. description = {
  4564. order = 0,
  4565. type = "description",
  4566. name = L["You can add new custom tags through this page, if you're looking to change what tags are used in text look under the Text tab for an Units configuration."],
  4567. },
  4568. },
  4569. },
  4570. search = {
  4571. order = 1,
  4572. type = "group",
  4573. inline = true,
  4574. name = L["Search"],
  4575. args = {
  4576. search = {
  4577. order = 1,
  4578. type = "input",
  4579. name = L["Search tags"],
  4580. set = function(info, text) tagData.search = text end,
  4581. get = function(info) return tagData.search end,
  4582. },
  4583. },
  4584. },
  4585. list = {
  4586. order = 2,
  4587. type = "group",
  4588. inline = true,
  4589. name = L["Tags"],
  4590. args = {},
  4591. },
  4592. },
  4593. },
  4594. add = {
  4595. order = 1,
  4596. type = "group",
  4597. name = L["Add new tag"],
  4598. args = {
  4599. help = {
  4600. order = 0,
  4601. type = "group",
  4602. inline = true,
  4603. name = L["Help"],
  4604. args = {
  4605. help = {
  4606. order = 0,
  4607. type = "description",
  4608. name = L["You can find more information on creating your own custom tags in the \"Help\" tab above."],
  4609. },
  4610. },
  4611. },
  4612. add = {
  4613. order = 1,
  4614. type = "group",
  4615. inline = true,
  4616. name = L["Add new tag"],
  4617. args = {
  4618. error = {
  4619. order = 0,
  4620. type = "description",
  4621. name = function() return tagData.addError or "" end,
  4622. hidden = function() return not tagData.addError end,
  4623. },
  4624. errorHeader = {
  4625. order = 0.50,
  4626. type = "header",
  4627. name = "",
  4628. hidden = function() return not tagData.addError end,
  4629. },
  4630. tag = {
  4631. order = 1,
  4632. type = "input",
  4633. name = L["Tag name"],
  4634. desc = L["Tag that you will use to access this code, do not wrap it in brackets or parenthesis it's automatically done. For example, you would enter \"foobar\" and then access it with [foobar]."],
  4635. validate = function(info, text)
  4636. if( text == "" ) then
  4637. tagData.addError = L["You must enter a tag name."]
  4638. elseif( string.match(text, "[%[%]%(%)]") ) then
  4639. tagData.addError = string.format(L["You cannot name a tag \"%s\", tag names should contain no brackets or parenthesis."], text)
  4640. elseif( ShadowUF.tagFunc[text] ) then
  4641. tagData.addError = string.format(L["The tag \"%s\" already exists."], text)
  4642. else
  4643. tagData.addError = nil
  4644. end
  4645. AceRegistry:NotifyChange("ShadowedUF")
  4646. return tagData.addError and "" or true
  4647. end,
  4648. set = function(info, tag)
  4649. tagData.name = tag
  4650. tagData.error = nil
  4651. tagData.addError = nil
  4652. ShadowUF.db.profile.tags[tag] = {func = "function(unit, unitOwner)\n\nend", category = "misc"}
  4653. options.args.tags.args.general.args.list.args[tag] = tagTable
  4654. Config.tagTextTable.args.misc.args[tag] = Config.tagTable
  4655. selectDialogGroup("tags", "edit")
  4656. end,
  4657. },
  4658. },
  4659. },
  4660. },
  4661. },
  4662. edit = {
  4663. order = 2,
  4664. type = "group",
  4665. name = L["Edit tag"],
  4666. hidden = function() return not tagData.name end,
  4667. args = {
  4668. help = {
  4669. order = 0,
  4670. type = "group",
  4671. inline = true,
  4672. name = L["Help"],
  4673. args = {
  4674. help = {
  4675. order = 0,
  4676. type = "description",
  4677. name = L["You can find more information on creating your own custom tags in the \"Help\" tab above.|nSUF will attempt to automatically detect what events your tag will need, so you do not generally need to fill out the events field."],
  4678. },
  4679. },
  4680. },
  4681. tag = {
  4682. order = 1,
  4683. type = "group",
  4684. inline = true,
  4685. name = function() return string.format(L["Editing %s"], tagData.name or "") end,
  4686. args = {
  4687. error = {
  4688. order = 0,
  4689. type = "description",
  4690. name = function()
  4691. if( tagData.error ) then
  4692. return "|cffff0000" .. tagData.error .. "|r"
  4693. end
  4694. return ""
  4695. end,
  4696. hidden = function() return not tagData.error end,
  4697. },
  4698. errorHeader = {
  4699. order = 1,
  4700. type = "header",
  4701. name = "",
  4702. hidden = function() return not tagData.error end,
  4703. },
  4704. discovery = {
  4705. order = 1,
  4706. type = "toggle",
  4707. name = L["Disable event discovery"],
  4708. desc = L["This will disable the automatic detection of what events this tag will need, you should leave this unchecked unless you know what you are doing."],
  4709. set = function(info, value) tagData.discovery = value end,
  4710. get = function() return tagData.discovery end,
  4711. width = "full",
  4712. },
  4713. frequencyEnable = {
  4714. order = 1.10,
  4715. type = "toggle",
  4716. name = L["Enable frequent updates"],
  4717. desc = L["Flags the tag for frequent updating, it will update the tag on a timer regardless of any events firing."],
  4718. set = function(info, value)
  4719. tagData.frequency = value and 5 or nil
  4720. set(info, tagData.frequency, "frequency")
  4721. end,
  4722. get = function(info) return get(info, "frequency") ~= "" and true or false end,
  4723. width = "full",
  4724. },
  4725. frequency = {
  4726. order = 1.20,
  4727. type = "input",
  4728. name = L["Update interval"],
  4729. desc = L["How many seconds between updates.|n[WARNING] By setting the frequency to 0 it will update every single frame redraw, if you want to disable frequent updating uncheck it don't set this to 0."],
  4730. disabled = function(info) return get(info) == "" end,
  4731. validate = function(info, value)
  4732. value = tonumber(value)
  4733. if( not value ) then
  4734. tagData.error = L["Invalid interval entered, must be a number."]
  4735. elseif( value < 0 ) then
  4736. tagData.error = L["You must enter a number that is 0 or higher, negative numbers are not allowed."]
  4737. else
  4738. tagData.error = nil
  4739. end
  4740. if( tagData.error ) then
  4741. AceRegistry:NotifyChange("ShadowedUF")
  4742. return ""
  4743. end
  4744. return true
  4745. end,
  4746. set = function(info, value)
  4747. tagData.frequency = tonumber(value)
  4748. tagData.frequency = tagData.frequency < 0 and 0 or tagData.frequency
  4749. set(info, tagData.frequency)
  4750. end,
  4751. get = function(info) return tostring(get(info) or "") end,
  4752. width = "half",
  4753. },
  4754. name = {
  4755. order = 2,
  4756. type = "input",
  4757. name = L["Tag name"],
  4758. set = set,
  4759. get = get,
  4760. },
  4761. category = {
  4762. order = 2.5,
  4763. type = "select",
  4764. name = L["Category"],
  4765. values = getTagCategories,
  4766. set = set,
  4767. get = get,
  4768. },
  4769. sep = {
  4770. order = 2.75,
  4771. type = "description",
  4772. name = "",
  4773. width = "full",
  4774. },
  4775. events = {
  4776. order = 3,
  4777. type = "input",
  4778. name = L["Events"],
  4779. desc = L["Events that should be used to trigger an update of this tag. Separate each event with a single space."],
  4780. width = "full",
  4781. validate = function(info, text)
  4782. if( ShadowUF.Tags.defaultTags[tagData.name] ) then
  4783. return true
  4784. end
  4785. if( text == "" or string.match(text, "[^_%a%s]") ) then
  4786. tagData.error = L["You have to set the events to fire, you can only enter letters and underscores, \"FOO_BAR\" for example is valid, \"APPLE_5_ORANGE\" is not because it contains a number."]
  4787. tagData.eventError = text
  4788. AceRegistry:NotifyChange("ShadowedUF")
  4789. return ""
  4790. end
  4791. tagData.eventError = text
  4792. tagData.error = nil
  4793. return true
  4794. end,
  4795. set = set,
  4796. get = function(info)
  4797. if( tagData.eventError ) then
  4798. return tagData.eventError
  4799. end
  4800. return get(info)
  4801. end,
  4802. },
  4803. func = {
  4804. order = 4,
  4805. type = "input",
  4806. multiline = true,
  4807. name = L["Code"],
  4808. desc = L["Your code must be wrapped in a function, for example, if you were to make a tag to return the units name you would do:|n|nfunction(unit, unitOwner)|nreturn UnitName(unitOwner)|nend"],
  4809. width = "full",
  4810. validate = function(info, text)
  4811. if( ShadowUF.Tags.defaultTags[tagData.name] ) then
  4812. return true
  4813. end
  4814. local funct, msg = loadstring("return " .. text)
  4815. if( not string.match(text, "function") ) then
  4816. tagData.error = L["You must wrap your code in a function."]
  4817. tagData.funcError = text
  4818. elseif( not funct and msg ) then
  4819. tagData.error = string.format(L["Failed to save tag, error:|n %s"], msg)
  4820. tagData.funcError = text
  4821. else
  4822. tagData.error = nil
  4823. tagData.funcError = nil
  4824. end
  4825. AceRegistry:NotifyChange("ShadowedUF")
  4826. return tagData.error and "" or true
  4827. end,
  4828. set = function(info, value)
  4829. value = string.gsub(value, "||", "|")
  4830. set(info, value)
  4831. -- Try and automatically identify the events this tag is going to want to use
  4832. if( not tagData.discovery ) then
  4833. tagData.eventError = nil
  4834. ShadowUF.db.profile.tags[tagData.name].events = ShadowUF.Tags:IdentifyEvents(value) or ""
  4835. end
  4836. ShadowUF.Tags:Reload(tagData.name)
  4837. end,
  4838. get = function(info)
  4839. if( tagData.funcError ) then
  4840. return stripCode(tagData.funcError)
  4841. end
  4842. return stripCode(ShadowUF.Tags.defaultTags[tagData.name] or ( ShadowUF.db.profile.tags[tagData.name] and ShadowUF.db.profile.tags[tagData.name].func))
  4843. end,
  4844. },
  4845. delete = {
  4846. order = 5,
  4847. type = "execute",
  4848. name = L["Delete"],
  4849. hidden = function() return ShadowUF.Tags.defaultTags[tagData.name] end,
  4850. confirm = true,
  4851. confirmText = L["Are you sure you want to delete this tag?"],
  4852. func = function(info)
  4853. local category = ShadowUF.db.profile.tags[tagData.name].category
  4854. if( category ) then
  4855. Config.tagTextTable.args[category].args[tagData.name] = nil
  4856. end
  4857. options.args.tags.args.general.args.list.args[tagData.name] = nil
  4858. ShadowUF.db.profile.tags[tagData.name] = nil
  4859. ShadowUF.tagFunc[tagData.name] = nil
  4860. ShadowUF.Tags:Reload(tagData.name)
  4861. tagData.name = nil
  4862. tagData.error = nil
  4863. selectDialogGroup("tags", "general")
  4864. end,
  4865. },
  4866. },
  4867. },
  4868. },
  4869. },
  4870. help = {
  4871. order = 3,
  4872. type = "group",
  4873. name = L["Help"],
  4874. args = {
  4875. general = {
  4876. order = 0,
  4877. type = "group",
  4878. name = L["General"],
  4879. inline = true,
  4880. args = {
  4881. general = {
  4882. order = 0,
  4883. type = "description",
  4884. name = L["See the documentation below for information and examples on creating tags, if you just want basic Lua or WoW API information then see the Programming in Lua and WoW Programming links."],
  4885. },
  4886. },
  4887. },
  4888. documentation = {
  4889. order = 1,
  4890. type = "group",
  4891. name = L["Documentation"],
  4892. inline = true,
  4893. args = {
  4894. doc = {
  4895. order = 0,
  4896. type = "input",
  4897. name = L["Documentation"],
  4898. set = false,
  4899. get = function() return "http://wiki.github.com/Shadowed/ShadowedUnitFrames/tag-documentation" end,
  4900. width = "full",
  4901. },
  4902. },
  4903. },
  4904. resources = {
  4905. order = 2,
  4906. type = "group",
  4907. inline = true,
  4908. name = L["Resources"],
  4909. args = {
  4910. lua = {
  4911. order = 0,
  4912. type = "input",
  4913. name = L["Programming in Lua"],
  4914. desc = L["This is a good guide on how to get started with programming in Lua, while you do not need to read the entire thing it is a helpful for understanding the basics of Lua syntax and API's."],
  4915. set = false,
  4916. get = function() return "http://www.lua.org/pil/" end,
  4917. width = "full",
  4918. },
  4919. wow = {
  4920. order = 1,
  4921. type = "input",
  4922. name = L["WoW Programming"],
  4923. desc = L["WoW Programming is a good resource for finding out what difference API's do and how to call them."],
  4924. set = false,
  4925. get = function() return "http://wowprogramming.com/docs" end,
  4926. width = "full",
  4927. },
  4928. },
  4929. },
  4930. },
  4931. },
  4932. },
  4933. }
  4934. -- Load the initial tag list
  4935. for tag in pairs(ShadowUF.Tags.defaultTags) do
  4936. options.args.tags.args.general.args.list.args[tag] = tagTable
  4937. end
  4938. for tag, data in pairs(ShadowUF.db.profile.tags) do
  4939. options.args.tags.args.general.args.list.args[tag] = tagTable
  4940. end
  4941. end
  4942. ---------------------
  4943. -- VISIBILITY OPTIONS
  4944. ---------------------
  4945. local function loadVisibilityOptions()
  4946. -- As zone units are only enabled in a certain zone... it's pointless to provide visibility options for them
  4947. local unitBlacklist = {}
  4948. for unit in pairs(ShadowUF.Units.zoneUnits) do unitBlacklist[unit] = true end
  4949. for unit, parent in pairs(ShadowUF.Units.childUnits) do
  4950. if( ShadowUF.Units.zoneUnits[parent] ) then
  4951. unitBlacklist[unit] = true
  4952. end
  4953. end
  4954. local globalVisibility = {}
  4955. local function set(info, value)
  4956. local key = info[#(info)]
  4957. local unit = info[#(info) - 1]
  4958. local area = info[#(info) - 2]
  4959. if( key == "enabled" ) then
  4960. key = ""
  4961. end
  4962. if( value == nil ) then
  4963. value = false
  4964. elseif( value == false ) then
  4965. value = nil
  4966. end
  4967. for _, configUnit in pairs(ShadowUF.unitList) do
  4968. if( ( configUnit == unit or unit == "global" ) and not unitBlacklist[configUnit] ) then
  4969. ShadowUF.db.profile.visibility[area][configUnit .. key] = value
  4970. end
  4971. end
  4972. -- Annoying yes, but only way that works
  4973. ShadowUF.Units:CheckPlayerZone(true)
  4974. if( unit == "global" ) then
  4975. globalVisibility[area .. key] = value
  4976. end
  4977. end
  4978. local function get(info)
  4979. local key = info[#(info)]
  4980. local unit = info[#(info) - 1]
  4981. local area = info[#(info) - 2]
  4982. if( key == "enabled" ) then
  4983. key = ""
  4984. end
  4985. if( unit == "global" ) then
  4986. if( globalVisibility[area .. key] == false ) then
  4987. return nil
  4988. elseif( globalVisibility[area .. key] == nil ) then
  4989. return false
  4990. end
  4991. return globalVisibility[area .. key]
  4992. elseif( ShadowUF.db.profile.visibility[area][unit .. key] == false ) then
  4993. return nil
  4994. elseif( ShadowUF.db.profile.visibility[area][unit .. key] == nil ) then
  4995. return false
  4996. end
  4997. return ShadowUF.db.profile.visibility[area][unit .. key]
  4998. end
  4999. local function getHelp(info)
  5000. local unit = info[#(info) - 1]
  5001. local area = info[#(info) - 2]
  5002. local key = info[#(info)]
  5003. if( key == "enabled" ) then
  5004. key = ""
  5005. end
  5006. local current
  5007. if( unit == "global" ) then
  5008. current = globalVisibility[area .. key]
  5009. else
  5010. current = ShadowUF.db.profile.visibility[area][unit .. key]
  5011. end
  5012. if( current == false ) then
  5013. return string.format(L["Disabled in %s"], AREA_NAMES[area])
  5014. elseif( current == true ) then
  5015. return string.format(L["Enabled in %s"], AREA_NAMES[area])
  5016. end
  5017. return L["Using unit settings"]
  5018. end
  5019. local areaTable = {
  5020. type = "group",
  5021. order = function(info) return info[#(info)] == "none" and 2 or 1 end,
  5022. childGroups = "tree",
  5023. name = function(info)
  5024. return AREA_NAMES[info[#(info)]]
  5025. end,
  5026. get = get,
  5027. set = set,
  5028. args = {},
  5029. }
  5030. Config.visibilityTable = {
  5031. type = "group",
  5032. order = function(info) return info[#(info)] == "global" and 1 or (getUnitOrder(info) + 1) end,
  5033. name = function(info) return info[#(info)] == "global" and L["Global"] or getName(info) end,
  5034. args = {
  5035. help = {
  5036. order = 0,
  5037. type = "group",
  5038. name = L["Help"],
  5039. inline = true,
  5040. hidden = hideBasicOption,
  5041. args = {
  5042. help = {
  5043. order = 0,
  5044. type = "description",
  5045. name = function(info)
  5046. return string.format(L["Disabling a module on this page disables it while inside %s. Do not disable a module here if you do not want this to happen!."], string.lower(AREA_NAMES[info[2]]))
  5047. end,
  5048. },
  5049. },
  5050. },
  5051. enabled = {
  5052. order = 0.25,
  5053. type = "toggle",
  5054. name = function(info)
  5055. local unit = info[#(info) - 1]
  5056. if( unit == "global" ) then return "" end
  5057. return string.format(L["%s frames"], L.units[unit])
  5058. end,
  5059. hidden = function(info) return info[#(info) - 1] == "global" end,
  5060. desc = getHelp,
  5061. tristate = true,
  5062. width = "double",
  5063. },
  5064. sep = {
  5065. order = 0.5,
  5066. type = "description",
  5067. name = "",
  5068. width = "full",
  5069. hidden = function(info) return info[#(info) - 1] == "global" end,
  5070. },
  5071. }
  5072. }
  5073. local moduleTable = {
  5074. order = 1,
  5075. type = "toggle",
  5076. name = getName,
  5077. desc = getHelp,
  5078. tristate = true,
  5079. hidden = function(info)
  5080. if( info[#(info) - 1] == "global" ) then return false end
  5081. return hideRestrictedOption(info)
  5082. end,
  5083. arg = 1,
  5084. }
  5085. for key, module in pairs(ShadowUF.modules) do
  5086. if( module.moduleName ) then
  5087. Config.visibilityTable.args[key] = moduleTable
  5088. end
  5089. end
  5090. areaTable.args.global = Config.visibilityTable
  5091. for _, unit in pairs(ShadowUF.unitList) do
  5092. if( not unitBlacklist[unit] ) then
  5093. areaTable.args[unit] = Config.visibilityTable
  5094. end
  5095. end
  5096. options.args.visibility = {
  5097. type = "group",
  5098. childGroups = "tab",
  5099. name = L["Zone configuration"],
  5100. desc = getPageDescription,
  5101. args = {
  5102. start = {
  5103. order = 0,
  5104. type = "group",
  5105. name = L["Help"],
  5106. inline = true,
  5107. hidden = hideBasicOption,
  5108. args = {
  5109. help = {
  5110. order = 0,
  5111. type = "description",
  5112. name = L["Gold checkmark - Enabled in this zone / Grey checkmark - Disabled in this zone / No checkmark - Use the default unit settings"],
  5113. },
  5114. },
  5115. },
  5116. pvp = areaTable,
  5117. arena = areaTable,
  5118. party = areaTable,
  5119. raid = areaTable,
  5120. },
  5121. }
  5122. end
  5123. local function loadOptions()
  5124. options = {
  5125. type = "group",
  5126. name = "Shadowed UF",
  5127. args = {}
  5128. }
  5129. loadGeneralOptions()
  5130. loadUnitOptions()
  5131. loadHideOptions()
  5132. loadTagOptions()
  5133. loadFilterOptions()
  5134. loadVisibilityOptions()
  5135. -- Ordering
  5136. options.args.general.order = 1
  5137. options.args.enableUnits.order = 2
  5138. options.args.units.order = 3
  5139. options.args.filter.order = 4
  5140. options.args.hideBlizzard.order = 5
  5141. options.args.visibility.order = 6
  5142. options.args.tags.order = 7
  5143. -- So modules can access it easier/debug
  5144. Config.options = options
  5145. -- Options finished loading, fire callback for any non-default modules that want to be included
  5146. ShadowUF:FireModuleEvent("OnConfigurationLoad")
  5147. end
  5148. function Config:Open()
  5149. AceDialog = AceDialog or LibStub("AceConfigDialog-3.0")
  5150. AceRegistry = AceRegistry or LibStub("AceConfigRegistry-3.0")
  5151. if( not registered ) then
  5152. loadOptions()
  5153. LibStub("AceConfig-3.0"):RegisterOptionsTable("ShadowedUF", options)
  5154. AceDialog:SetDefaultSize("ShadowedUF", 845, 550)
  5155. registered = true
  5156. end
  5157. AceDialog:Open("ShadowedUF")
  5158. end