annotate WorldPlan.lua @ 27:4a7e89bffbcb r27-beta

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