From 0c0f0657b673bdb948ebda1b497107769b0c1451 Mon Sep 17 00:00:00 2001 From: ggargani Date: Sun, 2 Oct 2016 22:02:49 +0200 Subject: [PATCH] Hall Mission fixes If no hero available, no mission prefill If possibile, does not put more than one troop per mission Manages special cases (1,2 or 3 heroes) --- MatchMaker.lua | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/MatchMaker.lua b/MatchMaker.lua index 089e27e..d420b66 100644 --- a/MatchMaker.lua +++ b/MatchMaker.lua @@ -142,7 +142,7 @@ local filterTypes = setmetatable({}, {__index=function(self, missionClass) rawset(self, missionClass, CreateFilter(missionClass)) return filterOut end}) -local function AddMoreFollowers(self,mission,scores,justdo) +local function AddMoreFollowers(self,mission,scores,justdo,justone) if #scores==0 then return end local missionID=mission.missionID local filterOut=filters[mission.class] or filters.other @@ -178,6 +178,7 @@ local function AddMoreFollowers(self,mission,scores,justdo) local slot=P:CurrentSlot() if P:AddFollower(candidate) and dbg then scroller:addRow(C("Slot " .. slot..":","Green").. " " .. addon:GetAnyData(0,candidate,'fullname')) + if justone then return end end candidate=nil end @@ -214,7 +215,6 @@ local function MatchMaker(self,mission,party,includeBusy,onlyBest) P:RemoveFollower(followerID) end end - --end end if dbg then scroller=self:GetScroller("Score for " .. mission.name .. " Class " .. mission.class) @@ -245,26 +245,29 @@ local function MatchMaker(self,mission,party,includeBusy,onlyBest) scroller:AddRow(C("Slot 1:","Green").. " " .. addon:GetAnyData(0,firstmember,'fullname')) end if mission.numFollowers > 1 then + local onetroop=(#scores==2) + if #scores ~= 3 then + AddMoreFollowers(self,mission,troops,false,onetroop) + end + AddMoreFollowers(self,mission,scores) + end + end + if P:FreeSlots() > 0 then + if not onlyBest then + filters.skipMaxed=false AddMoreFollowers(self,mission,scores) AddMoreFollowers(self,mission,troops) end end - end - if P:FreeSlots() > 0 then - if not onlyBest then + if P:FreeSlots() > 0 then filters.skipMaxed=false - AddMoreFollowers(self,mission,scores) - AddMoreFollowers(self,mission,troops) + AddMoreFollowers(self,mission,scores,true) + AddMoreFollowers(self,mission,troops,true) + end + if dbg then + P:Dump() + scroller:AddRow("Final score: " .. self:MissionScore(mission)) end - end - if P:FreeSlots() > 0 then - filters.skipMaxed=false - AddMoreFollowers(self,mission,scores,true) - AddMoreFollowers(self,mission,troops,true) - end - if dbg then - P:Dump() - scroller:AddRow("Final score: " .. self:MissionScore(mission)) end if not party.class then party.class=class -- 1.7.9.5