Advertisement
Guest User

Options.lua

a guest
Oct 30th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.73 KB | None | 0 0
  1. local L = LibStub("AceLocale-3.0"):GetLocale("Skada", false)
  2. local media = LibStub("LibSharedMedia-3.0")
  3.  
  4. Skada.resetoptions = {[1] = L["No"], [2] = L["Yes"], [3] = L["Ask"]}
  5.  
  6. Skada.windowdefaults = {
  7. name = "Skada",
  8.  
  9. barspacing=0,
  10. bartexture="BantoBar",
  11. barfont="Accidental Presidency",
  12. barfontflags="",
  13. barfontsize=11,
  14. barheight=15,
  15. barwidth=240,
  16. barorientation=1,
  17. barcolor = {r = 0.3, g = 0.3, b = 0.8, a=1},
  18. barbgcolor = {r = 0.3, g = 0.3, b = 0.3, a = 0.6},
  19. barslocked=false,
  20. clickthrough=false,
  21.  
  22. classcolorbars = true,
  23. classcolortext = false,
  24. classicons = true,
  25.  
  26. buttons = {menu = true, reset = true, report = true, mode = true, segment = true},
  27.  
  28. title = {height = 15, font="Accidental Presidency", fontsize=11,margin=0, texture="Aluminium", bordertexture="None", borderthickness=2, color = {r=0.1,g=0.1,b=0.3,a=0.8}, fontflags = ""},
  29. background = {margin=0, height=200, texture="Solid", bordertexture="None", borderthickness=0, color = {r=0,g=0,b=0.5,a=0.2}},
  30.  
  31. reversegrowth=false,
  32. modeincombat="",
  33. returnaftercombat=false,
  34. wipemode="",
  35.  
  36. hidden = false,
  37. enabletitle = true,
  38. titleset = true,
  39.  
  40. set = "current",
  41. mode = nil,
  42.  
  43. display = "bar",
  44. snapto = true,
  45. scale = 1
  46. }
  47.  
  48. local windefaultscopy = {}
  49. Skada:tcopy(windefaultscopy, Skada.windowdefaults)
  50.  
  51. Skada.defaults = {
  52. profile = {
  53. version=1,
  54. reset={instance=1, join=3, leave=1},
  55. icon = {hide = false, radius = 80, minimapPos = 195},
  56. numberformat=1,
  57. setformat=3,
  58. setnumber=true,
  59. showranks=true,
  60. setstokeep=10,
  61. tooltips=true,
  62. tooltippos="default",
  63. tooltiprows=3,
  64. informativetooltips=true,
  65. onlykeepbosses=false,
  66. tentativecombatstart=false,
  67. hidesolo=false,
  68. hidepvp=false,
  69. hidedisables=true,
  70. hidecombat=false,
  71. mergepets=true,
  72. feed = "",
  73. showtotals = false,
  74.  
  75. modules = {},
  76. columns = {},
  77. report = {mode = "Damage", set = "current", channel = "Say", chantype = "preset", number = 10},
  78. modulesBlocked = {
  79. },
  80.  
  81. windows = {windefaultscopy},
  82. }
  83. }
  84.  
  85. -- Adds column configuration options for a mode.
  86. function Skada:AddColumnOptions(mod)
  87. local db = self.db.profile.columns
  88.  
  89. if mod.metadata and mod.metadata.columns then
  90. local cols = {
  91. type = "group",
  92. name = mod:GetName(),
  93. order=0,
  94. inline=true,
  95. args = {}
  96. }
  97.  
  98. for colname, value in pairs(mod.metadata.columns) do
  99. local c = mod:GetName().."_"..colname
  100.  
  101. -- Set initial value from db if available, otherwise use mod default value.
  102. if db[c] ~= nil then
  103. mod.metadata.columns[colname] = db[c]
  104. end
  105.  
  106. -- Add column option.
  107. local col = {
  108. type="toggle",
  109. name=L[colname] or colname,
  110. get=function() return mod.metadata.columns[colname] end,
  111. set=function()
  112. mod.metadata.columns[colname] = not mod.metadata.columns[colname]
  113. db[c] = mod.metadata.columns[colname]
  114. Skada:UpdateDisplay(true)
  115. end,
  116. }
  117. cols.args[c] = col
  118. end
  119.  
  120. Skada.options.args.columns.args[mod:GetName()] = cols
  121. end
  122. end
  123.  
  124. function Skada:AddLoadableModuleCheckbox(mod, name)
  125. local new = {
  126. type = "toggle",
  127. name = name,
  128. order=1,
  129. }
  130. Skada.options.args.modules.args[mod] = new
  131. end
  132.  
  133. local deletewindow = nil
  134. local newdisplay = "bar"
  135. Skada.options = {
  136. type="group",
  137. name="Skada",
  138. plugins = {},
  139. args={
  140. d = {
  141. type="description",
  142. name=L["A damage meter."],
  143. order=0,
  144. },
  145.  
  146. windows = {
  147. type = "group",
  148. name = L["Windows"],
  149. order=1,
  150. args = {
  151.  
  152. create = {
  153. type="input",
  154. name=L["Create window"],
  155. desc=L["Enter the name for the new window."],
  156. set=function(self, val) if val and val ~= "" then Skada:CreateWindow(val, nil, newdisplay) end end,
  157. order=1,
  158. },
  159.  
  160. display = {
  161. type="select",
  162. name=L["Display system"],
  163. desc=L["Choose the system to be used for displaying data in this window."],
  164. values= function()
  165. local list = {}
  166. for name, display in pairs(Skada.displays) do
  167. list[name] = display.name
  168. end
  169. return list
  170. end,
  171. get=function() return newdisplay end,
  172. set=function(i, display) newdisplay = display end,
  173. order=2,
  174. },
  175.  
  176. },
  177. },
  178.  
  179. resetoptions = {
  180. type = "group",
  181. name = L["Data resets"],
  182. order=2,
  183. args = {
  184.  
  185. resetinstance = {
  186. type="select",
  187. name=L["Reset on entering instance"],
  188. desc=L["Controls if data is reset when you enter an instance."],
  189. values= function() return Skada.resetoptions end,
  190. get=function() return Skada.db.profile.reset.instance end,
  191. set=function(self, opt) Skada.db.profile.reset.instance = opt end,
  192. order=30,
  193. },
  194.  
  195. resetjoin = {
  196. type="select",
  197. name=L["Reset on joining a group"],
  198. desc=L["Controls if data is reset when you join a group."],
  199. values= function() return Skada.resetoptions end,
  200. get=function() return Skada.db.profile.reset.join end,
  201. set=function(self, opt) Skada.db.profile.reset.join = opt end,
  202. order=31,
  203. },
  204.  
  205. resetleave = {
  206. type="select",
  207. name=L["Reset on leaving a group"],
  208. desc=L["Controls if data is reset when you leave a group."],
  209. values= function() return Skada.resetoptions end,
  210. get=function() return Skada.db.profile.reset.leave end,
  211. set=function(self, opt) Skada.db.profile.reset.leave = opt end,
  212. order=32,
  213. },
  214.  
  215. }
  216.  
  217. },
  218.  
  219. tooltips = {
  220. type = "group",
  221. name = L["Tooltips"],
  222. order=3,
  223. args = {
  224. tooltips = {
  225. type="toggle",
  226. name=L["Show tooltips"],
  227. desc=L["Shows tooltips with extra information in some modes."],
  228. order=1,
  229. get=function() return Skada.db.profile.tooltips end,
  230. set=function() Skada.db.profile.tooltips = not Skada.db.profile.tooltips end,
  231. },
  232.  
  233. informative = {
  234. type="toggle",
  235. name=L["Informative tooltips"],
  236. desc=L["Shows subview summaries in the tooltips."],
  237. order=2,
  238. get=function() return Skada.db.profile.informativetooltips end,
  239. set=function() Skada.db.profile.informativetooltips = not Skada.db.profile.informativetooltips end,
  240. },
  241.  
  242. rows = {
  243. type="range",
  244. name=L["Subview rows"],
  245. desc=L["The number of rows from each subview to show when using informative tooltips."],
  246. min=1,
  247. max=10,
  248. step=1,
  249. get=function() return Skada.db.profile.tooltiprows end,
  250. set=function(self, val) Skada.db.profile.tooltiprows = val end,
  251. order=3,
  252. },
  253.  
  254. tooltippos = {
  255. type="select",
  256. name=L["Tooltip position"],
  257. desc=L["Position of the tooltips."],
  258. values= {["default"] = L["Default"], ["topright"] = L["Top right"], ["topleft"] = L["Top left"]},
  259. get=function() return Skada.db.profile.tooltippos end,
  260. set=function(self, opt) Skada.db.profile.tooltippos = opt end,
  261. order=4,
  262. },
  263. }
  264. },
  265.  
  266. generaloptions = {
  267. type = "group",
  268. name = L["General options"],
  269. order=4,
  270. args = {
  271.  
  272. mmbutton = {
  273. type="toggle",
  274. name=L["Show minimap button"],
  275. desc=L["Toggles showing the minimap button."],
  276. order=1,
  277. get=function() return not Skada.db.profile.icon.hide end,
  278. set=function()
  279. Skada.db.profile.icon.hide = not Skada.db.profile.icon.hide
  280. Skada:RefreshMMButton()
  281. end,
  282. },
  283.  
  284. mergepets = {
  285. type="toggle",
  286. name=L["Merge pets"],
  287. desc=L["Merges pets with their owners. Changing this only affects new data."],
  288. order=2,
  289. get=function() return Skada.db.profile.mergepets end,
  290. set=function() Skada.db.profile.mergepets = not Skada.db.profile.mergepets end,
  291. },
  292.  
  293. showtotals = {
  294. type="toggle",
  295. name=L["Show totals"],
  296. desc=L["Shows a extra row with a summary in certain modes."],
  297. order=3,
  298. get=function() return Skada.db.profile.showtotals end,
  299. set=function() Skada.db.profile.showtotals = not Skada.db.profile.showtotals end,
  300. },
  301.  
  302. onlykeepbosses = {
  303. type="toggle",
  304. name=L["Only keep boss fighs"],
  305. desc=L["Boss fights will be kept with this on, and non-boss fights are discarded."],
  306. order=4,
  307. get=function() return Skada.db.profile.onlykeepbosses end,
  308. set=function() Skada.db.profile.onlykeepbosses = not Skada.db.profile.onlykeepbosses end,
  309. },
  310.  
  311. hidesolo = {
  312. type="toggle",
  313. name=L["Hide when solo"],
  314. desc=L["Hides Skada's window when not in a party or raid."],
  315. order=5,
  316. get=function() return Skada.db.profile.hidesolo end,
  317. set=function()
  318. Skada.db.profile.hidesolo = not Skada.db.profile.hidesolo
  319. Skada:ApplySettings()
  320. end,
  321. },
  322.  
  323. hidepvp = {
  324. type="toggle",
  325. name=L["Hide in PvP"],
  326. desc=L["Hides Skada's window when in Battlegrounds/Arenas."],
  327. order=6,
  328. get=function() return Skada.db.profile.hidepvp end,
  329. set=function()
  330. Skada.db.profile.hidepvp = not Skada.db.profile.hidepvp
  331. Skada:ApplySettings()
  332. end,
  333. },
  334.  
  335. hidecombat = {
  336. type="toggle",
  337. name=L["Hide in combat"],
  338. desc=L["Hides Skada's window when in combat."],
  339. order=7,
  340. get=function() return Skada.db.profile.hidecombat end,
  341. set=function()
  342. Skada.db.profile.hidecombat = not Skada.db.profile.hidecombat
  343. Skada:ApplySettings()
  344. end,
  345. },
  346.  
  347. disablewhenhidden = {
  348. type="toggle",
  349. name=L["Disable while hidden"],
  350. desc=L["Skada will not collect any data when automatically hidden."],
  351. order=8,
  352. get=function() return Skada.db.profile.hidedisables end,
  353. set=function()
  354. Skada.db.profile.hidedisables = not Skada.db.profile.hidedisables
  355. Skada:ApplySettings()
  356. end,
  357. },
  358.  
  359. numberformat = {
  360. type="select",
  361. name=L["Number format"],
  362. desc=L["Controls the way large numbers are displayed."],
  363. values= function() return {[1] = L["Condensed"], [2] = L["Detailed"]} end,
  364. get=function() return Skada.db.profile.numberformat end,
  365. set=function(self, opt) Skada.db.profile.numberformat = opt end,
  366. order=11,
  367. },
  368.  
  369. showranks = {
  370. type="toggle",
  371. name=L["Show rank numbers"],
  372. desc=L["Shows numbers for relative ranks for modes where it is applicable."],
  373. order=9,
  374. get=function() return Skada.db.profile.showranks end,
  375. set=function()
  376. Skada.db.profile.showranks = not Skada.db.profile.showranks
  377. Skada:ApplySettings()
  378. end,
  379. },
  380.  
  381. datafeed = {
  382. type="select",
  383. name=L["Data feed"],
  384. desc=L["Choose which data feed to show in the DataBroker view. This requires an LDB display addon, such as Titan Panel."],
  385. values= function()
  386. local feeds = {}
  387. feeds[""] = L["None"]
  388. for name, func in pairs(Skada:GetFeeds()) do feeds[name] = name end
  389. return feeds
  390. end,
  391. get=function() return Skada.db.profile.feed end,
  392. set=function(self, feed)
  393. Skada.db.profile.feed = feed
  394. if feed ~= "" then Skada:SetFeed(Skada:GetFeeds()[feed]) end
  395. end,
  396. order=12,
  397. },
  398.  
  399. setstokeep = {
  400. type="range",
  401. name=L["Data segments to keep"],
  402. desc=L["The number of fight segments to keep. Persistent segments are not included in this."],
  403. min=0,
  404. max=30,
  405. step=1,
  406. get=function() return Skada.db.profile.setstokeep end,
  407. set=function(self, val) Skada.db.profile.setstokeep = val end,
  408. order=13,
  409. },
  410.  
  411. setnumber = {
  412. type="toggle",
  413. name=L["Number set duplicates"],
  414. desc=L["Append a count to set names with duplicate mob names."],
  415. order=13.5,
  416. get=function() return Skada.db.profile.setnumber end,
  417. set=function() Skada.db.profile.setnumber = not Skada.db.profile.setnumber end,
  418. },
  419.  
  420. setformat = {
  421. type="select",
  422. name=L["Set format"],
  423. desc=L["Controls the way set names are displayed."],
  424. values= Skada:SetLabelFormats(),
  425. get=function() return Skada.db.profile.setformat end,
  426. set=function(self, opt) Skada.db.profile.setformat = opt; Skada:ApplySettings(); end,
  427. order=14,
  428. width="double",
  429. },
  430.  
  431. tenativecombatstart = {
  432. type="toggle",
  433. name=L["Aggressive combat detection"],
  434. desc=L["Skada usually uses a very conservative (simple) combat detection scheme that works best in raids. With this option Skada attempts to emulate other damage meters. Useful for running dungeons. Meaningless on boss encounters."],
  435. order=10,
  436. get=function() return Skada.db.profile.tentativecombatstart end,
  437. set=function() Skada.db.profile.tentativecombatstart = not Skada.db.profile.tentativecombatstart end,
  438. },
  439. }
  440. },
  441. columns = {
  442. type = "group",
  443. name = L["Columns"],
  444. order=5,
  445. args = {},
  446. },
  447. modules = {
  448. type = "group",
  449. name = L["Disabled Modules"],
  450. order=6,
  451. get = function(i) return Skada.db.profile.modulesBlocked[i[#i]] end,
  452. set = function(i, value) Skada.db.profile.modulesBlocked[i[#i]] = value; Skada.options.args.modules.args.apply.disabled=false end,
  453. args = {
  454. desc = {
  455. type="description",
  456. name=L["Tick the modules you want to disable."],
  457. width="full",
  458. order=0,
  459. },
  460. apply = {
  461. type="execute",
  462. name=APPLY,
  463. width="full",
  464. func=ReloadUI,
  465. confirm = function()
  466. return L["This change requires a UI reload. Are you sure?"]
  467. end,
  468. disabled = true,
  469. order=99,
  470. },
  471. },
  472. }
  473. }
  474. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement