Quantcast

Added workaround to avoid that MasterPlan steals tooltip de facto

Alar of Daggerspine [11-24-14 - 20:35]
Added workaround to avoid that MasterPlan steals tooltip de facto
disabling GarrisonCommander

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
GarrisonCommander.lua
GarrisonCommander.toc
RelNotes.lua
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index b3074f9..9652ca4 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -77,7 +77,17 @@ function addon:GetDifficultyColor(perc)
 	end
 	return QuestDifficultyColors[difficulty]
 end
+function addon:RestoreTooltip()
+	local self = GMF.MissionTab.MissionList;
+	local scrollFrame = self.listScroll;
+	local buttons = scrollFrame.buttons;
+	for i =1,#buttons do
+		buttons[i]:SetScript("OnEnter",GarrisonMissionButton_OnEnter)
+	end
+	print ("Restoring tooltip")
+end
 function addon:TooltipAdder(missionID)
+	print("OnEnter called on button")
 --@debug@
 	GameTooltip:AddLine("ID:" .. tostring(missionID))
 --@end-debug@
@@ -242,6 +252,8 @@ function addon:TooltipAdder(missionID)
 		if (not rc) then print("Add",rc,code) end
 --@end-debug@
 	end
+	-- Add a signature
+	GameTooltip:AddDoubleLine("Tooltip enhancement","by GarrisonCommander",0,0,0,C:Silver())
 	self:DelTable(added)
 --@debug@
 	--DevTools_Dump(fellas)
@@ -279,7 +291,6 @@ end
 function addon:ADDON_LOADED(event,addon)
 	if (addon=="Blizzard_GarrisonUI") then
 		self:UnregisterEvent("ADDON_LOADED")
-		print("Enabled")
 		self:Init()
 	end
 end
@@ -344,7 +355,6 @@ function addon:preHookScript(frame,hook,method)
 	end
 end
 local hooks={
-	"GarrisonMissionList_Update",
 	"GarrisonMissionButton_OnEnter",
 	"GarrisonFollowerList_OnShow",
 }
@@ -361,6 +371,7 @@ function addon:Init()
 		self:ScheduleTimer("Init",2)
 		return
 	end
+	print("Enabled")
 	self:FillFollowersList()
 	self:CacheFollowers()
 --@debug@
@@ -371,6 +382,11 @@ function addon:Init()
 --@end-debug@
 	self:SecureHook("GarrisonMissionButton_AddThreatsToTooltip","TooltipAdder")
 	self:SecureHook("GarrisonFollowerList_UpdateFollowers","CacheFollowers")
+	if (IsAddOnLoaded("MasterPlan") or IsAddOnLoadOnDemand("MasterPlan")) then
+		-- I need to hook this function to restore tooltip handler disabled by MasterPlan
+		-- Bah!
+		self:SecureHook("GarrisonMissionList_Update","RestoreTooltip")
+	end
 	self:HookScript(GMFTab1,"OnClick","GarrisonMissionListTab_OnClick")
 	self:HookScript(GMFTab2,"OnClick","GarrisonMissionListTab_OnClick")
 --@debug@
diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc
index d7bb8d3..5dd8c72 100644
--- a/GarrisonCommander.toc
+++ b/GarrisonCommander.toc
@@ -4,7 +4,7 @@
 ## Notes-itIT: Ti aiuta a scegliere il giusto seguace per la giusta missione
 ## Author: Alar of Daggerspine
 ## Version: @project-version@ @project-abbreviated-hash@
-## X-Version: 1.1.0
+## X-Version: 1.1.1
 ## X-Revision: @project-abbreviated-hash@
 ## eMail: alar@aspide.it
 ## URL: http://wow.aspide.it
diff --git a/RelNotes.lua b/RelNotes.lua
index 76bfa10..354da43 100644
--- a/RelNotes.lua
+++ b/RelNotes.lua
@@ -21,6 +21,10 @@ GarrisonCommander adds to mission tooltips the following informations:
 # Improving selection of followers for missions
 ]])
 self:RelNotes(1,1,0,[[
+Fixed: Added workaround to avoid that MasterPlan steals tooltip de facto
+disabling GarrisonCommander
+]])
+self:RelNotes(1,1,0,[[
 Feature: Level added to follower line
 Feature: All counterd traits listed on the same line
 Feature: For "In mission" follower time letf is shown instead of "In mission"