Advertisement
Guest User

Castbars.lua

a guest
Apr 27th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.34 KB | None | 0 0
  1. local MODULE_NAME = "Castbars"
  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. border = BASIC_BORDER,
  23. background = BASIC_BACKGROUND,
  24. statusbar = BASIC_STATUSBAR,
  25.  
  26.  
  27. CastingBarFrame = {
  28. enable = true,
  29. fontSize = 18,
  30. textPosition = "LEFT",
  31. enableLag = true,
  32. enableTimer = true,
  33. selfAnchor = "BOTTOM",
  34. relAnchor = "BOTTOM",
  35. offSetX = 0,
  36. offSetY = 175,
  37. },
  38. TargetFrameSpellBar = {
  39. enable = false,
  40. fontSize = 18,
  41. textPosition = "CENTER",
  42. enableLag = true,
  43. enableTimer = true,
  44. selfAnchor = "TOP",
  45. relAnchor = "TOP",
  46. offSetX = 0,
  47. offSetY = -250,
  48. },
  49. FocusFrameSpellBar = {
  50. enable = true,
  51. fontSize = 18,
  52. textPosition = "CENTER",
  53. enableLag = true,
  54. enableTimer = true,
  55. selfAnchor = "TOP",
  56. relAnchor = "TOP",
  57. offSetX = 0,
  58. offSetY = -165,
  59. },
  60. MirrorTimer1 = {
  61. enable = true,
  62. fontSize = 18,
  63. enableTimer = true,
  64. selfAnchor = "TOP",
  65. relAnchor = "TOP",
  66. offSetX = 0,
  67. offSetY = -75,
  68. },
  69. PetCastingBarFrame = {
  70. enable = true,
  71. fontSize = 18,
  72. textPosition = "CENTER",
  73. enableTimer = true,
  74. selfAnchor = "BOTTOM",
  75. relAnchor = "BOTTOM",
  76. offSetX = 0,
  77. offSetY = 200,
  78. },
  79. },
  80. }
  81.  
  82. ------------------------------------------------------------------------
  83. -- Module Functions
  84. ------------------------------------------------------------------------
  85.  
  86. function MODULE:OnInitialize()
  87. self.db = ADDON_NAME.db:RegisterNamespace(MODULE_NAME, defaults)
  88. db = self.db.profile
  89.  
  90. self:SetEnabledState(ADDON_NAME:GetModuleEnabled(MODULE_NAME))
  91. end
  92.  
  93. function MODULE:OnEnable()
  94.  
  95. local db = self.db.profile
  96.  
  97. if db.enable ~= true then return end
  98.  
  99. local ccolor = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
  100. local m = 768/string.match(GetCVar("gxResolution"), "%d+x(%d+)")/min(2, max(.64, 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")));
  101. local scale = function(v) return m * floor(v/m+.5) end;
  102.  
  103. --[[
  104.  
  105. All Credit for Castbar.lua goes to thek.
  106. thek: Castbar = http://www.wowinterface.com/downloads/info11334-thekCastbar.html.
  107. Edited by Cokedriver.
  108.  
  109. ]]
  110.  
  111. local d = {};
  112. local find = string.find;
  113. local floor = math.floor;
  114.  
  115. local function Set(a, k)
  116. a:SetFrameLevel(_G[k]:GetFrameLevel() - 1);
  117. if find(k, "MirrorTimer") then
  118. _G[k.."StatusBar"]:SetStatusBarColor(ccolor.r, ccolor.g, ccolor.b);
  119. _G[k.."StatusBar"]:SetWidth(240);
  120. _G[k.."StatusBar"]:SetHeight(24);
  121. _G[k]:ClearAllPoints();
  122. _G[k]:SetPoint("TOPLEFT", a, "TOPLEFT", scale(_G[k].d.x), -scale(_G[k].d.y));
  123. _G[k.."StatusBar"]:ClearAllPoints();
  124. _G[k.."StatusBar"]:SetPoint("TOPLEFT", a, "TOPLEFT", scale(5), -scale(_G[k].d.y));
  125. else
  126. _G[k]:SetStatusBarColor(ccolor.r, ccolor.g, ccolor.b);
  127. _G[k]:SetWidth(240);
  128. _G[k]:SetHeight(24);
  129. _G[k]:ClearAllPoints();
  130. _G[k]:SetPoint("TOPLEFT", a, "TOPLEFT", scale(_G[k].d.x), -scale(_G[k].d.y))
  131. end;
  132. if db[k].enableLag then
  133. local d, u, l = GetNetStats();
  134. local min, max = _G[k]:GetMinMaxValues();
  135. local lv = ( l / 1000 ) / ( max - min );
  136. if ( lv < 0 ) then lv = 0; elseif ( lv > 1 ) then lv = 1 end;
  137. if ( _G[k].channeling ) then
  138. _G[k].lag:ClearAllPoints();
  139. _G[k].lag:SetPoint("LEFT", _G[k], "LEFT", 0, 0);
  140. else
  141. _G[k].lag:ClearAllPoints();
  142. _G[k].lag:SetPoint("RIGHT", _G[k], "RIGHT", 0, 0);
  143. end;
  144. _G[k].lag:SetWidth(_G[k]:GetWidth() * lv);
  145. end
  146. end;
  147.  
  148. if db["TargetFrameSpellBar"].enable then
  149. function Target_Spellbar_AdjustPosition()
  150. Set(_G["TargetFrameSpellBar"].df, "TargetFrameSpellBar");
  151. end;
  152. end;
  153. if db["FocusFrameSpellBar"].enable then
  154. function Focus_Spellbar_AdjustPosition()
  155. Set(_G["FocusFrameSpellBar"].df, "FocusFrameSpellBar");
  156. end;
  157. end
  158.  
  159. for k, _ in pairs(db) do
  160. if (k ~="enable" and db[k].enable) then
  161. local a = CreateFrame("Frame", "Castbar"..k, UIParent);
  162. d.w, d.h, d.x, d.y = nil, nil, nil, nil;
  163.  
  164. _G[k.."Border"]:SetTexture("");
  165. _G[k.."Text"]:ClearAllPoints("");
  166. _G[k.."Text"]:SetFont(ADDON_NAME.db.profile.media.fontNormal, db[k].fontSize, "");
  167.  
  168. if find(k, "MirrorTimer") then
  169. d.w = 240 + (5 * 2);
  170. d.h = 24 + (5 * 2);
  171. d.x = 5;
  172. d.y = 5;
  173.  
  174. _G[k.."Text"]:SetPoint("LEFT", k, -10, 2);
  175. _G[k.."StatusBar"]:SetStatusBarTexture(db.statusbar);
  176. else
  177. d.w = 240 + 24 + (5 * 2) + 5;
  178. d.h = 24 + (5 * 2);
  179. d.x = 24 + 5 + 5;
  180. d.y = 5;
  181.  
  182. _G[k.."Text"]:SetPoint(db[k].textPosition, k, 0, 0);
  183. _G[k]:SetStatusBarTexture(db.statusbar);
  184. _G[k.."Flash"].Show = _G[k.."Flash"].Hide;
  185. _G[k.."Spark"].Show = _G[k.."Spark"].Hide;
  186.  
  187. if _G[k.."BorderShield"] then
  188. _G[k.."BorderShield"].Show = _G[k.."BorderShield"].Hide;
  189. end;
  190.  
  191. if _G[k.."Icon"] then
  192. _G[k.."Icon"]:Show();
  193. _G[k.."Icon"]:ClearAllPoints();
  194. _G[k.."Icon"]:SetPoint("LEFT", _G[k], -27, 0);
  195. _G[k.."Icon"]:SetWidth(23);
  196. _G[k.."Icon"]:SetHeight(23);
  197. _G[k.."Icon"]:SetTexCoord(.08, .92, .08, .92);
  198. end;
  199.  
  200. _G[k]:HookScript("OnSizeChanged", function()
  201. _G[k].reset = true;
  202. end);
  203. _G[k]:HookScript("OnValueChanged", function(self)
  204. if self.reset and not self.reseting then
  205. self.reseting = true
  206. Set(a, k)
  207. self.reseting = nil
  208. self.reset = nil
  209. end
  210. end)
  211.  
  212. if db[k].enableLag then
  213. _G[k].lag = _G[k]:CreateTexture(nil, "BACKGROUND")
  214. _G[k].lag:SetHeight(24)
  215. _G[k].lag:SetWidth(0)
  216. _G[k].lag:SetPoint("RIGHT", _G[k], "RIGHT", 0, 0)
  217. _G[k].lag:SetTexture(1, 0, 0, 1)
  218. end;
  219. end;
  220.  
  221. if db[k].enableTimer then
  222. _G[k].timer = _G[k]:CreateFontString(nil);
  223. _G[k].timer:SetFont(ADDON_NAME.db.profile.media.fontNormal, ADDON_NAME.db.profile.media.fontSize, "");
  224. _G[k].timer:SetPoint("RIGHT", _G[k], "RIGHT", -5, 0);
  225. _G[k].update = .1;
  226. end;
  227.  
  228. a:SetPoint(db[k].relAnchor,"UIParent",db[k].selfAnchor, scale(db[k].offSetX),scale(db[k].offSetY))
  229.  
  230. a:SetWidth(d.w); a:SetHeight(d.h);
  231. a:SetBackdropColor(.1, .1, .1, .95);
  232. a:SetBackdrop({
  233. bgFile = db.background,
  234. edgeFile = db.border,
  235. tile = true, tileSize = 16, edgeSize = 15,
  236. insets = {left = 3, right = 3, top = 3, bottom = 3}
  237. })
  238. if ADDON_NAME.db.profile.media.classcolor == true then
  239. a:SetBackdropBorderColor(ccolor.r, ccolor.g, ccolor.b)
  240. end
  241. a:SetParent(_G[k]);
  242. a:SetMovable(true);
  243. a:EnableMouse(false);
  244. a:RegisterForDrag("LeftButton");
  245. a:SetScript("OnDragStart", function(self) self:StartMoving() end);
  246. a:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end);
  247. a.name = a:CreateFontString(nil, "OVERLAY");
  248. a.name:SetFont(ADDON_NAME.db.profile.media.fontNormal, ADDON_NAME.db.profile.media.fontSize, "");
  249. a.name:SetPoint("CENTER", a);
  250. _G[k].d = d; _G[k].df = a; _G[k].name = a.name; _G[k].l = true;
  251.  
  252. hooksecurefunc(_G[k], "Show", function() Set(a, k) end);
  253. end;
  254. end;
  255.  
  256. hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
  257. if not self.timer then return end
  258. if self.update and self.update < elapsed then
  259. if self.casting then
  260. self.timer:SetText(format("(%.1f)", max(self.maxValue - self.value, 0)))
  261. elseif self.channeling then
  262. self.timer:SetText(format("(%.1f)", max(self.value, 0)))
  263. else
  264. self.timer:SetText("")
  265. end
  266. self.update = .1
  267. else
  268. self.update = self.update - elapsed
  269. end
  270. end)
  271. UIPARENT_MANAGED_FRAME_POSITIONS["CastingBarFrame"] = nil;
  272. end
  273.  
  274.  
  275. -- Leave this out if the module doesn't have any settings:
  276. function MODULE:Refresh()
  277. db = self.db.profile -- update the upvalue
  278.  
  279. -- change stuff here
  280. end
  281.  
  282. ------------------------------------------------------------------------
  283. -- Module Options
  284. ------------------------------------------------------------------------
  285.  
  286. local regions = {
  287. ['BOTTOM'] = L['Bottom'],
  288. ['BOTTOMLEFT'] = L['Bottom Left'],
  289. ['BOTTOMRIGHT'] = L['Bottom Right'],
  290. ['CENTER'] = L['Center'],
  291. ['LEFT'] = L['Left'],
  292. ['RIGHT'] = L['Right'],
  293. ['TOP'] = L['Top'],
  294. ['TOPLEFT'] = L['Top Left'],
  295. ['TOPRIGHT'] = L['Top Right'],
  296. }
  297.  
  298. -- Leave this out if the module doesn't have any options:
  299. local options
  300. function MODULE:GetOptions()
  301.  
  302. if options then
  303. return options
  304. end
  305.  
  306. local function isModuleDisabled()
  307. return not ADDON_NAME:GetModuleEnabled(MODULE_NAME)
  308. end
  309.  
  310. options = {
  311. type = "group",
  312. name = L[MODULE_NAME],
  313. get = function(info) return db[ info[#info] ] end,
  314. set = function(info, value) db[ info[#info] ] = value end,
  315. disabled = isModuleDisabled(),
  316. args = {
  317. reloadUI = {
  318. type = "execute",
  319. name = "Reload UI",
  320. desc = " ",
  321. order = 0,
  322. func = function()
  323. ReloadUI()
  324. end,
  325. },
  326. Text = {
  327. type = "description",
  328. order = 0,
  329. name = "When changes are made a reload of the UI is needed.",
  330. width = "full",
  331. },
  332. Text1 = {
  333. type = "description",
  334. order = 1,
  335. name = " ",
  336. width = "full",
  337. },
  338. enable = {
  339. type = "toggle",
  340. order = 1,
  341. name = L["Enable Castbar Module"],
  342. width = "full",
  343. },
  344. Text2 = {
  345. type = "description",
  346. order = 2,
  347. name = " ",
  348. width = "full",
  349. },
  350. CastingBarFrame = {
  351. type = "group",
  352. order = 2,
  353. name = L["Player's Castbar"],
  354. guiInline = true,
  355. disabled = function() return isModuleDisabled() or not db.enable end,
  356. get = function(info) return db.CastingBarFrame[ info[#info] ] end,
  357. set = function(info, value) db.CastingBarFrame[ info[#info] ] = value; end,
  358. args = {
  359. enable = {
  360. type = "toggle",
  361. order = 0,
  362. name = L["Enable Player Castbar"],
  363. width = "full",
  364. },
  365. Text1 = {
  366. type = "description",
  367. order = 1,
  368. name = " ",
  369. width = "full",
  370. },
  371. enableLag = {
  372. type = "toggle",
  373. order = 1,
  374. name = L["Enable Lag"],
  375. desc = L["Enables lag to show on castbar."],
  376. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  377. },
  378. enableTimer = {
  379. type = "toggle",
  380. order = 1,
  381. name = L["Show Timer"],
  382. desc = L["Enables timer to show on castbar."],
  383. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  384. },
  385. Text2 = {
  386. type = "description",
  387. order = 2,
  388. name = " ",
  389. width = "full",
  390. },
  391. fontSize = {
  392. type = "range",
  393. order = 2,
  394. name = L["Font Size"],
  395. desc = L["Controls the Size of the Font"],
  396. min = 0, max = 30, step = 1,
  397. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  398. },
  399. offSetX = {
  400. type = "range",
  401. order = 2,
  402. name = L["X Offset"],
  403. desc = L["Controls the X offset. (Left - Right)"],
  404. min = -250, max = 250, step = 5,
  405. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  406. },
  407. offSetY = {
  408. type = "range",
  409. order = 2,
  410. name = L["Y Offset"],
  411. desc = L["Controls the Y offset. (Up - Down)"],
  412. min = -250, max = 250, step = 5,
  413. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  414. },
  415. Text3 = {
  416. type = "description",
  417. order = 3,
  418. name = " ",
  419. width = "full",
  420. },
  421. selfAnchor = {
  422. type = "select",
  423. order = 3,
  424. name = L["Self Anchor"],
  425. desc = L["Self Anchor Position."],
  426. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  427. values = regions,
  428. },
  429. relAnchor = {
  430. type = "select",
  431. order = 3,
  432. name = L["Relative Anchor"],
  433. desc = L["Relative Anchor Position."],
  434. disabled = function() return isModuleDisabled() or not db.enable or not db.CastingBarFrame.enable end,
  435. values = regions,
  436. },
  437. },
  438. },
  439. MirrorTimer1 = {
  440. type = "group",
  441. order = 3,
  442. name = L["Mirror Timer"],
  443. guiInline = true,
  444. disabled = function() return isModuleDisabled() or not db.enable end,
  445. get = function(info) return db.MirrorTimer1[ info[#info] ] end,
  446. set = function(info, value) db.MirrorTimer1[ info[#info] ] = value; end,
  447. args = {
  448. enable = {
  449. type = "toggle",
  450. order = 0,
  451. name = L["Enable Mirror Timer Castbar"],
  452. width = "full",
  453. },
  454. Text1 = {
  455. type = "description",
  456. order = 1,
  457. name = " ",
  458. width = "full",
  459. },
  460. enableTimer = {
  461. type = "toggle",
  462. order = 1,
  463. name = L["Show Timer"],
  464. desc = L["Enables timer to show on castbar."],
  465. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  466. },
  467. Text2 = {
  468. type = "description",
  469. order = 2,
  470. name = " ",
  471. width = "full",
  472. },
  473. fontSize = {
  474. type = "range",
  475. order = 2,
  476. name = L["Font Size"],
  477. desc = L["Controls the Size of the Font"],
  478. min = 0, max = 30, step = 1,
  479. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  480. },
  481. offSetX = {
  482. type = "range",
  483. order = 2,
  484. name = L["X Offset"],
  485. desc = L["Controls the X offset. (Left - Right)"],
  486. min = -250, max = 250, step = 5,
  487. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  488. },
  489. offSetY = {
  490. type = "range",
  491. order = 2,
  492. name = L["Y Offset"],
  493. desc = L["Controls the Y offset. (Up - Down)"],
  494. min = -250, max = 250, step = 5,
  495. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  496. },
  497. Text3 = {
  498. type = "description",
  499. order = 3,
  500. name = " ",
  501. width = "full",
  502. },
  503. selfAnchor = {
  504. type = "select",
  505. order = 3,
  506. name = L["Self Anchor"],
  507. desc = L["Self Anchor Position."],
  508. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  509. values = regions,
  510. },
  511. relAnchor = {
  512. type = "select",
  513. order = 3,
  514. name = L["Relative Anchor"],
  515. desc = L["Relative Anchor Position."],
  516. disabled = function() return isModuleDisabled() or not db.enable or not db.MirrorTimer1.enable end,
  517. values = regions,
  518. },
  519. },
  520. },
  521. PetCastingBarFrame = {
  522. type = "group",
  523. order = 4,
  524. name = L["Pet Castbar"],
  525. guiInline = true,
  526. disabled = function() return isModuleDisabled() or not db.enable end,
  527. get = function(info) return db.PetCastingBarFrame[ info[#info] ] end,
  528. set = function(info, value) db.PetCastingBarFrame[ info[#info] ] = value; end,
  529. args = {
  530. enable = {
  531. type = "toggle",
  532. order = 0,
  533. name = L["Enable Pet Castbar"],
  534. width = "full",
  535. },
  536. Text1 = {
  537. type = "description",
  538. order = 1,
  539. name = " ",
  540. width = "full",
  541. },
  542. enableTimer = {
  543. type = "toggle",
  544. order = 1,
  545. name = L["Show Timer"],
  546. desc = L["Enables timer to show on castbar."],
  547. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  548. },
  549. Text2 = {
  550. type = "description",
  551. order = 2,
  552. name = " ",
  553. width = "full",
  554. },
  555. offSetX = {
  556. type = "range",
  557. order = 2,
  558. name = L["X Offset."],
  559. desc = L["Controls the X offset. (Left - Right)"],
  560. min = -250, max = 250, step = 5,
  561. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  562. },
  563. offSetY = {
  564. type = "range",
  565. order = 2,
  566. name = L["Y Offset."],
  567. desc = L["Controls the Y offset. (Up - Down)"],
  568. min = -250, max = 250, step = 5,
  569. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  570. },
  571. fontSize = {
  572. type = "range",
  573. order = 2,
  574. name = L["Font Size"],
  575. desc = L["Controls the Size of the Font"],
  576. min = 0, max = 30, step = 1,
  577. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  578. },
  579. Text3 = {
  580. type = "description",
  581. order = 3,
  582. name = " ",
  583. width = "full",
  584. },
  585. selfAnchor = {
  586. type = "select",
  587. order = 3,
  588. name = L["Self Anchor"],
  589. desc = L["Self Anchor Position."],
  590. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  591. values = regions,
  592. },
  593. relAnchor = {
  594. type = "select",
  595. order = 3,
  596. name = L["Relative Anchor"],
  597. desc = L["Relative Anchor Position."],
  598. disabled = function() return isModuleDisabled() or not db.enable or not db.PetCastingBarFrame.enable end,
  599. values = regions,
  600. },
  601. },
  602. },
  603. TargetFrameSpellBar = {
  604. type = "group",
  605. order = 5,
  606. name = L["Target's Castbar"],
  607. guiInline = true,
  608. disabled = function() return isModuleDisabled() or not db.enable end,
  609. get = function(info) return db.TargetFrameSpellBar[ info[#info] ] end,
  610. set = function(info, value) db.TargetFrameSpellBar[ info[#info] ] = value; end,
  611. args = {
  612. enable = {
  613. type = "toggle",
  614. order = 0,
  615. name = L["Enable Target Castbar"],
  616. width = "full",
  617. },
  618. Text1 = {
  619. type = "description",
  620. order = 1,
  621. name = " ",
  622. width = "full",
  623. },
  624. enableLag = {
  625. type = "toggle",
  626. order = 1,
  627. name = L["Enable Lag"],
  628. desc = L["Enables lag to show on castbar."],
  629. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  630. },
  631. enableTimer = {
  632. type = "toggle",
  633. order = 1,
  634. name = L["Show Timer"],
  635. desc = L["Enables timer to show on castbar."],
  636. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  637. },
  638. Text2 = {
  639. type = "description",
  640. order = 2,
  641. name = " ",
  642. width = "full",
  643. },
  644. fontSize = {
  645. type = "range",
  646. order = 2,
  647. name = L["Font Size"],
  648. desc = L["Controls the Size of the Font"],
  649. min = 0, max = 30, step = 1,
  650. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  651. },
  652. offSetX = {
  653. type = "range",
  654. order = 2,
  655. name = L["X Offset"],
  656. desc = L["Controls the X offset. (Left - Right)"],
  657. min = -250, max = 250, step = 5,
  658. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  659. },
  660. offSetY = {
  661. type = "range",
  662. order = 2,
  663. name = L["Y Offset"],
  664. desc = L["Controls the Y offset. (Up - Down)"],
  665. min = -250, max = 250, step = 5,
  666. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  667. },
  668. Text3 = {
  669. type = "description",
  670. order = 3,
  671. name = " ",
  672. width = "full",
  673. },
  674. selfAnchor = {
  675. type = "select",
  676. order = 3,
  677. name = L["Self Anchor"],
  678. desc = L["Self Anchor Position."],
  679. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  680. values = regions,
  681. },
  682. relAnchor = {
  683. type = "select",
  684. order = 3,
  685. name = L["Relative Anchor"],
  686. desc = L["Relative Anchor Position."],
  687. disabled = function() return isModuleDisabled() or not db.enable or not db.TargetFrameSpellBar.enable end,
  688. values = regions,
  689. },
  690. },
  691. },
  692. FocusFrameSpellBar = {
  693. type = "group",
  694. order = 6,
  695. name = L["Focus Castbar"],
  696. guiInline = true,
  697. disabled = function() return isModuleDisabled() or not db.enable end,
  698. get = function(info) return db.FocusFrameSpellBar[ info[#info] ] end,
  699. set = function(info, value) db.FocusFrameSpellBar[ info[#info] ] = value; end,
  700. args = {
  701. enable = {
  702. type = "toggle",
  703. order = 0,
  704. name = L["Enable Focus Castbar"],
  705. width = "full",
  706. },
  707. Text1 = {
  708. type = "description",
  709. order = 1,
  710. name = " ",
  711. width = "full",
  712. },
  713. enableLag = {
  714. type = "toggle",
  715. order = 1,
  716. name = L["Enable Lag"],
  717. desc = L["Enables lag to show on castbar."],
  718. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  719. },
  720. enableTimer = {
  721. type = "toggle",
  722. order = 1,
  723. name = L["Show Timer"],
  724. desc = L["Enables timer to show on castbar."],
  725. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  726. },
  727. Text2 = {
  728. type = "description",
  729. order = 2,
  730. name = " ",
  731. width = "full",
  732. },
  733. offSetX = {
  734. type = "range",
  735. order = 2,
  736. name = L["X Offset"],
  737. desc = L["Controls the X offset. (Left - Right)"],
  738. min = -250, max = 250, step = 5,
  739. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  740. },
  741. offSetY = {
  742. type = "range",
  743. order = 2,
  744. name = L["Y Offset"],
  745. desc = L["Controls the Y offset. (Up - Down)"],
  746. min = -250, max = 250, step = 5,
  747. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  748. },
  749. fontSize = {
  750. type = "range",
  751. order = 2,
  752. name = L["Font Size"],
  753. desc = L["Controls the Size of the Font"],
  754. min = 0, max = 30, step = 1,
  755. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  756. },
  757. Text3 = {
  758. type = "description",
  759. order = 3,
  760. name = " ",
  761. width = "full",
  762. },
  763. selfAnchor = {
  764. type = "select",
  765. order = 3,
  766. name = L["Self Anchor"],
  767. desc = L["Self Anchor Position."],
  768. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  769. values = regions,
  770. },
  771. relAnchor = {
  772. type = "select",
  773. order = 3,
  774. name = L["Relative Anchor"],
  775. desc = L["Relative Anchor Position."],
  776. disabled = function() return isModuleDisabled() or not db.enable or not db.FocusFrameSpellBar.enable end,
  777. values = regions,
  778. },
  779. },
  780. },
  781. },
  782. }
  783. return options
  784. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement