Quantcast

Some catch up with Elv

Darthpred [01-02-13 - 15:00]
Some catch up with Elv
Filename
ElvUI_SLE/modules/chat/chat.lua
ElvUI_SLE/modules/datatexts/regen.lua
ElvUI_SLE/modules/datatexts/time.lua
ElvUI_SLE/modules/datatexts/version.lua
ElvUI_SLE/modules/unitframes/update_elements.lua
diff --git a/ElvUI_SLE/modules/chat/chat.lua b/ElvUI_SLE/modules/chat/chat.lua
index 67bd421..508184b 100644
--- a/ElvUI_SLE/modules/chat/chat.lua
+++ b/ElvUI_SLE/modules/chat/chat.lua
@@ -66,10 +66,10 @@ function CH:ChatEdit_AddHistory(editBox, line)
 			end
 		end

-		table.insert(ElvCharacterDB.ChatEditHistory, #ElvCharacterDB.ChatEditHistory + 1, line)
+		tinsert(ElvCharacterDB.ChatEditHistory, #ElvCharacterDB.ChatEditHistory + 1, line)
 		if #ElvCharacterDB.ChatEditHistory > E.db.chat.editboxhistory then
 			for i=1,(#ElvCharacterDB.ChatEditHistory - E.db.chat.editboxhistory) do
-				table.remove(ElvCharacterDB.ChatEditHistory, 1)
+				tremove(ElvCharacterDB.ChatEditHistory, 1)
 			end
 		end
 	end
@@ -118,9 +118,7 @@ function CH:PositionChat(override)
 		isDocked = chat.isDocked

 		if id > NUM_CHAT_WINDOWS then
-			if point == nil then
-				point = select(1, chat:GetPoint())
-			end
+			point = point or select(1, chat:GetPoint());
 			if select(2, tab:GetPoint()):GetName() ~= bg then
 				isDocked = true
 			else
diff --git a/ElvUI_SLE/modules/datatexts/regen.lua b/ElvUI_SLE/modules/datatexts/regen.lua
index ee75a4b..6493bb6 100644
--- a/ElvUI_SLE/modules/datatexts/regen.lua
+++ b/ElvUI_SLE/modules/datatexts/regen.lua
@@ -3,21 +3,21 @@ local DT = E:GetModule('DataTexts')

 local displayNumberString = ''
 local lastPanel;
+local join = string.join

 local function OnEvent(self, event, unit)
-	if event == "UNIT_AURA" and unit ~= 'player' then return end
-	lastPanel = self
-
 	local baseMR, castingMR = GetManaRegen()
 	if InCombatLockdown() then
 		self.text:SetFormattedText(displayNumberString, "MP5", castingMR*5)
 	else
 		self.text:SetFormattedText(displayNumberString, "MP5", baseMR*5)
 	end
+
+	lastPanel = self
 end

 local function ValueColorUpdate(hex, r, g, b)
-	displayNumberString = string.join("", "%s: ", hex, "%.2f|r")
+	displayNumberString = join("", "%s: ", hex, "%.2f|r")

 	if lastPanel ~= nil then
 		OnEvent(lastPanel)
diff --git a/ElvUI_SLE/modules/datatexts/time.lua b/ElvUI_SLE/modules/datatexts/time.lua
index 2028d81..c7cb8fe 100644
--- a/ElvUI_SLE/modules/datatexts/time.lua
+++ b/ElvUI_SLE/modules/datatexts/time.lua
@@ -7,11 +7,15 @@ P['datatexts'] = {
 	['lfrshow'] = 0,
 }

+local format = string.format
+local join = string.join
+local floor = math.floor
+
 local APM = { TIMEMANAGER_PM, TIMEMANAGER_AM }
 local europeDisplayFormat = '';
 local ukDisplayFormat = '';
-local europeDisplayFormat_nocolor = string.join("", "%02d", ":|r%02d")
-local ukDisplayFormat_nocolor = string.join("", "", "%d", ":|r%02d", " %s|r")
+local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d")
+local ukDisplayFormat_nocolor = join("", "", "%d", ":|r%02d", " %s|r")
 local timerLongFormat = "%d:%02d:%02d"
 local timerShortFormat = "%d:%02d"
 local lockoutInfoFormat = "|cffcccccc[%d%s]|r %s |cfff04000(%s/%s)|r"
@@ -24,9 +28,8 @@ local enteredFrame = false;

 local Update, lastPanel; -- UpValue
 local function ValueColorUpdate(hex, r, g, b)
-	europeDisplayFormat = string.join("", "%02d", hex, ":|r%02d")
-	ukDisplayFormat = string.join("", "", "%d", hex, ":|r%02d", hex, " %s|r")
-
+	europeDisplayFormat = join("", "%02d", hex, ":|r%02d")
+	ukDisplayFormat = join("", "", "%d", hex, ":|r%02d", hex, " %s|r")
 	if lastPanel ~= nil then
 		Update(lastPanel, 20000)
 	end
@@ -139,9 +142,9 @@ local function OnEnter(self)
 			else
 				local hour, min, sec = CalculateTimeLeft(startTime)
 				if hour > 0 then
-					startTime = string.format(timerLongFormat, hour, min, sec)
+					startTime = format(timerLongFormat, hour, min, sec)
 				else
-					startTime = string.format(timerShortFormat, min, sec)
+					startTime = format(timerShortFormat, min, sec)
 				end
 			end
 			GameTooltip:AddDoubleLine(format(formatBattleGroundInfo, localizedName), startTime, 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
@@ -206,9 +209,9 @@ local function OnEnter(self)
 	GameTooltip:AddLine(" ")
 	timeText = E.db.datatexts.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME
 	if AmPm == -1 then
-		GameTooltip:AddDoubleLine(timeText, string.format(europeDisplayFormat_nocolor, Hr, Min), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
+		GameTooltip:AddDoubleLine(timeText, format(europeDisplayFormat_nocolor, Hr, Min), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
 	else
-		GameTooltip:AddDoubleLine(timeText, string.format(ukDisplayFormat_nocolor, Hr, Min, APM[AmPm]), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
+		GameTooltip:AddDoubleLine(timeText, format(ukDisplayFormat_nocolor, Hr, Min, APM[AmPm]), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
 	end

 	GameTooltip:Show()
diff --git a/ElvUI_SLE/modules/datatexts/version.lua b/ElvUI_SLE/modules/datatexts/version.lua
index 9eea03f..31246ac 100644
--- a/ElvUI_SLE/modules/datatexts/version.lua
+++ b/ElvUI_SLE/modules/datatexts/version.lua
@@ -6,6 +6,7 @@ local SLE = E:GetModule('SLE')
 local displayString = '';
 local lastPanel;
 local self = lastPanel
+local join = string.join
 E.version = GetAddOnMetadata("ElvUI", "Version");

 local function OnEvent(self, event, ...)
@@ -28,7 +29,7 @@ local function OnEnter(self)
 end

 local function ValueColorUpdate(hex, r, g, b)
-	displayString = string.join("", "%s", hex, "%.2f|r", " : Shadow & Light Edit v", hex, "%.2f|r")
+	displayString = join("", "%s", hex, "%.2f|r", " : Shadow & Light Edit v", hex, "%.2f|r")

 	if lastPanel ~= nil then
 		OnEvent(lastPanel)
diff --git a/ElvUI_SLE/modules/unitframes/update_elements.lua b/ElvUI_SLE/modules/unitframes/update_elements.lua
index 2ee941c..31d586a 100644
--- a/ElvUI_SLE/modules/unitframes/update_elements.lua
+++ b/ElvUI_SLE/modules/unitframes/update_elements.lua
@@ -1,7 +1,6 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
 if not E.private.unitframe.enable then return end
 local UF = E:GetModule('UnitFrames');
-local LSM = LibStub("LibSharedMedia-3.0");

 --Replacement of text formats on unitframes.
 local styles = {
@@ -20,24 +19,22 @@ function E:GetFormattedTextSLE(style, min, max)
 	if max == 0 then max = 1 end

 	local useStyle = styles[style]
-
-	local percentValue = E:TrimFloatingPoint(min / max * 100)

 	if style == 'DEFICIT' then
 		local deficit = max - min
 		if deficit <= 0 then
 			return ''
 		else
-			return string.format(useStyle, deficit)
+			return format(useStyle, deficit)
 		end
 	elseif style == 'CURRENT' or ((style == 'CURRENT_MAX' or style == 'CURRENT_MAX_PERCENT' or style == 'CURRENT_PERCENT') and min == max) then
-			return string.format(styles['CURRENT'], min)
+			return format(styles['CURRENT'], min)
 	elseif style == 'CURRENT_MAX' then
-			return string.format(useStyle, min, max)
+			return format(useStyle, min, max)
 	elseif style == 'CURRENT_PERCENT' then
-			return string.format(useStyle, min, percentValue)
+			return format(useStyle, min, percentValue)
 	elseif style == 'CURRENT_MAX_PERCENT' then
-			return string.format(useStyle, min, max, percentValue)
+			return format(useStyle, min, max, percentValue)
 	end
 end

@@ -73,11 +70,7 @@ if E.myclass == "WARLOCK" then
 			end
 		end

-		local SPACING = 1
-		if db.classbar.fill == 'spaced' then
-			SPACING = 13
-		end
-
+		local SPACING = db.classbar.fill == 'spaced' and 13 or 1
 		for i = 1, maxBars do
 			self[i]:SetHeight(self:GetHeight())
 			self[i]:SetWidth((self:GetWidth() - (maxBars - 1)) / maxBars)