Quantcast

2.5.0 for 6.2

Alar of Daggerspine [06-21-15 - 21:30]
2.5.0 for 6.2

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
BuildingPage.lua
Debug.lua
FollowerCache.lua
FollowerPage.lua
FollowerRecruiting.lua
GarrisonCommander.lua
GarrisonCommander.toc
GarrisonCommander.xml
Init.lua
MatchMaker.lua
MissionCache.lua
MissionCompletion.lua
MissionControl.lua
PartyCache.lua
ShipYard.lua
Widgets.lua
wowhead.lua
diff --git a/BuildingPage.lua b/BuildingPage.lua
index 199c52e..216ed14 100644
--- a/BuildingPage.lua
+++ b/BuildingPage.lua
@@ -8,22 +8,14 @@ followerTooltip="colore + nome del follower"
 size= level
 Plot=framde del piedistallino
 Icon e IconRing contenuto e nordo dell'iconcina
-
-
 --]]
 local me,ns=...
-local addon=ns.addon
---@debug@
-if LibDebug then LibDebug() end
---@end-debug@
+ns.Configure()
+local addon=addon
 local GBF=GarrisonBuildingFrame
 local GBFMap=GBF.MapFrame
-local G=C_Garrison
 local CreateFrame=CreateFrame
 local GARRISON_FOLLOWER_MAX_LEVEL=GARRISON_FOLLOWER_MAX_LEVEL
-local L=ns.L
-local D=ns.D
-local C=ns.C
 local new,del=ns.new,ns.del
 local module=addon:NewSubClass("BuildingPage") --#module
 function module:OnInitialize()
diff --git a/Debug.lua b/Debug.lua
index 09ffd19..d0b6270 100644
--- a/Debug.lua
+++ b/Debug.lua
@@ -298,10 +298,12 @@ local function traitGen()
 end
 local trackedEvents={}
 local function eventTrace ( self, event, ... )
-	if (event:find("GARRISON",1,true)) then
+	if (event=="VARIABLES_LOADED") then
+		trackedEvents=ATEINFO.trackedEvents or {}
+	elseif (event:find("GARRISON",1,true)) then
 		local signature="("..event
 		for i=1,select('#',...) do
-			signature=','..signature..type(select(i,...))
+			signature=','..signature.." ".. tostring(select(i,...))
 		end
 		signature=signature..")"
 		trackedEvents[event]=signature
@@ -385,6 +387,7 @@ function addon:DumpSinks()
 	table.sort(sorted,function(a,b) return a>b end)
 	self:cutePrint(scroll,sorted)
 end
+_G.GAC=addon
 --[[
 PlaySound("UI_Garrison_CommandTable_Open");
 	PlaySound("UI_Garrison_CommandTable_Close");
diff --git a/FollowerCache.lua b/FollowerCache.lua
index dcff76d..fd98eb3 100644
--- a/FollowerCache.lua
+++ b/FollowerCache.lua
@@ -1,35 +1,229 @@
 local me,ns=...
-local addon=ns.addon --#addon
-local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
-local xdump=ns.xdump
+ns.Configure()
+print("loaded")
+local addon=addon --#addon
+--local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
 --upvalue
-local C=ns.C
-local G=C_Garrison
-local GMF=GarrisonMissionFrame
 local type=type
 local select=select
 local pairs=pairs
 local tonumber=tonumber
 local tinsert=tinsert
-local Mbase = GarrisonMissionFrameFollowers
+local tContains=tContains
+local wipe=wipe
+local Mbase = {}
 local GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY=GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY
 local GARRISON_FOLLOWER_MAX_LEVEL=GARRISON_FOLLOWER_MAX_LEVEL
 local format=format
 local tostring=tostring
 local GetItemInfo=GetItemInfo
-local index={}
-local names={}
-local sorted={}
-local threats={}
-local traits={}
+local LE_FOLLOWER_TYPE_GARRISON_6_0=_G.LE_FOLLOWER_TYPE_GARRISON_6_0
+local LE_FOLLOWER_TYPE_SHIPYARD_6_2=_G.LE_FOLLOWER_TYPE_SHIPYARD_6_2
+local maxrank=GARRISON_FOLLOWER_MAX_UPGRADE_QUALITY*1000+GARRISON_FOLLOWER_MAX_LEVEL
+local module=addon:NewSubClass('FollowerCache')
+local cache={} --#cache
+local EMPTY={}
+function module:OnInitialized()
+	self:RegisterEvent("GARRISON_FOLLOWER_REMOVED","OnEvent")
+	self:RegisterEvent("GARRISON_FOLLOWER_ADDED","OnEvent")
+	self:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE","OnEvent")
+	self:RegisterEvent("GARRISON_FOLLOWER_UPGRADED","OnEvent")
+	self:RegisterEvent("GARRISON_FOLLOWER_XP_CHANGED","OnEvent")
+	self.followerCache=cache:new(LE_FOLLOWER_TYPE_GARRISON_6_0)
+	self.shipCache=cache:new(LE_FOLLOWER_TYPE_SHIPYARD_6_2)
+end
+function module:OnEvent(event,...)
+	local followerID=...
+	if self.shipCache.cache[followerID].followerID then
+		self.shipCache:OnEvent(event,...)
+	elseif self.followerCache.cache[followerID].followerID then
+		self.followerCache:OnEvent(event,...)
+	else
+		self.followerCache:Wipe()
+		self.shipCache:Wipe()
+	end
+	print(event,...)
+end
+function cache:new(type)
+	local rc=setmetatable({type=type,names={},sorted={},threats={},traits={},cache={}},{__index=self})
+	setmetatable(rc.cache,{__index=function(t,k) return EMPTY end})
+	return rc
+end
+function cache:OnEvent(event,...)
+	print(event,...)
+	if event=="GARRISON_FOLLOWER_UPGRADED" or event=="GARRISON_FOLLOWER_XP_CHANGED" then
+		local followerID=...
+		if (self.cache[followerID]) then
+			self:AddExtraData(self.cache[followerID])
+			if event=="GARRISON_FOLLOWER_UPGRADED" then
+				self:AddAbilities(self.cache[followerID])
+			end
+		end
+	else
+		self:Wipe()
+	end
+end
+function cache:Wipe()
+	wipe(self.sorted)
+	wipe(self.names)
+	wipe(self.threats)
+	wipe(self.traits)
+	wipe(self.cache)
+end
+function cache:Refresh()
+	if next(self.cache) then return end
+	self:Wipe()
+	for _,follower in pairs(G.GetFollowers(self.type)) do
+		if follower.isCollected then
+			self:AddExtraData(follower)
+			self:AddAbilities(follower)
+			local i=follower.followerID
+			self.names[follower.name]=i
+			tinsert(self.sorted,i)
+			self.cache[i]=follower
+		end
+
+	end
+end
+function cache:AddAbilities(follower)
+	if (follower.abilities) then
+		local followerID=follower.followerID
+		for _,ability in pairs(follower.abilities) do
+			local t=self.traits[ability.id]
+			if t then
+				for i=1,#t do if t[i]==followerID then tremove(t,i) break end end
+			end
+			if (not ability.isTrait) then
+				for id,_ in pairs(ability.counters) do
+					local t=self.threats[id]
+					if t then
+						for i=1,#t do if t[i]==followerID then tremove(t,i) break end end
+					end
+				end
+			end
+		end
+		follower.abilities=nil
+	end
+	follower.abilities=G.GetFollowerAbilities(follower.followerID)
+	if (follower.abilities) then
+		local followerID=follower.followerID
+		for _,ability in pairs(follower.abilities) do
+			self.traits[ability.id]=self.traits[ability.id]or {}
+			tinsert(self.traits[ability.id],followerID)
+			if (not ability.isTrait) then
+				for id,_ in pairs(ability.counters) do
+					self.threats[id]=self.threats[id]or {}
+					tinsert(self.threats[id],followerID)
+				end
+			end
+		end
+	end
+
+end
+function cache:AddExtraData(follower)
+	follower.rank=follower.level < GARRISON_FOLLOWER_MAX_LEVEL and follower.level or follower.iLevel
+	follower.qLevel=follower.quality*1000+follower.level
+	follower.coloredname=C(follower.name,tostring(follower.quality))
+	follower.fullname=format("%3d %s",follower.rank,follower.coloredname)
+	follower.maxed=follower.qLevel>=maxrank
+	local weaponItemID, weaponItemLevel, armorItemID, armorItemLevel = G.GetFollowerItems(follower.followerID);
+	follower.weaponItemID=weaponItemID
+	follower.weaponItemLevel=weaponItemLevel
+	follower.armorItemID=armorItemID
+	follower.armorItemLevel=armorItemLevel
+	follower.weaponQuality=select(3,GetItemInfo(weaponItemID))
+	follower.armorQuality=select(3,GetItemInfo(armorItemID))
+end
+
+function cache:HasTrait(followerID,trait)
+	local list=self.traits[trait]
+	if list then return tContains(list,followerID) end
+end
+function cache:HasAbility(followerID,trait)
+	return self:HasTrait(followerID,trait)
+end
+function cache:CanCounter(followerID,threat)
+	local list=self.threats[threat]
+	if list then return tContains(list,followerID) end
+end
+function cache:GetFollowerData(followerID,key,default)
+	self:Refresh()
+	if type(followerID)~="string" then return self.cache end
+	if (followerID:sub(1,2)~="0x") then
+		followerID=self.names[followerID]
+	end
 --@debug@
-if LibDebug then LibDebug() end
+	assert(followerID)
 --@end-debug@
---[===[@non-debug@
-setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
---@end-non-debug@]===]
-local LE_FOLLOWER_TYPE_GARRISON_6_0=LE_FOLLOWER_TYPE_GARRISON_6_0
-local LE_FOLLOWER_TYPE_SHIPYARD_6_2=LE_FOLLOWER_TYPE_SHIPYARD_6_2
+	if not followerID then
+		return key and default or EMPTY
+	end
+	if not key then
+		return self.cache[followerID]
+	else
+		return self.cache[followerID][key] or default
+	end
+end
+local sorters={}
+sorters.leveldesc = function(a,b)
+	return (Mbase.followers[a].iLevel * 10 + Mbase.followers[a].level) >  (Mbase.followers[b].iLevel * 10 + Mbase.followers[b].level)
+end
+sorters.levelasc = function(a,b)
+	return (Mbase.followers[a].iLevel * 10 + Mbase.followers[a].level) <  (Mbase.followers[b].iLevel * 10 + Mbase.followers[b].level)
+end
+
+
+---@function
+-- Iterator function
+-- @param func type of sorting (can be mitted if we dont care)
+--
+function cache:GetFollowersIterator(func)
+	self:Refresh()
+	if type(func)=="function" then
+		table.sort(self.sorted,sorters[func])
+	end
+	local f=self.cache
+	return function(sorted,i)
+		i=i+1
+		local x = sorted[i]
+		if x then
+			local v=f[x] and f[x].followerID or nil
+			if v then
+				return i,v
+			end
+		end
+	end,self.sorted,0
+end
+function cache:GetFollowersWithTrait(trait)
+	self:Refresh()
+	return self.traits[trait]
+end
+function cache:GetFollowersWithCounterFor(threat)
+	self:refresh()
+	return self.threats[threat]
+end
+
+-- Addon level proxies
+function addon:GetFollowerData(followerID,key,default)
+	return module.followerCache:GetFollowerData(followerID,key,default)
+end
+function addon:GetShipData(followerID,key,default)
+	return module.shipCache:GetFollowerData(followerID,key,default)
+end
+function addon:GetFollowersWithTrait(trait)
+	return module.followerCache:GetFollowersWithTrait(trait)
+end
+function addon:GetFollowersWithCounterFor(threat)
+	return module.followerCache:GetFollowersWithCounterFor(threat)
+end
+function addon:GetFollowersIterator(func)
+	return module.followerCache:GetFollowersIterator(func)
+end
+function addon:GetShipsIterator(func)
+	return module.shipCache:GetFollowersIterator(func)
+end
+
+--[=[
 local function keyToIndex(key)
 	if (not Mbase.followers or not next(Mbase.followers)) then
 		Mbase.dirtyList=false
@@ -142,7 +336,7 @@ end
 -- Iterator function
 -- @param func type of sorting (can be mitted if we dont care)
 --
-function addon:GetFollowerIterator(func,followerTypeID)
+function addon:GetFollowersIterator(func,followerTypeID)
 	keyToIndex()
 	if type(func)=="function" then
 		table.sort(sorted,sorters[func])
@@ -160,8 +354,11 @@ function addon:GetFollowerIterator(func,followerTypeID)
 	end,sorted,0
 end
 function addon:GetFollowersWithTrait(trait)
+	if not next(traits) then keyToIndex() end
 	return traits[trait]
 end
 function addon:GetFollowersWithCounterFor(threat)
+	if not next(traits) then keyToIndex() end
 	return threats[threat]
-end
\ No newline at end of file
+end
+--]=]
\ No newline at end of file
diff --git a/FollowerPage.lua b/FollowerPage.lua
index 9a1b862..c305683 100644
--- a/FollowerPage.lua
+++ b/FollowerPage.lua
@@ -1,25 +1,9 @@
 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 pp=print
 local _G=_G
-local new, del, copy =ns.new,ns.del,ns.copy
--- Courtesy of Motig
--- Concept and interface reused with permission
--- Mission building rewritten from scratch
---local GMC_G = {}
+ns.Configure()
+local addon=ns.addon --#addon
 local factory=addon:GetFactory()
---GMC_G.frame = CreateFrame('FRAME')
-local aMissions={}
-local dbcache
-local cache
-local db
-local GMC
-local GMF=GarrisonMissionFrame
-local G=C_Garrison
-local GMCUsedFollowers={}
 local wipe=wipe
 local pairs=pairs
 local tinsert=tinsert
@@ -35,11 +19,6 @@ local GameTooltip=GameTooltip
 local StaticPopupDialogs=StaticPopupDialogs
 local YES=YES
 local NO=NO
---@debug@
-_G.GAC=addon
-if LibDebug then LibDebug() end
---@end-debug@
-local dbg
 local GARRISON_FOLLOWER_MAX_ITEM_LEVEL=GARRISON_FOLLOWER_MAX_ITEM_LEVEL
 function addon:ShowImprovements()
 	local scroller=self:GetScroller("Items")
@@ -211,4 +190,102 @@ end
 function addon:FollowerPageStartUp()
 	self:RegisterEvent("GARRISON_FOLLOWER_UPGRADED","DelayedRefresh")
 	self:RegisterEvent("CHAT_MSG_LOOT","DelayedRefresh")
+	self:GarrisonTraitCountersFrame_OnLoad(GarrisonTraitCountersFrame, GARRISON_THREAT_COUNTER_TOOLTIP .. " %d")
+	self:HookScript(GarrisonTraitCountersFrame,"OnEvent","GarrisonTraitCountersFrame_OnEvent")
+	self:HookScript(GarrisonTraitCountersFrame,"OnShow","GarrisonTraitCountersFrame_OnShow")
+end
+--[[
+		<Scripts>
+			<OnLoad function="GarrisonTraitCountersFrame_OnLoad"/>
+			<OnEvent function="GarrisonTraitCountersFrame_OnEvent"/>
+			<OnShow function="GarrisonTraitCountersFrame_Update"/>
+		</Scripts>
+--]]
+
+function addon:GarrisonTraitCountersFrame_OnLoad(this, tooltipString)
+	print("Load")
+	this:ClearAllPoints()
+	this:SetParent(GarrisonThreatCountersFrame:GetParent())
+	this:SetPoint("BOTTOMLEFT",185,6)
+	this:Show()
+	this.tooltipString = tooltipString;
+	this.choice=CreateFrame('Frame',this:GetName()..tostring(GetTime()*1000),this,"UIDropDownMenuTemplate")
+	this.choice.button=_G[this.choice:GetName()..'Button']
+	this.choice:SetPoint("TOPLEFT",-192,0)
+	addon:FillCounters(this,1)
+	this.TraitsList[1]:SetScript("OnEnter",_G.GarrisonTraitCounter_OnEnter)
+	--this.TraitsList[1]:SetScript("OnEnter",pp)
+	do
+		local frame=this.choice
+		local list=G.GetRecruiterAbilityCategories()
+		local function sel(this,category,index)
+			UIDropDownMenu_SetSelectedID(frame,index)
+			self:FillCounters(frame:GetParent(),category)
+		end
+		UIDropDownMenu_Initialize(frame, function(...)
+			local i=0
+			for v,k in pairs(list) do
+				if ns.traitTable[v] then
+					i=i+1
+					local info=UIDropDownMenu_CreateInfo()
+					info.text=k
+					info.value=v
+					info.func=sel
+					info.arg1=v
+					info.arg2=i
+					UIDropDownMenu_AddButton(info,1)
+				end
+			end
+		end)
+		UIDropDownMenu_SetWidth(frame, 150);
+		UIDropDownMenu_SetButtonWidth(frame, 174)
+		UIDropDownMenu_SetSelectedID(frame, 1)
+		UIDropDownMenu_JustifyText(frame, "LEFT")
+		--EasyMenu(list,frame,frame,0,0,nil,5)
+	end
+	this:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE");
+end
+
+function addon:GarrisonTraitCountersFrame_OnEvent(this, event, ...)
+	if ( this:IsVisible() ) then
+		self:GarrisonTraitCountersFrame_OnShow(this);
+	end
+end
+
+function addon:GarrisonTraitCountersFrame_OnShow(this)
+	for i = 1, #this.TraitsList do
+		local t=addon:GetFollowersWithTrait(this.TraitsList[i].id)
+		local n=t and #t or 0
+		this.TraitsList[i].Count:SetText(n);
+	end
+end
+
+---@function [parent=#addon] GarrisonTraitCounter_OnEnter
+-- Need to be a global
+function _G.GarrisonTraitCounter_OnEnter(this)
+	GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+	GameTooltip:SetText(this:GetParent().tooltipString:format(this.Count:GetText(), this.name,this.id), nil, nil, nil, nil, true);
+end
+function addon:FillCounters(this,category)
+	local i=0
+	for id,name in pairs(ns.traitTable[category]) do
+		i=i+1
+		local frame = this.TraitsList[i];
+		local offset=(ns.bigscreen and 22 or 17)
+
+		if ( not frame ) then
+			frame = CreateFrame("Button", nil, this, "GarrisonTraitCounterTemplate");
+			frame:SetPoint("LEFT", this.TraitsList[i-1], "RIGHT", 14, 0);
+			frame:SetScript("OnEnter",GarrisonTraitCounter_OnEnter)
+			this.TraitsList[i] = frame;
+		end
+		frame.Icon:SetTexture(G.GetFollowerAbilityIcon(id))
+		frame.name = name;
+		frame.id = id;
+		frame:Show()
+	end
+	for j=i+1,#this.TraitsList do
+		this.TraitsList[j]:Hide()
+	end
 end
+
diff --git a/FollowerRecruiting.lua b/FollowerRecruiting.lua
index b980395..a62f333 100644
--- a/FollowerRecruiting.lua
+++ b/FollowerRecruiting.lua
@@ -1,17 +1,6 @@
 local me,ns=...
-local addon=ns.addon
---@debug@
-if LibDebug then LibDebug() end
---@end-debug@
-local GBF=GarrisonBuildingFrame
-local GBFMap=GBF.MapFrame
-local G=C_Garrison
-local CreateFrame=CreateFrame
-local GARRISON_FOLLOWER_MAX_LEVEL=GARRISON_FOLLOWER_MAX_LEVEL
-local L=ns.L
-local D=ns.D
-local C=ns.C
-local new,del=ns.new,ns.del
+ns.Configure()
+local addon=addon
 local GRF=GarrisonRecruiterFrame.Pick
 local module=addon:NewSubClass("RecruitingPage") --#module
 function module:OnInitialize()
@@ -20,11 +9,11 @@ local origGarrisonRecruiterFrame_AddEntryToDropdown=GarrisonRecruiterFrame_AddEn
 function _G.GarrisonRecruiterFrame_AddEntryToDropdown(entry,info,level)
 	info.text = entry.name;
 	info.value = entry.id;
-	info.checked = (GarrisonRecruiterFrame.Pick.dropDownValue == info.value);
+	info.checked = (GRF.dropDownValue == info.value);
 	if (entry.id) then
 		local list=GRF.Title2:GetText()==GARRISON_CHOOSE_THREAT and addon:GetFollowersWithCounterFor(entry.id) or addon:GetFollowersWithTrait(entry.id)
 		if list then
-			info.text=format("%s (%d)",entry.name,#list)
+			info.text=("%s (%d)"):format(entry.name,#list)
 			info.tooltipText=entry.description.."\n"
 			for i=1,#list do
 				info.tooltipText=info.tooltipText.."\n"..addon:GetFollowerData(list[i],'fullname',L["Some follower"]) .. " " .. addon:GetFollowerStatus(list[i],false,true)
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index ac7fcb2..5f06435 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -1,11 +1,6 @@
 local me, ns = ...
-local addon=ns.addon --#addon
-local L=ns.L
-local D=ns.D
-local C=ns.C
+ns.Configure()
 local _G=_G
-local P=ns.party
-local AceGUI=ns.AceGUI
 local HD=false
 local tremove=tremove
 local setmetatable=setmetatable
@@ -26,12 +21,7 @@ local trc=false
 local pin=false
 local baseHeight
 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@]===]
+local addon=addon --#addon
 ns.bigscreen=true
 -- Blizzard functions override support
 local orig={} --#originals
@@ -437,98 +427,6 @@ function addon:showdata(fullargs,action,missionid)
 		end
 	end
 end
-local function fillCounters(self,category)
-	local i=0
-	for id,name in pairs(ns.traitTable[category]) do
-		i=i+1
-		local frame = self.TraitsList[i];
-		local offset=(ns.bigscreen and 22 or 17)
-
-		if ( not frame ) then
-			frame = CreateFrame("Button", nil, self, "GarrisonTraitCounterTemplate");
-			frame:SetPoint("LEFT", self.TraitsList[i-1], "RIGHT", 14, 0);
-			frame:SetScript("OnEnter",GarrisonTraitCounter_OnEnter)
-			self.TraitsList[i] = frame;
-		end
-		frame.Icon:SetTexture(G.GetFollowerAbilityIcon(id))
-		frame.name = name;
-		frame.id = id;
-		frame:Show()
-	end
-	for j=i+1,#self.TraitsList do
-		self.TraitsList[j]:Hide()
-	end
-end
-
----@function [parent=#GarrisonTraitCountersFrame] 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;
-	self.choice=CreateFrame('Frame',self:GetName()..tostring(GetTime()*1000),self,"UIDropDownMenuTemplate")
-	self.choice.button=_G[self.choice:GetName()..'Button']
-	self.choice:SetPoint("TOPLEFT")
-	fillCounters(self,1)
-	do
-		local frame=self.choice
-		local list=G.GetRecruiterAbilityCategories()
-		local function sel(this,category,index)
-			UIDropDownMenu_SetSelectedID(frame,index)
-			fillCounters(frame:GetParent(),category)
-		end
-		UIDropDownMenu_Initialize(frame, function(...)
-			local i=0
-			for v,k in pairs(list) do
-				if ns.traitTable[v] then
-					i=i+1
-					local info=UIDropDownMenu_CreateInfo()
-					info.text=k
-					info.value=v
-					info.func=sel
-					info.arg1=v
-					info.arg2=i
-					UIDropDownMenu_AddButton(info,1)
-				end
-			end
-		end)
-		UIDropDownMenu_SetWidth(frame, 150);
-		UIDropDownMenu_SetButtonWidth(frame, 174)
-		UIDropDownMenu_SetSelectedID(frame, 1)
-		UIDropDownMenu_JustifyText(frame, "LEFT")
-		--EasyMenu(list,frame,frame,0,0,nil,5)
-	end
-	self:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE");
-end
-
----@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_OnEvent
-function _G.GarrisonTraitCountersFrame_OnEvent(self, event, ...)
-	if ( self:IsVisible() ) then
-		GarrisonTraitCountersFrame_Update(self);
-	end
-end
-
----@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_Update
-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 [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_OnEnter
-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
@@ -1080,7 +978,7 @@ do
 	function addon:RefreshFollowerStatus()

 		wipe(s)
-		for _,followerID in self:GetFollowerIterator() do
+		for _,followerID in self:GetFollowersIterator() do
 			local status=self:GetFollowerStatus(followerID)
 			s[status]=s[status]+1
 		end
@@ -1663,7 +1561,7 @@ do
 			local missionID=partyIndex[i]
 			local party=parties[missionID]
 			local mission=self:GetMissionData(missionID)
-			if (mission) then
+			if mission and party and #party.members >= G.GetMissionMaxFollowers(missionID) then
 				local mb=AceGUI:Create("GMCMissionButton")
 				mb:SetScale(0.6)
 				ml:PushChild(mb,missionID)
@@ -1679,7 +1577,6 @@ end
 --Initial one time setup
 function addon:SetUp(...)
 	ns.CompletedMissions={}
-	self:FollowerCacheInit()
 --@alpha@
 	if (not db.alfa.v220) then
 		self:Popup(L["You are using an Alpha version of Garrison Commander. Please post bugs on Curse if you find them"],10)
@@ -1726,10 +1623,7 @@ 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("BOTTOMLEFT",200,0)
-	GarrisonTraitCountersFrame:Show()
+

 	return self:StartUp()
 	--collectgarbage("step",10)
@@ -1938,6 +1832,9 @@ function addon:GetFollowerTexture(followerID)
 end

 function addon:CleanUp()
+--@debug@
+	print("Cleaning up")
+--@end-debug@
 	wipe(ns.CompletedMissions)
 	self:UnhookAll()
 	self:CancelAllTimers()
@@ -2035,7 +1932,7 @@ if not stage.missionid then
 --@debug@
 	print("UpdateMissionPage for",missionID,missionInfo.name,missionInfo.numFollowers)
 --@end-debug@
-	self:holdEvents()
+	holdEvents()
 	if ns.toc < 60200 then
 		GarrisonMissionPage_ClearParty()
 	else
@@ -2062,7 +1959,7 @@ if not stage.missionid then
 		--self:Dump(GMF.MissionTab.MissionPage.Followers,"Selected followers")
 		--GarrisonMissionPage_UpdateEmptyString()
 	end
-	self:releaseEvents()
+	releaseEvents()
 end
 local firstcall=true

diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc
index 24f138b..e71d73e 100644
--- a/GarrisonCommander.toc
+++ b/GarrisonCommander.toc
@@ -5,7 +5,7 @@
 ## Notes-frFR: Vous aide au moment de choisir le droit utilisateur pour la bonne mission
 ## Author: Alar of Daggerspine
 ## Version: @project-version@ @project-abbreviated-hash@
-## X-Version: 2.4.8
+## X-Version: 2.5.0
 ## X-Revision: @project-abbreviated-hash@
 ## eMail: alar@aspide.it
 ## URL: http://wow.aspide.it
@@ -24,7 +24,7 @@
 ## X-Embeds:
 embeds.xml
 localization.lua
-wowhead.lua
+##wowhead.lua
 Init.lua
 Widgets.lua
 GarrisonCommander.xml
diff --git a/GarrisonCommander.xml b/GarrisonCommander.xml
index c23b8cf..e463c26 100644
--- a/GarrisonCommander.xml
+++ b/GarrisonCommander.xml
@@ -421,11 +421,6 @@
 				</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"/>
diff --git a/Init.lua b/Init.lua
index ffb09a3..59f595d 100644
--- a/Init.lua
+++ b/Init.lua
@@ -14,25 +14,12 @@ local tostring=tostring
 local tonumber=tonumber
 --@debug@
 LoadAddOn("Blizzard_DebugTools")
-if LibDebug then LibDebug() else ns.print=function() end end
+if LibDebug then LibDebug() ns.print=print else ns.print=function() end end
 --@end-debug@
 --[===[@non-debug@
 ns.print=function() end
 --@end-non.debug@]===]
 ns.addon=LibStub("LibInit"):NewAddon(me,'AceHook-3.0','AceTimer-3.0','AceEvent-3.0','AceBucket-3.0')
-local ENV=setmetatable({
-	print=ns.print
-},
-{__index=_G}
-)
-function ns.Configure()
-		local old_env = getfenv(2)
-		if old_env ~= _G and old_env ~= ENV then
-			error("The calling function has a modified environment, I won't replace it.", 2)
-		end
-		setfenv(2, ENV)
-end
-
 local addon=ns.addon --#addon
 ns.toc=select(4,GetBuildInfo())
 ns.AceGUI=LibStub("AceGUI-3.0")
@@ -40,6 +27,9 @@ ns.D=LibStub("LibDeformat-3.0")
 ns.C=ns.addon:GetColorTable()
 ns.L=ns.addon:GetLocale()
 ns.G=C_Garrison
+ns.GMF=_G.GarrisonMissionFrame
+ns.GMFMissions=_G.GarrisonMissionFrameMissions
+ns.GSF=_G.GarrisonShipFrame
 _G.GARRISON_FOLLOWER_MAX_ITEM_LEVEL = _G.GARRISON_FOLLOWER_MAX_ITEM_LEVEL or 675
 do
 	--@debug@
@@ -94,7 +84,7 @@ end

 local stacklevel=0
 local frames
-function addon:holdEvents()
+function ns.holdEvents()
 	if stacklevel==0 then
 		frames={GetFramesRegisteredForEvent('GARRISON_FOLLOWER_LIST_UPDATE')}
 		for i=1,#frames do
@@ -103,7 +93,7 @@ function addon:holdEvents()
 	end
 	stacklevel=stacklevel+1
 end
-function addon:releaseEvents()
+function ns.releaseEvents()
 	stacklevel=stacklevel-1
 	assert(stacklevel>=0)
 	if (stacklevel==0) then
@@ -113,7 +103,6 @@ function addon:releaseEvents()
 		frames=nil
 	end
 end
-local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
 ns.OnLeave=function() GameTooltip:Hide() end
 local upgrades={
 	"wt:120302:1",
@@ -210,7 +199,7 @@ function addon:GetType(itemID)
 	return "generic"
 end
 --Data
-
+if ns.toc < 60200 then
 ns.traitTable= {
 		{
 			[9] = "Wastelander",
@@ -273,9 +262,36 @@ ns.traitTable= {
 		[41] = "Furyslayer",
 	},
 }
+else
 ns.traitTable={
 [1]={  [9]="Wastelander",  [7]="Mountaineer",  [45]="Cave Dweller",  [46]="Guerilla Fighter",  [44]="Naturalist",  [48]="Marshwalker",  [49]="Plainsrunner",  [8]="Cold-Blooded"},[2]={  [80]="Extra Training",  [314]="Greasemonkey",  [79]="Scavenger",  [256]="Treasure Hunter",  [29]="Fast Learner"},[3]={  [76]="High Stamina",  [221]="Epic Mount",  [77]="Burst of Power"},[6]={  [61]="Tailoring",  [52]="Mining",  [54]="Alchemy",  [56]="Enchanting",  [58]="Inscription",  [60]="Leatherworking",  [62]="Skinning",  [53]="Herbalism",  [55]="Blacksmithing",  [57]="Engineering",  [59]="Jewelcrafting"},[7]={  [64]="Humanist",  [66]="Child of the Moon",  [68]="Canine Companion",  [65]="Dwarvenborn",  [67]="Ally of Argus",  [69]="Brew Aficionado",  [63]="Gnome-Lover"},[8]={  [37]="Beastslayer",  [39]="Primalslayer",  [4]="Orcslayer",  [43]="Talonslayer",  [36]="Demonslayer",  [38]="Ogreslayer",  [40]="Gronnslayer",  [42]="Voidslayer",  [41]="Furyslayer"}
 }
+end
+-- Pseudo Global Support.
+-- Calling ns.Configure() will give to the calling function a preloaded env
+
+local ENV={}
+
+for k,v in pairs(ns) do
+	ENV[k]=v
+end
+setmetatable(ENV,
+{__index=_G,
+__newindex=function(t,k,v)
+	assert(type(_G[k]) == 'nil',"Attempting to override global " ..k)
+	return rawset(t,k,v)
+end
+}
+)
+
+---@function [parent=#ns] Configure
+function ns.Configure()
+		local old_env = getfenv(2)
+		if old_env ~= _G and old_env ~= ENV then
+			error("The calling function has a modified environment, I won't replace it.", 2)
+		end
+		setfenv(2, ENV)
+end
 -------------------- to be estracted to CountersCache
 --
 --local G=C_Garrison
diff --git a/MatchMaker.lua b/MatchMaker.lua
index b9ceabc..6b07106 100644
--- a/MatchMaker.lua
+++ b/MatchMaker.lua
@@ -1,12 +1,11 @@
 local me,ns=...
-local addon=ns.addon --#addon
-local C=ns.C
-local P=ns.party
+ns.Configure()
+local addon=addon --#addon
 local _G=_G
-local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
-local new, del, copy =ns.new,ns.del,ns.copy
+local P=ns.party
+--local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
+--local new, del, copy =ns.new,ns.del,ns.copy
 --upvalue
-local G=C_Garrison
 local GMFRewardSplash=GarrisonMissionFrameMissions.CompleteDialog
 local pairs=pairs
 local format=format
@@ -24,12 +23,6 @@ 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 function formatScore(c,r,x,t,maxres,cap)
 	if (not maxres) then cap=100 end
@@ -196,7 +189,7 @@ local function MatchMaker(self,missionID,party,includeBusy,onlyBest)
 	end
 	--]]
 	local minchance=floor(self:GetNumber('MAXRESCHANCE')/mission.numFollowers)-mission.numFollowers*mission.numFollowers
-	for _,followerID in self:GetFollowerIterator() do
+	for _,followerID in self:GetFollowersIterator() do

 		if P:AddFollower(followerID) then
 			local score,chance=self:FollowerScore(mission,followerID)
diff --git a/MissionCache.lua b/MissionCache.lua
index 8f50922..ae35375 100644
--- a/MissionCache.lua
+++ b/MissionCache.lua
@@ -1,12 +1,7 @@
 local me,ns=...
 ns.Configure()
-local addon=ns.addon --#addon
-local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
-local xdump=ns.xdump
---upvalue
-local G=C_Garrison
-local GMF=GarrisonMissionFrame
-local GMFMissions=GarrisonMissionFrameMissions
+local addon=addon --#addon
+--local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
 local type=type
 local select=select
 local pairs=pairs
diff --git a/MissionCompletion.lua b/MissionCompletion.lua
index b0d4fe1..23dd028 100644
--- a/MissionCompletion.lua
+++ b/MissionCompletion.lua
@@ -1,21 +1,9 @@
 local me, ns = ...
-local addon=ns.addon --#addon
-local L=ns.L
-local D=ns.D
-local C=ns.C
-local AceGUI=ns.AceGUI
+ns.Configure()
+local addon=addon --#addon
 local _G=_G
---@debug@
-if LibDebug then LibDebug() end
---@end-debug@
---[===[@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
@@ -265,7 +253,6 @@ function module:GetMissionResults(success,currentMission)
 end
 function module:MissionsPrintResults(success)
 	stopTimer()
-	self:FollowerCacheInit()
 --@debug@
 	--self:Dump("Ended Mission",rewards)
 --@end-debug@
diff --git a/MissionControl.lua b/MissionControl.lua
index 355fab6..9491e18 100644
--- a/MissionControl.lua
+++ b/MissionControl.lua
@@ -1,11 +1,7 @@
 local me, ns = ...
-local addon=ns.addon --#addon
-local L=ns.L
-local D=ns.D
-local C=ns.C
-local AceGUI=ns.AceGUI
+ns.Configure()
+local addon=addon --#addon
 local _G=_G
-local new, del, copy =ns.new,ns.del,ns.copy
 -- Courtesy of Motig
 -- Concept and interface reused with permission
 -- Mission building rewritten from scratch
@@ -18,15 +14,11 @@ local cache
 local db
 local GMC
 local GMF=GarrisonMissionFrame
-local G=C_Garrison
 local GMCUsedFollowers={}
 local wipe=wipe
 local pairs=pairs
 local tinsert=tinsert
---@debug@
-_G.GAC=addon
-if LibDebug then LibDebug() end
---@end-debug@
+local tremove=tremove
 local dbg
 local tItems = {
 	{t = 'Enable/Disable money rewards.', i = 'Interface\\Icons\\inv_misc_coin_01', key = 'gold'},
@@ -39,6 +31,7 @@ local tItems = {
 	{t = 'Enable/Disable other rewards.', i = "Interface\\ICONS\\INV_Box_02", key = 'other'}
 }
 local tOrder
+local tSort={}
 local settings
 if (ns.toc >=60200) then
 	tinsert(tItems,3,{t = 'Enable/Disable oil awards.', i= 'Interface\\Icons\\garrison_oil', key = 'oil'})
@@ -84,7 +77,7 @@ function module:GMCCreateMissionList(workList)
 		if (c1==c2) then
 			return addon:GetMissionData(i1,c1,0) > addon:GetMissionData(i2,c2,0)
 		else
-			return tOrder[c1]<tOrder[c2]
+			return (tSort[c1] or i1)<(tSort[c2] or i2)
 		end
 	end
 	table.sort(workList,msort)
@@ -251,13 +244,13 @@ local function drawItemButtons()
 	for j,i in ipairs(tOrder) do
 		local frame = GMC.ignoreFrames[j] or CreateFrame('BUTTON', "Priority" .. j, GMC.aif, 'ItemButtonTemplate')
 		GMC.ignoreFrames[j] = frame
-		frame:SetID(i)
+		frame:SetID(j)
 		frame:ClearAllPoints()
 		frame:SetScale(scale)
 		frame:SetPoint('TOPLEFT', 0,(j) * (-h -gap) * scale)
 		frame.icon:SetTexture(tItems[i].i)
 		frame.key=tItems[i].key
-		tOrder[frame.key]=j
+		tSort[frame.key]=j
 		frame.tooltip=tItems[i].t
 		frame.allowed=GMC.settings.allowedRewards[frame.key]
 		frame.chance=GMC.settings.rewardChance[frame.key]
@@ -305,37 +298,39 @@ local function drawItemButtons()
 		frame:RegisterForDrag("LeftButton")
 		frame:SetMovable(true)
 		frame:SetScript("OnDragStart",function(this,button)
-			print("Start",this:GetID())
+			print("Start",this:GetID(),this.key)
 			this:StartMoving()
 			this.oldframestrata=this:GetFrameStrata()
 			this:SetFrameStrata("FULLSCREEN_DIALOG")
 		end)
 		frame:SetScript("OnDragStop",function(this,button)
 			this:StopMovingOrSizing()
-			print("Stopped",this:GetID())
+			print("Stopped",this:GetID(),this.key)
 			this:SetFrameStrata(this.oldframestrata)

 		end)
 		frame:SetScript("OnReceiveDrag",function(this)
+				print("Receive",this:GetID(),this.key)
+				DevTools_Dump(tOrder)
+				local from=this:GetID()
+				local to
 				local x,y=this:GetCenter()
 				local id=this:GetID()
-				for i=1,#tItems do
+				for i=1,#GMC.ignoreFrames do
 					local f=GMC.ignoreFrames[i]
 					if f:GetID() ~= id then
-						print(y,f:GetBottom(),f:GetTop())
 						if y>=f:GetBottom() and y<=f:GetTop() then
-							this:SetID(f:GetID())
-							f:SetID(id)
-							for j=1,#tItems do
-								tOrder[j]=GMC.ignoreFrames[j]:GetID()
-								tOrder[GMC.ignoreFrames[j].key]=j
-							end
-							break
+							to=f:GetID()
 						end
 					end
 				end
+				if (to) then
+					print("from:",from,"to:",to)
+					local appo=tremove(tOrder,from)
+					tinsert(tOrder,to,appo)
+				end
 				drawItemButtons()
-				GMC.startButton:Click()
+				--GMC.startButton:Click()
 		end)
 		frame:SetScript('OnLeave', function() GameTooltip:Hide() end)
 		frame:Show()
@@ -373,7 +368,22 @@ function module:OnInitialized()
 		settings.allowedRewards['followerUpgrade']=settings.allowedRewards['followerUpgrade']
 		settings.allowedRewards['followerEquip']=nil
 	end
-	tOrder=GMC.settings.rewardOrder
+
+	if true then
+		tOrder=GMC.settings.rewardOrder
+		local aa={}
+		for k,v in pairs(tOrder) do aa[k]=v end
+		for k,v in pairs(aa) do tOrder[k]=nil end
+		wipe(tOrder)
+		for i=1,#tItems do
+			tinsert(tOrder,i)
+		end
+		_G.tOrder=tOrder
+	end
+	for i=1,#tOrder do
+		tSort[tItems[tOrder[i]].key]=i
+	end
+
 	if GMC.settings.itemPrio then
 		GMC.settings.itemPrio=nil
 	end
@@ -451,6 +461,7 @@ function module:GMCBuildChance()
 	GMC.cp = GMC.cf:CreateTexture(nil, 'BACKGROUND')
 	GMC.cp:SetTexture('Interface\\Garrison\\GarrisonMissionUI2.blp')
 	GMC.cp:SetAtlas(chestTexture)
+	GMC.cp:SetDesaturated(not GMC.settings.useOneChance)
 	GMC.cp:SetSize((209-(209*0.25))*0.60, (155-(155*0.25))*0.60)
 	GMC.cp:SetPoint('CENTER', 0, 20)

@@ -458,14 +469,17 @@ function module:GMCBuildChance()
 	GMC.cc:SetFontObject('GameFontNormalHuge')
 	GMC.cc:SetText('Success Chance')
 	GMC.cc:SetPoint('TOP', 0, 0)
-	GMC.cc:SetTextColor(1, 1, 1)
+	GMC.cc:SetTextColor(C:White())

 	GMC.ct = GMC.cf:CreateFontString()
 	GMC.ct:SetFontObject('ZoneTextFont')
 	GMC.ct:SetFormattedText('%d%%',GMC.settings.minimumChance)
 	GMC.ct:SetPoint('TOP', 0, -40)
-	GMC.ct:SetTextColor(0, 1, 0)
-
+	if GMC.settings.useOneChance then
+		GMC.ct:SetTextColor(C:Green())
+	else
+		GMC.ct:SetTextColor(C:Silver())
+	end
 	GMC.cs = factory:Slider(GMC.cf,0,100,GMC.settings.minimumChance,'Minumum chance to start a mission')
 	GMC.cs:SetPoint('BOTTOM', 10, 0)
 	GMC.cs:SetScript('OnValueChanged', function(self, value)
diff --git a/PartyCache.lua b/PartyCache.lua
index 2c70da5..43e724b 100644
--- a/PartyCache.lua
+++ b/PartyCache.lua
@@ -1,8 +1,7 @@
 local me,ns=...
-local addon=ns.addon --#addon
-local holdEvents,releaseEvents=addon.holdEvents,addon.releaseEvents
+ns.Configure()
+local addon=addon --#addon
 --upvalue
-local G=C_Garrison
 local setmetatable=setmetatable
 local rawset=rawset
 local tContains=tContains
@@ -13,13 +12,6 @@ local pcall=pcall
 local type=type
 local pairs=pairs
 local format=format
---@debug@
-if LibDebug then LibDebug() end
---@end-debug@
---[===[@non-debug@
-setfenv(1,setmetatable({print=function(...) print("x",...) end},{__index=_G}))
---@end-non-debug@]===]
---
 -- Temporary party management
 local parties=setmetatable({},{
 	__index=function(t,k)  rawset(t,k,
@@ -97,6 +89,9 @@ end
 function party:IsEmpty()
 	return maxFollowers>0 and #members==0
 end
+function party:IsFull()
+	return maxFollowers and #members>=maxFollowers
+end

 function party:Dump()
 	print("Dumping party for mission",ID)
diff --git a/ShipYard.lua b/ShipYard.lua
index 0d2114e..d2a5934 100644
--- a/ShipYard.lua
+++ b/ShipYard.lua
@@ -1,14 +1,7 @@
 local me, ns = ...
-local addon=ns.addon --#addon
-local L=ns.L
-local D=ns.D
-local C=ns.C
-local AceGUI=ns.AceGUI
+ns.Configure()
+local addon=addon --#addon
 local _G=_G
---@debug@
---if LibDebug() then LibDebug() end
---@end-debug@
-local new, del, copy =ns.new,ns.del,ns.copy
 local GSF=GarrisonShipyardFrame
 local G=C_Garrison
 local pairs=pairs
@@ -17,7 +10,7 @@ local strsplit=strsplit
 local generated
 local module=addon:NewSubClass('ShipYard') --#Module
 function module:OnInitialize()
-	self:Print("ShipYard Loaded")
+	print("ShipYard Loaded")
 end
 function module:Setup()
 	print("Doing one time initialization")
diff --git a/Widgets.lua b/Widgets.lua
index 1bde304..a360ccc 100644
--- a/Widgets.lua
+++ b/Widgets.lua
@@ -1,11 +1,8 @@
 local me, ns = ...
+ns.Configure()
+local addon=addon
 local _G=_G
-local pp=print
-local addon=ns.addon
-local AceGUI=LibStub("AceGUI-3.0")
-local C=ns.C
-local G=ns.G
-local L=ns.L
+local wipe=wipe
 local module=addon:NewSubModule("Widgets") --#module
 --- Quick backdrop
 --
diff --git a/wowhead.lua b/wowhead.lua
index a8aa0ad..e69de29 100644
--- a/wowhead.lua
+++ b/wowhead.lua
@@ -1,408 +0,0 @@
--- DataMined from WowHead on 11/01/2015
--- Contains 304 missions
---[[
-Array
-(
-    [id] => 2
-    [level] => 90
-    [itemlevel] => 0
-    [traveltime] => 0
-    [missiontime] => 1800
-    [cooldown] => 9999999
-    [cost] => 0
-    [followers] => 1
-    [experience] => 100
-    [basebonuschance] => 65
-    [name] => Gronnlings Abound
-    [description] => Gronnlings are a menace to the region.  We should partner with the Frostwolf clan to thin the population.  One may even join our cause...
-    [location] => Frostwall Approach
-    [mechanictype] => 23
-    [missiontype] => 3
-    [flags] => 0
-    [rewards] => Array
-        (
-            [experience] => Array
-                (
-                )
-
-            [prestige] => Array
-                (
-                )
-
-            [item] => Array
-                (
-                    [0] => Array
-                        (
-                            [item] => 112737
-                            [amount] => 1
-                        )
-
-                )
-
-            [currency] => Array
-                (
-                )
-
-            [chest] => Array
-                (
-                )
-
-        )
-
-    [encounters] => Array
-        (
-            [1] => Array
-                (
-                    [setkey] => 2
-                    [id] => 1
-                    [npc] => 80693
-                    [name] => Frostfire Gronnling
-                    [portraitfile] => 1067373
-                    [portraitfilename] => enemyportrait_56633
-                    [mechanics] => Array
-                        (
-                            [10] => Array
-                                (
-                                    [setkey] => 2
-                                    [id] => 10
-                                    [amount] => 300
-                                    [type] => 1
-                                    [category] => 2
-                                    [name] => Wild Aggression
-                                    [description] => An unpredictable enemy whose aggression should be controlled.
-                                    [icon] => spell_nature_reincarnation
-                                )
-
-                        )
-
-                )
-
-        )
-
-    [mechanics] => Array
-        (
-            [0] => Array
-                (
-                    [setkey] => 2
-                    [id] => 0
-                    [amount] => 0
-                    [type] => 23
-                    [category] => 0
-                    [name] => Snow
-                    [description] => An arctic region.
-                    [icon] => achievement_zone_stormpeaks_02
-                )
-
-        )
-
-)
---]]
-local me,ns=...
- ns.wowhead={
-[2]=9999999,
-[3]=9999999,
-[6]=9999999,
-[7]=9999999,
-[43]=9999999,
-[44]=9999999,
-[55]=9999999,
-[65]=9999999,
-[66]=9999999,
-[67]=0,
-[73]=86400,
-[86]=9999999,
-[87]=9999999,
-[88]=9999999,
-[89]=0,
-[90]=9999999,
-[91]=9999999,
-[107]=129600,
-[108]=129600,
-[109]=129600,
-[110]=129600,
-[111]=129600,
-[112]=129600,
-[113]=129600,
-[114]=129600,
-[115]=129600,
-[116]=129600,
-[117]=129600,
-[118]=129600,
-[119]=129600,
-[120]=129600,
-[125]=129600,
-[126]=129600,
-[127]=129600,
-[128]=129600,
-[129]=129600,
-[130]=129600,
-[131]=129600,
-[132]=129600,
-[133]=129600,
-[135]=86400,
-[136]=86400,
-[137]=86400,
-[138]=86400,
-[139]=86400,
-[140]=86400,
-[141]=86400,
-[142]=86400,
-[143]=86400,
-[144]=86400,
-[145]=86400,
-[146]=86400,
-[147]=86400,
-[148]=86400,
-[149]=86400,
-[150]=86400,
-[151]=86400,
-[152]=86400,
-[153]=86400,
-[154]=86400,
-[155]=86400,
-[156]=86400,
-[157]=86400,
-[158]=86400,
-[159]=86400,
-[160]=86400,
-[161]=86400,
-[162]=86400,
-[163]=86400,
-[164]=86400,
-[165]=86400,
-[166]=86400,
-[167]=86400,
-[168]=86400,
-[169]=86400,
-[170]=86400,
-[171]=86400,
-[172]=86400,
-[173]=86400,
-[174]=86400,
-[175]=86400,
-[176]=86400,
-[177]=86400,
-[178]=86400,
-[179]=86400,
-[180]=86400,
-[181]=86400,
-[182]=86400,
-[183]=86400,
-[184]=86400,
-[185]=86400,
-[186]=86400,
-[187]=86400,
-[188]=86400,
-[189]=86400,
-[190]=86400,
-[191]=86400,
-[192]=86400,
-[193]=86400,
-[194]=86400,
-[195]=86400,
-[196]=86400,
-[197]=86400,
-[198]=86400,
-[199]=86400,
-[200]=86400,
-[201]=86400,
-[202]=86400,
-[203]=86400,
-[204]=86400,
-[205]=86400,
-[206]=86400,
-[207]=86400,
-[208]=86400,
-[209]=86400,
-[210]=86400,
-[211]=86400,
-[212]=86400,
-[213]=86400,
-[214]=86400,
-[215]=86400,
-[217]=86400,
-[218]=86400,
-[219]=86400,
-[220]=86400,
-[221]=9999999,
-[222]=9999999,
-[223]=86400,
-[224]=86400,
-[228]=9999999,
-[229]=9999999,
-[230]=86400,
-[231]=86400,
-[232]=86400,
-[242]=86400,
-[243]=86400,
-[244]=86400,
-[245]=86400,
-[247]=129600,
-[248]=129600,
-[249]=129600,
-[250]=129600,
-[251]=129600,
-[252]=129600,
-[253]=129600,
-[254]=129600,
-[255]=129600,
-[256]=129600,
-[257]=129600,
-[258]=129600,
-[259]=129600,
-[260]=129600,
-[261]=129600,
-[262]=129600,
-[263]=129600,
-[264]=129600,
-[265]=129600,
-[266]=129600,
-[267]=129600,
-[268]=129600,
-[269]=129600,
-[271]=86400,
-[272]=86400,
-[273]=86400,
-[274]=86400,
-[275]=86400,
-[276]=86400,
-[277]=86400,
-[278]=86400,
-[279]=86400,
-[280]=86400,
-[281]=86400,
-[282]=86400,
-[283]=86400,
-[284]=86400,
-[285]=86400,
-[286]=86400,
-[287]=86400,
-[288]=86400,
-[289]=86400,
-[290]=129600,
-[291]=129600,
-[292]=129600,
-[293]=129600,
-[294]=129600,
-[295]=129600,
-[296]=129600,
-[297]=129600,
-[298]=129600,
-[299]=129600,
-[300]=129600,
-[301]=129600,
-[302]=129600,
-[303]=129600,
-[304]=129600,
-[305]=129600,
-[306]=129600,
-[307]=129600,
-[308]=129600,
-[309]=129600,
-[310]=129600,
-[311]=129600,
-[312]=129600,
-[313]=1209000,
-[314]=1209000,
-[315]=1209000,
-[316]=1209000,
-[317]=1209000,
-[318]=1209000,
-[319]=1209000,
-[320]=1209000,
-[321]=1209000,
-[322]=1209000,
-[323]=1209000,
-[324]=1209000,
-[325]=1209000,
-[326]=1209000,
-[327]=1209000,
-[328]=1209000,
-[329]=86400,
-[330]=86400,
-[331]=86400,
-[332]=86400,
-[333]=86400,
-[334]=252000,
-[335]=252000,
-[336]=252000,
-[337]=252000,
-[338]=86400,
-[339]=86400,
-[340]=86400,
-[341]=86400,
-[342]=86400,
-[343]=86400,
-[344]=86400,
-[345]=86400,
-[346]=86400,
-[347]=86400,
-[348]=86400,
-[349]=86400,
-[350]=86400,
-[351]=86400,
-[352]=86400,
-[353]=86400,
-[354]=86400,
-[355]=86400,
-[356]=86400,
-[357]=86400,
-[358]=252000,
-[359]=252000,
-[360]=252000,
-[361]=252000,
-[362]=86400,
-[363]=86400,
-[364]=86400,
-[365]=86400,
-[366]=57600,
-[367]=57600,
-[368]=57600,
-[369]=57600,
-[370]=57600,
-[371]=57600,
-[372]=57600,
-[373]=57600,
-[374]=57600,
-[375]=57600,
-[376]=57600,
-[377]=57600,
-[378]=86400,
-[379]=86400,
-[380]=129600,
-[381]=86400,
-[382]=86400,
-[383]=86400,
-[384]=86400,
-[385]=129600,
-[386]=86400,
-[387]=86400,
-[388]=86400,
-[389]=86400,
-[390]=86400,
-[391]=86400,
-[392]=86400,
-[393]=86400,
-[394]=86400,
-[395]=86400,
-[396]=86400,
-[397]=86400,
-[398]=86400,
-[399]=86400,
-[400]=86400,
-[401]=86400,
-[402]=86400,
-[403]=1209000,
-[404]=1209000,
-[405]=1209000,
-[406]=1209000,
-[407]=1209000,
-[408]=1209000,
-[409]=1209000,
-[410]=1209000,
-[411]=1209000,
-[412]=1209000,
-[413]=1209000,
-_lastupdate_=1421009516
-}
-setmetatable(ns.wowhead,{__index=function(t,k) return 0 end})