Quantcast

6.2 compatibility added here and there

Alar of Daggerspine [06-17-15 - 19:29]
6.2 compatibility added here and there

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
FollowerCache.lua
FollowerPage.lua
GarrisonCommander.lua
GarrisonCommander.toc
GarrisonCommander.xml
Init.lua
MatchMaker.lua
MissionCache.lua
MissionCompletion.lua
MissionControl.lua
PartyCache.lua
ShipYard.lua
doc.txt
diff --git a/FollowerCache.lua b/FollowerCache.lua
index 4ac91a4..8be3391 100644
--- a/FollowerCache.lua
+++ b/FollowerCache.lua
@@ -111,7 +111,8 @@ function addon:GetFollowerData(followerID,key,default)
 	local follower=Mbase.followers[idx]
 	if (not follower) then
 --@debug@
-		ns.xprint("Not found",followerID,key,"at",idx,"len",#Mbase.followers)
+		print("Not found",followerID,key,"at",idx,"len",#Mbase.followers)
+		DevTools_Dump(G.GetFollowerInfo(followerID))
 		print(debugstack())
 --@end-debug@
 		return default
diff --git a/FollowerPage.lua b/FollowerPage.lua
index 3f450a7..9a1b862 100644
--- a/FollowerPage.lua
+++ b/FollowerPage.lua
@@ -23,7 +23,6 @@ local GMCUsedFollowers={}
 local wipe=wipe
 local pairs=pairs
 local tinsert=tinsert
-local xprint=ns.xprint
 local coroutine=coroutine
 local GetItemInfo=GetItemInfo
 local GarrisonMissionFrame_SetItemRewardDetails=GarrisonMissionFrame_SetItemRewardDetails
@@ -213,5 +212,3 @@ function addon:FollowerPageStartUp()
 	self:RegisterEvent("GARRISON_FOLLOWER_UPGRADED","DelayedRefresh")
 	self:RegisterEvent("CHAT_MSG_LOOT","DelayedRefresh")
 end
-
-
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index c943bf7..e00b7d4 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -3,11 +3,9 @@ local addon=ns.addon --#addon
 local L=ns.L
 local D=ns.D
 local C=ns.C
+local _G=_G
 local P=ns.party
 local AceGUI=ns.AceGUI
-local xprint=ns.xprint
-local _G=_G
-local pp=print
 local HD=false
 local tremove=tremove
 local setmetatable=setmetatable
@@ -31,6 +29,9 @@ local minHeight
 --@debug@
 if LibDebug then LibDebug() end
 --@end-debug@
+--[===[@non-debug@
+setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
+--@end-non-debug@]===]
 ns.bigscreen=true
 -- Blizzard functions override support
 local orig={} --#originals
@@ -65,7 +66,7 @@ end
 local parties


-local lastTab=1
+local lastTab
 local new, del, copy =ns.new,ns.del,ns.copy

 local function capitalize(s)
@@ -97,6 +98,7 @@ local GARRISON_MISSION_PERCENT_CHANCE="%d%%"-- GARRISON_MISSION_PERCENT_CHANCE
 --local GARRISON_CURRENCY=GARRISON_CURRENCY  --824
 --local GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY=GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY -- 4
 --local GARRISON_FOLLOWER_MAX_LEVEL=GARRISON_FOLLOWER_MAX_LEVEL -- 100
+
 local GARRISON_CURRENCY=GARRISON_CURRENCY
 local GetMoneyString=GetMoneyString
 local SHORTDATE=SHORTDATE.. " %s"
@@ -134,6 +136,8 @@ local MAXMISSIONS=8
 local MINPERC=20
 local BUSY_MESSAGE_FORMAT=L["Only first %1$d missions with over %2$d%% chance of success are shown"]
 local BUSY_MESSAGE=format(BUSY_MESSAGE_FORMAT,MAXMISSIONS,MINPERC)
+-- to be rmoved in 60200
+local LE_FOLLOWER_TYPE_GARRISON_6_0=_G.LE_FOLLOWER_TYPE_GARRISON_6_0

 local function splitFormat(base)
 	local i,s=base:find("|4.*:.*;")
@@ -160,16 +164,6 @@ local GARRISON_DURATION_MINUTES=GARRISON_DURATION_MINUTES -- "%d min";
 local GARRISON_DURATION_SECONDS=GARRISON_DURATION_SECONDS -- "%d sec";
 local AGE_HOURS="Expires in " .. GARRISON_DURATION_HOURS_MINUTES
 local AGE_DAYS="Expires in " .. GARRISON_DURATION_DAYS_HOURS
--- Temporary fix waiting to be able to export 6.2 interface
-if ns.toc == 60200 then
-function _G.GarrisonMissionFrame_SelectTab(index)
-	if index==1 then
-		GarrisonMissionFrameTab1:Click()
-	elseif index==2 then
-		GarrisonMissionFrameTab2:Click()
-	end
-end
-end
 -- Panel sizes
 local BIGSIZEW=1220
 local BIGSIZEH=662
@@ -354,7 +348,14 @@ function addon.Garrison_SortMissions_Original(missionsList)
 	addon:OnAllMissions(function(missionID) addon:MatchMaker(missionID) end)
 	origGarrison_SortMissions(missionsList)
 end
-
+local t={}
+for i=1,256 do
+	local rc,good=pcall(G.GetFollowerAbilityIsTrait,i)
+	if rc and good then
+		t[i]=G.GetFollowerAbilityName(i)
+	end
+end
+local traitTable=t
 function addon:OnInitialized()
 	for _,b in ipairs(GMFMissionsListScrollFrame.buttons) do
 		local scale=0.8
@@ -387,6 +388,8 @@ function addon:OnInitialized()
 		Garrison_SortMissions_Duration=L["Duration Time"],
 	},
 	L["Sort missions by:"],L["Original sort restores original sorting method, whatever it was (If you have another addon sorting mission, it should kick in again)"])
+	self:AddToggle("MAXRES",true,L["Maximize result"],L["Allows a lower success percentage for resource missions. Use /gac gui to change percentage. Default is 80%"])
+	self:AddSlider("MIAXRESCHANCE",80,50,100,L["Minum needed chance"],L["Applied when maximise result is enabled. Default is 80%"])
 	ns.bigscreen=self:GetBoolean("BIGSCREEN")
 	self:AddLabel("Followers Panel")
 	self:AddSlider("MAXMISSIONS",5,1,8,L["Mission shown for follower"],nil,1)
@@ -403,9 +406,86 @@ function addon:OnInitialized()
 	self:AddToggle("TRC",false, "Enable Trace")
 --@end-debug@
 	self:Trigger("MSORT")
+	self:AddOpenCmd("show","showdata","Prints a mission score")
 	LoadAddOn("GarrisonCommander-Broker")
+	if false and self.db.global.traits[ns.toc] then
+		return true
+	else
+		self.db.global.traits[ns.toc]=traitTable
+	end
 	return true
 end
+function addon:showdata(fullargs,action,missionid)
+	self:Print(fullargs,",",missionid)
+	missionid=tonumber(missionid)
+	if missionid then
+		if action=="score" then
+			self:Print(self:GetMissionData(missionid,'name'),self:MissionScore(self:GetMissionData(missionid)))
+		elseif action=="mission" then
+			self:DumpMission(missionid)
+		elseif action=="match" then
+			self:TestMission(missionid)
+		end
+	end
+end
+---@function [parent=#GarrisonCommander] GarrisonTraitCountersFrame_OnLoad
+--@param #enum followerType dalla 6.2, il tipo follower
+--@param #string tooltipString Format per il tooltip
+function _G.GarrisonTraitCountersFrame_OnLoad(self, followerType, tooltipString)
+	if (followerType == nil) then
+		followerType = LE_FOLLOWER_TYPE_GARRISON_6_0;
+	end
+	if (tooltipString == nil) then
+		tooltipString = GARRISON_THREAT_COUNTER_TOOLTIP .. " %d";
+	end
+	self.tooltipString = tooltipString;
+	local i=1
+	local top=0
+	for id,name in pairs(traitTable) do
+		local frame = self.TraitsList[i];
+		local offset=(ns.bigscreen and 22 or 17)
+
+		if ( not frame ) then
+			frame = CreateFrame("Button", nil, self, "GarrisonTraitCounterTemplate");
+			if i %  offset == 1 then
+				top=top-40
+				local a,b,c,x,y=self.TraitsList[1]:GetPoint(1)
+				frame:SetPoint(a,b,c,0,top)
+			else
+				frame:SetPoint("RIGHT", self.TraitsList[i-1], "LEFT", -14, 0);
+				frame:SetScript("OnEnter",GarrisonTraitCounter_OnEnter)
+			end
+			self.TraitsList[i] = frame;
+		end
+		frame.Icon:SetTexture(G.GetFollowerAbilityIcon(id))
+		frame.name = name;
+		frame.id = id;
+		i=i+1
+	end
+	self:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE");
+end
+-- Trait show
+function _G.GarrisonTraitCountersFrame_OnEvent(self, event, ...)
+	if ( self:IsVisible() ) then
+		GarrisonTraitCountersFrame_Update(self);
+	end
+end
+
+function _G.GarrisonTraitCountersFrame_Update(self)
+
+	for i = 1, #self.TraitsList do
+		local t=addon:GetFollowersWithTrait(self.TraitsList[i].id)
+		local n=t and #t or 0
+		self.TraitsList[i].Count:SetText(n);
+	end
+end
+
+function _G.GarrisonTraitCounter_OnEnter(self)
+	GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
+	local text = string.format(self:GetParent().tooltipString, self.Count:GetText(), self.name,self.id);
+	GameTooltip:SetText(text, nil, nil, nil, nil, true);
+end
+
 function addon:CheckMP()
 	if (IsAddOnLoaded("MasterPlan")) then
 		if (GetAddOnMetadata("MasterPlan","Version")=="0.18") then
@@ -433,6 +513,9 @@ end
 function addon:ApplyIGM(value)
 	self:RefreshMissions()
 end
+function addon:ApplyMAXRES(value)
+	self:RefreshMissions()
+end
 function addon:ApplyCKMP(value)
 	if (HD) then self:Clock() end
 	if (MasterPlanMissionList) then
@@ -552,25 +635,32 @@ function addon:HookedGarrisonMissionButton_AddThreatsToTooltip(missionID)
 	if (GMC:IsShown()) then return end
 	return self:RenderTooltip(missionID)
 end
-function addon:AddIconsToFollower(missionID,useful,followers,members)
+function addon:AddIconsToFollower(missionID,useful,followers,members,followerTypeID)
 	for followerID,icons in pairs(followers) do
-		if not tContains(members,followerID)  then
-			local bias=self:GetBiasColor(followerID,missionID)
-			if (not useful[followerID]) then
-				useful[followerID]=format("%04d%s %s ",
-					1000-self:GetFollowerData(followerID,'rank',0),
-					C(self:GetFollowerData(followerID,'rank'),bias),
-					self:GetFollowerData(followerID,'coloredname')
-				)
-			end
-			for i=1,#icons do
-				useful[followerID]=format("%s |T%s:0|t",useful[followerID],icons[i].icon)
+		if self:GetFollowerData(followerID,'followerTypeID',0) == followerTypeID then
+			if not tContains(members,followerID)  then
+				local bias=self:GetBiasColor(followerID,missionID)
+				if (not useful[followerID]) then
+					local rank=self:GetFollowerData(followerID,'rank')
+					if rank then
+						useful[followerID]=format("%04d%s %s ",
+							1000-rank,
+							C(rank,bias),
+							self:GetFollowerData(followerID,'coloredname')
+						)
+					end
+				end
+				for i=1,#icons do
+					if (useful[followerID]) then
+						useful[followerID]=format("%s |T%s:0|t",useful[followerID],icons[i].icon)
+					end
+				end
 			end
 		end
 	end

 end
-function addon:AddFollowersToTooltip(missionID)
+function addon:AddFollowersToTooltip(missionID,followerTypeID)
 	--local f=GarrisonMissionListTooltipThreatsFrame
 	-- Adding All available followers
 	local party=self:GetParty(missionID)
@@ -579,10 +669,10 @@ function addon:AddFollowersToTooltip(missionID)
 	local traited=G.GetFollowersTraitsForMission(missionID)
 	local buffed=G.GetBuffedFollowersForMission(missionID)
 	if (type(traited)=='table') then
-		self:AddIconsToFollower(missionID,useful,traited,members)
+		self:AddIconsToFollower(missionID,useful,traited,members,followerTypeID)
 	end
 	if (type(buffed)=='table') then
-		self:AddIconsToFollower(missionID,useful,buffed,members)
+		self:AddIconsToFollower(missionID,useful,buffed,members,followerTypeID)
 	end
 	if next(useful) then
 		table.sort(useful)
@@ -602,7 +692,11 @@ function addon:AddFollowersToTooltip(missionID)
 	if party.goldMultiplier>1 and party.class=='gold' then
 		GameTooltip:AddDoubleLine(L["Gold incremented!"],party.goldMultiplier..'x',C.Green())
 	end
-	if party.materialMultiplier>1 and party.class == 'resources' then
+	if type(party.materialMultiplier)=="table" then
+		for k,v in pairs(party.materialMultiplier) do
+			GameTooltip:AddDoubleLine((GetCurrencyInfo(k)),v..'x',C.Green())
+		end
+	elseif party.materialMultiplier>1 and party.class == 'resources' then
 		GameTooltip:AddDoubleLine(L["Resource incremented!"],party.materialMultiplier..'x',C.Green())
 	end
 	if party.xpBonus>0 then
@@ -772,7 +866,7 @@ end

 function addon:EventGARRISON_MISSION_STARTED(event,missionID,...)
 --@debug@
-	ns.xprint(event,missionID,...)
+	print(event,missionID,...)
 --@end-debug@
 	wipe(dbcache.ignored[missionID])
 	local party=self:GetParty(missionID)
@@ -797,8 +891,8 @@ end

 function addon:EventGARRISON_MISSION_FINISHED(event,missionID,...)
 --@debug@
-	ns.xprint(event,missionID,...)
-	ns.xdump(G.GetPartyMissionInfo(missionID))
+	print(event,missionID,...)
+	print(G.GetPartyMissionInfo(missionID))
 --@end-debug@
 end
 function addon:EventGARRISON_FOLLOWER_LIST_UPDATE(event)
@@ -807,7 +901,7 @@ end

 function addon:EventGARRISON_MISSION_BONUS_ROLL_LOOT(event,missionID,completed,success)
 --@debug@
-	ns.xprint('evt',event,missionID,completed,success)
+	print('evt',event,missionID,completed,success)
 --@end-debug@
 	self:RefreshFollowerStatus()
 end
@@ -941,22 +1035,6 @@ do
 	end
 end

-function addon:ShowMissionControl()
-	if (not GMC:IsShown()) then
-		GarrisonMissionFrame_SelectTab(999)
-		GMF.FollowerTab:Hide()
-		GMF.FollowerList:Hide()
-		GMF.MissionTab:Hide()
-		GMF.TitleText:SetText(L["Garrison Commander Mission Control"])
-		GMC:Show()
-		GMC.startButton:Click()
-		GMF.tabMC:SetChecked(true)
-	else
-		GMC:Hide()
-		GMF.tabMC:SetChecked(false)
-		GarrisonMissionFrame_SelectTab(1)
-	end
-end
 local helpwindow -- pseudo static
 function addon:ShowHelpWindow(button)
 	if (not helpwindow) then
@@ -1236,7 +1314,7 @@ end

 function addon:ScriptTrace(hook,frame,...)
 --@debug@
-	pp("Triggered " .. C(hook,"red").." script on",C(frame,"Azure"),...)
+	print("Triggered " .. C(hook,"red").." script on",C(frame,"Azure"),...)
 --@end-debug@
 end
 function addon:IsProgressMissionPage()
@@ -1257,16 +1335,6 @@ function addon:IsMissionPage()
 	return GMF:IsShown() and GMFMissionPage:IsShown() and GMFFollowers:IsShown()
 end
 ---
--- Switches between missions (1) and followers (others) panels
-function addon:HookedGarrisonMissionFrame_SelectTab(id)
-	GMC:Hide()
-	GMF.tabMC:SetChecked(false)
-	self:RefreshFollowerStatus()
-end
----
-
-
-
 function addon:HookedGarrisonFollowerTooltipTemplate_SetGarrisonFollower(...)
 	local h=GarrisonFollowerTooltip:GetHeight()
 	local ft=GarrisonFollowerTooltip.ft
@@ -1299,10 +1367,15 @@ function addon:HookedGarrisonFollowerTooltipTemplate_SetGarrisonFollower(...)
 		ft:Show()
 	end
 end
-function addon:HookedGarrisonFollowerButton_UpdateCounters(frame,follower,showCounters)
-	return self:RenderFollowerPageFollowerButton(frame,follower,showCounters)
+function addon:HookedGarrisonFollowerButton_UpdateCounters(...)
+	if ns.toc < 60200 then
+		return self:RenderFollowerPageFollowerButton(...)
+	else
+		return self:RenderFollowerPageFollowerButton(select(2,...))
+	end
 end
 function addon:RenderFollowerPageFollowerButton(frame,follower,showCounters)
+	--self:Trace(frame:GetName())
 	if not frame.GCIt then
 		frame.GCIt=frame:CreateFontString(nil,"ARTWORK","GameFontHighlightSmall")
 		frame.GCIt:SetPoint("BOTTOMLEFT",frame.Name,"TOPLEFT",0,2)
@@ -1325,7 +1398,7 @@ function addon:RenderFollowerPageFollowerButton(frame,follower,showCounters)
 		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:SetFormattedText("W:%s%3d|r A:%s%3d|r",c1.hex,self:GetFollowerData(follower.followerID,"weaponItemLevel",600),c2.hex,self:GetFollowerData(follower.followerID,"armorItemLevel",600))
 			frame.GCIt:Show()
 			frame.GCXp:SetPoint("LEFT",frame.GCIt,"RIGHT",2,0)
 		else
@@ -1341,7 +1414,11 @@ function addon:HookedGarrisonFollowerListButton_OnClick(frame,button)
 				self:HookedGarrisonFollowerPage_ShowFollower(frame.info,frame.info.followerID)
 			end
 		end
-		self:ScheduleTimer("HookedGarrisonFollowerButton_UpdateCounters",0.2,frame,frame.info,false)
+		if ns.toc <60200 then
+			self:ScheduleTimer("HookedGarrisonFollowerButton_UpdateCounters",0.2,frame,frame.info,false)
+		else
+			self:ScheduleTimer("HookedGarrisonFollowerButton_UpdateCounters",0.2,GMF,frame,frame.info,false)
+		end
 		self:ShowUpgradeButtons()
 	end
 end
@@ -1430,7 +1507,7 @@ function addon.ClonedGarrisonMissionMechanic_OnEnter(this)
 			local t=G.GetFollowersTraitsForMission(this.missionID)
 			for followerID,k in pairs(t) do
 				for i=1,#k do
-					xprint(k[i].icon)
+					print(k[i].icon)
 					if k[i].icon==this.texture then
 						tip:AddDoubleLine(addon:GetFollowerData(followerID,'fullname'),this.Name)
 					end
@@ -1458,12 +1535,22 @@ do
 	local ml=nil
 	local tContains=tContains
 	local function MissionOnClick(this,...)
-		GarrisonMissionButton_OnClick(this.frame,"LeftUp")
-		if (PanelTemplates_GetSelectedTab(GMF) ~= 1) then
-			addon:OpenMissionsTab()
+		if ns.toc < 60200 then
+			GarrisonMissionButton_OnClick(this.frame,"LeftUp")
+			if (PanelTemplates_GetSelectedTab(GMF) ~= 1) then
+				addon:OpenMissionsTab()
+			end
+			addon:OnClick_GarrisonMissionButton(this.frame,"Leftup")
+			lastTab=2
+		else
+			print(this.frame,this.frame:GetName())
+			GMF:OnClickMission(this.frame.info)
+			if (PanelTemplates_GetSelectedTab(GMF) ~= 1) then
+				addon:OpenMissionsTab()
+			end
+			addon:OnClick_GarrisonMissionButton(this.frame,"Leftup")
+			lastTab=2
 		end
-		addon:OnClick_GarrisonMissionButton(this.frame,"Leftup")
-		lastTab=2
 	end
 	function addon:RenderFollowerPageMissionList(frame,followerID,force)
 		if not ns.bigscreen then return end
@@ -1562,7 +1649,7 @@ function addon:SetUp(...)
 	tabHP:SetNormalTexture("Interface\\ICONS\\INV_Misc_QuestionMark.blp")
 	tabHP:SetPushedTexture("Interface\\ICONS\\INV_Misc_QuestionMark.blp")
 	tabHP:Show()
-	tabMC:SetScript("OnClick",function(this,...) addon:ShowMissionControl() end)
+	tabMC:SetScript("OnClick",function(this,...) addon:OpenMissionControlTab() end)
 	tabCF:SetScript("OnClick",function(this,...) addon:Gui() end)
 	tabHP:SetScript("OnClick",function(this,button) addon:ShowHelpWindow(this,button) end)
 	tabHP:SetPoint('TOPLEFT',GCF,'TOPRIGHT',0,-10)
@@ -1574,6 +1661,11 @@ function addon:SetUp(...)
 	bt:SetText(L["Garrison Comander Quick Mission Completion"])
 	bt:SetPoint("CENTER",0,-50)
 	addon:ActivateButton(bt,"MissionComplete",L["Complete all missions without confirmation"])
+	GarrisonTraitCountersFrame:ClearAllPoints()
+	GarrisonTraitCountersFrame:SetParent(GarrisonThreatCountersFrame:GetParent())
+	GarrisonTraitCountersFrame:SetPoint("BOTTOMRIGHT",0,-25)
+	GarrisonTraitCountersFrame:Show()
+
 	return self:StartUp()
 	--collectgarbage("step",10)
 --/Interface/FriendsFrame/UI-Toast-FriendOnlineIcon
@@ -1582,9 +1674,9 @@ function addon:MissionComplete()
 	return self:GetModule("MissionCompletion"):MissionComplete()
 end
 function addon:AddMenu()
-	local menu,size=self:CreateOptionsLayer(MP and 'CKMP' or nil,'BIGSCREEN','MOVEPANEL','IGM','IGP','NOFILL','MSORT')
+	local menu,size=self:CreateOptionsLayer(MP and 'CKMP' or nil,'BIGSCREEN','MOVEPANEL','IGM','IGP','NOFILL','MSORT','MAXRES')
 	--self:AddOptionToOptionsLayer(GCF.Menu,'MSORT')
-	--self:AddOptionToOptionsLayer(GCF.Menu,'ShowMissionControl')
+	--self:AddOptionToOptionsLayer(GCF.Menu,'OpenMissionControlTab')
 --@debug@
 	self:AddOptionToOptionsLayer(menu,'DBG')
 	self:AddOptionToOptionsLayer(menu,'TRC')
@@ -1613,6 +1705,9 @@ function addon:AddMissionId(b)
 		GameTooltip:Show()
 	end
 end
+function addon:HookedClickOnTabs(tab)
+	lastTab=tab
+end
 ---
 -- Additional setup
 -- This method is called every time garrison mission panel is open because
@@ -1635,14 +1730,10 @@ function addon:StartUp(...)
 	if (ns.bigscreen) then
 		self:SafeSecureHook("GarrisonFollowerTooltipTemplate_SetGarrisonFollower")
 	end
-	if ns.toc < 60200 then
-		self:SafeSecureHook("GarrisonMissionFrame_SelectTab")
-	else
-		for i =1,9 do
-			local hook="GarrisonMissionFrameTab" ..i
-			if (_G[hook]) then
-				self:SafeHookScript(hook,"OnClick","HookedGarrisonMissionFrame_SelectTab")
-			end
+	for i =1,9 do
+		local hook="GarrisonMissionFrameTab" ..i
+		if (_G[hook]) then
+			self:SafeHookScript(hook,"OnClick","HookedClickOnTabs")
 		end
 	end
 	-- GarrisonMissionList_SetTab is overrided
@@ -1706,12 +1797,12 @@ end
 function addon:checkMethod(method,hook)
 	if (type(self[method])=="function") then
 --@debug@
-		--ns.xprint("Hooking ",hook,"to self:" .. method)
+		print("Hooking ",hook,"to self:" .. method)
 --@end-debug@
 		return true
 --@debug@
 	else
-		--ns.xprint("Hooking ",hook,"to print")
+		print("Hooking ",hook,"to print")
 --@end-debug@
 	end
 end
@@ -1721,7 +1812,7 @@ function addon:SafeRegisterEvent(event)
 		return self:RegisterEvent(event,method)
 --@debug@
 	else
-		return self:RegisterEvent(event,ns.xprint)
+		return self:RegisterEvent(event,print)
 --@end-debug@
 	end
 end
@@ -1734,7 +1825,7 @@ function addon:SafeSecureHook(tobehooked,method)
 	else
 		do
 			local hooked=tobehooked
-			return self:SecureHook(tobehooked,function(...) ns.xprint(hooked,...) end)
+			return self:SecureHook(tobehooked,function(...) print(hooked,...) end)
 		end
 --@end-debug@
 	end
@@ -1848,30 +1939,63 @@ function addon:RemoveFromAllMissions(followerID)
 		pcall(G.RemoveFollowerFromMission,followerID,cache.missions[i])
 	end
 end
+local GARRISON_MISSION_AVAILABILITY1=GARRISON_MISSION_AVAILABILITY..'\n %s'
+local GARRISON_MISSION_AVAILABILITY2=GARRISON_MISSION_ENVIRONMENT:sub(1,10)..GARRISON_MISSION_AVAILABILITY..':|r %s'
+local GARRISON_MISSION_ID=GARRISON_MISSION_ENVIRONMENT:sub(1,10)..'MissionID:|r |cffffffff%s|r'
 function addon:FillMissionPage(missionInfo)
 	if type(missionInfo)=="number" then missionInfo=self:GetMissionData(missionInfo) end
 	if not missionInfo then return end
-	if( IsControlKeyDown()) then ns.xprint("Shift key, ignoring mission prefill") return end
+	local stage=GMF.MissionTab.MissionPage.Stage
+	if not stage.expires then
+		stage.expires=stage:CreateFontString()
+		stage.expires:SetFontObject(stage.MissionEnv:GetFontObject())
+		stage.expires:SetDrawLayer(stage.MissionEnv:GetDrawLayer())
+		stage.expires:SetPoint("TOPLEFT",stage.MissionEnv,"BOTTOMLEFT")
+	end
+	stage.expires:SetFormattedText(GARRISON_MISSION_AVAILABILITY2,missionInfo.offerTimeRemaining)
+	stage.expires:SetTextColor(self:GetAgeColor(missionInfo.offerEndTime))
+--@debug@
+if not stage.missionid then
+		stage.missionid=stage:CreateFontString()
+		stage.missionid:SetFontObject(stage.MissionEnv:GetFontObject())
+		stage.missionid:SetDrawLayer(stage.MissionEnv:GetDrawLayer())
+		stage.missionid:SetPoint("TOPLEFT",stage.expires,"BOTTOMLEFT")
+	end
+	stage.missionid:SetFormattedText(GARRISON_MISSION_ID,missionInfo.missionID)
+--@end-debug@
+	if( IsControlKeyDown()) then self:Print("Shift key, ignoring mission prefill") return end
 	if (self:GetBoolean("NOFILL")) then return end
 	local missionID=missionInfo.missionID
 --@debug@
-	ns.xprint("UpdateMissionPage for",missionID,missionInfo.name,missionInfo.numFollowers)
+	print("UpdateMissionPage for",missionID,missionInfo.name,missionInfo.numFollowers)
 --@end-debug@
 	self:holdEvents()
-	GarrisonMissionPage_ClearParty()
+	if ns.toc < 60200 then
+		GarrisonMissionPage_ClearParty()
+	else
+		GMF:ClearParty()
+	end
 	local party=self:GetParty(missionID)
 	if (party) then
 		local members=party.members
 		for i=1,missionInfo.numFollowers do
 			local followerID=members[i]
 			if (followerID) then
-				pcall(G.RemoveFollowerFromMission,missionID,followerID)
-				ns.xprint("Adding",followerID,G.GetFollowerName(followerID))
-				GarrisonMissionPage_AddFollower(followerID)
+					local rc,error=pcall(GarrisonMissionPage_AddFollower,followerID)
+					if (not rc) then
+						print("fillmissinopage",error)
+					end
 			end
 		end
 	end
-	GarrisonMissionPage_UpdateParty()
+	if ns.toc < 60200 then
+		GarrisonMissionPage_UpdateParty()
+	else
+		GMF:UpdateMissionParty(GMF.MissionTab.MissionPage.Followers)
+		GMF:UpdateMissionData(GMF.MissionTab.MissionPage)
+		--self:Dump(GMF.MissionTab.MissionPage.Followers,"Selected followers")
+		--GarrisonMissionPage_UpdateEmptyString()
+	end
 	self:releaseEvents()
 end
 local firstcall=true
@@ -2171,11 +2295,51 @@ function addon:UnignoreFollower(table,missionID,followerID,flag)
 	end
 	self:RefreshMissions(missionID)
 end
+function addon:OpenLastTab()
+	lastTab=lastTab or PanelTemplates_GetSelectedTab(GMF)
+	if lastTab then
+		if GMC:IsShown() then
+			GMC:Hide()
+			GMF.tabMC:SetChecked(false)
+			if lastTab==2 then
+				GMF.FollowerTab:Show()
+				GMF.FollowerList:Show()
+				self:RefreshFollowerStatus()
+			else
+				GMF.MissionTab:Show()
+			end
+		end
+		if ns.toc <60200 then
+			GarrisonMissionFrame_SelectTab(lastTab)
+		else
+			GMF:SelectTab(lastTab)
+		end
+	else
+		return self:OpenMissionsTab()
+	end
+end
 function addon:OpenFollowersTab()
-	GarrisonMissionFrame_SelectTab(2)
+	lastTab=2
+	return self:OpenLastTab()
 end
 function addon:OpenMissionsTab()
-	GarrisonMissionFrame_SelectTab(1)
+	lastTab=1
+	return self:OpenLastTab()
+end
+function addon:OpenMissionControlTab()
+	if (not GMC:IsShown()) then
+		lastTab=PanelTemplates_GetSelectedTab(GMF)
+		GMF.FollowerTab:Hide()
+		GMF.FollowerList:Hide()
+		GMF.MissionTab:Hide()
+		GMF.TitleText:SetText(L["Garrison Commander Mission Control"])
+		GMC:Show()
+		GMC.startButton:Click()
+		GMF.tabMC:SetChecked(true)
+	else
+		GMF.tabMC:SetChecked(false)
+		self:OpenLastTab()
+	end
 end
 function addon:OnClick_GarrisonMissionFrame_MissionComplete_NextMissionButton(this,button)
 	local frame = GMF.MissionComplete
@@ -2185,19 +2349,22 @@ function addon:OnClick_GarrisonMissionFrame_MissionComplete_NextMissionButton(th
 	end
 end
 function addon:OnClick_GarrisonMissionButton(tab,button)
+	print(tab,tab:GetName())
+	local frame = tab:GetParent():GetParent():GetParent():GetParent():GetParent();
+	print(frame:GetName())
 	lastTab=1
 	if (GMF.MissionTab.MissionList.showInProgress) then
 		return
 	end
 	if (type(tab.info)~="table") then return end
 --@debug@
-	ns.xprint("Clicked GarrisonMissionButton")
+	print("Clicked GarrisonMissionButton")
 --@end-debug@
 	if (tab.fromFollowerPage) then
 		if (#tab.info.followers>0) then
 			return
 		end
-		GarrisonMissionFrame_SelectTab(1)
+		self:OpenMissionsTab()
 		self:FillMissionPage(tab.info)
 	else
 		self:FillMissionPage(tab.info)
@@ -2303,12 +2470,20 @@ function over.GarrisonMissionFrame_SetFollowerPortrait(portraitFrame, followerIn
 end

 function over.GarrisonMissionPage_Close(self)
-	GarrisonMissionPage_ClearParty();
+	if ns.toc < 60200 then
+		GarrisonMissionPage_ClearParty()
+	else
+		GMF:ClearParty()
+	end
 	GarrisonMissionFrame.MissionTab.MissionPage:Hide();
 	GarrisonMissionFrame.followerCounters = nil;
 	GarrisonMissionFrame.MissionTab.MissionPage.missionInfo = nil;
 	if (lastTab) then
-		GarrisonMissionFrame_SelectTab(lastTab)
+		if lastTab==1 then
+			addon:OpenMissionsTab()
+		else
+			addon:OpenFollowersTab()
+		end
 	end
 	-- I hooked this handler, so I dont want it to be called in the middle of cleanup operations
 	GarrisonMissionFrame.MissionTab.MissionList:Show();
@@ -2351,6 +2526,14 @@ function over.GarrisonMissionButton_SetRewards(self, rewards, numRewards)
 				Reward.Icon:SetTexture(reward.icon);
 				Reward.title = reward.title
 				if (reward.currencyID and reward.quantity) then
+					local multi=1
+					if type(party.materialMultiplier)=="table" then
+						if party.materialMultiplier[reward.currencyID] then
+							multi=party.materialMultiplier[reward.currencyID]
+						end
+					else
+						multi=party.materialMultiplier or 1
+					end
 					if (reward.currencyID == 0) then
 						local multi=party.goldMultiplier or 1
 						Reward.tooltip = GetMoneyString(reward.quantity);
@@ -2361,9 +2544,7 @@ function over.GarrisonMissionButton_SetRewards(self, rewards, numRewards)
 						else
 							Reward.Quantity:SetTextColor(C:Gold())
 						end
-					elseif (reward.currencyID == GARRISON_CURRENCY) then
-						local multi=party.materialMultiplier or 1
-						Reward.tooltip = GetMoneyString(reward.quantity);
+					else
 						Reward.Quantity:SetText(reward.quantity * multi);
 						Reward.Quantity:Show();
 						if multi >1 then
@@ -2371,11 +2552,6 @@ function over.GarrisonMissionButton_SetRewards(self, rewards, numRewards)
 						else
 							Reward.Quantity:SetTextColor(C:Gold())
 						end
-					else
-						Reward.currencyID = reward.currencyID;
-						Reward.Quantity:SetText(reward.quantity);
-						Reward.Quantity:Show();
-						Reward.Quantity:SetTextColor(C:Gold())
 					end
 				else
 					if reward.followerXP then
@@ -2489,7 +2665,6 @@ function over.GarrisonMissionButton_OnEnter(self, button)
 	collectgarbage("step",100)

 	GameTooltip:SetOwner(self, "ANCHOR_CURSOR_RIGHT");
-
 	if(self.info.inProgress) then
 		GarrisonMissionButton_SetInProgressTooltip(self.info)
 	else
@@ -2503,7 +2678,7 @@ function over.GarrisonMissionButton_OnEnter(self, button)
 			GameTooltip:AddLine(" ");
 			GameTooltip:AddLine(GARRISON_MISSION_TOOLTIP_RETURN_TO_START, nil, nil, nil, 1);
 		end
-		addon:AddFollowersToTooltip(self.info.missionID)
+		addon:AddFollowersToTooltip(self.info.missionID,LE_FOLLOWER_TYPE_GARRISON_6_0 or 0)
 		GameTooltip:Show()
 	end
 --@debug@
@@ -2572,7 +2747,12 @@ function addon:DrawSingleSlimButton(page,button,progressing,bigscreen)
 end
 function addon:AddStandardDataToButton(page,button,mission,missionID,bigscreen)
 	button.Title:SetWidth(0);
-	button.Title:SetText(mission.name);
+--[===[@non-debug@
+	button.Title:SetText(mission.name)
+--@end-non-debug@]===]
+	--@debug@
+	button.Title:SetText(mission.name:sub(1,15).."  " .. (mission.class or ""))
+	--@end-debug@
 	button.Level:SetText(mission.level);
 	local seconds=self:GetMissionData(missionID,'improvedDurationSeconds')
 	local duration=SecondsToTime(seconds)
@@ -2644,7 +2824,7 @@ function addon:AddStandardDataToButton(page,button,mission,missionID,bigscreen)
 	local n=mission.numRewards
 	local w=button:GetWidth()-175 -- 655 for standard 830 button
 	if button:GetWidth()<1000 then n=n+mission.numFollowers end
-	--ns.xprint(format("%d %d %d %d",w,button.Title:GetWidth() + button.Summary:GetWidth() + 8,n,w - n * 65))
+	--print(format("%d %d %d %d",w,button.Title:GetWidth() + button.Summary:GetWidth() + 8,n,w - n * 65))
 	if ( button.Title:GetWidth() + button.Summary:GetWidth() + 8 < w - n * 65 ) then
 		button.Title:SetPoint("LEFT", 165, 0);
 		button.Summary:ClearAllPoints();
@@ -2726,7 +2906,13 @@ function addon:AddThreatsToButton(button,mission,missionID,bigscreen)
 		end
 	end
 end
-
+function addon:GetAgeColor(age)
+		if age>GetTime() then age=age-GetTime() end
+		if age < 0 then age=0 end
+		local hours=floor(age/3600)
+		local q=self:GetDifficultyColor(hours+20,true)
+		return q.r,q.g,q.b
+end
 function addon:AddIndicatorToButton(button,mission,missionID,bigscreen)
 	if not button.gcINDICATOR then
 		local indicators=CreateFrame("Frame",nil,button,"GarrisonCommanderIndicators")
@@ -2745,13 +2931,8 @@ function addon:AddIndicatorToButton(button,mission,missionID,bigscreen)
 		panel.Age:Hide()
 	else
 		panel.Percent:SetJustifyH("RIGHT")
-		panel.Age:SetFormattedText("Expires in \n%s",mission.offerTimeRemaining or self:CalculateAge(missionID))
-		panel.Age:SetTextColor(C.White())
-		local age=(mission.offerEndTime or GetTime() + 3600*24) -GetTime()
-		if age < 0 then age=0 end
-		local hours=floor(age/3600)
-		local q=self:GetDifficultyColor(hours+20,true)
-		panel.Age:SetTextColor(q.r,q.g,q.b)
+		panel.Age:SetFormattedText("Expires in \n%s",mission.offerTimeRemaining)
+		panel.Age:SetTextColor(self:GetAgeColor(mission.offerEndTime))
 		panel.Age:Show()
 	end
 -- XP display
@@ -2787,7 +2968,7 @@ function addon:AddFollowersToButton(button,mission,missionID,bigscreen)
 	local missionInfo=button.info
 	local missionID=missionInfo.missionID
 	local mission=missionInfo
-	if not mission then ns.print("Non ho la missione") return end -- something went wrong while refreshing
+	if not mission then print("Non ho la missione") return end -- something went wrong while refreshing
 	if (not bigscreen) then
 		local index=mission.numFollowers+mission.numRewards-3
 		local position=(index * -65) - 130
@@ -2827,7 +3008,10 @@ function over.GarrisonMissionList_SetTab(...)
 	end
 	if (HD) then addon:ResetSinks() end
 end
-
+function over.GarrisonMissionButton_OnClick(f,b)
+	print(f,f:GetName())
+	return orig.GarrisonMissionButton_OnClick(f,b)
+end

 --hooksecurefunc("GarrisonMissionList_Update",function(...)print("Original GarrisonMissionList_Update",...)end)
 override("GarrisonMissionPage_Close")
@@ -2836,9 +3020,11 @@ override("GarrisonMissionButton_SetRewards")
 override("GarrisonMissionButton_OnEnter")
 override("GarrisonMissionPageFollowerFrame_OnEnter")
 override("GarrisonMissionList_SetTab")
+override("GarrisonMissionButton_OnClick")

 GMF.MissionTab.MissionPage.CloseButton:SetScript("OnClick",over.GarrisonMissionPage_Close)
 for i=1,#GMFMissionListButtons do
 	local b=GMFMissionListButtons[i]
 	b:SetScript("OnEnter",over.GarrisonMissionButton_OnEnter)
 end
+_G.GAC=addon
\ No newline at end of file
diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc
index 4ef57a0..6104f31 100644
--- a/GarrisonCommander.toc
+++ b/GarrisonCommander.toc
@@ -37,4 +37,5 @@ FollowerPage.lua
 MatchMaker.lua
 FollowerRecruiting.lua
 BuildingPage.lua
+ShipYard.lua
 RelNotes.lua
diff --git a/GarrisonCommander.xml b/GarrisonCommander.xml
index a193710..fea07eb 100644
--- a/GarrisonCommander.xml
+++ b/GarrisonCommander.xml
@@ -406,4 +406,28 @@
 			<OnLeave function="GameTooltip_Hide"/>
 		</Scripts>
 	</Frame>
+	<Button name="GarrisonTraitCounterTemplate" inherits="GarrisonThreatCounterTemplate" virtual="true" enableMouse="true">
+		<Scripts>
+			<OnEnter function="GarrisonTraitCounter_OnEnter"/>
+			<OnLeave function="GameTooltip_Hide"/>
+		</Scripts>
+	</Button>
+	<Frame name="GarrisonTraitCountersFrame" hidden="true">
+		<Size x="10" y="10"/>
+		<Frames>
+			<Button parentArray="TraitsList" inherits="GarrisonTraitCounterTemplate">
+				<Anchors>
+					<Anchor point="TOPRIGHT" x="0" y="7"/>
+				</Anchors>
+			</Button>
+		</Frames>
+		<Scripts>
+			<OnLoad function="GarrisonTraitCountersFrame_OnLoad"/>
+			<OnEvent function="GarrisonTraitCountersFrame_OnEvent"/>
+			<OnShow function="GarrisonTraitCountersFrame_Update"/>
+		</Scripts>
+	</Frame>
+<!-- In 6.2.0 we can inherits
+	<Frame name="GarrisonThreatCountersFrame" inherits="GarrisonThreatCountersFrameTemplate" hidden="true"/>
+-->
 </Ui>
\ No newline at end of file
diff --git a/Init.lua b/Init.lua
index 6edc70e..0c47ba9 100644
--- a/Init.lua
+++ b/Init.lua
@@ -1,6 +1,5 @@
 local me, ns = ...
 local _G=_G
-local pp=print
 local setmetatable=setmetatable
 local next=next
 local pairs=pairs
@@ -11,10 +10,15 @@ local GetTime=GetTime
 local strjoin=strjoin
 local strspilit=strsplit
 local tostringall=tostringall
+local tostring=tostring
+local tonumber=tonumber
 --@debug@
 LoadAddOn("Blizzard_DebugTools")
 if LibDebug then LibDebug() end
 --@end-debug@
+--[===[@non-debug@
+setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
+--@end-non.debug@]===]
 ns.addon=LibStub("LibInit"):NewAddon(me,'AceHook-3.0','AceTimer-3.0','AceEvent-3.0','AceBucket-3.0')
 local chatframe=ns.addon:GetChatFrame("aDebug")
 local function pd(...)
@@ -28,18 +32,7 @@ ns.D=LibStub("LibDeformat-3.0")
 ns.C=ns.addon:GetColorTable()
 ns.L=ns.addon:GetLocale()
 ns.G=C_Garrison
-ns.print=ns.addon:Wrap("Print")
-ns.dprint=ns.print
-ns.trace=ns.addon:Wrap("Trace")
-ns.xprint=function() end
-ns.xdump=function() end
-ns.xtrace=function() end
 _G.GARRISON_FOLLOWER_MAX_ITEM_LEVEL = _G.GARRISON_FOLLOWER_MAX_ITEM_LEVEL or 675
---@debug@
-	ns.xprint=print
-	ns.xdump=function(d,t) pp("|cffff9900DMP|r",t) DevTools_Dump(d) end
-	ns.xtrace=print
---@end-debug@
 do
 	--@debug@
 	local newcount, delcount,createdcount,cached = 0,0,0
@@ -83,10 +76,10 @@ do
 		return n
 	end
 	function ns.addon:CacheStats()
-		ns.print("Created:",createdcount)
-		ns.print("Aquired:",newcount)
-		ns.print("Released:",delcount)
-		ns.print("Cached:",cached())
+		print("Created:",createdcount)
+		print("Aquired:",newcount)
+		print("Released:",delcount)
+		print("Cached:",cached())
 	end
 	--@end-debug@
 end
@@ -325,6 +318,7 @@ function addon:GetScroller(title,type,h,w)
 	w=w or 400
 	type=type or "Frame"
 	local scrollerWindow=AceGUI:Create("Frame")
+	--scrollerWindow.frame:SetAlpha(1)
 	scrollerWindow:SetTitle(title)
 	scrollerWindow:SetLayout("Fill")
 	--local scrollcontainer = AceGUI:Create("SimpleGroup") -- "InlineGroup" is also good
@@ -358,14 +352,22 @@ function addon:AddRow(obj,text,...)
 		obj:AddChild(l)
 	end
 end
+local function safesort(a,b)
+	if (tonumber(a) and tonumber(b)) then
+		return a < b
+	else
+		return tostring(a) < tostring(b)
+	end
+end
 function addon:cutePrint(scroll,level,k,v)
 	if (type(level)=="table") then
-		for k,v in pairs(level) do
+		for k,v in kpairs(level,safesort) do
 			self:cutePrint(scroll,"",k,v)
 		end
 		return
 	end
 	if (type(v)=="table") then
+		if (level:len()>6) then return end
 		self:AddRow(scroll,level..C(k,"Azure")..":" ..C("Table","Orange"))
 		for kk,vv in pairs(v) do
 			self:cutePrint(scroll,level .. "  ",kk,vv)
@@ -408,11 +410,11 @@ function addon:DumpIgnored()
 end
 function addon:DumpMission(missionID)
 	local scroll=self:GetScroller("MissionCache " .. self:GetMissionData(missionID,'name'))
-	self:cutePrint(scroll,cache.missions[missionID])
+	self:cutePrint(scroll,self:GetMissionData(missionID))
 end
 function addon:DumpMissions()
 	local scroll=self:GetScroller("MissionCache")
-	for id,data in pairs(cache.missions) do
+	for id,data in pairs(self:GetMissionData(missionID)) do
 		self:cutePrint(scroll,id .. '.'..data.name)
 	end
 end
@@ -428,7 +430,15 @@ function addon:DumpCounters(missionID)
 	self:cutePrint(scroll,counterThreatIndex[missionID])
 end
 function addon:Dump(title,data)
+	if type(data)=="string" then
+		data=_G[data]
+	end
+	if type(data) ~= "table" then
+		print(data,"is not a table")
+		return
+	end
 	local scroll=self:GetScroller(title)
+	print("Dumping",title)
 	self:cutePrint(scroll,data)
 	return scroll
 end
@@ -481,3 +491,4 @@ PlaySound("UI_Garrison_CommandTable_Open");

 --]]
 --@end-do-not-package@
+
diff --git a/MatchMaker.lua b/MatchMaker.lua
index eaaa204..dec00dc 100644
--- a/MatchMaker.lua
+++ b/MatchMaker.lua
@@ -1,5 +1,4 @@
 local me,ns=...
-local pp=print
 local addon=ns.addon --#addon
 local C=ns.C
 local P=ns.party
@@ -23,27 +22,58 @@ local extraTrainingTrait=80 --all followers +35
 local fastLearnerTrait=29 -- only this follower +50
 local hearthStoneProTrait=236 -- all followers +36
 local scavengerTrait=79 -- More resources
+local GARRISON_CURRENCY=GARRISON_CURRENCY
+local GARRISON_SHIP_OIL_CURRENCY=GARRISON_SHIP_OIL_CURRENCY
+--@debug@
+if LibDebug then LibDebug() end
+--@end-debug@
+--[===[@non-debug@
+setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
+--@end-non-debug@]===]
 local dbg
-local xprint=function(...) if dbg then ns.xprint(...) end end
-local xdump=function(...) if dbg then ns.xdump(...) end end
+local function formatScore(c,r,x,t,maxres,cap)
+	if (not maxres) then cap=100 end
+	return format("%03d%03d%03d%03d%01d",max(c,cap),r,c,x,t)
+end
 function addon:MissionScore(mission)
+	if ns.toc >=60200 then return self:xMissionScore(mission) end
+	if not mission then
+		return formatScore(0,1,0,0,false,0)
+	end
 	local totalTimeString, totalTimeSeconds, isMissionTimeImproved, successChance, partyBuffs, isEnvMechanicCountered, xpBonus, materialMultiplier,goldMultiplier = G.GetPartyMissionInfo(mission.missionID)
+	if type(materialMultiplier)=='table' then materialMultiplier=materialMultiplier[824] or 1 end
 	local r=math.min(mission.class=='resource' and materialMultiplier or (tonumber(xpBonus)or 0)/100,999)
 	local t=isMissionTimeImproved and 1 or 0
-	return format("%03d%03d%01d",successChance,r,t)
+	local x=mission.xp and xpBonus/mission.xp*100 or 0
+	return formatScore(successChance,r,x,t,self:GetBoolean("MAXRES"),self:GetBoolean("MASRESPERC"))
 end
-function addon:FollowerScore(mission,followerID)
-	local totalTimeString, totalTimeSeconds, isMissionTimeImproved, successChance, partyBuffs, isEnvMechanicCountered, xpBonus, materialMultiplier,goldMultiplier = G.GetPartyMissionInfo(mission.missionID)
-	local r=0
-	if mission.class=='resource' then r=materialMultiplier
-	--elseif mission.class=='xp' then r= xpBonus -- all time bonus
-	elseif mission.class=='gold' then r= goldMultiplier
-	else r=xpBonus>0 and 1 or 0
+function addon:xMissionScore(mission)
+	if (mission) then
+		local totalTimeString, totalTimeSeconds, isMissionTimeImproved, successChance, partyBuffs, isEnvMechanicCountered, xpBonus, materialMultiplier,goldMultiplier = G.GetPartyMissionInfo(mission.missionID)
+		local x=mission.xp and xpBonus/mission.xp*100 or 0
+		local r=0
+		if type(materialMultiplier)=='table' then
+			for _,v in pairs(mission.rewards) do
+				if v.currencyID then
+					if v.currencyID==0 then
+						r=r+goldMultiplier
+					else
+						r=r+(materialMultiplier[v.currencyID] or 0)
+					end
+				end
+			end
+		end
+		local t=isMissionTimeImproved and 1 or 0
+		return formatScore(successChance,r,x,t,self:GetBoolean("MAXRES"),self:GetBoolean("MASRESPERC"))
+	else
+		return formatScore(0,1,0,0,false,0)
 	end
+end

-	local t=isMissionTimeImproved and 1 or 0
-	local c=math.min((isEnvMechanicCountered and 1 or 0)+#partyBuffs,9)
-	return format("%03d%01d%01d%01d%04d",successChance,r,c,t,math.min(1000-self:GetFollowerData(followerID,'rank',90),999))
+
+function addon:FollowerScore(mission,followerID)
+	local score,chance=self:MissionScore(mission)
+	return format("%s %04d",score,followerID and math.min(1000-self:GetFollowerData(followerID,'rank',90),999)),chance
 end
 local filters={skipMaxed=false,skipBusy=false}
 function filters.nop(followerID)
@@ -65,31 +95,32 @@ function filters.xp(followerID,missionID)
 	return filters.maxed(followerID,missionID) or filters.generic(followerID,missionID)
 end
 --alias
-filters.resources=filters.generic
-filters.gold=filters.generic
-filters.equip=filters.generic
-filters.followerEquip=filters.generic
-filters.epic=filters.generic
+--filters.resources=filters.generic
+--filters.oil=filters.generic
+--filters.gold=filters.generic
+--filters.equip=filters.generic
+--filters.followerEquip=filters.generic
+--filters.epic=filters.generic
 local nop={addRow=function() end}
 local scroller=nop
 local function CreateFilter(missionClass)
 	local code = [[
-	local filters,xprint,pairs = ...
+	local filters,print,pairs = ...
 	local function filterdata(followers,missionID)
 		for followerID,_ in pairs(followers) do
 			if TEST then
-				xprint("Removing",C_Garrison.GetFollowerName(followerID),"due to TEST", TEST)
+				print("Removing",C_Garrison.GetFollowerName(followerID),"due to TEST", TEST)
 				followers[followerID] = nil
 			else
-				xprint("Keeping",C_Garrison.GetFollowerName(followerID),"due to TEST", TEST)
+				print("Keeping",C_Garrison.GetFollowerName(followerID),"due to TEST", TEST)
 			end
 		end
 	end
 	return filterdata
 	]]
 	code = code:gsub("TEST", " filters." ..missionClass .."(followerID,missionID)")
-	xprint("Compiling ",missionClass,"filterOut")
-	return assert(loadstring(code, "filterOut for " .. missionClass))(filters,xprint,pairs)
+	print("Compiling ",missionClass,"filterOut")
+	return assert(loadstring(code, "filterOut for " .. missionClass))(filters,print,pairs)
 end

 local filterTypes = setmetatable({}, {__index=function(self, missionClass)
@@ -99,7 +130,7 @@ local filterTypes = setmetatable({}, {__index=function(self, missionClass)
 end})
 local function AddMoreFollowers(self,mission,scores,justdo)
 	local missionID=mission.missionID
-	local filterOut=filters[mission.class]
+	local filterOut=filters[mission.class] or filters.generic
 	local missionScore=self:MissionScore(mission)

 	for p=1,P:FreeSlots() do
@@ -109,7 +140,7 @@ local function AddMoreFollowers(self,mission,scores,justdo)
 		local candidate=nil
 		local candidateScore=missionScore
 		for i=1,#scores do
-			local score,followerID=strsplit('|',scores[i])
+			local score,followerID,chance=strsplit('@',scores[i])
 			if (not filterOut(followerID,missionID) and not P:IsIn(followerID)) then
 				P:AddFollower(followerID)
 				local newScore=self:MissionScore(mission)
@@ -140,8 +171,8 @@ end
 local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 	local mission=self:GetMissionData(missionID)
 	local class=self:GetMissionData(missionID,'class')
-	xprint(C(format("MATCHMAKER %s (%d) class: %s",mission.name,missionID,class),'Orange'),includeBusy and "Busy" or "Ready")
-	local filterOut=filters[class]
+	print(C(format("MATCHMAKER %s (%d) class: %s",mission.name,missionID,class),'Orange'),includeBusy and "Busy" or "Ready")
+	local filterOut=filters[class] or filters.generic
 	filters.skipMaxed=self:GetBoolean("IGP")
 	if (includeBusy==nil) then
 		filters.skipBusy=self:GetBoolean("IGM")
@@ -149,6 +180,7 @@ local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 		filters.skipBusy=not includeBusy
 	end
 	local scores=new()
+	local fillers=new()
 	P:Open(missionID,mission.numFollowers)
 	--[[
 	local buffed=G.GetBuffedFollowersForMission(missionID)
@@ -168,7 +200,12 @@ local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 	for _,followerID in self:GetFollowerIterator() do
 		--if (not buffed[followerID]) then
 		if P:AddFollower(followerID) then
-			tinsert(scores,format("%s0|%s",self:FollowerScore(mission,followerID),followerID))
+			local score,chance=self:FollowerScore(mission,followerID)
+			if (score~=self:FollowerScore(nil,followerID) and chance >10) then
+				tinsert(scores,format("%s@%s",score,followerID))
+			else
+				tinsert(fillers,format("%s@%s",score,followerID))
+			end
 			P:RemoveFollower(followerID)
 		end
 		--end
@@ -178,15 +215,15 @@ local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 		table.sort(scores)
 		if (dbg) then
 			for i=1,#scores do
-				local score,followerID=strsplit('|',scores[i])
-				local t=score:gsub("(%d%d%d)(%d)(%d)(%d)(%d*)","%1%% r:%2 t:%3d b:%4 Rank:%5 ") .. addon:GetFollowerData(followerID,'fullname') .. " " .. tostring(G.GetFollowerStatus(followerID))
+				local score,followerID=strsplit('@',scores[i])
+				local t=score .. " " .. addon:GetFollowerData(followerID,'fullname') .. " " .. tostring(G.GetFollowerStatus(followerID))
 				scroller:addRow(t)
 			end
 		else
 			scroller=nop
 		end
 		for i=#scores,1,-1 do
-			local score,followerID=strsplit('|',scores[i])
+			local score,followerID=strsplit('@',scores[i])
 			if not firstmember and not filterOut(followerID,missionID) then
 				firstmember=followerID
 				break
@@ -204,17 +241,25 @@ local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 	if P:FreeSlots() > 0 then
 		if not onlyBest then
 			filters.skipMaxed=false
-			xprint("           AddMore 1 with skipmaxed false",filters.skipMaxed)
+			print("           AddMore 1 with skipmaxed false",filters.skipMaxed)
 			AddMoreFollowers(self,mission,scores)
 		end
 	end
 	if P:FreeSlots() > 0 then
 		filters.skipMaxed=false
-		xprint("           AddMore 1 with just do true")
+		print("           AddMore 1 with just do true")
 		AddMoreFollowers(self,mission,scores,true)
 	end
-	if dbg then P:Dump() end
-	xprint("Final score",self:MissionScore(mission))
+	if P:FreeSlots() > 0 then
+		filters.skipMaxed=false
+		print("           AddMore 1 with just do true")
+		AddMoreFollowers(self,mission,fillers,true)
+	end
+	if dbg then
+		P:Dump()
+		scroller:AddRow("Final score: " .. self:MissionScore(mission))
+	end
+	print("Final score",self:MissionScore(mission))
 	if not party.class then
 		party.class=class
 		party.itemLevel=mission.itemLevel
@@ -247,7 +292,7 @@ function addon:MatchMaker(missionID,party,includeBusy)
 end
 function addon:TestMission(missionID,includeBusy)
 	dbg=true
-	scroller=self:GetScroller("Scores")
+	scroller=self:GetScroller("Score for " .. missionID)
 	local party=new()
 	party.members=new()
 	self:MatchMaker(missionID,party,includeBusy)
diff --git a/MissionCache.lua b/MissionCache.lua
index c5919c6..f4ac466 100644
--- a/MissionCache.lua
+++ b/MissionCache.lua
@@ -11,8 +11,10 @@ local select=select
 local pairs=pairs
 local tonumber=tonumber
 local tinsert=tinsert
+local tcontains=tContains
 local wipe=wipe
 local GARRISON_CURRENCY=GARRISON_CURRENCY
+local GARRISON_SHIP_OIL_CURRENCY=GARRISON_SHIP_OIL_CURRENCY
 local GARRISON_FOLLOWER_MAX_LEVEL=GARRISON_FOLLOWER_MAX_LEVEL
 local Mbase = GMFMissions
 -- self=Mbase
@@ -21,6 +23,8 @@ local Mbase = GMFMissions
 local Index={}
 local sorted={}
 local AddExtraData
+local ItemRewards={122484,118529,128391}
+local rushOrders="interface\\icons\\inv_scroll_12.blp"
 local function keyToIndex(key)
 	local idx=Index[key]
 	if (idx and idx <= #Mbase.availableMissions) then
@@ -55,9 +59,15 @@ function addon:GetMissionData(missionID,key,default)
 	if not mission then
 		mission=self:GetModule("MissionCompletion"):GetMission(missionID)
 		if mission then
+			if type(mission.improvedDurationSeconds)~='number' then
+				mission.improvedDurationSeconds=mission.durationSeconds
+			end
 			mission.improvedDurationSeconds=mission.isMissionTimeImproved and mission.improvedDurationSeconds/2 or mission.improvedDurationSeconds
 		end
 	end
+	if not mission then
+		mission=G.GetMissionInfo(missionID)
+	end
 --@debug@
 	if not mission then
 		self:Print("Could not find info for mission",missionID,G.GetMissionName(missionID))
@@ -96,25 +106,33 @@ function AddExtraData(mission)
 	_,mission.xp,mission.type,mission.typeDesc,mission.typeIcon,mission.locPrefix,_,mission.enemies=G.GetMissionInfo(mission.missionID)
 	mission.rank=mission.level < GARRISON_FOLLOWER_MAX_LEVEL and mission.level or mission.iLevel
 	mission.resources=0
+	mission.oil=0
 	mission.gold=0
 	mission.followerUpgrade=0
 	mission.itemLevel=0
 	mission.xpBonus=0
 	mission.others=0
 	mission.xp=mission.xp or 0
+	mission.rush=0
+	mission.chanceCap=100
 	local numrewards=0
 	for k,v in pairs(mission.rewards) do
 		numrewards=numrewards+1
-		if (k==615 and v.followerXP) then mission.xpBonus=mission.xpBonus+v.followerXP end
-		if (v.currencyID and v.currencyID==GARRISON_CURRENCY) then mission.resources=v.quantity end
-		if (v.currencyID and v.currencyID==0) then mission.gold =mission.gold+v.quantity/10000 end
-		if (v.icon=="Interface\\Icons\\XPBonus_Icon" and v.followerXP) then
+		if k==615 and v.followerXP then mission.xpBonus=mission.xpBonus+v.followerXP end
+		if v.currencyID and v.currencyID==GARRISON_CURRENCY then mission.resources=v.quantity end
+		if v.currencyID and v.currencyID==GARRISON_SHIP_OIL_CURRENCY then mission.oil=v.quantity end
+		if v.currencyID and v.currencyID==0 then mission.gold =mission.gold+v.quantity/10000 end
+		if v.icon=="Interface\\Icons\\XPBonus_Icon" and v.followerXP then
 			mission.xpBonus=mission.xpBonus+v.followerXP
 		elseif (v.itemID) then
-			if (v.itemID~=120205) then -- xp item
+			if tcontains(ItemRewards,v.itemID) then
+				mission.itemLevel=655
+			elseif v.itemID~=120205 then -- xp item
 				local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(v.itemID)
-				if (itemName and (not v.quantity or v.quantity==1) and not v.followerXP ) then
-					if (itemLevel > 1 and itemMinLevel >=90 ) then
+				if itemTexture:lower()==rushOrders then
+					mission.rush=1
+				elseif itemName and (not v.quantity or v.quantity==1) and not v.followerXP then
+					if itemLevel > 1 and itemMinLevel >=90 then
 						mission.itemLevel=itemLevel
 					else
 						mission.followerUpgrade=itemRarity
@@ -125,24 +143,32 @@ function AddExtraData(mission)
 			end
 		end
 	end
-	if (mission.resources==0 and mission.gold==0 and mission.itemLevel==0 and mission.followerUpgrade==0 and mission.others==0 and numrewards <2) then
-		mission.xpOnly=true
-		mission.class="xp"
+	mission.xpOnly=false
+	if mission.resources > 0 then
+		mission.class='resources'
+		mission.chanceCap=addon:GetNumber('MAXRESCHANCE',80)
+		mission.mat=true
+	elseif mission.oil > 0 then
+		mission.class='oil'
+		mission.chanceCap=addon:GetNumber('MAXRESCHANCE',80)
+		mission.mat=true
+	elseif mission.gold >0 then
+		mission.class='gold'
+		mission.chanceCap=addon:GetNumber('MAXRESCHANCE',80)
+		mission.mat=true
+	elseif mission.itemLevel >0 then
+		mission.class='equip'
+	elseif mission.followerUpgrade>0 then
+		mission.class='followerEquip'
+	elseif mission.itemLevel>=645 then
+		mission.class='epic'
+	elseif mission.rush>=0 then
+		mission.class='rush'
+	elseif numrewards > 1 then
+		mission.class='generic'
 	else
-		mission.xpOnly=false
-		if mission.resources > 0 then
-			mission.class='resources'
-		elseif mission.gold >0 then
-			mission.class='gold'
-		elseif mission.itemLevel >0 then
-			mission.class='equip'
-		elseif mission.followerUpgrade>0 then
-			mission.class='followerEquip'
-		elseif mission.itemLevel>=645 then
-			mission.class='epic'
-		else
-			mission.class='generic'
-		end
+		mission.class='xp'
+		mission.xpOnly=true
 	end
 	mission.globalXp=(mission.xp+mission.xpBonus+(addon:GetParty(mission.missionID)['xpBonus'] or 0) )*mission.numFollowers

@@ -173,3 +199,5 @@ function addon:GetMissionIterator(func)
 		end
 	end,sorted,0
 end
+local GSF=GarrisonShipyardFrame
+
diff --git a/MissionCompletion.lua b/MissionCompletion.lua
index 1718c89..b0d4fe1 100644
--- a/MissionCompletion.lua
+++ b/MissionCompletion.lua
@@ -6,14 +6,18 @@ local C=ns.C
 local AceGUI=ns.AceGUI
 local _G=_G
 --@debug@
---if LibDebug() then LibDebug() end
+if LibDebug then LibDebug() end
 --@end-debug@
-local xprint=ns.xprint
+--[===[@non-debug@
+setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
+--@end-non-debug@]===]
+
 local new, del, copy =ns.new,ns.del,ns.copy
 local GMF=GarrisonMissionFrame
 local GMFMissions=GarrisonMissionFrameMissions
 local G=C_Garrison
 local GARRISON_CURRENCY=GARRISON_CURRENCY
+local GARRISON_SHIP_OIL_CURRENCY=_G.GARRISON_SHIP_OIL_CURRENCY or 0
 local pairs=pairs
 local format=format
 local strsplit=strsplit
@@ -66,7 +70,7 @@ local function startTimer(delay,event,...)
 	stopTimer()
 	timer=module:ScheduleRepeatingTimer("MissionAutoComplete",delay,event,...)
 	--@alpha@
-	addon:Dprint("Timer rearmed for",event,delay)
+	print("Timer rearmed for",event,delay)
 	--@end-alpha@
 end
 function module:MissionsCleanup()
@@ -80,10 +84,10 @@ function module:MissionsCleanup()
 	GarrisonMissionList_UpdateMissions()
 	-- Re-enable "view" button
 	GMFMissions.CompleteDialog.BorderFrame.ViewButton:SetEnabled(true)
+	addon:OpenLastTab()
 	if ns.toc < 60200 then
-		GarrisonMissionFrame_SelectTab(1)
+		GarrisonMissionFrame_CheckCompleteMissions()
 	end
-	GarrisonMissionFrame_CheckCompleteMissions()
 end
 function module:Events(on)
 	if (on) then
@@ -119,6 +123,8 @@ function module:MissionComplete(this,button)

 			local _
 			_,_,m.isMissionTimeImproved,m.successChance,_,_,m.xpBonus,m.resourceMultiplier,m.goldMultiplier=G.GetPartyMissionInfo(m.missionID)
+			if type(m.resourceMultiplier)=='table' then m.resourceMultiplier=m.resourceMultiplier[824] or 1 end
+
 		end
 --@debug@
 		self:Dump("Completed missions",missions)
@@ -146,7 +152,7 @@ function module:MissionAutoComplete(event,ID,arg1,arg2,arg3,arg4)
 -- C_Garrison.MarkMissionComplete Mark mission as complete and prepare it for bonus roll, da chiamare solo in caso di successo
 -- C_Garrison.MissionBonusRoll
 --@alpha@
-	self:Dprint("evt",event,ID,arg1 or'',arg2 or '',arg3 or '')
+	print("evt",event,ID,arg1 or'',arg2 or '',arg3 or '')
 --@end-alpha@
 	if event=="LOOT" then
 		return self:MissionsPrintResults()
@@ -203,13 +209,13 @@ function module:MissionAutoComplete(event,ID,arg1,arg2,arg3,arg4)
 			end
 			if (step==0) then
 				--@alpha@
-				self:Dprint("Fired mission complete for",currentMission.missionID)
+				print("Fired mission complete for",currentMission.missionID)
 				--@end-alpha@
 				G.MarkMissionComplete(currentMission.missionID)
 				startTimer(2)
 			elseif (step==1) then
 				--@alpha@
-				self:Dprint("Fired bonus roll complete for",currentMission.missionID)
+				print("Fired bonus roll complete for",currentMission.missionID)
 				--@end-alpha@
 				G.MissionBonusRoll(currentMission.missionID)
 				startTimer(2)
diff --git a/MissionControl.lua b/MissionControl.lua
index df9eda1..0c360ff 100644
--- a/MissionControl.lua
+++ b/MissionControl.lua
@@ -23,7 +23,6 @@ local GMCUsedFollowers={}
 local wipe=wipe
 local pairs=pairs
 local tinsert=tinsert
-local xprint=ns.xprint
 --@debug@
 _G.GAC=addon
 if LibDebug then LibDebug() end
@@ -40,20 +39,20 @@ function addon:GMCCreateMissionList(workList)
 	for _,missionID in self:GetMissionIterator() do
 		local discarded=false
 		repeat
-			xprint("|cffff0000",'Examing',self:GetMissionData(missionID,"name"),self:GetMissionData(missionID,"class"),"|r")
+			print("|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
-				xprint(missionID,"discarded due to len",durationSeconds /3600)
+				print(missionID,"discarded due to len",durationSeconds /3600)
 				break
 			end -- Mission too long, out of here
 			if (self:GetMissionData(missionID,'isRare') and settings.skipRare) then
-				xprint(missionID,"discarded due to rarity")
+				print(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
-						xprint(missionID,"discarded due to class == ", k)
+						print(missionID,"discarded due to class == ", k)
 						discarded=true
 						break
 					end
@@ -86,7 +85,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)
-	xprint("Asked to start mission",missionID)
+	print("Asked to start mission",missionID)
 	if (start) then
 		G.StartMission(missionID)
 		PlaySound("UI_Garrison_CommandTable_MissionStart")
@@ -94,7 +93,7 @@ function addon:GMCRunMission(missionID,start)
 	end
 	for i=1,#GMC.ml.Parties do
 		local party=GMC.ml.Parties[i]
-		xprint("Checking",party.missionID)
+		print("Checking",party.missionID)
 		if (missionID and party.missionID==missionID or not missionID) then
 			GMC.ml.widget:RemoveChild(party.missionID)
 			GMC.ml.widget:DoLayout()
@@ -151,7 +150,7 @@ do
 				local checkprio=class
 				if checkprio=="itemLevel" then class="equip" end
 				if checkprio=="followerUpgrade" then class= "followerEquip" end
-				xprint(C("Processing ","Red"),missionID,addon:GetMissionData(missionID,"name"))
+				print(C("Processing ","Red"),missionID,addon:GetMissionData(missionID,"name"))
 				local minimumChance=0
 				if (GMC.settings.useOneChance) then
 					minimumChance=tonumber(GMC.settings.minimumChance) or 100
@@ -160,9 +159,9 @@ do
 				end
 				local party={members={},perc=0}
 				self:MCMatchMaker(missionID,party,GMC.settings.skipEpic)
-				xprint ("                           Requested",class,";",minimumChance,"Mission",party.perc,party.full)
+				print ("                           Requested",class,";",minimumChance,"Mission",party.perc,party.full)
 				if ( party.full and party.perc >= minimumChance) then
-					xprint("                           Mission accepted")
+					print("                           Mission accepted")
 					local mb=AceGUI:Create("GMCMissionButton")
 					for i=1,#party.members do
 						GMCUsedFollowers[party.members[i]]=true
@@ -205,7 +204,7 @@ function addon:GMC_OnClick_Run(this,button)
 	end
 end
 function addon:GMC_OnClick_Start(this,button)
-	xprint(C("-------------------------------------------------","Yellow"))
+	print(C("-------------------------------------------------","Yellow"))
 	GMC.ml.widget:ClearChildren()
 	if (self:GetTotFollowers(AVAILABLE) == 0) then
 		GMC.ml.widget:SetTitle("All followers are busy")
@@ -458,7 +457,9 @@ function addon:GMCBuildRewards()

 	local t = {
 		{t = 'Enable/Disable money rewards.', i = 'Interface\\Icons\\inv_misc_coin_01', key = 'gold'},
-		{t = 'Enable/Disable other currency awards. (Resources/Seals)', i= 'Interface\\Icons\\inv_garrison_resource', key = 'resources'},
+		{t = 'Enable/Disable resource awards. (Resources/Seals)', i= 'Interface\\Icons\\inv_garrison_resource', key = 'resources'},
+		{t = 'Enable/Disable oil awards.', i= 'Interface\\Icons\\garrison_oil', key = 'oil'},
+		{t = 'Enable/Disable rush scroll.', i= 'Interface\\ICONS\\INV_Scroll_12', key = 'scroll'},
 		{t = 'Enable/Disable Follower XP Bonus rewards.', i = 'Interface\\Icons\\XPBonus_Icon', key = 'xp'},
 		{t = 'Enable/Disable follower equip enhancement.', i = 'Interface\\ICONS\\Garrison_ArmorUpgrade', key = 'followerEquip'},
 		{t = 'Enable/Disable item tokens.', i = "Interface\\ICONS\\INV_Bracer_Cloth_Reputation_C_01", key = 'equip'},
@@ -542,6 +543,7 @@ do
 		xp=L["Xp gain"],
 		gold=L["Gold Reward"],
 		resources=L["Resource Rewards"],
+		oil=L["Oil"],
 		generic=L["Other Rewards"]
 	}
 	prioVoices=0
diff --git a/PartyCache.lua b/PartyCache.lua
index c80d7d5..4000db7 100644
--- a/PartyCache.lua
+++ b/PartyCache.lua
@@ -52,7 +52,6 @@ local function addPartyMissionInfo(desttable,missionID)
 		desttable.xpBonus,
 		desttable.materialMultiplier,
 		desttable.goldMultiplier = G.GetPartyMissionInfo(missionID)
-		desttable.materialMultiplier=1
 	end
 end
 ns.party={}
@@ -95,11 +94,11 @@ function party:IsEmpty()
 end

 function party:Dump()
-	ns.xprint("Dumping party for mission",ID)
+	print("Dumping party for mission",ID)
 	for i=1,#members do
-		ns.xprint(addon:GetFollowerData(members[i],'fullname'),G.GetFollowerStatus(members[i] or 1))
+		print(addon:GetFollowerData(members[i],'fullname'),G.GetFollowerStatus(members[i] or 1))
 	end
-	ns.xprint(G.GetPartyMissionInfo(ID))
+	print(G.GetPartyMissionInfo(ID))
 end

 function party:AddFollower(followerID)
@@ -115,8 +114,8 @@ function party:AddFollower(followerID)
 			return true
 --@debug@
 		else
-			ns.xprint("Unable to add",followerID, G.GetFollowerName(followerID),"to",ID,code,self:IsIn(followerID),G.GetFollowerStatus(followerID))
-			ns.xprint(members[1],members[2],members[3])
+			print("Unable to add",followerID, G.GetFollowerName(followerID),"to",ID,code,self:IsIn(followerID),G.GetFollowerStatus(followerID))
+			print(members[1],members[2],members[3])
 			print(debugstack(1,6,0))
 --@end-debug@
 		end
@@ -165,9 +164,6 @@ function party:Close(desttable)
 	end
 	if (desttable) then
 		addPartyMissionInfo(desttable,ID)
-		if (ns.toc < 60100) then
-			desttable.goldMultiplier = 1
-		end
 		desttable.full=self:FreeSlots()==0
 		desttable.threats=desttable.threats or {}
 		wipe(desttable.threats)
diff --git a/ShipYard.lua b/ShipYard.lua
new file mode 100644
index 0000000..03057e1
--- /dev/null
+++ b/ShipYard.lua
@@ -0,0 +1,24 @@
+local me, ns = ...
+local addon=ns.addon --#addon
+local L=ns.L
+local D=ns.D
+local C=ns.C
+local AceGUI=ns.AceGUI
+local _G=_G
+--@debug@
+--if LibDebug() then LibDebug() end
+--@end-debug@
+local new, del, copy =ns.new,ns.del,ns.copy
+local GMF=GarrisonMissionFrame
+local GMFMissions=GarrisonMissionFrameMissions
+local G=C_Garrison
+local GARRISON_CURRENCY=GARRISON_CURRENCY
+local pairs=pairs
+local format=format
+local strsplit=strsplit
+local generated
+local module=addon:NewSubClass('ShipYard') --#Module
+function module:OnInitialize()
+	self:Print("ShipYard Loaded")
+end
+print("CIAOCIAO")
\ No newline at end of file
diff --git a/doc.txt b/doc.txt
index 9e14563..0739699 100644
--- a/doc.txt
+++ b/doc.txt
@@ -384,7 +384,7 @@ GetNumActiveFollowers",
 GetNumFollowerActivationsRemaining",
 GetNumFollowerDailyActivations",
 GetNumFollowers",
-GetNumFollowersForMechanic",
+GetNumFollowersForMechanic(MechanicId)",
 GetNumFollowersOnMission",
 GetNumPendingShipments",
 GetNumShipmentReagents",