Mercurial > wow > worldplan
comparison ClassPlan.lua @ 8:802abb8a10ea
Fixed loss of mission progress data while changing zones by using `GARRISON_LANDINGPAGE_SHIPMENTS' as the trigger point for mission scoops.
* `MISSION_LIST_UPDATE' fires before all data is available, and if this is happens on a loading screen, then several landing page items may get snipped.
| author | Nenue |
|---|---|
| date | Sun, 23 Oct 2016 07:19:53 -0400 |
| parents | 48001b6a9496 |
| children | a2b623043970 |
comparison
equal
deleted
inserted
replaced
| 7:34d9fbf7af20 | 8:802abb8a10ea |
|---|---|
| 26 playerFirst = false, | 26 playerFirst = false, |
| 27 prototypes = {} | 27 prototypes = {} |
| 28 } | 28 } |
| 29 ClassPlanMissionMixin = { | 29 ClassPlanMissionMixin = { |
| 30 templateName = 'ClassPlanMissionEntry', | 30 templateName = 'ClassPlanMissionEntry', |
| 31 events = {'GARRISON_MISSION_LIST_UPDATE', 'GARRISON_MISSION_STARTED', 'GARRISON_MISSION_FINISHED'},} | 31 events = {'GARRISON_MISSION_LIST_UPDATE', 'GARRISON_MISSION_STARTED', 'GARRISON_MISSION_FINISHED', 'GARRISON_LANDINGPAGE_SHIPMENTS'},} |
| 32 ClassPlanShipmentMixin = { | 32 ClassPlanShipmentMixin = { |
| 33 templateName = 'ClassPlanShipmentEntry', | 33 templateName = 'ClassPlanShipmentEntry', |
| 34 parent = false, | 34 parent = false, |
| 35 point = 'TOPRIGHT', | 35 point = 'TOPRIGHT', |
| 36 relativePoint ='TOPRIGHT', | 36 relativePoint ='TOPRIGHT', |
| 54 | 54 |
| 55 MissionsHandler.GetPlayerData = function(self) | 55 MissionsHandler.GetPlayerData = function(self) |
| 56 if not self.profile then | 56 if not self.profile then |
| 57 return | 57 return |
| 58 end | 58 end |
| 59 self.items = C_Garrison.GetLandingPageItems(LE_GARRISON_TYPE_7_0) | 59 local items = C_Garrison.GetLandingPageItems(LE_GARRISON_TYPE_7_0) |
| 60 print(#items) | |
| 60 | 61 |
| 61 wipe(self.profile.missions) | 62 wipe(self.profile.missions) |
| 62 for index, data in ipairs(self.items) do | 63 for index, data in ipairs(items) do |
| 63 print(' ',data.name, '|cFF00FF00'.. data.timeLeft .. '|r', date("%A %I:%m %p", data.missionEndTime)) | 64 print(' ',data.name, '|cFF00FF00'.. data.timeLeft .. '|r', date("%A %I:%m %p", data.missionEndTime)) |
| 64 tinsert(self.profile.missions, data) | 65 tinsert(self.profile.missions, data) |
| 65 end | 66 end |
| 66 print('items update pending') | 67 print('items update pending') |
| 67 self.isStale = true | 68 self.isStale = true |
| 68 | |
| 69 if self:IsVisible() then | |
| 70 self:Refresh() | |
| 71 end | |
| 72 end | 69 end |
| 73 | 70 |
| 74 MissionsHandler.OnGetItem = function(data) | 71 MissionsHandler.OnGetItem = function(data) |
| 75 if data.missionEndTime < GI_currentTime then | 72 if data.missionEndTime < GI_currentTime then |
| 76 data.isComplete = true | 73 data.isComplete = true |
| 129 local AddShipmentInfo = function(shipmentType, name, texture, shipmentCapacity, shipmentsReady, shipmentsTotal, creationTime, duration, timeleftString, itemName, itemIcon, itemQuality, itemID, followerID) | 126 local AddShipmentInfo = function(shipmentType, name, texture, shipmentCapacity, shipmentsReady, shipmentsTotal, creationTime, duration, timeleftString, itemName, itemIcon, itemQuality, itemID, followerID) |
| 130 -- early login queries may return empty tables, causing the sorter to compare nil | 127 -- early login queries may return empty tables, causing the sorter to compare nil |
| 131 if not creationTime then | 128 if not creationTime then |
| 132 return | 129 return |
| 133 end | 130 end |
| 134 print(shipmentType, name, shipmentCapacity, shipmentsReady, shipmentsTotal, creationTime, duration, timeleftString) | 131 --print(shipmentType, name, shipmentCapacity, shipmentsReady, shipmentsTotal, creationTime, duration, timeleftString) |
| 135 tinsert(ShipmentsInfo, | 132 tinsert(ShipmentsInfo, |
| 136 { | 133 { |
| 137 shipmentType = shipmentType, | 134 shipmentType = shipmentType, |
| 138 name = name, | 135 name = name, |
| 139 icon = texture, | 136 icon = texture, |
| 201 --DEFAULT_CHAT_FRAME:AddMessage(data.shipmentType ..' '.. tostring(data.name) ..' '.. tostring(data.creationTime) ..' '.. tostring(data.duration)) | 198 --DEFAULT_CHAT_FRAME:AddMessage(data.shipmentType ..' '.. tostring(data.name) ..' '.. tostring(data.creationTime) ..' '.. tostring(data.duration)) |
| 202 tinsert(self.profile.shipments, data) | 199 tinsert(self.profile.shipments, data) |
| 203 end | 200 end |
| 204 self.isStale = true | 201 self.isStale = true |
| 205 | 202 |
| 206 if self:IsVisible() then | |
| 207 self:Refresh() | |
| 208 end | |
| 209 end | 203 end |
| 210 | 204 |
| 211 function core:OnLoad () | 205 function core:OnLoad () |
| 212 self:RegisterEvent('PLAYER_LOGIN') | 206 self:RegisterEvent('PLAYER_LOGIN') |
| 213 self:RegisterEvent('PLAYER_ENTERING_WORLD') | |
| 214 self:RegisterEvent('ADDON_LOADED') | 207 self:RegisterEvent('ADDON_LOADED') |
| 215 self:RegisterEvent('PLAYER_REGEN_ENABLED') | 208 self:RegisterEvent('PLAYER_REGEN_ENABLED') |
| 216 self:RegisterEvent('PLAYER_REGEN_DISABLED') | 209 self:RegisterEvent('PLAYER_REGEN_DISABLED') |
| 217 -- Blizzard_GarrisonUI already fires a shipment data request for GARRISON_SHIPMENT_RECEIVED; this is unlikely to | 210 -- Blizzard_GarrisonUI already fires a shipment data request for GARRISON_SHIPMENT_RECEIVED; this is unlikely to |
| 218 | 211 |
| 340 local numCalls = 0 | 333 local numCalls = 0 |
| 341 for ptype, eventFunc in pairs(self.events[event]) do | 334 for ptype, eventFunc in pairs(self.events[event]) do |
| 342 numCalls = numCalls + 1 | 335 numCalls = numCalls + 1 |
| 343 print('|cFF88FF00' .. tostring(ptype) .. '|r:GetPlayerData() --', numCalls) | 336 print('|cFF88FF00' .. tostring(ptype) .. '|r:GetPlayerData() --', numCalls) |
| 344 eventFunc(self, event) | 337 eventFunc(self, event) |
| 338 end | |
| 339 | |
| 340 | |
| 341 if self:IsVisible() then | |
| 342 self:Refresh() | |
| 345 end | 343 end |
| 346 end | 344 end |
| 347 end | 345 end |
| 348 | 346 |
| 349 function core:UpdateNotifications() | 347 function core:UpdateNotifications() |
