Quantcast

Rewrote the caster name option to not require reload and some minor clean up.

Repooc [11-19-12 - 12:01]
Rewrote the caster name option to not require reload and some minor clean up.

Signed-off-by: Repooc <repooc@tukui.org>
Filename
ElvUI_SLE/config/profile.lua
ElvUI_SLE/config/sle_private.lua
ElvUI_SLE/modules/auras/auras.lua
ElvUI_SLE/modules/auras/load_auras.xml
ElvUI_SLE/modules/auras/options.lua
ElvUI_SLE/modules/load_modules.xml
ElvUI_SLE/modules/tooltip/load_tooltip.xml
ElvUI_SLE/modules/tooltip/options.lua
ElvUI_SLE/modules/tooltip/tooltip.lua
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index 10f3341..36f0aac 100644
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -44,6 +44,9 @@ P['sle'] = {
 			['pethide'] = true,
 		},
 	},
+
+	--Caster Name
+	['castername'] = false,

 	--Raid marks
 	['marks'] = {
diff --git a/ElvUI_SLE/config/sle_private.lua b/ElvUI_SLE/config/sle_private.lua
index d177d6b..0653ff6 100644
--- a/ElvUI_SLE/config/sle_private.lua
+++ b/ElvUI_SLE/config/sle_private.lua
@@ -1,11 +1,6 @@
 local E, L, V, P, G, _ =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB

 V['sle'] = {
-	--Auras Frame
-	['auras'] = {
-		['castername'] = false,
-	},
-
 	['dbm'] = {
 		['size'] = 10,
 	},
diff --git a/ElvUI_SLE/modules/auras/auras.lua b/ElvUI_SLE/modules/auras/auras.lua
deleted file mode 100644
index 3ac48f3..0000000
--- a/ElvUI_SLE/modules/auras/auras.lua
+++ /dev/null
@@ -1,51 +0,0 @@
-local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
-local A = E:GetModule('Auras');
-
-local auraCount = 0
-
-function A:addAuraSource(self, func, unit, index, filter)
-	local srcUnit = select(8, func(unit, index, filter))
-	if srcUnit then
-		if auraCount == 1 then
-			auraCount = 0
-			return
-		end
-		self:AddLine(" ")
-
-		local src = GetUnitName(srcUnit, true)
-		if srcUnit == "pet" or srcUnit == "vehicle" then
-			src = format("%s (%s)", src, GetUnitName("player", true))
-		else
-			local partypet = srcUnit:match("^partypet(%d+)$")
-			local raidpet = srcUnit:match("^raidpet(%d+)$")
-			if partypet then
-				src = format("%s (%s)", src, GetUnitName("party"..partypet, true))
-			elseif raidpet then
-				src = format("%s (%s)", src, GetUnitName("raid"..raidpet, true))
-			end
-		end
-
-		self:AddLine(src)
-		self:Show()
-		auraCount = 1
-	end
-end
-
-A.InitializeSLE = A.Initialize
-function A:Initialize()
-    A.InitializeSLE(self)
-
-	local funcs = {
-		SetUnitAura = UnitAura,
-		SetUnitBuff = UnitBuff,
-		SetUnitDebuff = UnitDebuff,
-	}
-
-	if E.private.sle.auras.castername then
-		for k, v in pairs(funcs) do
-			hooksecurefunc(GameTooltip, k, function(self, unit, index, filter)
-			A:addAuraSource(self, v, unit, index, filter)
-			end)
-		end
-	end
-end
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/auras/load_auras.xml b/ElvUI_SLE/modules/auras/load_auras.xml
deleted file mode 100644
index 8129c99..0000000
--- a/ElvUI_SLE/modules/auras/load_auras.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/">
-	<Button name='ElvUIAuraTemplate15' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='15' y='15'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Button name='ElvUIAuraTemplate20' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='20' y='20'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Button name='ElvUIAuraTemplate25' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='25' y='25'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Button name='ElvUIAuraTemplate30' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='30' y='30'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Button name='ElvUIAuraTemplate35' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='35' y='35'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Button name='ElvUIAuraTemplate40' inherits='SecureActionButtonTemplate' virtual='true'>
-		<Size x='40' y='40'/>
-		<Attributes>
-			<Attribute name='type' value='cancelaura'/>
-		</Attributes>
-		<Scripts>
-			<OnLoad>
-				self:RegisterForClicks('RightButtonUp')
-			</OnLoad>
-			<OnEnter>
-				GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', -5, -5)
-				if(self:GetAttribute'index') then
-					GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute("filter"))
-				elseif(self:GetAttribute'target-slot') then
-					GameTooltip:SetInventoryItem('player', self:GetID())
-				end
-			</OnEnter>
-			<OnLeave function='GameTooltip_Hide'/>
-		</Scripts>
-	</Button>
-	<Script file='auras.lua'/>
-	<Script file='options.lua'/>
-</Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/auras/options.lua b/ElvUI_SLE/modules/auras/options.lua
deleted file mode 100644
index b55e3d1..0000000
--- a/ElvUI_SLE/modules/auras/options.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
-local A = E:GetModule('Auras');
-
-E.Options.args.sle.args.auras = {
-	type = "group",
-	name = L["Auras"],
-	order = 5,
-	guiInline = true,
-	args = {
-		info = {
-			order = 1,
-			type = "description",
-			name = L["Options for customizing auras near the minimap."],
-		},
-		enable = {
-			order = 2,
-			type = "toggle",
-			name = L["Caster Name"],
-			desc = L["Enabling this will show caster name in the buffs and debuff icons."],
-			get = function(info) return E.private.sle.auras.castername end,
-			set = function(info, value) E.private.sle.auras.castername = value; E:StaticPopup_Show("PRIVATE_RL") end,
-		},
-	},
-}
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml
index e062936..cdde84d 100644
--- a/ElvUI_SLE/modules/load_modules.xml
+++ b/ElvUI_SLE/modules/load_modules.xml
@@ -10,6 +10,7 @@
 	<Include file='exprepbar\load_exprepbar.xml'/>
 	<Include file='marks\load_marks.xml'/>
 	<Include file='raidutility\load_raidutility.xml'/>
+	<Include file='tooltip\load_tooltip.xml'/>
 	<Include file='uibuttons\load_uibuttons.xml'/>
 	<Include file='unitframes\load_unitframes.xml'/>
 	<Script file='test.lua'/>
diff --git a/ElvUI_SLE/modules/tooltip/load_tooltip.xml b/ElvUI_SLE/modules/tooltip/load_tooltip.xml
new file mode 100644
index 0000000..0973922
--- /dev/null
+++ b/ElvUI_SLE/modules/tooltip/load_tooltip.xml
@@ -0,0 +1,4 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='tooltip.lua'/>
+	<Script file='options.lua'/>
+</Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/tooltip/options.lua b/ElvUI_SLE/modules/tooltip/options.lua
new file mode 100644
index 0000000..8dd0a09
--- /dev/null
+++ b/ElvUI_SLE/modules/tooltip/options.lua
@@ -0,0 +1,23 @@
+local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
+
+E.Options.args.sle.args.auras = {
+	type = "group",
+	name = L["Tooltip"],
+	order = 5,
+	guiInline = true,
+	args = {
+		info = {
+			order = 1,
+			type = "description",
+			name = L["Options for customizing auras near the minimap."],
+		},
+		enable = {
+			order = 2,
+			type = "toggle",
+			name = L["Caster Name"],
+			desc = L["Enabling this will show caster name in the buffs and debuff icons."],
+			get = function(info) return E.db.sle.castername end,
+			set = function(info, value) E.db.sle.castername = value; end,
+		},
+	},
+}
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/tooltip/tooltip.lua b/ElvUI_SLE/modules/tooltip/tooltip.lua
new file mode 100644
index 0000000..40128f0
--- /dev/null
+++ b/ElvUI_SLE/modules/tooltip/tooltip.lua
@@ -0,0 +1,79 @@
+local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
+local TT = E:GetModule('Tooltip');
+
+TT.InitializeSLE = TT.Initialize
+function TT:Initialize()
+	TT:InitializeSLE(self)
+
+	hooksecurefunc(GameTooltip, "SetUnitBuff", function(self,...)
+		local srcUnit = select(8,UnitBuff(...))
+		local src = GetUnitName(srcUnit, true)
+
+		if srcUnit == "pet" or srcUnit == "vehicle" then
+			src = format("%s (%s)", src, GetUnitName("player", true))
+		else
+			local partypet = srcUnit:match("^partypet(%d+)$")
+			local raidpet = srcUnit:match("^raidpet(%d+)$")
+
+			if partypet then
+				src = format("%s (%s)", src, GetUnitName("party"..partypet, true))
+			elseif raidpet then
+				src = format("%s (%s)", src, GetUnitName("raid"..raidpet, true))
+			end
+		end
+
+		if src and E.db.sle.castername then
+			self:AddLine("|cff1784d1"..src.."|r")
+			self:Show()
+			self.forceRefresh = true;
+		end
+	end)
+
+	hooksecurefunc(GameTooltip, "SetUnitDebuff", function(self,...)
+		local srcUnit = select(8,UnitDebuff(...))
+		local src = GetUnitName(srcUnit, true)
+
+		if srcUnit == "pet" or srcUnit == "vehicle" then
+			src = format("%s (%s)", src, GetUnitName("player", true))
+		else
+			local partypet = srcUnit:match("^partypet(%d+)$")
+			local raidpet = srcUnit:match("^raidpet(%d+)$")
+
+			if partypet then
+				src = format("%s (%s)", src, GetUnitName("party"..partypet, true))
+			elseif raidpet then
+				src = format("%s (%s)", src, GetUnitName("raid"..raidpet, true))
+			end
+		end
+
+		if src and E.db.sle.castername then
+			self:AddLine("|cff1784d1"..src.."|r")
+			self:Show()
+			self.forceRefresh = true;
+		end
+	end)
+
+	hooksecurefunc(GameTooltip, "SetUnitAura", function(self,...)
+		local srcUnit = select(8,UnitAura(...))
+		local src = GetUnitName(srcUnit, true)
+
+		if srcUnit == "pet" or srcUnit == "vehicle" then
+			src = format("%s (%s)", src, GetUnitName("player", true))
+		else
+			local partypet = srcUnit:match("^partypet(%d+)$")
+			local raidpet = srcUnit:match("^raidpet(%d+)$")
+
+			if partypet then
+				src = format("%s (%s)", src, GetUnitName("party"..partypet, true))
+			elseif raidpet then
+				src = format("%s (%s)", src, GetUnitName("raid"..raidpet, true))
+			end
+		end
+
+		if src and E.db.sle.castername then
+			self:AddLine("|cff1784d1"..src.."|r")
+			self:Show()
+			self.forceRefresh = true;
+		end
+	end)
+end
\ No newline at end of file