Mercurial > wow > worldplan
comparison FlightMap.lua @ 40:589c444d4837
WowAce/Curseforge migration push
| author | Nenue |
|---|---|
| date | Sun, 25 Dec 2016 13:04:57 -0500 |
| parents | a93cae445d3f |
| children | dbd81d49af02 |
comparison
equal
deleted
inserted
replaced
| 39:89ddef0594bc | 40:589c444d4837 |
|---|---|
| 1 | 1 local _, db = ... |
| 2 local print = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end | 2 local print = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end |
| 3 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end | 3 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end |
| 4 local wipe, pairs, ipairs = wipe, pairs, ipairs | 4 local wipe, pairs, ipairs = wipe, pairs, ipairs |
| 5 local HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest = HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest | 5 local HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest = HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest |
| 6 | 6 |
| 34 local func = tremove(self.TaskQueue, 1) | 34 local func = tremove(self.TaskQueue, 1) |
| 35 func() | 35 func() |
| 36 end | 36 end |
| 37 end | 37 end |
| 38 | 38 |
| 39 function WorldPlanDataProvider:OnLoad() | |
| 40 | |
| 41 self:SetNudgeTargetFactor(0.015); | |
| 42 self:SetNudgeZoomedOutFactor(1.0); | |
| 43 self:SetNudgeZoomedInFactor(0.25); | |
| 44 end | |
| 45 | |
| 39 function WorldPlanDataProvider:OnShow() | 46 function WorldPlanDataProvider:OnShow() |
| 40 assert(self.ticker == nil); | 47 assert(self.ticker == nil); |
| 41 self.ticker = C_Timer.NewTicker(10, function() self:RefreshAllData() end); | 48 self.ticker = C_Timer.NewTicker(10, function() self:RefreshAllData() end); |
| 42 end | 49 end |
| 43 function WorldPlanDataProvider:OnHide() | 50 function WorldPlanDataProvider:OnHide() |
| 67 | 74 |
| 68 local pinsToRemove = {}; | 75 local pinsToRemove = {}; |
| 69 for questId in pairs(self.activePins) do | 76 for questId in pairs(self.activePins) do |
| 70 pinsToRemove[questId] = true; | 77 pinsToRemove[questId] = true; |
| 71 end | 78 end |
| 72 | 79 print(unpack(db.Config.FlightMapAlphaLimits)) |
| 80 local alpha1, alpha2, alpha3 = unpack(db.Config.FlightMapAlphaLimits) | |
| 81 local scale1, scale2, scale3 = unpack(db.Config.FlightMapScalingLimits) | |
| 73 | 82 |
| 74 local mapAreaID = self:GetMap():GetMapID(); | 83 local mapAreaID = self:GetMap():GetMapID(); |
| 75 for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do | 84 for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do |
| 76 local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); | 85 local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); |
| 77 print(zoneMapID, zoneName) | 86 print(zoneMapID, zoneName) |
| 80 | 89 |
| 81 if taskInfo then | 90 if taskInfo then |
| 82 for i, info in ipairs(taskInfo) do | 91 for i, info in ipairs(taskInfo) do |
| 83 if HaveQuestData(info.questId) then | 92 if HaveQuestData(info.questId) then |
| 84 if QuestUtils_IsQuestWorldQuest(info.questId) then | 93 if QuestUtils_IsQuestWorldQuest(info.questId) then |
| 85 local pin = WorldPlanQuests:AcquirePin(info.questId, zoneMapID) | 94 local pin = db.QuestsByID[info.questId] |
| 86 pin:RefreshData(info) | 95 if not db.QuestsByID[info.questId] then |
| 96 pin = WorldPlanQuests:AcquirePin(info, zoneMapID) | |
| 97 end | |
| 98 | |
| 87 pin:IsShowable() | 99 pin:IsShowable() |
| 88 if pin.used then | 100 if pin.used then |
| 89 print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) | 101 print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) |
| 90 pinsToRemove[info.questId] = nil; | 102 pinsToRemove[info.questId] = nil; |
| 91 | 103 |
| 92 local frame = self.activePins[info.questId] | 104 local frame = self.activePins[info.questId] |
| 93 if not frame then | 105 if not frame then |
| 94 frame = self:GetMap():AcquirePin("WorldPlanFlightPin") | 106 frame = self:GetMap():AcquirePin("WorldPlanFlightPin") |
| 95 frame:SetAlphaLimits(1, 0.7, 1) | 107 print(alpha1, alpha2, alpha3) |
| 96 frame:SetScalingLimits(1, 3, 1.5); | 108 print(scale1, scale2, scale3) |
| 109 frame:SetAlphaLimits(alpha1, alpha2, alpha3) | |
| 110 frame:SetScalingLimits(scale1, scale2, scale3); | |
| 97 frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); | 111 frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); |
| 98 frame:Show() | 112 frame:Show() |
| 99 self.activePins[info.questId] = frame | 113 self.activePins[info.questId] = frame |
| 100 end | 114 end |
| 101 frame:SetPosition(info.x, info.y) | 115 frame:SetPosition(info.x, info.y) |
| 102 frame.pin = pin | 116 frame.pin = pin |
| 103 | 117 |
| 104 pin.owningFrame = self:GetMap() | 118 pin.owningFrame = frame:GetMap() |
| 105 pin.isStale = true | 119 pin.isStale = true |
| 106 pin:SetParent(frame) | 120 pin:SetParent(frame) |
| 107 pin:ClearAllPoints() | 121 pin:ClearAllPoints() |
| 108 pin:SetPoint('CENTER', frame, 'CENTER') | 122 pin:SetPoint('CENTER', frame, 'CENTER') |
| 109 | 123 |
| 125 pin:Hide() | 139 pin:Hide() |
| 126 end | 140 end |
| 127 | 141 |
| 128 end | 142 end |
| 129 function WorldPlanDataProvider:OnEvent() | 143 function WorldPlanDataProvider:OnEvent() |
| 130 for pin in self:GetMap():EnumeratePinsByTemplate("WorldQuestPinTemplate") do | |
| 131 pin:Hide() | |
| 132 end | |
| 133 end | 144 end |
| 134 | 145 |
| 135 function WorldPlanDataPinMixin:OnShow() | 146 function WorldPlanDataPinMixin:OnShow() |
| 136 print('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r') | |
| 137 end | 147 end |
| 138 | 148 |
| 139 function WorldPlanDataPinMixin:OnMouseEnter () | 149 function WorldPlanDataPinMixin:OnMouseEnter () |
| 140 | |
| 141 end | 150 end |
| 142 | 151 |
| 143 function WorldPlanDataPinMixin:OnMouseLeave () | 152 function WorldPlanDataPinMixin:OnMouseLeave () |
| 144 | |
| 145 end | 153 end |
| 146 | 154 |
| 147 function WorldPlanDataPinMixin:RemoveAllData() | 155 function WorldPlanDataPinMixin:RemoveAllData() |
| 148 wipe(self.activePins); | 156 wipe(self.activePins); |
| 149 self:GetMap():RemoveAllPinsByTemplate("WorldPlanFlightPin"); | 157 self:GetMap():RemoveAllPinsByTemplate("WorldPlanFlightPin"); |
