# HG changeset patch
# User Nenue
# Date 1476351163 14400
# Node ID 232617b8bcd5273eca39496c9ce0e629946b3745
# Parent 3830a592cb0fbc020c9f616d27a823dc32feb719
New Order Hall mission tracker:
- record active missions and shipments across characters
diff -r 3830a592cb0f -r 232617b8bcd5 ClassPlan.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ClassPlan.lua Thu Oct 13 05:32:43 2016 -0400
@@ -0,0 +1,213 @@
+SLASH_CLASSPLAN1 = "/classplan"
+SLASH_CLASSPLAN2 = "/cp"
+SlashCmdList.CLASSPLAN = function(args)
+ if ClassOrderPlan:IsVisible() then
+ ClassOrderPlan:Hide()
+ else
+ ClassOrderPlan:Show()
+ DEFAULT_CHAT_FRAME:AddMessage('|cFF88FF00WorldPlan|r: Order Hall Panel')
+ end
+end
+
+ClassOrderPlanCore = {
+ blocks = {},
+ playerFirst = true,
+ timers = {}
+}
+ClassPlanBlockMixin = {
+ followers = {},
+ blocks = {},
+}
+local core, block = ClassOrderPlanCore, ClassPlanBlockMixin
+local print = DEVIAN_WORKSPACE and function(...) print('ClassPlan', ...) end or nop
+
+function core:OnLoad ()
+ self:RegisterUnitEvent('UNIT_PORTRAIT_UPDATE', 'player')
+ self:RegisterEvent('GARRISON_MISSION_STARTED')
+ self:RegisterEvent('GARRISON_MISSION_FINISHED')
+ self:RegisterEvent('PLAYER_LOGIN')
+ self:RegisterEvent('PLAYER_ENTERING_WORLD')
+end
+
+
+function core:OnEvent (event, ...)
+ if event == 'UNIT_PORTRAIT_UPDATE' then
+ SetPortraitTexture(self.portrait, 'player')
+ elseif event == 'PLAYER_LOGIN' then
+ if not self.initialized then
+ if IsLoggedIn() then
+ WorldPlanData.OrderHall = WorldPlanData.OrderHall or {}
+ self.data = WorldPlanData.OrderHall
+
+
+ local name, realm = UnitName('player')
+ realm = realm or GetRealmName()
+ self.profileKey = name .. '-' .. realm
+ if not self.data[self.profileKey] then
+ self.data[self.profileKey] = {}
+ end
+ self.profile = self.data[self.profileKey]
+
+ self.initialized = true
+ print('initialized')
+ end
+ end
+ else
+ self:Refresh ()
+ end
+end
+
+function core:UpdateList()
+ self.sortedMissions = self.sortedMissions or {}
+ table.wipe(self.sortedMissions)
+
+ for name, profile in pairs(self.data) do
+ local isMine = (profile == self.profile)
+ for index, data in pairs(profile.missions) do
+
+ data.classColor = profile.classColor or {r = 0.7, g = 0.7, b =0.7}
+
+ data.profileKey = name
+ data.isMine = (profile == self.profile)
+ tinsert(self.sortedMissions, data)
+ end
+ end
+
+ for i, v in ipairs(self.sortedMissions) do
+ print(i, v.missionEndTime, v.name)
+ end
+
+
+ table.sort(self.sortedMissions, function(a,b)
+ local result = false
+ if not a or not b then
+ result = true
+ else
+
+ if (a.isMine ~= b.isMine) and self.playerFirst then
+ result = a.isMine
+ else
+ if (not b.missionEndTime) or (not a.missionEndTime) then
+ print('missing article', b.missionEndTime, a.missionEndTime)
+ end
+
+ result = ( b.missionEndTime > a.missionEndTime)
+ end
+ end
+
+ print('cmp', (b and (b.missionEndTime .. ' ' .. tostring(b.isMine)) or '-'), '>', (a and (a.missionEndTime .. ' ' .. tostring(a.isMine)) or '-'), result, n)
+ return result
+ end)
+ self.isStale = nil
+
+ local lastProfile
+ local numItems = #self.sortedMissions
+ for i, data in ipairs(self.sortedMissions) do
+ local block = self.blocks[i]
+ if not block then
+ block = CreateFrame('Frame', nil, self, 'ClassPlanBlock')
+ block:SetID(i)
+ self.numBlocks = (self.numBlocks or 0) + 1
+
+ if self.lastBlock then
+ block:SetPoint('TOPLEFT', self.lastBlock, 'BOTTOMLEFT', 0, 0)
+ else
+ block:SetPoint('TOPLEFT', self.portrait, 'TOPRIGHT', 0, 0)
+ end
+ self.lastBlock = block
+ self.blocks[i] = block
+ end
+
+ local r,g,b = 1, 1, 1
+ if data.isRare then
+ r,g,b = 0.1, 0.4, 1
+ end
+ if data.isMine then
+ block.Icon:SetVertexColor(0,1,0,1)
+ else
+ block.Icon:SetVertexColor(1,1,1)
+ end
+
+
+ --block.missionData = data
+ block.missionID = data.missionID
+ block.missionEndTime = data.missionEndTime
+ block.Icon:SetAtlas(data.typeAtlas, false)
+ block.Label:SetText(data.name)
+ block.Label:SetTextColor(r, g, b)
+
+ if lastProfile ~= data.profileKey then
+ block.Owner:SetText(data.profileKey)
+ block.Owner:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b)
+ else
+ block.Owner:SetText(nil)
+ end
+ block.Background:SetColorTexture(data.classColor.r, data.classColor.g, data.classColor.b, 0.5)
+
+ block:Show()
+ lastProfile = data.profileKey
+ end
+ for i = numItems + 1, self.numBlocks do
+ if self.blocks[i] then
+ self.blocks[i]:Hide()
+ end
+ end
+end
+
+function core:OnShow()
+ if self.isStale then
+ print('updating items on show')
+ self:UpdateList()
+ end
+end
+
+function core:Refresh ()
+ if not self.profile then
+ return
+ end
+
+ self.items = C_Garrison.GetLandingPageItems(LE_GARRISON_TYPE_7_0)
+
+ self.profile.missions = self.profile.missions or {}
+
+ self.profile.classColor = RAID_CLASS_COLORS[select(2, UnitClass('player'))]
+
+
+ print('|cFF0088FFLocal Scoop|r:', self.profileKey)
+ if #self.items >= 1 then
+ table.wipe(self.profile.missions)
+ for index, data in ipairs(self.items) do
+ print('', data.name)
+ print(' |cFF00FF00', data.timeLeft .. '|r', date("%A %I:%m %p", data.missionEndTime))
+ tinsert(self.profile.missions, data)
+ end
+ end
+
+ if self:IsVisible() then
+ self:UpdateList()
+ else
+ print('items update pending')
+ self.isStale = true
+ end
+end
+
+function block:OnUpdate()
+ if self.missionEndTime then
+ local timeLeft = self.missionEndTime - time()
+ if timeLeft < 0 then
+ self.TimeLeft:SetText('Complete!')
+ else
+ local days = floor(timeLeft/(24*3600))
+ local hours = floor(mod(timeLeft, (24*3600)) / 3600)
+ local minutes = floor(mod(timeLeft, 3600) / 60)
+ local seconds = mod(timeLeft, 60)
+ self.TimeLeft:SetText(
+ ((days > 0) and (days .. ' d') or '') ..
+ ((hours > 0) and (' '.. hours .. ' hr') or '')..
+ ((minutes > 0) and (' ' .. minutes .. ' min' or ''))
+ , 1,1,1)
+ end
+ else
+ self.TimeLeft:SetText(self.missionEndTime)
+ end
+end
\ No newline at end of file
diff -r 3830a592cb0f -r 232617b8bcd5 ClassPlan.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ClassPlan.xml Thu Oct 13 05:32:43 2016 -0400
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 3830a592cb0f -r 232617b8bcd5 WorldPlan.lua
--- a/WorldPlan.lua Tue Oct 11 17:20:37 2016 -0400
+++ b/WorldPlan.lua Thu Oct 13 05:32:43 2016 -0400
@@ -204,7 +204,8 @@
local QuestsByID = {}
local QuestPositions = {}
local FilterInclusions = {rewardType = {}, worldQuestType = {}}
-local FilterExclusions = {rewardType = {}, worldQuestType = {}}
+local FilterExclusions = {rewardType = {}, worldQuestType = {} }
+local NotificationTypes = {}
local ZoneInfo = {}
local SummaryHeaders = {}
@@ -799,11 +800,16 @@
pin.FadeIn:Play()
end)
if not notifyPlayed then
- notifyPlayed = true
- PlaySoundKitID(23404)
+ for k,v in pairs(NotificationTypes) do
+ if v[pin[k]] then
+ notifyPlayed = true
+ PlaySoundKitID(23404)
+ end
+ end
end
tinsert(debug_animate,questID)
end
+ -- trap new but animating pins here
else
-- hard show existing pin
pin:Show()
@@ -831,6 +837,7 @@
print(' adding:', table.concat(debug_animate, ',' ))
print(' showing:', table.concat(debug_show, ',' ))
hasNewQuestPins = nil
+ notifyPlayed = nil
end
-- data provider manipulations for the taxi map
diff -r 3830a592cb0f -r 232617b8bcd5 WorldPlan.toc
--- a/WorldPlan.toc Tue Oct 11 17:20:37 2016 -0400
+++ b/WorldPlan.toc Thu Oct 13 05:32:43 2016 -0400
@@ -9,4 +9,5 @@
## LoadOnDemand: 0
## Dependencies: Veneer
-WorldPlan.xml
\ No newline at end of file
+WorldPlan.xml
+ClassPlan.xml
\ No newline at end of file
diff -r 3830a592cb0f -r 232617b8bcd5 WorldPlan.xml
--- a/WorldPlan.xml Tue Oct 11 17:20:37 2016 -0400
+++ b/WorldPlan.xml Thu Oct 13 05:32:43 2016 -0400
@@ -3,8 +3,8 @@
-
-
+
+
@@ -90,12 +90,12 @@
-
+
-
+