Quantcast

nameplates testing

Steven Jackson [04-28-15 - 05:07]
nameplates testing
Filename
SVUI_!Core/system/core.lua
SVUI_!Core/system/layout.lua
SVUI_!Core/system/utilities.lua
SVUI_!Options/SVUI_!Options.lua
SVUI_NamePlates/SVUI_NamePlates.lua
SVUI_Skins/components/addons/Altoholic.lua
diff --git a/SVUI_!Core/system/core.lua b/SVUI_!Core/system/core.lua
index 8f557c4..7553e5c 100644
--- a/SVUI_!Core/system/core.lua
+++ b/SVUI_!Core/system/core.lua
@@ -247,6 +247,7 @@ SV.defaults           = {
         ["loginmessage"] = true,
         ["logincredits"] = true,
         ["cooldown"] = true,
+        ["useDraggable"] = true,
         ["saveDraggable"] = false,
         ["taintLog"] = false,
         ["stickyFrames"] = true,
diff --git a/SVUI_!Core/system/layout.lua b/SVUI_!Core/system/layout.lua
index dd3ad53..72a3d99 100644
--- a/SVUI_!Core/system/layout.lua
+++ b/SVUI_!Core/system/layout.lua
@@ -1283,29 +1283,31 @@ local function InitializeMovables()

 	Layout:Update()

-	if(not SV.private.Draggables) then SV.private.Draggables = {} end
+	if(SV.db.general.useDraggable) then
+		if(not SV.private.Draggables) then SV.private.Draggables = {} end

-	if(SV.db.general.saveDraggable) then
-		Dragger.Frames = SV.private.Draggables
-	else
-		Dragger.Frames = {}
-	end
+		if(SV.db.general.saveDraggable) then
+			Dragger.Frames = SV.private.Draggables
+		else
+			Dragger.Frames = {}
+		end

-	Dragger.EventsActive = true
+		Dragger.EventsActive = true

-	Dragger:RegisterEvent("ADDON_LOADED")
-	Dragger:RegisterEvent("LFG_UPDATE")
-	Dragger:RegisterEvent("ROLE_POLL_BEGIN")
-	Dragger:RegisterEvent("READY_CHECK")
-	Dragger:RegisterEvent("UPDATE_WORLD_STATES")
-	Dragger:RegisterEvent("WORLD_STATE_TIMER_START")
-	Dragger:RegisterEvent("WORLD_STATE_UI_TIMER_UPDATE")
+		Dragger:RegisterEvent("ADDON_LOADED")
+		Dragger:RegisterEvent("LFG_UPDATE")
+		Dragger:RegisterEvent("ROLE_POLL_BEGIN")
+		Dragger:RegisterEvent("READY_CHECK")
+		Dragger:RegisterEvent("UPDATE_WORLD_STATES")
+		Dragger:RegisterEvent("WORLD_STATE_TIMER_START")
+		Dragger:RegisterEvent("WORLD_STATE_UI_TIMER_UPDATE")

-	DraggerEventHandler(Dragger)
-	Dragger:SetScript("OnEvent", DraggerEventHandler)
+		DraggerEventHandler(Dragger)
+		Dragger:SetScript("OnEvent", DraggerEventHandler)

-	if(SV.db.general.saveDraggable) then
-		hooksecurefunc("UIParent_ManageFramePositions", _hook_UIParent_ManageFramePositions)
+		if(SV.db.general.saveDraggable) then
+			hooksecurefunc("UIParent_ManageFramePositions", _hook_UIParent_ManageFramePositions)
+		end
 	end
 end

diff --git a/SVUI_!Core/system/utilities.lua b/SVUI_!Core/system/utilities.lua
index 5ed8440..1e59f65 100644
--- a/SVUI_!Core/system/utilities.lua
+++ b/SVUI_!Core/system/utilities.lua
@@ -193,7 +193,7 @@ function SV:PlayerInfoUpdate()
             self.RoleChangedCallback()
         end
     end
-
+    SV.Events:Trigger("PLAYER_ROLE_CHANGED")
     self:GearSwap()
 end
 --[[
diff --git a/SVUI_!Options/SVUI_!Options.lua b/SVUI_!Options/SVUI_!Options.lua
index 3c0d31f..bc578d6 100644
--- a/SVUI_!Options/SVUI_!Options.lua
+++ b/SVUI_!Options/SVUI_!Options.lua
@@ -519,16 +519,24 @@ SV.Options.args.Core.args.mostCommon = {
 			get = function(j)return SV.db.general.logincredits end,
 			set = function(j,value)SV.db.general.logincredits = value end
 		},
-		saveDraggable = {
+		useDraggable = {
 			order = 3,
 			type = "toggle",
+			name = L["Enable Draggable"],
+			desc = L["Allow many default Blizzard frames to be draggable"],
+			get = function(j)return SV.db.general.useDraggable end,
+			set = function(j,value)SV.db.general.useDraggable = value; SV:StaticPopup_Show("RL_CLIENT") end
+		},
+		saveDraggable = {
+			order = 4,
+			type = "toggle",
 			name = L["Save Draggable"],
 			desc = L["Save the positions of draggable frames when they are moved. NOTE: THIS WILL OVERRIDE BLIZZARD FRAME SNAPPING!"],
 			get = function(j)return SV.db.general.saveDraggable end,
 			set = function(j,value)SV.db.general.saveDraggable = value; SV:StaticPopup_Show("RL_CLIENT") end
 		},
 		cooldownText = {
-			order = 4,
+			order = 5,
 			type = "toggle",
 			name = L['Cooldown Text'],
 			desc = L["Display cooldown text on anything with the cooldown spiral."],
@@ -536,7 +544,7 @@ SV.Options.args.Core.args.mostCommon = {
 			set = function(j,value)SV.db.general.cooldown = value; SV:StaticPopup_Show("RL_CLIENT")end
 		},
 		texture = {
-			order = 5,
+			order = 6,
 			type = "group",
 			name = L["Textures"],
 			guiInline = true,
@@ -565,7 +573,7 @@ SV.Options.args.Core.args.mostCommon = {
 			}
 		},
 		colors = {
-			order = 6,
+			order = 7,
 			type = "group",
 			name = L["Colors"],
 			guiInline = true,
@@ -622,7 +630,7 @@ SV.Options.args.Core.args.mostCommon = {
 			}
 		},
 		loot = {
-			order = 7,
+			order = 8,
 			type = "toggle",
 			name = L['Loot Frame'],
 			desc = L['Enable/Disable the loot frame.'],
@@ -630,7 +638,7 @@ SV.Options.args.Core.args.mostCommon = {
 			set = function(j,value)SV.db.general.loot = value;SV:StaticPopup_Show("RL_CLIENT")end
 		},
 		lootRoll = {
-			order = 8,
+			order = 9,
 			type = "toggle",
 			name = L['Loot Roll'],
 			desc = L['Enable/Disable the loot roll frame.'],
@@ -638,7 +646,7 @@ SV.Options.args.Core.args.mostCommon = {
 			set = function(j,value)SV.db.general.lootRoll = value;SV:StaticPopup_Show("RL_CLIENT")end
 		},
 		lootRollWidth = {
-			order = 9,
+			order = 10,
 			type = 'range',
 			width = "full",
 			name = L["Roll Frame Width"],
@@ -649,7 +657,7 @@ SV.Options.args.Core.args.mostCommon = {
 			set = function(a,b) SV.db.general.lootRollWidth = b; end,
 		},
 		lootRollHeight = {
-			order = 10,
+			order = 11,
 			type = 'range',
 			width = "full",
 			name = L["Roll Frame Height"],
diff --git a/SVUI_NamePlates/SVUI_NamePlates.lua b/SVUI_NamePlates/SVUI_NamePlates.lua
index 452e070..0febab2 100644
--- a/SVUI_NamePlates/SVUI_NamePlates.lua
+++ b/SVUI_NamePlates/SVUI_NamePlates.lua
@@ -195,37 +195,37 @@ local PLATE_REACTION_MAP = {
 	--PLAYER
 	{
 		['T'] = {
-			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token] end end,
 		},
 		['C'] = {
-			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token] end end,
 		},
 		['M'] = {
-			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+			function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token] end end,
 		}
 	},
 	--TAPPED
 	{
 		['T'] = {
-			function() return NPReactTap,1 end,
+			function() return NPReactTap end,
 		},
 		['C'] = {
-			function() return NPReactTap,1 end,
+			function() return NPReactTap end,
 		},
 		['M'] = {
-			function() return NPReactTap,1 end,
+			function() return NPReactTap end,
 		}
 	},
 	--FRIENDLY
 	{
 		['T'] = {
-			function() return NPReactNPCGood,1 end,
+			function() return NPReactNPCGood end,
 		},
 		['C'] = {
-			function() return NPReactNPCGood,1 end,
+			function() return NPReactNPCGood end,
 		},
 		['M'] = {
-			function() return NPReactNPCGood,1 end,
+			function() return NPReactNPCGood end,
 		}
 	},
 	--NEUTRAL
@@ -252,21 +252,21 @@ local PLATE_REACTION_MAP = {
 	--HOSTILE
 	{
 		['T'] = {
-			function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPBadThreat,NPThreatBS end end end,
+			function() if(not NPUseThreat or not InCombatLockdown()) then return NPReactEnemy else return NPBadThreat,NPThreatBS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodThreat,NPThreatGS end end,
 		},
 		['C'] = {
-			function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPGoodThreat,NPThreatGS end end end,
+			function() if(not NPUseThreat or not InCombatLockdown()) then return NPReactEnemy else return NPGoodThreat,NPThreatGS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadThreat,NPThreatBS end end,
 		},
 		['M'] = {
-			function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPGoodThreat,NPThreatGS end end end,
+			function() if(not NPUseThreat or not InCombatLockdown()) then return NPReactEnemy else return NPGoodThreat,NPThreatGS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
-			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
+			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatGS end end,
 			function() if(not NPUseThreat) then return NPReactEnemy else return NPBadThreat,NPThreatBS end end,
 		}
 	},
@@ -750,25 +750,25 @@ PLATE COLORING
 ##########################################################
 ]]--
 do
-	local function GetPlateThreatReaction(threat)
-		if threat:IsShown() then
-			local r, g, b = threat:GetVertexColor()
-			if g + b == 0 then
+	local function GetPlateThreatReaction(plate)
+		if plate.ref.threat:IsShown() then
+			local r, g, b = plate.ref.threat:GetVertexColor()
+			local lastThreat = plate.ref.reaction or 1
+			if g + b < 1 then
 				plate.ref.reaction = 4
 				return 4
 			else
-				if plate.ref.reaction == 4 then
+				if lastThreat > 2 then
 					plate.ref.reaction = 2
 					return 2
-				else
+				elseif lastThreat < 3 then
 					plate.ref.reaction = 3
 					return 3
 				end
 			end
-		else
-			plate.ref.reaction = 1
-			return 1
 		end
+		plate.ref.reaction = 1
+		return 1
 	end

 	local function GetPlateReaction(plate)
@@ -800,7 +800,7 @@ do
 		if (r + b + b) == 1.59 then
 			return PLATE_REACTION_MAP[2][NPClassRole][1]()
 		elseif g + b == 0 then
-			local threatReaction = GetPlateThreatReaction(plate.ref.threat)
+			local threatReaction = GetPlateThreatReaction(plate)
 			return PLATE_REACTION_MAP[5][NPClassRole][threatReaction]()
 		elseif r + b == 0 then
 			return PLATE_REACTION_MAP[3][NPClassRole][1]()
@@ -815,7 +815,6 @@ do

 	local function ColorizeAndScale(plate, frame)
 		local unitType = GetPlateReaction(plate)
-		local scale = 1

 		plate.setting.classToken = unitType

@@ -836,7 +835,7 @@ do
 		--frame.health.elite.bottom:SetVertexColor(r,g,b)
 		--frame.health.elite.right:SetVertexColor(r,g,b)
 		--frame.health.elite.left:SetVertexColor(r,g,b)
-
+		scale = scale or 1
 		if(not plate.setting.scaled and not plate.setting.tiny and frame.health:GetWidth() ~= (HBWidth * scale)) then
 			frame.health:SetSize(HBWidth * scale, HBHeight * scale)
 			local scaledIconSize = CBHeight + (HBHeight * scale) + 5;
@@ -1631,11 +1630,11 @@ function MOD:UpdateLocals()
 	end

 	if (db.comboPoints and (SV.class == 'ROGUE' or SV.class == 'DRUID')) then
-		self.UseCombo = true
-		self:RegisterEvent("UNIT_COMBO_POINTS")
+		MOD.UseCombo = true
+		MOD:RegisterEvent("UNIT_COMBO_POINTS")
 	else
-		self.UseCombo = false
-		self:UnregisterEvent("UNIT_COMBO_POINTS")
+		MOD.UseCombo = false
+		MOD:UnregisterEvent("UNIT_COMBO_POINTS")
 	end
 end

@@ -1678,4 +1677,5 @@ function MOD:Load()
 	self:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
 	WorldFrame:HookScript('OnUpdate', WorldFrameUpdateHook)
 	self:CombatToggle(true)
+	SV.Events:On("PLAYER_ROLE_CHANGED", MOD.UpdateLocals)
 end
diff --git a/SVUI_Skins/components/addons/Altoholic.lua b/SVUI_Skins/components/addons/Altoholic.lua
index 91d2cd1..8ddbbb5 100644
--- a/SVUI_Skins/components/addons/Altoholic.lua
+++ b/SVUI_Skins/components/addons/Altoholic.lua
@@ -1,7 +1,7 @@
 --[[
 ##########################################################
 S V U I   By: Munglunch
-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
@@ -13,8 +13,8 @@ local pairs 	= _G.pairs;
 local string 	= _G.string;
 --[[ STRING METHODS ]]--
 local format = string.format;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
@@ -22,8 +22,8 @@ local SV = _G['SVUI'];
 local L = SV.L;
 local MOD = SV.Skins;
 local Schema = MOD.Schema;
---[[
-##########################################################
+--[[
+##########################################################
 ALTOHOLIC
 ##########################################################
 ]]--
@@ -45,10 +45,12 @@ local function ApplyTextureStyle(self)
 	end
 end

+local AltoholicFrameStyled = false;
+
 local function StyleAltoholic(event, addon)
 	assert(AltoholicFrame, "AddOn Not Loaded")

-	if event == "PLAYER_ENTERING_WORLD" then
+	if not AltoholicFrameStyled then
 		SV.API:Set("Tooltip", AltoTooltip)

 		AltoholicFramePortrait:Die()
@@ -67,9 +69,10 @@ local function StyleAltoholic(event, addon)
 		AltoholicFrame_SearchEditBox:SetPoint("TOPLEFT", AltoholicFrame, "TOPLEFT", 37, -56)
 		AltoholicFrame_ResetButton:SetSize(85, 24)
 		AltoholicFrame_SearchButton:SetSize(85, 24)
+		AltoholicFrameStyled = true
 	end

-	if addon == "Altoholic_Summary" then
+	if IsAddOnLoaded("Altoholic_Summary") then
 		SV.API:Set("Frame", AltoholicFrameSummary)
 		SV.API:Set("Frame", AltoholicFrameBagUsage)
 		SV.API:Set("Frame", AltoholicFrameSkills)
@@ -80,7 +83,7 @@ local function StyleAltoholic(event, addon)
 		SV.API:Set("ScrollBar", AltoholicFrameActivityScrollFrameScrollBar)
 		SV.API:Set("DropDown", AltoholicTabSummary_SelectLocation, 200)

-		if(AltoholicFrameSummaryScrollFrame) then
+		if(AltoholicFrameSummaryScrollFrame) then
 			AltoholicFrameSummaryScrollFrame:RemoveTextures(true)
 		end

@@ -113,8 +116,8 @@ local function StyleAltoholic(event, addon)
 			SV.API:Set("Tab", _G["AltoholicFrameTab"..i], true)
 		end
 	end
-
-	if IsAddOnLoaded("Altoholic_Characters") or addon == "Altoholic_Characters" then
+
+	if IsAddOnLoaded("Altoholic_Characters") then
 		SV.API:Set("Frame", AltoholicFrameContainers)
 		SV.API:Set("Frame", AltoholicFrameRecipes)
 		SV.API:Set("Frame", AltoholicFrameQuests)
@@ -164,7 +167,7 @@ local function StyleAltoholic(event, addon)
 		end
 	end

-	if IsAddOnLoaded("Altoholic_Achievements") or addon == "Altoholic_Achievements" then
+	if IsAddOnLoaded("Altoholic_Achievements") then
 		SV.API:Set("!_Frame", AltoholicFrameAchievements)
 		AltoholicFrameAchievementsScrollFrame:RemoveTextures(true)
 		AltoholicAchievementsMenuScrollFrame:RemoveTextures(true)
@@ -187,7 +190,7 @@ local function StyleAltoholic(event, addon)
 		end
 	end

-	if IsAddOnLoaded("Altoholic_Agenda") or addon == "Altoholic_Agenda" then
+	if IsAddOnLoaded("Altoholic_Agenda") then
 		SV.API:Set("Frame", AltoholicFrameCalendarScrollFrame)
 		SV.API:Set("Frame", AltoholicTabAgendaMenuItem1)
 		SV.API:Set("ScrollBar", AltoholicFrameCalendarScrollFrameScrollBar)
@@ -200,7 +203,7 @@ local function StyleAltoholic(event, addon)
 		end
 	end

-	if IsAddOnLoaded("Altoholic_Grids") or addon == "Altoholic_Grids" then
+	if IsAddOnLoaded("Altoholic_Grids") then
 		AltoholicFrameGridsScrollFrame:RemoveTextures(true)
 		SV.API:Set("!_Frame", AltoholicFrameGrids)
 		SV.API:Set("ScrollBar", AltoholicFrameGridsScrollFrameScrollBar)
@@ -226,7 +229,7 @@ local function StyleAltoholic(event, addon)

 	end

-	if IsAddOnLoaded("Altoholic_Guild") or addon == "Altoholic_Guild" then
+	if IsAddOnLoaded("Altoholic_Guild") then
 		SV.API:Set("Frame", AltoholicFrameGuildMembers)
 		SV.API:Set("Frame", AltoholicFrameGuildBank)
 		SV.API:Set("ScrollBar", AltoholicFrameGuildMembersScrollFrameScrollBar)
@@ -251,7 +254,7 @@ local function StyleAltoholic(event, addon)
 		end
 	end

-	if IsAddOnLoaded("Altoholic_Search") or addon == "Altoholic_Search" then
+	if IsAddOnLoaded("Altoholic_Search") then
 		SV.API:Set("!_Frame", AltoholicFrameSearch)
 		AltoholicFrameSearchScrollFrame:RemoveTextures(true)
 		AltoholicSearchMenuScrollFrame:RemoveTextures(true)
@@ -276,4 +279,4 @@ local function StyleAltoholic(event, addon)
 	end
 end

-MOD:SaveAddonStyle("Altoholic", StyleAltoholic, nil, true)
\ No newline at end of file
+MOD:SaveAddonStyle("Altoholic", StyleAltoholic, false, true)