Quantcast

updates

Steven Jackson [08-20-14 - 22:16]
updates
Filename
Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_TotemBars/oUF_TotemBars.lua
Interface/AddOns/SVUI/packages/stats/stats/guild.lua
Interface/AddOns/SVUI/packages/tip/SVTip.lua
Interface/AddOns/SVUI/packages/unit/resources/shaman.lua
Interface/AddOns/SVUI/scripts/misc.lua
diff --git a/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_TotemBars/oUF_TotemBars.lua b/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_TotemBars/oUF_TotemBars.lua
index 948541b..ccf7d29 100644
--- a/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_TotemBars/oUF_TotemBars.lua
+++ b/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_TotemBars/oUF_TotemBars.lua
@@ -11,55 +11,52 @@ oUF.colors.totems = {
 	[AIR_TOTEM_SLOT] = { 132/255, 056/255, 231/255 }
 }

-local total = 0
-local delay = 0.01
-local GetTotemInfo, SetValue, GetTime = GetTotemInfo, SetValue, GetTime
-local haveTotem, name, startTime, duration, totemIcon
+local GetTotemInfo, GetTime = GetTotemInfo, GetTime
 local priorities = SHAMAN_TOTEM_PRIORITIES or STANDARD_TOTEM_PRIORITIES
+
+local Totem_OnEnter = function(self)
+	if(not self:IsVisible()) then return end
+	GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
+	GameTooltip:SetTotem(self:GetID())
+end
+
+local Totem_OnLeave = function()
+	GameTooltip:Hide()
+end

 local Totem_OnUpdate = function(self, elapsed)
-	total = total + elapsed
-	if total >= delay then
-		total = 0
-		haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(self.ID)
-		if ((GetTime() - startTime) == 0) or (duration == 0) then
-			self:SetValue(0)
+	if not self.expirationTime then return end
+	self.elapsed = (self.elapsed or 0) + elapsed
+	if self.elapsed >= 0.5 then
+		local timeLeft = self.expirationTime - GetTime()
+		if timeLeft > 0 then
+			self:SetValue(timeLeft)
 		else
-			self:SetValue(1 - ((GetTime() - startTime) / duration))
+			self:SetScript("OnUpdate", nil)
 		end
 	end
 end

-local UpdateTotem = function(self, slot)
-	local totems = self.TotemBars
-	if(slot > MAX_TOTEMS or not priorities[slot]) then return end
-	local totem = totems[priorities[slot]]
-	if not totem then return end
-
-	haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(slot)
-	totem:SetValue(0)
-	totem.ID = slot
-
-	if(haveTotem) then
-		if(duration > 0) then
-			totem:SetValue(1 - ((GetTime() - startTime) / duration))
-			totem:SetScript("OnUpdate", Totem_OnUpdate)
-		else
-			totem:SetScript("OnUpdate",nil)
-			totem:SetValue(0)
-		end
-	else
-		totem:SetValue(0)
-	end
-end
-
 local Update = function(self, event)
 	local totems = self.TotemBars
-
 	if(totems.PreUpdate) then totems:PreUpdate() end
-
+	local haveTotem, name, start, duration, icon, timeLeft
 	for i = 1, MAX_TOTEMS do
-		UpdateTotem(self, i)
+		local totem = totems[priorities[i]]
+		if(totem) then
+			haveTotem, name, start, duration, icon = GetTotemInfo(i)
+			timeLeft = (start + duration) - GetTime()
+			totem:SetMinMaxValues(0,duration)
+
+			if(timeLeft > 0) then
+				totem.expirationTime = (start + duration)
+				totem:SetValue(timeLeft)
+				totem:SetScript('OnUpdate', UpdateBar)
+			else
+				totem:SetValue(0)
+				totem:SetScript('OnUpdate', nil)
+			end
+		end
 	end

 	if(totems.PostUpdate) then
@@ -79,8 +76,6 @@ local Enable = function(self)
 	local totems = self.TotemBars

 	if(totems) then
-		self:RegisterEvent('PLAYER_TOTEM_UPDATE', Path, true)
-
 		totems.__owner = self
 		totems.__map = { unpack(priorities) }
 		totems.ForceUpdate = ForceUpdate
@@ -88,8 +83,15 @@ local Enable = function(self)
 		for i = 1, MAX_TOTEMS do
 			local totem = totems[i]
 			totem:SetID(priorities[i])
+
+			if(totem:IsMouseEnabled()) then
+				totem:SetScript('OnEnter', Totem_OnEnter)
+				totem:SetScript('OnLeave', Totem_OnLeave)
+			end
 		end

+		self:RegisterEvent('PLAYER_TOTEM_UPDATE', Path, true)
+
 		TotemFrame.Show = TotemFrame.Hide
 		TotemFrame:Hide()

diff --git a/Interface/AddOns/SVUI/packages/stats/stats/guild.lua b/Interface/AddOns/SVUI/packages/stats/stats/guild.lua
index 2ee7e46..e7d2370 100644
--- a/Interface/AddOns/SVUI/packages/stats/stats/guild.lua
+++ b/Interface/AddOns/SVUI/packages/stats/stats/guild.lua
@@ -49,7 +49,6 @@ local playerRealm = GetRealmName();
 local StatEvents = {"PLAYER_ENTERING_WORLD","GUILD_ROSTER_UPDATE","GUILD_XP_UPDATE","PLAYER_GUILD_UPDATE","GUILD_MOTD"};

 local updatedString = "";
-local updatedString2 = "";
 local patternColor = SuperVillain:HexColor(0.75,0.9,1);
 local pattern1 = ("|cff%s%s"):format(patternColor, GUILD_EXPERIENCE_CURRENT);
 local pattern2 = ("|cff%s%s"):format(patternColor, GUILD_EXPERIENCE_DAILY);
@@ -198,7 +197,7 @@ local function Guild_OnEvent(self, event, ...)
 		GuildStatEventHandler[event](self, select(1, ...))
 		self.text:SetFormattedText(updatedString, #GuildStatMembers)
 	else
-		self.text:SetText(updatedString2)
+		self.text:SetText(L['No Guild'])
 	end
 end;

@@ -325,7 +324,6 @@ end;
 local GuildColorUpdate = function()
 	local hexColor = SuperVillain:HexColor("highlight");
 	updatedString = join("", GUILD, ": |cff", hexColor, "%d|r")
-	updatedString2 = join("|cff", hexColor, L['No Guild'])
 	if currentObject ~= nil then
 		Guild_OnEvent(currentObject, 'SVUI_COLOR_UPDATE')
 	end
diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua
index 0daa535..93b156c 100644
--- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua
+++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua
@@ -322,8 +322,8 @@ local function ShowInspectInfo(this,unit,unitLevel,r,g,b,iteration)
 		this:AddDoubleLine(L["Talent Specialization:"],GetTalentSpec(unit,true),nil,nil,nil,r,g,b)
 		this:AddDoubleLine(L["Item Level:"],floor(select(2,GetAverageItemLevel())),nil,nil,nil,1,1,1)
 	elseif inspectCache[guid] then
-		local talent=inspectCache[guid].talent;
-		local itemLevel=inspectCache[guid].itemLevel;
+		local talent = inspectCache[guid].talent;
+		local itemLevel = inspectCache[guid].itemLevel;
 		if GetTime() - inspectCache[guid].time > 900 or not talent or not itemLevel then
 			inspectCache[guid] = nil;
 			return ShowInspectInfo(this,unit,unitLevel,r,g,b,iteration+1)
@@ -331,7 +331,7 @@ local function ShowInspectInfo(this,unit,unitLevel,r,g,b,iteration)
 		this:AddDoubleLine(L["Talent Specialization:"],talent,nil,nil,nil,r,g,b)
 		this:AddDoubleLine(L["Item Level:"],itemLevel,nil,nil,nil,1,1,1)
 	else
-		if not inspectable or InspectFrame and InspectFrame:IsShown() then
+		if(not inspectable or (InspectFrame and InspectFrame:IsShown())) then
 			return
 		end
 		MOD.lastGUID = guid;
@@ -442,7 +442,7 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self)
 			lvlLine:SetFormattedText("|cff%02x%02x%02x%s|r %s |c%s%s|r", qColor.r * 255, qColor.g * 255, qColor.b * 255, unitLevel > 0 and unitLevel or SKULL_ICON, race or "", colors.colorStr, className)
 		end

-		if MOD.db.inspectInfo or isShiftKeyDown then
+		if(not IsAddOnLoaded("HealBot") and (MOD.db.inspectInfo or isShiftKeyDown)) then
 			ShowInspectInfo(self, unit, unitLevel, colors.r, colors.g, colors.b, 0)
 		end
 	else
diff --git a/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua b/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua
index a4f850a..aac7748 100644
--- a/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua
+++ b/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua
@@ -49,11 +49,13 @@ assert(oUF_SuperVillain, "SVUI was unable to locate oUF.")
 LOCALS
 ##########################################################
 ]]--
+local totemMax = MAX_TOTEMS
+local totemPriorities = SHAMAN_TOTEM_PRIORITIES or {1, 2, 3, 4};
 local totemTextures = {
-	[1] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-EARTH]],
-	[2] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-FIRE]],
-	[3] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-WATER]],
-	[4] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-AIR]],
+	[EARTH_TOTEM_SLOT] 	= [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-EARTH]],
+	[FIRE_TOTEM_SLOT] 	= [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-FIRE]],
+	[WATER_TOTEM_SLOT] 	= [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-WATER]],
+	[AIR_TOTEM_SLOT] 	= [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-AIR]],
 };
 --[[
 ##########################################################
@@ -62,10 +64,9 @@ POSITIONING
 ]]--
 local Reposition = function(self)
 	local db = MOD.db.player
-	local bar = self.TotemBars;
-	local max = self.MaxClassPower;
+	local bar = self.TotemBars
 	local size = db.classbar.height
-	local width = size * max;
+	local width = size * totemMax
 	bar.Holder:Size(width, size)
     if(not db.classbar.detachFromFrame) then
     	SuperVillain:ResetMovables(L["Classbar"])
@@ -77,7 +78,7 @@ local Reposition = function(self)

     bar:ClearAllPoints()
     bar:SetAllPoints(bar.Holder)
-	for i = 1, max do
+	for i = 1, totemMax do
 		bar[i]:ClearAllPoints()
 		bar[i]:SetHeight(size)
 		bar[i]:SetWidth(size)
@@ -95,18 +96,18 @@ SHAMAN
 ##########################################################
 ]]--
 function MOD:CreateClassBar(playerFrame)
-	local max = 4
 	local bar = CreateFrame("Frame",nil,playerFrame)
 	bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30)
-	for i=1, max do
+	for i=1, totemMax do
+		local iconfile = totemTextures[totemPriorities[i]]
 		bar[i] = CreateFrame("StatusBar",nil,bar)
-		bar[i]:SetStatusBarTexture(totemTextures[i])
+		bar[i]:SetStatusBarTexture(iconfile)
 		bar[i]:GetStatusBarTexture():SetHorizTile(false)
 		bar[i]:SetOrientation("VERTICAL")
 		bar[i].noupdate=true;
 		bar[i].backdrop = bar[i]:CreateTexture(nil,"BACKGROUND")
 		bar[i].backdrop:SetAllPoints(bar[i])
-		bar[i].backdrop:SetTexture(totemTextures[i])
+		bar[i].backdrop:SetTexture(iconfile)
 		bar[i].backdrop:SetDesaturated(true)
 		bar[i].backdrop:SetVertexColor(0.2,0.2,0.2,0.7)
 	end;
@@ -117,7 +118,7 @@ function MOD:CreateClassBar(playerFrame)
 	bar.Holder = classBarHolder
 	SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO")

-	playerFrame.MaxClassPower = max;
+	playerFrame.MaxClassPower = totemMax;
 	playerFrame.ClassBarRefresh = Reposition;
 	playerFrame.TotemBars = bar
 	return 'TotemBars'
diff --git a/Interface/AddOns/SVUI/scripts/misc.lua b/Interface/AddOns/SVUI/scripts/misc.lua
index eacb8af..1b60ba9 100644
--- a/Interface/AddOns/SVUI/scripts/misc.lua
+++ b/Interface/AddOns/SVUI/scripts/misc.lua
@@ -32,6 +32,7 @@ GET ADDON DATA
 ##########################################################
 ]]--
 local SuperVillain, L = unpack(select(2, ...));
+local toonclass = select(2, UnitClass('player'))
 --[[
 ##########################################################
 MERCHANT MAX STACK
@@ -382,35 +383,36 @@ TOTEMS
 ]]--
 local Totems = CreateFrame("Frame");
 local TotemBar;
+local priorities = STANDARD_TOTEM_PRIORITIES
+if(toonclass == "SHAMAN") then
+	priorities = SHAMAN_TOTEM_PRIORITIES
+end

 local Totems_OnEvent = function(self, event)
 	if not TotemBar then return end
 	local displayedTotems = 0;
-	for i=1,MAX_TOTEMS do
+	for i = 1, MAX_TOTEMS do
 		if TotemBar[i] then
 			local haveTotem, name, start, duration, icon = GetTotemInfo(i)
-			if haveTotem and icon and icon ~= '' then
+			if(haveTotem and icon and icon ~= "") then
 				TotemBar[i]:Show()
 				TotemBar[i].Icon:SetTexture(icon)
 				displayedTotems = displayedTotems + 1;
 				CooldownFrame_SetTimer(TotemBar[i].CD, start, duration, 1)
-				for i=1,MAX_TOTEMS do
-					if _G['TotemFrameTotem'..i..'IconTexture']:GetTexture()==icon then
-						_G['TotemFrameTotem'..i]:ClearAllPoints()
-						_G['TotemFrameTotem'..i]:SetParent(TotemBar[i].Anchor)
-						_G['TotemFrameTotem'..i]:SetAllPoints(TotemBar[i].Anchor)
-					end
+
+				local id = TotemBar[i]:GetID()
+				local blizztotem = _G["TotemFrameTotem"..id]
+				if(blizztotem) then
+					blizztotem:ClearAllPoints()
+					blizztotem:SetParent(TotemBar[i].Anchor)
+					blizztotem:SetAllPoints(TotemBar[i].Anchor)
 				end
 			else
 				TotemBar[i]:Hide()
 			end
 		end
 	end
-end
-
--- local Totem_OnClick = function(self)
--- 	_G["TotemFrameTotem"..self:GetID()]:Click("RightButton")
--- end
+end

 function SuperVillain:UpdateTotems()
 	local totemSize = self.db.system.totems.size;
@@ -455,49 +457,67 @@ function SuperVillain:UpdateTotems()
 	local tH = (totemGrowth == "HORIZONTAL" and tS2 or tS1);
 	TotemBar:Size(tW, tH);
 	Totems_OnEvent()
-end
+end
+
+local Totem_OnEnter = function(self)
+	if(not self:IsVisible()) then return end
+	GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
+	GameTooltip:SetTotem(self:GetID())
+end
+
+local Totem_OnLeave = function()
+	GameTooltip:Hide()
+end

 local function CreateTotemBar()
 	if(not SuperVillain.db.system.totems.enable) then return; end
 	local xOffset = SuperVillain.db.SVDock.dockLeftWidth + 12
 	TotemBar = CreateFrame("Frame", "SVUI_TotemBar", SuperVillain.UIParent)
 	TotemBar:SetPoint("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", xOffset, 40)
-	for i = 1, MAX_TOTEMS do
-		local totem = CreateFrame("Button", "TotemBarTotem"..i, TotemBar)
-		totem:SetID(i)
+	for i = 1, MAX_TOTEMS do
+		local id = priorities[i]
+		local totem = CreateFrame("Button", "TotemBarTotem"..id, TotemBar)
+		totem:SetID(id)
 		totem:SetButtonTemplate()
 		totem:Hide()
-		totem.Anchor = CreateFrame("Frame", nil, totem)
-		totem.Anchor:SetAlpha(0)
-		totem.Anchor:SetAllPoints()
+
 		totem.Icon = totem:CreateTexture(nil, "ARTWORK")
 		totem.Icon:FillInner()
 		totem.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
-		totem.CD = CreateFrame("Cooldown", "TotemBarTotem"..i.."Cooldown", totem, "CooldownFrameTemplate")
+		totem.CD = CreateFrame("Cooldown", "TotemBarTotem"..id.."Cooldown", totem, "CooldownFrameTemplate")
 		totem.CD:SetReverse(true)
 		totem.CD:FillInner()
 		SuperVillain:AddCD(totem.CD)
-		totem:EnableMouse(true)

-		local t = _G['TotemFrameTotem'..i]
-		t:ClearAllPoints()
-		t:SetParent(totem)
-		t:SetAllPoints(totem)
-		t:SetFrameLevel(totem:GetFrameLevel() + 1)
-		t:SetFrameStrata(totem:GetFrameStrata())
-		t:SetAlpha(0)
+		totem.Anchor = CreateFrame("Frame", nil, totem)
+		totem.Anchor:SetAllPoints()
+
+		totem:EnableMouse(true)
+		totem:SetScript('OnEnter', Totem_OnEnter)
+		totem:SetScript('OnLeave', Totem_OnLeave)
+
+		local blizztotem = _G["TotemFrameTotem"..id]
+		if(blizztotem) then
+			blizztotem:ClearAllPoints()
+			blizztotem:SetParent(totem.Anchor)
+			blizztotem:SetAllPoints(totem.Anchor)
+			blizztotem:SetFrameLevel(totem.Anchor:GetFrameLevel() + 1)
+			blizztotem:SetFrameStrata(totem.Anchor:GetFrameStrata())
+			blizztotem:SetAlpha(0)
+		end

 		TotemBar[i] = totem
 	end

 	hooksecurefunc("TotemFrame_Update", function()
 		for i=1, MAX_TOTEMS do
-			local t = _G['TotemFrameTotem'..i]
-			local slot = t.slot
+			local id = priorities[i]
+			local blizztotem = _G["TotemFrameTotem"..id]
+			local slot = blizztotem.slot

 			if slot and slot > 0 then
-				t:ClearAllPoints()
-				t:SetAllPoints(_G['TotemBarTotem'..i])
+				blizztotem:ClearAllPoints()
+				blizztotem:SetAllPoints(_G["TotemBarTotem"..id])
 			end
 		end
 	end)
@@ -509,9 +529,9 @@ local function CreateTotemBar()
 	Totems_OnEvent()
 	SuperVillain:UpdateTotems()
 	local frame_name;
-	if SuperVillain.class == "DEATHKNIGHT" then
+	if toonclass == "DEATHKNIGHT" then
 		frame_name = L["Ghoul Bar"]
-	elseif SuperVillain.class == "DRUID" then
+	elseif toonclass == "DRUID" then
 		frame_name = L["Mushroom Bar"]
 	else
 		frame_name = L["Totem Bar"]