Quantcast

QoL changes

Steven Jackson [04-10-15 - 00:38]
QoL changes
Filename
SVUI_!Core/libs/AceVillain/widgets/AceGUIWidget-Slider.lua
SVUI_!Core/system/_reports/experience.lua
SVUI_!Core/system/credits.lua
SVUI_!Core/system/reports.lua
SVUI_!Options/UnitFrames.lua
SVUI_UnitFrames/Loader.lua
SVUI_UnitFrames/SVUI_UnitFrames.lua
SVUI_UnitFrames/SVUI_UnitFrames.xml
SVUI_UnitFrames/bodyguard.lua
SVUI_UnitFrames/libs/oUF/elements/health.lua
diff --git a/SVUI_!Core/libs/AceVillain/widgets/AceGUIWidget-Slider.lua b/SVUI_!Core/libs/AceVillain/widgets/AceGUIWidget-Slider.lua
index caf9653..555bfc3 100644
--- a/SVUI_!Core/libs/AceVillain/widgets/AceGUIWidget-Slider.lua
+++ b/SVUI_!Core/libs/AceVillain/widgets/AceGUIWidget-Slider.lua
@@ -115,11 +115,11 @@ local function EditBox_OnEnterPressed(frame)
 end

 local function EditBox_OnEnter(frame)
-	frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
+	frame:SetBackdropBorderColor(0.2, 0.2, 0.2)
 end

 local function EditBox_OnLeave(frame)
-	frame:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
+	frame:SetBackdropBorderColor(0, 0, 0)
 end

 --[[-----------------------------------------------------------------------------
diff --git a/SVUI_!Core/system/_reports/experience.lua b/SVUI_!Core/system/_reports/experience.lua
index dcfa8bb..cd9bdd4 100644
--- a/SVUI_!Core/system/_reports/experience.lua
+++ b/SVUI_!Core/system/_reports/experience.lua
@@ -37,57 +37,87 @@ EXPERIENCE STATS
 ]]--
 local HEX_COLOR = "22FFFF";
 local TEXT_PATTERN = "|cff%s%s|r";
-local function FormatExp(value, maxValue, r_value, exhaust)
-	local trunc, calc, r_trunc, r_calc;
-    if value >= 1e9 then
-        trunc = ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1")
-    elseif value >= 1e6 then
-        trunc = ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1")
-    elseif value >= 1e3 or value <= -1e3 then
-        trunc = ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1")
-    else
-        trunc = value
-    end
-
-    local remain
-    if(maxValue > 0) then
-		remain = r_value or (maxValue - value);
-		if remain >= 1e9 then
-			r_trunc = ("%.1fb"):format(remain/1e9):gsub("%.?0+([kmb])$","%1")
-	    elseif remain >= 1e6 then
-			r_trunc = ("%.1fm"):format(remain/1e6):gsub("%.?0+([kmb])$","%1")
-	    elseif remain >= 1e3 or value <= -1e3 then
-			r_trunc = ("%.1fk"):format(remain/1e3):gsub("%.?0+([kmb])$","%1")
+local playerName = UnitName("player");
+local maxPlayerLevel = GetMaxPlayerLevel();
+
+local function FormatExp(subset, value, maxValue, remain, exhaust)
+	local trunc, calc;
+
+	if(maxPlayerLevel == UnitLevel("player")) then return "|cff11CC00Max Level|r" end
+
+	local expString,prefix,suffix = "","","";
+	if(exhaust and exhaust > 0) then
+		prefix = "|cff1188FF";
+		suffix = "|r";
+	end
+
+	if(subset:find("XP")) then
+	    if value >= 1e9 then
+	        trunc = ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1")
+	    elseif value >= 1e6 then
+	        trunc = ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1")
+	    elseif value >= 1e3 or value <= -1e3 then
+	        trunc = ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1")
 	    else
-			r_trunc = remain
+	        trunc = value
 	    end
-	else
-		remain = 0
-		r_trunc = 0;
-	end

-		if(exhaust and exhaust > 0) then
+	    if(exhaust and exhaust > 0) then
 			trunc = "|cff1188FF" .. trunc .. "|r";
-			r_trunc = "|cff1188FF" .. r_trunc .. "|r";
 		end

-    if(maxValue > 0) then
-			if(value > 0) then
-    		calc = (value / maxValue) * 100
-			else
-				calc = 100
-			end
-			if(remain > 0) then
-				r_calc = (remain / maxValue) * 100
-			else
-				r_calc = 100
-			end
-    else
-    	calc = 100
-			r_calc = 100
-    end
-
-    return trunc, calc, r_trunc, r_calc
+		if(subset:find("_Percent")) then
+		    if(maxValue > 0) then
+				if(value > 0) then
+	    			calc = (value / maxValue) * 100
+	    			calc = ("%d%%"):format(calc)
+				else
+					calc = 100
+				end
+		    else
+		    	calc = 100
+		    end
+		    expString = prefix .. trunc .. suffix .. "  |cffAAAAAA=|r  " .. calc
+		else
+			expString = prefix .. trunc .. suffix .. "  |cffAAAAAA/|r  " .. maxValue
+		end
+	end
+
+	if(subset:find("Remaining")) then
+	    if(maxValue > 0) then
+			remain = remain or (maxValue - value);
+			if remain >= 1e9 then
+				trunc = ("%.1fb"):format(remain/1e9):gsub("%.?0+([kmb])$","%1")
+		    elseif remain >= 1e6 then
+				trunc = ("%.1fm"):format(remain/1e6):gsub("%.?0+([kmb])$","%1")
+		    elseif remain >= 1e3 or value <= -1e3 then
+				trunc = ("%.1fk"):format(remain/1e3):gsub("%.?0+([kmb])$","%1")
+		    else
+				trunc = remain
+		    end
+		else
+			remain = 0
+			trunc = 0;
+		end
+
+		if(subset:find("_Percent")) then
+		    if(maxValue > 0) then
+				if(remain > 0) then
+					calc = (remain / maxValue) * 100
+					calc = ("%d%%"):format(calc)
+				else
+					calc = 100
+				end
+		    else
+		    	calc = 100
+		    end
+		    expString = prefix .. trunc .. suffix .. "  |cffAAAAAA=|r  " .. calc
+		else
+			expString = prefix .. trunc .. suffix .. "  |cffAAAAAA/|r  " .. maxValue
+		end
+	end
+
+    return expString
 end

 local function FetchExperience()
@@ -110,6 +140,11 @@ local function FetchExperience()

 	return xp,mxp,exp,rxp
 end
+
+local function CacheRepData(data)
+	tinsert(data, {text = factionName, func = fn})
+	tsort(data, function(a,b) return a.text < b.text end)
+end
 --[[
 ##########################################################
 STANDARD TYPE
@@ -124,7 +159,12 @@ local Report = Reports:NewReport(REPORT_NAME, {

 Report.events = {"PLAYER_ENTERING_WORLD", "PLAYER_XP_UPDATE", "PLAYER_LEVEL_UP", "DISABLE_XP_GAIN", "ENABLE_XP_GAIN", "UPDATE_EXHAUSTION"};

+Report.OnClick = function(self, button)
+  SV.Dropdown:Open(self, self.InnerData, "Select Format")
+end
+
 Report.OnEvent = function(self, event, ...)
+	local subset = self.ExpKey or "XP";
 	if self.barframe:IsShown()then
 		self.text:SetAllPoints(self)
 		self.text:SetJustifyH("CENTER")
@@ -132,12 +172,13 @@ Report.OnEvent = function(self, event, ...)
 	end

 	local XP, maxXP, exhaust, remaining = FetchExperience();
-	local _, _, text, _ = FormatExp(XP, maxXP, remaining, exhaust);
+	local text = FormatExp(subset, XP, maxXP, remaining, exhaust);

 	self.text:SetText(text)
 end

 Report.OnEnter = function(self)
+	local subset = self.ExpKey or "XP";
 	Reports:SetDataTip(self)
 	local XP, maxXP, exhaust, remaining = FetchExperience();
 	Reports.ToolTip:AddLine(L["Experience"])
@@ -150,10 +191,12 @@ Report.OnEnter = function(self)
 		Reports.ToolTip:AddDoubleLine(L["XP:"], (" %d  /  %d (%d%%)"):format(XP, maxXP, calc1), 1, 1, 1)
 		Reports.ToolTip:AddDoubleLine(L["Remaining:"], (" %d (%d%% - %d "..L["Bars"]..")"):format(remaining, r_percent, r_bars), 1, 1, 1)
 		if(exhaust > 0) then
-			local _, calc2 = FormatExp(exhaust, maxXP);
-			Reports.ToolTip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", exhaust, calc2), 1, 1, 1)
+			local text = FormatExp(subset, exhaust, maxXP);
+			Reports.ToolTip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", exhaust, text), 1, 1, 1)
 		end
 	end
+	Reports.ToolTip:AddLine(" ")
+  	Reports.ToolTip:AddDoubleLine("[Click]", "Change XP Format", 0,1,0, 0.5,1,0.5)
 	Reports:ShowDataTip()
 end
 --[[
@@ -205,15 +248,58 @@ ReportBar.OnEnter = function(self)
 	Reports.ToolTip:AddLine(" ")

 	if((XP > 0) and (maxXP > 0)) then
+		local subset = self.ExpKey or "XP";
 		local calc1 = (XP / maxXP) * 100;
 		local r_percent = (remaining / maxXP) * 100;
 		local r_bars = r_percent / 5;
 		Reports.ToolTip:AddDoubleLine(L["XP:"], (" %d  /  %d (%d%%)"):format(XP, maxXP, calc1), 1, 1, 1)
 		Reports.ToolTip:AddDoubleLine(L["Remaining:"], (" %d (%d%% - %d "..L["Bars"]..")"):format(remaining, r_percent, r_bars), 1, 1, 1)
 		if(exhaust > 0) then
-			local _, calc2 = FormatExp(exhaust, maxXP);
-			Reports.ToolTip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", exhaust, calc2), 1, 1, 1)
+			local text = FormatExp(subset, exhaust, maxXP);
+			Reports.ToolTip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", exhaust, text), 1, 1, 1)
 		end
 	end
 	Reports:ShowDataTip()
 end
+
+Report.OnInit = function(self)
+  if(not self.InnerData) then
+    self.InnerData = {}
+  end
+
+  Reports:SetSubSettingsData('experience', 'table', {})
+
+  local key = self:GetName()
+
+  Reports.SubSettings["experience"][playerName][key] = Reports.SubSettings["experience"][playerName][key] or "XP";
+  self.ExpKey = Reports.SubSettings["experience"][playerName][key]
+
+  local fn1 = function()
+    Reports.SubSettings["experience"][playerName][key] = "XP";
+    self.ExpKey = "XP"
+    Report.OnEvent(self)
+  end
+
+  local fn2 = function()
+    Reports.SubSettings["experience"][playerName][key] = "XP_Percent";
+    self.ExpKey = "XP_Percent"
+    Report.OnEvent(self)
+  end
+
+  local fn3 = function()
+    Reports.SubSettings["experience"][playerName][key] = "Remaining";
+    self.ExpKey = "Remaining"
+    Report.OnEvent(self)
+  end
+
+  local fn4 = function()
+    Reports.SubSettings["experience"][playerName][key] = "Remaining_Percent";
+    self.ExpKey = "Remaining_Percent"
+    Report.OnEvent(self)
+  end
+
+  tinsert(self.InnerData, {text = "XP", func = fn1});
+  tinsert(self.InnerData, {text = "XP_Percent", func = fn2});
+  tinsert(self.InnerData, {text = "Remaining", func = fn3});
+  tinsert(self.InnerData, {text = "Remaining_Percent", func = fn4});
+end
\ No newline at end of file
diff --git a/SVUI_!Core/system/credits.lua b/SVUI_!Core/system/credits.lua
index 08efce6..755e2c4 100644
--- a/SVUI_!Core/system/credits.lua
+++ b/SVUI_!Core/system/credits.lua
@@ -73,14 +73,14 @@ SV.Credits["author"] = {
 };

 SV.Credits["council"] = {
-  "SINNISTERR",
-  "PENGUINSANE",
-  "BLOODEAGLE",
-  "HOTLUCK",
-  "CROMAX",
-  "DOONGA",
-  "DAIGAN",
-  "FAOLANKING"
+  "Sinnisterr",
+  "Penguinsane",
+  "BloodEagle",
+  "Hotluck",
+  "Cromax",
+  "Doonga",
+  "Daigan",
+  "FaolanKing"
 };

 SV.Credits["investors"] = {
@@ -89,7 +89,8 @@ SV.Credits["investors"] = {
   "BloodEagle", "Egbert", "Jerry Ferguson", "Hyti", "Elton",
   "James Watson", "Lathron", "Adam Vargas", "Daphne", "Dave (Naméra)",
   "Soulkrusher-Shu-Halo", "Talirrine", "Gaeline", "Malinche", "StealthyMangos",
-  "Monger", "JoeyMagz"
+  "Monger", "JoeyMagz",
+  "Cherep2267", "Ravensongs", "Huggiedabear", "Titatotemaar", "Mahga"
 };

 SV.Credits["contributors"] = {
@@ -247,9 +248,9 @@ end

 function SV:PrintCredits()
   local investors, contributors, community;
-  investors = concat(self.Credits["investors"]);
-  contributors = concat(self.Credits["contributors"]);
-  community = concat(self.Credits["community"]);
+  investors = concat(self.Credits["investors"], ", ");
+  contributors = concat(self.Credits["contributors"], ", ");
+  community = concat(self.Credits["community"], ", ");
   return PRINTED_TEMPLATE:format(investors, contributors, community)
 end

diff --git a/SVUI_!Core/system/reports.lua b/SVUI_!Core/system/reports.lua
index 494e898..318978f 100644
--- a/SVUI_!Core/system/reports.lua
+++ b/SVUI_!Core/system/reports.lua
@@ -666,6 +666,14 @@ function MOD:SetAccountantData(dataType, cacheType, defaultValue)
 	end
 end

+function MOD:SetSubSettingsData(dataType, cacheType, defaultValue)
+	self.SubSettings[dataType] = self.SubSettings[dataType] or {};
+	local cache = self.SubSettings[dataType];
+	if(not cache[playerName] or type(cache[playerName]) ~= cacheType) then
+		cache[playerName] = defaultValue;
+	end
+end
+
 function MOD:ReportAdded(event, dataName, dataObj, noupdate)
 	local t = dataObj.type
 	if(t) then
@@ -693,6 +701,10 @@ function MOD:Load()
 	accountant[playerRealm] = accountant[playerRealm] or {};
 	self.Accountant = accountant[playerRealm];

+	local subsettings = SVLib:NewGlobal("ReportSubSettings")
+	subsettings[playerRealm] = subsettings[playerRealm] or {};
+	self.SubSettings = subsettings[playerRealm];
+
 	--BOTTOM CENTER BARS
 	local bottomLeft = CreateFrame("Frame", "SVUI_ReportsGroup1", SV.Dock.BottomCenter)
 	bottomLeft:SetSize(dockWidth, dockHeight)
diff --git a/SVUI_!Options/UnitFrames.lua b/SVUI_!Options/UnitFrames.lua
index a5f4e23..215d7ab 100644
--- a/SVUI_!Options/UnitFrames.lua
+++ b/SVUI_!Options/UnitFrames.lua
@@ -646,7 +646,7 @@ function SVUIOptions:SetHealthConfigGroup(partyRaid, updateFunction, unitName, c
 						name = L["Coloring"],
 						type = "execute",
 						width = 'full',
-						func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "common", "allColorsGroup", "healthGroup") end
+						func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "healthGroup") end
 					},
 				}
 			}
@@ -795,7 +795,7 @@ function SVUIOptions:SetPowerConfigGroup(playerTarget, updateFunction, unitName,
 						name = L["Coloring"],
 						type = "execute",
 						width = 'full',
-						func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "common", "allColorsGroup", "powerGroup") end
+						func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "powerGroup") end
 					},
 				}
 			}
@@ -1749,7 +1749,7 @@ function SVUIOptions:SetAuraConfigGroup(isPlayer, auraType, unused, updateFuncti
 				configureButton1 = {
 					order = 2,
 					name = L["Coloring"],
-					type = "execute", func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "common", "allColorsGroup", "auraBars") end,
+					type = "execute", func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "auraBars") end,
 					disabled = function() return not SV.db.UnitFrames[unitName][auraType].useBars end,
 				},
 				configureButton2 = {
@@ -2561,9 +2561,22 @@ SV.Options.args[Schema] = {
 												MOD:RefreshAllUnitMedia()
 											end,
 										},
-										tapped = {
+										healthBackdrop = {
 											order = 4,
 											type = "color",
+											name = L["Health Backdrop"],
+											get = function(key)
+												local color = SV.media.extended.unitframes.healthBackdrop
+												return color[1],color[2],color[3]
+											end,
+											set = function(key, rValue, gValue, bValue)
+												SV.media.extended.unitframes.healthBackdrop = {rValue, gValue, bValue}
+												MOD:RefreshAllUnitMedia()
+											end,
+										},
+										tapped = {
+											order = 5,
+											type = "color",
 											name = L["Tapped"],
 											get = function(key)
 												local color = SV.media.extended.unitframes.tapped
@@ -2575,7 +2588,7 @@ SV.Options.args[Schema] = {
 											end,
 										},
 										disconnected = {
-											order = 5,
+											order = 6,
 											type = "color",
 											name = L["Disconnected"],
 											get = function(key)
diff --git a/SVUI_UnitFrames/Loader.lua b/SVUI_UnitFrames/Loader.lua
index f9e00a6..91c9731 100644
--- a/SVUI_UnitFrames/Loader.lua
+++ b/SVUI_UnitFrames/Loader.lua
@@ -19,6 +19,7 @@ local Schema = MOD.Schema;

 local unitframeColors = {
 	["health"]       = {0.3, 0.5, 0.3},
+	["healthBackdrop"] = {0.1, 0.1, 0.1},
 	["power"]        = {
 		["MANA"]         = {0.41, 0.85, 1},
 		["RAGE"]         = {1, 0.31, 0.31},
diff --git a/SVUI_UnitFrames/SVUI_UnitFrames.lua b/SVUI_UnitFrames/SVUI_UnitFrames.lua
index 017b1bd..477e2a1 100644
--- a/SVUI_UnitFrames/SVUI_UnitFrames.lua
+++ b/SVUI_UnitFrames/SVUI_UnitFrames.lua
@@ -1293,6 +1293,8 @@ function MOD:Load()

 	SV.Events:On("AURA_FILTER_OPTIONS_CHANGED", UpdateUnitFrames, true);

+	self:InitializeBodyGuard()
+
 	local rDebuffs = SV.oUF_RaidDebuffs or oUF_RaidDebuffs;
 	if not rDebuffs then return end
 	rDebuffs.ShowDispelableDebuff = true;
diff --git a/SVUI_UnitFrames/SVUI_UnitFrames.xml b/SVUI_UnitFrames/SVUI_UnitFrames.xml
index b5f66dc..c23c28e 100644
--- a/SVUI_UnitFrames/SVUI_UnitFrames.xml
+++ b/SVUI_UnitFrames/SVUI_UnitFrames.xml
@@ -138,4 +138,5 @@
     <Script file="frames.lua"/>
     <Script file="groups.lua"/>
     <Script file="view.lua"/>
+    <!-- <Script file="bodyguard.lua"/> -->
 </Ui>
\ No newline at end of file
diff --git a/SVUI_UnitFrames/bodyguard.lua b/SVUI_UnitFrames/bodyguard.lua
index c686c8f..dd2dbd3 100644
--- a/SVUI_UnitFrames/bodyguard.lua
+++ b/SVUI_UnitFrames/bodyguard.lua
@@ -330,7 +330,7 @@ function BodyGuard:IsValidZone()
 end

 function BodyGuard:IsShowing()
-  if(self.UF:IsShown() or self.combatEvent == self.showFrame) then
+  if(self.UF and (self.UF:IsShown() or self.combatEvent == self.showFrame)) then
     return true
   else
     return false
@@ -419,8 +419,8 @@ function BodyGuard:HealthUpdate(health, maxHealth)
   self.CurrentMaxHealth = maxHealth
 end

-function BodyGuard:Init(...)
-  self:UpdateFromBuilding()
+function MOD:InitializeBodyGuard()
+  BodyGuard:UpdateFromBuilding()

   local frame = CreateFrame("Button", "SVUI_BodyGuard", SV.Screen, "SecureActionButtonTemplate")
   frame:SetPoint("CENTER", SV.Screen, "CENTER")
@@ -447,23 +447,23 @@ function BodyGuard:Init(...)

   SV:NewAnchor(frame, L["BodyGuard Frame"])

-  local name = self:GetName()
+  local name = BodyGuard:GetName()
   frame:SetAttribute("type1", "macro")
   if name then
     frame:SetAttribute("macrotext1", "/targetexact " .. name)
   end

-  self.UF = frame
+  BodyGuard.UF = frame

-  self:HideFrame()
-  self.LoginHealth = true
+  BodyGuard:HideFrame()
+  BodyGuard.LoginHealth = true

-  if type(self.IsInValidZone) ~= "boolean" then
-    self.IsInValidZone = self:IsValidZone()
+  if type(BodyGuard.IsInValidZone) ~= "boolean" then
+    BodyGuard.IsInValidZone = BodyGuard:IsValidZone()
   end

-  if self.IsActive and self.IsInValidZone then
-    self:ShowFrame()
-    self:HealthUpdate(self.CurrentHealth, self.CurrentMaxHealth)
+  if BodyGuard.IsActive and BodyGuard.IsInValidZone then
+    BodyGuard:ShowFrame()
+    BodyGuard:HealthUpdate(BodyGuard.CurrentHealth, BodyGuard.CurrentMaxHealth)
   end
 end
diff --git a/SVUI_UnitFrames/libs/oUF/elements/health.lua b/SVUI_UnitFrames/libs/oUF/elements/health.lua
index 95e8faf..e78747f 100644
--- a/SVUI_UnitFrames/libs/oUF/elements/health.lua
+++ b/SVUI_UnitFrames/libs/oUF/elements/health.lua
@@ -93,10 +93,12 @@ local Update = function(self, event, unit)
 				local mu = bg.multiplier or 1
 				if(health.colorBackdrop and bgColors) then
 					r, g, b = bgColors[1], bgColors[2], bgColors[3]
-					bg:SetVertexColor(r * mu, g * mu, b * mu)
+				elseif(oUF.colors.healthBackdrop) then
+					r, g, b = unpack(oUF.colors.healthBackdrop)
 				else
-					bg:SetVertexColor(unpack(oUF.colors.health))
+					r, g, b = unpack(oUF.colors.health)
 				end
+				bg:SetVertexColor(r * mu, g * mu, b * mu)
 			end
 		end
 	end