Advertisement
Guest User

colored-shields-patch

a guest
Dec 9th, 2011
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.55 KB | None | 0 0
  1. Index: Options/locales/enUS.lua
  2. ===================================================================
  3. --- Options/locales/enUS.lua    (revision 638)
  4. +++ Options/locales/enUS.lua    (working copy)
  5. @@ -594,6 +594,19 @@
  6.  L["Maximum shield amount"] = true
  7.  L["Maximum shield amount value. Only used by bar indicators."] = true
  8.  
  9. +L["Shield-Color1-Name"] = "Normal"
  10. +L["Shield-Color2-Name"] = "Medium"
  11. +L["Shield-Color3-Name"] = "Low"
  12. +
  13. +L["Shield-Color1-Desc"] = "Normal shield color"
  14. +L["Shield-Color2-Desc"] = "Medium shield color"
  15. +L["Shield-Color3-Desc"] = "Low shield color"
  16. +
  17. +L["Low shield threshold"] = true
  18. +L["The value below which a shield is considered low."] = true
  19. +L["Medium shield threshold"] = true
  20. +L["The value below which a shield is considered medium."] = true
  21. +
  22.  -- aoe heals
  23.  L["aoe-"] = true
  24.  L["neighbors"] = true
  25. Index: Options/GridStatuses.lua
  26. ===================================================================
  27. --- Options/GridStatuses.lua    (revision 638)
  28. +++ Options/GridStatuses.lua    (working copy)
  29. @@ -532,8 +532,26 @@
  30.  end
  31.  
  32.  function Grid2Options:MakeStatusShieldsOptions(status, options, optionParams)
  33. +
  34. +   -- Ugly hack to upgrade status config in ace database
  35. +   if not status.dbx.colorCount or status.dbx.colorCount < 3 then status.dbx.colorCount = 3 end   
  36. +   if not status.dbx.color2 then status.dbx.color2 = { r = 1, g = 0.5, b = 0, a = 1 } end
  37. +   if not status.dbx.color3 then status.dbx.color3 = { r = 1, g = 0, b = 0, a = 1 } end
  38. +   if not status.dbx.thresholdMedium then status.dbx.thresholdMedium = 15000 end
  39. +   if not status.dbx.thresholdLow then status.dbx.thresholdLow = 6000 end
  40. +
  41.     options = options or {}
  42. -   options = Grid2Options:MakeStatusColorOptions(status, options, optionParams)
  43. +   options = Grid2Options:MakeStatusColorOptions(status, options, {
  44. +           color1 = L["Shield-Color1-Name"],
  45. +           colorDesc1 = L["Shield-Color1-Desc"],
  46. +           color2 = L["Shield-Color2-Name"],
  47. +           colorDesc2 = L["Shield-Color1-Desc"],
  48. +           color3 = L["Shield-Color3-Name"],
  49. +           colorDesc3 = L["Shield-Color1-Desc"],
  50. +   })
  51. +  
  52. +   options.spacer1 = { type = "header", order = 28, name = "", }
  53. +  
  54.     options.maxShieldAmount = {
  55.         type = "range",
  56.         order = 30,
  57. @@ -548,6 +566,38 @@
  58.             status:UpdateDB()
  59.         end,
  60.     }
  61. +   options.thresholdMedium = {
  62. +       type = "range",
  63. +       order = 32,
  64. +       name = L["Medium shield threshold"],
  65. +       desc = L["The value below which a shield is considered medium."],
  66. +       min = 0,
  67. +       softMax = 100000,
  68. +       bigStep = 100,
  69. +       step = 1,
  70. +       get = function () return status.dbx.thresholdMedium end,
  71. +       set = function (_, v)
  72. +           if status.dbx.thresholdLow > v then v = status.dbx.thresholdLow end
  73. +           status.dbx.thresholdMedium = v  
  74. +           status:UpdateDB()
  75. +       end,
  76. +   }
  77. +   options.thresholdLow = {
  78. +       type = "range",
  79. +       order = 34,
  80. +       name = L["Low shield threshold"],
  81. +       desc = L["The value below which a shield is considered low."],
  82. +       min = 0,
  83. +       softMax = 100000,
  84. +       bigStep = 100,
  85. +       step = 1,
  86. +       get = function () return status.dbx.thresholdLow end,
  87. +       set = function (_, v)
  88. +           if status.dbx.thresholdMedium < v then v = status.dbx.thresholdMedium end
  89. +           status.dbx.thresholdLow = v  
  90. +           status:UpdateDB()
  91. +       end,
  92. +   }
  93.     options.filter = {
  94.         type = "group",
  95.         order = 40,
  96. Index: GridDefaults.lua
  97. ===================================================================
  98. --- GridDefaults.lua    (revision 638)
  99. +++ GridDefaults.lua    (working copy)
  100. @@ -386,7 +386,7 @@
  101.         color4 = {r=1,g=1  ,b=0  ,a=1},   -- energy
  102.         color5 = {r=0,g=0.8,b=0.8,a=1},   -- runic power
  103.     })  
  104. -   Grid2:DbSetMissingValue( "statuses",  "shields", { type = "shields", color1 = {r=0,g=1,b=0,a=1} })
  105. +   Grid2:DbSetMissingValue( "statuses",  "shields", { type = "shields", colorCount = 3, color1 = {r=0,g=1,b=0,a=1}, color2 = {r=1,g=0.5,b=0,a=1}, color3 = {r=1,g=0,b=0,a=1}, thresholdMedium = 15000, thresholdLow = 6000 })
  106.     if Grid2:DbSetMissingValue( "statuses", "resurrection", { type = "resurrection", colorCount = 2,   
  107.         color1 = { r = 0, g = 1, b = 0, a=1 },    
  108.         color2 = { r = 1, g = 1, b = 0, a=0.75 }, })
  109. Index: modules/StatusShields.lua
  110. ===================================================================
  111. --- modules/StatusShields.lua   (revision 638)
  112. +++ modules/StatusShields.lua   (working copy)
  113. @@ -104,7 +104,18 @@
  114.  end
  115.  
  116.  function Shields:GetColor(unit)
  117. -   local c = self.dbx.color1
  118. +   local c
  119. +   local amount = shields_tot[unit]
  120. +   local db = self.dbx
  121. +  
  122. +   if amount > db.thresholdMedium then
  123. +       c = db.color1
  124. +   elseif amount > db.thresholdLow then
  125. +       c = db.color2
  126. +   else
  127. +       c = db.color3
  128. +   end
  129. +  
  130.     return c.r, c.g, c.b, c.a
  131.  end
  132.  
  133.  
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement