# HG changeset patch # User Nenue # Date 1513373889 18000 # Node ID a4dfdd4f1cf39561267e778baf102289101346b3 # Parent bf4a36378bb97cefac38733eb44b33e775d65a61 - Fixed filter pins not working on Argus maps - More taint counter-measures diff -r bf4a36378bb9 -r a4dfdd4f1cf3 ClassPlan.lua --- a/ClassPlan.lua Fri Nov 24 23:51:44 2017 -0500 +++ b/ClassPlan.lua Fri Dec 15 16:38:09 2017 -0500 @@ -145,6 +145,7 @@ self.profile = characters[profileName] or { showItems = true } + self.profileName = profileName self.characters = characters characters[profileName] = self.profile @@ -175,9 +176,9 @@ end frame.sortedItems = {} for index, listKey in ipairs(frame.listKey) do + self.profile[listKey] = self.profile[listKey] or {} frame.profile = self.profile frame.data = self.data - self.profile[listKey] = self.profile[listKey] or {} local listTitle = frame.listTitle[index] setmetatable(self.profile[listKey], { __tostring = function() return listTitle end }) frame.sortedItems[listKey] = {} @@ -235,16 +236,11 @@ local max = math.max function ClassPlan:RefreshData() - local detailsFailed for index, handler in pairs(self.Handlers) do print(' |cFF00FF00'..handler:GetName()..' data update|r') handler:RefreshData() end - if detailsFailed then - db.print('Unable to obtain player details. Trying again later.') - else self.requestingData = nil - end end function ClassPlan:Update() @@ -254,7 +250,9 @@ for index, handler in ipairs(self.Handlers) do local itemsHeight = handler:UpdateItems() if itemsHeight then + self.currentHeight = max(itemsHeight, self.currentHeight) + print('calc height', handler, self.currentHeight) end end @@ -299,6 +297,11 @@ index = index + 1 end + for i = index, #self.characterButtons do + self.characterButtons[i]:Hide() + end + + self.HeaderInset:SetHeight(CP_HEADER_SIZE) self.HeaderInset:ClearAllPoints() self.HeaderInset:SetPoint('TOPLEFT' ,self, 'TOPLEFT') @@ -376,7 +379,7 @@ ListTab:SetPoint('BOTTOMRIGHT', frame, 'TOPRIGHT', 0, -CP_HEADER_SIZE) ListTab.Label:SetText(frame.listTitle[frame.currentListIndex]) ListTab:Show() - print(ListTab:GetSize()) + print(ListTab:GetName(), ListTab:GetSize()) end self.currentHeight = max(self.currentHeight, frame.currentHeight or 0) end @@ -470,13 +473,10 @@ function ClassPlanHandlerBase:RefreshData() print('|cFF0088FF'..self:GetName()..':RefreshData()') local activeKey = self.activeKey - local detailsFailed self.truncatedItems = 0 self.currentTime = time() if self:GetParent().profile then self:GetPlayerData() - else - detailsFailed = true end for _, listKey in ipairs(self.listKey) do local sortedItems = self.sortedItems[listKey] @@ -543,10 +543,7 @@ self.Name:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b) end -function ClassPlanHandlerBase:Acquire(id) -end -function ClassPlanHandlerBase:FreeBlock (block) -end +function ClassPlanHandlerBase:Reanchor() end function ClassPlanHandlerBase:UpdateItems() print('|cFF0088FF '..self:GetName()..':UpdateItems()|r', self.activeKey) @@ -561,6 +558,16 @@ scrollOffset = (numItems - self.maxItems) end + if self.OnUpdateRequested then + local overrideHeight = self:OnUpdateRequested() + if overrideHeight then + return overrideHeight + end + + + end + + self.ListTab.Count:SetText(numItems) self.blocks = self.blocks or {} local blocks = self.blocks @@ -647,6 +654,12 @@ self.scrollOffset = scrollOffset self.isStale = nil + + + if self.OnItemsUpdated then + return self:OnItemsUpdated() + end + return totalHeight end @@ -708,7 +721,7 @@ local frame = self:GetParent() frame:SetList() if frame.OnHeaderClick then - frame.OnHeaderClick(frame) + frame:OnHeaderClick() end end @@ -723,6 +736,10 @@ self.SelectGlow:SetShown(self.isMine) end +function ClassPlanCharacterButtonMixin:OnLoad() + self:RegisterForClicks('AnyDown') +end + function ClassPlanCharacterButtonMixin:OnEnter() if not self.profileKey then return @@ -730,7 +747,7 @@ GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') local info = ClassOrderPlan.data.characters[self.profileKey] - GameTooltip:AddLine(self.characterName, self.classColor.r, self.classColor.g, self.classColor.b) + GameTooltip:AddLine(self.characterName .. ' - ' .. self.characterRealm, self.classColor.r, self.classColor.g, self.classColor.b) local numItems = 0 if info.missions then GameTooltip:AddLine(#info.missions .. ' mission'..((#info.missions == 1) and '' or 's')..' in progress') @@ -751,13 +768,22 @@ end function ClassPlanCharacterButtonMixin:OnClick(button, down) - print('OnClick', self.profileKey) local clist = ClassOrderPlan.data.characters if button == 'RightButton' then - for _, profile in pairs(clist) do - profile.showItems = true + + if IsShiftKeyDown() then + print('delete profile', self.profileKey) + clist[self.profileKey] = nil + else + + for _, profile in pairs(clist) do + profile.showItems = true + end end + + + else if clist[self.profileKey].showItems then clist[self.profileKey].showItems = nil @@ -769,7 +795,10 @@ handler.isStale = true end + + ClassOrderPlan:RefreshData() ClassOrderPlan:Update() - print(clist[self.profileKey].showItems) + print('OnClick', self.profileKey) + print( clist[self.profileKey] and clist[self.profileKey].showItems) end diff -r bf4a36378bb9 -r a4dfdd4f1cf3 ClassPlanFollowers.lua --- a/ClassPlanFollowers.lua Fri Nov 24 23:51:44 2017 -0500 +++ b/ClassPlanFollowers.lua Fri Dec 15 16:38:09 2017 -0500 @@ -1,10 +1,10 @@ -local print = DEVIAN_WORKSPACE and function(...) print('ClassPlan', ...) end or nop +local print = DEVIAN_WORKSPACE and function(...) print('ClassPlanF', ...) end or nop local c = { - templateName = 'ClassPlanShipmentEntry', + templateName = 'ClassPlanFollowerEntry', listKey = {'followers','troops'}, - listTitle = {'Followers'}, + listTitle = {'Followers', 'Troops'}, events = { 'GARRISON_FOLLOWER_LIST_UPDATE', 'GARRISON_FOLLOWER_XP_CHANGED', @@ -26,47 +26,132 @@ self:GetPlayerData() end -function c:OnUpdate() end - function c:GetPlayerData() - print('|cFF0088FF'..self:GetName()..':GetPlayerData()|r') - local profileList = self:GetParent().profile.followers - local troopList = self:GetParent().profile.troops + print('|cFF0088FF'..self:GetName()..':GetPlayerData()|r', self.followerType, time()) + local profile = self:GetParent().profile local followerInfo = C_Garrison.GetFollowers(self.followerType) + if followerInfo then - table.wipe(profileList) + table.wipe(profile.followers) + table.wipe(profile.troops) for followerID, follower in pairs(followerInfo) do print(FOLLOWER_QUALITY_COLORS[follower.quality].hex, follower.name, follower.isTroop) if follower.isTroop then - troopList[followerID] = follower + print('added troop') + profile.troops[followerID] = follower else print(follower.isMaxLevel, follower.xp, follower.levelXP, follower.iLevel) - profileList[followerID] = follower + profile.followers[followerID] = follower end - profileList[followerID] = follower + --profileList[followerID] = follower end end + return true end -function c:UpdateItems() +function c:UpdateTroops (followers, baseIndex) + baseIndex = baseIndex or 1 + for followerID, follower in pairs(followers) do + --local frame = self. + end + + + return baseIndex +end + +function c:OnUpdateRequested () + print('OnUpdateRequested()') +end + +function c:OnItemsUpdated() + print('OnItemsUpdated()') + return nil +end + +function c:RefreshData() + + print('|cFF0088FF'..self:GetName()..':RefreshData()') + local activeKey = self.activeKey + self.truncatedItems = 0 + self.currentTime = time() + if self:GetParent().profile then + self:GetPlayerData() + end + local profile = self.profile + for _, listKey in ipairs(self.listKey) do + local sortedItems = self.sortedItems[listKey] + wipe(sortedItems) + local isMine = (profile == self.profile) + print(listKey, isMine, profile.showItems) + local profileList = self.profile[listKey] + if profileList and #profileList >= 1 then + local classColor = profile.classColor or RAID_CLASS_COLORS['HUNTER'] + if profile.showItems then + for index, data in ipairs(profileList) do + data.classColor = classColor + data.profileKey = ClassOrderPlan.profileName + data.isMine = isMine + if self.OnGetItem then + self:OnGetItem(data) + end + tinsert(sortedItems, data) + end + else + self.truncatedItems = self.truncatedItems + 1 + end + end + + if self.SortHandler then + sort(sortedItems, self.SortHandler) + end + end + + for k,v in pairs(self.sortedItems) do + print(' ', k) + end + + self.isStale = true +end + +--[[ +-- function c:UpdateItems() local profileList = self:GetParent().profile.followers local troopList = self:GetParent().profile.troops - + print('UpdateItems() ') + end +--]] function c:Reanchor() + self:SetPoint('TOPLEFT', ClassOrderPlan.BackgroundInset, 'BOTTOMLEFT') + self:SetPoint('RIGHT', ClassOrderPlan.BackgroundInset, 'RIGHT') end +local f = {} +function f:Update() + self.Icon:SetTexture() +end +function f:OnLoad() + self.Owner = self.Overlay.Owner -ClassPlanFollowerMixin = CreateFromMixins(ClassPlanHandlerBase, c) \ No newline at end of file + self.Count = self.Overlay.Count + self.Name = self.Overlay.Name +end + +function f.SortHandler (a, b) + return true +end + +ClassPlanFollowersHandler = CreateFromMixins(ClassPlanHandlerBase, c) +ClassPlanFollowerEntryMixin = CreateFromMixins(ClassPlanEntryBase, f) \ No newline at end of file diff -r bf4a36378bb9 -r a4dfdd4f1cf3 ClassPlanFollowers.xml --- a/ClassPlanFollowers.xml Fri Nov 24 23:51:44 2017 -0500 +++ b/ClassPlanFollowers.xml Fri Dec 15 16:38:09 2017 -0500 @@ -1,11 +1,40 @@