diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua index 7aed011..3f80202 100644 --- a/GarrisonCommander.lua +++ b/GarrisonCommander.lua @@ -428,29 +428,18 @@ function addon:showdata(fullargs,action,missionid) end end end ----@function [parent=#GarrisonCommander] GarrisonTraitCountersFrame_OnLoad ---@param #enum followerType dalla 6.2, il tipo follower ---@param #string tooltipString Format per il tooltip -function _G.GarrisonTraitCountersFrame_OnLoad(self, followerType, tooltipString) - if (followerType == nil) then - followerType = LE_FOLLOWER_TYPE_GARRISON_6_0; - end - if (tooltipString == nil) then - tooltipString = GARRISON_THREAT_COUNTER_TOOLTIP .. " %d"; - end - self.tooltipString = tooltipString; - local i=1 - local top=0 - for id,name in pairs(traitTable) do +local function fillCounters(self,category) + local i=0 + for id,name in pairs(ns.traitTable[category]) do + i=i+1 local frame = self.TraitsList[i]; local offset=(ns.bigscreen and 22 or 17) if ( not frame ) then frame = CreateFrame("Button", nil, self, "GarrisonTraitCounterTemplate"); if i % offset == 1 then - top=top-40 local a,b,c,x,y=self.TraitsList[1]:GetPoint(1) - frame:SetPoint(a,b,c,0,top) + frame:SetPoint(a,b,c,0,0) else frame:SetPoint("RIGHT", self.TraitsList[i-1], "LEFT", -14, 0); frame:SetScript("OnEnter",GarrisonTraitCounter_OnEnter) @@ -460,17 +449,72 @@ function _G.GarrisonTraitCountersFrame_OnLoad(self, followerType, tooltipString) frame.Icon:SetTexture(G.GetFollowerAbilityIcon(id)) frame.name = name; frame.id = id; - i=i+1 + frame:Show() + end + for j=i+1,#self.TraitsList do + self.TraitsList[j]:Hide() + end +end + +---@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_OnLoad +--@param #enum followerType dalla 6.2, il tipo follower +--@param #string tooltipString Format per il tooltip +function _G.GarrisonTraitCountersFrame_OnLoad(self, followerType, tooltipString) + if (followerType == nil) then + followerType = LE_FOLLOWER_TYPE_GARRISON_6_0; + end + if (tooltipString == nil) then + tooltipString = GARRISON_THREAT_COUNTER_TOOLTIP .. " %d"; + end + self.tooltipString = tooltipString; + self.choice=CreateFrame('Frame',self:GetName()..tostring(GetTime()*1000),self,"UIDropDownMenuTemplate") + self.choice.button=_G[self.choice:GetName()..'Button'] + self.choice:SetPoint("TOPLEFT",GMF.FollowerTab,"BOTTOMLEFT",-10,-5) + fillCounters(self,1) + do + local frame=self.choice + local list=addon:GetSortedProxy({}) + for v,k in pairs(G.GetRecruiterAbilityCategories()) do + if (ns.traitTable[v]) then + list[k]=v + end + end + + local function sel(this,category,index) + print(category,index) + UIDropDownMenu_SetSelectedID(frame,index) + fillCounters(frame:GetParent(),category) + end + UIDropDownMenu_Initialize(frame, function(...) + local i=0 + for k,v in list() do + i=i+1 + local info=UIDropDownMenu_CreateInfo() + info.text=v + info.value=v + info.func=sel + info.arg1=v + info.arg2=i + UIDropDownMenu_AddButton(info,1) + end + end) + UIDropDownMenu_SetWidth(frame, 100); + UIDropDownMenu_SetButtonWidth(frame, 124) + UIDropDownMenu_SetSelectedID(frame, 1) + UIDropDownMenu_JustifyText(frame, "LEFT") + --EasyMenu(list,frame,frame,0,0,nil,5) end self:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE"); end --- Trait show + +---@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_OnEvent function _G.GarrisonTraitCountersFrame_OnEvent(self, event, ...) if ( self:IsVisible() ) then GarrisonTraitCountersFrame_Update(self); end end +---@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_Update function _G.GarrisonTraitCountersFrame_Update(self) for i = 1, #self.TraitsList do @@ -480,6 +524,7 @@ function _G.GarrisonTraitCountersFrame_Update(self) end end +---@function [parent=#GarrisonTraitCountersFrame] GarrisonTraitCountersFrame_OnEnter function _G.GarrisonTraitCounter_OnEnter(self) GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); local text = string.format(self:GetParent().tooltipString, self.Count:GetText(), self.name,self.id); @@ -731,7 +776,9 @@ local function switch(flag) end end function addon:RefreshMissions(missionID) - GarrisonMissionList_UpdateMissions() + if (GMF:IsShown()) then + GarrisonMissionList_UpdateMissions() + end end --[[ diff --git a/Init.lua b/Init.lua index 0c47ba9..97db8f9 100644 --- a/Init.lua +++ b/Init.lua @@ -201,6 +201,70 @@ function addon:GetType(itemID) if (followerItems[itemID]) then return "followerEquip" end return "generic" end +--Data + +ns.traitTable= { + { + [9] = "Wastelander", + [7] = "Mountaineer", + [45] = "Cave Dweller", + [46] = "Guerilla Fighter", + [44] = "Naturalist", + [48] = "Marshwalker", + [49] = "Plainsrunner", + [8] = "Cold-Blooded", + }, -- [1] + { + [79] = "Scavenger", + [80] = "Extra Training", + [29] = "Fast Learner", + [256] = "Treasure Hunter", + }, -- [2] + { + [76] = "High Stamina", + [221] = "Epic Mount", + [77] = "Burst of Power", + }, -- [3] + [5] = { + [61] = "Tailoring", + [52] = "Mining", + [54] = "Alchemy", + [56] = "Enchanting", + [58] = "Inscription", + [60] = "Leatherworking", + [62] = "Skinning", + [53] = "Herbalism", + [55] = "Blacksmithing", + [57] = "Engineering", + [59] = "Jewelcrafting", + }, + [6] = { + [73] = "Voodoo Zealot", + [63] = "Gnome-Lover", + [66] = "Child of the Moon", + [70] = "Child of Draenor", + [74] = "Elvenkind", + [67] = "Ally of Argus", + [71] = "Death Fascination", + [75] = "Economist", + [64] = "Humanist", + [68] = "Canine Companion", + [72] = "Totemist", + [65] = "Dwarvenborn", + [69] = "Brew Aficionado", + }, + [7] = { + [37] = "Beastslayer", + [39] = "Primalslayer", + [4] = "Orcslayer", + [43] = "Talonslayer", + [36] = "Demonslayer", + [38] = "Ogreslayer", + [40] = "Gronnslayer", + [42] = "Voidslayer", + [41] = "Furyslayer", + }, +} -------------------- to be estracted to CountersCache @@ -211,11 +275,32 @@ end --}) -- -- +-- + +--[[ TtraitTable generator +local TT=C_Garrison.GetRecruiterAbilityList(true) +local map={} +local keys={} +for i,v in pairs(C_Garrison.GetRecruiterAbilityCategories()) do + keys[v]=i +end +for _,trait in pairs(TT) do + local key=keys[trait.category] + if type(map[key])~="table" then + map[key]={} + end + map[key][trait.id]=trait.name +end +ATEINFO['abilities']=map +--]] + +-- --[===[@non-debug@ if true then return end --@end-non-debug@]===] --@do-not-package@ + local me, ns = ... local addon=ns.addon --#addon local L=ns.L diff --git a/MissionCache.lua b/MissionCache.lua index 627bcb3..c0cec7f 100644 --- a/MissionCache.lua +++ b/MissionCache.lua @@ -131,7 +131,7 @@ function AddExtraData(mission) mission.itemLevel=655 elseif v.itemID~=120205 then -- xp item local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(v.itemID) - if (not itemName) then + if (not itemName or not itemTexture) then mission.class="retry" return end diff --git a/MissionControl.lua b/MissionControl.lua index 9acc4bc..ca65ec9 100644 --- a/MissionControl.lua +++ b/MissionControl.lua @@ -288,7 +288,7 @@ local function drawItemButtons() GMC.settings.rewardChance[this:GetParent().key]=this:OnValueChanged(value) end ) - frame.slider:OnValueChanged(GMC.settings.rewardChance[frame.key]) + frame.slider:OnValueChanged(GMC.settings.rewardChance[frame.key] or 100) --frame.slider:SetText(GMC.settings.rewardChance[frame.key]) frame.chest = frame.chest or frame:CreateTexture(nil, 'BACKGROUND') frame.chest:SetTexture('Interface\\Garrison\\GarrisonMissionUI2.blp')