Quantcast

A few additions/changes in this one:

Safturento [12-26-11 - 16:59]
A few additions/changes in this one:
- Added datatext for experience/reputation
- Moved the map datatext points to align with the info left and info right panels
- Removed a few functions that were aparently implemented into default Tukui
- Added a 2 second delay on setting up chat to fix the issue where it would sometimes not reposition the frames

Hope you guys have a happy holiday!
Filename
SaftUI/SaftUI.toc
SaftUI/SaftUI.xml
SaftUI/config/config.lua
SaftUI/core/customconfig.lua
SaftUI/core/functions.lua
SaftUI/frames/datatext.lua
SaftUI/frames/killframes.lua
SaftUI/frames/moveframes.lua
SaftUI/modules/addonskins/skada.lua
SaftUI/modules/chat.lua
SaftUI/modules/datatext/experience.lua
SaftUI/modules/unitframes/groups/raid.lua
SaftUI/modules/unitframes/units/raid.lua
diff --git a/SaftUI/SaftUI.toc b/SaftUI/SaftUI.toc
index 32a2718..3e2b76c 100644
--- a/SaftUI/SaftUI.toc
+++ b/SaftUI/SaftUI.toc
@@ -1,6 +1,6 @@
 ## Interface: 40300
 ## Author: Safturento
-## Version: 0.1
+## Version: @project-version@
 ## Title: |cff00aaffSaftUI|r
 ## Notes: Saft's custom edit of Tukui
 ## RequiredDeps: Tukui
diff --git a/SaftUI/SaftUI.xml b/SaftUI/SaftUI.xml
index 072e89f..042a4c2 100644
--- a/SaftUI/SaftUI.xml
+++ b/SaftUI/SaftUI.xml
@@ -7,6 +7,7 @@
 	<Script file="modules\chat.lua"/>
 	<Include file="modules\unitframes\stUnitFrames.xml"/>
 	<Include file="modules\classbars\classbars.xml"/>
+	<Script file="modules\datatext\experience.lua"/>

 	<Script file="frames\reskinframes.lua"/>
 	<Script file="frames\killframes.lua"/>
diff --git a/SaftUI/config/config.lua b/SaftUI/config/config.lua
index bafb8ad..e8ff613 100644
--- a/SaftUI/config/config.lua
+++ b/SaftUI/config/config.lua
@@ -46,5 +46,9 @@ do
 end

 do
-	C.chat.rightLoot = false
+	C.chat.dockedLoot = true
+end
+
+do
+	C.datatext.exp = 7
 end
\ No newline at end of file
diff --git a/SaftUI/core/customconfig.lua b/SaftUI/core/customconfig.lua
new file mode 100644
index 0000000..e69de29
diff --git a/SaftUI/core/functions.lua b/SaftUI/core/functions.lua
index b7bc1e0..85db535 100644
--- a/SaftUI/core/functions.lua
+++ b/SaftUI/core/functions.lua
@@ -29,21 +29,6 @@ end
 -- General Functions ---------------------------------------------
 ------------------------------------------------------------------

-function T.fmtVal(v)
-	if v >= 1e6 then
-		return ("%.2fM"):format(v / 1e6):gsub("%.?0+([km])$", "%1")
-	elseif v >= 1e3 or v <= -1e3 then
-		return ("%.1fK"):format(v / 1e3):gsub("%.?0+([km])$", "%1")
-	else
-		return v
-	end
-end
-
-function T.round(number, decimals)
-	if not decimals then decimals = 0 end
-    return (("%%.%df"):format(decimals)):format(number)
-end
-
 function T.FormatTime(s)
 	local day, hour, minute = 86400, 3600, 60
 	if s >= day then
@@ -58,12 +43,6 @@ function T.FormatTime(s)
 	return format("%.1f", s)
 end

-function T.RGBToHex(r, g, b)
-	r = r <= 1 and r >= 0 and r or 0
-	g = g <= 1 and g >= 0 and g or 0
-	b = b <= 1 and b >= 0 and b or 0
-	return string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
-end

 function T.ColorGradient(perc, ...)
 	-- Translate divison by zeros into 0, so we don't blow select.
@@ -155,7 +134,7 @@ T.PostUpdateHealth = function(self, unit, min, max)
 			self.value:SetText("")
 		else
 			local r, g, b = oUF.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
-			self.value:SetFormattedText("|cff%02x%02x%02x%s|r", r*255, g*255, b*255, T.fmtVal(min))
+			self.value:SetFormattedText("|cff%02x%02x%02x%s|r", r*255, g*255, b*255, T.ShortValue(min))
 		end
 	end

@@ -201,7 +180,7 @@ T.PostUpdatePower = function(power, unit, min, max)
 		elseif min == max then
 			power.value:SetText("")
 		else
-			power.value:SetText(T.fmtVal(min))
+			power.value:SetText(T.ShortValue(min))
 		end
 	end

diff --git a/SaftUI/frames/datatext.lua b/SaftUI/frames/datatext.lua
index e31e00c..8b7794e 100644
--- a/SaftUI/frames/datatext.lua
+++ b/SaftUI/frames/datatext.lua
@@ -24,23 +24,42 @@ local datatext = {
 	"Regen",
 	"Talent",
 	"CallToArms",
+	"Experience",
 }

 local function SkinDataText()
+	local mmsLeft, mmsRight = false, false
 	for _, dt in pairs(datatext) do
-		local stat = _G["TukuiStat"..dt.."Text"]
+		local stat = _G["TukuiStat"..dt]
+		local text = _G["TukuiStat"..dt.."Text"]
 		if stat then
-			stat:SetFont(T.GetPixelFont())
+			local point = stat.Option
+			if point == 7 then mmsLeft = true end
+			if point == 8 then mmsRight = true end
+
+			text:SetFont(T.GetPixelFont())
 		end
 	end

+	if mmsLeft == false then
+		TukuiMinimapStatsRight:SetAllPoints(TukuiMinimapStatsLeft)
+		TukuiMinimapStatsLeft:Kill()
+	end
+
+	if mmsRight == false then
+		TukuiMinimapStatsRight:Kill()
+	end
+
+
+	TukuiMinimapStatsLeft:SetBackdrop(nil)
+	TukuiMinimapStatsRight:SetBackdrop(nil)
 	TukuiInfoLeft:SetBackdrop(nil)
 	TukuiInfoRight:SetBackdrop(nil)
 	TukuiInfoBackdrop = CreateFrame("Frame", "TukuiInfoBackdrop", UIParent)
 	TukuiInfoBackdrop:SetTemplate("Transparent")
 	TukuiInfoBackdrop:ThickBorder()
 	TukuiInfoBackdrop:SetPoint("TOPLEFT", TukuiInfoLeft)
-	TukuiInfoBackdrop:SetPoint("BOTTOMRIGHT", TukuiInfoRight)
+	TukuiInfoBackdrop:SetPoint("BOTTOMRIGHT", mmsRight and TukuiMinimapStatsRight or mmsLeft and TukuiMinimapStatsLeft or TukuiInfoRight)
 	TukuiInfoBackdrop:SetFrameStrata("BACKGROUND")
 	TukuiInfoBackdrop:SetFrameLevel(0)
 end
diff --git a/SaftUI/frames/killframes.lua b/SaftUI/frames/killframes.lua
index be1b200..46f3e13 100644
--- a/SaftUI/frames/killframes.lua
+++ b/SaftUI/frames/killframes.lua
@@ -10,8 +10,6 @@ local frames = {
 	TukuiLineToPetActionBarBackground,
 	TukuiCubeLeft,
 	TukuiCubeRight,
-	TukuiMinimapStatsLeft,
-	TukuiMinimapStatsRight,
 	TukuiExitVehicleButtonRight,
 	TukuiInfoLeftBattleGround,
 }
diff --git a/SaftUI/frames/moveframes.lua b/SaftUI/frames/moveframes.lua
index 2720b06..04b38b8 100644
--- a/SaftUI/frames/moveframes.lua
+++ b/SaftUI/frames/moveframes.lua
@@ -4,6 +4,8 @@ local frames = {
 	["TukuiRollAnchor"] = {"BOTTOM", TukuiChatBackgroundLeft or ChatFrame1, "TOP", 0, 5},
 	["TukuiInfoLeft"] = {"TOPLEFT", UIParent, "TOPLEFT", 6, -6},
 	["TukuiInfoRight"] = {"LEFT", TukuiInfoLeft, "RIGHT", 0, 0},
+	["TukuiMinimapStatsLeft"] = {"LEFT", TukuiInfoRight, "RIGHT", 0, 0},
+	["TukuiMinimapStatsRight"] = {"LEFT", TukuiMinimapStatsLeft, "RIGHT", 0, 0},
 	["TukuiTooltipAnchor"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0},
 	["TukuiBags"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6},
 }
diff --git a/SaftUI/modules/addonskins/skada.lua b/SaftUI/modules/addonskins/skada.lua
new file mode 100644
index 0000000..9a5ec62
--- /dev/null
+++ b/SaftUI/modules/addonskins/skada.lua
@@ -0,0 +1,11 @@
+local T, C, L = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
+
+if not IsAddOnLoaded("Skada") then return end
+if not C.general.skadareskin then return end
+
+local Skada = Skada
+local barmod = Skada.displays["bar"]
+
+hooksecurefunc(barmod, "ApplySettings", function(self, win)
+
+end)
\ No newline at end of file
diff --git a/SaftUI/modules/chat.lua b/SaftUI/modules/chat.lua
index 75f5874..029a4b3 100644
--- a/SaftUI/modules/chat.lua
+++ b/SaftUI/modules/chat.lua
@@ -6,14 +6,26 @@ local function SetupChat(self)

 	if C.chat.background then
 		local leftbg, rightbg = TukuiChatBackgroundLeft, TukuiChatBackgroundRight
-
+		local lefttab, righttab = TukuiTabsLeftBackground, TukuiTabsRightBackground
+
+		leftbg:ThickBorder()
+		lefttab:ThickBorder()
+
+		if C.chat.dockedLoot then
+			rightbg:SetBackdrop(nil)
+			righttab:SetBackdrop(nil)
+		else
+			rightbg:ThickBorder()
+			righttab:ThickBorder()
+		end
+
 		general:ClearAllPoints()
 		general:SetPoint("BOTTOMLEFT", leftbg, "BOTTOMLEFT", 6, 6)
-		general:SetPoint("TOPRIGHT", leftbg, "TOPRIGHT", 6, -32)
+		general:SetPoint("TOPRIGHT", leftbg, "TOPRIGHT", -6, -32)

 		loot:ClearAllPoints()
 		loot:SetPoint("BOTTOMLEFT", rightbg, "BOTTOMLEFT", 6, 6)
-		loot:SetPoint("TOPRIGHT", rightbg, "TOPRIGHT", 6, -32)
+		loot:SetPoint("TOPRIGHT", rightbg, "TOPRIGHT", -6, -32)

 		leftbg:ClearAllPoints()
 		leftbg:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6)
@@ -37,11 +49,19 @@ local function SetupChat(self)
 			editbox:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -10, 16)
 		end
 	end
+
+	if C.chat.dockedLoot then
+		FCF_DockFrame(loot)
+		loot:SetJustifyH("LEFT")
+	else
+		FCF_UnDockFrame(loot)
+		loot:SetJustifyH("RIGHT")
+	end
 end

 local OnLoad = CreateFrame("Frame")
 OnLoad:RegisterEvent("PLAYER_ENTERING_WORLD")
-OnLoad:SetScript("OnEvent", SetupChat)
+OnLoad:SetScript("OnEvent", function(self) T.Delay(2, SetupChat(self)) end)


 if true then return end --Leaving all of this code here to use for later, but stop the file execution right here.
diff --git a/SaftUI/modules/datatext/experience.lua b/SaftUI/modules/datatext/experience.lua
new file mode 100644
index 0000000..29e8d0b
--- /dev/null
+++ b/SaftUI/modules/datatext/experience.lua
@@ -0,0 +1,78 @@
+local T, C, L = unpack(Tukui) -- Import: T - functions, constants, variables; C - config; L - locales
+--------------------------------------------------------------------
+ -- experience
+--------------------------------------------------------------------
+if C["datatext"].exp and C["datatext"].exp > 0 then
+	local Stat = CreateFrame("Frame", "TukuiStatExperience")
+	Stat:EnableMouse(true)
+	Stat:SetFrameStrata("BACKGROUND")
+	Stat:SetFrameLevel(3)
+	Stat.Option = C.datatext.exp
+	Stat.Color1 = T.RGBToHex(unpack(C.media.datatextcolor1))
+	Stat.Color2 = T.RGBToHex(unpack(C.media.datatextcolor2))
+
+	local maxlvl = UnitLevel("player") == MAX_PLAYER_LEVEL
+
+	local Text  = Stat:CreateFontString("TukuiStatExperienceText", "OVERLAY")
+	Text:SetFont(C.media.font, C["datatext"].fontsize)
+	T.PP(C["datatext"].exp, Text)
+
+	local function OnEvent(self, event, ...)
+		maxlvl = UnitLevel("player") == MAX_PLAYER_LEVEL
+
+		if not maxlvl then
+			local currentXP, maxXP, restXP = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion()
+			local percentXP = T.Round((currentXP/maxXP)*100, 1)
+
+			Text:SetFormattedText('%s%%', percentXP)
+		elseif GetWatchedFactionInfo() then
+			local name, rank, minRep, maxRep, value = GetWatchedFactionInfo()
+			local percentRep = T.Round(value/(maxRep)*100, 1)
+			Text:SetFormattedText('%s%%', percentRep)
+		else
+			Text:SetText("-")
+		end
+
+		self:SetAllPoints(Text)
+	end
+
+	local function OnEnter(self)
+		if not InCombatLockdown() then
+			if maxlvl and not GetWatchedFactionInfo() then return end
+
+			local anchor, panel, xoff, yoff = T.DataTextTooltipAnchor(Text)
+			GameTooltip:SetOwner(panel, anchor, xoff, yoff)
+			GameTooltip:ClearLines()
+
+			if not maxlvl then
+				local currentXP, maxXP, restXP = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion()
+				local percentRestXP = GetXPExhaustion() and T.Round((GetXPExhaustion()/maxXP)*100, 1)
+				local percentXP = T.Round((currentXP/maxXP)*100, 1)
+
+				GameTooltip:AddDoubleLine("Current XP", currentXP)
+				GameTooltip:AddDoubleLine("Max XP", maxXP)
+				if restXP then GameTooltip:AddDoubleLine("Rested", "|cff3399ff"..restXP.."|r") end
+			end
+
+			if GetWatchedFactionInfo() then
+				if maxlvl then GameTooltip:AddLine("") end
+				local name, rank, minRep, maxRep, value = GetWatchedFactionInfo()
+				local percentRep = T.Round(value/(maxRep)*100, 1)
+				Text:SetFormattedText('%s%s%%|r', Stat.Color2, percentRep)
+			end
+
+
+			GameTooltip:Show()
+		end
+	end
+
+	local function OnLeave(self) GameTooltip:Hide() end
+
+	local events = { "PLAYER_ENTERING_WORLD","PLAYER_LEVEL_UP","PLAYER_XP_UPDATE","UPDATE_EXHAUSTION","UPDATE_FACTION","PLAYER_ENTERING_WORLD", "DISABLE_XP_GAIN", "ENABLE_XP_GAIN" }
+	for _,e in pairs(events) do
+		Stat:RegisterEvent(e)
+	end
+	Stat:SetScript("OnEvent", OnEvent)
+	Stat:SetScript("OnEnter", OnEnter)
+	Stat:SetScript("OnLeave", OnLeave)
+end
\ No newline at end of file
diff --git a/SaftUI/modules/unitframes/groups/raid.lua b/SaftUI/modules/unitframes/groups/raid.lua
deleted file mode 100644
index 0ebe145..0000000
--- a/SaftUI/modules/unitframes/groups/raid.lua
+++ /dev/null
@@ -1,38 +0,0 @@
--- raid editing guide by hydra/tukz
-
-local T, C, L = unpack(Tukui)
-if C["unitframes"].enable ~= true then return end
-
---------------------------------------------------------------
--- Edit Unit Raid Frames here!
---------------------------------------------------------------
--- 1 second delay before edited skin apply (can probably be a lower because 1 second is really too long, 0.1 or 0.2 should be the best, setting it to 1 was just for testing, CANNOT BE 0)
-local delay = 0.2
-local headers = {"TukuiRaid25", "TukuiRaid40", "TukuiRaidHealer15", "TukuiRaidHealerGrid"}
-local function ReskinFrame(frame, header)
-	for _, header in pairs(headers) do
-		if T.groupframefuncs[header] then
-			T.groupframefuncs[header](_G[header])
-		end
-	end
-end
-
-
-T.unitframefuncs = {}
-local function LoadUnitFrames(self)
-	--Only run this once
-	self:UnregisterAllEvents()
-	self:SetScript("OnEvent", nil)
-
-	for _, header in pairs(headers) do
-		if T.groupframefuncs[header] and _G[header] then
-			for _, frame in pairs({header:GetChildren()})
-				T.groupframefuncs[header](frame)
-			end
-		end
-	end
-end
-
-local UFLoader = CreateFrame("frame")
-UFLoader:RegisterEvent("PLAYER_ENTERING_WORLD")
-UFLoader:SetScript("OnEvent", LoadUnitFrames)
\ No newline at end of file
diff --git a/SaftUI/modules/unitframes/units/raid.lua b/SaftUI/modules/unitframes/units/raid.lua
deleted file mode 100644
index e69de29..0000000