Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.99 KB | None | 0 0
  1. --[[
  2. Shadowed Unit Frames, Shadowed of Mal'Ganis (US) PvP
  3. ]]
  4.  
  5. ShadowUF = select(2, ...)
  6.  
  7. local L = ShadowUF.L
  8. ShadowUF.dbRevision = 61
  9. ShadowUF.dbRevisionClassic = 2
  10. ShadowUF.playerUnit = "player"
  11. ShadowUF.enabledUnits = {}
  12. ShadowUF.modules = {}
  13. ShadowUF.moduleOrder = {}
  14. ShadowUF.unitList = {"player", "pet", "pettarget", "target", "targettarget", "targettargettarget", "party", "partypet", "partytarget", "partytargettarget", "raid", "raidpet", "boss", "bosstarget", "maintank", "maintanktarget", "mainassist", "mainassisttarget", "arena", "arenatarget", "arenapet", "battleground", "battlegroundtarget", "battlegroundpet", "arenatargettarget", "battlegroundtargettarget", "maintanktargettarget", "mainassisttargettarget", "bosstargettarget"}
  15. ShadowUF.fakeUnits = {["targettarget"] = true, ["targettargettarget"] = true, ["pettarget"] = true, ["arenatarget"] = true, ["arenatargettarget"] = true, ["partytarget"] = true, ["raidtarget"] = true, ["bosstarget"] = true, ["maintanktarget"] = true, ["mainassisttarget"] = true, ["battlegroundtarget"] = true, ["partytargettarget"] = true, ["battlegroundtargettarget"] = true, ["maintanktargettarget"] = true, ["mainassisttargettarget"] = true, ["bosstargettarget"] = true}
  16. L.units = {["raidpet"] = L["Raid pet"], ["PET"] = L["Pet"], ["arena"] = L["Arena"], ["arenapet"] = L["Arena Pet"], ["arenatarget"] = L["Arena Target"], ["arenatargettarget"] = L["Arena Target of Target"], ["boss"] = L["Boss"], ["bosstarget"] = L["Boss Target"],["mainassist"] = L["Main Assist"], ["mainassisttarget"] = L["Main Assist Target"], ["maintank"] = L["Main Tank"], ["maintanktarget"] = L["Main Tank Target"], ["party"] = L["Party"], ["partypet"] = L["Party Pet"], ["partytarget"] = L["Party Target"], ["pet"] = L["Pet"], ["pettarget"] = L["Pet Target"], ["player"] = L["Player"],["raid"] = L["Raid"], ["target"] = L["Target"], ["targettarget"] = L["Target of Target"], ["targettargettarget"] = L["Target of Target of Target"], ["battleground"] = L["Battleground"], ["battlegroundpet"] = L["Battleground Pet"], ["battlegroundtarget"] = L["Battleground Target"], ["partytargettarget"] = L["Party Target of Target"], ["battlegroundtargettarget"] = L["Battleground Target of Target"], ["maintanktargettarget"] = L["Main Tank Target of Target"], ["mainassisttargettarget"] = L["Main Assist Target of Target"], ["bosstargettarget"] = L["Boss Target of Target"]}
  17. L.shortUnits = {["battleground"] = L["BG"], ["battlegroundtarget"] = L["BG Target"], ["battlegroundpet"] = L["BG Pet"], ["battlegroundtargettarget"] = L["BG ToT"], ["arenatargettarget"] = L["Arena ToT"], ["partytargettarget"] = L["Party ToT"], ["bosstargettarget"] = L["Boss ToT"], ["maintanktargettarget"] = L["MT ToT"], ["mainassisttargettarget"] = L["MA ToT"]}
  18.  
  19. -- Cache the units so we don't have to concat every time it updates
  20. ShadowUF.unitTarget = setmetatable({}, {__index = function(tbl, unit) rawset(tbl, unit, unit .. "target"); return unit .. "target" end})
  21. ShadowUF.partyUnits, ShadowUF.raidUnits, ShadowUF.raidPetUnits, ShadowUF.bossUnits, ShadowUF.arenaUnits, ShadowUF.battlegroundUnits = {}, {}, {}, {}, {}, {}
  22. ShadowUF.maintankUnits, ShadowUF.mainassistUnits, ShadowUF.raidpetUnits = ShadowUF.raidUnits, ShadowUF.raidUnits, ShadowUF.raidPetUnits
  23. for i=1, MAX_PARTY_MEMBERS do ShadowUF.partyUnits[i] = "party" .. i end
  24. for i=1, MAX_RAID_MEMBERS do ShadowUF.raidUnits[i] = "raid" .. i end
  25. for i=1, MAX_RAID_MEMBERS do ShadowUF.raidPetUnits[i] = "raidpet" .. i end
  26. for i=1, MAX_BOSS_FRAMES do ShadowUF.bossUnits[i] = "boss" .. i end
  27. for i=1, 5 do ShadowUF.arenaUnits[i] = "arena" .. i end
  28. for i=1, 4 do ShadowUF.battlegroundUnits[i] = "arena" .. i end
  29.  
  30. local TagEnv = setmetatable({
  31. UnitHealth = ShadowUF.API.UnitHealth,
  32. UnitHealthMax = ShadowUF.API.UnitHealthMax,
  33. }, { __index = _G, __newindex = function(k,v) _G[k] = v end })
  34.  
  35. function ShadowUF:OnInitialize()
  36. self.defaults = {
  37. profile = {
  38. locked = false,
  39. advanced = false,
  40. tooltipCombat = false,
  41. omnicc = false,
  42. blizzardcc = true,
  43. tags = {},
  44. units = {},
  45. positions = {},
  46. range = {},
  47. filters = {zonewhite = {}, zoneblack = {}, zoneoverride = {}, whitelists = {}, blacklists = {}, overridelists = {}},
  48. visibility = {arena = {}, pvp = {}, party = {}, raid = {}},
  49. hidden = {cast = false, playerPower = true, buffs = false, party = true, raid = false, player = true, pet = true, target = true, boss = true, arena = true, playerAltPower = false},
  50. },
  51. }
  52.  
  53. self:LoadUnitDefaults()
  54.  
  55. -- Initialize DB
  56. self.db = LibStub:GetLibrary("AceDB-3.0"):New("ShadowedUFDB", self.defaults, true)
  57. self.db.RegisterCallback(self, "OnProfileChanged", "ProfilesChanged")
  58. self.db.RegisterCallback(self, "OnProfileCopied", "ProfilesChanged")
  59. self.db.RegisterCallback(self, "OnProfileReset", "ProfileReset")
  60.  
  61. -- Setup tag cache
  62. self.tagFunc = setmetatable({}, {
  63. __index = function(tbl, index)
  64. if( not ShadowUF.Tags.defaultTags[index] and not ShadowUF.db.profile.tags[index] ) then
  65. tbl[index] = false
  66. return false
  67. end
  68.  
  69. local func, msg = loadstring("return " .. (ShadowUF.Tags.defaultTags[index] or ShadowUF.db.profile.tags[index].func or ""))
  70. if( func ) then
  71. func = func()
  72. elseif( msg ) then
  73. error(msg, 3)
  74. end
  75.  
  76. setfenv(func, TagEnv)
  77.  
  78. tbl[index] = func
  79. return tbl[index]
  80. end})
  81.  
  82. if( not self.db.profile.loadedLayout ) then
  83. self:LoadDefaultLayout()
  84. else
  85. self:CheckUpgrade()
  86. self:CheckBuild()
  87. self:ShowInfoPanel()
  88. end
  89.  
  90. self.db.profile.revision = self.dbRevision
  91. self.db.profile.revisionClassic = self.dbRevisionClassic
  92. self:FireModuleEvent("OnInitialize")
  93. self:HideBlizzardFrames()
  94. self.Layout:LoadSML()
  95. self:LoadUnits()
  96. self.modules.movers:Update()
  97. end
  98.  
  99. function ShadowUF.UnitAuraBySpell(unit, spell, filter)
  100. local index = 0
  101. while true do
  102. index = index + 1
  103. local name, _, _, _, _, _, _, _, _, spellID = UnitAura(unit, index, filter)
  104. if not name then break end
  105. if (type(spell) == "string" and spell == name) or (type(spell) == "number" and spell == spellID) then
  106. return UnitAura(unit, index, filter)
  107. end
  108. end
  109. end
  110.  
  111. function ShadowUF:CheckBuild()
  112. local build = select(4, GetBuildInfo())
  113. if( self.db.profile.wowBuild == build ) then return end
  114.  
  115. -- Nothing to add here right now
  116. self.db.profile.wowBuild = build
  117. end
  118.  
  119. function ShadowUF:CheckUpgrade()
  120. local revisionClassic = self.db.profile.revisionClassic or (self.db.profile.revision and 1 or self.dbRevisionClassic)
  121. local revision = self.db.profile.revision or self.dbRevision
  122. if( revisionClassic <= 1 ) then
  123. local indicators = self.db.profile.units.pet.indicators or {}
  124. self.db.profile.units.pet.indicators = indicators
  125. if( revision <= 59 or not indicators.happiness ) then
  126. indicators.happiness = {enabled = true, anchorPoint = "RC", size = 20, x = 0, y = 0, anchorTo = "$parent"}
  127. else
  128. local happiness = indicators.happiness
  129. if happiness.size == 0 then
  130. happiness.size = 20
  131. end
  132. if not happiness.anchorPoint then
  133. happiness.anchorPoint = "RC"
  134. end
  135. if not happiness.anchorTo then
  136. happiness.anchorTo = "$parent"
  137. end
  138. end
  139. end
  140. if( revision <= 58 ) then
  141. for unit, config in pairs(self.db.profile.units) do
  142. if config.text then
  143. local i = 1
  144. while i <= #config.text do
  145. local text
  146. if rawget(config.text, i) or i <= #(self.defaults.profile.units[unit].text) then
  147. text = config.text[i]
  148. end
  149.  
  150. if not text then
  151. table.remove(config.text, i)
  152. elseif text.anchorTo == "$demonicFuryBar" or text.anchorTo == "$eclipseBar" or text.anchorTo == "$burningEmbersBar" or text.anchorTo == "$monkBar" then
  153. table.remove(config.text, i)
  154. elseif i > 6 and text.default and text.anchorTo == "$emptyBar" then
  155. table.remove(config.text, i)
  156. else
  157. if text.anchorTo == "$emptyBar" and text.name == L["Left text"] then
  158. text.width = 0.50
  159. end
  160.  
  161. i = i + 1
  162. end
  163. end
  164.  
  165. if not config.text[6] or config.text[6].anchorTo ~= "$emptyBar" then
  166. table.insert(config.text, 6, {enabled = true, width = 0.60, name = L["Right text"], text = "", anchorTo = "$emptyBar", anchorPoint = "CRI", size = 0, x = -3, y = 0, default = true})
  167. else
  168. config.text[6].width = 0.60
  169. config.text[6].name = L["Right text"]
  170. config.text[6].anchorPoint = "CRI"
  171. config.text[6].size = 0
  172. config.text[6].x = -3
  173. config.text[6].y = 0
  174. config.text[6].default = true
  175. end
  176. end
  177. end
  178. end
  179.  
  180. if( revision <= 56 ) then
  181. -- new classes
  182. self.db.profile.classColors.DEMONHUNTER = {r = 0.64, g = 0.19, b = 0.79}
  183.  
  184. -- new power types
  185. self.db.profile.powerColors.INSANITY = {r = 0.40, g = 0, b = 0.80}
  186. self.db.profile.powerColors.MAELSTROM = {r = 0.00, g = 0.50, b = 1.00}
  187. self.db.profile.powerColors.FURY = {r = 0.788, g = 0.259, b = 0.992}
  188. self.db.profile.powerColors.PAIN = {r = 1, g = 0, b = 0}
  189. self.db.profile.powerColors.LUNAR_POWER = {r = 0.30, g = 0.52, b = 0.90}
  190. self.db.profile.powerColors.ARCANECHARGES = {r = 0.1, g = 0.1, b = 0.98}
  191.  
  192. -- new bars
  193. local config = self.db.profile.units
  194. config.player.priestBar = {enabled = true, background = true, height = 0.40, order = 70}
  195. config.player.shamanBar = {enabled = true, background = true, height = 0.40, order = 70}
  196. config.player.arcaneCharges = {enabled = true, anchorTo = "$parent", order = 60, height = 0.40, anchorPoint = "BR", x = -8, y = 6, size = 12, spacing = -2, growth = "LEFT", isBar = true, showAlways = true}
  197.  
  198. -- clean out old bars
  199. config.player.demonicFuryBar = nil
  200. config.player.burningEmbersBar = nil
  201. config.player.shadowOrbs = nil
  202. config.player.eclipseBar = nil
  203. config.player.monkBar = nil
  204. end
  205.  
  206. if( revision <= 49 ) then
  207. ShadowUF:LoadDefaultLayout(true)
  208. end
  209.  
  210. if( revision <= 49 ) then
  211. if( ShadowUF.db.profile.font.extra == "MONOCHROME" ) then
  212. ShadowUF.db.profile.font.extra = ""
  213. end
  214. end
  215.  
  216. if( revision <= 47 ) then
  217. local config = self.db.profile.units
  218. config.player.comboPoints = config.target.comboPoints
  219. end
  220.  
  221. if( revision <= 45 ) then
  222. for unit, config in pairs(self.db.profile.units) do
  223. if( config.auras ) then
  224. for _, key in pairs({"buffs", "debuffs"}) do
  225. local aura = config.auras[key]
  226. aura.show = aura.show or {}
  227. aura.show.player = true
  228. aura.show.boss = true
  229. aura.show.raid = true
  230. aura.show.misc = true
  231. end
  232. end
  233. end
  234. end
  235. end
  236.  
  237. local function zoneEnabled(zone, zoneList)
  238. if( type(zoneList) == "string" ) then
  239. return zone == zoneList
  240. end
  241.  
  242. for id, row in pairs(zoneList) do
  243. if( zone == row ) then return true end
  244. end
  245.  
  246. return false
  247. end
  248.  
  249. function ShadowUF:LoadUnits()
  250. -- CanHearthAndResurrectFromArea() returns true for world pvp areas, according to BattlefieldFrame.lua
  251. local instanceType = CanHearthAndResurrectFromArea() and "pvp" or select(2, IsInInstance())
  252. if( instanceType == "scenario" ) then instanceType = "party" end
  253.  
  254. if( not instanceType ) then instanceType = "none" end
  255.  
  256. for _, type in pairs(self.unitList) do
  257. local enabled = self.db.profile.units[type].enabled
  258. if( ShadowUF.Units.zoneUnits[type] ) then
  259. enabled = enabled and zoneEnabled(instanceType, ShadowUF.Units.zoneUnits[type])
  260. elseif( instanceType ~= "none" ) then
  261. if( self.db.profile.visibility[instanceType][type] == false ) then
  262. enabled = false
  263. elseif( self.db.profile.visibility[instanceType][type] == true ) then
  264. enabled = true
  265. end
  266. end
  267.  
  268. self.enabledUnits[type] = enabled
  269.  
  270. if( enabled ) then
  271. self.Units:InitializeFrame(type)
  272. else
  273. self.Units:UninitializeFrame(type)
  274. end
  275. end
  276. end
  277.  
  278. function ShadowUF:LoadUnitDefaults()
  279. for _, unit in pairs(self.unitList) do
  280. self.defaults.profile.positions[unit] = {point = "", relativePoint = "", anchorPoint = "", anchorTo = "UIParent", x = 0, y = 0}
  281.  
  282. -- The reason why the defaults are so sparse, is because the layout needs to specify most of this. The reason I set tables here is basically
  283. -- as an indication that hey, the unit wants this, if it doesn't that it won't want it.
  284. self.defaults.profile.units[unit] = {
  285. enabled = false, height = 0, width = 0, scale = 1.0,
  286. healthBar = {enabled = true},
  287. powerBar = {enabled = true},
  288. emptyBar = {enabled = false},
  289. portrait = {enabled = false},
  290. castBar = {enabled = false, name = {}, time = {}},
  291. text = {
  292. {enabled = true, name = L["Left text"], text = "[name]", anchorPoint = "CLI", anchorTo = "$healthBar", width = 0.50, size = 0, x = 3, y = 0, default = true},
  293. {enabled = true, name = L["Right text"], text = "[curmaxhp]", anchorPoint = "CRI", anchorTo = "$healthBar", width = 0.60, size = 0, x = -3, y = 0, default = true},
  294. {enabled = true, name = L["Left text"], text = "[level] [race]", anchorPoint = "CLI", anchorTo = "$powerBar", width = 0.50, size = 0, x = 3, y = 0, default = true},
  295. {enabled = true, name = L["Right text"], text = "[curmaxpp]", anchorPoint = "CRI", anchorTo = "$powerBar", width = 0.60, size = 0, x = -3, y = 0, default = true},
  296. {enabled = true, name = L["Left text"], text = "", anchorTo = "$emptyBar", anchorPoint = "CLI", width = 0.50, size = 0, x = 3, y = 0, default = true},
  297. {enabled = true, name = L["Right text"], text = "", anchorTo = "$emptyBar", anchorPoint = "CRI", width = 0.60, size = 0, x = -3, y = 0, default = true},
  298. ['*'] = {enabled = true, text = "", anchorTo = "", anchorPoint = "C", size = 0, x = 0, y = 0},
  299. },
  300. indicators = {raidTarget = {enabled = true, size = 0}},
  301. highlight = {},
  302. auraIndicators = {enabled = false},
  303. auras = {
  304. buffs = {enabled = false, perRow = 10, maxRows = 4, selfScale = 1.30, prioritize = true, show = {player = true, boss = true, raid = true, misc = true}, enlarge = {}, timers = {ALL = true}},
  305. debuffs = {enabled = false, perRow = 10, maxRows = 4, selfScale = 1.30, show = {player = true, boss = true, raid = true, misc = true}, enlarge = {SELF = true}, timers = {ALL = true}},
  306. },
  307. }
  308.  
  309. if( not self.fakeUnits[unit] ) then
  310. self.defaults.profile.units[unit].combatText = {enabled = true, anchorTo = "$parent", anchorPoint = "C", x = 0, y = 0}
  311.  
  312. if( unit ~= "battleground" and unit ~= "battlegroundpet" and unit ~= "arena" and unit ~= "arenapet" and unit ~= "boss" ) then
  313. self.defaults.profile.units[unit].incHeal = {enabled = true, cap = 1.20}
  314. self.defaults.profile.units[unit].incAbsorb = {enabled = true, cap = 1.30}
  315. self.defaults.profile.units[unit].healAbsorb = {enabled = true, cap = 1.30}
  316. end
  317. end
  318.  
  319. if( unit ~= "player" ) then
  320. self.defaults.profile.units[unit].range = {enabled = false, oorAlpha = 0.80, inAlpha = 1.0}
  321.  
  322. if( not string.match(unit, "pet") ) then
  323. self.defaults.profile.units[unit].indicators.class = {enabled = false, size = 19}
  324. end
  325. end
  326.  
  327. if( unit == "player" or unit == "party" or unit == "target" or unit == "raid" or unit == "mainassist" or unit == "maintank" ) then
  328. self.defaults.profile.units[unit].indicators.leader = {enabled = true, size = 0}
  329. self.defaults.profile.units[unit].indicators.masterLoot = {enabled = true, size = 0}
  330. self.defaults.profile.units[unit].indicators.pvp = {enabled = true, size = 0}
  331. self.defaults.profile.units[unit].indicators.role = {enabled = true, size = 0}
  332. self.defaults.profile.units[unit].indicators.status = {enabled = false, size = 19}
  333. self.defaults.profile.units[unit].indicators.resurrect = {enabled = true}
  334.  
  335. if( unit ~= "target" ) then
  336. self.defaults.profile.units[unit].indicators.ready = {enabled = true, size = 0}
  337. end
  338. end
  339.  
  340. if( unit == "battleground" ) then
  341. self.defaults.profile.units[unit].indicators.pvp = {enabled = true, size = 0}
  342. end
  343.  
  344. self.defaults.profile.units[unit].altPowerBar = {enabled = not ShadowUF.fakeUnits[unit]}
  345. end
  346.  
  347. -- PLAYER
  348. self.defaults.profile.units.player.enabled = true
  349. self.defaults.profile.units.player.healthBar.predicted = true
  350. self.defaults.profile.units.player.powerBar.predicted = true
  351. self.defaults.profile.units.player.indicators.status.enabled = true
  352. self.defaults.profile.units.player.totemBar = {enabled = false}
  353. self.defaults.profile.units.player.druidBar = {enabled = false}
  354. self.defaults.profile.units.player.xpBar = {enabled = false}
  355. self.defaults.profile.units.player.fader = {enabled = false}
  356. self.defaults.profile.units.player.comboPoints = {enabled = true, isBar = true}
  357. table.insert(self.defaults.profile.units.player.text, {enabled = true, text = "", anchorTo = "", anchorPoint = "C", size = 0, x = 0, y = 0, default = true})
  358. table.insert(self.defaults.profile.units.player.text, {enabled = true, text = "", anchorTo = "", anchorPoint = "C", size = 0, x = 0, y = 0, default = true})
  359. table.insert(self.defaults.profile.units.player.text, {enabled = true, text = "", anchorTo = "", anchorPoint = "C", size = 0, x = 0, y = 0, default = true})
  360.  
  361. -- PET
  362. self.defaults.profile.units.pet.enabled = true
  363. self.defaults.profile.units.pet.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  364. self.defaults.profile.units.pet.xpBar = {enabled = false}
  365. self.defaults.profile.units.pet.indicators.happiness = {enabled = true, size = 0, x = 0, y = 0}
  366. -- TARGET
  367. self.defaults.profile.units.target.enabled = true
  368. self.defaults.profile.units.target.indicators.questBoss = {enabled = true, size = 0, x = 0, y = 0}
  369. self.defaults.profile.units.target.comboPoints = {enabled = false, isBar = true}
  370. self.defaults.profile.units.target.auras.buffs.approximateEnemyData = true
  371. -- TARGETTARGET/TARGETTARGETTARGET
  372. self.defaults.profile.units.targettarget.enabled = true
  373. self.defaults.profile.units.targettargettarget.enabled = true
  374. -- PARTY
  375. self.defaults.profile.units.party.enabled = true
  376. self.defaults.profile.units.party.auras.debuffs.maxRows = 1
  377. self.defaults.profile.units.party.auras.buffs.maxRows = 1
  378. self.defaults.profile.units.party.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  379. self.defaults.profile.units.party.combatText.enabled = false
  380. self.defaults.profile.units.party.indicators.phase = {enabled = true, size = 0, x = 0, y = 0}
  381. -- ARENA
  382. self.defaults.profile.units.arena.enabled = false
  383. self.defaults.profile.units.arena.attribPoint = "TOP"
  384. self.defaults.profile.units.arena.attribAnchorPoint = "LEFT"
  385. self.defaults.profile.units.arena.auras.debuffs.maxRows = 1
  386. self.defaults.profile.units.arena.auras.buffs.maxRows = 1
  387. self.defaults.profile.units.arena.offset = 0
  388. -- BATTLEGROUND
  389. self.defaults.profile.units.battleground.enabled = false
  390. self.defaults.profile.units.battleground.attribPoint = "TOP"
  391. self.defaults.profile.units.battleground.attribAnchorPoint = "LEFT"
  392. self.defaults.profile.units.battleground.auras.debuffs.maxRows = 1
  393. self.defaults.profile.units.battleground.auras.buffs.maxRows = 1
  394. self.defaults.profile.units.battleground.offset = 0
  395. -- BOSS
  396. self.defaults.profile.units.boss.enabled = false
  397. self.defaults.profile.units.boss.attribPoint = "TOP"
  398. self.defaults.profile.units.boss.attribAnchorPoint = "LEFT"
  399. self.defaults.profile.units.boss.auras.debuffs.maxRows = 1
  400. self.defaults.profile.units.boss.auras.buffs.maxRows = 1
  401. self.defaults.profile.units.boss.offset = 0
  402. self.defaults.profile.units.boss.altPowerBar.enabled = true
  403. -- RAID
  404. self.defaults.profile.units.raid.groupBy = "GROUP"
  405. self.defaults.profile.units.raid.sortOrder = "ASC"
  406. self.defaults.profile.units.raid.sortMethod = "INDEX"
  407. self.defaults.profile.units.raid.attribPoint = "TOP"
  408. self.defaults.profile.units.raid.attribAnchorPoint = "RIGHT"
  409. self.defaults.profile.units.raid.offset = 0
  410. self.defaults.profile.units.raid.filters = {[1] = true, [2] = true, [3] = true, [4] = true, [5] = true, [6] = true, [7] = true, [8] = true}
  411. self.defaults.profile.units.raid.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  412. self.defaults.profile.units.raid.combatText.enabled = false
  413. -- RAID PET
  414. self.defaults.profile.units.raidpet.groupBy = "GROUP"
  415. self.defaults.profile.units.raidpet.sortOrder = "ASC"
  416. self.defaults.profile.units.raidpet.sortMethod = "INDEX"
  417. self.defaults.profile.units.raidpet.attribPoint = "TOP"
  418. self.defaults.profile.units.raidpet.attribAnchorPoint = "RIGHT"
  419. self.defaults.profile.units.raidpet.offset = 0
  420. self.defaults.profile.units.raidpet.filters = {[1] = true, [2] = true, [3] = true, [4] = true, [5] = true, [6] = true, [7] = true, [8] = true}
  421. self.defaults.profile.units.raidpet.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  422. self.defaults.profile.units.raidpet.combatText.enabled = false
  423. -- MAINTANK
  424. self.defaults.profile.units.maintank.roleFilter = "TANK"
  425. self.defaults.profile.units.maintank.groupFilter = "MAINTANK"
  426. self.defaults.profile.units.maintank.groupBy = "GROUP"
  427. self.defaults.profile.units.maintank.sortOrder = "ASC"
  428. self.defaults.profile.units.maintank.sortMethod = "INDEX"
  429. self.defaults.profile.units.maintank.attribPoint = "TOP"
  430. self.defaults.profile.units.maintank.attribAnchorPoint = "RIGHT"
  431. self.defaults.profile.units.maintank.offset = 0
  432. self.defaults.profile.units.maintank.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  433. -- MAINASSIST
  434. self.defaults.profile.units.mainassist.groupFilter = "MAINASSIST"
  435. self.defaults.profile.units.mainassist.groupBy = "GROUP"
  436. self.defaults.profile.units.mainassist.sortOrder = "ASC"
  437. self.defaults.profile.units.mainassist.sortMethod = "INDEX"
  438. self.defaults.profile.units.mainassist.attribPoint = "TOP"
  439. self.defaults.profile.units.mainassist.attribAnchorPoint = "RIGHT"
  440. self.defaults.profile.units.mainassist.offset = 0
  441. self.defaults.profile.units.mainassist.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  442. -- PARTYPET
  443. self.defaults.profile.positions.partypet.anchorTo = "$parent"
  444. self.defaults.profile.positions.partypet.anchorPoint = "RB"
  445. self.defaults.profile.units.partypet.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  446. -- PARTYTARGET
  447. self.defaults.profile.positions.partytarget.anchorTo = "$parent"
  448. self.defaults.profile.positions.partytarget.anchorPoint = "RT"
  449. self.defaults.profile.units.partytarget.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  450. -- PARTYTARGETTARGET
  451. self.defaults.profile.positions.partytarget.anchorTo = "$parent"
  452. self.defaults.profile.positions.partytarget.anchorPoint = "RT"
  453. self.defaults.profile.units.partytarget.fader = {enabled = false, combatAlpha = 1.0, inactiveAlpha = 0.60}
  454.  
  455. -- Aura indicators
  456. self.defaults.profile.auraIndicators = {
  457. disabled = {},
  458. missing = {},
  459. linked = {},
  460. indicators = {
  461. ["tl"] = {name = L["Top Left"], anchorPoint = "TLI", anchorTo = "$parent", height = 8, width = 8, alpha = 1.0, x = 4, y = -4, friendly = true, hostile = true},
  462. ["tr"] = {name = L["Top Right"], anchorPoint = "TRI", anchorTo = "$parent", height = 8, width = 8, alpha = 1.0, x = -3, y = -3, friendly = true, hostile = true},
  463. ["bl"] = {name = L["Bottom Left"], anchorPoint = "BLI", anchorTo = "$parent", height = 8, width = 8, alpha = 1.0, x = 4, y = 4, friendly = true, hostile = true},
  464. ["br"] = {name = L["Bottom Right"], anchorPoint = "BRI", anchorTo = "$parent", height = 8, width = 8, alpha = 1.0, x = -4, y = -4, friendly = true, hostile = true},
  465. ["c"] = {name = L["Center"], anchorPoint = "C", anchorTo = "$parent", height = 20, width = 20, alpha = 1.0, x = 0, y = 0, friendly = true, hostile = true},
  466. },
  467. filters = {
  468. ["tl"] = {boss = {priority = 100}, curable = {priority = 100}},
  469. ["tr"] = {boss = {priority = 100}, curable = {priority = 100}},
  470. ["bl"] = {boss = {priority = 100}, curable = {priority = 100}},
  471. ["br"] = {boss = {priority = 100}, curable = {priority = 100}},
  472. ["c"] = {boss = {priority = 100}, curable = {priority = 100}},
  473. },
  474. auras = {
  475. ["20707"] = [[{indicator = '', group = "Warlock", priority = 10, r = 0.42, g = 0.21, b = 0.65}]],
  476. ["116849"] = [[{r=0.19607843137255, group="Monk", indicator="c", g=1, player=false, duration=true, b=0.3843137254902, alpha=1, priority=0, icon=true, iconTexture="Interface\\Icons\\ability_monk_chicocoon"}]],
  477. ["155777"] = [[{r=0.57647058823529, group="Druid", indicator="tr", g=0.28235294117647, player=true, duration=true, b=0.6156862745098, priority=100, alpha=1, iconTexture="Interface\\Icons\\Spell_Nature_Rejuvenation"}]],
  478. ["121176"] = [[{alpha=1, b=0, priority=0, r=0.062745098039216, group="PvP Flags", indicator="bl", g=1, iconTexture="Interface\\Icons\\INV_BannerPVP_03"}]],
  479. ["19705"] = [[{r=0.80392156862745, group="Food", indicator="", g=0.76470588235294, missing=true, duration=true, priority=0, alpha=1, b=0.24313725490196}]],
  480. ["53563"] = [[{r=0.64313725490196, group="Paladin", indicator="tr", g=0.24705882352941, player=true, alpha=1, b=0.73333333333333, priority=100, duration=false, iconTexture="Interface\\Icons\\Ability_Paladin_BeaconofLight"}]],
  481. ["774"] = [[{r=0.57647058823529, group="Druid", indicator="tr", g=0.28235294117647, player=true, duration=true, b=0.6156862745098, priority=100, alpha=1, iconTexture="Interface\\Icons\\Spell_Nature_Rejuvenation"}]],
  482. ["33206"] = [[{r=0, group="Priest", indicator="c", g=0, b=0, duration=true, priority=0, icon=true, iconTexture="Interface\\Icons\\Spell_Holy_PainSupression"}]],
  483. ["6788"] = [[{b=0.29019607843137, group="Priest", indicator="tl", alpha=1, player=false, g=0.56862745098039, duration=true, r=0.83921568627451, priority=20, icon=false, iconTexture="Interface\\Icons\\Spell_Holy_AshesToAshes"}]],
  484. ["33763"] = [[{r=0.23137254901961, group="Druid", indicator="tl", g=1, player=true, duration=true, alpha=1, priority=0, b=0.2, iconTexture="Interface\\Icons\\INV_Misc_Herb_Felblossom"}]],
  485. ["139"] = [[{r=0.23921568627451, group="Priest", indicator="tr", g=1, player=true, alpha=1, duration=true, b=0.39607843137255, priority=10, icon=false, iconTexture="Interface\\Icons\\Spell_Holy_Renew"}]],
  486. ["41635"] = [[{r=1, group="Priest", indicator="br", g=0.90196078431373, missing=false, player=true, duration=false, alpha=1, b=0, priority=50, icon=false, iconTexture="Interface\\Icons\\Spell_Holy_PrayerOfMendingtga"}]],
  487. ["47788"] = [[{r=0, group="Priest", indicator="c", g=0, b=0, duration=true, priority=0, icon=true, iconTexture="Interface\\Icons\\Spell_Holy_GuardianSpirit"}]],
  488. ["61295"] = [[{r=0.17647058823529, group="Shaman", indicator="tl", g=0.4, player=true, alpha=1, duration=true, b=1, priority=0, icon=false, iconTexture="Interface\\Icons\\spell_nature_riptide"}]],
  489. ["17"] = [[{r=1, group="Priest", indicator="tl", g=0.41960784313725, player=true, alpha=1, duration=true, b=0.5843137254902, priority=0, icon=false, iconTexture="Interface\\Icons\\Spell_Holy_PowerWordShield"}]],
  490. ["152118"] = [[{r=1, group="Priest", indicator="tl", g=0.41960784313725, player=true, alpha=1, duration=true, b=0.5843137254902, priority=0, icon=false, iconTexture="Interface\\Icons\\Ability_Priest_ClarityOfWill"}]],
  491. ["23335"] = [[{r=0, group="PvP Flags", indicator="bl", g=0, duration=false, b=0, priority=0, icon=true, iconTexture="Interface\\Icons\\INV_BannerPVP_02"}]],
  492. ["102342"] = [[{r=0, group="Druid", indicator="c", g=0, duration=true, b=0, priority=0, icon=true, iconTexture="Interface\\Icons\\spell_druid_ironbark"}]],
  493. ["121177"] = [[{r=0.78039215686275, group="PvP Flags", indicator="bl", g=0.42352941176471, alpha=1, b=0, priority=0, icon=false, iconTexture="Interface\\Icons\\INV_BannerPVP_03"}]],
  494. ["586"] = [[{r=0, group="Priest", indicator="", g=0.85882352941176, selfColor={alpha=1, b=1, g=0.93725490196078, r=0, }, alpha=1, priority=0, b=1, iconTexture="Interface\\Icons\\Spell_Magic_LesserInvisibilty"}]],
  495. ["23333"] = [[{icon=true, b=0, priority=0, r=0, group="PvP Flags", indicator="bl", g=0, iconTexture="Interface\\Icons\\INV_BannerPVP_01"}]],
  496. ["119611"] = [[{r=0.26274509803922, group="Monk", indicator="tl", g=0.76078431372549, player=true, duration=true, alpha=1, b=0.53725490196078, priority=0, icon=false, iconTexture="Interface\\Icons\\ability_monk_renewingmists"}]],
  497. ["8936"] = [[{r=0.12156862745098, group="Druid", indicator="br", g=0.45882352941176, player=true, duration=true, b=0.12156862745098, priority=100, alpha=1, iconTexture="Interface\\Icons\\Spell_Nature_ResistNature"}]],
  498. ["34976"] = [[{r=0, group="PvP Flags", indicator="bl", g=0, player=false, b=0, priority=0, icon=true, iconTexture="Interface\\Icons\\INV_BannerPVP_03"}]],
  499. ["121164"] = [[{alpha=1, b=1, priority=0, r=0, group="PvP Flags", indicator="bl", g=0.003921568627451, iconTexture="Interface\\Icons\\INV_BannerPVP_03"}]],
  500. ["48438"] = [[{r=0.55294117647059, group="Druid", indicator="31685", g=1, player=true, duration=true, b=0.3921568627451, priority=100, alpha=1, iconTexture="Interface\\Icons\\Ability_Druid_Flourish"}]],
  501. ["1022"] = [[{r=0, group="Paladin", indicator="c", g=0, player=false, duration=true, b=0, priority=0, icon=true, iconTexture="Interface\\Icons\\Spell_Holy_SealOfProtection"}]],
  502. ["121175"] = [[{r=1, group="PvP Flags", indicator="bl", g=0.24705882352941, b=0.90196078431373, alpha=1, priority=0, icon=false, iconTexture="Interface\\Icons\\INV_BannerPVP_03"}]],
  503. ["64844"] = [[{r=0.67843137254902, group="Priest", indicator="31685", g=0.30588235294118, player=true, alpha=1, priority=0, b=0.14117647058824, iconTexture="Interface\\Icons\\Spell_Holy_DivineProvidence"}]],
  504. ["124081"] = [[{r=0.51372549019608, group="Monk", indicator="br", g=1, player=true, duration=true, b=0.90588235294118, alpha=1, priority=100, icon=false, iconTexture="Interface\\Icons\\ability_monk_forcesphere"}]],
  505. ["29166"] = [[{r=0, group="Druid", indicator="c", g=0, b=0, duration=true, priority=0, icon=true, iconTexture="Interface\\Icons\\Spell_Nature_Lightning"}]],
  506. ["189895"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\INV_Enchant_VoidSphere\";}",
  507. ["189627"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\achievement_zone_cataclysmgreen\";}",
  508. ["181306"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Ability_Mage_LivingBomb\";}",
  509. ["181753"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_felarakkoa_feldetonation_green\";}",
  510. ["188929"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Ability_Hunter_MarkedForDeath\";}",
  511. ["189032"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_malkorok_blightofyshaarj_green\";}",
  512. ["182826"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Fire_FelFlameRing\";}",
  513. ["181515"] = "{b=0;g=0;priority=1;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_SeedOfDestruction\";}",
  514. ["179219"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_felarakkoa_feldetonation_red\";}",
  515. ["179864"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Arcane_PrismaticCloak\";}",
  516. ["184124"] = "{b=0;g=0;priority=1;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_AntiMagicShell\";}",
  517. ["184450"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossfelorcs_necromancer_purple\";}",
  518. ["186134"] = "{icon=true;b=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"tr\";g=0;iconTexture=\"Interface\\\\Icons\\\\spell_fel_elementaldevastation\";}",
  519. ["185066"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossfelorcs_necromancer_red\";}",
  520. ["183817"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Ability_Warlock_EverlastingAffliction\";}",
  521. ["179978"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossgorefiend_touchofdoom\";}",
  522. ["182280"] = "{icon=true;b=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";g=0;iconTexture=\"Interface\\\\Icons\\\\Ability_Hunter_MarkedForDeath\";}",
  523. ["189031"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_malkorok_blightofyshaarj_yellow\";}",
  524. ["186500"] = "{b=0;g=0;priority=1;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"INTERFACE\\\\ICONS\\\\inv_misc_steelweaponchain\";}",
  525. ["188666"] = "{b=0;g=0;priority=1;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"INTERFACE\\\\ICONS\\\\ability_warlock_soulsiphon\";}",
  526. ["186333"] = "{b=0;g=0;priority=1;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_DevouringPlague\";}",
  527. ["186135"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"tr\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_AntiShadow\";}",
  528. ["181275"] = "{icon=true;b=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";g=0;iconTexture=\"Interface\\\\Icons\\\\spell_warlock_summonterrorguard\";}",
  529. ["181957"] = "{b=0;g=0;priority=2;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Frost_ArcticWinds\";}",
  530. ["189030"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_malkorok_blightofyshaarj_red\";}",
  531. ["182178"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_arakkoa_spinning_blade\";}",
  532. ["189777"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"INTERFACE\\\\ICONS\\\\inv_misc_steelweaponchain\";}",
  533. ["186407"] = "{r=0;indicator=\"c\";b=0;group=\"Hellfire Citadel\";priority=2;g=0;iconTexture=\"Interface\\\\Icons\\\\spell_fel_incinerate\";}",
  534. ["180166"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"tr\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_ChillTouch\";}",
  535. ["180079"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\inv_blacksmithdye_black\";}",
  536. ["184449"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossfelorcs_necromancer_purple\";}",
  537. ["185510"] = "{r=0;icon=true;indicator=\"tr\";b=0;group=\"Hellfire Citadel\";priority=1;g=0;iconTexture=\"INTERFACE\\\\ICONS\\\\inv_misc_steelweaponchain\";}",
  538. ["185065"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossfelorcs_necromancer_orange\";}",
  539. ["182769"] = "{r=0;icon=true;indicator=\"tr\";b=0;group=\"Hellfire Citadel\";priority=0;g=0;iconTexture=\"Interface\\\\Icons\\\\ability_fixated_state_purple\";}",
  540. ["181508"] = "{b=0;group=\"Hellfire Citadel\";indicator=\"c\";g=0;alpha=1;r=0;priority=1;icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_SeedOfDestruction\";}",
  541. ["181099"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_AuraOfDarkness\";}",
  542. ["181307"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\Spell_Shadow_Requiem\";}",
  543. ["183865"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_warlock_shadowfurytga\";}",
  544. ["186961"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_warlock_moltencoregreen\";}",
  545. ["182200"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_arakkoa_spinning_blade\";}",
  546. ["181597"] = "{b=0;g=0;priority=0;r=0;group=\"Hellfire Citadel\";indicator=\"c\";icon=true;iconTexture=\"Interface\\\\Icons\\\\ability_bossmannoroth_mannorothsgaze\";}",
  547. }
  548. }
  549.  
  550. for classToken in pairs(RAID_CLASS_COLORS) do
  551. self.defaults.profile.auraIndicators.disabled[classToken] = {}
  552. end
  553. end
  554.  
  555. -- Module APIs
  556. function ShadowUF:RegisterModule(module, key, name, isBar, class, spec, level)
  557. -- Prevent duplicate registration for deprecated plugin
  558. if( key == "auraIndicators" and IsAddOnLoaded("ShadowedUF_Indicators") and self.modules.auraIndicators ) then
  559. self:Print(L["WARNING! ShadowedUF_Indicators has been deprecated as v4 and is now built in. Please delete ShadowedUF_Indicators, your configuration will be saved."])
  560. return
  561. end
  562.  
  563. self.modules[key] = module
  564.  
  565. module.moduleKey = key
  566. module.moduleHasBar = isBar
  567. module.moduleName = name
  568. module.moduleClass = class
  569. module.moduleLevel = level
  570.  
  571. if( type(spec) == "number" ) then
  572. module.moduleSpec = {}
  573. module.moduleSpec[spec] = true
  574. elseif( type(spec) == "table" ) then
  575. module.moduleSpec = {}
  576. for _, id in pairs(spec) do
  577. module.moduleSpec[id] = true
  578. end
  579. end
  580.  
  581. table.insert(self.moduleOrder, module)
  582. end
  583.  
  584. function ShadowUF:FireModuleEvent(event, frame, unit)
  585. for _, module in pairs(self.moduleOrder) do
  586. if( module[event] ) then
  587. module[event](module, frame, unit)
  588. end
  589. end
  590. end
  591.  
  592. -- Profiles changed
  593. -- I really dislike this solution, but if we don't do it then there is setting issues
  594. -- because when copying a profile, AceDB-3.0 fires OnProfileReset -> OnProfileCopied
  595. -- SUF then sees that on the new reset profile has no profile, tries to load one in
  596. -- ... followed by the profile copying happen and it doesn't copy everything correctly
  597. -- due to variables being reset already.
  598. local resetTimer
  599. function ShadowUF:ProfileReset()
  600. if( not resetTimer ) then
  601. resetTimer = CreateFrame("Frame")
  602. resetTimer:SetScript("OnUpdate", function(f)
  603. ShadowUF:ProfilesChanged()
  604. f:Hide()
  605. end)
  606. end
  607.  
  608. resetTimer:Show()
  609. end
  610.  
  611. function ShadowUF:ProfilesChanged()
  612. if( self.layoutImporting ) then return end
  613. if( resetTimer ) then resetTimer:Hide() end
  614.  
  615. self.db:RegisterDefaults(self.defaults)
  616.  
  617. -- No active layout, register the default one
  618. if( not self.db.profile.loadedLayout ) then
  619. self:LoadDefaultLayout()
  620. else
  621. self:CheckUpgrade()
  622. end
  623.  
  624. self:FireModuleEvent("OnProfileChange")
  625. self:LoadUnits()
  626. self:HideBlizzardFrames()
  627. self.Layout:CheckMedia()
  628. self.Units:ProfileChanged()
  629. self.modules.movers:Update()
  630. end
  631.  
  632. ShadowUF.noop = function() end
  633. ShadowUF.hiddenFrame = CreateFrame("Frame")
  634. ShadowUF.hiddenFrame:Hide()
  635.  
  636. local rehideFrame = function(self)
  637. if( not InCombatLockdown() ) then
  638. self:Hide()
  639. end
  640. end
  641.  
  642. local function basicHideBlizzardFrames(...)
  643. for i=1, select("#", ...) do
  644. local frame = select(i, ...)
  645. frame:UnregisterAllEvents()
  646. frame:HookScript("OnShow", rehideFrame)
  647. frame:Hide()
  648. end
  649. end
  650.  
  651. local function hideBlizzardFrames(taint, ...)
  652. for i=1, select("#", ...) do
  653. local frame = select(i, ...)
  654. UnregisterUnitWatch(frame)
  655. frame:UnregisterAllEvents()
  656. frame:Hide()
  657.  
  658. if( frame.manabar ) then frame.manabar:UnregisterAllEvents() end
  659. if( frame.healthbar ) then frame.healthbar:UnregisterAllEvents() end
  660. if( frame.spellbar ) then frame.spellbar:UnregisterAllEvents() end
  661. if( frame.powerBarAlt ) then frame.powerBarAlt:UnregisterAllEvents() end
  662.  
  663. if( taint ) then
  664. frame.Show = ShadowUF.noop
  665. else
  666. frame:SetParent(ShadowUF.hiddenFrame)
  667. frame:HookScript("OnShow", rehideFrame)
  668. end
  669. end
  670. end
  671.  
  672. local active_hiddens = {}
  673. function ShadowUF:HideBlizzardFrames()
  674. if( self.db.profile.hidden.cast and not active_hiddens.cast ) then
  675. hideBlizzardFrames(true, CastingBarFrame, PetCastingBarFrame)
  676. end
  677.  
  678. if( self.db.profile.hidden.party and not active_hiddens.party ) then
  679. for i=1, MAX_PARTY_MEMBERS do
  680. local name = "PartyMemberFrame" .. i
  681. hideBlizzardFrames(false, _G[name], _G[name .. "HealthBar"], _G[name .. "ManaBar"])
  682. end
  683.  
  684. -- This stops the compact party frame from being shown
  685. UIParent:UnregisterEvent("GROUP_ROSTER_UPDATE")
  686.  
  687. -- This just makes sure
  688. if( CompactPartyFrame ) then
  689. hideBlizzardFrames(false, CompactPartyFrame)
  690. end
  691. end
  692.  
  693. if( CompactRaidFrameManager ) then
  694. if( self.db.profile.hidden.raid and not active_hiddens.raidTriggered ) then
  695. active_hiddens.raidTriggered = true
  696.  
  697. local function hideRaid()
  698. CompactRaidFrameManager:UnregisterAllEvents()
  699. CompactRaidFrameContainer:UnregisterAllEvents()
  700. if( InCombatLockdown() ) then return end
  701.  
  702. CompactRaidFrameManager:Hide()
  703. local shown = CompactRaidFrameManager_GetSetting("IsShown")
  704. if( shown and shown ~= "0" ) then
  705. CompactRaidFrameManager_SetSetting("IsShown", "0")
  706. end
  707. end
  708.  
  709. hooksecurefunc("CompactRaidFrameManager_UpdateShown", function()
  710. if( self.db.profile.hidden.raid ) then
  711. hideRaid()
  712. end
  713. end)
  714.  
  715. hideRaid()
  716. CompactRaidFrameContainer:HookScript("OnShow", hideRaid)
  717. CompactRaidFrameManager:HookScript("OnShow", hideRaid)
  718. end
  719. end
  720.  
  721. if( self.db.profile.hidden.buffs and not active_hiddens.buffs ) then
  722. hideBlizzardFrames(false, BuffFrame, TemporaryEnchantFrame)
  723. end
  724.  
  725. if( self.db.profile.hidden.player and not active_hiddens.player ) then
  726. hideBlizzardFrames(false, PlayerFrame)
  727.  
  728. -- We keep these in case someone is still using the default auras, otherwise it messes up vehicle stuff
  729. PlayerFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
  730. PlayerFrame:SetMovable(true)
  731. PlayerFrame:SetUserPlaced(true)
  732. PlayerFrame:SetDontSavePosition(true)
  733. end
  734.  
  735. if( self.db.profile.hidden.pet and not active_hiddens.pet ) then
  736. hideBlizzardFrames(false, PetFrame)
  737. end
  738.  
  739. if( self.db.profile.hidden.target and not active_hiddens.target ) then
  740. hideBlizzardFrames(false, TargetFrame, ComboFrame, TargetFrameToT)
  741. end
  742.  
  743. if( self.db.profile.hidden.boss and not active_hiddens.boss ) then
  744. for i=1, MAX_BOSS_FRAMES do
  745. local name = "Boss" .. i .. "TargetFrame"
  746. hideBlizzardFrames(false, _G[name], _G[name .. "HealthBar"], _G[name .. "ManaBar"])
  747. end
  748. end
  749.  
  750. -- As a reload is required to reset the hidden hooks, we can just set this to true if anything is true
  751. for type, flag in pairs(self.db.profile.hidden) do
  752. if( flag ) then
  753. active_hiddens[type] = true
  754. end
  755. end
  756. end
  757.  
  758. -- Upgrade info
  759. local infoMessages = {
  760. -- Old messages we don't need anymore
  761. {}, {},
  762. {
  763. L["You must restart Shadowed Unit Frames."],
  764. L["If you don't, you will be unable to use any combo point features (Chi, Holy Power, Combo Points, Aura Points, etc) until you do so."]
  765. }
  766. }
  767.  
  768. function ShadowUF:ShowInfoPanel()
  769. local infoID = ShadowUF.db.global.infoID or 0
  770. if( ShadowUF.ComboPoints and infoID < 3 ) then infoID = 3 end
  771.  
  772. ShadowUF.db.global.infoID = #(infoMessages)
  773. if( infoID < 0 or infoID >= #(infoMessages) ) then return end
  774.  
  775. local frame = CreateFrame("Frame", nil, UIParent)
  776. frame:SetClampedToScreen(true)
  777. frame:SetFrameStrata("HIGH")
  778. frame:SetToplevel(true)
  779. frame:SetWidth(500)
  780. frame:SetHeight(285)
  781. frame:SetBackdrop({
  782. bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
  783. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  784. edgeSize = 26,
  785. insets = {left = 9, right = 9, top = 9, bottom = 9},
  786. })
  787. frame:SetBackdropColor(0, 0, 0, 0.85)
  788. frame:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
  789.  
  790. frame.titleBar = frame:CreateTexture(nil, "ARTWORK")
  791. frame.titleBar:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
  792. frame.titleBar:SetPoint("TOP", 0, 8)
  793. frame.titleBar:SetWidth(350)
  794. frame.titleBar:SetHeight(45)
  795.  
  796. frame.title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  797. frame.title:SetPoint("TOP", 0, 0)
  798. frame.title:SetText("Shadowed Unit Frames")
  799.  
  800. frame.text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
  801. frame.text:SetText(table.concat(infoMessages[ShadowUF.db.global.infoID], "\n"))
  802. frame.text:SetPoint("TOPLEFT", 12, -22)
  803. frame.text:SetWidth(frame:GetWidth() - 20)
  804. frame.text:SetJustifyH("LEFT")
  805. frame:SetHeight(frame.text:GetHeight() + 70)
  806.  
  807. frame.hide = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
  808. frame.hide:SetText(L["Ok"])
  809. frame.hide:SetHeight(20)
  810. frame.hide:SetWidth(100)
  811. frame.hide:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 8, 8)
  812. frame.hide:SetScript("OnClick", function(f)
  813. f:GetParent():Hide()
  814. end)
  815. end
  816.  
  817. function ShadowUF:Print(msg)
  818. DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99Shadow UF|r: " .. msg)
  819. end
  820.  
  821. CONFIGMODE_CALLBACKS = CONFIGMODE_CALLBACKS or {}
  822. CONFIGMODE_CALLBACKS["Shadowed Unit Frames"] = function(mode)
  823. if( mode == "ON" ) then
  824. ShadowUF.db.profile.locked = false
  825. ShadowUF.modules.movers.isConfigModeSpec = true
  826. elseif( mode == "OFF" ) then
  827. ShadowUF.db.profile.locked = true
  828. end
  829.  
  830. ShadowUF.modules.movers:Update()
  831. end
  832.  
  833. SLASH_SHADOWEDUF1 = "/suf"
  834. SLASH_SHADOWEDUF2 = "/shadowuf"
  835. SLASH_SHADOWEDUF3 = "/shadoweduf"
  836. SLASH_SHADOWEDUF4 = "/shadowedunitframes"
  837. SlashCmdList["SHADOWEDUF"] = function(msg)
  838. msg = msg and string.lower(msg)
  839. if( msg and string.match(msg, "^profile (.+)") ) then
  840. local profile = string.match(msg, "^profile (.+)")
  841.  
  842. for id, name in pairs(ShadowUF.db:GetProfiles()) do
  843. if( string.lower(name) == profile ) then
  844. ShadowUF.db:SetProfile(name)
  845. ShadowUF:Print(string.format(L["Changed profile to %s."], name))
  846. return
  847. end
  848. end
  849.  
  850. ShadowUF:Print(string.format(L["Cannot find any profiles named \"%s\"."], profile))
  851. return
  852. end
  853.  
  854. local loaded, reason = LoadAddOn("ShadowedUF_Options")
  855. if( not ShadowUF.Config ) then
  856. DEFAULT_CHAT_FRAME:AddMessage(string.format(L["Failed to load ShadowedUF_Options, cannot open configuration. Error returned: %s"], reason and _G["ADDON_" .. reason] or ""))
  857. return
  858. end
  859.  
  860. ShadowUF.Config:Open()
  861. end
  862.  
  863. local frame = CreateFrame("Frame")
  864. frame:RegisterEvent("PLAYER_LOGIN")
  865. frame:RegisterEvent("ADDON_LOADED")
  866. frame:SetScript("OnEvent", function(self, event, addon)
  867. if( event == "PLAYER_LOGIN" ) then
  868. ShadowUF:OnInitialize()
  869. self:UnregisterEvent("PLAYER_LOGIN")
  870. elseif( event == "ADDON_LOADED" and ( addon == "Blizzard_ArenaUI" or addon == "Blizzard_CompactRaidFrames" ) ) then
  871. ShadowUF:HideBlizzardFrames()
  872. end
  873. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement