Quantcast

Added icons to tooltip lines

Alar of Daggerspine [11-20-14 - 09:10]
Added icons to tooltip lines
Added traits
Choosen hopefully cleaner color scheme

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
CHANGELOG.txt
GarrisonCommander.lua
RelNotes.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6b8f5ec..d8bcaaf 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,9 +1,7 @@
 = GarrisonCommander helps you when choosing the right follower for the right mission =
-== Description ==
-GarrisonCommander adds to mission tooltips the following informations:
-* base success chance
-* list of follower that have the necessary counters for the mission, with their status (on mission, available etc)
-
-== Future plans ==
-# Showing information in an overlay on mission buttons to have all needed information for all missions at a glance
-# Mission assign optimizer: I think I could also propone the best assignment to maximise your chances of success
+* 1.0.1
+Fixed: Follower info refresh should be now more reliable
+Feature: Mission panel is now movable
+Feature: Shows also countered traits( i.e. environmente/racial bonuses)
+Feature: Shows icon for trait or ability countered. Abilities are blue lines, traits orange lines
+* 1.0.0 First release
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index 75de59d..3598e81 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -14,9 +14,23 @@ ns.debugEnable('on')
 -----------------------------------------------------------------
 local followerIndexes
 local followers
+local GMF=GarrisonMissionFrame
+local GMFFollowers=GarrisonMissionFrameFollowers
+local GMFMissions=GarrisonMissionFrameMissions
+local GMFTab1=GarrisonMissionFrameTab1
+local GMFTab2=GarrisonMissionFrameTab2
 function addon:dump(...)
 	print("dump",...)
 end
+function addon:AddLine(icon,name,status,r,g,b,...)
+	local r2,g2,b2=C.Green()
+	if (status) then
+		r2,g2,b2=C.Red()
+	end
+	--GameTooltip:AddDoubleLine(name, status or AVAILABLE,r,g,b,r2,g2,b2)
+	--GameTooltip:AddTexture(icon)
+	GameTooltip:AddDoubleLine("|T" .. tostring(icon) .. ":0|t  " .. name, status or AVAILABLE,r,g,b,r2,g2,b2)
+end
 function addon:TooltipAdder(missionID)
 --@debug@
 	GameTooltip:AddLine("ID:" .. tostring(missionID))
@@ -36,8 +50,12 @@ function addon:TooltipAdder(missionID)
 	GameTooltip:AddLine(format(GARRISON_MISSION_PERCENT_CHANCE,perc),q.r,q.g,q.b)
 	GameTooltip:AddLine(GARRISON_FOLLOWER_CAN_COUNTER)
 	local buffed=self:NewTable()
+	local traited=self:NewTable()
 	for id,d in pairs(C_Garrison.GetBuffedFollowersForMission(missionID)) do
-		buffed[id]=true
+		buffed[id]=d
+	end
+	for id,d in pairs(C_Garrison.GetFollowersTraitsForMission(missionID)) do
+		traited[id]=d
 	end
 	local followerList=GarrisonMissionFrameFollowers.followersList
 	for j=1,#followerList do
@@ -46,10 +64,14 @@ function addon:TooltipAdder(missionID)
 		if (not follower.garrFollowerID) then return end
 		local b=buffed[follower.followerID]
 		if (b) then
-			if (follower.status) then
-				GameTooltip:AddDoubleLine(follower.name, follower.status or AVAILABLE,1,1,0,1,0,0)
-			else
-				GameTooltip:AddDoubleLine(follower.name, follower.status or AVAILABLE,1,1,0,0,1,0)
+			for _,ability in pairs(b) do
+				self:AddLine(ability.icon,follower.name,follower.status,C.Azure())
+			end
+		end
+		local t=traited[follower.followerID]
+		if (t) then
+			for _,ability in pairs(t) do
+				self:AddLine(ability.icon,follower.name,follower.status,C.Orange())
 			end
 		end
 	end
@@ -67,6 +89,7 @@ end
 function addon:OnInitialized()
 	self:FillFollowersList()
 	self:CacheFollowers()
+	self:loadHelp()
 end
 function addon:OnDisabled()
 	self:UnhookAll()
@@ -76,12 +99,104 @@ local hooks={
 	"GarrisonMissionButton_OnEnter",
 	"GarrisonFollowerList_OnShow",
 }
+function addon:GarrisonMissionListTab_OnClick(frame, button)
+	if (frame:GetID()==1) then
+		self:CacheFollowers()
+	end
+	self.hooks[frame].OnClick(frame)
+end
 function addon:OnEnabled()
-
 	for _,f in pairs(hooks) do
 		self[f]=function(...) debug(f,...) end
 		self:SecureHook(f,f)
 	end
 	self:SecureHook("GarrisonMissionButton_AddThreatsToTooltip","TooltipAdder")
 	self:SecureHook("GarrisonFollowerList_UpdateFollowers","CacheFollowers")
+	self:HookScript(GMFTab1,"OnClick","GarrisonMissionListTab_OnClick")
+	self:HookScript(GMFTab2,"OnClick","GarrisonMissionListTab_OnClick")
+	GMF:SetMovable(true)
+	GMF:RegisterForDrag("LeftButton")
+	GMF:SetScript("OnDragStart",function(self) self:StartMoving() end)
+	GMF:SetScript("OnDragStop",function(self) self:StopMovingOrSizing() end)
+end
+--@do-not-package@
+if (false) then
+	local ga=GarrisonMissionFrame
+	local gmm=GarrisonMissionFrameMissionsListScrollFrame
+	local gmf=GarrisonMissionFrameFollowersListScrollFrame
+	local gf=GarrisonMissionFrameFollowers
+	local gm=GarrisonMissionFrameMissions
+	local gfol=GarrisonMissionFrame.FollowerTab
+
+	if (not ga:IsMovable()) then
+
+		print(ga:GetWidth())
+	end
+	gm:ClearAllPoints()
+	gm:SetPoint("TOPRIGHT",ga,"TOPRIGHT",-30,-60)
+	gm:SetPoint("BOTTOMRIGHT",ga,"BOTTOMRIGHT",0,30)
+	gf:SetPoint("TOPLEFT",ga,"TOPLEFT",30,-60)
+	gf:SetPoint("BOTTOMLEFT",ga,"BOTTOMLEFT",0,60)
+	ga:SetHeight(800)
+
+	print(gm:GetName())
+	for i=1,gm:GetNumPoints() do
+		local a,f,r,x,y=gm:GetPoint(i)
+		print(a,f:GetName(),r,x,y)
+	end
+	print(gm:IsShown(),gm:GetWidth())
+	function GACTab(self)
+		print("Selected")
+		PlaySound("UI_Garrison_Nav_Tabs");
+		local id=self:GetID()
+		GarrisonMissionFrame_SelectTab(id);
+		if (id == 1)  then
+				ga:SetWidth(1600)
+				gm:SetWidth(890+1600-1250)
+				gf:Show()
+		else
+				ga:SetWidth(930)
+		end
+	end
+	function GACClick(self,button)
+		print(self:GetName(),self:GetID(),button)
+		if ( IsModifiedClick("CHATLINK") ) then
+				local missionLink = C_Garrison.GetMissionLink(self.info.missionID);
+				if (missionLink) then
+					ChatEdit_InsertLink(missionLink);
+				end
+				return;
+		end
+		if (self.info.inProgress) then
+				return;
+		end
+		GarrisonMissionList_Update();
+		PlaySound("UI_Garrison_CommandTable_SelectMission");
+		GarrisonMissionFrame.MissionTab.MissionList:Hide();
+		GarrisonMissionFrame.MissionTab.MissionPage:Show();
+		GarrisonMissionPage_ShowMission(self.info);
+		GarrisonMissionFrame.followerCounters = C_Garrison.GetBuffedFollowersForMission(self.info.missionID)
+		GarrisonMissionFrame.followerTraits = C_Garrison.GetFollowersTraitsForMission(self.info.missionID);
+		GarrisonFollowerList_UpdateFollowers(GarrisonMissionFrame.FollowerList);
+
+	end
+	for i=1,8 do
+		local gname="GarrisonMissionFrameMissionsListScrollFrameButton"..i
+		local gbutton=_G[gname]
+		gbutton:SetScript("OnClick",GACClick)
+		gbutton:SetWidth(1200)
+		gbutton:SetHeight(80)
+		print(gbutton:GetHeight())
+			local f1=CreateFrame("Frame",gname..'Follower2',gbutton,"GarrisonMissionPageFollowerTemplate")
+			f1:ClearAllPoints()
+			f1:SetPoint("TOPLEFT",gbutton,"TOPLEFT",500,-10)
+		gbutton.follower1=f1
+		local f2=CreateFrame("Frame",gname..'Follower2',gbutton,"GarrisonMissionPageFollowerTemplate")
+		gbutton.follower2=f2
+		f2:SetPoint("TOPLEFT",f1,"TOPRIGHT",10,0)
+		local f3=CreateFrame("Frame",gname..'Follower2',gbutton,"GarrisonMissionPageFollowerTemplate")
+		gbutton.follower3=f3
+		f3:SetPoint("TOPLEFT",f2,"TOPRIGHT",10,0)
+	end
 end
+--@end-do-not-package@
\ No newline at end of file
diff --git a/RelNotes.lua b/RelNotes.lua
index 019cf24..9b1f176 100644
--- a/RelNotes.lua
+++ b/RelNotes.lua
@@ -8,14 +8,23 @@ self:HF_Pre([[
 = GarrisonCommander helps you when choosing the right follower for the right mission =
 == Description ==
 GarrisonCommander adds to mission tooltips the following informations:
-* base success chance
+* makes mission panel movable (position NOT yet saved between sessions)
+* base success chance (does NOT account for followers)
 * list of follower that have the necessary counters for the mission, with their status (on mission, available etc)
+* both traits (orange lines) and abilities(blue lines) are shown
+* every follower line has now the icon for countered trait/ability

 == Future plans ==
 # Showing information in an overlay on mission buttons to have all needed information for all missions at a glance
 # Mission assign optimizer: I think I could also propone the best assignment to maximise your chances of success

 ]])
+self:RelNotes(1,0,1,[[
+Fixed: Follower info refresh should be now more reliable
+Feature: Mission panel is now movable
+Feature: Shows also countered traits( i.e. environmente/racial bonuses)
+Feature: Shows icon for trait or ability countered. Abilities are blue lines, traits orange lines
+]])
 self:RelNotes(1,0,0,[[
 Initial release
 ]])