From f056034343c0089d8868022b5bd14c72e5be30a3 Mon Sep 17 00:00:00 2001 From: Alar of Daggerspine Date: Wed, 26 Aug 2015 00:00:39 +0200 Subject: [PATCH] * *2.6.15* Feature: Item rewards in Mission Control can be filtered on level Feature: All header menu are now context sensitive Feature: Header added to Shipyard Feature: One click ship upgrade Signed-off-by: Alar of Daggerspine --- CHANGELOG.txt | 7 ++ FollowerPage.lua | 43 ++++------- GarrisonCommander.lua | 163 ++++++++++++++++++++++++++++-------------- GarrisonCommander.toc | 2 +- Init.lua | 15 +++- MissionCache.lua | 12 ++-- MissionControl.lua | 65 ++++++++++++----- ShipYard.lua | 148 ++++++++++++++++++++++++++++++++++++-- 8 files changed, 342 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cede13b..e32a2cc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,12 @@ *GarrisonCommander helps you when choosing the right follower for the right mission* +* *2.6.15* +Feature: Item rewards in Mission Control can be filtered on level +Feature: All header menu are now context sensitive +Feature: Header added to Shipyard +Feature: One click ship upgrade + + * *2.6.14* Fix: Rare error when zoning in and out of Garrison Fix: In follower page, swap button conflicted with confirm upgrade button diff --git a/FollowerPage.lua b/FollowerPage.lua index 201d917..9d8f9d6 100644 --- a/FollowerPage.lua +++ b/FollowerPage.lua @@ -90,47 +90,34 @@ local colors={ [630]="Rare", [645]="Epic" } +function addon:ApplyUPG(value) + self:ShowUpgradeButtons() +end +function addon:ApplySWAPBUTTONS(value) + self:ShowUpgradeButtons() +end function addon:ShowUpgradeButtons(force) if InCombatLockdown() then self:ScheduleLeaveCombatAction("ShowUpgradeButtons",force) return end local gf=GMF.FollowerTab - if (not force and not gf:IsVisible()) then return end - if (not gf.showUpgrades) then - gf.showUpgrades=self:GetFactory():Checkbox(gf.Model,self:GetToggle("UPG"),self:GetVarInfo("UPG")) - gf.showUpgrades:SetPoint("TOPLEFT") - gf.showUpgrades:Show() - gf.showUpgrades:SetScript("OnClick",function(this) - addon:SetBoolean("UPG",this:GetChecked()) - addon:ShowUpgradeButtons() - end) - end - if (not gf.noConfirm) then - gf.noConfirm=self:GetFactory():Checkbox(gf.Model,self:GetToggle("NOCONFIRM"),self:GetVarInfo("NOCONFIRM")) - gf.noConfirm:SetPoint("TOPLEFT",0,-20) - gf.noConfirm:Show() - gf.noConfirm:SetScript("OnClick",function(this) - addon:SetBoolean("NOCONFIRM",this:GetChecked()) - end) - end - if (not gf.swapButtons) then - gf.swapButtons=self:GetFactory():Checkbox(gf.Model,self:GetToggle("SWAPBUTTONS"),self:GetVarInfo("SWAPBUTTONS")) - gf.swapButtons:SetPoint("TOPLEFT",0,-40) - gf.swapButtons:Show() - gf.swapButtons:SetScript("OnClick",function(this) - addon:SetBoolean("SWAPBUTTONS",this:GetChecked()) - addon:ShowUpgradeButtons() - end) + if not self:GetBoolean("UPG") then + local b=gf.upgradeButtons + for i=1,#b do + b[i]:Hide() + end + return end + if (not force and not gf:IsVisible()) then return end if not gf.upgradeButtons then gf.upgradeButtons ={} end --if not gf.upgradeFrame then gf.upgradeFrame=CreateFrame("Frame",nil,gf.model) end local b=gf.upgradeButtons local upgrades=self:GetUpgrades() local axpos=self:GetBoolean("SWAPBUTTONS") and 7 or 243 local wxpos=self:GetBoolean("SWAPBUTTONS") and 243 or 7 - local wypos=-155 - local aypos=-155 + local wypos=-85 + local aypos=-85 local used=1 if not gf.followerID then return self:DelayedRefresh(0.1) diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua index ae34bed..bda4074 100644 --- a/GarrisonCommander.lua +++ b/GarrisonCommander.lua @@ -402,7 +402,7 @@ print("Initialize") dbGAC.namespaces.missionscache=nil -- Removed in 2.6.9 dbGAC.namespaces=nil end - self:AddLabel("Appearance") + self:AddLabel(L["Garrison Appearance"]) self:AddToggle("MOVEPANEL",true,L["Unlock Panel"],L["Makes main mission panel movable"]) self:AddToggle("BIGSCREEN",true,L["Use big screen"],L["Disabling this will give you the interface from 1.1.8, given or taken. Need to reload interface"]) self:AddToggle("PIN",true,L["Show Garrison Commander menu"],L["Disable if you dont want the full Garrison Commander Header."]) @@ -423,7 +423,7 @@ print("Initialize") 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)"]) self:AddToggle("USEFUL",true,L["Enhance tooltip"],L["Adds a list of other useful followers to tooltip"]) self:AddToggle("MAXRES",true,L["Maximize result"],L["Allows a lower success percentage for resource missions. Use /gac gui to change percentage. Default is 80%"]) - self:AddSlider("MAXRESCHANCE",80,50,100,L["Minum needed chance"],L["Applied when maximise result is enabled. Default is 80%"]) + self:AddSlider("MAXRESCHANCE",80,50,100,L["Minum needed chance"],L["Applied when maximise result is enabled. Default is 80%"],1) ns.bigscreen=self:GetBoolean("BIGSCREEN") self:AddLabel("Followers Panel") self:AddSlider("MAXMISSIONS",5,1,8,L["Mission shown"],L["Mission shown for follower"],1) @@ -433,6 +433,9 @@ print("Initialize") self:AddToggle("UPG",true,L["Show upgrades"],L["Only meaningful upgrades are shown"]) self:AddToggle("NOCONFIRM",true,L["Don't ask confirmation"],L["If checked, clicking an upgrade icon will consume the item and upgrade the follower\n|cFFFF0000NO QUESTION ASKED|r"]) self:AddToggle("SWAPBUTTONS",false,L["Swap upgrades position"],L["IF checked, shows armors on the left and weapons on the right "]) + if not ns.bigscreen then + self:AddToggle("FOLLOWERMISSIONLIST",true,L["Show missionlist"],L["Affects only little screen mode, hiding the per follower mission list if not checked"]) + end self:AddLabel("Buildings Panel") self:AddToggle("HF",false,L["Hide followers"],L["Do not show follower icon on plots"]) --@debug@ @@ -539,6 +542,15 @@ function addon:ApplyMINPERC(value) MINPERC=value BUSY_MESSAGE=format(BUSY_MESSAGE_FORMAT,MAXMISSIONS,MINPERC) end +function addon:ApplyFOLLOWERMISSIONLIST(value) + if (GMF.FollowerTab:IsVisible()) then + self:RenderFollowerPageMissionList(nil,GMF.FollowerTab.followerID) + end +end +function addon:ApplyIXP(vale) +end +function addon:ApplyILV(vale) +end function addon:IsIgnored(followerID,missionID) if (chardb.ignored[missionID][followerID]) then return true end @@ -1076,9 +1088,9 @@ function addon:AddOptionToOptionsLayer(o,flag,maxsize) --@debug@ print("Adding option",flag) --@end-debug@ - maxsize=tonumber(maxsize) or 140 + maxsize=tonumber(maxsize) or 160 if (not flag) then return 0 end - local info=self:GetVarInfo(flag) + local info=addon:GetVarInfo(flag) if (info) then local data={option=info} local widget @@ -1087,14 +1099,14 @@ function addon:AddOptionToOptionsLayer(o,flag,maxsize) --@end-debug@ if (info.type=="toggle") then widget=AceGUI:Create("CheckBox") - local value=self:GetBoolean(flag) + local value=addon:GetBoolean(flag) widget:SetValue(value) local color=value and "Green" or "Silver" widget:SetLabel(C(info.name,color)) - widget:SetWidth(max(widget.text:GetStringWidth(),maxsize)) + widget:SetWidth(min(widget.text:GetStringWidth()+40,maxsize)) elseif(info.type=="select") then widget=AceGUI:Create("Dropdown") - widget:SetValue(self:GetVar(flag)) + widget:SetValue(addon:GetVar(flag)) widget:SetLabel(info.name) widget:SetText(info.values[self:GetVar(flag)]) widget:SetList(info.values) @@ -1107,7 +1119,7 @@ function addon:AddOptionToOptionsLayer(o,flag,maxsize) self[info.func](self,data,value) end) elseif (info.type=="range") then - local value=self:GetNumber(flag) + local value=addon:GetNumber(flag) widget=AceGUI:Create("Slider") widget:SetLabel(info.name) widget:SetValue(value) @@ -1140,11 +1152,16 @@ function addon:AddOptionToOptionsLayer(o,flag,maxsize) end return maxsize end - -function addon:CreateHeader() +function addon:GetMain() + return GMF +end +function addon:CreateHeader(module) + if not module then module=self end -- Main Garrison Commander Header - GCF=CreateFrame("Frame","GCF",UIParent,"GarrisonCommanderTitle") + local GCF=CreateFrame("Frame","GCF",UIParent,"GarrisonCommanderTitle") local signature=me .. " " .. self.version + local PIN=module and "SHIPPIN" or "PIN" + local MOVEPANEL =module and "SHIPMOVEPANEL" or "MOVEPANEL" GCF.Signature:SetText(signature) --@alpha@ GCF.Warning:SetText("Alpha Version") @@ -1154,16 +1171,17 @@ function addon:CreateHeader() for _,f in pairs({GCF:GetRegions()}) do if (f:GetObjectType()=="Texture" and f:GetAtlas()=="Garr_WoodFrameCorner") then f:Hide() end end - GCF:SetFrameStrata(GMF:GetFrameStrata()) - GCF:SetFrameLevel(GMF:GetFrameLevel()-2) - if (not ns.bigscreen) then GCF:SetHeight(GCF:GetHeight()+35) end + local main=module:GetMain() + GCF:SetFrameStrata(main:GetFrameStrata()) + GCF:SetFrameLevel(main:GetFrameLevel()-2) + if (not ns.bigscreen and not module) then GCF:SetHeight(190) end baseHeight=GCF:GetHeight() minHeight=47 GCF.CloseButton:SetScript("OnClick",nil) GCF.Pin:SetAllPoints(GCF.CloseButton) GCF:SetWidth(BIGSIZEW) GCF:SetPoint("TOP",UIParent,0,-60) - if (self:GetBoolean("PIN")) then + if (self:GetBoolean(PIN)) then GCF.Pin:SetChecked(true) else GCF.Pin:SetChecked(false) @@ -1175,8 +1193,12 @@ function addon:CreateHeader() local baseStrata=GCF:GetFrameStrata() local baseLevel=GCF:GetFrameStrata() local speed=3 + local GCF=GCF + local module=module + local MOVEPANEL=MOVEPANEL + local PIN=PIN local function shrink(this) - addon:RemoveMenu() + module:RemoveMenu() this:SetScript("OnUpdate",function(me,ts) local h=me:GetHeight() if (h<=45) then @@ -1194,7 +1216,7 @@ function addon:CreateHeader() if (h>=baseHeight) then me:SetScript("OnUpdate",nil) me:SetHeight(baseHeight) - if (not me.Menu) then addon:AddMenu() end + if (not me.Menu) then module:AddMenu() end GCF.tooltip=nil me.Menu:DoLayout() else @@ -1207,32 +1229,17 @@ function addon:CreateHeader() GCF.Pin:SetScript("OnClick",function(this) local value=this:GetChecked() this:SetChecked(value) - addon:SetBoolean("PIN",value) + addon:SetBoolean(PIN,value) if (value) then grow(GCF) else shrink(GCF) end end) end GCF:EnableMouse(true) GCF:SetMovable(true) GCF:RegisterForDrag("LeftButton") - GCF:SetScript("OnDragStart",function(frame)if (self:GetBoolean("MOVEPANEL")) then frame:StartMoving() end end) + GCF:SetScript("OnDragStart",function(frame)if self:GetBoolean(MOVEPANEL) then frame:StartMoving() end end) GCF:SetScript("OnDragStop",function(frame) frame:StopMovingOrSizing() end) - if (ns.bigscreen) then - -- Mission list on follower panels - local ml=CreateFrame("Frame","GCFMissions",GMFFollowers,"GarrisonCommanderFollowerMissionList") - ml:SetPoint("TOPLEFT",GMFFollowers,"TOPRIGHT") - ml:SetPoint("BOTTOMLEFT",GMFFollowers,"BOTTOMRIGHT") - --ml:SetWidth(450) - ml:Show() - GCFMissions=ml - local fs=GMFFollowers:CreateFontString(nil, "BACKGROUND", "GameFontNormalHugeBlack") - fs:SetPoint("TOPLEFT",GMFFollowers,"TOPRIGHT") - fs:SetText(AVAILABLE) - fs:SetWidth(250) - fs:Show() - GCFBusyStatus=fs - end - self:Trigger("MOVEPANEL") - self.CreateHeader=function() end + self:Trigger(MOVEPANEL) + return GCF end function addon:ScriptTrace(hook,frame,...) @@ -1294,6 +1301,8 @@ function addon:RenderFollowerPageFollowerButton(frame,follower,showCounters) else frame.GCXp:Hide() end + else + frame.GCXp:Hide() end if self:GetToggle("ILV") then if (follower.level >= GARRISON_FOLLOWER_MAX_LEVEL) then @@ -1311,18 +1320,22 @@ function addon:RenderFollowerPageFollowerButton(frame,follower,showCounters) frame.GCArm:Hide() frame.GCXp:SetPoint("LEFT",frame.Name,"LEFT",0,20) end + else + frame.GCWep:Hide() + frame.GCArm:Hide() + frame.GCXp:SetPoint("LEFT",frame.Name,"LEFT",0,20) end end function addon:HookedGarrisonFollowerListButton_OnClick(frame,button) --@debug@ print("Click") --@end-debug@ - if (frame.info.isCollected) then if (button=="LeftButton") then - if (ns.bigscreen and frame and frame.info and frame.info.followerID) then + if (frame and frame.info and frame.info.followerID) then self:HookedGarrisonFollowerPage_ShowFollower(frame.info,frame.info.followerID) end end + if (frame.info.isCollected) then self:ScheduleTimer("HookedGarrisonFollowerButton_UpdateCounters",0.2,GMF,frame,frame.info,false) self:ShowUpgradeButtons() end @@ -1366,6 +1379,7 @@ do local Busystatusmessage local lastFollowerID="" local ml=nil + local mh=nil local tContains=tContains local function MissionOnClick(this,...) @@ -1379,10 +1393,35 @@ print(this.frame,this.frame:GetName()) addon:ScriptGarrisonMissionButton_OnClick(this.frame,"Leftup") lastTab=2 end - function addon:RenderFollowerPageMissionList(frame,followerID,force) - print(ns.bigscreen,GMFFollowers:IsVisible()) - if not ns.bigscreen then return end + function addon:RenderFollowerPageMissionList(dummy,followerID,force) + --print(ns.bigscreen,GMFFollowers:IsVisible()) + --if not ns.bigscreen then return end + if not ns.bigscreen and not self:GetBoolean("FOLLOWERMISSIONLIST") then + if mh then mh:Hide() end + if ml then ml:Hide() end + return + end if not GMFFollowers:IsVisible() then return end + -- Mission list on follower panels + if not mh then + mh=CreateFrame("Frame","GCFMissions",GMFFollowers,"GarrisonCommanderFollowerMissionList") + GCFMissions=mh + local fs=GMFFollowers:CreateFontString(nil, "BACKGROUND", "GameFontNormalHugeBlack") + if (ns.bigscreen) then + mh:SetPoint("TOPLEFT",GMFFollowers,"TOPRIGHT") + fs:SetPoint("TOPLEFT",GMFFollowers,"TOPRIGHT") + else + mh:SetPoint("BOTTOMRIGHT",GMF,"TOPLEFT") + fs:SetPoint("TOPRIGHT",GMFFollowers,"TOPLEFT") + mh.Header:ClearAllPoints() + mh.Header:SetPoint("BOTTOMRIGHT") + end + mh:SetHeight(60) + fs:SetText(AVAILABLE) + fs:SetWidth(250) + fs:Show() + GCFBusyStatus=fs + end if (not ml) then ml=AceGUI:Create("GMCLayer") ml:SetTitle("Ninso") @@ -1393,19 +1432,28 @@ print(this.frame,this.frame:GetName()) ml:ClearAllPoints() ml:SetWidth(200) ml:SetHeight(600) - ml:SetPoint("TOP",GCFMissions.Header,"BOTTOM") - ml:SetPoint("LEFT",GMFFollowers,"RIGHT") - ml:SetPoint("RIGHT",GMF.FollowerTab,"LEFT") - ml:SetPoint("BOTTOM",GMF,0,25) + ml:SetPoint("TOP",mh,"BOTTOM") + if ns.bigscreen then + ml:SetPoint("LEFT",GMFFollowers,"RIGHT") + ml:SetPoint("RIGHT",GMF.FollowerTab,"LEFT") + else + ml:SetPoint("RIGHT",GMF,"LEFT") + ml:SetWidth(300) + end + ml:SetPoint("BOTTOM",GMF,0,ns.bigscreen and 25 or 0) end - self:RenderFollowerButton(GCFMissions.Header,followerID) ml:ClearChildren() - if (type(frame.followerID)=="number") then + if type(followerID)=="number" then ml:SetTitle(NOT_COLLECTED) ml:SetTitleColor(C.Silver()) + mh.Header:Hide() return end + mh.Header:Show() local status=self:GetFollowerStatus(followerID,true) + self:RenderFollowerButton(mh.Header,followerID) + mh:Show() + ml:Show() ml:SetTitle(status) if (status==GARRISON_FOLLOWER_WORKING) then ml:SetTitleColor(C.Cyan()) @@ -1422,17 +1470,23 @@ print(this.frame,this.frame:GetName()) if (tContains(party.members,followerID)) then tinsert(partyIndex,missionID) end end table.sort(partyIndex,function(a,b) return parties[a].perc > parties[b].perc end) + local prog=1 for i=1,#partyIndex do local missionID=partyIndex[i] local party=parties[missionID] local mission=self:GetMissionData(missionID) if mission and party and #party.members >= G.GetMissionMaxFollowers(missionID) then +--@debug@ + print(i,prog,mission,party,self:GetNumber("MAXMISSIONS"),self:GetNumber("MINPERC")) + if prog > self:GetNumber("MAXMISSIONS") or party.perc< self:GetNumber("MINPERC") then print("------------------") break end +--@end-debug@ local mb=AceGUI:Create("GMCMissionButton") mb:SetScale(0.6) ml:PushChild(mb,missionID) mb:SetFullWidth(true) mb:SetMission(mission,party,false,"followers") mb:SetCallback("OnClick",MissionOnClick) + prog=prog+1 end end del(partyIndex) @@ -1448,7 +1502,7 @@ print("Setup") self:CheckMP() if MP then self:AddToggle("CKMP",true,L["Use GC Interface"],L["GCMPSWITCH"]) end self:CheckGMM() - self:CreateHeader() + GCF=self:CreateHeader() local tabMC=CreateFrame("CheckButton",nil,GMF,"SpellBookSkillLineTabTemplate") GMF.tabMC=tabMC tabMC.tooltip="Open Garrison Commander Mission Control" @@ -1493,6 +1547,7 @@ print("Setup") --/Interface/FriendsFrame/UI-Toast-FriendOnlineIcon end function addon:RefreshMenu() + if not GCF then return end -- This could be called befaur header is built if not self.currentmenu or not self.currentmenu:IsVisible() then self:RemoveMenu() self:AddMenu() @@ -1508,13 +1563,15 @@ print("Adding Menu") local menu,size if GMF.MissionTab:IsVisible() then self.currentmenu=GMF.MissionTab - menu,size=self:CreateOptionsLayer(MP and 'CKMP' or nil,'BIGSCREEN','IGM','IGP','NOFILL','MSORT','MAXRES','USEFUL') + menu,size=self:CreateOptionsLayer(MP and 'CKMP' or nil,'BIGSCREEN','IGM','IGP','MSORT','MAXRES','MAXRESCHANCE','NOFILL','USEFUL','MOVEPANEL') elseif GMF.FollowerTab:IsVisible() then + local missionlist=ns.bigscreen or self:GetBoolean("FOLLOWERMISSIONLIST") self.currentmenu=GMF.FollowerTab - menu,size=self:CreateOptionsLayer('BIGSCREEN',ns.bigscreen and 'MAXMISSIONS' or nil,ns.bigscreen and 'MINPERC' or nil,'ILV','IXP','UPG','NOCONFIRM','SWAPBUTTONS') + menu,size=self:CreateOptionsLayer('BIGSCREEN',ns.bigscreen and nil or 'FOLLOWERMISSIONLIST',missionlist and 'MAXMISSIONS' or nil,missionlist and 'MINPERC' or nil,'ILV','IXP','UPG','NOCONFIRM','SWAPBUTTONS','MOVEPANEL') + self:RenderFollowerPageMissionList(nil,GMF.FollowerTab.followerID) elseif GMF.MissionControlTab:IsVisible() then self.currentmenu=GMF.MissionControlTab - menu,size=self:CreateOptionsLayer('BIGSCREEN') + menu,size=self:CreateOptionsLayer('BIGSCREEN','GCSKIPRARE','GCSKIPEPIC','GCMINLEVEL') end --@debug@ self:AddOptionToOptionsLayer(menu,'DBG') @@ -2829,9 +2886,7 @@ function addon:HookedClickOnTabs(tab) print(tab) --@end-debug@ lastTab=tab - if GCF then - self:RefreshMenu() - end + self:RefreshMenu() end function addon:GarrisonMissionFrame_SelectTab(frame,tab) --@debug@ diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc index ccaa1f7..f627079 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.14 +## X-Version: 2.6.15 ## X-Revision: @project-abbreviated-hash@ ## eMail: alar@aspide.it ## URL: http://wow.aspide.it diff --git a/Init.lua b/Init.lua index 172e6f1..d0b9841 100644 --- a/Init.lua +++ b/Init.lua @@ -110,10 +110,13 @@ local backdrop = { edgeSize=16, insets={bottom=3,left=3,right=3,top=3} } -function ns.AddBackdrop(frame) +function ns.AddBackdrop(frame,r,g,b) + r=r or 1 + g=g or 0 + b=b or 0 frame:SetBackdrop(backdrop) frame:SetBackdropColor(1,1,1,0) - frame:SetBackdropBorderColor(1,0,0,1) + frame:SetBackdropBorderColor(r,g,b,1) end -- my implementation of tonumber which accounts for nan and inf ---@function [parent=#ns] tonumber @@ -227,9 +230,15 @@ local items={ } local itemcaches={ [118529]=655,--Cache of Highmaul Treasures, +[118530]=670,--Cache of Highmaul Treasures, +[118531]=685,--Cache of Highmaul Treasures, [122484]=670, --Blackrock Foundry Spoils, +[122485]=685, --Blackrock Foundry Spoils, +[122486]=700, --Blackrock Foundry Spoils, +[127853]=690,--Iron Fleet Treasure Chest +[127854]=705,--Iron Fleet Treasure Chest +[127855]=720,--Iron Fleet Treasure Chest [128391]=685,--Iron Fleet Treasure Chest -[122486]=700, --Blackrock Foundry Spoils [120301]=600, -- Folower Generic armor upgrade [120302]=600, -- Folower Generic weapon upgrade diff --git a/MissionCache.lua b/MissionCache.lua index 3f8be51..0bb4e3f 100644 --- a/MissionCache.lua +++ b/MissionCache.lua @@ -105,6 +105,8 @@ function module:AddExtraData(mission) mission.followerUpgrade=itemRarity elseif itemLevel > 500 and itemMinLevel >=90 then mission.itemLevel=itemLevel + elseif itemLevel >=655 then + mission.itemLevel=itemLevel else mission.others=mission.others+v.quantity end @@ -305,13 +307,15 @@ function addon:AddExtraData(mission) if itemTexture:lower()==rushOrders then mission.rush=mission.rush+v.quantity elseif itemName and (not v.quantity or v.quantity==1) and not v.followerXP then - itemLevel=addon:GetTrueLevel(v.itemID,itemLevel) if (addon:IsFollowerUpgrade(v.itemID)) then mission.followerUpgrade=itemRarity - elseif itemLevel > 500 and itemMinLevel >=90 then - mission.itemLevel=itemLevel else - mission.others=mission.others+v.quantity + itemLevel=addon:GetTrueLevel(v.itemID,itemLevel) + if itemLevel > 500 then + mission.itemLevel=itemLevel + else + mission.others=mission.others+v.quantity + end end else mission.others=mission.others+v.quantity diff --git a/MissionControl.lua b/MissionControl.lua index 45dd6b4..5db5dd4 100644 --- a/MissionControl.lua +++ b/MissionControl.lua @@ -42,6 +42,7 @@ function module:GMCCreateMissionList(workList) --First get rid of unwanted rewards and missions that are too long local settings=self.privatedb.profile.missionControl local ar=settings.allowedRewards + local minlevel=addon:GetNumber('GCMINLEVEL') wipe(workList) for _,missionID in self:GetMissionIterator() do local discarded=false @@ -59,7 +60,7 @@ print(missionID,"discarded due to len",durationSeconds /3600) --@end-debug@ break end -- Mission too long, out of here - if (self:GetMissionData(missionID,'isRare') and settings.skipRare) then + if self:GetMissionData(missionID,'isRare') and addon:GetBoolean('GCSKIPRARE') then --@debug@ print(missionID,"discarded due to rarity") @@ -74,6 +75,15 @@ print(missionID,"discarded due to class == ", class) discarded=true break end + if class=="itemLevel" then + if self:GetMissionData(missionID,'itemLevel') < minlevel then +--@debug@ +print(missionID,"discarded due to ilevel == ", self:GetMissionData(missionID,'itemLevel')) +--@end-debug@ + discarded=true + break + end + end if (not discarded) then tinsert(workList,missionID) end @@ -90,6 +100,12 @@ print(missionID,"discarded due to class == ", class) end end table.sort(workList,msort) +--@debug@ + for i=1,#workList do + local id=workList[i] + print(self:GetMissionData(id,'name'),self:GetMissionData(id,'class'),self:GetMissionData(id,self:GetMissionData(id,'class'))) + end +--@end-debug@ end --- This routine can be called both as coroutin and as a standard one -- In standard version, delay between group building and submitting is done via a self schedule @@ -175,7 +191,7 @@ do minimumChance=tonumber(settings.rewardChance[class]) or 100 end local party={members={},perc=0} - self:MCMatchMaker(missionID,party,settings.skipEpic,minimumChance) + self:MCMatchMaker(missionID,party,addon:GetBoolean('GCSKIPEPIC'),minimumChance) --@debug@ print(missionID," Requested",class,";",minimumChance,"Mission",party.perc,party.full,settings) --@end-debug@ @@ -469,33 +485,48 @@ function module:OnInitialized() GMC.logoutButton:SetWidth(ns.bigscreen and 148 or 90) GMC.logoutButton:SetScript("OnClick",function() GMF:Hide() Logout() end ) GMC.logoutButton:SetPoint('TOP',0,25) - GMC.skipRare=factory:Checkbox(GMC,settings.skipRare,L["Ignore rare missions"]) - GMC.skipRare:SetPoint("TOPLEFT",chance,"BOTTOMLEFT",40,-50) - GMC.skipRare:SetScript("OnClick",function(this) - settings.skipRare=this:GetChecked() - module:GMC_OnClick_Start(GMC.startButton,"LeftUp") - end) + addon:AddLabel(L["Mission Control"]) + addon:AddToggle("GCSKIPRARE",settings.skipRare,L["Ignore rare missions"],L["When checked, Mission Control ignores mission marked as rare"]) + addon:AddToggle("GCSKIPEPIC",settings.skipRare,L["Ignore epic followers"],L["When checked, Mission Control ignores mission marked as rare"]) + addon:AddSlider("GCMINLEVEL",600,540,715,L["Minimum Item Level"],L["For missions rewarding PC equipment, request this mimimum item level in rewards (not applied in real time)"],5) local warning=GMC:CreateFontString(nil,"ARTWORK","CombatTextFont") warning:SetText(L["Epic followers are NOT sent alone on xp only missions"]) warning:SetPoint("TOPLEFT",GMC,"TOPLEFT",0,-25) warning:SetPoint("TOPRIGHT",GMC,"TOPRIGHT",0,-25) warning:SetJustifyH("CENTER") warning:SetTextColor(C.Orange()) - if (settings.skipEpic) then warning:Show() else warning:Hide() end - GMC.skipEpic=factory:Checkbox(GMC,settings.skipEpic,L["Ignore epic for xp missions."]) - GMC.skipEpic:SetPoint("TOPLEFT",GMC.skipRare,"BOTTOMLEFT",0,-10) - GMC.skipEpic:SetScript("OnClick",function(this) - settings.skipEpic=this:GetChecked() - if (settings.skipEpic) then warning:Show() else warning:Hide() end - module:GMC_OnClick_Start(GMC.startButton,"LeftUp") - end) + GMC.warning=warning + if addon:GetBoolean('GCSKIPRARE') then warning:Show() else warning:Hide() end GMC.Credits=GMC:CreateFontString(nil,"ARTWORK","QuestFont_Shadow_Small") GMC.Credits:SetWidth(0) GMC.Credits:SetFormattedText(C(L["Original concept and interface by %s"],'Yellow'),C("Motig","Red") ) GMC.Credits:SetJustifyH("LEFT") - GMC.Credits:SetPoint("BOTTOMLEFT",25,25) + GMC.Credits:SetPoint("BOTTOMLEFT",50,5) return GMC end +local refreshTimer +function module:Refresh() + if GMF.MissionControlTab.startButton:IsEnabled() then + self:GMC_OnClick_Start(GMF.MissionControlTab.startButton,"LeftUp") + else + if refreshTimer then + self:CancelTimer(refreshTimer) + refreshTimer=nil + end + refreshTimer=self:ScheduleTimer("Refresh",1) + end +end +function addon:ApplyGCSKIPRARE(value) + module:Refresh() +end +function addon:ApplyGCMINLEVEL(value) + module:Refresh() +end +function addon:ApplyGCSKIPEPIC(value) + local warning=GMF.MissionControlTab.warning + if addon:GetBoolean('GCSKIPRARE') then warning:Show() else warning:Hide() end + module:Refresh() +end function module:GMCBuildChance() local GMC=GMF.MissionControlTab --Chance diff --git a/ShipYard.lua b/ShipYard.lua index 108ca39..d817abc 100644 --- a/ShipYard.lua +++ b/ShipYard.lua @@ -18,6 +18,19 @@ local LE_FOLLOWER_TYPE_SHIPYARD_6_2=LE_FOLLOWER_TYPE_SHIPYARD_6_2 local module=addon:NewSubClass('ShipYard') --#Module local GameTooltip=GameTooltip local GarrisonShipyardMapMissionTooltip=GarrisonShipyardMapMissionTooltip +local GCS +local shipEnhancement={ + 127882, + 127883, + 127884, + 127663, + 125787, + 127662, + 127880, + 127881, + 127894, + 127886 +} function module:Test() @@ -51,9 +64,16 @@ print(ref) self:SafeHookScript(GSF.MissionTab.MissionList.CompleteDialog,"OnShow",true) self:SafeHookScript(GSF.MissionTab,"OnShow",true) self:SafeHookScript(GSF.FollowerTab,"OnShow",true) + self:SafeRegisterEvent("GARRISON_SHIPYARD_NPC_CLOSED") --GarrisonShipyardFrameFollowersListScrollFrameButton1 --GarrisonShipyardMapMission1 ---@end-debug@ + addon:AddLabel(L["Shipyard Appearance"]) + addon:AddToggle("SHIPMOVEPANEL",true,L["Unlock Panel"],L["Makes shipyard panel movable"]) + --addon:AddToggle("BIGSCREEN",true,L["Use big screen"],L["Disabling this will give you the interface from 1.1.8, given or taken. Need to reload interface"]) + addon:AddToggle("SHIPPIN",true,L["Show Garrison Commander menu"],L["Disable if you dont want the full Garrison Commander Header."]) +end +function module:GetMain() + return GSF end --- --Invoked on every mission display, only for available missions @@ -143,13 +163,23 @@ print("Doing one time initialization for",this:GetName(),...) --@end-debug@ addon:CheckMP() self:SafeSecureHookScript("GarrisonShipyardFrame","OnShow") - GSF:EnableMouse(true) - GSF:SetMovable(true) - GSF:RegisterForDrag("LeftButton") - GSF:SetScript("OnDragStart",function(frame)if (self:GetBoolean("MOVEPANEL")) then frame:StartMoving() end end) - GSF:SetScript("OnDragStop",function(frame) frame:StopMovingOrSizing() end) + self:SafeSecureHookScript(GSF.FollowerTab,"OnShow","FollowerOnShow") + --GSF:EnableMouse(true) + --GSF:SetMovable(true) + --GSF:RegisterForDrag("LeftButton") + --GSF:SetScript("OnDragStart",function(frame)if (self:GetBoolean("MOVEPANEL")) then frame:StartMoving() end end) + --GSF:SetScript("OnDragStop",function(frame) frame:StopMovingOrSizing() end) + GCS=addon:CreateHeader(self) + self:ScriptGarrisonShipyardFrame_OnShow() + self:SafeHookScript(GSF,"OnShow") end function module:ScriptGarrisonShipyardFrame_OnShow() + GCS:Show() + GCS:SetWidth(GSF:GetWidth()) + GSF:ClearAllPoints() + GSF:SetPoint("TOPLEFT",GCS,"BOTTOMLEFT",0,23) + GSF:SetPoint("TOPRIGHT",GCS,"BOTTOMRIGHT",0,23) + self:RefreshMenu() --@debug@ print("Doing all time initialization") @@ -178,11 +208,117 @@ function module:HookedGarrisonShipyardMapMission_OnEnter(frame) g:SetWidth(GarrisonShipyardMapMissionTooltip:GetWidth()) end end +function addon:EventGARRISON_SHIPYARD_NPC_CLOSED(event,...) +--@debug@ +print("NPC CLOSED") +--@end-debug@ + if (GCS) then + self:RemoveMenu() + GCS:Hide() + end +end +function module:RefreshMenu() + if not GCS then return end -- This could be called befaur header is built + if not self.currentmenu or not self.currentmenu:IsVisible() then + self:RemoveMenu() + self:AddMenu() + end +end +function module:AddMenu() +--@debug@ +print("Adding Menu",GCS.Menu,GSF.MissionTab:IsVisible(),GSF.FollowerTab:IsVisible()) +--@end-debug@ + if GCS.Menu then + return + end + local menu,size + + if GSF.MissionTab:IsVisible() then + self.currentmenu=GSF.MissionTab + menu,size=self:CreateOptionsLayer('SHIPMOVEPANEL') + elseif GSF.FollowerTab:IsVisible() then + self.currentmenu=GSF.FollowerTab + menu,size=self:CreateOptionsLayer('SHIPMOVEPANEL') + --elseif GSF.MissionControlTab:IsVisible() then + -- self.currentmenu=GSF.MissionControlTab + -- menu,size=self:CreateOptionsLayer('BIGSCREEN','GCSKIPRARE','GCSKIPEPIC') + end +--@debug@ + self:AddOptionToOptionsLayer(menu,'DBG') + self:AddOptionToOptionsLayer(menu,'TRC') +--@end-debug@ + local frame=menu.frame + frame:Show() + frame:SetParent(GCS) + frame:SetFrameStrata(GCS:GetFrameStrata()) + frame:SetFrameLevel(GCS:GetFrameLevel()+2) + menu:ClearAllPoints() + menu:SetPoint("TOPLEFT",GCS,"TOPLEFT",25,-18) + menu:SetWidth(GCS:GetWidth()-50) + menu:SetHeight(GCS:GetHeight()-50) + menu:DoLayout() + GCS.Menu=menu +end +function module:RemoveMenu() +--@debug@ +print("Removing menu") +--@end-debug@ + if (GCS.Menu) then + local rc,message=pcall(GCS.Menu.Release,GCS.Menu) + --@debug@ + print("Removed menu",rc,message) + --@end-debug@ + GCS.Menu=nil + end +end + function module:OpenLastTab() --@debug@ print("Should restore tab") --@end-debug@ end +function module:FollowerOnShow() + self:ShowEnhancements() +end +function module:ShowEnhancements() + local f=GarrisonShipyardFrame.FollowerTab + local u + if not f.upgrades then + f.upgrades=CreateFrame("Frame","UPG",f) + f.upgrades.items={} + u=f.upgrades + u:ClearAllPoints() + u:SetPoint("TOPLEFT",10,-100) + u:SetPoint("BOTTOMLEFT",0,0) + u:SetWidth(50) + end + u=f.upgrades + for i,itemID in pairs(shipEnhancement) do + local e + if not u.items[i] then + u.items[i]=CreateFrame("Button","But"..i,u,"GarrisonCommanderUpgradeButton,SecureActionButtonTemplate") + e=u.items[i] + e.itemID=itemID + e.Icon:SetSize(40,40) + e:SetPoint("TOPLEFT",0,-45*(i-1)) + GarrisonMissionFrame_SetItemRewardDetails(e) + e:EnableMouse(true) + e:RegisterForClicks("LeftButtonDown") + e:SetAttribute("type","item") + e:SetAttribute("item",select(2,GetItemInfo(itemID))) + --@debug@ + print('Filling ',itemID,GetItemInfo(itemID)) + --@end-debug@ + end + e=u.items[i] + local qt=GetItemCount(itemID) + e.Quantity:SetText(qt) + e.Quantity:Show() + e.Icon:SetDesaturated(qt==0) + e:Show() + end + u:Show() +end --[[ Follower displayHeight = 0.25 followerTypeID = 2