annotate WorldPlan.lua @ 1:232617b8bcd5

New Order Hall mission tracker: - record active missions and shipments across characters
author Nenue
date Thu, 13 Oct 2016 05:32:43 -0400
parents 3830a592cb0f
children 34d9fbf7af20
rev   line source
Nenue@0 1 -- Veneer
Nenue@0 2 -- WorldPlan.lua
Nenue@0 3 -- Created: 8/16/2016 8:19 AM
Nenue@0 4 -- %file-revision%
Nenue@0 5 --[[
Nenue@0 6 Summary:
Nenue@0 7 Adds reward icons to the world quest POI markers, and adds said markers to the continent map.
Nenue@0 8
Nenue@0 9 Issues:
Nenue@0 10 Dalaran quests aren't visible until that map has been specifically viewed by the player.
Nenue@0 11 --]]
Nenue@0 12
Nenue@0 13 WorldPlanCore = {}
Nenue@0 14 WorldPlanPOIMixin = {}
Nenue@0 15 WorldPlanFilterPinMixin = {}
Nenue@0 16 local WorldPlanFlightMapMixin = setmetatable({}, {__tostring = function() return 'FlightMapHandler' end})
Nenue@0 17 local WorldQuests = setmetatable({ QuestsByID = {}, freePins = {} }, {__tostring = function() return 'QuestHandler' end})
Nenue@0 18 local FilterBar = setmetatable({ SummaryHeaders = {} }, {__tostring = function() return 'FilterBar' end})
Nenue@0 19
Nenue@0 20 local WorldPlan = WorldPlanCore
Nenue@0 21 local QuestPOI = WorldPlanPOIMixin
Nenue@0 22 local FilterPin = WorldPlanFilterPinMixin
Nenue@0 23 local WP_VERSION = "1.0"
Nenue@0 24
Nenue@0 25 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
Nenue@0 26 local wipe, tremove, tinsert, pairs, floor, tContains = table.wipe, table.remove, table.insert, pairs, floor, tContains
Nenue@0 27 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
Nenue@0 28 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented
Nenue@0 29 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
Nenue@0 30 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
Nenue@0 31 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
Nenue@0 32 local TQ_IsActive = C_TaskQuest.IsActive
Nenue@0 33 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
Nenue@0 34 local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters
Nenue@0 35 local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest
Nenue@0 36 local GameTooltip = GameTooltip
Nenue@0 37 local GetItemIcon = GetItemIcon
Nenue@0 38
Nenue@0 39
Nenue@0 40 local GetMapInfo, QuestPOIGetIconInfo = GetMapInfo, QuestPOIGetIconInfo
Nenue@0 41 local GetQuestTagInfo, HaveQuestData = GetQuestTagInfo, HaveQuestData
Nenue@0 42 local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, GetQuestLogRewardMoney = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, GetQuestLogRewardMoney
Nenue@0 43 local GetQuestLogRewardInfo, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardInfo, GetQuestLogRewardCurrencyInfo, GetMoneyString
Nenue@0 44
Nenue@0 45 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID
Nenue@0 46 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo
Nenue@0 47
Nenue@0 48 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
Nenue@0 49 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
Nenue@0 50
Nenue@0 51 local SearchFaction
Nenue@0 52 local PinBaseIndex = 1600
Nenue@0 53 local ShowAllProfessionQuests = false
Nenue@0 54 local DisplayContinentSummary = true
Nenue@0 55 local DisplayContinentPins = true
Nenue@0 56 local NotifyWhenNewQuests = true
Nenue@0 57 local PinRewardFilter, PinTagFilter
Nenue@0 58 local BROKEN_ISLES_ID, DALARAN_ID, AZSUNA_ID, VALSHARAH_ID, HIGHMOUNTAIN_ID, STORMHEIM_ID, SURAMAR_ID, EOA_ID = 1007, 1014, 1015,1018, 1024, 1017, 1033, 1096
Nenue@0 59
Nenue@0 60 -- maps where we do our own anchors
Nenue@0 61 local CONTINENT_MAPS = { [BROKEN_ISLES_ID] = BROKEN_ISLES_ID, }
Nenue@0 62 local WORLD_QUEST_MAPS = { [DALARAN_ID] = 'Dalaran70', [AZSUNA_ID] = 'Azsuna', [VALSHARAH_ID] = "Val'sharah",
Nenue@0 63 [HIGHMOUNTAIN_ID] = 'Highmountain', [STORMHEIM_ID] = 'Stormheim', [SURAMAR_ID] = 'Suramar', [EOA_ID] = 'EyeOfAszhara', }
Nenue@0 64 -- default color templates
Nenue@0 65 local ARTIFACT_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_ARTIFACT]
Nenue@0 66 local MONEY_COLOR = {hex ='|cFFFFFF00', r=1, g=1, b=0}
Nenue@0 67 local COMMON_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_COMMON]
Nenue@0 68
Nenue@0 69 -- operating flags
Nenue@0 70 local superTrackedID
Nenue@0 71 local currentMapName
Nenue@0 72 local hasNewQuestPins
Nenue@0 73 local isContinentMap
Nenue@0 74
Nenue@0 75 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
Nenue@0 76 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
Nenue@0 77
Nenue@0 78 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
Nenue@0 79 local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@0 80 local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE"
Nenue@0 81 local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
Nenue@0 82 local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@0 83 local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"
Nenue@0 84
Nenue@0 85 local REWARD_CASH = 1001
Nenue@0 86 local REWARD_ARTIFACT_POWER = 1002
Nenue@0 87 local REWARD_GEAR = 1003
Nenue@0 88 local REWARD_CURRENCY = 1004
Nenue@0 89 local REWARD_ITEM = 1005
Nenue@0 90 local REWARD_REAGENT = 1006
Nenue@0 91
Nenue@0 92 local POI_DEFAULT_TYPE = {
Nenue@0 93 a = 1,
Nenue@0 94 r = 1, g = 1, b = 1,
Nenue@0 95 x = 0, y = 0,
Nenue@0 96 desaturated = true,
Nenue@0 97 mask = POI_BORDER_MASK,
Nenue@0 98 texture = POI_BORDER_FILL,
Nenue@0 99 continent = {
Nenue@0 100 PinSize = 18,
Nenue@0 101 Border = 3,
Nenue@0 102 TrackingBorder = 2,
Nenue@0 103 TagSize = 6,
Nenue@0 104 TimeleftStage = 3,
Nenue@0 105 },
Nenue@0 106 zone = {
Nenue@0 107 PinSize = 22,
Nenue@0 108 Border = 3,
Nenue@0 109 TrackingBorder = 2,
Nenue@0 110 TagSize = 12,
Nenue@0 111 TimeleftStage = 3,
Nenue@0 112 },
Nenue@0 113 minimized = {
Nenue@0 114 PinSize = 4,
Nenue@0 115 Border = 1,
Nenue@0 116 TrackingBorder = 2,
Nenue@0 117 NoIcon = true,
Nenue@0 118 TimeleftStage = 1,
Nenue@0 119 }
Nenue@0 120 }
Nenue@0 121 local POI_REWARD_TYPE = setmetatable({}, {
Nenue@0 122 __newindex = function(t, k, v)
Nenue@0 123 if type(v) == 'table' then
Nenue@0 124 setmetatable(v, {__index = POI_DEFAULT_TYPE})
Nenue@0 125 end
Nenue@0 126 rawset(t,k,v)
Nenue@0 127 end
Nenue@0 128 })
Nenue@0 129 local POI_FILTER_STYLE = setmetatable({
Nenue@0 130 continentBorder = 2,
Nenue@0 131 zoneBorder = 2,
Nenue@0 132 }, {__index = POI_DEFAULT_TYPE})
Nenue@0 133
Nenue@0 134 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
Nenue@0 135 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
Nenue@0 136 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
Nenue@0 137 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
Nenue@0 138 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
Nenue@0 139
Nenue@0 140 -- Pin color/display variables
Nenue@0 141 POI_REWARD_TYPE[REWARD_ITEM] = {
Nenue@0 142 r = 1, g = 1, b = 1,
Nenue@0 143 }
Nenue@0 144 POI_REWARD_TYPE[REWARD_REAGENT] = {
Nenue@0 145 r = 0, g = 1, b = 1,
Nenue@0 146 }
Nenue@0 147 POI_REWARD_TYPE[REWARD_ARTIFACT_POWER] = {
Nenue@0 148 r = 1, g = .25, b = .5,
Nenue@0 149 showNumber = true,
Nenue@0 150 }
Nenue@0 151 POI_REWARD_TYPE[REWARD_GEAR] = {
Nenue@0 152 r = .1, g = .2, b = 1,
Nenue@0 153 }
Nenue@0 154 POI_REWARD_TYPE[REWARD_CURRENCY] = {
Nenue@0 155 r = 1, g = 1, b = 0,
Nenue@0 156 }
Nenue@0 157 POI_REWARD_TYPE[REWARD_CASH] = {
Nenue@0 158 r = 0, g = 0, b = 0,
Nenue@0 159 --x = 0, y = -1,
Nenue@0 160 --mask = ICON_MONEY,
Nenue@0 161 --continentBorder = 1,
Nenue@0 162 --zoneBorder = 1,
Nenue@0 163 }
Nenue@0 164
Nenue@0 165
Nenue@0 166 -- Summary header structure
Nenue@0 167 local POI_FILTER_OPTIONS = {
Nenue@0 168 { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" },
Nenue@0 169 { filterKey= 'rewardType', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" },
Nenue@0 170 { filterKey= 'rewardType', filterValue = REWARD_CURRENCY,label = 'Currency', texture = "Interface\\ICONS\\inv_misc_elvencoins" },
Nenue@0 171 { filterKey= 'rewardType', filterValue = REWARD_ITEM, label = 'Item', texture = "Interface\\ICONS\\inv_crate_01" },
Nenue@0 172 { filterKey= 'rewardType', filterValue = REWARD_GEAR, label = 'Equipment', texture = "Interface\\ICONS\\garrison_bluearmorupgrade" },
Nenue@0 173 { filterKey= 'rewardType', filterValue = REWARD_REAGENT, label = 'Reagents', texture = 1417744 },
Nenue@0 174 { filterKey= 'rewardType', filterValue = REWARD_CASH, label = 'Reagents', texture = ICON_MONEY },
Nenue@0 175 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 },
Nenue@0 176 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", },
Nenue@0 177 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
Nenue@0 178 }
Nenue@0 179
Nenue@0 180 local PIN_TIME_CONTEXT = {
Nenue@0 181 {max = 60,
Nenue@0 182 r=1, g=0.25, b =0, format = function (minutes) return '|cFFFF4400'.. minutes .. 'm' end,
Nenue@0 183 continentAlpha = 1, swipeTime = 1440,
Nenue@0 184 },
Nenue@0 185 {max = 240,
Nenue@0 186 r=1, g=.5, b=0, format = function(minutes) return '|cFFFF4400'.. floor(minutes/60) .. 'h' end,
Nenue@0 187 continentAlpha = 1, swipeTime = 1440,
Nenue@0 188 },
Nenue@0 189 {max = 1440,
Nenue@0 190 r=1, g=1, b=0, format = function(minutes) return '|cFFFFFF00'.. floor(minutes/60) .. 'h' end,
Nenue@0 191 continentAlpha = .55, swipeTime = 1440
Nenue@0 192 },
Nenue@0 193 {max = 10081,
Nenue@0 194 r=0, g=1, b=0,
Nenue@0 195 continentAlpha = .3,
Nenue@0 196 }, -- 7 days + 1 minute
Nenue@0 197 }
Nenue@0 198
Nenue@0 199 local numPins = 0
Nenue@0 200 local QuestsByZone = {}
Nenue@0 201 local QuestsByFaction = {}
Nenue@0 202 local QuestsByReward = {}
Nenue@0 203 local QuestsByTag = {}
Nenue@0 204 local QuestsByID = {}
Nenue@0 205 local QuestPositions = {}
Nenue@0 206 local FilterInclusions = {rewardType = {}, worldQuestType = {}}
Nenue@1 207 local FilterExclusions = {rewardType = {}, worldQuestType = {} }
Nenue@1 208 local NotificationTypes = {}
Nenue@0 209 local ZoneInfo = {}
Nenue@0 210 local SummaryHeaders = {}
Nenue@0 211
Nenue@0 212 local FreePins = {}
Nenue@0 213 local NumPinFrames = 1
Nenue@0 214
Nenue@0 215 local hasPendingQuestData
Nenue@0 216 local notifyPlayed
Nenue@0 217 local scanner, wmtt, WorldMapPOIFrame
Nenue@0 218
Nenue@0 219
Nenue@0 220 local tasksQueue = {}
Nenue@0 221 local function OnNext (func)
Nenue@0 222 if #tasksQueue == 0 then
Nenue@0 223 _G.WorldPlan:SetScript('OnUpdate', function()
Nenue@0 224 local func = tremove(tasksQueue, 1)
Nenue@0 225 if func then
Nenue@0 226 func()
Nenue@0 227 end
Nenue@0 228 if #tasksQueue == 0 then
Nenue@0 229 _G.WorldPlan:SetScript('OnUpdate', nil)
Nenue@0 230 end
Nenue@0 231 end)
Nenue@0 232 end
Nenue@0 233 tinsert(tasksQueue, func)
Nenue@0 234 end
Nenue@0 235
Nenue@0 236 -- combines templates
Nenue@0 237 local function DoMixins(frame,...)
Nenue@0 238 for i = 1, select('#', ...) do
Nenue@0 239 for k,v in pairs(select(i,...)) do
Nenue@0 240 frame[k] = v
Nenue@0 241 end
Nenue@0 242 end
Nenue@0 243 return frame
Nenue@0 244 end
Nenue@0 245
Nenue@0 246 -- use tooltip object to extract item details
Nenue@0 247 local ParseItemReward = function(questID)
Nenue@0 248 local rewardType = REWARD_ITEM
Nenue@0 249 local name, icon, quantity, quality, _, itemID = GetQuestLogRewardInfo(1, questID)
Nenue@0 250 if not itemID then
Nenue@0 251 return REWARD_ITEM
Nenue@0 252 end
Nenue@0 253
Nenue@0 254 scanner:SetOwner(WorldPlan, "ANCHOR_NONE")
Nenue@0 255 scanner:SetItemByID(itemID)
Nenue@0 256 local ttl1 = _G['WorldPlanTooltipTextLeft1']
Nenue@0 257 local ttl2 = _G['WorldPlanTooltipTextLeft2']
Nenue@0 258 local ttl3 = _G['WorldPlanTooltipTextLeft3']
Nenue@0 259 local ttl4 = _G['WorldPlanTooltipTextLeft4']
Nenue@0 260 if ttl2 then
Nenue@0 261 local text = ttl2:GetText()
Nenue@0 262 -- Artifact Power
Nenue@0 263 if text and text:match("|cFFE6CC80") then
Nenue@0 264 --print('AP token!', text)
Nenue@0 265 local power
Nenue@0 266 if ttl4 then
Nenue@0 267 local text = ttl4:GetText()
Nenue@0 268 --print('tip line 4', text)
Nenue@0 269 if text then
Nenue@0 270 power = text:gsub("%p", ""):match("%d+")
Nenue@0 271 power = tonumber(power)
Nenue@0 272 end
Nenue@0 273
Nenue@0 274 end
Nenue@0 275 rewardType = REWARD_ARTIFACT_POWER
Nenue@0 276 icon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01"
Nenue@0 277 quantity = power
Nenue@0 278 elseif text and text:match("Item Level") then
Nenue@0 279 --print('equipment!', text)
Nenue@0 280 rewardType = REWARD_GEAR
Nenue@0 281 quantity = text:match("Item Level ([%d\+]+)")
Nenue@0 282 end
Nenue@0 283 end
Nenue@0 284 if ttl3 then
Nenue@0 285 local text = ttl3:GetText()
Nenue@0 286 -- Crafting Reagent
Nenue@0 287 if text and text:match("Crafting Reagent") then
Nenue@0 288 --print('reagent', text)
Nenue@0 289 rewardType = REWARD_REAGENT
Nenue@0 290 end
Nenue@0 291 end
Nenue@0 292 iprint(' item:', name, rewardType, icon, quantity)
Nenue@0 293 return rewardType, icon, quantity, name, itemID
Nenue@0 294 end
Nenue@0 295
Nenue@0 296 -- update a masked texture without messing up its blending mask
Nenue@0 297 local SetMaskedTexture = function(region, file, mask)
Nenue@0 298 mask = mask or POI_BORDER_MASK
Nenue@0 299 region:SetMask(nil)
Nenue@0 300 region:SetTexture(file)
Nenue@0 301 region:SetMask(mask)
Nenue@0 302 end
Nenue@0 303
Nenue@0 304 -- tracking menu toggler
Nenue@0 305 local DropDown_OnClick = function(self)
Nenue@0 306 local key = self.value
Nenue@0 307 if key then
Nenue@0 308 if WorldPlanData[key] then
Nenue@0 309 WorldPlanData[key] = nil
Nenue@0 310 else
Nenue@0 311 WorldPlanData[key] = true
Nenue@0 312 end
Nenue@0 313 end
Nenue@0 314 end
Nenue@0 315
Nenue@0 316 function WorldPlan:print(...)
Nenue@0 317 local msg
Nenue@0 318 for i = 1, select('#', ...) do
Nenue@0 319 msg = (msg and (msg .. ' ') or '') .. tostring(select(i, ...))
Nenue@0 320 end
Nenue@0 321 DEFAULT_CHAT_FRAME:AddMessage("|cFF0088FFWorldPlan|r: " .. msg)
Nenue@0 322 end
Nenue@0 323
Nenue@0 324 function WorldPlan:OnLoad ()
Nenue@0 325 WorldPlan = self
Nenue@0 326 scanner = _G.WorldPlanTooltip
Nenue@0 327 wmtt = _G.WorldMapTooltip
Nenue@0 328 WorldMapPOIFrame = _G.WorldMapPOIFrame
Nenue@0 329
Nenue@0 330 WorldPlan:print('v'..WP_VERSION)
Nenue@0 331
Nenue@0 332 self:RegisterEvent("QUESTLINE_UPDATE")
Nenue@0 333 self:RegisterEvent("QUEST_LOG_UPDATE")
Nenue@0 334 self:RegisterEvent("WORLD_MAP_UPDATE")
Nenue@0 335 self:RegisterEvent("WORLD_QUEST_COMPLETED_BY_SPELL")
Nenue@0 336 self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED")
Nenue@0 337 self:RegisterEvent("SKILL_LINES_CHANGED")
Nenue@0 338 self:RegisterEvent("ARTIFACT_XP_UPDATE")
Nenue@0 339 self:RegisterEvent("ADDON_LOADED")
Nenue@0 340
Nenue@0 341 WorldPlan.modules = {
Nenue@0 342 WorldQuests, FilterBar, WorldPlanFlightMapMixin,
Nenue@0 343 }
Nenue@0 344 hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize)
Nenue@0 345 end
Nenue@0 346
Nenue@0 347 function WorldPlan:OnEvent (event, ...)
Nenue@0 348 print()
Nenue@0 349 print(event, ...)
Nenue@0 350 if event == 'ADDON_LOADED' then
Nenue@0 351 local addon = ...
Nenue@0 352 if addon == "Blizzard_FlightMap" then
Nenue@0 353 print('do mixin junk')
Nenue@0 354 self.OnFlightMapLoaded()
Nenue@0 355
Nenue@0 356 end
Nenue@0 357 if IsLoggedIn() and not self.initialized then
Nenue@0 358 self:Setup()
Nenue@0 359 end
Nenue@0 360 elseif event == 'WORLD_MAP_UPDATE' then
Nenue@0 361 self:RefreshAll()
Nenue@0 362 end
Nenue@0 363 for i, module in ipairs(self.modules) do
Nenue@0 364 if module.OnEvent then
Nenue@0 365 print('forwarding to', tostring(module))
Nenue@0 366 module:OnEvent(event, ...)
Nenue@0 367 end
Nenue@0 368 end
Nenue@0 369 end
Nenue@0 370
Nenue@0 371
Nenue@0 372 function WorldPlan:Setup ()
Nenue@0 373 if not WorldPlanData then
Nenue@0 374 WorldPlanData = {key = 0 }
Nenue@0 375 end
Nenue@0 376 WorldPlanData.key = (WorldPlanData.key or 0) + 1
Nenue@0 377 self.db = WorldPlanData
Nenue@0 378
Nenue@0 379 for i, module in ipairs(self.modules) do
Nenue@0 380 if module.Setup then module:Setup() end
Nenue@0 381 if not module.RegisterEvent then
Nenue@0 382 module.RegisterEvent = self.RegisterEvent
Nenue@0 383 end
Nenue@0 384 end
Nenue@0 385 self.initialized = true
Nenue@0 386
Nenue@0 387 end
Nenue@0 388
Nenue@0 389 function WorldPlan:RefreshAll (forced)
Nenue@0 390 for i, module in ipairs(self.modules) do
Nenue@0 391 if module.Refresh then
Nenue@0 392 module:Refresh()
Nenue@0 393 end
Nenue@0 394 end
Nenue@0 395 end
Nenue@0 396 function WorldPlan:UpdateAnchors ()
Nenue@0 397 for i, module in ipairs(self.modules) do
Nenue@0 398 if module.UpdateAnchors then
Nenue@0 399 module:UpdateAnchors()
Nenue@0 400 end
Nenue@0 401 end
Nenue@0 402 end
Nenue@0 403
Nenue@0 404 -- insert visual options into the tracking button menu
Nenue@0 405 WorldPlan.OnDropDownInitialize = function (self, callback, dropType)
Nenue@0 406 if self ~= WorldMapFrameDropDown then
Nenue@0 407 return
Nenue@0 408 end
Nenue@0 409
Nenue@0 410 local info = UIDropDownMenu_CreateInfo()
Nenue@0 411 info.text = ""
Nenue@0 412 info.isTitle = true
Nenue@0 413 UIDropDownMenu_AddButton(info)
Nenue@0 414 info.text = "|cFF00AAFFWorldPlan|r"
Nenue@0 415 info.isTitle = true
Nenue@0 416 UIDropDownMenu_AddButton(info)
Nenue@0 417 info.isTitle = nil
Nenue@0 418 info.disabled = nil
Nenue@0 419 info.keepShownOnClick = true
Nenue@0 420 info.tooltipOnButton = 1
Nenue@0 421
Nenue@0 422 info.text = "Hidden World Quests"
Nenue@0 423 info.isNotRadio = true
Nenue@0 424 info.value = "ShowAllProfessionQuests"
Nenue@0 425 info.checked = ShowAllProfessionQuests
Nenue@0 426 info.tooltipTitle = "Hidden Quests"
Nenue@0 427 info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI."
Nenue@0 428 info.func = DropDown_OnClick
Nenue@0 429 UIDropDownMenu_AddButton(info)
Nenue@0 430
Nenue@0 431 info.text = "Show Continent Pins"
Nenue@0 432 info.isNotRadio = true
Nenue@0 433 info.value = "DisplayContinentPins"
Nenue@0 434 info.checked = DisplayContinentPins
Nenue@0 435 info.tooltipTitle = "Continent Pins"
Nenue@0 436 info.tooltipText = "Display quest pins on the continent map (may get cramped)."
Nenue@0 437 info.func = DropDown_OnClick
Nenue@0 438 UIDropDownMenu_AddButton(info)
Nenue@0 439
Nenue@0 440 info.text = "Show Summary"
Nenue@0 441 info.isNotRadio = true
Nenue@0 442 info.value = "DisplayContinentSummary"
Nenue@0 443 info.tooltipTitle = "Summary Bar"
Nenue@0 444 info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info."
Nenue@0 445 info.checked = DisplayContinentSummary
Nenue@0 446 info.func = DropDown_OnClick
Nenue@0 447 UIDropDownMenu_AddButton(info)
Nenue@0 448 end
Nenue@0 449
Nenue@0 450 function WorldQuests:Setup()
Nenue@0 451 -- refresh positions any time blizzard does so (i.e. mousewheel zoom)
Nenue@0 452 hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function()
Nenue@0 453 self:Refresh()
Nenue@0 454 end)
Nenue@0 455
Nenue@0 456 -- hide the original world quest POIs
Nenue@0 457 hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function()
Nenue@0 458 for i = 1, NUM_WORLDMAP_TASK_POIS do
Nenue@0 459 local button = _G['WorldMapFrameTaskPOI'..i]
Nenue@0 460 if button and button.worldQuest then
Nenue@0 461 button:Hide()
Nenue@0 462 end
Nenue@0 463 end
Nenue@0 464 end)
Nenue@0 465
Nenue@0 466
Nenue@0 467 end
Nenue@0 468
Nenue@0 469 function WorldQuests:OnEvent (event, ...)
Nenue@0 470 print('|cFFFFFF00'..tostring(self)..':OnEvent()'..event..'|r', ...)
Nenue@0 471 if event == 'QUEST_LOG_UPDATE' then
Nenue@0 472 local questID, added = ...
Nenue@0 473 if questID and added then
Nenue@0 474 self:GetPinByQuestID(questID)
Nenue@0 475 else
Nenue@0 476 self:GetPinsForMap()
Nenue@0 477 end
Nenue@0 478 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
Nenue@0 479 local questID = ...
Nenue@0 480 if questID and QuestsByID[questID] then
Nenue@0 481 self:ReleasePin(QuestsByID[questID])
Nenue@0 482 end
Nenue@0 483 elseif event == 'SKILL_LINES_CHANGED' then
Nenue@0 484 self:Refresh()
Nenue@0 485 end
Nenue@0 486 end
Nenue@0 487
Nenue@0 488 function WorldQuests:AcquirePin (questID, pinTable)
Nenue@0 489 local pin = QuestsByID[questID]
Nenue@0 490 local isNew = false
Nenue@0 491 if not pin then
Nenue@0 492 isNew = true
Nenue@0 493 local numFree = #self.freePins
Nenue@0 494 if numFree >= 1 then
Nenue@0 495 pin = tremove(self.freePins, numFree)
Nenue@0 496 --print('|cFF00FF00Re-using', pin:GetName())
Nenue@0 497 else
Nenue@0 498 local name = 'WorldPlanQuestMarker' .. NumPinFrames
Nenue@0 499 --print('|cFF00FF00Creating', name)
Nenue@0 500 pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin')
Nenue@0 501 pin:SetFrameStrata('HIGH')
Nenue@0 502 pin:SetScript('OnEnter', function(self)
Nenue@0 503 TaskPOI_OnEnter(self)
Nenue@0 504 end)
Nenue@0 505 pin:SetScript('OnLeave', function(self)
Nenue@0 506 TaskPOI_OnLeave(self)
Nenue@0 507 end)
Nenue@0 508 pin:SetScript('OnMouseDown', TaskPOI_OnClick)
Nenue@0 509
Nenue@0 510 NumPinFrames = NumPinFrames + 1
Nenue@0 511
Nenue@0 512 --pin.iconBorder:SetVertexColor(0,0,0,1)
Nenue@0 513
Nenue@0 514 end
Nenue@0 515 QuestsByID[questID] = pin
Nenue@0 516 pin.isNew = true
Nenue@0 517 pin.currentWidth = nil
Nenue@0 518
Nenue@0 519 -- used by TaskPOI_x scripts
Nenue@0 520 pin.questID = questID
Nenue@0 521 pin.worldQuest = true
Nenue@0 522 else
Nenue@0 523 --print('|cFF00FF00Using', pin:GetName())
Nenue@0 524 end
Nenue@0 525
Nenue@0 526 -- set display flags accordingly
Nenue@0 527 if pinTable then
Nenue@0 528 for k,v in pairs(pinTable) do
Nenue@0 529 pin[k] = v
Nenue@0 530 end
Nenue@0 531 end
Nenue@0 532 pin.throttle = nil
Nenue@0 533 pin.timeThreschold = nil
Nenue@0 534 return pin, isNew
Nenue@0 535 end
Nenue@0 536
Nenue@0 537 -- remove from index and add it to the recycling heap
Nenue@0 538 function WorldQuests:ReleasePin (pin)
Nenue@0 539
Nenue@0 540 local id = pin.questId
Nenue@0 541 if id then
Nenue@0 542 QuestsByID[id] = nil
Nenue@0 543 for i, zone in pairs(QuestsByZone) do
Nenue@0 544 print('-', i, zone[i])
Nenue@0 545 zone[id] = nil
Nenue@0 546 end
Nenue@0 547 end
Nenue@0 548 if pin.factionID then
Nenue@0 549 QuestsByFaction[pin.factionID][id] = nil
Nenue@0 550 end
Nenue@0 551 pin:Hide()
Nenue@0 552 pin:ClearAllPoints()
Nenue@0 553 tinsert(self.freePins, pin)
Nenue@0 554 print('|cFFFF4400Clearing out', pin:GetName(),id)
Nenue@0 555 end
Nenue@0 556
Nenue@0 557 -- create of update quest pins for a map and its underlying zones
Nenue@0 558 function WorldQuests:GetPinsForMap (mapID)
Nenue@0 559 mapID = mapID or GetCurrentMapAreaID()
Nenue@0 560 superTrackedID = GetSuperTrackedQuestID()
Nenue@0 561 if not mapID then
Nenue@0 562 -- info not available yet
Nenue@0 563 return
Nenue@0 564 end
Nenue@0 565 if mapID == BROKEN_ISLES_ID then
Nenue@0 566 hasPendingQuestData = nil
Nenue@0 567 print('|cFF00FFFFRefreshQuestsForMap|r', mapID, GetMapNameByID(mapID), superTrackedID)
Nenue@0 568 self.fullSearch = true
Nenue@0 569 for i = 1, MC_GetNumZones(mapID) do
Nenue@0 570 local submapID, name, depth = MC_GetZoneInfo(mapID, i)
Nenue@0 571 self:GetPinsForMap(submapID)
Nenue@0 572 end
Nenue@0 573 self.fullSearch = nil
Nenue@0 574 elseif QuestsByZone[mapID] then
Nenue@0 575 local taskInfo = TQ_GetQuestsForPlayerByMapID(mapID)
Nenue@0 576 local quest = QuestsByZone[mapID]
Nenue@0 577 local numQuests = 0
Nenue@0 578 if taskInfo and #taskInfo >= 1 then
Nenue@0 579 print('|cFF00FFFFRefreshQuestsForMap|r', mapID, GetMapNameByID(mapID), #taskInfo)
Nenue@0 580 wipe(QuestsByZone[mapID])
Nenue@0 581 ZoneInfo[mapID] = taskInfo
Nenue@0 582 for taskID, info in pairs(taskInfo) do
Nenue@0 583 local questID = info.questId
Nenue@0 584
Nenue@0 585 info.mapID = mapID
Nenue@0 586 QuestsByZone[mapID][questID] = self:GetPinByQuestID(questID, info)
Nenue@0 587 numQuests = numQuests + 1
Nenue@0 588 end
Nenue@0 589 end
Nenue@0 590 end
Nenue@0 591 if hasNewQuestPins and not self.fullSearch then
Nenue@0 592 print('|cFF00FF00NEW PINS DO ANCHOR THINGS')
Nenue@0 593 self:Refresh ()
Nenue@0 594 hasNewQuestPins = nil
Nenue@0 595 end
Nenue@0 596 end
Nenue@0 597
Nenue@0 598 -- create or update the pin using the given questID and C_TaskQuest results
Nenue@0 599 function WorldQuests:GetPinByQuestID (questID, taskInfo)
Nenue@0 600 if (QuestMapFrame_IsQuestWorldQuest (questID)) then
Nenue@0 601 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
Nenue@0 602 local pin = self:AcquirePin(questID, taskInfo)
Nenue@0 603
Nenue@0 604 if pin.isNew then
Nenue@0 605 if not hasNewQuestPins then
Nenue@0 606 print('triggering new quest pins event')
Nenue@0 607 end
Nenue@0 608
Nenue@0 609 hasNewQuestPins = true
Nenue@0 610 end
Nenue@0 611
Nenue@0 612 if not HaveQuestData(questID) then
Nenue@0 613 print('|cFFFF4400Retrieval failed.')
Nenue@0 614 TQ_RequestPreloadRewardData(questID)
Nenue@0 615 hasPendingQuestData = true
Nenue@0 616 else
Nenue@0 617 print('|cFF00FF88HaveQuestData|r')
Nenue@0 618 pin.mapID = pin.mapID or C_TaskQuest.GetQuestZoneID(questID)
Nenue@0 619
Nenue@0 620 -- set reward category
Nenue@0 621 local numRewards = GetNumQuestLogRewards(questID)
Nenue@0 622 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
Nenue@0 623 local money = GetQuestLogRewardMoney(questID)
Nenue@0 624 if numRewards >= 1 then
Nenue@0 625 rewardType, rewardIcon, rewardCount, rewardName, itemID = ParseItemReward(questID)
Nenue@0 626 elseif numCurrency >= 1 then
Nenue@0 627 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
Nenue@0 628 rewardType = REWARD_CURRENCY
Nenue@0 629 elseif money >= 1 then
Nenue@0 630 rewardIcon = ICON_MONEY
Nenue@0 631 rewardName = GetMoneyString(money)
Nenue@0 632 rewardType = REWARD_CASH
Nenue@0 633 end
Nenue@0 634 rewardStyle = POI_REWARD_TYPE[rewardType] or POI_DEFAULT_TYPE
Nenue@0 635
Nenue@0 636 pin.itemNumber = rewardCount or pin.itemNumber
Nenue@0 637 pin.rewardType = rewardType or REWARD_ITEM
Nenue@0 638 pin.style = rewardStyle
Nenue@0 639 QuestsByID[questID] = pin
Nenue@0 640
Nenue@0 641 -- title, faction, capped state
Nenue@0 642 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
Nenue@0 643 if factionID then
Nenue@0 644 QuestsByFaction[factionID] = QuestsByFaction[factionID] or {}
Nenue@0 645 QuestsByFaction[factionID][questID] = pin
Nenue@0 646 end
Nenue@0 647 pin.title = questTitle or "|cFFFF0000Retrieving..."
Nenue@0 648 pin.factionID = factionID
Nenue@0 649 pin.capped = capped
Nenue@0 650
Nenue@0 651 -- set tag details
Nenue@0 652 local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID);
Nenue@0 653 local tagAtlas
Nenue@0 654 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
Nenue@0 655 tagAtlas = "worldquest-icon-petbattle"
Nenue@0 656 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
Nenue@0 657 tagAtlas = "worldquest-icon-pvp-ffa"
Nenue@0 658 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@0 659 local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex))
Nenue@0 660 if id then
Nenue@0 661 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
Nenue@0 662 end
Nenue@0 663 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
Nenue@0 664 tagAtlas = "worldquest-icon-dungeon"
Nenue@0 665 end
Nenue@0 666 pin.tagID = tagID
Nenue@0 667 pin.tagName = tagName
Nenue@0 668 pin.worldQuestType = worldQuestType
Nenue@0 669 pin.isElite = isElite
Nenue@0 670 pin.tradeskillLineIndex = tradeskillLineIndex
Nenue@0 671 pin.rarity = rarity
Nenue@0 672 pin.tagAtlas = tagAtlas
Nenue@0 673 end
Nenue@0 674
Nenue@0 675 -- flag unresolved info
Nenue@0 676 if not (rewardIcon and rewardName) then
Nenue@0 677 if not pin.isPending then
Nenue@0 678 pin.isPending = true
Nenue@0 679 TQ_RequestPreloadRewardData (questID)
Nenue@0 680 pin.rewardType = pin.rewardType or REWARD_ITEM
Nenue@0 681 pin.style = pin.style or POI_REWARD_TYPE[REWARD_ITEM]
Nenue@0 682
Nenue@0 683 if not hasPendingQuestData then
Nenue@0 684 hasPendingQuestData = true
Nenue@0 685 PlaySoundKitID(229)
Nenue@0 686 end
Nenue@0 687 --WorldPlan:print('|cFFFFFF00'..tostring(pin.title)..'|r waiting on texture info')
Nenue@0 688 end
Nenue@0 689 else
Nenue@0 690 if (rewardIcon and rewardName) then
Nenue@0 691 --WorldPlan:print('|cFF00FF00'..tostring(pin.title)..'|r has info', rewardIcon, rewardName)
Nenue@0 692 pin.hasUpdate = true
Nenue@0 693 end
Nenue@0 694 pin.isPending = nil
Nenue@0 695 end
Nenue@0 696 pin.itemTexture = rewardIcon or pin.itemTexture
Nenue@0 697 pin.itemName = rewardName or pin.itemName
Nenue@0 698
Nenue@0 699 qprint(' |cFF00FFFF'..questID..'|r:->', (HaveQuestData(questID) and "|cFF00FF00HaveQuestData" or "-"), (C_TaskQuest.IsActive(questID) and "|cFF88FF00IsActive|r" or ""))
Nenue@0 700 qprint(' ', pin.title, pin.itemTexture, 'rewardType:', pin.rewardType, 'tag:', pin.tagID, 'style', pin.style )
Nenue@0 701 end
Nenue@0 702 return QuestsByID[questID]
Nenue@0 703 end
Nenue@0 704
Nenue@0 705 function WorldQuests:Refresh(forced)
Nenue@0 706 print('pushing |cFF00FF88'..tostring(self)..':Refresh()|r')
Nenue@0 707 if not WorldMapPOIFrame:IsVisible() then
Nenue@0 708 return
Nenue@0 709 end
Nenue@0 710 self:Reset()
Nenue@0 711 self:UpdateAnchors()
Nenue@0 712 self:Cleanup ()
Nenue@0 713 end
Nenue@0 714
Nenue@0 715 -- prepares elements for a map update
Nenue@0 716 function WorldQuests:Reset ()
Nenue@0 717 wipe(QuestPositions)
Nenue@0 718 wipe(QuestsByReward)
Nenue@0 719 wipe(QuestsByTag)
Nenue@0 720 for questID, pin in pairs(QuestsByID) do
Nenue@0 721 pin.used = nil
Nenue@0 722 end
Nenue@0 723 qprint(tostring(self)..':|cFFFFFF00Reset()|r')
Nenue@0 724 end
Nenue@0 725
Nenue@0 726 -- update visibility states of all pins
Nenue@0 727 function WorldQuests:UpdateAnchors (submapID)
Nenue@0 728 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
Nenue@0 729 if isMicroDungeon then
Nenue@0 730 return
Nenue@0 731 end
Nenue@0 732
Nenue@0 733 local currentMap = GetCurrentMapAreaID()
Nenue@0 734 local submapID = submapID or currentMap
Nenue@0 735
Nenue@0 736 if submapID == BROKEN_ISLES_ID and (not DisplayContinentPins) then
Nenue@0 737 print('not updating map for reasons')
Nenue@0 738 return
Nenue@0 739 end
Nenue@0 740 print('|cFF88FF00'..tostring(self)..':UpdateAnchors|r', submapID, GetMapNameByID(submapID), 'pin count:', numPins)
Nenue@0 741 local numZones = MC_GetNumZones(submapID)
Nenue@0 742 if numZones then
Nenue@0 743 for i = 1, numZones do
Nenue@0 744 local subMapID = MC_GetZoneInfo(submapID, i)
Nenue@0 745 self:UpdateAnchors(subMapID)
Nenue@0 746 end
Nenue@0 747 end
Nenue@0 748 local pins = QuestsByZone[submapID]
Nenue@0 749
Nenue@0 750 if pins then
Nenue@0 751 local hostFrame = WorldMapPOIFrame
Nenue@0 752 local mapWidth, mapHeight = hostFrame:GetSize()
Nenue@0 753 for questID, pin in pairs(pins) do
Nenue@0 754 if pin:IsShowable(true) then
Nenue@0 755 pin:SetFrameLevel(PinBaseIndex+numPins)
Nenue@0 756 pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight)
Nenue@0 757 pin.used = true
Nenue@0 758 numPins = numPins + 1
Nenue@0 759 end
Nenue@0 760 end
Nenue@0 761 end
Nenue@0 762 end
Nenue@0 763
Nenue@0 764
Nenue@0 765
Nenue@0 766
Nenue@0 767 -- shows, animates, or hides pins based on their current visibility flags
Nenue@0 768 local debug_show = {}
Nenue@0 769 local debug_animate = {}
Nenue@0 770 local debug_hide = {}
Nenue@0 771 function WorldQuests:Cleanup ()
Nenue@0 772 local showQuestPOI = GetCVarBool("questPOI")
Nenue@0 773 print('|cFFFFFF00'..tostring(self)..':Cleanup()|r')
Nenue@0 774 wipe(QuestsByReward)
Nenue@0 775 wipe(QuestsByTag)
Nenue@0 776 wipe(debug_show)
Nenue@0 777 wipe(debug_animate)
Nenue@0 778 wipe(debug_hide)
Nenue@0 779 local mapID = GetCurrentMapAreaID()
Nenue@0 780 isContinentMap = (mapID == BROKEN_ISLES_ID)
Nenue@0 781
Nenue@0 782 -- continent or zone sizing
Nenue@0 783 local subStyle = isContinentMap and 'continent' or 'zone'
Nenue@0 784
Nenue@0 785 numPins = 0
Nenue@0 786 for questID, pin in pairs(QuestsByID) do
Nenue@0 787 -- can we show it?
Nenue@0 788 if showQuestPOI and (pin.used) then
Nenue@0 789 pin.subStyle = pin.filtered and 'minimized' or subStyle
Nenue@0 790 pin:GetSizeMetrics()
Nenue@0 791
Nenue@0 792
Nenue@0 793 -- is it a new quest?
Nenue@0 794 if pin.isNew then
Nenue@0 795 if not pin.isAnimating then
Nenue@0 796 pin.isAnimating = true
Nenue@0 797 OnNext(function()
Nenue@0 798 pin.isNew = nil
Nenue@0 799 pin:Show()
Nenue@0 800 pin.FadeIn:Play()
Nenue@0 801 end)
Nenue@0 802 if not notifyPlayed then
Nenue@1 803 for k,v in pairs(NotificationTypes) do
Nenue@1 804 if v[pin[k]] then
Nenue@1 805 notifyPlayed = true
Nenue@1 806 PlaySoundKitID(23404)
Nenue@1 807 end
Nenue@1 808 end
Nenue@0 809 end
Nenue@0 810 tinsert(debug_animate,questID)
Nenue@0 811 end
Nenue@1 812 -- trap new but animating pins here
Nenue@0 813 else
Nenue@0 814 -- hard show existing pin
Nenue@0 815 pin:Show()
Nenue@0 816 tinsert(debug_show,questID)
Nenue@0 817 end
Nenue@0 818 else
Nenue@0 819 pin:Hide()
Nenue@0 820 tinsert(debug_hide,questID)
Nenue@0 821 end
Nenue@0 822
Nenue@0 823 -- is it part of the current map?
Nenue@0 824 if pin.used then
Nenue@0 825 local rewardType = pin.rewardType
Nenue@0 826 local tagType = pin.worldQuestType
Nenue@0 827 if rewardType then
Nenue@0 828 QuestsByReward[rewardType] = QuestsByReward[rewardType] or {}
Nenue@0 829 tinsert(QuestsByReward[rewardType], pin)
Nenue@0 830 end
Nenue@0 831 if tagType then
Nenue@0 832 QuestsByTag[tagType] = QuestsByTag[tagType] or {}
Nenue@0 833 tinsert(QuestsByTag[tagType], pin)
Nenue@0 834 end
Nenue@0 835 end
Nenue@0 836 end
Nenue@0 837 print(' adding:', table.concat(debug_animate, ',' ))
Nenue@0 838 print(' showing:', table.concat(debug_show, ',' ))
Nenue@0 839 hasNewQuestPins = nil
Nenue@1 840 notifyPlayed = nil
Nenue@0 841 end
Nenue@0 842
Nenue@0 843 -- data provider manipulations for the taxi map
Nenue@0 844 WorldPlan.OnFlightMapLoaded = function()
Nenue@0 845 if true then return end
Nenue@0 846 -- todo: figure out how to layer inside the map canvas
Nenue@0 847 local res = {}
Nenue@0 848 local t = {}
Nenue@0 849 for k,v in pairs(FlightMapFrame) do
Nenue@0 850 tinsert(res, tostring(k))
Nenue@0 851 end
Nenue@0 852
Nenue@0 853 table.sort(res)
Nenue@0 854 for i, k in ipairs(res) do
Nenue@0 855 print(k)
Nenue@0 856 end
Nenue@0 857 hooksecurefunc(FlightMapFrame, 'RefreshAll', function(self)
Nenue@0 858 print('|cFF0088FFWQDP RefreshAllData ', GetTime())
Nenue@0 859
Nenue@0 860 WorldPlan:GetPinsForMap(self:GetMapID())
Nenue@0 861
Nenue@0 862 for pin in self:EnumerateAllPins() do
Nenue@0 863 if pin.worldQuest then
Nenue@0 864 --print('got pin #', pin.questID)
Nenue@0 865 local wp = QuestsByID[pin.questID]
Nenue@0 866 if wp then
Nenue@0 867 wp:ClearAllPoints()
Nenue@0 868 wp:SetParent(FlightMapFrame.ScrollContainer)
Nenue@0 869 wp:SetFrameStrata('MEDIUM')
Nenue@0 870 wp:SetPoint('CENTER', pin, 'CENTER')
Nenue@0 871 wp:Show()
Nenue@0 872 end
Nenue@0 873 end
Nenue@0 874 end
Nenue@0 875 end)
Nenue@0 876 end
Nenue@0 877
Nenue@0 878
Nenue@0 879
Nenue@0 880 local throttle = 0
Nenue@0 881 local tooltip = CreateFrame ("GameTooltip", "VeneerWorldQuestsScanner", nil, "GameTooltipTemplate")
Nenue@0 882 local tooltipLine1 = _G['VeneerWorldQuestsScannerTextLeft1']
Nenue@0 883 local tooltipLine3 = _G['VeneerWorldQuestsScannerTextLeft3']
Nenue@0 884 local GetTime, mod = GetTime, mod
Nenue@0 885
Nenue@0 886 function QuestPOI:OnLoad()
Nenue@0 887 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
Nenue@0 888 end
Nenue@0 889
Nenue@0 890 function QuestPOI:OnEvent(event, ...)
Nenue@0 891 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
Nenue@0 892 if self:IsVisible() then
Nenue@0 893 self:Refresh()
Nenue@0 894 end
Nenue@0 895 end
Nenue@0 896 end
Nenue@0 897
Nenue@0 898 local PIN_UPDATE_DELAY = .016
Nenue@0 899 local TOP_PIN_ID
Nenue@0 900 function QuestPOI:OnUpdate (sinceLast)
Nenue@0 901 -- control update check intervals
Nenue@0 902 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
Nenue@0 903 if self.throttle <= 0 then
Nenue@0 904 -- factor overtime into the throttle timer
Nenue@0 905 self.throttle = PIN_UPDATE_DELAY - self.throttle
Nenue@0 906 else
Nenue@0 907 return
Nenue@0 908 end
Nenue@0 909
Nenue@0 910 -- query for reward data if it wasn't found in the original scan
Nenue@0 911 local questID = self.questID
Nenue@0 912 if self.isPending then
Nenue@0 913 WorldQuests:GetPinByQuestID(questID)
Nenue@0 914 if not (self.PendingFade:IsPlaying() or self.isAnimating) then
Nenue@0 915 self.PendingFade:Play()
Nenue@0 916 end
Nenue@0 917 return
Nenue@0 918 else
Nenue@0 919 if self.PendingFade:IsPlaying() then
Nenue@0 920 self.PendingFade:Stop()
Nenue@0 921 end
Nenue@0 922 end
Nenue@0 923
Nenue@0 924 if self.hasUpdate then
Nenue@0 925 self:Refresh()
Nenue@0 926 self.hasUpdate = nil
Nenue@0 927 end
Nenue@0 928
Nenue@0 929 -- update time elements
Nenue@0 930 local tl = self.timeThreschold
Nenue@0 931 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
Nenue@0 932 if timeLeft > 0 then
Nenue@0 933 for i, context in ipairs(PIN_TIME_CONTEXT) do
Nenue@0 934 if i > self.TimeleftStage then
Nenue@0 935 self.timeLabel:SetText(nil)
Nenue@0 936 break
Nenue@0 937 end
Nenue@0 938
Nenue@0 939
Nenue@0 940 if timeLeft <= context.max then
Nenue@0 941 if tl ~= i then
Nenue@0 942 tl = i
Nenue@0 943 end
Nenue@0 944
Nenue@0 945 if context.format then
Nenue@0 946 self.timeLabel:SetText(context.format(timeLeft))
Nenue@0 947 else
Nenue@0 948 self.timeLabel:SetText(nil)
Nenue@0 949 end
Nenue@0 950 break
Nenue@0 951 end
Nenue@0 952 end
Nenue@0 953 else
Nenue@0 954 -- remove self in a timely manner
Nenue@0 955 if not self.isPending then
Nenue@0 956 self:Hide()
Nenue@0 957 end
Nenue@0 958 end
Nenue@0 959 self.timeThreschold = tl
Nenue@0 960
Nenue@0 961 if self:IsMouseOver() then
Nenue@0 962 self.MouseGlow:Show()
Nenue@0 963 else
Nenue@0 964 self.MouseGlow:Hide()
Nenue@0 965 end
Nenue@0 966 end
Nenue@0 967
Nenue@0 968 function QuestPOI:OnShow ()
Nenue@0 969 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow()')
Nenue@0 970 -- pop this on principle
Nenue@0 971 self:Refresh()
Nenue@0 972 end
Nenue@0 973 function QuestPOI:OnHide()
Nenue@0 974 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
Nenue@0 975 end
Nenue@0 976 function QuestPOI:Refresh ()
Nenue@0 977 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
Nenue@0 978 qprint(self.style)
Nenue@0 979
Nenue@0 980 local questID = self.questId
Nenue@0 981 local style = self.style
Nenue@0 982 local borderMask = style.mask
Nenue@0 983 local borderFill = style.texture
Nenue@0 984 local iconBorder = self.iconBorder
Nenue@0 985 local icon = self.icon
Nenue@0 986 local count = self.count
Nenue@0 987
Nenue@0 988 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
Nenue@0 989 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
Nenue@0 990 icon:SetAllPoints(self)
Nenue@0 991
Nenue@0 992 if self.itemName then
Nenue@0 993 local color = self.rewardColor or COMMON_COLOR
Nenue@0 994 if self.itemNumber and self.target then
Nenue@0 995 self.count:SetText(color.hex .. tostring(self.itemNumber))
Nenue@0 996 else
Nenue@0 997 self.count:SetText(nil)
Nenue@0 998 end
Nenue@0 999 end
Nenue@0 1000
Nenue@0 1001 SetMaskedTexture(iconBorder, borderFill, borderMask)
Nenue@0 1002 local border = (self.rewardType and POI_REWARD_TYPE[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or COMMON_COLOR)
Nenue@0 1003 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
Nenue@0 1004 iconBorder:SetDesaturated(true)
Nenue@0 1005
Nenue@0 1006 local trackingBorder = self.supertrackBorder
Nenue@0 1007
Nenue@0 1008 self.highlight:SetMask(nil)
Nenue@0 1009 if questID == GetSuperTrackedQuestID() then
Nenue@0 1010 trackingBorder:SetVertexColor(0,0,0,1)
Nenue@0 1011 else
Nenue@0 1012 trackingBorder:SetVertexColor(0,0,0,0.5)
Nenue@0 1013 end
Nenue@0 1014 self.highlight:SetAllPoints(trackingBorder)
Nenue@0 1015
Nenue@0 1016 SetMaskedTexture(trackingBorder, borderFill, borderMask)
Nenue@0 1017 self.highlight:SetMask(borderMask)
Nenue@0 1018
Nenue@0 1019 local qType = self.worldQuestType
Nenue@0 1020 self.tagIcon:SetAtlas(self.tagAtlas)
Nenue@0 1021 self.tagIcon:SetTexCoord(0,1,0,1)
Nenue@0 1022
Nenue@0 1023
Nenue@0 1024 if self.isElite then
Nenue@0 1025 self.EliteDecal:Show()
Nenue@0 1026 else
Nenue@0 1027 self.EliteDecal:Hide()
Nenue@0 1028 end
Nenue@0 1029
Nenue@0 1030 if style.showNumber then
Nenue@0 1031 self.label:SetText(self.itemNumber)
Nenue@0 1032 else
Nenue@0 1033 self.label:SetText(nil)
Nenue@0 1034 end
Nenue@0 1035 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
Nenue@0 1036 end
Nenue@0 1037
Nenue@0 1038 function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight)
Nenue@0 1039 self:ClearAllPoints()
Nenue@0 1040 local dX, dY = TQ_GetQuestLocation(self.questID, mapID)
Nenue@0 1041 if not dX or dX == 0 then
Nenue@0 1042 local _, x, y = QuestPOIGetIconInfo(self.questID)
Nenue@0 1043 if x and floor(x) ~= 0 then
Nenue@0 1044 dX, dY = x, y
Nenue@0 1045 else
Nenue@0 1046 dX, dY = self.x, self.y
Nenue@0 1047 end
Nenue@0 1048 end
Nenue@0 1049 self.x = dX
Nenue@0 1050 self.y = dY
Nenue@0 1051
Nenue@0 1052 print(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
Nenue@0 1053
Nenue@0 1054 local pX = (dX * mapWidth)
Nenue@0 1055 local pY = (-dY * mapHeight)
Nenue@0 1056
Nenue@0 1057 self:SetParent(WorldMapPOIFrame)
Nenue@0 1058 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
Nenue@0 1059 end
Nenue@0 1060
Nenue@0 1061
Nenue@0 1062 function QuestPOI:IsShowable (ignoreFilters)
Nenue@0 1063 local qType = self.worldQuestType
Nenue@0 1064 local rType = self.rewardType
Nenue@0 1065 self.filtered = nil
Nenue@0 1066 print(' |cFFFF4400IsShowable()|r', self.tradeskillLineIndex, self.title)
Nenue@0 1067
Nenue@0 1068 local whiteListed, blackListed
Nenue@0 1069 for filterKey, includes in pairs(FilterInclusions) do
Nenue@0 1070 local controlValue = self[filterKey]
Nenue@0 1071 if FilterInclusions[filterKey][controlValue] then
Nenue@0 1072 whiteListed = true
Nenue@0 1073 break
Nenue@0 1074 end
Nenue@0 1075 if FilterExclusions[filterKey][controlValue] then
Nenue@0 1076 blackListed = true
Nenue@0 1077 end
Nenue@0 1078 end
Nenue@0 1079 print(blackListed, whiteListed)
Nenue@0 1080 self.filtered = (blackListed and (not whiteListed))
Nenue@0 1081
Nenue@0 1082 if not TQ_IsActive(self.questID) then
Nenue@0 1083 print(' quest is dead')
Nenue@0 1084 return false
Nenue@0 1085 end
Nenue@0 1086 if qType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@0 1087
Nenue@0 1088 if not (ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
Nenue@0 1089 print(' non-profession')
Nenue@0 1090 return false
Nenue@0 1091 end
Nenue@0 1092 end
Nenue@0 1093 return true
Nenue@0 1094 end
Nenue@0 1095
Nenue@0 1096 function QuestPOI:UpdateTimer (timeLeft, timeType)
Nenue@0 1097 print('|cFF0088FFUpdatePinTimer()|r')
Nenue@0 1098 end
Nenue@0 1099
Nenue@0 1100 --- Re-acquires size information and triggers things
Nenue@0 1101 function QuestPOI:GetSizeMetrics (style, subStyle)
Nenue@0 1102 self.style = self.style or POI_DEFAULT_TYPE
Nenue@0 1103 self.subStyle = self.subStyle or 'continent'
Nenue@0 1104
Nenue@0 1105 style = style or self.style
Nenue@0 1106 subStyle = style[subStyle or self.subStyle]
Nenue@0 1107
Nenue@0 1108
Nenue@0 1109 self.currentWidth = subStyle.PinSize
Nenue@0 1110 self.borderSize = subStyle.Border
Nenue@0 1111 self.trackingBorderSize = subStyle.TrackingBorder
Nenue@0 1112 self.tagSize = subStyle.TagSize
Nenue@0 1113 self.TimeleftStage = subStyle.TimeleftStage
Nenue@0 1114 self.NoIcon = subStyle.NoIcon
Nenue@0 1115
Nenue@0 1116 self:SetSize(self.currentWidth, self.currentWidth)
Nenue@0 1117 end
Nenue@0 1118
Nenue@0 1119 -- triggered by OnSizeChanged script
Nenue@0 1120 function QuestPOI:OnSizeChanged ()
Nenue@0 1121 local iconBorder = self.iconBorder
Nenue@0 1122 local trackingBorder = self.supertrackBorder
Nenue@0 1123 local tag = self.tagIcon
Nenue@0 1124 local style = self.style or POI_DEFAULT_TYPE
Nenue@0 1125 local mask = style.mask or POI_BORDER_FILL
Nenue@0 1126
Nenue@0 1127 self.icon:SetMask(nil)
Nenue@0 1128 self.iconBorder:SetMask(nil)
Nenue@0 1129 self.supertrackBorder:SetMask(nil)
Nenue@0 1130
Nenue@0 1131
Nenue@0 1132 local borderWidth = self.borderSize
Nenue@0 1133 local trackingWidth = self.trackingBorderSize
Nenue@0 1134
Nenue@0 1135 iconBorder:ClearAllPoints()
Nenue@0 1136 iconBorder:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', -borderWidth + (style.x or 0), -borderWidth + (style.y or 0))
Nenue@0 1137 iconBorder:SetPoint('TOPRIGHT', self, 'TOPRIGHT', borderWidth + (style.x or 0), borderWidth + (style.y or 0))
Nenue@0 1138
Nenue@0 1139 trackingBorder:ClearAllPoints()
Nenue@0 1140 trackingBorder:SetPoint('BOTTOMLEFT', iconBorder, 'BOTTOMLEFT', -trackingWidth, -trackingWidth)
Nenue@0 1141 trackingBorder:SetPoint('TOPRIGHT', iconBorder, 'TOPRIGHT', trackingWidth, trackingWidth)
Nenue@0 1142
Nenue@0 1143 if self.tagSize then
Nenue@0 1144 tag:Show()
Nenue@0 1145 tag:ClearAllPoints()
Nenue@0 1146 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth)
Nenue@0 1147 else
Nenue@0 1148 tag:Hide()
Nenue@0 1149 end
Nenue@0 1150
Nenue@0 1151 self.icon:SetMask(mask)
Nenue@0 1152 self.iconBorder:SetMask(mask)
Nenue@0 1153 self.supertrackBorder:SetMask(mask)
Nenue@0 1154
Nenue@0 1155 if self.NoIcon then
Nenue@0 1156 self.icon:Hide()
Nenue@0 1157 else
Nenue@0 1158 self.icon:Show()
Nenue@0 1159 end
Nenue@0 1160
Nenue@0 1161 end
Nenue@0 1162
Nenue@0 1163
Nenue@0 1164
Nenue@0 1165 function FilterBar:OnEvent(event)
Nenue@0 1166 if event == 'QUEST_LOG_UPDATE' then
Nenue@0 1167 self:Refresh()
Nenue@0 1168 end
Nenue@0 1169 end
Nenue@0 1170
Nenue@0 1171 function FilterBar:PassesFilterSet(filterKey, pin)
Nenue@0 1172 local passesFilter = true
Nenue@0 1173 for filterKey, filters in pairs(QuestFilters) do
Nenue@0 1174 for rewardType, value in pairs(QuestFilters[filterKey]) do
Nenue@0 1175 if value == 1 and rewardType == pin[filterKey] then
Nenue@0 1176 passesFilter = true
Nenue@0 1177 elseif value == -1 and rewardType == pin[filterKey] then
Nenue@0 1178 passesFilter = false
Nenue@0 1179 end
Nenue@0 1180 end
Nenue@0 1181 end
Nenue@0 1182 return passesFilter
Nenue@0 1183 end
Nenue@0 1184
Nenue@0 1185 local debug_headers = {}
Nenue@0 1186 function FilterBar:Refresh()
Nenue@0 1187 local mapID = GetCurrentMapAreaID()
Nenue@0 1188 local blocks = self.SummaryHeaders
Nenue@0 1189 local numHeaders = 0
Nenue@0 1190 local lastButton
Nenue@0 1191 local pinSize, borderSize, trackingSize = 20, 2, 2
Nenue@0 1192 print('|cFF00FF88'..tostring(self)..':Refresh()|r')
Nenue@0 1193 for index, info in pairs(POI_FILTER_OPTIONS) do
Nenue@0 1194 local numQuests = 0
Nenue@0 1195 local quests = QuestsByZone[mapID] or QuestsByID
Nenue@0 1196
Nenue@0 1197 for questID, pin in pairs(quests) do
Nenue@0 1198 if pin.used then
Nenue@0 1199 if not info.filterKey then
Nenue@0 1200 numQuests = numQuests + 1
Nenue@0 1201 elseif pin[info.filterKey] == info.filterValue then
Nenue@0 1202 numQuests = numQuests + 1
Nenue@0 1203 end
Nenue@0 1204 end
Nenue@0 1205 end
Nenue@0 1206 print(tostring(index).. ' ("'..tostring(info.label)..'"'.. tostring(rewardFilter).. ', '..tostring(tagFilter) .. ', '..tostring(numQuests)..')')
Nenue@0 1207
Nenue@0 1208 if numQuests >= 1 then
Nenue@0 1209 numHeaders = numHeaders + 1
Nenue@0 1210 local button = blocks[numHeaders]
Nenue@0 1211 if not blocks[numHeaders] then
Nenue@0 1212 button = CreateFrame('Button', 'WorldPlanFilterButton'..numHeaders, WorldMapScrollFrame, 'WorldPlanFilterPin')
Nenue@0 1213 button.iconBorder:SetTexture(info.fill or POI_BORDER_FILL)
Nenue@0 1214 button.iconBorder:SetMask(info.mask or POI_BORDER_MASK)
Nenue@0 1215 button.iconBorder:SetDesaturated(info.desaturated)
Nenue@0 1216 button.supertrackBorder:SetTexture(info.fill or POI_BORDER_FILL)
Nenue@0 1217 button.supertrackBorder:SetMask(info.mask or POI_BORDER_MASK)
Nenue@0 1218 button.supertrackBorder:SetDesaturated(true)
Nenue@0 1219 blocks[numHeaders] = button
Nenue@0 1220 end
Nenue@0 1221
Nenue@0 1222 button:SetID(index)
Nenue@0 1223 button.lastButton = lastButton
Nenue@0 1224 button:Refresh(info, (numHeaders == 1), numQuests)
Nenue@0 1225 button:Show()
Nenue@0 1226 lastButton = button
Nenue@0 1227 end
Nenue@0 1228
Nenue@0 1229 end
Nenue@0 1230 -- hide trailing buttons
Nenue@0 1231 for i = numHeaders + 1, #POI_FILTER_OPTIONS do
Nenue@0 1232 if blocks[i] then
Nenue@0 1233 blocks[i]:Hide()
Nenue@0 1234 end
Nenue@0 1235 end
Nenue@0 1236 end
Nenue@0 1237
Nenue@0 1238
Nenue@0 1239 function FilterPin:Refresh(info, isFirst, numQuests)
Nenue@0 1240 info = info or POI_FILTER_OPTIONS[self:GetID()]
Nenue@0 1241 isFirst = isFirst or self.isFirst
Nenue@0 1242 numQuests = numQuests or self.numQuests
Nenue@0 1243
Nenue@0 1244 self.isFirst = isFirst
Nenue@0 1245 self.numQuests = numQuests
Nenue@0 1246 self.filterKey = info.filterKey
Nenue@0 1247 self.filterValue = info.filterValue
Nenue@0 1248 self.tagID = info.tagID
Nenue@0 1249
Nenue@0 1250 self.icon:ClearAllPoints()
Nenue@0 1251 self.icon:SetTexture(info.texture)
Nenue@0 1252 self.icon:SetAllPoints(self)
Nenue@0 1253 self.supertrackBorder:Hide()
Nenue@0 1254 self.label:SetText(numQuests)
Nenue@0 1255 self:Show()
Nenue@0 1256
Nenue@0 1257
Nenue@0 1258 if isFirst then
Nenue@0 1259 self:SetPoint('TOP', WorldMapFrame.UIElementsFrame.TrackingOptionsButton, 'BOTTOM', 0, -5)
Nenue@0 1260 else
Nenue@0 1261 self:SetPoint('TOPRIGHT', self.lastButton, 'BOTTOMRIGHT', 0, -(3*2 + 1 + (info.spacing or 0)))
Nenue@0 1262 end
Nenue@0 1263
Nenue@0 1264 print(self.filterKey, self.filterValue)
Nenue@0 1265 local r, g, b, a = 1,1,1,1
Nenue@0 1266 if self.filterKey then
Nenue@0 1267 if FilterInclusions[self.filterKey][self.filterValue] == true then
Nenue@0 1268 r, g, b = 0, 1, 0
Nenue@0 1269 elseif FilterExclusions[self.filterKey][self.filterValue] then
Nenue@0 1270 r, g, b = 1, 0, 0
Nenue@0 1271 end
Nenue@0 1272 end
Nenue@0 1273 self.iconBorder:SetVertexColor(r, g, b, a)
Nenue@0 1274
Nenue@0 1275
Nenue@0 1276 self:GetSizeMetrics()
Nenue@0 1277 end
Nenue@0 1278
Nenue@0 1279 function FilterPin:OnLoad()
Nenue@0 1280 self:RegisterForClicks('AnyUp')
Nenue@0 1281 self:SetFrameStrata('HIGH')
Nenue@0 1282 self:SetFrameLevel(151)
Nenue@0 1283 self:SetScript('OnUpdate', nil)
Nenue@0 1284 end
Nenue@0 1285
Nenue@0 1286 function FilterPin:OnUpdate ()
Nenue@0 1287
Nenue@0 1288 end
Nenue@0 1289
Nenue@0 1290 function FilterPin:OnEnter ()
Nenue@0 1291 local filter = POI_FILTER_OPTIONS[self:GetID()]
Nenue@0 1292 local mapID = GetCurrentMapAreaID()
Nenue@0 1293 local quests = (mapID == BROKEN_ISLES_ID) and QuestsByID or QuestsByZone[mapID]
Nenue@0 1294 if quests then
Nenue@0 1295 GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
Nenue@0 1296 GameTooltip:AddLine(filter.label)
Nenue@0 1297 local filterKey = self.filterKey
Nenue@0 1298 local filterValue = self.filterValue
Nenue@0 1299 if filterKey then
Nenue@0 1300 for questID, pin in pairs(quests) do
Nenue@0 1301 if pin.used and not pin.filtered then
Nenue@0 1302 if pin[filterKey] == filterValue then
Nenue@0 1303 local style = pin.style or POI_FILTER_STYLE
Nenue@0 1304 GameTooltip:AddLine(pin.title)
Nenue@0 1305 end
Nenue@0 1306 end
Nenue@0 1307 end
Nenue@0 1308 else
Nenue@0 1309 GameTooltip:AddLine('Reset all filters')
Nenue@0 1310 end
Nenue@0 1311 GameTooltip:Show()
Nenue@0 1312 end
Nenue@0 1313 end
Nenue@0 1314 function FilterPin:OnLeave ()
Nenue@0 1315 if GameTooltip:IsOwned(self) then
Nenue@0 1316 GameTooltip:Hide()
Nenue@0 1317 end
Nenue@0 1318 end
Nenue@0 1319
Nenue@0 1320 -- shift-click: reset filter
Nenue@0 1321 -- click: rotate through include(1), exclude(-1), ignore(nil)
Nenue@0 1322 function FilterPin:OnClick (button)
Nenue@0 1323 local filterKey = self.filterKey
Nenue@0 1324 local filterValue = self.filterValue
Nenue@0 1325
Nenue@0 1326 print('click', filterKey, filterValue)
Nenue@0 1327
Nenue@0 1328 if not filterKey then
Nenue@0 1329 -- resetting
Nenue@0 1330 for k,v in pairs(FilterInclusions) do
Nenue@0 1331 wipe(v)
Nenue@0 1332 end
Nenue@0 1333 for k,v in pairs(FilterExclusions) do
Nenue@0 1334 wipe(v)
Nenue@0 1335 end
Nenue@0 1336 else
Nenue@0 1337 local setExclude = (button == 'RightButton')
Nenue@0 1338 if IsControlKeyDown() then
Nenue@0 1339 if setExclude then
Nenue@0 1340 if FilterExclusions[filterKey][filterValue] then
Nenue@0 1341 FilterExclusions[filterKey][filterValue] = nil
Nenue@0 1342 else
Nenue@0 1343 FilterExclusions[filterKey][filterValue] = true
Nenue@0 1344 end
Nenue@0 1345 FilterInclusions[filterKey][filterValue] = nil
Nenue@0 1346 else
Nenue@0 1347 if FilterInclusions[filterKey][filterValue] == true then
Nenue@0 1348 FilterInclusions[filterKey][filterValue] = nil
Nenue@0 1349 else
Nenue@0 1350 FilterInclusions[filterKey][filterValue] = true
Nenue@0 1351 end
Nenue@0 1352 FilterExclusions[filterKey][filterValue] = nil
Nenue@0 1353 end
Nenue@0 1354 elseif IsShiftKeyDown() then
Nenue@0 1355 FilterInclusions[filterKey][filterValue] = nil
Nenue@0 1356 FilterExclusions[filterKey][filterValue] = nil
Nenue@0 1357 else
Nenue@0 1358 print('limit to', filterKey, filterValue)
Nenue@0 1359 if setExclude then
Nenue@0 1360 FilterExclusions[filterKey][filterValue] = true
Nenue@0 1361 FilterInclusions[filterKey][filterValue] = nil
Nenue@0 1362 else
Nenue@0 1363 FilterInclusions[filterKey][filterValue] = true
Nenue@0 1364 FilterExclusions[filterKey][filterValue] = nil
Nenue@0 1365 end
Nenue@0 1366
Nenue@0 1367 for k, info in ipairs(POI_FILTER_OPTIONS) do
Nenue@0 1368 if info.filterKey and ((info.filterKey ~= filterKey) or (info.filterValue ~= filterValue)) then
Nenue@0 1369 if setExclude then
Nenue@0 1370 FilterExclusions[info.filterKey][info.filterValue] = nil
Nenue@0 1371 FilterInclusions[info.filterKey][info.filterValue] = true
Nenue@0 1372 else
Nenue@0 1373 FilterExclusions[info.filterKey][info.filterValue] = true
Nenue@0 1374 FilterInclusions[info.filterKey][info.filterValue] = nil
Nenue@0 1375 end
Nenue@0 1376
Nenue@0 1377 end
Nenue@0 1378 end
Nenue@0 1379
Nenue@0 1380 end
Nenue@0 1381 end
Nenue@0 1382
Nenue@0 1383
Nenue@0 1384 WorldPlan:RefreshAll()
Nenue@0 1385 end
Nenue@0 1386
Nenue@0 1387 --%debug%
Nenue@0 1388 local SetTimedCallbackForAllPins = function(seconds, callback)
Nenue@0 1389 C_Timer.After(seconds, function()
Nenue@0 1390 for id, pin in pairs(QuestsByID) do
Nenue@0 1391 callback(pin)
Nenue@0 1392 end
Nenue@0 1393 end)
Nenue@0 1394 end
Nenue@0 1395
Nenue@0 1396 SLASH_WORLDPLAN1 = "/worldplan"
Nenue@0 1397 SLASH_WORLDPLAN2 = "/wp"
Nenue@0 1398 SlashCmdList.WORLDPLAN = function()
Nenue@0 1399 print('command pop')
Nenue@0 1400 WorldPlan:GetPinsForMap()
Nenue@0 1401 WorldPlan:RefreshPins()
Nenue@0 1402
Nenue@0 1403 SetTimedCallbackForAllPins(0, function(self) self.FadeIn:Play() self.FlashIn:Play() end)
Nenue@0 1404 SetTimedCallbackForAllPins(5, function(self) self.PendingFade:Play() end)
Nenue@0 1405 SetTimedCallbackForAllPins(8, function(self) self.PendingFade:Stop() end)
Nenue@0 1406 end
Nenue@0 1407 --%end-debug%
Nenue@0 1408
Nenue@0 1409 for mapID, mapName in pairs(WORLD_QUEST_MAPS) do
Nenue@0 1410 QuestsByZone[mapID] = {}
Nenue@0 1411 end
Nenue@0 1412 for index, color in pairs(ITEM_QUALITY_COLORS) do
Nenue@0 1413 POI_REWARD_TYPE[index] = {
Nenue@0 1414 r = color.r, g = color.g, b = color.b,
Nenue@0 1415 hex = color.hex,
Nenue@0 1416 }
Nenue@0 1417 end