Nenue@40: Nenue@117: local print = DEVIAN_WORKSPACE and function(...) print('ClassPlanF', ...) end or nop Nenue@40: local c = { Nenue@40: Nenue@117: templateName = 'ClassPlanFollowerEntry', Nenue@95: listKey = {'followers','troops'}, Nenue@117: listTitle = {'Followers', 'Troops'}, Nenue@40: events = { Nenue@40: 'GARRISON_FOLLOWER_LIST_UPDATE', Nenue@40: 'GARRISON_FOLLOWER_XP_CHANGED', Nenue@40: 'GARRISON_FOLLOWER_DURABILITY_CHANGED', Nenue@40: 'GARRISON_FOLLOWER_UPGRADED', Nenue@40: 'GARRISON_FOLLOWER_REMOVED' Nenue@40: } Nenue@40: } Nenue@40: Nenue@40: Nenue@40: function c:OnLoad() Nenue@95: print('Followers:OnLoad()') Nenue@40: self.followerType = 4 Nenue@40: -- follower type, versus garrison_type Nenue@40: end Nenue@40: Nenue@40: function c:OnEvent(event, ...) Nenue@40: print('|cFF00FF00'..self:GetName()..':OnEvent()|r', event, ...) Nenue@40: self:GetPlayerData() Nenue@40: end Nenue@40: Nenue@40: function c:GetPlayerData() Nenue@40: Nenue@117: print('|cFF0088FF'..self:GetName()..':GetPlayerData()|r', self.followerType, time()) Nenue@117: local profile = self:GetParent().profile Nenue@95: Nenue@40: local followerInfo = C_Garrison.GetFollowers(self.followerType) Nenue@95: Nenue@95: Nenue@117: Nenue@40: if followerInfo then Nenue@117: table.wipe(profile.followers) Nenue@117: table.wipe(profile.troops) Nenue@40: for followerID, follower in pairs(followerInfo) do Nenue@95: print(FOLLOWER_QUALITY_COLORS[follower.quality].hex, follower.name, follower.isTroop) Nenue@95: if follower.isTroop then Nenue@117: print('added troop') Nenue@117: profile.troops[followerID] = follower Nenue@95: else Nenue@95: print(follower.isMaxLevel, follower.xp, follower.levelXP, follower.iLevel) Nenue@95: Nenue@117: profile.followers[followerID] = follower Nenue@95: end Nenue@95: Nenue@95: Nenue@117: --profileList[followerID] = follower Nenue@40: end Nenue@40: end Nenue@33: Nenue@117: return true Nenue@33: end Nenue@33: Nenue@117: function c:UpdateTroops (followers, baseIndex) Nenue@117: baseIndex = baseIndex or 1 Nenue@117: for followerID, follower in pairs(followers) do Nenue@117: --local frame = self. Nenue@117: end Nenue@117: Nenue@117: Nenue@117: return baseIndex Nenue@117: end Nenue@117: Nenue@117: function c:OnUpdateRequested () Nenue@117: print('OnUpdateRequested()') Nenue@117: end Nenue@117: Nenue@117: function c:OnItemsUpdated() Nenue@117: print('OnItemsUpdated()') Nenue@117: return nil Nenue@117: end Nenue@117: Nenue@117: function c:RefreshData() Nenue@117: Nenue@117: print('|cFF0088FF'..self:GetName()..':RefreshData()') Nenue@117: local activeKey = self.activeKey Nenue@117: self.truncatedItems = 0 Nenue@117: self.currentTime = time() Nenue@117: if self:GetParent().profile then Nenue@117: self:GetPlayerData() Nenue@117: end Nenue@117: local profile = self.profile Nenue@117: for _, listKey in ipairs(self.listKey) do Nenue@117: local sortedItems = self.sortedItems[listKey] Nenue@117: wipe(sortedItems) Nenue@117: local isMine = (profile == self.profile) Nenue@117: print(listKey, isMine, profile.showItems) Nenue@117: local profileList = self.profile[listKey] Nenue@117: if profileList and #profileList >= 1 then Nenue@117: local classColor = profile.classColor or RAID_CLASS_COLORS['HUNTER'] Nenue@117: if profile.showItems then Nenue@117: for index, data in ipairs(profileList) do Nenue@117: data.classColor = classColor Nenue@117: data.profileKey = ClassOrderPlan.profileName Nenue@117: data.isMine = isMine Nenue@117: if self.OnGetItem then Nenue@117: self:OnGetItem(data) Nenue@117: end Nenue@117: tinsert(sortedItems, data) Nenue@117: end Nenue@117: else Nenue@117: self.truncatedItems = self.truncatedItems + 1 Nenue@117: end Nenue@117: end Nenue@117: Nenue@117: if self.SortHandler then Nenue@117: sort(sortedItems, self.SortHandler) Nenue@117: end Nenue@117: end Nenue@117: Nenue@117: for k,v in pairs(self.sortedItems) do Nenue@117: print(' ', k) Nenue@117: end Nenue@117: Nenue@117: self.isStale = true Nenue@117: end Nenue@117: Nenue@117: --[[ Nenue@117: -- function c:UpdateItems() Nenue@95: Nenue@95: local profileList = self:GetParent().profile.followers Nenue@95: Nenue@95: local troopList = self:GetParent().profile.troops Nenue@95: Nenue@117: print('UpdateItems() ') Nenue@117: Nenue@95: Nenue@40: end Nenue@117: --]] Nenue@40: function c:Reanchor() Nenue@117: self:SetPoint('TOPLEFT', ClassOrderPlan.BackgroundInset, 'BOTTOMLEFT') Nenue@117: self:SetPoint('RIGHT', ClassOrderPlan.BackgroundInset, 'RIGHT') Nenue@40: end Nenue@33: Nenue@117: local f = {} Nenue@117: function f:Update() Nenue@117: self.Icon:SetTexture() Nenue@117: end Nenue@117: function f:OnLoad() Nenue@117: self.Owner = self.Overlay.Owner Nenue@33: Nenue@117: self.Count = self.Overlay.Count Nenue@117: self.Name = self.Overlay.Name Nenue@117: end Nenue@117: Nenue@117: function f.SortHandler (a, b) Nenue@117: return true Nenue@117: end Nenue@117: Nenue@117: ClassPlanFollowersHandler = CreateFromMixins(ClassPlanHandlerBase, c) Nenue@117: ClassPlanFollowerEntryMixin = CreateFromMixins(ClassPlanEntryBase, f)