Quantcast

DeadlyWhispers update

Scott Sibley [08-07-10 - 11:08]
DeadlyWhispers update
Filename
Modules/DeadlyWhispers.lua
StarTip.lua
StarTip.toc
diff --git a/Modules/DeadlyWhispers.lua b/Modules/DeadlyWhispers.lua
index bb5750b..9c97913 100644
--- a/Modules/DeadlyWhispers.lua
+++ b/Modules/DeadlyWhispers.lua
@@ -1,6 +1,7 @@
-if not DBM then return end
+--if not DBM and not BigWigs then return end
 local mod = StarTip:NewModule("DeadlyWhispers")
-mod.name = "Who"
+mod.name = "DeadlyWhispers"
+mod.toggled = true
 mod.desc = "Show last DBM messages, such as whispers, announces, etc... You can filter out unwanted messages."

 local _G = _G
@@ -12,12 +13,29 @@ local self = mod

 local defaults = {
 	profile = {
-		watchList = {},
-		modifier = 1
+		delay = 3
 	}
 }

-local options = {}
+local options = {
+	delay = {
+		name = "Hide Delay",
+		desc = "Enter the time to delay before hiding DeadlyWhispers",
+		type = "input",
+		get = function()
+			return mod.db.profile.delay
+		end,
+		set = function(info, v)
+			mod.db.profile.delay = v
+		end,
+		pattern = "%d",
+		order = 5
+	}
+}
+
+local history = {}
+
+local messageFlag

 function mod:OnInitialize()
 	self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults)
@@ -25,16 +43,50 @@ function mod:OnInitialize()
 end

 function mod:OnEnable()
-	--StarTip:SecureHook(FriendsFrame, "Show", mod.FriendFrameShow)
+	if DBM then
+
+	elseif BigWigs then
+		local mod = BigWigs:GetBossModule(module)
+
+		local function NewBoss(module, ...)
+			local mod = BigWigs:GetBossModule(module)
+			-StarTip:SecureHook(mod, "DelayedMessage", function(key, delay, text, ...) tinsert(history, text) end)
+		end
+
+		StarTip:SecureHook(BigWigs, "NewBoss", NewBoss)
+	end
+
+	history[1] = "Test"
+	history[2] = "foo"
 end

 function mod:OnDisable()
+	local mod = BigWigs:GetBossModule(module)
+	StarTip:RemoveHook(mod, "DelayMessage")
 end

 function mod:GetOptions()
 	return options
 end

+local skip
+local function hideDW()
+	skip = true
+	GameTooltip:SetUnit("mouseover")
+	skip = nil
+end
+
 function mod:SetUnit()
+	if #history == 0 or skip then return end
+
+	if #history > 10 then
+		tremove(history, #history)
+	end
+	GameTooltip:ClearLines()
+	GameTooltip:AddLine("--- DeadlyWhispers ---")
+	for i = 1, #history do
+		GameTooltip:AddLine(history[i], 1, 1, 1)
+	end

+	StarTip:ScheduleTimer(hideDW, self.db.profile.delay)
 end
\ No newline at end of file
diff --git a/StarTip.lua b/StarTip.lua
index 5c068a9..d5d5bd3 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -1,4 +1,4 @@
-StarTip = LibStub("AceAddon-3.0"):NewAddon("StarTip", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0")
+StarTip = LibStub("AceAddon-3.0"):NewAddon("StarTip", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0")
 --local LibQTip = LibStub('LibQTip-1.0')
 local LibDBIcon = LibStub("LibDBIcon-1.0")
 local LSM = _G.LibStub("LibSharedMedia-3.0")
@@ -225,20 +225,21 @@ function StarTip:RebuildOpts()
 			args = nil
 		}

-		if v.toggled then
-			if v.GetOptions then
-				t = v:GetOptions()
-				t.optionsHeader = {
-					name = "Settings",
-					type = "header",
-					order = 3
-				}
-				if v:GetName() == "Bars" then
-					options.args.modules.args[v:GetName()].childGroups = "tab"
-				end
-			else
-				t = {}
+		if v.GetOptions then
+			t = v:GetOptions()
+			t.optionsHeader = {
+				name = "Settings",
+				type = "header",
+				order = 3
+			}
+			if v:GetName() == "Bars" then
+				options.args.modules.args[v:GetName()].childGroups = "tab"
 			end
+		else
+			t = {}
+		end
+
+		if v.toggled then
 			t.header = {
 				name = v.name,
 				type = "header",
@@ -259,11 +260,8 @@ function StarTip:RebuildOpts()
 				get = function() return self.db.profile.modules[k] == nil or self.db.profile.modules[k] end,
 				order = 2
 			}
-
-			options.args.modules.args[v:GetName()].args = t
-		else
-			options.args.modules.args[v:GetName()] = nil
 		end
+		options.args.modules.args[v:GetName()].args = t
 	end
 end

diff --git a/StarTip.toc b/StarTip.toc
index e04747f..ae84898 100644
--- a/StarTip.toc
+++ b/StarTip.toc
@@ -24,4 +24,5 @@ Modules\RaidIcon.lua
 Modules\Targeting.lua
 Modules\Text.lua
 Modules\Talents.lua
+Modules\DeadlyWhispers.lua