diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 116b32d..0fb70a4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ *GarrisonCommander helps you when choosing the right follower for the right mission* +* *2.6.12* +Fix: Colorizing in broker at last wotking as intended +Fix: Anticipating a fixe for a 6.2.1 only bug + * *2.6.11* Fix: When loaded in a particular order and with GarrisonCommander-Broker, was running partially broken Fix: Clash with MP in fleet map, slightly moved GC frame diff --git a/GarrisonCommander-Broker/GarrisonCommander-Broker.toc b/GarrisonCommander-Broker/GarrisonCommander-Broker.toc index 83d1ec3..20873d0 100644 --- a/GarrisonCommander-Broker/GarrisonCommander-Broker.toc +++ b/GarrisonCommander-Broker/GarrisonCommander-Broker.toc @@ -5,7 +5,7 @@ ## Notes-frFR: Data-Broker pour GarrisonCommander ## Author: Alar of Daggerspine ## Version: @project-version@ 6.2 -## X-Version: 2.6.5 +## X-Version: 2.6.12 ## X-Revision: @project-abbreviated-hash@ ## eMail: alar@aspide.it ## URL: http://wow.aspide.it diff --git a/GarrisonCommander-Broker/ldb.lua b/GarrisonCommander-Broker/ldb.lua index d33a0cd..3bfdf28 100644 --- a/GarrisonCommander-Broker/ldb.lua +++ b/GarrisonCommander-Broker/ldb.lua @@ -346,7 +346,7 @@ function addon:OnInitialized() self:AddToggle("SHOWNEXT",false,L["Show next toon"],L["Show the next toon which will complete a mission"]) self:AddSlider("FREQUENCY",5,1,60,L["Update frequency"]) frequency=self:GetNumber("FREQUENCY",5) - self:ScheduleTimer("DelayedInit",5) + self:ScheduleTimer("DelayedInit",1) end function addon:ApplyFREQUENCY(value) frequency=value @@ -367,15 +367,21 @@ function addon:SHOW_LOOT_TOAST(event,typeIdentifier, itemLink, quantity, specID, cacheobj:Update() end end +local init=5 function addon:DelayedInit() self:CheckDateReset() self:WorkUpdate() self:ZONE_CHANGED_NEW_AREA() - ldbtimer=self:ScheduleRepeatingTimer("ldbUpdate",frequency) farmobj:Update() workobj:Update() dataobj:Update() self.db.realm.cachesize[ns.me] = self:GetImprovedCacheSize() + if init > 0 then + self:ScheduleTimer('DelayedInit',2) + init=init-1 + else + ldbtimer=self:ScheduleRepeatingTimer("ldbUpdate",frequency) + end end function addon:GetImprovedCacheSize() if IsQuestFlaggedCompleted(37485) then @@ -399,12 +405,8 @@ function addon:Gradient(perc) end function addon:ColorGradient(perc, ...) - if perc >= 1 then - local r, g, b = select(select('#', ...) - 2, ...) - return r, g, b - elseif perc <= 0 then - local r, g, b = ... - return r, g, b + if perc > 1 then perc=1 + elseif perc < 0 then perc=0 end local num = select('#', ...) / 3 local segment, relperc = math.modf(perc*(num-1)) @@ -447,17 +449,28 @@ cacheobj=LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("GC-Cache", { function farmobj:Update() local n,t=addon:CountMissing() if (t>0) then - local c=addon:ColorToString(addon:Gradient(n/t)) - farmobj.text=format("|cff%s%d|r/|cff%s%d|r",c,t-n,C.Green.c,t) + --local c=addon:ColorToString(addon:Gradient(1/t*(t-n))) + local c,perc=addon:moreIsGood(n,t) + farmobj.text=format("|cff%s%d|r/|cff20ff20%d|r",c,t-n,t) else farmobj.text=NONE end end +function workobj:Update() + local n,t=addon:CountEmpty() + if (t>0) then + local c,perc=addon:moreIsGood(n,t) + workobj.text=format("|cff%s%d|r/|cff20ff20%d|r",c,t-n,t) + else + workobj.text=NONE + end +end + function cacheobj:Update() local n,t=addon:CountCaches() if (t>0) then - local c=addon:ColorToString(addon:Gradient(n/t)) - cacheobj.text=format("|cff%s%d|r/|cff%s%d|r",c,t-n,C.Green.c,t) + local c,perc=addon:moreIsGood(n,t) + cacheobj.text=format("|cff%s%d|r/|cff20ff20%d|r",c,t-n,t) else cacheobj.text=NONE end @@ -494,6 +507,7 @@ function dataobj:OnTooltipShow() self:AddLine(L["Mission awaiting"]) local db=addon.db.realm.missions local now=time() + local remove=nil for i=1,#db do if db[i] then local t,missionID,pc,followerType=strsplit('.',db[i]) @@ -501,6 +515,11 @@ function dataobj:OnTooltipShow() followerType=tonumber(followerType) or LE_FOLLOWER_TYPE_GARRISON_6_0 local name= (followerType==LE_FOLLOWER_TYPE_SHIPYARD_6_2) and C(G.GetMissionName(missionID),"cyan") or G.GetMissionName(missionID) if (name) then + if not remove and pc==ns.me then + if not G.GetPartyMissionInfo(missionID) then + remove=i + end + end local msg=format("|cff%s%s|r: %s",pc==ns.me and C.Green.c or C.Orange.c,pc,name) if t > now then self:AddDoubleLine(msg,SecondsToTime(t-now),nil,nil,nil,C.Red()) @@ -510,7 +529,9 @@ function dataobj:OnTooltipShow() end end end - + if remove then + tremove(db,remove) + end self:AddLine(me,C.Silver()) end @@ -539,16 +560,6 @@ function workobj:OnEnter() workobj.OnTooltipShow(GameTooltip) GameTooltip:Show() end -function workobj:Update() - local n,t=addon:CountEmpty() - if (t>0) then - local c=addon:ColorToString(addon:Gradient((n)/t)) - workobj.text=format("|cff%s%d|r/|cff%s%d|r",c,t-n,C.Green.c,t) - else - workobj.text=NONE - end - -end function workobj:OnTooltipShow() self:AddLine(CAPACITANCE_WORK_ORDERS) local now=time() @@ -633,11 +644,11 @@ function dataobj:Update() end end if t>0 then - local c=addon:ColorToString(addon:Gradient(n/t)) + local c,perc=addon:moreIsGood(n,t) if (prox and addon:GetBoolean("SHOWNEXT")) then - self.text=format("|cff%s%d|r/|cff%s%d|r (%s)",c,n,C.Green.c,t,prox) + self.text=format("|cff%s%d|r/|cff20ff20%d|r (%s)",c,n,t,prox) else - self.text=format("|cff%s%d|r/|cff%s%d|r",c,n,C.Green.c,t) + self.text=format("|cff%s%d|r/|cff20ff20%d|r",c,n,t) end else self.text=NONE @@ -665,6 +676,13 @@ function dataobj:OldUpdate() end self.text=format("%s: %s (Tot: |cff00ff00%d|r) %s: %s",READY,ready,completed,NEXT,prox) end-- Resources rate: 144 a day +function addon:moreIsGood(n,t) + -- t = total + -- n = counted + local perc= math.floor(1/t*(t-n)*10)/10 + --return 1/t*w + return addon:ColorToString(addon:ColorGradient(perc,1,0,0,1,1,0,0,1,0)),perc +end --@debug@ local function highdebug(tb) diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua index 1f614b9..1d72741 100644 --- a/GarrisonCommander.lua +++ b/GarrisonCommander.lua @@ -443,14 +443,14 @@ print("Initialize") self:Trigger("MSORT") LoadAddOn("GarrisonCommander-Broker") --@debug@ - assert(self:GetAgeColor(1/0)) - assert(self:GetAgeColor(0/0)) - assert(self:GetAgeColor(GetTime()+100)) - assert(type(1/0)==nil) - assert(type(0/0)==nil) - assert("stringa"~=nil) - assert("stringa"==nil or true) - assert(pcall(format,"%03d %03d",tonumber(1/0) or 1,tonumber(0/0) or 2)) +-- assert(self:GetAgeColor(1/0)) +-- assert(self:GetAgeColor(0/0)) +-- assert(self:GetAgeColor(GetTime()+100)) +-- assert(type(1/0)==nil) +-- assert(type(0/0)==nil) +-- assert("stringa"~=nil) +-- assert("stringa"==nil or true) +-- assert(pcall(format,"%03d %03d",tonumber(1/0) or 1,tonumber(0/0) or 2)) --@end-debug@ self:SafeSecureHookScript("GarrisonMissionFrame","OnShow","Setup") return true @@ -2700,6 +2700,7 @@ function addon:AddIndicatorToButton(button,mission,missionID,bigscreen) button.xp:SetJustifyH("CENTER") end button.xp:SetWidth(0) + print (self:GetMissionData(missionID,'xp',0),self:GetMissionData(missionID,'xpBonus',0),self:GetParty(missionID,'xpBonus',0) ,button.info.numFollowers) local xp=(self:GetMissionData(missionID,'xp',0)+self:GetMissionData(missionID,'xpBonus',0)+self:GetParty(missionID,'xpBonus',0) )*button.info.numFollowers button.xp:SetFormattedText("Xp: %d",xp) button.xp:SetTextColor(self:GetDifficultyColors(xp/3000*100)) diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc index 9b506fc..1225d9d 100644 --- a/GarrisonCommander.toc +++ b/GarrisonCommander.toc @@ -13,7 +13,7 @@ ## Notes-zhCN: 發送所有的追隨者與點擊多任務 ## Author: Alar of Daggerspine ## Version: @project-version@ 6.2.0 -## X-Version: 2.6.11 +## X-Version: 2.6.12 ## X-Revision: @project-abbreviated-hash@ ## eMail: alar@aspide.it ## URL: http://wow.aspide.it diff --git a/Init.lua b/Init.lua index 49b5048..172e6f1 100644 --- a/Init.lua +++ b/Init.lua @@ -13,6 +13,7 @@ local tostringall=tostringall local tostring=tostring local tonumber=tonumber local type=type +print("init loaded") --@debug@ LoadAddOn("Blizzard_DebugTools") LoadAddOn("LibDebug") diff --git a/MatchMaker.lua b/MatchMaker.lua index e25b492..3879939 100644 --- a/MatchMaker.lua +++ b/MatchMaker.lua @@ -42,8 +42,12 @@ end function addon:MissionScore(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 - if x~=x then x=0 end -- Nan is the only value which differs from itself + local x = tonumber(mission.xp) + if x and x >0 then + x= xpBonus/mission.xp*100 + else + x=0 + end local r=0 if type(materialMultiplier)=='table' then for _,v in pairs(mission.rewards) do diff --git a/MissionCache.lua b/MissionCache.lua index 09a3f95..3f8be51 100644 --- a/MissionCache.lua +++ b/MissionCache.lua @@ -263,6 +263,7 @@ print("Could not find info for mission",missionID,G.GetMissionName(missionID)) return mission.basePerc or default else --AddExtraData(mission) + if type(default)=="number" and type(mission[key])~="number" then return default end return mission[key] or default end end diff --git a/PartyCache.lua b/PartyCache.lua index 99e5202..c5de57d 100644 --- a/PartyCache.lua +++ b/PartyCache.lua @@ -227,6 +227,7 @@ function addon:GetParty(missionID,key,default) end end if key then + if type(default)=="number" and type(party[key])~="number" then return default end return party[key] or default else return party