Mercurial > wow > worldplan
comparison ClassPlanMissions.lua @ 35:26dfa661daa7
WorldPlan:
- Quest pins will appear in the flight map. They follow the filter settings applied from the world map.
- Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it.
- Fixed filter bar info falling out of sync after player-triggered world map updates.
- Code stuff:
-- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there
-- WorldQuests module re-factored outside of the top level frame script.
ClassPlan:
- Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author | Nenue |
---|---|
date | Thu, 03 Nov 2016 17:29:15 -0400 |
parents | |
children | 589c444d4837 |
comparison
equal
deleted
inserted
replaced
34:0100d923d8c3 | 35:26dfa661daa7 |
---|---|
1 local MissionList = ClassPlanMissionHandler | |
2 local ListEntry = ClassPlanMissionEntryMixin | |
3 local ORDERHALL_TYPE = LE_GARRISON_TYPE_7_0 | |
4 function ClassPlanMissionHandler:Reanchor() | |
5 self:SetPoint('TOPRIGHT', 0, -24) | |
6 self:SetPoint('BOTTOMLEFT', ClassOrderPlan:GetWidth()/2, 0) | |
7 | |
8 end | |
9 local GetPrimaryGarrisonFollowerType = GetPrimaryGarrisonFollowerType | |
10 local C_Garrison = C_Garrison | |
11 | |
12 local wipe, tinsert, date, ipairs = table.wipe, table.insert, date, ipairs | |
13 local GetItemIcon = GetItemIcon | |
14 local print = DEVIAN_WORKSPACE and function(...) print('ClassPlan', ...) end or nop | |
15 | |
16 function ClassPlanMissionHandler:GetPlayerData (profile) | |
17 local items = C_Garrison.GetAvailableMissions(GetPrimaryGarrisonFollowerType(ORDERHALL_TYPE)); | |
18 if not items then | |
19 return | |
20 end | |
21 wipe(profile.missions) | |
22 wipe(profile.available) | |
23 | |
24 | |
25 for i = 1, #items do | |
26 if (not items[i].isBuilding and items[i].isZoneSupport) then | |
27 else | |
28 | |
29 tinsert(profile.available, items[i]) | |
30 end | |
31 end | |
32 | |
33 local items = C_Garrison.GetLandingPageItems(ORDERHALL_TYPE) | |
34 for index, data in ipairs(items) do | |
35 print(' -',data.name, '|cFF00FF00'.. data.timeLeft .. '|r', date("%A %I:%m %p", data.missionEndTime)) | |
36 tinsert(profile.missions, data) | |
37 end | |
38 return true | |
39 end | |
40 | |
41 function ClassPlanMissionHandler:OnGetItem (data) | |
42 if data.missionEndTime and (data.missionEndTime < self.currentTime) then | |
43 data.isComplete = true | |
44 end | |
45 if data.offerEndTime and (data.offerEndTime < self.currentTime) then | |
46 data.isExpired = true | |
47 data.timeToKeep = self.currentTime + 300 | |
48 end | |
49 end | |
50 | |
51 MissionList.SortHandler = function (a,b) | |
52 local result = false | |
53 --if not a or not b then | |
54 -- return true | |
55 --else | |
56 --if (a.isMine ~= b.isMine) then | |
57 -- result = a.isMine | |
58 --else | |
59 --if (not b.missionEndTime) or (not a.missionEndTime) then | |
60 -- print('missing article', b.missionEndTime, a.missionEndTime) | |
61 --end | |
62 if b.isComplete ~= a.isComplete then | |
63 return a.isComplete | |
64 elseif b.isMine ~= a.isMine then | |
65 return a.isMine | |
66 elseif b.missionEndTime then | |
67 return ( b.missionEndTime > a.missionEndTime) | |
68 else | |
69 return ((b.offerEndTime or 0) > (a.offerEndTime or 0)) | |
70 end | |
71 | |
72 --end | |
73 --end | |
74 end | |
75 | |
76 | |
77 function MissionList:OnShow() | |
78 print('|cFF00FF88'..self:GetName()..':OnShow()|r') | |
79 end | |
80 | |
81 | |
82 | |
83 function ClassPlanMissionEntryMixin:OnComplete() | |
84 print('flagging complete', self.name) | |
85 self:Update() | |
86 end | |
87 | |
88 function ClassPlanMissionEntryMixin:OnUpdate(sinceLast) | |
89 self.throttle = (self.throttle or .5) + sinceLast | |
90 if self.throttle < .5 then | |
91 return | |
92 else | |
93 self.throttle = self.throttle - .5 | |
94 end | |
95 if self.offerEndTime then | |
96 self:SetTimeLeft(self.offerEndTime) | |
97 elseif self.missionEndTime then | |
98 self:SetTimeLeft(self.missionEndTime, self.durationSeconds) | |
99 end | |
100 end | |
101 | |
102 function ClassPlanMissionEntryMixin:OnLoad() | |
103 print('|cFFFF4400',self:GetName() or tostring(self), 'onload') | |
104 self.Count = self.Overlay.Count | |
105 self.Name = self.Overlay.Name | |
106 self.TimeLeft = self.Overlay.TimeLeft | |
107 self.Owner = self.Overlay.Owner | |
108 self.maxDisplayed = 10 | |
109 | |
110 self.Icon:SetDesaturated(false) | |
111 self.Done:Hide() | |
112 end | |
113 | |
114 function ClassPlanMissionEntryMixin:Update() | |
115 local r,g,b = 1, 1, 1 | |
116 if self.isRare then | |
117 r,g,b = 0.1, 0.4, 1 | |
118 self.IconBorder:SetVertexColor(r, g, b, 1) | |
119 end | |
120 | |
121 --self.missionData = data | |
122 self.Name:SetText(self.name) | |
123 if #self.rewards >= 1 then | |
124 self.Icon:SetTexture(self.rewards[1].icon or GetItemIcon(self.rewards[1].itemID)) | |
125 self.rewardInfo = self.rewards[1] | |
126 else | |
127 self.Icon:SetAtlas(self.typeAtlas, false) | |
128 end | |
129 | |
130 | |
131 | |
132 if self.isComplete then | |
133 self.TimeLeft:SetText('Complete!') | |
134 self.Background:SetColorTexture(.25,.25,.25,1) | |
135 else | |
136 self.Background:SetColorTexture(0,0,0,0.5) | |
137 end | |
138 end | |
139 | |
140 function ListEntry:OnEnter() | |
141 if self.rewardInfo and self.rewardInfo.itemID then | |
142 GameTooltip:SetOwner(self, 'ANCHOR_LEFT') | |
143 GameTooltip:SetItemByID(self.rewardInfo.itemID) | |
144 GameTooltip:Show() | |
145 end | |
146 end | |
147 | |
148 function ListEntry:OnLeave() | |
149 if GameTooltip:IsOwned(self) then | |
150 GameTooltip:Hide() | |
151 end | |
152 end |