diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2f4c2f9..d0e9ce4 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -4,4 +4,5 @@ Fix: Using a full upgrade token on follower was warning about lost points
Fix: Possible soloution for a couple of very rare lua errors
Feature: Clicking on data broker opens missions report (same as clicking on minimap icon)
Feature: In follower rectuiting page, information about which follower have traits and counter are show in dropdown
-Feature: Broker now reports status of producing lot.
\ No newline at end of file
+Feature: Broker now reports status of producing lot.
+Feature: In available mission we now show the improved mission duration
\ No newline at end of file
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index b3be823..c3b5499 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -257,7 +257,7 @@ end
-- First time i am called to verride it I save it, so I give other modules a chance to hook it, too
-- Could even do a trick and secureHook it at the expense of a double sort...
local origGarrison_SortMissions
-local sorters={}
+local sorters={} --#Sorters
sorters.EndTime=function (mission1, mission2)
if type(mission1)~="table" or type(mission2) ~="table" then return true end
local rc1,p1=pcall(G.GetFollowerMissionTimeLeftSeconds,mission1.followers[1])
@@ -282,10 +282,20 @@ sorters.Chance=function (mission1, mission2)
return p1.perc > p2.perc
end
end
+sorters.Duration=function (mission1, mission2)
+ if type(mission1)~="table" or type(mission2) ~="table" then return end
+ local p1=addon:GetMissionData(mission1.missionID,'improvedDurationSeconds',0)
+ local p2=addon:GetMissionData(mission2.missionID,'improvedDurationSeconds',0)
+ if (p1==p2) then
+ return strcmputf8i(mission1.name, mission2.name) < 0
+ else
+ return p1 < p2
+ end
+end
sorters.Age=function (mission1, mission2)
if type(mission1)~="table" or type(mission2) ~="table" then return end
- local p1=addon:GetMissionData(mission1.missionID,'offerEndTime')
- local p2=addon:GetMissionData(mission2.missionID,'offerEndTime')
+ local p1=addon:GetMissionData(mission1.missionID,'offerEndTime',0)
+ local p2=addon:GetMissionData(mission2.missionID,'offerEndTime',0)
if (p1==p2) then
return strcmputf8i(mission1.name, mission2.name) < 0
else
@@ -294,8 +304,8 @@ sorters.Age=function (mission1, mission2)
end
sorters.Followers=function(mission1, mission2)
if type(mission1)~="table" or type(mission2) ~="table" then return end
- local p1=addon:GetMissionData(mission1.missionID,'numFollowers')
- local p2=addon:GetMissionData(mission2.missionID,'numFollowers')
+ local p1=addon:GetMissionData(mission1.missionID,'numFollowers',1)
+ local p2=addon:GetMissionData(mission2.missionID,'numFollowers',1)
if (p1==p2) then
return strcmputf8i(mission1.name, mission2.name) < 0
else
@@ -305,8 +315,8 @@ end
sorters.Xp=function (mission1, mission2)
if type(mission1)~="table" or type(mission2) ~="table" then return end
- local p1=addon:GetMissionData(mission1.missionID,'globalXp')
- local p2=addon:GetMissionData(mission2.missionID,'globalXp')
+ local p1=addon:GetMissionData(mission1.missionID,'globalXp',0)
+ local p2=addon:GetMissionData(mission2.missionID,'globalXp',0)
if (p1==p2) then
return strcmputf8i(mission1.name, mission2.name) < 0
else
@@ -321,6 +331,10 @@ function addon.Garrison_SortMissions_Age(missionsList)
addon:OnAllMissions(function(missionID) addon:MatchMaker(missionID) end)
table.sort(missionsList, sorters.Age);
end
+function addon.Garrison_SortMissions_Duration(missionsList)
+ addon:OnAllMissions(function(missionID) addon:MatchMaker(missionID) end)
+ table.sort(missionsList, sorters.Duration);
+end
function addon.Garrison_SortMissions_Followers(missionsList)
addon:OnAllMissions(function(missionID) addon:MatchMaker(missionID) end)
table.sort(missionsList, sorters.Followers);
@@ -363,6 +377,7 @@ function addon:OnInitialized()
Garrison_SortMissions_Followers=L["Number of followers"],
Garrison_SortMissions_Age=L["Expiration Time"],
Garrison_SortMissions_Xp=L["Global approx. xp reward"],
+ 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)"])
ns.bigscreen=self:GetBoolean("BIGSCREEN")
@@ -574,7 +589,7 @@ function addon:AddFollowersToTooltip(missionID)
local q=self:GetDifficultyColor(perc)
GameTooltip:AddDoubleLine(GARRISON_MISSION_SUCCESS,format(GARRISON_MISSION_PERCENT_CHANCE,perc),nil,nil,nil,q.r,q.g,q.b)
for _,i in pairs (dbcache.ignored[missionID]) do
- GameTooltip:AddLine(L["You have ignored followers"])
+ GameTooltip:AddLine(L["You have ignored followers"],C.Orange())
break;
end
if party.goldMultiplier>1 and party.class=='gold' then
@@ -586,6 +601,10 @@ function addon:AddFollowersToTooltip(missionID)
if party.xpBonus>0 then
GameTooltip:AddDoubleLine(L["Xp incremented!"],'+'..party.xpBonus,C.Green())
end
+ if party.isMissionTimeImproved then
+ GameTooltip:AddLine(L["Mission time reduced!"],C.Green())
+ end
+
if (dbcache.history[missionID]) then
local tot,success=0,0
for d,r in pairs(dbcache.history[missionID]) do
@@ -2526,11 +2545,14 @@ function addon:AddStandardDataToButton(page,button,mission,missionID,bigscreen)
button.Title:SetWidth(0);
button.Title:SetText(mission.name);
button.Level:SetText(mission.level);
- if ( mission.durationSeconds >= GARRISON_LONG_MISSION_TIME ) then
- local duration = format(GARRISON_LONG_MISSION_TIME_FORMAT, mission.duration);
- button.Summary:SetFormattedText(PARENS_TEMPLATE, duration);
+ local seconds=self:GetMissionData(missionID,'improvedDurationSeconds')
+ local duration=SecondsToTime(seconds)
+ if ( seconds >= GARRISON_LONG_MISSION_TIME ) then
+ button.Summary:SetFormattedText(PARENS_TEMPLATE, format(GARRISON_LONG_MISSION_TIME_FORMAT,duration))
+ elseif (seconds<mission.durationSeconds) then
+ button.Summary:SetFormattedText(PARENS_TEMPLATE, format("%s%s%s",GREEN_FONT_COLOR_CODE,duration,FONT_COLOR_CODE_CLOSE))
else
- button.Summary:SetFormattedText(PARENS_TEMPLATE, mission.duration);
+ button.Summary:SetFormattedText(PARENS_TEMPLATE, duration);
end
if ( mission.locPrefix ) then
button.LocBG:Show();
diff --git a/Init.lua b/Init.lua
index 09e7015..6edc70e 100644
--- a/Init.lua
+++ b/Init.lua
@@ -176,6 +176,7 @@ function addon:GetItems()
return items
end
-- to be moved in LibInit
+--[[
function addon:coroutineExecute(interval,func)
local co=coroutine.wrap(func)
local interval=interval
@@ -189,6 +190,7 @@ function addon:coroutineExecute(interval,func)
end
return repeater()
end
+--]]
addon:coroutineExecute(0.1,
function ()
for itemID,_ in pairs(followerItems) do
diff --git a/MissionCache.lua b/MissionCache.lua
index 635a8a2..fdb6a21 100644
--- a/MissionCache.lua
+++ b/MissionCache.lua
@@ -64,6 +64,13 @@ function addon:GetMissionData(missionID,key,default)
if (type(mission[key])~='nil') then
return mission[key]
end
+ if key=='improvedDurationSeconds' then
+ if self:GetParty(missionID,'isMissionTimeImproved') then
+ return mission.durationSeconds/2
+ else
+ return mission.durationSeconds
+ end
+ end
if (key=='rank') then
mission.rank=mission.level < GARRISON_FOLLOWER_MAX_LEVEL and mission.level or mission.iLevel
return mission.rank
diff --git a/MissionCompletion.lua b/MissionCompletion.lua
index cee6bf6..387dec5 100644
--- a/MissionCompletion.lua
+++ b/MissionCompletion.lua
@@ -99,6 +99,9 @@ function module:MissionComplete(this,button)
for k,v in pairs(missions[i].followers) do
rewards.followerBase[v]=self:GetFollowerData(v,'qLevel')
end
+ for k,v in pairs(missions[i].rewards) do
+ if v.itemID then GetItemInfo(v.itemID) end -- tickling server
+ end
local m=missions[i]
local _
_,_,_,m.successChance,_,_,m.xpBonus,m.resourceMultiplier,m.goldMultiplier=G.GetPartyMissionInfo(m.missionID)
diff --git a/PartyCache.lua b/PartyCache.lua
index 27cf93e..66cdfdd 100644
--- a/PartyCache.lua
+++ b/PartyCache.lua
@@ -194,7 +194,7 @@ end
function addon:GetParties()
return self:GetParty()
end
-function addon:GetParty(missionID,key)
+function addon:GetParty(missionID,key,default)
if not missionID then return parties end
local party=parties[missionID]
if #party.members==0 and G.GetNumFollowersOnMission(missionID)>0 then