Quantcast

Last updates

Munglunch [11-18-14 - 16:55]
Last updates
Filename
Interface/AddOns/SVUI/packages/map/SVMap.lua
Interface/AddOns/SVUI/packages/tools/SVTools.lua
Interface/AddOns/SVUI/packages/tools/components/garrison.lua
Interface/AddOns/SVUI/system/configs.lua
Interface/AddOns/SVUI/system/media.lua
Interface/AddOns/SVUI/system/utilities.lua
Interface/BUTTONS/Thumbs.db
Interface/Characterframe/Thumbs.db
diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.lua b/Interface/AddOns/SVUI/packages/map/SVMap.lua
index 0047ba3..4bc3a65 100644
--- a/Interface/AddOns/SVUI/packages/map/SVMap.lua
+++ b/Interface/AddOns/SVUI/packages/map/SVMap.lua
@@ -59,8 +59,6 @@ local MMBHolder, MMBBar;

 local NewHook = hooksecurefunc
 local Initialized = false
-
-local GARRISON_ICON = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-GARRISON]];
 --[[
 ##########################################################
 DATA UPVALUES
@@ -86,34 +84,6 @@ SVUI_MinimapFrame:SetSize(MM_WIDTH, MM_HEIGHT)
 GENERAL HELPERS
 ##########################################################
 ]]--
-local function GetDockCooldown(itemID)
-	local start,duration = GetItemCooldown(itemID)
-	local expires = duration - (GetTime() - start)
-	if expires > 0.05 then
-		local timeLeft = 0;
-		local calc = 0;
-		if expires < 4 then
-			return format("|cffff0000%.1f|r", expires)
-		elseif expires < 60 then
-			return format("|cffffff00%d|r", floor(expires))
-		elseif expires < 3600 then
-			timeLeft = ceil(expires / 60);
-			calc = floor((expires / 60) + .5);
-			return format("|cffff9900%dm|r", timeLeft)
-		elseif expires < 86400 then
-			timeLeft = ceil(expires / 3600);
-			calc = floor((expires / 3600) + .5);
-			return format("|cff66ffff%dh|r", timeLeft)
-		else
-			timeLeft = ceil(expires / 86400);
-			calc = floor((expires / 86400) + .5);
-			return format("|cff6666ff%dd|r", timeLeft)
-		end
-	else
-		return "|cff6666ffReady|r"
-	end
-end
-
 --[[
  /$$$$$$$  /$$   /$$ /$$$$$$$$/$$$$$$$$/$$$$$$  /$$   /$$  /$$$$$$
 | $$__  $$| $$  | $$|__  $$__/__  $$__/$$__  $$| $$$ | $$ /$$__  $$
@@ -446,19 +416,6 @@ end
 HANDLERS
 ##########################################################
 ]]--
-local SetGarrisonTooltip = function(self)
-	local text1 = self:GetAttribute("tipText")
-	local text2 = self:GetAttribute("tipExtraText")
-	GameTooltip:AddDoubleLine("[Left-Click]", text1, 0, 1, 0, 1, 1, 1)
-	if InCombatLockdown() then return end
-	if(text2) then
-		local remaining = GetDockCooldown(110560)
-		GameTooltip:AddLine(" ", 1, 1, 1)
-		GameTooltip:AddDoubleLine("[Right Click]", text2, 0, 1, 0, 1, 1, 1)
-		GameTooltip:AddDoubleLine(L["Time Remaining"], remaining, 1, 1, 1, 0, 1, 1)
-	end
-end
-
 local MiniMap_MouseUp = function(self, btn)
 	local position = self:GetPoint()
 	if btn == "RightButton" then
@@ -718,31 +675,6 @@ function MOD:PLAYER_REGEN_DISABLED()
 	WorldMapFrameSizeDownButton:Disable()
 	WorldMapFrameSizeUpButton:Disable()
 end
-
-local function GarrisonButton_OnEvent(self, event, ...)
-    if (event == "GARRISON_HIDE_LANDING_PAGE") then
-        SVUI_Garrison:Hide();
-    elseif (event == "GARRISON_SHOW_LANDING_PAGE") then
-        SVUI_Garrison:Show();
-    elseif ( event == "GARRISON_BUILDING_ACTIVATABLE" ) then
-        SVUI_Garrison:StartAlert();
-    elseif ( event == "GARRISON_BUILDING_ACTIVATED" or event == "GARRISON_ARCHITECT_OPENED") then
-        SVUI_Garrison:StopAlert();
-    elseif ( event == "GARRISON_MISSION_FINISHED" ) then
-        SVUI_Garrison:StartAlert();
-    elseif ( event == "GARRISON_MISSION_NPC_OPENED" ) then
-        SVUI_Garrison:StopAlert();
-    elseif (event == "GARRISON_INVASION_AVAILABLE") then
-        SVUI_Garrison:StartAlert();
-    elseif (event == "GARRISON_INVASION_UNAVAILABLE") then
-        SVUI_Garrison:StopAlert();
-    elseif (event == "SHIPMENT_UPDATE") then
-        local shipmentStarted = ...;
-        if (shipmentStarted) then
-            SVUI_Garrison:StartAlert();
-        end
-    end
-end
 --[[
 ##########################################################
 BUILD FUNCTION / UPDATE
@@ -769,14 +701,6 @@ function MOD:ReLoad()
 	if(not SV.db.SVMap.enable) then return; end
 	self:RefreshMiniMap()
 	self:UpdateMinimapButtonSettings()
-	if(not SVUI_Garrison:GetAttribute("tipExtraText")) then
-		local garrisonStone = GetItemInfo(110560);
-		if(garrisonStone and type(garrisonStone) == "string") then
-			SVUI_Garrison:SetAttribute("tipExtraText", L["Garrison Hearthstone"])
-			SVUI_Garrison:SetAttribute("type2", "macro")
-			SVUI_Garrison:SetAttribute("macrotext", "/use [nomod] " .. garrisonStone)
-		end
-	end
 end

 function MOD:Load()
@@ -869,26 +793,6 @@ function MOD:Load()
 		MiniMapChallengeMode:Point("LEFT", mapHolder, "LEFT", 12, 0)
 	end)

-	local garrison = SV.Dock:SetDockButton("TopLeft", L["Garrison"], GARRISON_ICON, nil, "SVUI_Garrison", SetGarrisonTooltip, "SecureActionButtonTemplate")
-	garrison:SetAttribute("type1", "click")
-	garrison:SetAttribute("clickbutton", GarrisonLandingPageMinimapButton)
-
-	local garrisonStone = GetItemInfo(110560);
-	if(garrisonStone and type(garrisonStone) == "string") then
-		garrison:SetAttribute("tipExtraText", L["Garrison Hearthstone"])
-		garrison:SetAttribute("type2", "macro")
-		garrison:SetAttribute("macrotext", "/use [nomod] " .. garrisonStone)
-	end
-
-	GarrisonLandingPageMinimapButton:RemoveTextures()
-	GarrisonLandingPageMinimapButton:ClearAllPoints()
-	GarrisonLandingPageMinimapButton:SetAllPoints(garrison)
-	GarrisonLandingPageMinimapButton:SetNormalTexture("")
-	GarrisonLandingPageMinimapButton:SetPushedTexture("")
-	GarrisonLandingPageMinimapButton:SetHighlightTexture("")
-
-	GarrisonLandingPageMinimapButton:HookScript("OnEvent", GarrisonButton_OnEvent)
-
 	if FeedbackUIButton then
 		FeedbackUIButton:Die()
 	end
diff --git a/Interface/AddOns/SVUI/packages/tools/SVTools.lua b/Interface/AddOns/SVUI/packages/tools/SVTools.lua
index f079fd3..e96fb44 100644
--- a/Interface/AddOns/SVUI/packages/tools/SVTools.lua
+++ b/Interface/AddOns/SVUI/packages/tools/SVTools.lua
@@ -78,6 +78,11 @@ function MOD:PLAYER_REGEN_ENABLED()
 		self:UpdateProfessionTools()
 	end

+	if(self.GarrisonNeedsUpdate) then
+		self.GarrisonNeedsUpdate = nil;
+		self:UpdateGarrisonTool()
+	end
+
 	if(self.RaidLeaderNeedsUpdate) then
 		self.RaidLeaderNeedsUpdate = nil;
 		self:UpdateRaidLeader()
@@ -86,11 +91,13 @@ end

 function MOD:ReLoad()
 	self:UpdateProfessionTools()
+	self:UpdateGarrisonTool()
 	self:UpdateRaidLeader()
 end

 function MOD:Load()
 	self:LoadQuestWatch()
 	self:LoadProfessionTools()
+	self:LoadGarrisonTool()
 	self:LoadRaidLeaderTools()
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/packages/tools/components/garrison.lua b/Interface/AddOns/SVUI/packages/tools/components/garrison.lua
new file mode 100644
index 0000000..a6f1e2a
--- /dev/null
+++ b/Interface/AddOns/SVUI/packages/tools/components/garrison.lua
@@ -0,0 +1,216 @@
+--[[
+##############################################################################
+_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_       #
+ ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__      #
+  __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____     #
+   ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____    #
+    ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____   #
+     _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____  #
+      __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ #
+       _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_#
+        ___\///////////___________\///___________\/////////_____\///////////_#
+##############################################################################
+S U P E R - V I L L A I N - U I   By: Munglunch                              #
+##############################################################################
+##########################################################
+LOCALIZED LUA FUNCTIONS
+##########################################################
+]]--
+--[[ GLOBALS ]]--
+local _G = _G;
+local unpack        = _G.unpack;
+local select        = _G.select;
+local assert        = _G.assert;
+local type          = _G.type;
+local error         = _G.error;
+local pcall         = _G.pcall;
+local print         = _G.print;
+local ipairs        = _G.ipairs;
+local pairs         = _G.pairs;
+local tostring      = _G.tostring;
+local tonumber      = _G.tonumber;
+
+--STRING
+local string        = _G.string;
+local upper         = string.upper;
+local format        = string.format;
+local find          = string.find;
+local match         = string.match;
+local gsub          = string.gsub;
+--TABLE
+local table 		= _G.table;
+local tinsert       = _G.tinsert;
+local tremove       = _G.tremove;
+local twipe 		= _G.wipe;
+--MATH
+local math      	= _G.math;
+local min 			= math.min;
+local floor         = math.floor
+local ceil          = math.ceil
+--BLIZZARD API
+local GameTooltip          	= _G.GameTooltip;
+local InCombatLockdown     	= _G.InCombatLockdown;
+local CreateFrame          	= _G.CreateFrame;
+local GetTime         		= _G.GetTime;
+local GetItemCooldown       = _G.GetItemCooldown;
+local GetItemCount         	= _G.GetItemCount;
+local GetItemInfo          	= _G.GetItemInfo;
+local GetSpellInfo         	= _G.GetSpellInfo;
+local IsSpellKnown         	= _G.IsSpellKnown;
+local GetGarrison       	= _G.GetGarrison;
+local GetProfessionInfo    	= _G.GetProfessionInfo;
+local hooksecurefunc     	= _G.hooksecurefunc;
+--[[
+##########################################################
+ADDON
+##########################################################
+]]--
+local SV = select(2, ...)
+local L = SV.L
+
+local MOD = SV.SVTools;
+--[[
+##########################################################
+LOCALS
+##########################################################
+]]--
+local GARRISON_ICON = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-GARRISON]];
+
+local function GetDockCooldown(itemID)
+	local start,duration = GetItemCooldown(itemID)
+	local expires = duration - (GetTime() - start)
+	if expires > 0.05 then
+		local timeLeft = 0;
+		local calc = 0;
+		if expires < 4 then
+			return format("|cffff0000%.1f|r", expires)
+		elseif expires < 60 then
+			return format("|cffffff00%d|r", floor(expires))
+		elseif expires < 3600 then
+			timeLeft = ceil(expires / 60);
+			calc = floor((expires / 60) + .5);
+			return format("|cffff9900%dm|r", timeLeft)
+		elseif expires < 86400 then
+			timeLeft = ceil(expires / 3600);
+			calc = floor((expires / 3600) + .5);
+			return format("|cff66ffff%dh|r", timeLeft)
+		else
+			timeLeft = ceil(expires / 86400);
+			calc = floor((expires / 86400) + .5);
+			return format("|cff6666ff%dd|r", timeLeft)
+		end
+	else
+		return "|cff6666ffReady|r"
+	end
+end
+
+local function GarrisonButton_OnEvent(self, event, ...)
+    if (event == "GARRISON_HIDE_LANDING_PAGE") then
+        if(not InCombatLockdown()) then SVUI_Garrison:Hide() end;
+    elseif (event == "GARRISON_SHOW_LANDING_PAGE") then
+    	if(not InCombatLockdown()) then SVUI_Garrison:Show() end;
+    elseif ( event == "GARRISON_BUILDING_ACTIVATABLE" ) then
+        SVUI_Garrison:StartAlert();
+    elseif ( event == "GARRISON_BUILDING_ACTIVATED" or event == "GARRISON_ARCHITECT_OPENED") then
+        SVUI_Garrison:StopAlert();
+    elseif ( event == "GARRISON_MISSION_FINISHED" ) then
+        SVUI_Garrison:StartAlert();
+    elseif ( event == "GARRISON_MISSION_NPC_OPENED" ) then
+        SVUI_Garrison:StopAlert();
+    elseif (event == "GARRISON_INVASION_AVAILABLE") then
+        SVUI_Garrison:StartAlert();
+    elseif (event == "GARRISON_INVASION_UNAVAILABLE") then
+        SVUI_Garrison:StopAlert();
+    elseif (event == "SHIPMENT_UPDATE") then
+        local shipmentStarted = ...;
+        if (shipmentStarted) then
+            SVUI_Garrison:StartAlert();
+        end
+    end
+end
+
+local function getColoredString(text, color)
+	local hex = SV:HexColor(color)
+	return ("|cff%s%s|r"):format(hex, text)
+end
+
+local function GetActiveMissions()
+	GameTooltip:AddLine(" ", 1, 1, 1)
+	for key,data in pairs(C_Garrison.GetInProgressMissions()) do
+		local mission = ("%s - %s"):format(data.level, data.name);
+
+		local remaining
+		if (data.start == -1) then
+			remaining = ("~%s %s"):format(data.timeLeft, getColoredString("("..SV:ParseSeconds(data.duration)..")", "lightgrey"))
+		elseif (data.start == 0 or timeLeft < 0) then
+			remaining = L["Complete!"]
+		else
+			remaining = ("%s %s"):format(SV:ParseSeconds(timeLeft), getColoredString("("..SV:ParseSeconds(data.duration)..")", "lightgrey"))
+		end
+
+		GameTooltip:AddDoubleLine(mission, remaining, 0, 1, 0, 1, 1, 1)
+	end
+
+	-- for key,garrisonMission in pairs(C_Garrison.GetCompleteMissions()) do
+		-- DO STUFF
+	-- end
+end
+
+local SetGarrisonTooltip = function(self)
+	local text1 = self:GetAttribute("tipText")
+	local text2 = self:GetAttribute("tipExtraText")
+	GameTooltip:AddDoubleLine("[Left-Click]", text1, 0, 1, 0, 1, 1, 1)
+	if InCombatLockdown() then return end
+	if(text2) then
+		local remaining = GetDockCooldown(110560)
+		GameTooltip:AddLine(" ", 1, 1, 1)
+		GameTooltip:AddDoubleLine("[Right Click]", text2, 0, 1, 0, 1, 1, 1)
+		GameTooltip:AddDoubleLine(L["Time Remaining"], remaining, 1, 1, 1, 0, 1, 1)
+	end
+	--GetActiveMissions()
+end
+
+local function LoadToolBarGarrison()
+	if((not SV.db.SVTools.garrison) or MOD.GarrisonLoaded) then return end
+	if(InCombatLockdown()) then
+		MOD.GarrisonNeedsUpdate = true;
+		MOD:RegisterEvent("PLAYER_REGEN_ENABLED");
+		return
+	end
+
+	local garrison = SV.Dock:SetDockButton("TopLeft", L["Garrison"], GARRISON_ICON, nil, "SVUI_Garrison", SetGarrisonTooltip, "SecureActionButtonTemplate")
+	garrison:SetAttribute("type1", "click")
+	garrison:SetAttribute("clickbutton", GarrisonLandingPageMinimapButton)
+
+	local garrisonStone = GetItemInfo(110560);
+	if(garrisonStone and type(garrisonStone) == "string") then
+		garrison:SetAttribute("tipExtraText", L["Garrison Hearthstone"])
+		garrison:SetAttribute("type2", "macro")
+		garrison:SetAttribute("macrotext", "/use [nomod] " .. garrisonStone)
+	end
+
+	GarrisonLandingPageMinimapButton:RemoveTextures()
+	GarrisonLandingPageMinimapButton:ClearAllPoints()
+	GarrisonLandingPageMinimapButton:SetAllPoints(garrison)
+	GarrisonLandingPageMinimapButton:SetNormalTexture("")
+	GarrisonLandingPageMinimapButton:SetPushedTexture("")
+	GarrisonLandingPageMinimapButton:SetHighlightTexture("")
+
+	GarrisonLandingPageMinimapButton:HookScript("OnEvent", GarrisonButton_OnEvent)
+
+	MOD.GarrisonLoaded = true
+end
+--[[
+##########################################################
+BUILD/UPDATE
+##########################################################
+]]--
+function MOD:UpdateGarrisonTool()
+	if((not SV.db.SVTools.garrison) or self.GarrisonLoaded) then return end
+	LoadToolBarGarrison()
+end
+
+function MOD:LoadGarrisonTool()
+	if((not SV.db.SVTools.garrison) or self.GarrisonLoaded) then return end
+	SV.Timers:ExecuteTimer(LoadToolBarGarrison, 5)
+end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/system/configs.lua b/Interface/AddOns/SVUI/system/configs.lua
index 53e6b5b..061ccfd 100644
--- a/Interface/AddOns/SVUI/system/configs.lua
+++ b/Interface/AddOns/SVUI/system/configs.lua
@@ -105,7 +105,7 @@ SV.configs["media"] = {
     ["colors"] = {
         ["default"]      = {0.2, 0.2, 0.2, 1},
         ["special"]      = {0.37, 0.32, 0.29, 1},
-        ["specialdark"]      = {0.37, 0.32, 0.29, 1},
+        ["specialdark"]  = {0.37, 0.32, 0.29, 1},
     },
     ["unitframes"] = {
         ["health"]       = {0.3, 0.5, 0.3},
diff --git a/Interface/AddOns/SVUI/system/media.lua b/Interface/AddOns/SVUI/system/media.lua
index 193771a..2a651d9 100644
--- a/Interface/AddOns/SVUI/system/media.lua
+++ b/Interface/AddOns/SVUI/system/media.lua
@@ -152,6 +152,7 @@ do
     ["bizzaro"]     = {ir1, ig1, ib1, 1},
     ["dark"]        = {0, 0, 0, 1},
     ["light"]       = {0.95, 0.95, 0.95, 1},
+    ["lightgrey"]   = {0.32, 0.35, 0.38, 1},
     ["highlight"]   = {0.1, 0.8, 0.8, 1},
     ["green"]       = {0.25, 0.9, 0.08, 1},
     ["red"]         = {0.9, 0.08, 0.08, 1},
diff --git a/Interface/AddOns/SVUI/system/utilities.lua b/Interface/AddOns/SVUI/system/utilities.lua
index ad4cd0f..28fdc95 100644
--- a/Interface/AddOns/SVUI/system/utilities.lua
+++ b/Interface/AddOns/SVUI/system/utilities.lua
@@ -529,6 +529,35 @@ do
 end
 --[[
 ##########################################################
+TIME UTILITIES
+##########################################################
+]]--
+local SECONDS_PER_HOUR = 60 * 60
+local SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR
+
+function SV:ParseSeconds(seconds)
+    local negative = ""
+
+    if not seconds then
+        seconds = 0
+    end
+
+    if seconds < 0 then
+        negative = "-"
+        seconds = -seconds
+    end
+    local L_DAY_ONELETTER_ABBR = _G.DAY_ONELETTER_ABBR:gsub("%s*%%d%s*", "")
+
+    if not seconds or seconds >= SECONDS_PER_DAY * 36500 then -- 100 years
+        return ("%s**%s **:**"):format(negative, L_DAY_ONELETTER_ABBR)
+    elseif seconds >= SECONDS_PER_DAY then
+        return ("%s%d%s %d:%02d"):format(negative, seconds / SECONDS_PER_DAY, L_DAY_ONELETTER_ABBR, math.fmod(seconds / SECONDS_PER_HOUR, 24), math.fmod(seconds / 60, 60))
+    else
+        return ("%s%d:%02d:%02d"):format(negative, seconds / SECONDS_PER_HOUR, math.fmod(seconds / 60, 60), math.fmod(seconds, 60))
+    end
+end
+--[[
+##########################################################
 SIMPLE BUTTON CONSTRUCT
 ##########################################################
 ]]--
diff --git a/Interface/BUTTONS/Thumbs.db b/Interface/BUTTONS/Thumbs.db
deleted file mode 100644
index 9a524d6..0000000
Binary files a/Interface/BUTTONS/Thumbs.db and /dev/null differ
diff --git a/Interface/Characterframe/Thumbs.db b/Interface/Characterframe/Thumbs.db
new file mode 100644
index 0000000..e66b1c5
Binary files /dev/null and b/Interface/Characterframe/Thumbs.db differ