Mercurial > wow > worldplan
comparison WorldQuests.lua @ 36:21bcff08b0f4
WorldPlan:
- Quest pins are now placed on the flight map. Their visibility rules will mirror the filter options from the world map.
- Filter controls polish:
- First click negates other reward type filters. Subsequent clicks will then toggle individual reward types until the filters are reset via Right-click.
- Adheres to the Blizzard CVars added in patch 7.1
- Numerous optimizations to how data and visual updates are handled; should see an even better load time, and snappier world map interaction.
ClassPlan:
- The 'Available Missions' list is now recorded. It can be reviewed by clicking on the mission list heading.
- Information filtering by character and realm.
author | Nenue |
---|---|
date | Fri, 04 Nov 2016 01:40:39 -0400 |
parents | 26dfa661daa7 |
children | 78cf1f19856a |
comparison
equal
deleted
inserted
replaced
35:26dfa661daa7 | 36:21bcff08b0f4 |
---|---|
1 -- WorldPlan | 1 -- WorldPlan |
2 -- WorldQuests.lua | 2 -- WorldQuests.lua |
3 -- Created: 11/2/2016 3:40 PM | 3 -- Created: 11/2/2016 3:40 PM |
4 -- %file-revision% | 4 -- %file-revision% |
5 | 5 |
6 WorldPlanDataProvider = {} | |
7 WorldPlanDataPinMixin = {} | |
8 WorldPlanQuestsMixin = { | |
9 QuestsByZone = {}, | |
10 QuestsByID = {}, | |
11 freePins = {}, | |
12 } | |
13 local WorldQuests = WorldPlanQuestsMixin | 6 local WorldQuests = WorldPlanQuestsMixin |
14 | 7 |
15 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo | 8 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo |
16 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented | 9 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented |
17 local TQ_GetQuestZoneID = C_TaskQuest.GetQuestZoneID | 10 local TQ_GetQuestZoneID = C_TaskQuest.GetQuestZoneID |
82 local rgbWhite = {1, 1, 1} | 75 local rgbWhite = {1, 1, 1} |
83 WorldPlan:AddTypeInfo(self, REWARD_REAGENT, { r = 0, g = 1, b = 1 }) | 76 WorldPlan:AddTypeInfo(self, REWARD_REAGENT, { r = 0, g = 1, b = 1 }) |
84 WorldPlan:AddTypeInfo(self, REWARD_ARTIFACT_POWER, { r = 1, g = .25, b = .5, hasNumeric = true, numberRGB = rgbWhite }) | 77 WorldPlan:AddTypeInfo(self, REWARD_ARTIFACT_POWER, { r = 1, g = .25, b = .5, hasNumeric = true, numberRGB = rgbWhite }) |
85 WorldPlan:AddTypeInfo(self, REWARD_GEAR, { r = .1, g = .2, b = 1 }) | 78 WorldPlan:AddTypeInfo(self, REWARD_GEAR, { r = .1, g = .2, b = 1 }) |
86 WorldPlan:AddTypeInfo(self, REWARD_CURRENCY, { r = 1, g = 1, b = 0, hasNumeric = true, numberRGB = {1,1,0}, }) | 79 WorldPlan:AddTypeInfo(self, REWARD_CURRENCY, { r = 1, g = 1, b = 0, hasNumeric = true, numberRGB = {1,1,0}, }) |
87 WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = 0, g = 0, b = 0, }) | 80 WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = .7, g = .6, b = .32, pinMask = false, rewardMask = false }) |
88 | 81 |
89 for areaID, fileName in pairs(WORLD_QUEST_MAPS) do | 82 for areaID, fileName in pairs(WORLD_QUEST_MAPS) do |
90 self.QuestsByZone[areaID] = {} | 83 self.QuestsByZone[areaID] = {} |
91 end | 84 end |
92 | 85 |
316 local pin = WorldQuests:GetPinByQuestID(questID) | 309 local pin = WorldQuests:GetPinByQuestID(questID) |
317 return pin:IsShowable() | 310 return pin:IsShowable() |
318 end | 311 end |
319 | 312 |
320 | 313 |
321 | |
322 | |
323 function WorldPlanDataProvider:OnShow() | |
324 assert(self.ticker == nil); | |
325 self.ticker = C_Timer.NewTicker(10, function() self:RefreshAllData() end); | |
326 end | |
327 function WorldPlanDataProvider:OnHide() | |
328 self.ticker:Cancel(); | |
329 self.ticker = nil; | |
330 end | |
331 | |
332 function WorldPlanDataProvider:OnAdded(mapCanvas) | |
333 self.activePins = {}; | |
334 self.owningMap = mapCanvas | |
335 end | |
336 | |
337 | |
338 | |
339 function WorldPlanDataProvider:RefreshAllData() | |
340 local print = mprint | |
341 print('|cFFFF0088'..self.owningMap:GetName()..':RefreshAllData()|r') | |
342 | |
343 | |
344 local pinsToRemove = {}; | |
345 for questId in pairs(self.activePins) do | |
346 pinsToRemove[questId] = true; | |
347 end | |
348 | |
349 SetMapZoom(8) | |
350 | |
351 local mapAreaID = self:GetMap():GetMapID(); | |
352 for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do | |
353 local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); | |
354 print(zoneMapID, zoneName) | |
355 if zoneDepth <= 1 then -- Exclude subzones | |
356 local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneMapID, mapAreaID); | |
357 | |
358 if taskInfo then | |
359 for i, info in ipairs(taskInfo) do | |
360 if HaveQuestData(info.questId) then | |
361 if QuestUtils_IsQuestWorldQuest(info.questId) then | |
362 local pin = WorldPlanQuests:AcquirePin(info.questId, zoneMapID) | |
363 pin:RefreshData(info) | |
364 pin:IsShowable() | |
365 if pin.used then | |
366 print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) | |
367 pinsToRemove[info.questId] = nil; | |
368 | |
369 local frame = self.activePins[info.questId] | |
370 if not frame then | |
371 frame = self:GetMap():AcquirePin("WorldPlanPinContainer") | |
372 frame:SetAlphaLimits(1, 0.7, 1) | |
373 frame:SetScalingLimits(1, 3, 1.5); | |
374 frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanPinContainer")); | |
375 frame:Show() | |
376 self.activePins[info.questId] = frame | |
377 end | |
378 frame:SetPosition(info.x, info.y) | |
379 frame.pin = pin | |
380 | |
381 pin.isStale = true | |
382 pin:SetParent(frame) | |
383 pin:ClearAllPoints() | |
384 pin:SetPoint('CENTER', frame, 'CENTER') | |
385 | |
386 end | |
387 pin:SetShown(pin.used) | |
388 end | |
389 end | |
390 end | |
391 end | |
392 end | |
393 end | |
394 | |
395 for questId in pairs(pinsToRemove) do | |
396 self:GetMap():RemovePin(self.activePins[questId]); | |
397 self.activePins[questId] = nil; | |
398 end | |
399 self:GetMap():RemoveAllPinsByTemplate("WorldQuestPinTemplate"); | |
400 | |
401 end | |
402 | |
403 function WorldPlanDataPinMixin:OnShow() | |
404 mprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r') | |
405 end | |
406 | |
407 function WorldPlanDataPinMixin:OnMouseEnter () | |
408 self.pin:OnEnter() | |
409 end | |
410 | |
411 function WorldPlanDataPinMixin:OnMouseLeave () | |
412 self.pin:OnLeave() | |
413 end | |
414 | |
415 function WorldPlanDataPinMixin:RemoveAllData() | |
416 wipe(self.activePins); | |
417 self:GetMap():RemoveAllPinsByTemplate("WorldQuestPinTemplate"); | |
418 end |