diff ClassPlanFollowers.lua @ 40:589c444d4837

WowAce/Curseforge migration push
author Nenue
date Sun, 25 Dec 2016 13:04:57 -0500
parents 26dfa661daa7
children b29b35cb8539
line wrap: on
line diff
--- a/ClassPlanFollowers.lua	Fri Nov 04 02:54:32 2016 -0400
+++ b/ClassPlanFollowers.lua	Sun Dec 25 13:04:57 2016 -0500
@@ -1,11 +1,50 @@
-ClassPlanFollowerMixin = {}
-local c = ClassPlanFollowerMixin
-function c:OnEvent(event, arg)
+
+local print = DEVIAN_WORKSPACE and function(...) print('ClassPlan', ...) end or nop
+local c  = {
+
+  templateName = 'ClassPlanShipmentEntry',
+  listKey = {'followers'},
+  listTitle = {'Followers'},
+  events = {
+    'GARRISON_FOLLOWER_LIST_UPDATE',
+    'GARRISON_FOLLOWER_XP_CHANGED',
+    'GARRISON_FOLLOWER_DURABILITY_CHANGED',
+    'GARRISON_FOLLOWER_UPGRADED',
+    'GARRISON_FOLLOWER_REMOVED'
+  }
+}
+
+
+function c:OnLoad()
+  self.followerType = 4
+  -- follower type, versus garrison_type
+end
+
+function c:OnEvent(event, ...)
+  print('|cFF00FF00'..self:GetName()..':OnEvent()|r', event, ...)
+  self:GetPlayerData()
+end
+
+function c:OnUpdate() end
+
+function c:GetPlayerData()
+
+  print('|cFF0088FF'..self:GetName()..':GetPlayerData()|r')
+  local profileList = self:GetParent().profile.followers
+  local followerInfo = C_Garrison.GetFollowers(self.followerType)
+  if followerInfo then
+    table.wipe(profileList)
+    for followerID, follower in pairs(followerInfo) do
+      profileList[followerID] = follower
+    end
+  end
 
 end
 
-function c:GetPlayerData(event, arg) end
+function c:UpdateItems()
+end
+function c:Reanchor()
+end
 
-function c:UpdateItems() end
 
-function c:Reanchor() end
\ No newline at end of file
+ClassPlanFollowerMixin = CreateFromMixins(ClassPlanHandlerBase, c)
\ No newline at end of file