Advertisement
Guest User

Tooltip.lua

a guest
Apr 27th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.39 KB | None | 0 0
  1. local MODULE_NAME = "Tooltip"
  2. local ADDON_NAME = LibStub("AceAddon-3.0"):GetAddon("BasicUI")
  3. local MODULE = ADDON_NAME:NewModule(MODULE_NAME, "AceEvent-3.0")
  4. local L = setmetatable({}, { __index = function(t,k)
  5. local v = tostring(k)
  6. rawset(t, k, v)
  7. return v
  8. end })
  9.  
  10. ------------------------------------------------------------------------
  11. -- Module Database
  12. ------------------------------------------------------------------------
  13.  
  14. local BASIC_BORDER = [[Interface\Tooltips\UI-Tooltip-Border]]
  15. local BASIC_BACKGROUND = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]]
  16. local BASIC_STATUSBAR = [[Interface\TargetingFrame\UI-StatusBar]]
  17.  
  18. local db
  19. local defaults = {
  20. profile = {
  21. enable = true,
  22. fontSize = 15,
  23. fontOutline = true,
  24. disableFade = false, -- Can cause errors or a buggy tooltip!
  25. abbrevRealmNames = true,
  26. border = BASIC_BORDER,
  27. background = BASIC_BACKGROUND,
  28. statusbar = BASIC_STATUSBAR,
  29. hideInCombat = false, -- Hide unit frame tooltips during combat
  30. hideRealmText = true, -- Hide the coalesced/interactive realm text
  31. reactionBorderColor = true,
  32. itemqualityBorderColor = true,
  33.  
  34. showPlayerTitles = true,
  35. showPVPIcons = false, -- Show pvp icons instead of just a prefix
  36. showMouseoverTarget = true,
  37. showOnMouseover = false,
  38. showUnitRole = true,
  39. showItemLevel = true,
  40. showSpecializationIcon = false,
  41.  
  42. healthbar = {
  43. showHealthValue = true,
  44. showOutline = true,
  45. healthFormat = '$cur / $max', -- Possible: $cur, $max, $deficit, $perc, $smartperc, $smartcolorperc, $colorperc
  46. healthFullFormat = '$cur', -- if the tooltip unit has 100% hp
  47. textPos = "CENTER", -- Possible "TOP" "BOTTOM" "CENTER"
  48. reactionColoring = false,
  49. custom = {
  50. apply = false,
  51. color = { r = 1, g = 1, b = 0},
  52. },
  53. fontSize = 15,
  54. },
  55. }
  56. }
  57.  
  58. ------------------------------------------------------------------------
  59. -- Module Functions
  60. ------------------------------------------------------------------------
  61.  
  62. local classColor
  63.  
  64. function MODULE:OnInitialize()
  65. self.db = ADDON_NAME.db:RegisterNamespace(MODULE_NAME, defaults)
  66. db = self.db.profile
  67.  
  68. local _, class = UnitClass("player")
  69. classColor = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  70.  
  71. self:SetEnabledState(ADDON_NAME:GetModuleEnabled(MODULE_NAME))
  72. end
  73.  
  74.  
  75. function MODULE:OnEnable()
  76.  
  77. if db.enable ~= true then return end
  78.  
  79. --[[
  80.  
  81. All Credit for Tooltip.lua goes to Neal and ballagarba.
  82. Neav UI = http://www.wowinterface.com/downloads/info13981-NeavUI.html.
  83. Edited by Cokedriver.
  84.  
  85. ]]
  86.  
  87. local _G = _G
  88. local select = select
  89. local format = string.format
  90.  
  91. local UnitName = UnitName
  92. local UnitLevel = UnitLevel
  93. local UnitExists = UnitExists
  94. local UnitIsDead = UnitIsDead
  95. local UnitIsGhost = UnitIsGhost
  96. local UnitFactionGroup = UnitFactionGroup
  97. local UnitCreatureType = UnitCreatureType
  98. local GetQuestDifficultyColor = GetQuestDifficultyColor
  99.  
  100. local tankIcon = '|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:13:13:0:0:64:64:0:19:22:41|t'
  101. local healIcon = '|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:13:13:0:0:64:64:20:39:1:20|t'
  102. local damagerIcon = '|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:13:13:0:0:64:64:20:39:22:41|t'
  103.  
  104. local symbiosis = {
  105. gain = {
  106. ['DEATHKNIGHT'] = { ['DK_BLOOD'] = 113072, ['DK_FROST'] = 113516, ['DK_UNHOLY'] = 113516, },
  107. ['HUNTER'] = { ['HUNTER_BM'] = 113073, ['HUNTER_MM'] = 113073, ['HUNTER_SV'] = 113073, },
  108. ['MAGE'] = { ['MAGE_ARCANE'] = 113074, ['MAGE_FIRE'] = 113074, ['MAGE_FROST'] = 113074, },
  109. ['MONK'] = { ['MONK_BREW'] = 113306, ['MONK_MIST'] = 127361, ['MONK_WIND'] = 113275, },
  110. ['PALADIN'] = { ['PALADIN_HOLY'] = 113269, ['PALADIN_PROT'] = 122287, ['PALADIN_RET'] = 113075, },
  111. ['PRIEST'] = { ['PRIEST_DISC'] = 113506, ['PRIEST_HOLY'] = 113506, ['PRIEST_SHADOW'] = 113277, },
  112. ['ROGUE'] = { ['ROGUE_ASS'] = 113613, ['ROGUE_COMBAT'] = 113613, ['ROGUE_SUB'] = 113613, },
  113. ['SHAMAN'] = { ['SHAMAN_ELE'] = 113286, ['SHAMAN_ENHANCE'] = 113286, ['SHAMAN_RESTO'] = 113289, },
  114. ['WARLOCK'] = { ['WARLOCK_AFFLICTION'] = 113295, ['WARLOCK_DEMO'] = 113295, ['WARLOCK_DESTRO'] = 113295, },
  115. ['WARRIOR'] = { ['WARRIOR_ARMS'] = 122294, ['WARRIOR_FURY'] = 122294, ['WARRIOR_PROT'] = 122286, },
  116. },
  117. grant = {
  118. ['DEATHKNIGHT'] = { ['DRUID_BALANCE'] = 110570, ['DRUID_FERAL'] = 122282, ['DRUID_GUARDIAN'] = 122285, ['DRUID_RESTO'] = 110575, },
  119. ['HUNTER'] = { ['DRUID_BALANCE'] = 110588, ['DRUID_FERAL'] = 110597, ['DRUID_GUARDIAN'] = 110600, ['DRUID_RESTO'] = 19263, },
  120. ['MAGE'] = { ['DRUID_BALANCE'] = 110621, ['DRUID_FERAL'] = 110693, ['DRUID_GUARDIAN'] = 110694, ['DRUID_RESTO'] = 110696, },
  121. ['MONK'] = { ['DRUID_BALANCE'] = 126458, ['DRUID_FERAL'] = 128844, ['DRUID_GUARDIAN'] = 126453, ['DRUID_RESTO'] = 126456, },
  122. ['PALADIN'] = { ['DRUID_BALANCE'] = 110698, ['DRUID_FERAL'] = 110700, ['DRUID_GUARDIAN'] = 110701, ['DRUID_RESTO'] = 122288, },
  123. ['PRIEST'] = { ['DRUID_BALANCE'] = 110707, ['DRUID_FERAL'] = 110715, ['DRUID_GUARDIAN'] = 110717, ['DRUID_RESTO'] = 110718, },
  124. ['ROGUE'] = { ['DRUID_BALANCE'] = 110788, ['DRUID_FERAL'] = 110730, ['DRUID_GUARDIAN'] = 122289, ['DRUID_RESTO'] = 110791, },
  125. ['SHAMAN'] = { ['DRUID_BALANCE'] = 110802, ['DRUID_FERAL'] = 110807, ['DRUID_GUARDIAN'] = 110803, ['DRUID_RESTO'] = 110806, },
  126. ['WARLOCK'] = { ['DRUID_BALANCE'] = 122291, ['DRUID_FERAL'] = 110810, ['DRUID_GUARDIAN'] = 122290, ['DRUID_RESTO'] = 112970, },
  127. ['WARRIOR'] = { ['DRUID_BALANCE'] = 122292, ['DRUID_FERAL'] = 112997, ['DRUID_GUARDIAN'] = 113002, ['DRUID_RESTO'] = 113004, },
  128. }
  129. }
  130.  
  131. -- _G.TOOLTIP_DEFAULT_BACKGROUND_COLOR = {r = 0, g = 0, b = 0}
  132.  
  133. -- Some tooltip changes
  134.  
  135. if (db.fontOutline) then
  136. GameTooltipHeaderText:SetFont(ADDON_NAME.db.profile.media.fontBold, (db.fontSize + 2), 'THINOUTLINE')
  137. GameTooltipHeaderText:SetShadowOffset(0, 0)
  138.  
  139. GameTooltipText:SetFont(ADDON_NAME.db.profile.media.fontNormal, (db.fontSize), 'THINOUTLINE')
  140. GameTooltipText:SetShadowOffset(0, 0)
  141.  
  142. GameTooltipTextSmall:SetFont(ADDON_NAME.db.profile.media.fontNormal, (db.fontSize), 'THINOUTLINE')
  143. GameTooltipTextSmall:SetShadowOffset(0, 0)
  144. else
  145. GameTooltipHeaderText:SetFont(ADDON_NAME.db.profile.media.fontBold, (db.fontSize + 2))
  146. GameTooltipText:SetFont(ADDON_NAME.db.profile.media.fontNormal, (db.fontSize))
  147. GameTooltipTextSmall:SetFont(ADDON_NAME.db.profile.media.fontNormal, (db.fontSize))
  148. end
  149.  
  150. GameTooltipStatusBar:SetHeight(7)
  151. GameTooltipStatusBar:SetBackdrop({bgFile = 'Interface\\Buttons\\WHITE8x8'})
  152. GameTooltipStatusBar:SetBackdropColor(0, 1, 0, 0.3)
  153.  
  154. CUSTOM_FACTION_BAR_COLORS = {
  155. [1] = {r = 1, g = 0, b = 0},
  156. [2] = {r = 1, g = 0, b = 0},
  157. [3] = {r = 1, g = 1, b = 0},
  158. [4] = {r = 1, g = 1, b = 0},
  159. [5] = {r = 0, g = 1, b = 0},
  160. [6] = {r = 0, g = 1, b = 0},
  161. [7] = {r = 0, g = 1, b = 0},
  162. [8] = {r = 0, g = 1, b = 0},
  163. }
  164. function GameTooltip_UnitColor(unit)
  165. local r, g, b
  166.  
  167. if (UnitIsDead(unit) or UnitIsGhost(unit) or UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
  168. r = 0.5
  169. g = 0.5
  170. b = 0.5
  171. elseif (UnitIsPlayer(unit)) then
  172. if (UnitIsFriend(unit, 'player')) then
  173. local _, class = UnitClass(unit)
  174. r = RAID_CLASS_COLORS[class].r
  175. g = RAID_CLASS_COLORS[class].g
  176. b = RAID_CLASS_COLORS[class].b
  177. elseif (not UnitIsFriend(unit, 'player')) then
  178. r = 1
  179. g = 0
  180. b = 0
  181. end
  182. elseif (UnitPlayerControlled(unit)) then
  183. if (UnitCanAttack(unit, 'player')) then
  184. if (not UnitCanAttack('player', unit)) then
  185. r = 157/255
  186. g = 197/255
  187. b = 255/255
  188. else
  189. r = 1
  190. g = 0
  191. b = 0
  192. end
  193. elseif (UnitCanAttack('player', unit)) then
  194. r = 1
  195. g = 1
  196. b = 0
  197. elseif (UnitIsPVP(unit)) then
  198. r = 0
  199. g = 1
  200. b = 0
  201. else
  202. r = 157/255
  203. g = 197/255
  204. b = 255/255
  205. end
  206. else
  207. local reaction = UnitReaction(unit, 'player')
  208.  
  209. if (reaction) then
  210. r = CUSTOM_FACTION_BAR_COLORS[reaction].r
  211. g = CUSTOM_FACTION_BAR_COLORS[reaction].g
  212. b = CUSTOM_FACTION_BAR_COLORS[reaction].b
  213. else
  214. r = 157/255
  215. g = 197/255
  216. b = 255/255
  217. end
  218. end
  219.  
  220. return r, g, b
  221. end
  222.  
  223. UnitSelectionColor = GameTooltip_UnitColor
  224.  
  225. local function ApplyTooltipStyle(self)
  226. local bgsize, bsize
  227. if (self == ConsolidatedBuffsTooltip) then
  228. bgsize = 1
  229. bsize = 8
  230. elseif (self == FriendsTooltip) then
  231. FriendsTooltip:SetScale(1.1)
  232.  
  233. bgsize = 1
  234. bsize = 9
  235. else
  236. bgsize = 3
  237. bsize = 12
  238. end
  239.  
  240. self:SetBackdrop({
  241. bgFile = db.background, -- 'Interface\\Tooltips\\UI-Tooltip-Background',
  242. edgeFile = db.border,
  243. tile = true, tileSize = 16, edgeSize = 18,
  244.  
  245. insets = {
  246. left = bgsize, right = bgsize, top = bgsize, bottom = bgsize
  247. }
  248. })
  249. end
  250.  
  251. for _, tooltip in pairs({
  252. GameTooltip,
  253. ItemRefTooltip,
  254.  
  255. ShoppingTooltip1,
  256. ShoppingTooltip2,
  257. ShoppingTooltip3,
  258.  
  259. WorldMapTooltip,
  260.  
  261. DropDownList1MenuBackdrop,
  262. DropDownList2MenuBackdrop,
  263.  
  264. ConsolidatedBuffsTooltip,
  265.  
  266. ChatMenu,
  267. EmoteMenu,
  268. LanguageMenu,
  269. VoiceMacroMenu,
  270.  
  271. FriendsTooltip,
  272. }) do
  273. ApplyTooltipStyle(tooltip)
  274. end
  275.  
  276. -- Itemquaility border
  277.  
  278. if (db.itemqualityBorderColor) then
  279. for _, tooltip in pairs({
  280. GameTooltip,
  281. ItemRefTooltip,
  282.  
  283. ShoppingTooltip1,
  284. ShoppingTooltip2,
  285. ShoppingTooltip3,
  286. }) do
  287. tooltip:HookScript('OnTooltipSetItem', function(self)
  288. local name, item = self:GetItem()
  289. if (item) then
  290. local quality = select(3, GetItemInfo(item))
  291. if (quality) then
  292. local r, g, b = GetItemQualityColor(quality)
  293. self:SetBackdropBorderColor(r, g, b)
  294. end
  295. end
  296. end)
  297.  
  298. tooltip:HookScript('OnTooltipCleared', function(self)
  299. self:SetBackdropBorderColor(1, 1, 1)
  300. end)
  301. end
  302. end
  303.  
  304. -- Itemlvl (by Gsuz) - http://www.tukui.org/forums/topic.php?id=10151
  305.  
  306. local function GetItemLevel(unit)
  307. local total, item = 0, 0
  308. for i, v in pairs({
  309. 'Head',
  310. 'Neck',
  311. 'Shoulder',
  312. 'Back',
  313. 'Chest',
  314. 'Wrist',
  315. 'Hands',
  316. 'Waist',
  317. 'Legs',
  318. 'Feet',
  319. 'Finger0',
  320. 'Finger1',
  321. 'Trinket0',
  322. 'Trinket1',
  323. 'MainHand',
  324. 'SecondaryHand',
  325. }) do
  326. local slot = GetInventoryItemLink(unit, GetInventorySlotInfo(v..'Slot'))
  327. if (slot ~= nil) then
  328. item = item + 1
  329. total = total + select(4, GetItemInfo(slot))
  330. end
  331. end
  332.  
  333. if (item > 0) then
  334. return floor(total / item + 0.5)
  335. end
  336.  
  337. return 0
  338. end
  339.  
  340. -- Make sure we get a correct unit
  341.  
  342. local function GetRealUnit(self)
  343. if (GetMouseFocus() and not GetMouseFocus():GetAttribute('unit') and GetMouseFocus() ~= WorldFrame) then
  344. return select(2, self:GetUnit())
  345. elseif (GetMouseFocus() and GetMouseFocus():GetAttribute('unit')) then
  346. return GetMouseFocus():GetAttribute('unit')
  347. elseif (select(2, self:GetUnit())) then
  348. return select(2, self:GetUnit())
  349. else
  350. return 'mouseover'
  351. end
  352. end
  353.  
  354. local function GetFormattedUnitType(unit)
  355. local creaturetype = UnitCreatureType(unit)
  356. if (creaturetype) then
  357. return creaturetype
  358. else
  359. return ''
  360. end
  361. end
  362.  
  363. local function GetFormattedUnitClassification(unit)
  364. local class = UnitClassification(unit)
  365. if (class == 'worldboss') then
  366. return '|cffFF0000'..BOSS..'|r '
  367. elseif (class == 'rareelite') then
  368. return '|cffFF66CCRare|r |cffFFFF00'..ELITE..'|r '
  369. elseif (class == 'rare') then
  370. return '|cffFF66CCRare|r '
  371. elseif (class == 'elite') then
  372. return '|cffFFFF00'..ELITE..'|r '
  373. else
  374. return ''
  375. end
  376. end
  377.  
  378. local function GetFormattedUnitLevel(unit)
  379. local diff = GetQuestDifficultyColor(UnitLevel(unit))
  380. if (UnitLevel(unit) == -1) then
  381. return '|cffff0000??|r '
  382. elseif (UnitLevel(unit) == 0) then
  383. return '? '
  384. else
  385. return format('|cff%02x%02x%02x%s|r ', diff.r*255, diff.g*255, diff.b*255, UnitLevel(unit))
  386. end
  387. end
  388.  
  389. local function GetFormattedUnitClass(unit)
  390. local color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
  391. if (color) then
  392. return format(' |cff%02x%02x%02x%s|r', color.r*255, color.g*255, color.b*255, UnitClass(unit))
  393. end
  394. end
  395.  
  396. local function GetFormattedUnitString(unit, specIcon)
  397. if (UnitIsPlayer(unit)) then
  398. if (not UnitRace(unit)) then
  399. return nil
  400. end
  401. return GetFormattedUnitLevel(unit)..UnitRace(unit)..GetFormattedUnitClass(unit)..(db.showSpecializationIcon and specIcon or '')
  402. else
  403. return GetFormattedUnitLevel(unit)..GetFormattedUnitClassification(unit)..GetFormattedUnitType(unit)
  404. end
  405. end
  406.  
  407. local function GetUnitRoleString(unit)
  408. local role = UnitGroupRolesAssigned(unit)
  409. local roleList = nil
  410.  
  411. if (role == 'TANK') then
  412. roleList = ' '..tankIcon..' '..TANK
  413. elseif (role == 'HEALER') then
  414. roleList = ' '..healIcon..' '..HEALER
  415. elseif (role == 'DAMAGER') then
  416. roleList = ' '..damagerIcon..' '..DAMAGER
  417. end
  418.  
  419. return roleList
  420. end
  421.  
  422. -- Healthbar coloring funtion
  423.  
  424. local function SetHealthBarColor(unit)
  425. local r, g, b
  426. if (db.healthbar.custom.apply and not db.healthbar.reactionColoring) then
  427. r, g, b = db.healthbar.custom.color.r, db.healthbar.custom.color.g, db.healthbar.custom.color.b
  428. elseif (db.healthbar.reactionColoring and unit) then
  429. r, g, b = UnitSelectionColor(unit)
  430. else
  431. r, g, b = 0, 1, 0
  432. end
  433.  
  434. GameTooltipStatusBar:SetStatusBarColor(r, g, b)
  435. GameTooltipStatusBar:SetBackdropColor(r, g, b, 0.3)
  436. end
  437.  
  438. local function GetUnitRaidIcon(unit)
  439. local index = GetRaidTargetIndex(unit)
  440.  
  441. if (index) then
  442. if (UnitIsPVP(unit) and db.showPVPIcons) then
  443. return ICON_LIST[index]..'11|t'
  444. else
  445. return ICON_LIST[index]..'11|t '
  446. end
  447. else
  448. return ''
  449. end
  450. end
  451.  
  452. local function GetUnitPVPIcon(unit)
  453. local factionGroup = UnitFactionGroup(unit)
  454.  
  455. if (UnitIsPVPFreeForAll(unit)) then
  456. if (db.showPVPIcons) then
  457. return '|TInterface\\AddOns\\MyCore\\Media\\UI-PVP-FFA:12|t'
  458. else
  459. return '|cffFF0000# |r'
  460. end
  461. elseif (factionGroup and UnitIsPVP(unit)) then
  462. if (db.showPVPIcons) then
  463. return '|TInterface\\AddOns\\MyCore\\Media\\UI-PVP-'..factionGroup..':12|t'
  464. else
  465. return '|cff00FF00# |r'
  466. end
  467. else
  468. return ''
  469. end
  470. end
  471.  
  472. local function AddMouseoverTarget(self, unit)
  473. local unitTargetName = UnitName(unit..'target')
  474. local unitTargetClassColor = RAID_CLASS_COLORS[select(2, UnitClass(unit..'target'))] or { r = 1, g = 0, b = 1 }
  475. local unitTargetReactionColor = {
  476. r = select(1, UnitSelectionColor(unit..'target')),
  477. g = select(2, UnitSelectionColor(unit..'target')),
  478. b = select(3, UnitSelectionColor(unit..'target'))
  479. }
  480.  
  481. if (UnitExists(unit..'target')) then
  482. if (UnitName('player') == unitTargetName) then
  483. self:AddLine(format('|cffFFFF00Target|r: '..GetUnitRaidIcon(unit..'target')..'|cffff00ff%s|r', string.upper("** YOU **")), 1, 1, 1)
  484. else
  485. if (UnitIsPlayer(unit..'target')) then
  486. self:AddLine(format('|cffFFFF00Target|r: '..GetUnitRaidIcon(unit..'target')..'|cff%02x%02x%02x%s|r', unitTargetClassColor.r*255, unitTargetClassColor.g*255, unitTargetClassColor.b*255, unitTargetName:sub(1, 40)), 1, 1, 1)
  487. else
  488. self:AddLine(format('|cffFFFF00Target|r: '..GetUnitRaidIcon(unit..'target')..'|cff%02x%02x%02x%s|r', unitTargetReactionColor.r*255, unitTargetReactionColor.g*255, unitTargetReactionColor.b*255, unitTargetName:sub(1, 40)), 1, 1, 1)
  489. end
  490. end
  491. end
  492. end
  493.  
  494. GameTooltip.inspectCache = {}
  495.  
  496. GameTooltip:HookScript('OnTooltipSetUnit', function(self, ...)
  497. local unit = GetRealUnit(self)
  498.  
  499. if (db.hideInCombat and InCombatLockdown()) then
  500. self:Hide()
  501. return
  502. end
  503.  
  504. if (UnitExists(unit) and UnitName(unit) ~= UNKNOWN) then
  505.  
  506. local ilvl = 0
  507. local specIcon = ''
  508. local lastUpdate = 30
  509. for index, _ in pairs(self.inspectCache) do
  510. local inspectCache = self.inspectCache[index]
  511. if (inspectCache.GUID == UnitGUID(unit)) then
  512. ilvl = inspectCache.itemLevel or 0
  513. specIcon = inspectCache.specIcon or ''
  514. lastUpdate = inspectCache.lastUpdate and math.abs(inspectCache.lastUpdate - math.floor(GetTime())) or 30
  515. end
  516. end
  517.  
  518. -- Fetch inspect information (ilvl and spec)
  519.  
  520. if (unit and CanInspect(unit)) then
  521. if (not self.inspectRefresh and lastUpdate >= 30 and not self.blockInspectRequests) then
  522. if (not self.blockInspectRequests) then
  523. self.inspectRequestSent = true
  524. NotifyInspect(unit)
  525. end
  526. end
  527. end
  528.  
  529. self.inspectRefresh = false
  530.  
  531. local name, realm = UnitName(unit)
  532.  
  533. -- Hide player titles
  534.  
  535. if (db.showPlayerTitles) then
  536. if (UnitPVPName(unit)) then
  537. name = UnitPVPName(unit)
  538. end
  539. end
  540.  
  541. GameTooltipTextLeft1:SetText(name)
  542.  
  543. -- Color guildnames
  544.  
  545. if (GetGuildInfo(unit)) then
  546. if (GetGuildInfo(unit) == GetGuildInfo('player') and IsInGuild('player')) then
  547. GameTooltipTextLeft2:SetText('|cffFF66CC'..GameTooltipTextLeft2:GetText()..'|r')
  548. end
  549. end
  550.  
  551. -- Tooltip level text
  552.  
  553. for i = 2, GameTooltip:NumLines() do
  554. if (_G['GameTooltipTextLeft'..i]:GetText():find('^'..TOOLTIP_UNIT_LEVEL:gsub('%%s', '.+'))) then
  555. _G['GameTooltipTextLeft'..i]:SetText(GetFormattedUnitString(unit, specIcon))
  556. end
  557. end
  558.  
  559. -- Role text
  560.  
  561. if (db.showUnitRole) then
  562. self:AddLine(GetUnitRoleString(unit), 1, 1, 1)
  563. end
  564.  
  565. -- Mouse over target with raidicon support
  566.  
  567. if (db.showMouseoverTarget) then
  568. AddMouseoverTarget(self, unit)
  569. end
  570.  
  571. -- Pvp flag prefix
  572.  
  573. for i = 3, GameTooltip:NumLines() do
  574. if (_G['GameTooltipTextLeft'..i]:GetText():find(PVP_ENABLED)) then
  575. _G['GameTooltipTextLeft'..i]:SetText(nil)
  576. GameTooltipTextLeft1:SetText(GetUnitPVPIcon(unit)..GameTooltipTextLeft1:GetText())
  577. end
  578. end
  579.  
  580. -- Raid icon, want to see the raidicon on the left
  581.  
  582. GameTooltipTextLeft1:SetText(GetUnitRaidIcon(unit)..GameTooltipTextLeft1:GetText())
  583.  
  584. -- Afk and dnd prefix
  585.  
  586. if (UnitIsAFK(unit)) then
  587. self:AppendText('|cff00ff00 <AFK>|r')
  588. elseif (UnitIsDND(unit)) then
  589. self:AppendText('|cff00ff00 <DND>|r')
  590. end
  591.  
  592. -- Player realm names
  593.  
  594. if (realm and realm ~= '') then
  595. if (db.abbrevRealmNames) then
  596. self:AppendText(' (*)')
  597. else
  598. self:AppendText(' - '..realm)
  599. end
  600. end
  601.  
  602. -- Move the healthbar inside the tooltip
  603.  
  604. self:AddLine(' ')
  605. GameTooltipStatusBar:ClearAllPoints()
  606. GameTooltipStatusBar:SetPoint('LEFT', self:GetName()..'TextLeft'..self:NumLines(), 1, -3)
  607. GameTooltipStatusBar:SetPoint('RIGHT', self, -10, 0)
  608.  
  609. -- Border coloring
  610.  
  611. if (db.reactionBorderColor) then
  612. local r, g, b = UnitSelectionColor(unit)
  613. self:SetBackdropBorderColor(r, g, b)
  614. end
  615.  
  616. -- Dead or ghost recoloring
  617.  
  618. if (UnitIsDead(unit) or UnitIsGhost(unit)) then
  619. GameTooltipStatusBar:SetBackdropColor(0.5, 0.5, 0.5, 0.3)
  620. else
  621. if (not db.healthbar.custom.apply and not db.healthbar.reactionColoring) then
  622. GameTooltipStatusBar:SetBackdropColor(27/255, 243/255, 27/255, 0.3)
  623. else
  624. SetHealthBarColor(unit)
  625. end
  626. end
  627.  
  628. -- Custom healthbar coloring
  629.  
  630. if (db.healthbar.reactionColoring or db.healthbar.custom.apply) then
  631. GameTooltipStatusBar:HookScript('OnValueChanged', function()
  632. SetHealthBarColor(unit)
  633. end)
  634. end
  635.  
  636. -- Show player item lvl
  637.  
  638. if (db.showItemLevel and ilvl > 1) then
  639. GameTooltip:AddLine(STAT_AVERAGE_ITEM_LEVEL .. ': ' .. '|cffFFFFFF'..ilvl..'|r')
  640. end
  641.  
  642. -- Symbiosis
  643.  
  644. if (UnitIsPlayer(unit) and not UnitIsEnemy(unit, 'player')) then
  645. local hasSymbiosisBuff = false
  646. for i = 1, 40 do
  647. if select(11, UnitAura(unit, i, 'HELPFUL')) == 110309 then
  648. hasSymbiosisBuff = true
  649. break
  650. end
  651. end
  652.  
  653. local _, playerClass = UnitClass('player')
  654. local _, unitClass = UnitClass(unit)
  655. local spec = SPEC_CORE_ABILITY_TEXT[GetSpecializationInfo(GetSpecialization() or 1)]
  656. local spellID = (playerClass == 'DRUID' and unitClass ~= 'DRUID') and symbiosis.grant[unitClass][spec] or (playerClass ~= 'DRUID' and unitClass == 'DRUID') and symbiosis.grant[playerClass][spec]
  657. local name, _, icon = GetSpellInfo(spellID)
  658.  
  659. if (hasSymbiosisBuff) then
  660. GameTooltip:AddLine(' ')
  661. GameTooltip:AddLine('|cff3eea23'..GetSpellInfo(110309)..' already buffed|r')
  662. end
  663.  
  664. if (icon) then
  665. GameTooltip:AddLine(' ')
  666. GameTooltip:AddDoubleLine('|T'..icon..':16:16:0:0:64:64:4:60:4:60|t '..name, '|cff3eea23'..GetSpellInfo(110309)..'|r')
  667. end
  668. end
  669. end
  670. end)
  671.  
  672. GameTooltip:HookScript('OnTooltipCleared', function(self)
  673. GameTooltipStatusBar:ClearAllPoints()
  674. GameTooltipStatusBar:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0.5, 3)
  675. GameTooltipStatusBar:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', -1, 3)
  676. GameTooltipStatusBar:SetBackdropColor(0, 1, 0, 0.3)
  677.  
  678. if (db.reactionBorderColor) then
  679. self:SetBackdropColor(1, 1, 1)
  680. end
  681. end)
  682.  
  683.  
  684. -- Hide coalesced/interactive realm information
  685.  
  686. if (db.hideRealmText) then
  687. local COALESCED_REALM_TOOLTIP1 = string.split(FOREIGN_SERVER_LABEL, COALESCED_REALM_TOOLTIP)
  688. local INTERACTIVE_REALM_TOOLTIP1 = string.split(INTERACTIVE_SERVER_LABEL, INTERACTIVE_REALM_TOOLTIP)
  689. -- Dirty checking of the coalesced realm text because it's added
  690. -- after the initial OnShow
  691. GameTooltip:HookScript('OnUpdate', function(self)
  692. for i = 3, self:NumLines() do
  693. local row = _G['GameTooltipTextLeft'..i]
  694. local rowText = row:GetText()
  695.  
  696. if (rowText) then
  697. if (rowText:find(COALESCED_REALM_TOOLTIP1) or rowText:find(INTERACTIVE_REALM_TOOLTIP1)) then
  698. row:SetText(nil)
  699. row:Hide()
  700.  
  701. local previousRow = _G['GameTooltipTextLeft'..(i - 1)]
  702. previousRow:SetText(nil)
  703. previousRow:Hide()
  704.  
  705. self:Show()
  706. end
  707. end
  708. end
  709. end)
  710. end
  711.  
  712. hooksecurefunc('GameTooltip_SetDefaultAnchor', function(self, parent)
  713. if (db.showOnMouseover) then
  714. self:SetOwner(parent, 'ANCHOR_CURSOR')
  715. end
  716. end)
  717.  
  718.  
  719. GameTooltip:RegisterEvent('INSPECT_READY')
  720. GameTooltip:SetScript('OnEvent', function(self, event, GUID)
  721. if (not self:IsShown()) then
  722. return
  723. end
  724.  
  725. local _, unit = self:GetUnit()
  726.  
  727. if (not unit) then
  728. return
  729. end
  730.  
  731. if (self.blockInspectRequests) then
  732. self.inspectRequestSent = false
  733. end
  734.  
  735. if (UnitGUID(unit) ~= GUID or not self.inspectRequestSent) then
  736. if (not self.blockInspectRequests) then
  737. ClearInspectPlayer()
  738. end
  739. return
  740. end
  741.  
  742. local _, _, _, icon = GetSpecializationInfoByID(GetInspectSpecialization(unit))
  743. local ilvl = GetItemLevel(unit)
  744. local now = GetTime()
  745.  
  746. local matchFound
  747. for index, _ in pairs(self.inspectCache) do
  748. local inspectCache = self.inspectCache[index]
  749. if (inspectCache.GUID == GUID) then
  750. inspectCache.itemLevel = ilvl
  751. inspectCache.specIcon = icon and ' |T'..icon..':0|t' or ''
  752. inspectCache.lastUpdate = math.floor(now)
  753. matchFound = true
  754. end
  755. end
  756.  
  757. if not matchFound then
  758. local GUIDInfo = {
  759. ['GUID'] = GUID,
  760. ['itemLevel'] = ilvl,
  761. ['specIcon'] = icon and ' |T'..icon..':0|t' or '',
  762. ['lastUpdate'] = math.floor(now)
  763. }
  764. table.insert(self.inspectCache, GUIDInfo)
  765. end
  766.  
  767. if (#self.inspectCache > 30) then
  768. table.remove(self.inspectCache, 1)
  769. end
  770.  
  771. self.inspectRefresh = true
  772. GameTooltip:SetUnit('mouseover')
  773.  
  774. if (not self.blockInspectRequests) then
  775. ClearInspectPlayer()
  776. end
  777. self.inspectRequestSent = false
  778. end)
  779.  
  780. local f = CreateFrame('Frame')
  781. f:RegisterEvent('ADDON_LOADED')
  782. f:SetScript('OnEvent', function(self, event)
  783. if IsAddOnLoaded('Blizzard_InspectUI') then
  784. hooksecurefunc('InspectFrame_Show', function(unit)
  785. GameTooltip.blockInspectRequests = true
  786. end)
  787.  
  788. InspectFrame:HookScript('OnHide', function()
  789. GameTooltip.blockInspectRequests = false
  790. end)
  791.  
  792. self:UnregisterEvent('ADDON_LOADED')
  793. end
  794. end)
  795.  
  796. local select = select
  797. local tonumber = tonumber
  798.  
  799. local modf = math.modf
  800. local gsub = string.gsub
  801. local format = string.format
  802.  
  803. local bar = GameTooltipStatusBar
  804. bar.Text = bar:CreateFontString(nil, 'OVERLAY')
  805. bar.Text:SetPoint('CENTER', bar, db.healthbar.textPos, 0, 1)
  806.  
  807. if (db.healthbar.showOutline) then
  808. bar.Text:SetFont(ADDON_NAME.db.profile.media.fontNormal, db.healthbar.fontSize, 'THINOUTLINE')
  809. bar.Text:SetShadowOffset(0, 0)
  810. else
  811. bar.Text:SetFont(ADDON_NAME.db.profile.media.fontNormal, db.healthbar.fontSize)
  812. bar.Text:SetShadowOffset(1, -1)
  813. end
  814.  
  815. local function ColorGradient(perc, ...)
  816. if (perc >= 1) then
  817. local r, g, b = select(select('#', ...) - 2, ...)
  818. return r, g, b
  819. elseif (perc <= 0) then
  820. local r, g, b = ...
  821. return r, g, b
  822. end
  823.  
  824. local num = select('#', ...) / 3
  825.  
  826. local segment, relperc = modf(perc*(num-1))
  827. local r1, g1, b1, r2, g2, b2 = select((segment*3)+1, ...)
  828.  
  829. return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc
  830. end
  831.  
  832. local function FormatValue(value)
  833. if (value >= 1e6) then
  834. return tonumber(format('%.1f', value/1e6))..'m'
  835. elseif (value >= 1e3) then
  836. return tonumber(format('%.1f', value/1e3))..'k'
  837. else
  838. return value
  839. end
  840. end
  841.  
  842. local function DeficitValue(value)
  843. if (value == 0) then
  844. return ''
  845. else
  846. return '-'..FormatValue(value)
  847. end
  848. end
  849.  
  850. local function GetHealthTag(text, cur, max)
  851. local perc = format('%d', (cur/max)*100)
  852.  
  853. if (max == 1) then
  854. return perc
  855. end
  856.  
  857. local r, g, b = ColorGradient(cur/max, 1, 0, 0, 1, 1, 0, 0, 1, 0)
  858. text = gsub(text, '$cur', format('%s', FormatValue(cur)))
  859. text = gsub(text, '$max', format('%s', FormatValue(max)))
  860. text = gsub(text, '$deficit', format('%s', DeficitValue(max-cur)))
  861. text = gsub(text, '$perc', format('%d', perc)..'%%')
  862. text = gsub(text, '$smartperc', format('%d', perc))
  863. text = gsub(text, '$smartcolorperc', format('|cff%02x%02x%02x%d|r', r*255, g*255, b*255, perc))
  864. text = gsub(text, '$colorperc', format('|cff%02x%02x%02x%d', r*255, g*255, b*255, perc)..'%%|r')
  865.  
  866. return text
  867. end
  868.  
  869. GameTooltipStatusBar:HookScript('OnValueChanged', function(self, value)
  870. if (self.Text) then
  871. self.Text:SetText('')
  872. end
  873.  
  874. if (not value) then
  875. return
  876. end
  877.  
  878. local min, max = self:GetMinMaxValues()
  879.  
  880. if ((value < min) or (value > max) or (value == 0) or (value == 1)) then
  881. return
  882. end
  883.  
  884. if (not self.Text) then
  885. CreateHealthString(self)
  886. end
  887.  
  888. local fullString = GetHealthTag(db.healthbar.healthFullFormat, value, max)
  889. local normalString = GetHealthTag(db.healthbar.healthFormat, value, max)
  890.  
  891. local perc = (value/max)*100
  892. if (perc >= 100 and currentValue ~= 1) then
  893. self.Text:SetText(fullString)
  894. elseif (perc < 100 and currentValue ~= 1) then
  895. self.Text:SetText(normalString)
  896. else
  897. self.Text:SetText('')
  898. end
  899. end)
  900.  
  901. local watchFrame = _G['WatchFrame']
  902. watchFrame:SetHeight(400)
  903. watchFrame:ClearAllPoints()
  904. watchFrame.ClearAllPoints = function() end
  905. watchFrame:SetPoint('TOPRIGHT', UIParent, -100, -250)
  906. watchFrame:SetClampedToScreen(true)
  907. watchFrame:SetMovable(true)
  908. watchFrame:SetUserPlaced(true)
  909. watchFrame.SetPoint = function() end
  910. watchFrame:SetScale(1.01)
  911.  
  912. local watchHead = _G['WatchFrameHeader']
  913. watchHead:EnableMouse(true)
  914. watchHead:RegisterForDrag('LeftButton')
  915. watchHead:SetHitRectInsets(-15, 0, -5, -5)
  916. watchHead:SetScript('OnDragStart', function(self)
  917. if (IsShiftKeyDown()) then
  918. self:GetParent():StartMoving()
  919. end
  920. end)
  921.  
  922. watchHead:SetScript('OnDragStop', function(self)
  923. self:GetParent():StopMovingOrSizing()
  924. end)
  925.  
  926. watchHead:SetScript('OnEnter', function()
  927. if InCombatLockdown() then return end
  928. GameTooltip:SetOwner(watchHead, "ANCHOR_TOPLEFT")
  929. GameTooltip:ClearLines()
  930. GameTooltip:AddLine("|cffeda55fShift+Left Click|r to Drag")
  931. GameTooltip:Show()
  932. end)
  933. watchHead:SetScript('OnLeave', function() GameTooltip:Hide() end)
  934.  
  935. local watchHeadTitle = _G['WatchFrameTitle']
  936. watchHeadTitle:SetFont(ADDON_NAME.db.profile.media.fontBold, 15)
  937. if ADDON_NAME.db.profile.media.classcolor == true then
  938. watchHeadTitle:SetTextColor(classColor.r, classColor.g, classColor.b)
  939. end
  940. end
  941.  
  942.  
  943. ------------------------------------------------------------------------
  944. -- Module Options
  945. ------------------------------------------------------------------------
  946.  
  947. local options
  948. function MODULE:GetOptions()
  949. if options then
  950. return options
  951. end
  952.  
  953. local function isModuleDisabled()
  954. return not ADDON_NAME:GetModuleEnabled(MODULE_NAME)
  955. end
  956.  
  957. local regions = {
  958. ['BOTTOM'] = L['Bottom'],
  959. ['BOTTOMLEFT'] = L['Bottom Left'],
  960. ['BOTTOMRIGHT'] = L['Bottom Right'],
  961. ['CENTER'] = L['Center'],
  962. ['LEFT'] = L['Left'],
  963. ['RIGHT'] = L['Right'],
  964. ['TOP'] = L['Top'],
  965. ['TOPLEFT'] = L['Top Left'],
  966. ['TOPRIGHT'] = L['Top Right'],
  967. }
  968.  
  969. options = {
  970. type = "group",
  971. name = L[MODULE_NAME],
  972. get = function(info) return db[ info[#info] ] end,
  973. set = function(info, value) db[ info[#info] ] = value; end,
  974. disabled = isModuleDisabled(),
  975. args = {
  976. ---------------------------
  977. --Option Type Seperators
  978. sep1 = {
  979. type = "description",
  980. order = 2,
  981. name = " ",
  982. },
  983. sep2 = {
  984. type = "description",
  985. order = 3,
  986. name = " ",
  987. },
  988. sep3 = {
  989. type = "description",
  990. order = 4,
  991. name = " ",
  992. },
  993. sep4 = {
  994. type = "description",
  995. order = 5,
  996. name = " ",
  997. },
  998. ---------------------------
  999. reloadUI = {
  1000. type = "execute",
  1001. name = "Reload UI",
  1002. desc = " ",
  1003. order = 0,
  1004. func = function()
  1005. ReloadUI()
  1006. end,
  1007. },
  1008. Text = {
  1009. type = "description",
  1010. order = 0,
  1011. name = "When changes are made a reload of the UI is needed.",
  1012. width = "full",
  1013. },
  1014. Text1 = {
  1015. type = "description",
  1016. order = 1,
  1017. name = " ",
  1018. width = "full",
  1019. },
  1020. enable = {
  1021. type = "toggle",
  1022. order = 1,
  1023. name = L["Enable Tooltip Module"],
  1024. width = "full",
  1025. },
  1026. disableFade = {
  1027. type = "toggle",
  1028. order = 2,
  1029. name = L["Disable Fade"],
  1030. desc = L["Disables Tooltip Fade."],
  1031. disabled = function() return isModuleDisabled() or not db.enable end,
  1032. },
  1033. reactionBorderColor = {
  1034. type = "toggle",
  1035. order = 2,
  1036. name = L["Reaction Border Color"],
  1037. desc = L["Colors the borders match targets classcolors."],
  1038. disabled = function() return isModuleDisabled() or not db.enable end,
  1039. },
  1040. itemqualityBorderColor = {
  1041. type = "toggle",
  1042. order = 2,
  1043. name = L["Item Quality Border Color"],
  1044. desc = L["Colors the border of the tooltip to match the items quality."],
  1045. disabled = function() return isModuleDisabled() or not db.enable end,
  1046. },
  1047. showPlayerTitles = {
  1048. type = "toggle",
  1049. order = 2,
  1050. name = L["Player Titles"],
  1051. desc = L["Shows players title in tooltip."],
  1052. disabled = function() return isModuleDisabled() or not db.enable end,
  1053. },
  1054. showPVPIcons = {
  1055. type = "toggle",
  1056. order = 2,
  1057. name = L["PVP Icons"],
  1058. desc = L["Shows PvP Icons in tooltip."],
  1059. disabled = function() return isModuleDisabled() or not db.enable end,
  1060. },
  1061. showUnitRole = {
  1062. type = "toggle",
  1063. order = 2,
  1064. name = L["Show Units Role"],
  1065. desc = L["Shows Units Role in tooltip."],
  1066. disabled = function() return isModuleDisabled() or not db.enable end,
  1067. },
  1068. abbrevRealmNames = {
  1069. type = "toggle",
  1070. order = 2,
  1071. name = L["Abberviate Realm Names"],
  1072. desc = L["Abberviates Players Realm Name."],
  1073. disabled = function() return isModuleDisabled() or not db.enable end,
  1074. },
  1075. showMouseoverTarget = {
  1076. type = "toggle",
  1077. order = 2,
  1078. name = L["Mouseover Target"],
  1079. desc = L["Shows mouseover target."],
  1080. disabled = function() return isModuleDisabled() or not db.enable end,
  1081. },
  1082. showItemLevel = {
  1083. type = "toggle",
  1084. order = 2,
  1085. name = L["Item Level"],
  1086. desc = L["Shows targets average item level."],
  1087. disabled = function() return isModuleDisabled() or not db.enable end,
  1088. },
  1089. hideInCombat = {
  1090. type = "toggle",
  1091. order = 2,
  1092. name = L["Hide in Combat"],
  1093. desc = L["Hides unit frame tooltips during combat."],
  1094. disabled = function() return isModuleDisabled() or not db.enable end,
  1095. },
  1096. hideRealmText = {
  1097. type = "toggle",
  1098. order = 2,
  1099. name = L["Hide Realm Text"],
  1100. desc = L["Hide the coalesced/interactive realm text."],
  1101. disabled = function() return isModuleDisabled() or not db.enable end,
  1102. },
  1103. healthbar = {
  1104. type = "group",
  1105. order = 6,
  1106. name = L["Healthbar"],
  1107. desc = L["Players Healthbar Options."],
  1108. guiInline = true,
  1109. disabled = function() return isModuleDisabled() or not db.enable end,
  1110. get = function(info) return db.healthbar[ info[#info] ] end,
  1111. set = function(info, value) db.healthbar[ info[#info] ] = value; end,
  1112. args = {
  1113. ---------------------------
  1114. --Option Type Seperators
  1115. sep1 = {
  1116. type = "description",
  1117. order = 2,
  1118. name = " ",
  1119. },
  1120. sep2 = {
  1121. type = "description",
  1122. order = 3,
  1123. name = " ",
  1124. },
  1125. sep3 = {
  1126. type = "description",
  1127. order = 4,
  1128. name = " ",
  1129. },
  1130. sep4 = {
  1131. type = "description",
  1132. order = 5,
  1133. name = " ",
  1134. },
  1135. ---------------------------
  1136. showHealthValue = {
  1137. type = "toggle",
  1138. order = 2,
  1139. name = L["Health Value"],
  1140. desc = L["Shows health value over healthbar."],
  1141. disabled = function() return isModuleDisabled() or not db.enable end,
  1142. },
  1143. showOutline = {
  1144. type = "toggle",
  1145. order = 2,
  1146. name = L["Font Outline"],
  1147. desc = L["Adds a font outline to health value."],
  1148. disabled = function() return isModuleDisabled() or not db.enable end,
  1149. },
  1150. reactionColoring = {
  1151. type = "toggle",
  1152. order = 2,
  1153. name = L["Reaction Coloring"],
  1154. desc = L["Change healthbar color to targets classcolor. (Overides Custom Color)"],
  1155. disabled = function() return isModuleDisabled() or not db.enable end,
  1156. },
  1157. custom = {
  1158. type = "group",
  1159. order = 6,
  1160. name = L["Custom"],
  1161. desc = L["Custom Coloring"],
  1162. childGroups = "tree",
  1163. disabled = function() return isModuleDisabled() or not db.enable end,
  1164. get = function(info) return db.healthbar.custom[ info[#info] ] end,
  1165. set = function(info, value) db.healthbar.custom[ info[#info] ] = value; end,
  1166. args = {
  1167. ---------------------------
  1168. --Option Type Seperators
  1169. sep1 = {
  1170. type = "description",
  1171. name = " ",
  1172. order = 2,
  1173. },
  1174. sep2 = {
  1175. type = "description",
  1176. name = " ",
  1177. order = 3,
  1178. },
  1179. sep3 = {
  1180. type = "description",
  1181. name = " ",
  1182. order = 4,
  1183. },
  1184. sep4 = {
  1185. type = "description",
  1186. name = " ",
  1187. order = 5,
  1188. },
  1189. ---------------------------
  1190. apply = {
  1191. type = "toggle",
  1192. order = 2,
  1193. name = L["Apply Custom Color"],
  1194. desc = L["Use the Custom Color you have chosen."],
  1195. disabled = function() return isModuleDisabled() or not db.enable end,
  1196. },
  1197. color = {
  1198. type = "color",
  1199. order = 4,
  1200. name = L["Custom Color"],
  1201. desc = L["Picks a Custom Color for the tooltip border."],
  1202. hasAlpha = false,
  1203. disabled = function() return isModuleDisabled() or not db.healthbar.custom.apply or not db.enable end,
  1204. get = function(info)
  1205. local hb = db.healthbar.custom[ info[#info] ]
  1206. return hb.r, hb.g, hb.b
  1207. end,
  1208. set = function(info, r, g, b)
  1209. db.healthbar.custom[ info[#info] ] = {}
  1210. local hb = db.healthbar.custom[ info[#info] ]
  1211. hb.r, hb.g, hb.b = r, g, b
  1212. end,
  1213. },
  1214. },
  1215. },
  1216. textPos = {
  1217. type = "select",
  1218. order = 3,
  1219. name = L["Text Position"],
  1220. desc = L["Health Value Position."],
  1221. disabled = function() return isModuleDisabled() or not db.enable end,
  1222. values = regions,
  1223. },
  1224. fontSize= {
  1225. type = "range",
  1226. order = 5,
  1227. name = L["Font Size"],
  1228. desc = L["Controls the healthbar value font size."],
  1229. min = 8, max = 25, step = 1,
  1230. disabled = function() return isModuleDisabled() or not db.enable end,
  1231. },
  1232. },
  1233. },
  1234. },
  1235. }
  1236. return options
  1237. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement