From 08901b9cb91b2052b4b15c0e938b415ae245b9ba Mon Sep 17 00:00:00 2001 From: Alar of Runetotem Date: Mon, 27 Feb 2017 12:47:20 +0100 Subject: [PATCH] Help now opens release note page. Also improved info button for new releases --- GarrisonCommander.lua | 119 +++++++++++-------------------------------------- 1 file changed, 27 insertions(+), 92 deletions(-) diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua index 9179da5..ff67a06 100644 --- a/GarrisonCommander.lua +++ b/GarrisonCommander.lua @@ -1110,93 +1110,7 @@ end local helpwindow -- pseudo static function addon:ShowHelpWindow(button) - if (not helpwindow) then - helpwindow=CreateFrame("Frame",nil,GCF) - helpwindow:EnableMouse(true) - helpwindow:SetBackdrop(backdrop) - helpwindow:SetBackdropColor(1,1,1,1) - helpwindow:SetFrameStrata("TOOLTIP") - helpwindow:Show() - local html=CreateFrame("SimpleHTML",nil,helpwindow) - html:SetFontObject('h1',MovieSubtitleFont); - local f=GameFontNormalLarge - html:SetFontObject('h2',f); - html:SetFontObject('h3',f); - html:SetFontObject('p',f); - html:SetTextColor('h1',C.Blue()) - html:SetTextColor('h2',C.Orange()) - html:SetTextColor('h3',C.Red()) - html:SetTextColor('p',C.Yellow()) - local text=[[ -

Garrison Commander Help

-
-

GC enhances standard Garrison UI by adding a Menu header and useful information in mission button and tooltip. -Since 2.0.2, the "big screen" mode became optional. If you choosed to disable it, some feature described here will not be available -

-
-

Button list:

-

-* Success percent with the current followers selection guidelines
-* Time since the first time we saw this mission in log
-* A "Good" party composition. on each member countered mechanics are shown.
-*** Green border means full counter, Orange border low level counter
-

-

Tooltip:

-

-* Overall mission status
-* All members which can possibly play a role in the mission
-

-

Button enhancement:

-

-* In rewards, actual quantity is shown (xp, money and resources) ot iLevel (item rewards)
-* Countered status
-

-

Menu Header:

-

-* Quick selection of which follower ignore for match making
-* Quick mission list order selection
-

-

Mission Control:

-

Thanks to Motig which donated the code, we have an auto lancher for mission
-You specify some criteria mission should satisfy (success chance, rewards type etc) and matching missions will be autosubmitted
-

-]] -if (MP) then -text=text..[[ -


-

Master Plan 0.20 or above detected

-

Master Plan hides Garrison Commander interface for available missions
-You can still use Garrison Commander Mission Control
-You can switch between MP and GC interface for missions checking and unchecking "Use GC Interface" checkbox. It usually works :) -

-]] -end -if (GMM) then -text=text..[[ -


-

Garrison Mission Manager Detected

-

Garrison Mission Manager and Garrison Commander plays reasonably well together.
-The red button to the right of rewards is from GMM. It spills out of button, Yes, it's designed this way. Dunno why. Ask GMM author :)
-Same thing for the three red buttons in mission page. -

-]] -end -text=text.."" - --html:SetTextColor('h1',C.Red()) - --html:SetTextColor('h2',C.Orange()) - helpwindow:SetWidth(800) - helpwindow:SetHeight(590 + (MP and 160 or 0) + (GMM and 120 or 0)) - helpwindow:SetPoint("TOPRIGHT",button,"TOPLEFT",0,0) - html:ClearAllPoints() - html:SetWidth(helpwindow:GetWidth()-20) - html:SetHeight(helpwindow:GetHeight()-20) - html:SetPoint("TOPLEFT",helpwindow,"TOPLEFT",10,-10) - html:SetPoint("BOTTOMRIGHT",helpwindow,"BOTTOMRIGHT",-10,10) - html:SetText(text) - helpwindow:Show() - return - end - if (helpwindow:IsVisible()) then helpwindow:Hide() else helpwindow:Show() end + addon:Help() end function addon:Toggle(button) local f=button.Toggle @@ -1292,6 +1206,10 @@ function addon:CreateHeader(module,MOVEPANEL,PIN) local GCF=CreateFrame("Frame","GCF",UIParent,"GarrisonCommanderTitle") local signature=me .. " " .. self.version GCF.Signature:SetText(signature) + local _,minor=LibStub("LibInit") + local LL=LibStub("AceLocale-3.0"):GetLocale("LibInit" .. minor,true) + self:MarkAsNew(GCF,self:NumericVersion(),LL["Release notes"] .. self.version,"Help") + --@alpha@ GCF.Warning:SetText("Alpha Version") --@end-alpha@ @@ -1665,7 +1583,6 @@ print("Setup") GMF.tabMC=tabMC tabMC.tooltip=L["Open Garrison Commander Mission Control"] tabMC:SetNormalTexture("Interface\\ICONS\\ACHIEVEMENT_GUILDPERK_WORKINGOVERTIME.blp") - self:MarkAsNew(tabMC,'MissionControl','New in 2.2.0! Try automatic mission management!') tabMC:SetScript("OnClick",function(this,...) addon:OpenMissionControlTab() end) tabMC:Show() tabMC:SetPoint('TOPLEFT',GCF,'TOPRIGHT',0,-110) @@ -1687,6 +1604,7 @@ print("Setup") tabHP:Show() tabHP:SetPoint('TOPLEFT',GCF,'TOPRIGHT',0,-10) tabHP:SetScript("OnClick",function(this,button) addon:ShowHelpWindow(this,button) end) + -- retrieving release notes localization from LibInit local tabQ=CreateFrame("Button",nil,GMF,"SpellBookSkillLineTabTemplate") GMF.tabQ=tabQ tabQ.tooltip=L["Automatically process completed missions and schedules new ones."].."\n".. @@ -1879,6 +1797,7 @@ function addon:ScriptGarrisonMissionFrame_OnShow(...) self:Trigger("MSORT") self:Trigger("CKMP") if IsControlKeyDown() then + self:EnableAutoLogout() self:ScheduleTimer("RunQuick",0.1,true) end return self:RefreshMissions() @@ -1891,15 +1810,31 @@ function addon:RaiseCompleteDialog() print("Dialog:",GMFMissions.CompleteDialog:GetFrameLevel()) --C_Timer.After(0.1,function() local f=GMFMissions.CompleteDialog print("Dialog:",f:GetFrameLevel()) if f:GetFrameLevel() < 45 then f:SetFrameLevel(45) end print("Dialog:",f:GetFrameLevel()) end) end - -function addon:MarkAsNew(obj,key,message) +local newsframes={} +function addon:MarkAsNew(obj,key,message,method) + --@debug@ + db.news[key]=false + --@end-debug@ if (not db.news[key]) then - local f=CreateFrame("Frame",nil,obj,"GarrisonCommanderWhatsNew") + local f=CreateFrame("Button",nil,obj,"GarrisonCommanderWhatsNew") f.tooltip=message - f:SetPoint("BOTTOMLEFT",obj,"TOPRIGHT") + f.texture:ClearAllPoints() + f.texture:SetAllPoints() + f:SetPoint("TOPLEFT",obj,"TOPLEFT") + f:SetFrameStrata("HIGH") f:Show() + if method then + f:SetScript("OnClick",function(frame) self[method](self,frame) self:MarkAsSeen(key) end) + else + f:SetScript("OnClick",function(frame) self:MarkAsSeen(key) end) + end + newsframes[key]=f end end +function addon:MarkAsSeen(key) + db.news[key]=true + if newsframes[key] then newsframes[key]:Hide() end +end function addon:PermanentEvents() -- Follower button enhancement in follower list -- 1.7.9.5