Quantcast

Fix: In Mission Control, some mission where checed against a wrong

Alar of Daggerspine [02-26-15 - 00:26]
Fix: In Mission Control, some mission where checed against a wrong
chance percent
Fix: some clashes with MP. Now all follower button data are optional

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
FollowerCache.lua
GarrisonCommander.lua
MatchMaker.lua
MissionCache.lua
MissionCompletion.lua
MissionControl.lua
diff --git a/FollowerCache.lua b/FollowerCache.lua
index ff9f9df..97fa23d 100644
--- a/FollowerCache.lua
+++ b/FollowerCache.lua
@@ -90,7 +90,10 @@ function addon:GetFollowerData(followerID,key,default)
 	local idx=keyToIndex(followerID)
 	local follower=Mbase.followers[idx]
 	if (not follower) then
-		ns.dprint("Not found",followerID,key,"at",idx,"len",#Mbase.followers)
+--@debug@
+		ns.xprint("Not found",followerID,key,"at",idx,"len",#Mbase.followers)
+		print(debugstack())
+--@end-debug#
 	end
 	if (key==nil) then
 		return follower
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index 413b4c1..b5c1c48 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -405,6 +405,8 @@ function addon:OnInitialized()
 	self:AddSlider("MAXMISSIONS",5,1,8,L["Mission shown for follower"],nil,1)
 	self:AddSlider("MINPERC",50,0,100,L["Minimun chance success under which ignore missions"],nil,5)
 	self:AddToggle("ILV",true,L["Show weapon/armor level"],L["When checked, show on each follower button weapon and armor level for maxed followers"])
+	self:AddToggle("IXP",true,L["Show xp to next level"],L["When checked, show on each follower button missing xp to next level"])
+	self:AddToggle("STP",true,L["Show time left"],L["When checked, show on each follower button time left for on mission followers"])
 	--self:AddPrivateAction("ShowMissionControl",L["Mission control"],L["You can choose some criteria and have GC autosumbit missions for you"])
 --@debug@
 	self:AddLabel("Developers options")
@@ -1249,10 +1251,13 @@ function addon:GenerateMissionButton()
 			local frame=self.frame
 			frame.info=nil
 			frame:SetHeight(self.type==Type1 and 80 or 80)
-			self.frame:SetAlpha(1)
-			self.frame:Enable()
+			frame:SetAlpha(1)
+			frame:Enable()
 			for i=1,#self.scripts do
-				self.frame:SetScript(self.scripts[i],nil)
+				frame:SetScript(self.scripts[i],nil)
+			end
+			for i=1,#frame.Rewards do
+				frame.Rewards[i].Icon:SetDesaturated(false)
 			end
 			wipe(self.scripts)
 			return self.frame:SetScale(1.0)
@@ -1612,45 +1617,44 @@ function addon:RenderFollowerPageFollowerButton(frame,follower,showCounters)
 	if not frame.GCIt then
 		frame.GCIt=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
 		frame.GCIt:SetPoint("BOTTOMLEFT",frame.Name,"TOPLEFT",0,2)
-		if not MP then
-			frame.GCTime=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
-			frame.GCTime:SetPoint("TOPLEFT",frame.Status,"TOPRIGHT",5,0)
-			frame.GCXp=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
-		end
+		frame.GCTime=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
+		frame.GCTime:SetPoint("TOPLEFT",frame.Status,"TOPRIGHT",5,0)
+		frame.GCXp=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
 	end
 	if not frame.isCollected then
-		if not MP then
-			frame.GCTime:Hide()
-			frame.GCXp:Hide()
-		end
+		frame.GCTime:Hide()
+		frame.GCXp:Hide()
 		frame.GCIt:Hide()
 		return
 	end
-	if not MP then
+	if self:GetToggle("IST") then
 		if (frame.Status:GetText() == GARRISON_FOLLOWER_ON_MISSION) then
 			frame.GCTime:SetText(self:GetFollowerStatus(follower.followerID,true,true))
 			frame.GCTime:Show()
 		else
 			frame.GCTime:Hide()
 		end
-		if (follower.level >= GARRISON_FOLLOWER_MAX_LEVEL and follower.quality >= GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY) then
-			frame.GCXp:Hide()
-		else
+	end
+	if self:GetToggle("IXP") then
+		if (follower.level < GARRISON_FOLLOWER_MAX_LEVEL or follower.quality < GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY) then
 			frame.GCXp:SetFormattedText(L["To go: %d"],follower.levelXP-follower.xp)
 			frame.GCXp:Show()
+		else
+			frame.GCXp:Hide()
 		end
 	end
-	if (follower.level >= GARRISON_FOLLOWER_MAX_LEVEL and self:GetToggle("ILV") ) then
-		local c1=ITEM_QUALITY_COLORS[follower.weaponQuality or 1]
-		local c2=ITEM_QUALITY_COLORS[follower.armorQuality or 1]
-		frame.GCIt:SetFormattedText("W:%s%3d|r A:%s%3d|r",c1.hex,self:GetFollowerData(follower.followerID,"weaponItemLevel"),c2.hex,self:GetFollowerData(follower.followerID,"armorItemLevel"))
-		frame.GCIt:Show()
-		frame.GCXp:SetPoint("LEFT",frame.GCIt,"RIGHT",2,0)
-	else
-		frame.GCIt:Hide()
-		frame.GCXp:SetPoint("LEFT",frame.Name,"LEFT",0,20)
+	if self:GetToggle("ILV") then
+		if (follower.level >= GARRISON_FOLLOWER_MAX_LEVEL) then
+			local c1=ITEM_QUALITY_COLORS[follower.weaponQuality or 1]
+			local c2=ITEM_QUALITY_COLORS[follower.armorQuality or 1]
+			frame.GCIt:SetFormattedText("W:%s%3d|r A:%s%3d|r",c1.hex,self:GetFollowerData(follower.followerID,"weaponItemLevel"),c2.hex,self:GetFollowerData(follower.followerID,"armorItemLevel"))
+			frame.GCIt:Show()
+			frame.GCXp:SetPoint("LEFT",frame.GCIt,"RIGHT",2,0)
+		else
+			frame.GCIt:Hide()
+			frame.GCXp:SetPoint("LEFT",frame.Name,"LEFT",0,20)
+		end
 	end
-
 end
 function addon:HookedGarrisonFollowerListButton_OnClick(frame,button)
 	if (frame.info.isCollected) then
@@ -2941,9 +2945,17 @@ function addon:DrawSingleButton(page,button,progressing,bigscreen)
 			addon:AddThreatsToButton(button,mission,missionID,bigscreen)
 		end
 		local a1,f,a2,h,v=button.Title:GetPoint(1)
-		v=v+10
-		button.Title:ClearAllPoints()
-		button.Title:SetPoint(a1,f,a2,h,v)
+		if page then
+			v=v+10
+			button.Title:ClearAllPoints()
+			button.Title:SetPoint(a1,f,a2,h,v)
+		else
+			v=v+20
+			button.Title:ClearAllPoints()
+			button.Title:SetPoint(a1,f,a2,h,v)
+			button.Summary:ClearAllPoints()
+			button.Summary:SetPoint("TOPLEFT",button.Title,"BOTTOMLEFT",0,-5)
+		end
 		button:Show();

 	else
@@ -2959,11 +2971,11 @@ function addon:DrawSingleSlimButton(page,button,progressing,bigscreen)
 		self:AddStandardDataToButton(page,button,mission,missionID,bigscreen)
 		over.GarrisonMissionButton_SetRewards(button, mission.rewards, mission.numRewards);
 		self:AddFollowersToButton(button,mission,missionID,bigscreen)
-		frame.Title:SetPoint("TOPLEFT",frame.Percent,"TOPLEFT",0,5)
+		frame.Title:SetPoint("TOPLEFT",frame.Percent,"TOPLEFT",0,15)
 		frame.Success:SetPoint("LEFT",frame.Percent,"RIGHT",0,0)
 		frame.Failure:SetPoint("LEFT",frame.Percent,"RIGHT",0,0)
 		frame.Summary:ClearAllPoints()
-		frame.Summary:SetPoint("BOTTOMLEFT",frame.Title,"BOTTOMRIGHT",0,0)
+		frame.Summary:SetPoint("TOPLEFT",frame.Title,"BOTTOMLEFT",0,-10)
 		button:Show();
 	else
 		button:Hide();
diff --git a/MatchMaker.lua b/MatchMaker.lua
index 0d8f7dc..d248934 100644
--- a/MatchMaker.lua
+++ b/MatchMaker.lua
@@ -69,7 +69,7 @@ end
 filters.resources=filters.generic
 filters.gold=filters.generic
 filters.equip=filters.generic
-filters.followerequip=filters.generic
+filters.followerEquip=filters.generic
 filters.epic=filters.generic
 local function CreateFilter(missionClass)
 	local code = [[
diff --git a/MissionCache.lua b/MissionCache.lua
index 0cd9fce..ad96375 100644
--- a/MissionCache.lua
+++ b/MissionCache.lua
@@ -111,7 +111,7 @@ function AddExtraData(mission)
 		elseif mission.itemLevel >0 then
 			mission.class='equip'
 		elseif mission.followerUpgrade>0 then
-			mission.class='followerequip'
+			mission.class='followerEquip'
 		elseif mission.itemLevel>=645 then
 			mission.class='epic'
 		else
diff --git a/MissionCompletion.lua b/MissionCompletion.lua
index 2e41e44..d632127 100644
--- a/MissionCompletion.lua
+++ b/MissionCompletion.lua
@@ -26,6 +26,13 @@ function addon:GenerateMissionCompleteList(title)
 					GameTooltip:Show()
 				end
 			end
+			function m:ScrollDown()
+				local obj=self.scroll
+				if (#self.missions >6 and obj.scrollbar and obj.scrollbar:IsShown()) then
+					obj:SetScroll(80)
+					obj.scrollbar.ScrollDownButton:Click()
+				end
+			end
 			function m:OnAcquire()
 				wipe(self.missions)
 			end
@@ -46,15 +53,20 @@ function addon:GenerateMissionCompleteList(title)
 				obj:AddChild(b)
 			end
 			function m:AddMissionName(missionID,success)
-				print("Addmissioname",missionID,success)
 				local mission=self.missions[missionID]
 				if mission then
 					if success then
 						mission.frame.Success:Show()
 						mission.frame.Failure:Hide()
+						for i=1,#mission.Rewards do
+							mission.Rewards[i].Icon:SetDesaturated(true)
+						end
 					else
 						mission.frame.Success:Hide()
 						mission.frame.Failure:Show()
+						for i=1,#mission.Rewards do
+							mission.Rewards[i].Icon:SetDesaturated(true)
+						end
 					end
 				end
 			end
@@ -66,10 +78,6 @@ function addon:GenerateMissionCompleteList(title)
 				l:SetColor(...)
 				l:SetFullWidth(true)
 				obj:AddChild(l)
-				if (obj.scrollbar and obj.scrollbar:IsShown()) then
-					obj:SetScroll(80)
-					obj.scrollbar.ScrollDownButton:Click()
-				end

 			end
 			function m:AddFollower(followerID,xp,levelup)
diff --git a/MissionControl.lua b/MissionControl.lua
index 419c11c..53923ce 100644
--- a/MissionControl.lua
+++ b/MissionControl.lua
@@ -23,7 +23,10 @@ local GMCUsedFollowers={}
 local wipe=wipe
 local pairs=pairs
 local tinsert=tinsert
+local xprint=ns.xprint
+xprint=print
 --@debug@
+_G.GAC=addon
 if LibDebug then LibDebug() end
 --@end-debug@
 local dbg
@@ -38,20 +41,20 @@ function addon:GMCCreateMissionList(workList)
 	for _,missionID in self:GetMissionIterator() do
 		local discarded=false
 		repeat
-			ns.xprint("|cffff0000",'Examing',self:GetMissionData(missionID,"name"),self:GetMissionData(missionID,"class"),"|r")
+			xprint("|cffff0000",'Examing',self:GetMissionData(missionID,"name"),self:GetMissionData(missionID,"class"),"|r")
 			local durationSeconds=self:GetMissionData(missionID,'durationSeconds')
 			if (durationSeconds > settings.maxDuration * 3600 or durationSeconds <  settings.minDuration * 3600) then
-				ns.xprint(missionID,"discarded due to len",durationSeconds /3600)
+				xprint(missionID,"discarded due to len",durationSeconds /3600)
 				break
 			end -- Mission too long, out of here
 			if (self:GetMissionData(missionID,'isRare') and settings.skipRare) then
-				ns.xprint(missionID,"discarded due to rarity")
+				xprint(missionID,"discarded due to rarity")
 				break
 			end
 			for k,v in pairs(ar) do
 				if (not v) then
 					if (self:GetMissionData(missionID,"class")==k) then -- we have a forbidden reward
-						ns.xprint(missionID,"discarded due to class == ", k)
+						xprint(missionID,"discarded due to class == ", k)
 						discarded=true
 						break
 					end
@@ -84,7 +87,7 @@ end
 --@param #integer missionID Optional, to run a single mission
 --@param #bool start Optional, tells that follower already are on mission and that we need just to start it
 function addon:GMCRunMission(missionID,start)
-	ns.xprint("Asked to start mission",missionID)
+	xprint("Asked to start mission",missionID)
 	if (start) then
 		G.StartMission(missionID)
 		PlaySound("UI_Garrison_CommandTable_MissionStart")
@@ -92,7 +95,7 @@ function addon:GMCRunMission(missionID,start)
 	end
 	for i=1,#GMC.ml.Parties do
 		local party=GMC.ml.Parties[i]
-		ns.xprint("Checking",party.missionID)
+		xprint("Checking",party.missionID)
 		if (missionID and party.missionID==missionID or not missionID) then
 			GMC.ml.widget:RemoveChild(party.missionID)
 			GMC.ml.widget:DoLayout()
@@ -134,7 +137,7 @@ do
 			end
 			return
 		end
-		if (timeElapsed >=0.) then
+		if (timeElapsed >=0.1) then
 			currentMission=currentMission+1
 			if (currentMission > #aMissions) then
 				wipe(aMissions)
@@ -142,13 +145,13 @@ do
 				x=0
 				timeElapsed=0.2
 			else
-				GMC.ml.widget:SetFormattedTitle("Processing mission %d of %d",currentMission,#aMissions)
 				local missionID=aMissions[currentMission]
+				GMC.ml.widget:SetFormattedTitle("Processing mission %d of %d (%s)",currentMission,#aMissions,G.GetMissionName(missionID))
 				local class=self:GetMissionData(missionID,"class")
 				local checkprio=class
 				if checkprio=="itemLevel" then class="equip" end
 				if checkprio=="followerUpgrade" then class= "followerEquip" end
-				ns.xprint(C("Processing ","Red"),missionID,addon:GetMissionData(missionID,"name"))
+				xprint(C("Processing ","Red"),missionID,addon:GetMissionData(missionID,"name"))
 				local minimumChance=0
 				if (GMC.settings.useOneChance) then
 					minimumChance=tonumber(GMC.settings.minimumChance) or 100
@@ -157,9 +160,9 @@ do
 				end
 				local party={members={},perc=0}
 				self:MCMatchMaker(missionID,party,false,false)
-				ns.xprint ("                           Requested",minimumChance,"Mission",party.perc,party.full)
+				xprint ("                           Requested",class,";",minimumChance,"Mission",party.perc,party.full)
 				if ( party.full and party.perc >= minimumChance) then
-					ns.xprint("                           Mission accepted")
+					xprint("                           Mission accepted")
 					local mb=AceGUI:Create("GMCMissionButton")
 					for i=1,#party.members do
 						GMCUsedFollowers[party.members[i]]=true
@@ -200,7 +203,7 @@ function addon:GMC_OnClick_Run(this,button)
 	end
 end
 function addon:GMC_OnClick_Start(this,button)
-	ns.xprint(C("-------------------------------------------------","Yellow"))
+	xprint(C("-------------------------------------------------","Yellow"))
 	GMC.ml.widget:ClearChildren()
 	if (self:GetTotFollowers(AVAILABLE) == 0) then
 		GMC.ml.widget:SetTitle("All followers are busy")
@@ -240,7 +243,7 @@ function addon:GMCBuildPanel(bigscreen)
 	chance:SetPoint("TOPLEFT",duration,"TOPRIGHT",bigscreen and 50 or 10,0)
 	priorities:SetPoint("TOPLEFT",duration,"BOTTOMLEFT",25,-40)
 	rewards:SetPoint("TOPLEFT",priorities,"TOPRIGHT",bigscreen and 50 or 15,0)
-	list:SetPoint("TOPLEFT",chance,"TOPRIGHT",10,0)
+	list:SetPoint("TOPLEFT",chance,"TOPRIGHT",10,-30)
 	list:SetPoint("BOTTOMRIGHT",GMF,"BOTTOMRIGHT",-25,25)
 	GMC.startButton = CreateFrame('BUTTON',nil,  list.frame, 'GameMenuButtonTemplate')
 	GMC.startButton:SetText('Calculate')
@@ -268,9 +271,15 @@ function addon:GMCBuildPanel(bigscreen)
 		GMC.settings.skipRare=this:GetChecked()
 		addon:GMC_OnClick_Start(GMC.startButton,"LeftUp")
 	end)
-	GMC.Credits=GMC:CreateFontString(nil,"ARTWORK","ReputationDetailFont")
+	local warning=GMC:CreateFontString(nil,"ARTWORK","CombatTextFont")
+	warning:SetText(L["Epic followers are NEVER sent alone on xp only missions"])
+	warning:SetPoint("TOPLEFT",GMC,"TOPLEFT",0,-25)
+	warning:SetPoint("TOPRIGHT",GMC,"TOPRIGHT",0,-25)
+	warning:SetJustifyH("CENTER")
+	warning:SetTextColor(C.Orange())
+	GMC.Credits=GMC:CreateFontString(nil,"ARTWORK","DestinyFontLarge")
 	GMC.Credits:SetWidth(0)
-	GMC.Credits:SetFormattedText("Original concept and interface by %s",C("Motig","Red") )
+	GMC.Credits:SetFormattedText(C("Original concept and interface by %s",'Yellow'),C("Motig","Red") )
 	GMC.Credits:SetPoint("BOTTOMLEFT",25,25)
 	return GMC
 end
@@ -435,13 +444,13 @@ function addon:GMCBuildRewards()
 	local rc=GMC.settings.rewardChance
 	if ar.xpBonus then ar.xp=true end
 	ar.xpBonus=nil
-	if ar.followerUpgrade then ar.followerequip=true end
+	if ar.followerUpgrade then ar.followerEquip=true end
 	ar.followerUpgrade=nil
 	if ar.itemLevel then ar.equip=true end
 	ar.itemLevel=nil
 	if rc.xpBonus then rc.xp=rc.xpbonus or 100 end
 	rc.xpBonus=nil
-	if rc.followerUpgrade then rc.followerequip=rc.followerUpgrade or 100 end
+	if rc.followerUpgrade then rc.followerEquip=rc.followerUpgrade or 100 end
 	rc.followerUpgrade=nil
 	if rc.itemLevel then rc.equip=rc.itemLevel or 100 end
 	rc.itemLevel=nil