Quantcast

5.2.15

Munglunch [11-18-14 - 21:14]
5.2.15
Filename
Interface/AddOns/SVUI/assets/artwork/Template/PLAYER-AFK.blp
Interface/AddOns/SVUI/framework/framework.lua
Interface/AddOns/SVUI/framework/widgets/widget_afk.lua
Interface/AddOns/SVUI/system/configs.lua
diff --git a/Interface/AddOns/SVUI/assets/artwork/Template/PLAYER-AFK.blp b/Interface/AddOns/SVUI/assets/artwork/Template/PLAYER-AFK.blp
new file mode 100644
index 0000000..452a517
Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Template/PLAYER-AFK.blp differ
diff --git a/Interface/AddOns/SVUI/framework/framework.lua b/Interface/AddOns/SVUI/framework/framework.lua
index 59d2a3b..e06c4fc 100644
--- a/Interface/AddOns/SVUI/framework/framework.lua
+++ b/Interface/AddOns/SVUI/framework/framework.lua
@@ -33,4 +33,5 @@ function SV:LoadFramework()
   self.Mentalo:Initialize();
 	self.Comix:Initialize();
 	self.GameMenu:Initialize();
+  -- self.AFK:Initialize();
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua b/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua
index 728ee42..16435a7 100644
--- a/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua
+++ b/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua
@@ -59,6 +59,7 @@ local function WatchAFKTime()
 end

 function SV.AFK:Toggle(enabled)
+	if(InCombatLockdown()) then return end
 	if(enabled) then
 		MoveViewLeftStart(CAMERA_SPEED);
 		self:Show();
@@ -74,14 +75,23 @@ function SV.AFK:Toggle(enabled)
 end

 local Activate = function(self)
-	if(not SV.db.general.afk) then
-		self:Toggle()
-		return
-	end
 	self:SetAlpha(1)
 	self.Model:SetAnimation(4)
 end

+local AFK_OnEvent = function(self, event)
+	if(event == "PLAYER_REGEN_DISABLED") then
+		self:RegisterEvent("PLAYER_REGEN_ENABLED", "OnEvent")
+		self:Toggle(false)
+	else
+		if(UnitIsAFK("player")) then
+			self:Toggle(true)
+		else
+			self:Toggle(false)
+		end
+	end
+end
+
 function SV.AFK:Initialize()
 	self:SetFrameLevel(0)
 	self:SetAllPoints(SV.Screen)
@@ -90,11 +100,13 @@ function SV.AFK:Initialize()
 	self.Model:SetCamDistanceScale(1.15)
 	self.Model:SetFacing(6)

-	-- local splash = self:CreateTexture(nil, "OVERLAY")
-	-- splash:SetSize(600, 300)
-	-- splash:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\SPLASH-BLACK")
-	-- splash:SetBlendMode("ADD")
-	-- splash:SetPoint("TOP", 0, 0)
+	local splash = self:CreateTexture(nil, "OVERLAY")
+	splash:SetSize(256,256)
+	splash:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Template\\PLAYER-AFK")
+	splash:SetBlendMode("ADD")
+	splash:SetPoint("CENTER", self.Model, "TOPRIGHT", 64, 0)

 	self:SetScript("OnShow", Activate)
+	self:RegisterEvent("PLAYER_FLAGS_CHANGED", AFK_OnEvent)
+	self:RegisterEvent("PLAYER_REGEN_DISABLED", AFK_OnEvent)
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/system/configs.lua b/Interface/AddOns/SVUI/system/configs.lua
index 061ccfd..73fbe7a 100644
--- a/Interface/AddOns/SVUI/system/configs.lua
+++ b/Interface/AddOns/SVUI/system/configs.lua
@@ -682,6 +682,7 @@ SV.configs["SVTip"] = {

 SV.configs["SVTools"] = {
 	["enable"] = true,
+	["garrison"] = true,
 	["professions"] = true,
 	["breakStuff"] = true,
 };